8024707: TransformerException : item() return null with node list of length != 1
authoraefimov
Tue, 01 Oct 2013 17:14:08 +0400
changeset 20580 ec467abf6fc9
parent 20270 b5d2bf482a3e
child 20581 65d17ea72da3
8024707: TransformerException : item() return null with node list of length != 1 Reviewed-by: joehw, lancea
jaxp/src/com/sun/org/apache/xml/internal/dtm/ref/DTMAxisIterNodeList.java
--- a/jaxp/src/com/sun/org/apache/xml/internal/dtm/ref/DTMAxisIterNodeList.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xml/internal/dtm/ref/DTMAxisIterNodeList.java	Tue Oct 01 17:14:08 2013 +0400
@@ -105,15 +105,15 @@
      */
     public Node item(int index) {
         if (m_iter != null) {
-            int node;
+            int node = 0;
             int count = m_cachedNodes.size();
 
             if (count > index) {
                 node = m_cachedNodes.elementAt(index);
                 return m_dtm.getNode(node);
             } else if (m_last == -1) {
-                while (((node = m_iter.next()) != DTMAxisIterator.END)
-                           && count <= index) {
+                while (count <= index
+                        && ((node = m_iter.next()) != DTMAxisIterator.END)) {
                     m_cachedNodes.addElement(node);
                     count++;
                 }