Resource leak: This FileReader is not closed on method exit
GoogleCodeExporter opened this issue · comments
Google Code Exporter commented
I have V2.1 sources.
BeanShellRule.java keeps a file open, the fix is as follows:
private String getFileContents(File f) throws IOException {
StringBuffer sb = new StringBuffer();
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(f));
String line;
while ((line = br.readLine()) != null) {
sb.append(line + System.getProperty("line.separator"));
}
} finally {
if (br != null) {
br.close();
}
}
return sb.toString();
}
Original issue reported on code.google.com by eamonn.w...@gmail.com
on 26 Nov 2013 at 7:10