]> source.dussan.org Git - poi.git/commitdiff
Fix some Findbugs reports
authorDominik Stadler <centic@apache.org>
Sat, 31 Dec 2016 09:43:08 +0000 (09:43 +0000)
committerDominik Stadler <centic@apache.org>
Sat, 31 Dec 2016 09:43:08 +0000 (09:43 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1776714 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
src/scratchpad/src/org/apache/poi/hwmf/record/HwmfBitmap16.java

index cc482536b54412f7bf8d6f218f281584f65623ab..84f345504d32c58fbf208b5c6ba27ec7b16246b3 100644 (file)
 
 package org.apache.poi.poifs.filesystem;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
 
 import org.apache.poi.poifs.dev.POIFSViewable;
 import org.apache.poi.util.CloseIgnoringInputStream;
@@ -152,10 +149,16 @@ public class POIFSFileSystem
         // TODO Make this nicer!
         // Create a new empty POIFS in the file
         POIFSFileSystem tmp = new POIFSFileSystem();
-        FileOutputStream fout = new FileOutputStream(file);
-        tmp.writeFilesystem(fout);
-        fout.close();
-        tmp.close();
+        try {
+            OutputStream out = new FileOutputStream(file);
+            try {
+                tmp.writeFilesystem(out);
+            } finally {
+                out.close();
+            }
+        } finally {
+            tmp.close();
+        }
         
         // Open it up again backed by the file
         return new POIFSFileSystem(file, false);
@@ -166,14 +169,9 @@ public class POIFSFileSystem
      *
      * @param args names of the files; arg[ 0 ] is the input file,
      *             arg[ 1 ] is the output file
-     *
-     * @exception IOException
      */
-
-    public static void main(String args[])
-        throws IOException
+    public static void main(String args[]) throws IOException
     {
         OPOIFSFileSystem.main(args);
     }
 }
-
index 3a774af2e4df965c37b2dae0e4d7f4a24997ace6..6212a0d6ab4b85250a558dfead236b21459de2ae 100644 (file)
@@ -74,8 +74,7 @@ public class HwmfBitmap16 {
         }\r
 \r
         int length = (((width * bitsPixel + 15) >> 4) << 1) * height;\r
-        @SuppressWarnings("unused")\r
-        byte buf[] = IOUtils.toByteArray(leis, length);\r
+        /*byte buf[] =*/ IOUtils.toByteArray(leis, length);\r
         \r
         // TODO: this is not implemented ... please provide a sample, if it\r
         // ever happens to you, to come here ...\r