FYI: Another javax.xml bugfix

Gary Benson gbenson@redhat.com
Thu Mar 8 17:03:00 GMT 2007


Hi all,

This commit fixes a bug where the entity resolver (if set) would be
used to open the top-level document when parsing an XML file.  The
spec states that the parser will use the entity resolver before
opening any external entity _except_ the top-level document entity.

Cheers,
Gary
-------------- next part --------------
Index: ChangeLog.gcj
===================================================================
--- ChangeLog.gcj	(revision 122699)
+++ ChangeLog.gcj	(working copy)
@@ -1,5 +1,12 @@
+2007-03-08  Gary Benson  <gbenson@redhat.com>
+
+	PR classpath/30983:
+	* gnu/xml/dom/ls/DomLSParser.java (getInputSource):
+	Do not use the entity resolver to resolve the top-level document.
+
 2007-03-07  Gary Benson  <gbenson@redhat.com>
 
+	PR classpath/30906:
 	* resource/META-INF/services/org.w3c.dom.DOMImplementationSourceList:
 	New file.
 
Index: gnu/xml/dom/ls/DomLSParser.java
===================================================================
--- gnu/xml/dom/ls/DomLSParser.java	(revision 122699)
+++ gnu/xml/dom/ls/DomLSParser.java	(working copy)
@@ -363,22 +363,6 @@
         source = new InputSource(in);
         source.setSystemId(systemId);
       }
-    if (source == null && entityResolver != null)
-      {
-        String publicId = input.getPublicId();
-        try
-          {
-            source = entityResolver.resolveEntity(publicId, systemId);
-          }
-        catch (SAXException e)
-          {
-            throw new DomLSException(LSException.PARSE_ERR, e);
-          } 
-        catch (IOException e)
-          {
-            throw new DomLSException(LSException.PARSE_ERR, e);
-          } 
-      }
     if (source == null)
       {
         URL url = null;


More information about the Java-patches mailing list