jkesselm 01/10/09 07:53:01
Modified: java/src/org/apache/xml/dtm/ref DTMManagerDefault.java
Log:
Partial response to Bugzilla 3438: make getDTM(DTM.NULL) return Java null.
This is arguably a more appropriate response to that specific case.
Revision Changes Path
1.22 +28 -5
xml-xalan/java/src/org/apache/xml/dtm/ref/DTMManagerDefault.java
Index: DTMManagerDefault.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/DTMManagerDefault.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- DTMManagerDefault.java 2001/08/24 04:49:31 1.21
+++ DTMManagerDefault.java 2001/10/09 14:53:01 1.22
@@ -150,7 +150,7 @@
private static final boolean DUMPTREE = false;
/** Set this to true if you want a basic diagnostics. */
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = true;
/**
* Get an instance of a DTM, loaded with the content from the
@@ -179,7 +179,11 @@
{
if(DEBUG && null != source)
- System.out.println("Starting source: "+source.getSystemId());
+ System.out.println("Starting "+
+ (unique ? "UNIQUE" : "shared")+
+ " source: "+source.getSystemId()
+ );
+
XMLStringFactory xstringFactory = m_xsf;
int dtmPos = getFirstFreeDTMID();
int documentID = dtmPos << IDENT_DTM_NODE_BITS;
@@ -545,9 +549,18 @@
*/
public DTM getDTM(int nodeHandle)
{
-
- // Performance critical function.
- return m_dtms[nodeHandle >>> IDENT_DTM_NODE_BITS];
+ try
+ {
+ // Performance critical function.
+ return m_dtms[nodeHandle >>> IDENT_DTM_NODE_BITS];
+ }
+ catch(java.lang.ArrayIndexOutOfBoundsException e)
+ {
+ if(nodeHandle==DTM.NULL)
+ return null; // Accept as a special case.
+ else
+ throw e; // Programming error; want to know about it.
+ }
}
/**
@@ -587,6 +600,16 @@
*/
public boolean release(DTM dtm, boolean shouldHardDelete)
{
+ if(DEBUG)
+ {
+ System.out.println("Releasing "+
+ (shouldHardDelete ? "HARD" : "soft")+
+ " systemID="+
+ // Following shouldn't need a nodeHandle, but does...
+ // and doesn't seem to report the intended value
+ dtm.getDocumentSystemIdentifier(dtm.getDocument())
+ );
+ }
if (dtm instanceof SAX2DTM)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]