zongaro 2003/06/16 07:40:48
Modified: java/src/org/apache/xml/dtm/ref/sax2dtm SAX2DTM2.java
Log:
Patch from Igor Hersht for Bug 19770. getFirstAttributeIdentity should check
that argument is not equal to DTM.NULL prior to calling _type2 method - that
method assumes that the argument is not NULL. Added comments to that effect
to
_type2, _parent2, _firstch2, _nextsib2 and _exptype2.
Revision Changes Path
1.4 +19 -1
xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java
Index: SAX2DTM2.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SAX2DTM2.java 3 Apr 2003 16:48:11 -0000 1.3
+++ SAX2DTM2.java 16 Jun 2003 14:40:48 -0000 1.4
@@ -1947,6 +1947,9 @@
/**
* The optimized version of DTMDefaultBase._exptype().
+ *
+ * @param identity A node identity, which <em>must not</em> be equal to
+ * <code>DTM.NULL</code>
*/
public final int _exptype2(int identity)
{
@@ -1960,6 +1963,9 @@
/**
* The optimized version of DTMDefaultBase._nextsib().
+ *
+ * @param identity A node identity, which <em>must not</em> be equal to
+ * <code>DTM.NULL</code>
*/
public final int _nextsib2(int identity)
{
@@ -1973,6 +1979,9 @@
/**
* The optimized version of DTMDefaultBase._firstch().
+ *
+ * @param identity A node identity, which <em>must not</em> be equal to
+ * <code>DTM.NULL</code>
*/
public final int _firstch2(int identity)
{
@@ -1986,6 +1995,9 @@
/**
* The optimized version of DTMDefaultBase._parent().
+ *
+ * @param identity A node identity, which <em>must not</em> be equal to
+ * <code>DTM.NULL</code>
*/
public final int _parent2(int identity)
{
@@ -1999,6 +2011,9 @@
/**
* The optimized version of DTMDefaultBase._type().
+ *
+ * @param identity A node identity, which <em>must not</em> be equal to
+ * <code>DTM.NULL</code>
*/
public final int _type2(int identity)
{
@@ -2540,6 +2555,9 @@
* @return Identity of first attribute, or DTM.NULL to indicate none
exists.
*/
protected int getFirstAttributeIdentity(int identity) {
+ if (identity == NULL) {
+ return NULL;
+ }
int type = _type2(identity);
if (DTM.ELEMENT_NODE == type)
@@ -3296,4 +3314,4 @@
handler.addAttribute(nodeName, nodeValue);
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]