Resource leak: This FileReader is not closed on method exit

Description

From eamonn.w...@gmail.com on November 26, 2013 14:10:51

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: http://code.google.com/p/owasp-esapi-java/issues/detail?id=312

Environment

None

Status

Assignee

Unassigned

Reporter

Max Gelman

Priority

Configure