kinman 2004/08/16 15:35:38 Modified: jasper2/src/share/org/apache/jasper/compiler JspDocumentParser.java ParserController.java Log: - Close any InputStream open in JspDocumentParser. Revision Changes Path 1.83 +24 -37 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java Index: JspDocumentParser.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java,v retrieving revision 1.82 retrieving revision 1.83 diff -u -r1.82 -r1.83 --- JspDocumentParser.java 13 Jul 2004 20:38:56 -0000 1.82 +++ JspDocumentParser.java 16 Aug 2004 22:35:37 -0000 1.83 @@ -18,6 +18,8 @@ import java.io.CharArrayWriter; import java.io.FileNotFoundException; import java.io.IOException; +import java.io.InputStream; + import java.util.Iterator; import java.util.List; import java.util.jar.JarFile; @@ -166,24 +168,32 @@ // Parse the input SAXParser saxParser = getSAXParser(false, jspDocParser); + InputStream inStream = null; try { - saxParser.parse( - jspDocParser.getInputSource( - path, - jarFile, - jspDocParser.ctxt, - jspDocParser.err), - jspDocParser); + inStream = JspUtil.getInputStream(path, jarFile, + jspDocParser.ctxt, + jspDocParser.err); + saxParser.parse(new InputSource(inStream), jspDocParser); } catch (EnableDTDValidationException e) { saxParser = getSAXParser(true, jspDocParser); jspDocParser.isValidating = true; - saxParser.parse( - jspDocParser.getInputSource( - path, - jarFile, - jspDocParser.ctxt, - jspDocParser.err), - jspDocParser); + if (inStream != null) { + try { + inStream.close(); + } catch (Exception any) { + } + } + inStream = JspUtil.getInputStream(path, jarFile, + jspDocParser.ctxt, + jspDocParser.err); + saxParser.parse(new InputSource(inStream), jspDocParser); + } finally { + if (inStream != null) { + try { + inStream.close(); + } catch (Exception any) { + } + } } if (parent == null) { @@ -1369,29 +1379,6 @@ xmlReader.setErrorHandler(jspDocParser); return saxParser; - } - - /* - * Gets an InputSource to the JSP document or tag file to be parsed. - * - * @param path The path to the JSP document or tag file to be parsed - * @param jarFile The JAR file from which to read the JSP document or tag - * file, or null if the JSP document or tag file is to be read from the - * filesystem - * @param ctxt The JSP compilation context - * @param err The error dispatcher - * - * @return An InputSource to the requested JSP document or tag file - */ - private InputSource getInputSource( - String path, - JarFile jarFile, - JspCompilationContext ctxt, - ErrorDispatcher err) - throws Exception { - - return new InputSource( - JspUtil.getInputStream(path, jarFile, ctxt, err)); } /* 1.54 +8 -16 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ParserController.java Index: ParserController.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ParserController.java,v retrieving revision 1.53 retrieving revision 1.54 diff -u -r1.53 -r1.54 --- ParserController.java 12 Jul 2004 22:54:33 -0000 1.53 +++ ParserController.java 16 Aug 2004 22:35:37 -0000 1.54 @@ -192,22 +192,14 @@ // Dispatch to the appropriate parser if (isXml) { // JSP document (XML syntax) - InputStream inStream = null; - try { - parsedPage = JspDocumentParser.parse(this, absFileName, - jarFile, parent, - isTagFile, directiveOnly, - sourceEnc, - jspConfigPageEnc, - isEncodingSpecifiedInProlog); - } finally { - if (inStream != null) { - try { - inStream.close(); - } catch (Exception any) { - } - } - } + // InputStream for jspx page is created and properly closed in + // JspDocumentParser. + parsedPage = JspDocumentParser.parse(this, absFileName, + jarFile, parent, + isTagFile, directiveOnly, + sourceEnc, + jspConfigPageEnc, + isEncodingSpecifiedInProlog); } else { // Standard syntax InputStreamReader inStreamReader = null;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]