avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 6877] New: - Reusing JaxpParser causes problems
Date Tue, 05 Mar 2002 13:07:37 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6877>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6877

Reusing JaxpParser causes problems 

           Summary: Reusing JaxpParser causes problems
           Product: Avalon
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Excalibur
        AssignedTo: avalon-dev@jakarta.apache.org
        ReportedBy: dims@yahoo.com


Xerces does not clear the LexicalHandler for resuing this parser instance the 
next time around. We need to clean it up ourselves. Here's a patch.

Thanks,
dims


Index: src/java/org/apache/avalon/excalibur/xml/JaxpParser.java
===================================================================
RCS file: /home/cvspublic/jakarta-avalon-
excalibur/src/java/org/apache/avalon/excalibur/xml/JaxpParser.java,v
retrieving revision 1.1
diff -d -u -b -B -w -u -r1.1 JaxpParser.java
--- src/java/org/apache/avalon/excalibur/xml/JaxpParser.java	15 Feb 2002 
10:57:39 -0000	1.1
+++ src/java/org/apache/avalon/excalibur/xml/JaxpParser.java	5 Mar 2002 
13:02:56 -0000
@@ -251,6 +251,7 @@
         {
             this.getLogger().warn("SAX2 driver does not support property: "+
                                   "'http://xml.org/sax/properties/lexical-
handler'");
+            lexicalHandler = null;
         }
 
         tmpReader.setErrorHandler( this );
@@ -264,8 +265,14 @@
         tmpReader.parse(in);
 
         // Here, parsing was successful : restore this.reader
-        if ( this.reuseParsers )
+        if ( this.reuseParsers ) {
             this.reader = tmpReader;
+            // Reset the Lexical Handler to null, so that we can reuse the 
parser
+            if(lexicalHandler != null) {
+                tmpReader.setProperty("http://xml.org/sax/properties/lexical-
handler",
+                                      null);
+            }
+        }
     }
 
     /**

--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message