close input stream
@@ -100,11 +100,16 @@ public class FileHelper
{
try {
InputStream inputStream = new FileInputStream(fileName);
- return getFileCompressType(inputStream);
+ String fileType = getFileCompressType(inputStream);
+ inputStream.close();
+ return fileType;
}
catch (FileNotFoundException e) {
throw new RuntimeException("File not found: " + fileName, e);
}
+ catch (IOException e) {
+ throw new RuntimeException("close file failed: ", e);
+ }
}
public static String getFileCompressType(InputStream inputStream)
