Hi,
Please find the attached patch for NodeSet class.
Problem : In removeElement(...) and removeElementAt(...) methods, the
element removal from the array isn't done correctly and hence
leads to an NPE.
Thanks,
Pavani
--
Pavani Mukthipudi
Sun Microsystems, Inc.
Phone: 91-80-2298989/87390
Index: NodeSet.java
===================================================================
RCS file: /home/cvspublic/xml-xalan/java/src/org/apache/xpath/NodeSet.java,v
retrieving revision 1.14
diff -u -r1.14 NodeSet.java
--- NodeSet.java 4 Aug 2001 18:23:30 -0000 1.14
+++ NodeSet.java 21 May 2002 15:49:25 -0000
@@ -1250,13 +1250,8 @@
if ((null != node) && node.equals(s))
{
- if (i > m_firstFree)
- System.arraycopy(m_map, i + 1, m_map, i - 1, m_firstFree - i);
- else
- m_map[i] = null;
-
+ System.arraycopy(m_map, i + 1, m_map, i, m_firstFree - i);
m_firstFree--;
-
return true;
}
}
@@ -1278,10 +1273,12 @@
if (null == m_map)
return;
- if (i > m_firstFree)
- System.arraycopy(m_map, i + 1, m_map, i - 1, m_firstFree - i);
+ if (i < m_firstFree)
+ System.arraycopy(m_map, i + 1, m_map, i, m_firstFree - i);
else
m_map[i] = null;
+
+ m_firstFree--;
}
/**
NodeSet.java
Description: NodeSet.java
