Author: markt Date: Tue Mar 6 22:56:31 2012 New Revision: 1297778 URL: http://svn.apache.org/viewvc?rev=1297778&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52732 Clean-up code. Fixes potential resource leak although the problems that would trigger the leak are far more serious than the leak.
Modified: tomcat/trunk/java/javax/el/ExpressionFactory.java Modified: tomcat/trunk/java/javax/el/ExpressionFactory.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/el/ExpressionFactory.java?rev=1297778&r1=1297777&r2=1297778&view=diff ============================================================================== --- tomcat/trunk/java/javax/el/ExpressionFactory.java (original) +++ tomcat/trunk/java/javax/el/ExpressionFactory.java Tue Mar 6 22:56:31 2012 @@ -227,8 +227,10 @@ public abstract class ExpressionFactory if (is != null) { String line = null; BufferedReader br = null; + InputStreamReader isr = null; try { - br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + isr = new InputStreamReader(is, "UTF-8"); + br = new BufferedReader(isr); line = br.readLine(); if (line != null && line.trim().length() > 0) { return line.trim(); @@ -246,6 +248,11 @@ public abstract class ExpressionFactory } } catch (IOException ioe) {/*Ignore*/} try { + if (isr != null) { + isr.close(); + } + } catch (IOException ioe) {/*Ignore*/} + try { is.close(); } catch (IOException ioe) {/*Ignore*/} } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org