Author: markt
Date: Sun Jun 24 04:45:44 2007
New Revision: 550210
URL: http://svn.apache.org/viewvc?view=rev&rev=550210
Log:
Close streams as noted in bug 42314.
Modified:
tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java
Modified:
tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java
URL:
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java?view=diff&rev=550210&r1=550209&r2=550210
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java
Sun Jun 24 04:45:44 2007
@@ -94,13 +94,16 @@
this.jspBeginLineNum = jspBeginLineNum;
if (jspBeginLineNum > 0 && ctxt != null) {
+ InputStream is = null;
+ FileInputStream fis = null;
+
try {
// Read both files in, so we can inspect them
- String[] jspLines = readFile
- (ctxt.getResourceAsStream(jspFileName));
+ is = ctxt.getResourceAsStream(jspFileName);
+ String[] jspLines = readFile(is);
- String[] javaLines = readFile
- (new FileInputStream(ctxt.getServletJavaFileName()));
+ fis = new FileInputStream(ctxt.getServletJavaFileName());
+ String[] javaLines = readFile(fis);
// If the line contains the opening of a multi-line scriptlet
// block, then the JSP line number we got back is probably
@@ -134,6 +137,21 @@
} catch (IOException ioe) {
// Can't read files - ignore
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException ioe) {
+ // Ignore
+ }
+ }
+ if (fis != null) {
+ try {
+ fis.close();
+ } catch (IOException ioe) {
+ // Ignore
+ }
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]