close the InputStream for property file loading explicitly
instead of relying on the stream's finalize method
This commit is contained in:
parent
a7d9874074
commit
a16368d3f8
|
|
@ -276,8 +276,10 @@ public class CheckStyleTask
|
|||
|
||||
// Load the properties file if specified
|
||||
if (mPropertiesFile != null) {
|
||||
FileInputStream inStream = null;
|
||||
try {
|
||||
retVal.load(new FileInputStream(mPropertiesFile));
|
||||
inStream = new FileInputStream(mPropertiesFile);
|
||||
retVal.load(inStream);
|
||||
}
|
||||
catch (FileNotFoundException e) {
|
||||
throw new BuildException(
|
||||
|
|
@ -289,6 +291,19 @@ public class CheckStyleTask
|
|||
"Error loading Properties file '" + mPropertiesFile + "'",
|
||||
e, getLocation());
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
if (inStream != null) {
|
||||
inStream.close();
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new BuildException(
|
||||
"Error closing Properties file '"
|
||||
+ mPropertiesFile + "'",
|
||||
e, getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now override the properties specified
|
||||
|
|
|
|||
Loading…
Reference in New Issue