close the InputStream for property file loading explicitly

instead of relying on the stream's finalize method
This commit is contained in:
Lars Kühne 2003-01-21 06:23:45 +00:00
parent a7d9874074
commit a16368d3f8
1 changed files with 16 additions and 1 deletions

View File

@ -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