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/11 05:02:19 UTC
svn commit: r462674 -
/xerces/java/trunk/src/org/apache/xerces/impl/dtd/XMLDTDProcessor.java
Author: mrglavas
Date: Tue Oct 10 20:02:18 2006
New Revision: 462674
URL: http://svn.apache.org/viewvc?view=rev&rev=462674
Log:
Fixing JIRA Issue #1203:
http://issues.apache.org/jira/browse/XERCESJ-1203
Applying the fix suggested by George Cristian Bina to fix an NPE
which can occur when traversing the content spec for an element
declared to have mixed content. In such a case it's possible that
both contentSpec.value and contentSpec.otherValue are null.
Modified:
xerces/java/trunk/src/org/apache/xerces/impl/dtd/XMLDTDProcessor.java
Modified: xerces/java/trunk/src/org/apache/xerces/impl/dtd/XMLDTDProcessor.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/dtd/XMLDTDProcessor.java?view=diff&rev=462674&r1=462673&r2=462674
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/dtd/XMLDTDProcessor.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/dtd/XMLDTDProcessor.java Tue Oct 10 20:02:18 2006
@@ -1709,23 +1709,22 @@
new Object[]{grammar.getElementDeclName(elementIndex).rawname, value},
XMLErrorReporter.SEVERITY_WARNING);
}
- }
- else {
- // It's not a leaf, so we have to recurse its left and maybe right
- // nodes. Save both values before we recurse and trash the node.
+ }
+ // It's not a leaf, so we have to recurse its left and maybe right
+ // nodes. Save both values before we recurse and trash the node.
+ else if ((contentSpec.type == XMLContentSpec.CONTENTSPECNODE_CHOICE)
+ || (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_SEQ)) {
final int leftNode = ((int[])contentSpec.value)[0];
final int rightNode = ((int[])contentSpec.otherValue)[0];
- if ((contentSpec.type == XMLContentSpec.CONTENTSPECNODE_CHOICE)
- || (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_SEQ)) {
- // Recurse on both children.
- checkDeclaredElements(grammar, elementIndex, leftNode, contentSpec);
- checkDeclaredElements(grammar, elementIndex, rightNode, contentSpec);
- }
- else if (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_MORE
- || contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_ONE
- || contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ONE_OR_MORE) {
- checkDeclaredElements(grammar, elementIndex, leftNode, contentSpec);
- }
+ // Recurse on both children.
+ checkDeclaredElements(grammar, elementIndex, leftNode, contentSpec);
+ checkDeclaredElements(grammar, elementIndex, rightNode, contentSpec);
+ }
+ else if (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_MORE
+ || contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_ONE
+ || contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ONE_OR_MORE) {
+ final int leftNode = ((int[])contentSpec.value)[0];
+ checkDeclaredElements(grammar, elementIndex, leftNode, contentSpec);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org