Fix some Findbugs reports

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1776714 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2016-12-31 09:43:08 +00:00
parent 8e1a75912e
commit b2a4c75665
2 changed files with 13 additions and 16 deletions

View File

@ -19,10 +19,7 @@
package org.apache.poi.poifs.filesystem; package org.apache.poi.poifs.filesystem;
import java.io.File; import java.io.*;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.poi.poifs.dev.POIFSViewable; import org.apache.poi.poifs.dev.POIFSViewable;
import org.apache.poi.util.CloseIgnoringInputStream; import org.apache.poi.util.CloseIgnoringInputStream;
@ -152,10 +149,16 @@ public class POIFSFileSystem
// TODO Make this nicer! // TODO Make this nicer!
// Create a new empty POIFS in the file // Create a new empty POIFS in the file
POIFSFileSystem tmp = new POIFSFileSystem(); POIFSFileSystem tmp = new POIFSFileSystem();
FileOutputStream fout = new FileOutputStream(file); try {
tmp.writeFilesystem(fout); OutputStream out = new FileOutputStream(file);
fout.close(); try {
tmp.writeFilesystem(out);
} finally {
out.close();
}
} finally {
tmp.close(); tmp.close();
}
// Open it up again backed by the file // Open it up again backed by the file
return new POIFSFileSystem(file, false); return new POIFSFileSystem(file, false);
@ -166,14 +169,9 @@ public class POIFSFileSystem
* *
* @param args names of the files; arg[ 0 ] is the input file, * @param args names of the files; arg[ 0 ] is the input file,
* arg[ 1 ] is the output 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); OPOIFSFileSystem.main(args);
} }
} }

View File

@ -74,8 +74,7 @@ public class HwmfBitmap16 {
} }
int length = (((width * bitsPixel + 15) >> 4) << 1) * height; int length = (((width * bitsPixel + 15) >> 4) << 1) * height;
@SuppressWarnings("unused") /*byte buf[] =*/ IOUtils.toByteArray(leis, length);
byte buf[] = IOUtils.toByteArray(leis, length);
// TODO: this is not implemented ... please provide a sample, if it // TODO: this is not implemented ... please provide a sample, if it
// ever happens to you, to come here ... // ever happens to you, to come here ...