You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2001/09/06 01:38:02 UTC

[DO NOT REPLY: Bug 3447] New: DTM not added to DTM array in DTMDefaultManager for DTMNodeProxy

PLEASE DO NOT REPLY TO THIS MESSAGE. TO FURTHER COMMENT
ON THE STATUS OF THIS BUG PLEASE FOLLOW THE LINK BELOW
AND USE THE ON-LINE APPLICATION. REPLYING TO THIS MESSAGE
DOES NOT UPDATE THE DATABASE, AND SO YOUR COMMENT WILL
BE LOST SOMEWHERE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3447

*** shadow/3447	Wed Sep  5 16:38:02 2001
--- shadow/3447.tmp.14312	Wed Sep  5 16:38:02 2001
***************
*** 0 ****
--- 1,70 ----
+ +============================================================================+
+ | DTM not added to DTM array in DTMDefaultManager for DTMNodeProxy           |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 3447                        Product: XalanJ2                 |
+ |       Status: NEW                         Version: 2.2.x                   |
+ |   Resolution:                            Platform: All                     |
+ |     Severity: Major                    OS/Version: All                     |
+ |     Priority: Other                     Component: org.apache.xml.dtm      |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: xalan-dev@xml.apache.org                                     |
+ |  Reported By: manda@best.com                                               |
+ |      CC list: Cc:                                                          |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ In org.apache.xml.dtm.ref.DTMDefaultManager, getDTMHandleFromNode(Node node) 
+ does not add an appropriate DTM to DTMDefaultManager's m_dtms array if the node 
+ argument is a DTMNodeProxy (for other Nodes, the DTM is added to m_dtms via the 
+ call to getDTM(Source source, boolean unique, DTMWSFilter whiteSpaceFilter, 
+ boolean incremental, boolean doIndexing)). Obviously, this causes problems when 
+ invoking getDTM(int nodeHandle), which simply returns the appropriate m_dtms 
+ array value (return m_dtms[nodeHandle >>> IDENT_DTM_NODE_BITS]).
+ 
+ The current version is as follows:
+ 
+   public int getDTMHandleFromNode(org.w3c.dom.Node node)
+   {
+         .
+         .
+         .
+     if (node instanceof org.apache.xml.dtm.ref.DTMNodeProxy)
+     {
+       return ((org.apache.xml.dtm.ref.DTMNodeProxy) node).getDTMNodeNumber();
+     }
+     else
+     {
+         .
+         .
+         .
+ 
+ To make the behavior the same for DTMNodeProxy objects as for other Nodes, the 
+ following simple fix has worked for me:
+ 
+   public int getDTMHandleFromNode(org.w3c.dom.Node node)
+   {
+         .
+         .
+         .
+     if (node instanceof org.apache.xml.dtm.ref.DTMNodeProxy)
+     {
+       int handle = 
+               ((org.apache.xml.dtm.ref.DTMNodeProxy) node).getDTMNodeNumber();
+       addDTM(((org.apache.xml.dtm.ref.DTMNodeProxy) node).getDTM(), 
+                handle >>> IDENT_DTM_NODE_BITS);
+       return handle;
+     }
+     else
+     {
+         .
+         .
+         .
+ 
+ I discovered this problem in using XPathAPI.eval(Node contextNode, String str, 
+ Node namespaceNode), passing in a DTMNodeProxy as the contextNode and 
+ namespaceNode. This eventually causes a NPE in ChildTestIterator when the 
+ setRoot(int context, Object environment) method is invoked, because it counts 
+ on the context node DTM (m_cdtm) being obtained in the parent (LocPathIterator) 
+ setRoot method through a call to getDTM(int nodeHandle) in XPathContext (which 
+ is acting as a proxy for DTMManager).