Author: mrglavas
Date: Mon Feb 13 20:56:13 2006
New Revision: 377620
URL: http://svn.apache.org/viewcvs?rev=377620&view=rev
Log:
Fixing JIRA Bug #1135:
http://issues.apache.org/jira/browse/XERCESJ-1135
If the document ends abruptly in the middle of the DOCTYPE declaration the
XMLEntityManager
will call endEntity() on XMLDTDScannerImpl. This was causing an AIOOBE to be
thrown because
it was assumed that any entity not named [dtd] must be a parameter entity. The
end of the
document was being reported down the pipeline as the end of a parameter entity.
Reorganized
the code a bit so that this no longer happens.
Modified:
xerces/java/trunk/src/org/apache/xerces/impl/XMLDTDScannerImpl.java
Modified: xerces/java/trunk/src/org/apache/xerces/impl/XMLDTDScannerImpl.java
URL:
http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/impl/XMLDTDScannerImpl.java?rev=377620&r1=377619&r2=377620&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/XMLDTDScannerImpl.java
(original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/XMLDTDScannerImpl.java Mon Feb
13 20:56:13 2006
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2004,2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@
import org.apache.xerces.impl.msg.XMLMessageFormatter;
import org.apache.xerces.util.SymbolTable;
-import org.apache.xerces.util.XMLAttributesImpl;
import org.apache.xerces.util.XMLChar;
import org.apache.xerces.util.XMLStringBuffer;
import org.apache.xerces.xni.Augmentations;
@@ -143,9 +142,6 @@
/** Start DTD called. */
private boolean fStartDTDCalled;
- /** Default attribute */
- private XMLAttributesImpl fAttributes = new XMLAttributesImpl();
-
/**
* Stack of content operators (either '|' or ',') in children
* content.
@@ -564,16 +560,13 @@
if (fEntityScanner.isExternal()) {
fExtEntityDepth--;
}
+ // call handler
+ if (fDTDHandler != null && reportEntity) {
+ fDTDHandler.endParameterEntity(name, augs);
+ }
}
-
- // call handler
- boolean dtdEntity = name.equals("[dtd]");
- if (fDTDHandler != null && !dtdEntity && reportEntity) {
- fDTDHandler.endParameterEntity(name, augs);
- }
-
// end DTD
- if (dtdEntity) {
+ else if (name.equals("[dtd]")) {
if (fIncludeSectDepth != 0) {
reportFatalError("IncludeSectUnterminated", null);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]