You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ne...@apache.org on 2002/05/02 16:33:35 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/impl XMLDTDScannerImpl.java XMLEntityManager.java XMLScanner.java
neilg 02/05/02 07:33:35
Modified: java/src/org/apache/xerces/impl XMLDTDScannerImpl.java
XMLEntityManager.java XMLScanner.java
Log:
fix for bug #8617. In the case of an internal parameter entity, we were assuming that the global XMLString containing the entity value would remain unchanged even after we requested that spaces between the terminating quote of the entity value and the > had been consumed. Especially in space-rich documents, this was not necessarily the case since a buffer boundary might exist in the spaces; if one did, the XMLString would change and the entity value would be corrupted. XMLDTDScannerImpl.java
Note that there is also a bug in nonNormalized values for parameter entities which contain references to other parameter entities. This will not be easy to fix; I note it here for the record.
Revision Changes Path
1.20 +9 -3 xml-xerces/java/src/org/apache/xerces/impl/XMLDTDScannerImpl.java
Index: XMLDTDScannerImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLDTDScannerImpl.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- XMLDTDScannerImpl.java 12 Mar 2002 21:32:48 -0000 1.19
+++ XMLDTDScannerImpl.java 2 May 2002 14:33:35 -0000 1.20
@@ -103,7 +103,7 @@
* @author Glenn Marcy, IBM
* @author Eric Ye, IBM
*
- * @version $Id: XMLDTDScannerImpl.java,v 1.19 2002/03/12 21:32:48 neilg Exp $
+ * @version $Id: XMLDTDScannerImpl.java,v 1.20 2002/05/02 14:33:35 neilg Exp $
*/
public class XMLDTDScannerImpl
extends XMLScanner
@@ -1429,6 +1429,12 @@
// internal entity
if (systemId == null) {
scanEntityValue(fLiteral, fLiteral2);
+ // since we need it's value anyway, let's snag it so it doesn't get corrupted
+ // if a new load takes place before we store the entity values
+ fStringBuffer.clear();
+ fStringBuffer2.clear();
+ fStringBuffer.append(fLiteral.ch, fLiteral.offset, fLiteral.length);
+ fStringBuffer2.append(fLiteral2.ch, fLiteral2.offset, fLiteral2.length);
}
// skip possible trailing space
@@ -1466,9 +1472,9 @@
}
}
else {
- fEntityManager.addInternalEntity(name, fLiteral.toString());
+ fEntityManager.addInternalEntity(name, fStringBuffer.toString());
if (fDTDHandler != null) {
- fDTDHandler.internalEntityDecl(name, fLiteral, fLiteral2, null);
+ fDTDHandler.internalEntityDecl(name, fStringBuffer, fStringBuffer2, null);
}
}
fReportEntity = true;
1.29 +2 -2 xml-xerces/java/src/org/apache/xerces/impl/XMLEntityManager.java
Index: XMLEntityManager.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLEntityManager.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- XMLEntityManager.java 18 Mar 2002 15:49:26 -0000 1.28
+++ XMLEntityManager.java 2 May 2002 14:33:35 -0000 1.29
@@ -115,7 +115,7 @@
* @author Andy Clark, IBM
* @author Arnaud Le Hors, IBM
*
- * @version $Id: XMLEntityManager.java,v 1.28 2002/03/18 15:49:26 neilg Exp $
+ * @version $Id: XMLEntityManager.java,v 1.29 2002/05/02 14:33:35 neilg Exp $
*/
public class XMLEntityManager
implements XMLComponent, XMLEntityResolver {
@@ -366,7 +366,7 @@
if (!fEntities.containsKey(name)) {
Entity entity = new InternalEntity(name, text);
fEntities.put(name, entity);
- }
+ }
} // addInternalEntity(String,String)
/**
1.15 +1 -2 xml-xerces/java/src/org/apache/xerces/impl/XMLScanner.java
Index: XMLScanner.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLScanner.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- XMLScanner.java 15 Mar 2002 09:57:11 -0000 1.14
+++ XMLScanner.java 2 May 2002 14:33:35 -0000 1.15
@@ -96,7 +96,7 @@
* @author Arnaud Le Hors, IBM
* @author Eric Ye, IBM
*
- * @version $Id: XMLScanner.java,v 1.14 2002/03/15 09:57:11 rahuls Exp $
+ * @version $Id: XMLScanner.java,v 1.15 2002/05/02 14:33:35 neilg Exp $
*/
public abstract class XMLScanner
implements XMLComponent {
@@ -464,7 +464,6 @@
}
sawSpace = fEntityScanner.skipSpaces();
}
-
// REVISIT: should we remove this error reporting?
if (scanningTextDecl && state != STATE_DONE) {
reportFatalError("MorePseudoAttributes", null);
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org