Author: mrglavas
Date: Tue Sep 12 07:31:03 2006
New Revision: 442591

URL: http://svn.apache.org/viewvc?view=rev&rev=442591
Log:
Fixing JIRA Bug #1147:

http://issues.apache.org/jira/browse/XERCESJ-1147



Some applications like Saxon are casting Xerces' DOM nodes directly

to a NodeList. Because this bypasses the synchronizeChildren() call 

in ParentNode.getChildNodes() the children may not be expanded yet

if getLength() or item() are called on the NodeList. We now check

if the children are synchronized before obtaining the NodeListCache.

Modified:
    xerces/java/trunk/src/org/apache/xerces/dom/ParentNode.java

Modified: xerces/java/trunk/src/org/apache/xerces/dom/ParentNode.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/dom/ParentNode.java?view=diff&rev=442591&r1=442590&r2=442591
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/dom/ParentNode.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/dom/ParentNode.java Tue Sep 12 
07:31:03 2006
@@ -672,6 +672,9 @@
     private int nodeListGetLength() {
 
         if (fNodeListCache == null) {
+            if (needsSyncChildren()) {
+                synchronizeChildren();
+            }
             // get rid of trivial cases
             if (firstChild == null) {
                 return 0;
@@ -721,6 +724,9 @@
     private Node nodeListItem(int index) {
 
         if (fNodeListCache == null) {
+            if (needsSyncChildren()) {
+                synchronizeChildren();
+            }
             // get rid of trivial case
             if (firstChild == lastChild()) {
                 return index == 0 ? firstChild : null;



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to