Clean up open streams, issue #778
All violations of Fildbugs rule [OBL: Method may fail to clean up stream or resource](http://findbugs.sourceforge.net/bugDescriptions.html#OBL_UNSATISFIED_OBLIGATION) are fixed.
This commit is contained in:
parent
a135b0952a
commit
ca1c33e311
|
|
@ -273,9 +273,8 @@ public final class Main
|
|||
private static Properties loadProperties(File file)
|
||||
{
|
||||
final Properties properties = new Properties();
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
fis = new FileInputStream(file);
|
||||
|
||||
try (final FileInputStream fis = new FileInputStream(file)) {
|
||||
properties.load(fis);
|
||||
}
|
||||
catch (final IOException ex) {
|
||||
|
|
@ -284,9 +283,6 @@ public final class Main
|
|||
ex.printStackTrace(System.out);
|
||||
System.exit(1);
|
||||
}
|
||||
finally {
|
||||
Utils.closeQuietly(fis);
|
||||
}
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,8 +64,14 @@ public class UniquePropertiesCheck extends AbstractFileSetCheck
|
|||
final UniqueProperties properties = new UniqueProperties();
|
||||
|
||||
try {
|
||||
// As file is already read, there should not be any exceptions.
|
||||
properties.load(new FileInputStream(file));
|
||||
final FileInputStream fileInputStream = new FileInputStream(file);
|
||||
try {
|
||||
// As file is already read, there should not be any exceptions.
|
||||
properties.load(fileInputStream);
|
||||
}
|
||||
finally {
|
||||
fileInputStream.close();
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
log(0, IO_EXCEPTION_KEY, file.getPath(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue