garyp       01/08/12 11:06:58

  Modified:    java/src/org/apache/xml/dtm DTMManager.java
               java/src/org/apache/xml/dtm/ref DTMManagerDefault.java
  Log:
  Fixes inspired by bugzilla bug 2308 
(http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2308).  The maximum number 
of DTMs is calculated based on the number of bits left over for the DTM number. 
 The m_dtms array is allocated only at this length to avoid generating a DTMId 
greater than the maximum available.  I changed a sign-extended shift to a 
non-sign-extended shift to allow access to the upper have of the DTMId range.  
Also changed the -1 ^ x syntax to ~x which I find much more understandable.
  
  Revision  Changes    Path
  1.6       +6 -1      xml-xalan/java/src/org/apache/xml/dtm/DTMManager.java
  
  Index: DTMManager.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/DTMManager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DTMManager.java   2001/08/10 17:57:20     1.5
  +++ DTMManager.java   2001/08/12 18:06:57     1.6
  @@ -539,7 +539,12 @@
     /** When this bitmask is ANDed with a DTM node handle number, the result
      * is the DTM's document identity number.
      */
  -  public static final int IDENT_DTM_DEFAULT = -1 ^ IDENT_NODE_DEFAULT;
  +  public static final int IDENT_DTM_DEFAULT = ~IDENT_NODE_DEFAULT;
  +
  +  /** This is the maximum number of DTMs available.  The highest DTM is
  +    * one less than this.
  +   */
  +  public static final int IDENT_MAX_DTMS = (IDENT_DTM_DEFAULT >>> 
IDENT_DTM_NODE_BITS) + 1;
   
   
     /**
  
  
  
  1.20      +2 -2      
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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DTMManagerDefault.java    2001/08/10 17:57:37     1.19
  +++ DTMManagerDefault.java    2001/08/12 18:06:58     1.20
  @@ -105,7 +105,7 @@
     /** 
      * Vector of DTMs that this manager manages. 
      */
  -  protected DTM m_dtms[] = new DTM[4095];
  +  protected DTM m_dtms[] = new DTM[IDENT_MAX_DTMS];
       
     /**
      * Add a DTM to the DTM table.
  @@ -546,7 +546,7 @@
     {
   
       // Performance critical function.
  -    return m_dtms[nodeHandle >> IDENT_DTM_NODE_BITS];
  +    return m_dtms[nodeHandle >>> IDENT_DTM_NODE_BITS];
     }
   
     /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to