OSDN Git Service

streamクローズ忘れ
authoryukihane <yukihane.feather@gmail.com>
Wed, 21 Sep 2011 05:29:43 +0000 (14:29 +0900)
committeryukihane <yukihane.feather@gmail.com>
Wed, 21 Sep 2011 07:57:02 +0000 (16:57 +0900)
src/nicobrowser/NicoHttpClient.java

index 70420d5..687d649 100644 (file)
@@ -909,6 +909,7 @@ public class NicoHttpClient {
     public File getCommentFile(VideoInfo vi, String fileName, EnumSet<DownloadCommentType> types,
             WayBackInfo wayback, int commentNum) throws Exception {
         HttpResponse response = null;
+        BufferedInputStream bis = null;
         BufferedOutputStream bos = null;
 
         try {
@@ -935,7 +936,7 @@ public class NicoHttpClient {
             post.setEntity(se);
             response = http.execute(post);
             final InputStream is = response.getEntity().getContent();
-            final BufferedInputStream bis = new BufferedInputStream(is);
+            bis = new BufferedInputStream(is);
 
             final String outputFileName = (fileName.endsWith(".xml")) ? fileName : fileName + ".xml";
             bos = new BufferedOutputStream(new FileOutputStream(outputFileName));
@@ -953,6 +954,9 @@ public class NicoHttpClient {
             if (response != null) {
                 EntityUtils.consume(response.getEntity());
             }
+            if (bis != null) {
+                bis.close();
+            }
             if (bos != null) {
                 bos.close();
             }