You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2012/03/06 23:39:34 UTC
svn commit: r1297769 -
/tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java
Author: markt
Date: Tue Mar 6 22:39:33 2012
New Revision: 1297769
URL: http://svn.apache.org/viewvc?rev=1297769&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52731
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/org/apache/jasper/compiler/JDTCompiler.java
Modified: tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java?rev=1297769&r1=1297768&r2=1297769&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java Tue Mar 6 22:39:33 2012
@@ -107,12 +107,13 @@ public class JDTCompiler extends org.apa
public char[] getContents() {
char[] result = null;
FileInputStream is = null;
+ InputStreamReader isr = null;
Reader reader = null;
try {
is = new FileInputStream(sourceFile);
-
- reader = new BufferedReader(new InputStreamReader(is,
- ctxt.getOptions().getJavaEncoding()));
+ isr = new InputStreamReader(is,
+ ctxt.getOptions().getJavaEncoding());
+ reader = new BufferedReader(isr);
char[] chars = new char[8192];
StringBuilder buf = new StringBuilder();
int count;
@@ -130,6 +131,11 @@ public class JDTCompiler extends org.apa
reader.close();
} catch (IOException ioe) {/*Ignore*/}
}
+ if (isr != null) {
+ try {
+ isr.close();
+ } catch (IOException ioe) {/*Ignore*/}
+ }
if (is != null) {
try {
is.close();
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org