7157609: Issues with loop
authorjoehw
Tue, 10 Apr 2012 13:59:21 -0700
changeset 13065 f70c23219070
parent 12324 1d7e6da6adc8
child 13066 d7ed93b02ae9
7157609: Issues with loop Reviewed-by: hawtin, lancea, asaha
jaxp/src/share/classes/com/sun/org/apache/xerces/internal/impl/XMLScanner.java
--- a/jaxp/src/share/classes/com/sun/org/apache/xerces/internal/impl/XMLScanner.java	Thu Apr 05 13:04:52 2012 -0700
+++ b/jaxp/src/share/classes/com/sun/org/apache/xerces/internal/impl/XMLScanner.java	Tue Apr 10 13:59:21 2012 -0700
@@ -402,6 +402,16 @@
 
         boolean dataFoundForTarget = false;
         boolean sawSpace = fEntityScanner.skipSpaces();
+        // since pseudoattributes are *not* attributes,
+        // their quotes don't need to be preserved in external parameter entities.
+        // the XMLEntityScanner#scanLiteral method will continue to
+        // emit -1 in such cases when it finds a quote; this is
+        // fine for other methods that parse scanned entities,
+        // but not for the scanning of pseudoattributes.  So,
+        // temporarily, we must mark the current entity as not being "literal"
+        Entity.ScannedEntity currEnt = fEntityManager.getCurrentEntity();
+        boolean currLiteral = currEnt.literal;
+        currEnt.literal = false;
         while (fEntityScanner.peekChar() != '?') {
             dataFoundForTarget = true;
             String name = scanPseudoAttribute(scanningTextDecl, fString);
@@ -499,6 +509,9 @@
             }
             sawSpace = fEntityScanner.skipSpaces();
         }
+        // restore original literal value
+        if(currLiteral)
+            currEnt.literal = true;
         // REVISIT: should we remove this error reporting?
         if (scanningTextDecl && state != STATE_DONE) {
             reportFatalError("MorePseudoAttributes", null);