You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2006/10/09 19:45:40 UTC
svn commit: r454439 -
/xerces/java/trunk/src/org/apache/xerces/impl/XMLDTDScannerImpl.java
Author: mrglavas
Date: Mon Oct 9 10:45:39 2006
New Revision: 454439
URL: http://svn.apache.org/viewvc?view=rev&rev=454439
Log:
Fixing JIRA Issue #1193:
http://issues.apache.org/jira/browse/XERCESJ-1193
If the "continue-after-fatal-error" feature is enabled skip over invalid
enumeration values. This prevents the parser from entering an infinite
loop or throwing an NPE in a later code path.
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/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/XMLDTDScannerImpl.java?view=diff&rev=454439&r1=454438&r2=454439
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/XMLDTDScannerImpl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/XMLDTDScannerImpl.java Mon Oct 9 10:45:39 2006
@@ -23,6 +23,7 @@
import org.apache.xerces.util.SymbolTable;
import org.apache.xerces.util.XMLChar;
import org.apache.xerces.util.XMLStringBuffer;
+import org.apache.xerces.util.XMLSymbols;
import org.apache.xerces.xni.Augmentations;
import org.apache.xerces.xni.XMLDTDContentModelHandler;
import org.apache.xerces.xni.XMLDTDHandler;
@@ -1264,7 +1265,12 @@
String aName = fEntityScanner.scanName();
if (aName == null) {
reportFatalError("MSG_NAME_REQUIRED_IN_NOTATIONTYPE",
- new Object[]{elName, atName});
+ new Object[]{elName, atName});
+ c = skipInvalidEnumerationValue();
+ if (c == '|') {
+ continue;
+ }
+ break;
}
ensureEnumerationSize(fEnumerationCount + 1);
fEnumeration[fEnumerationCount++] = aName;
@@ -1293,6 +1299,11 @@
if (token == null) {
reportFatalError("MSG_NMTOKEN_REQUIRED_IN_ENUMERATION",
new Object[]{elName, atName});
+ c = skipInvalidEnumerationValue();
+ if (c == '|') {
+ continue;
+ }
+ break;
}
ensureEnumerationSize(fEnumerationCount + 1);
fEnumeration[fEnumerationCount++] = token;
@@ -2100,6 +2111,17 @@
// set starting state
setScannerState(SCANNER_STATE_TEXT_DECL);
+ }
+
+ private int skipInvalidEnumerationValue() throws IOException {
+ int c;
+ do {
+ c = fEntityScanner.scanChar();
+ }
+ while (c != '|' && c != ')');
+ ensureEnumerationSize(fEnumerationCount + 1);
+ fEnumeration[fEnumerationCount++] = XMLSymbols.EMPTY_STRING;
+ return c;
}
} // class XMLDTDScannerImpl
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org