DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15186>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

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

ArrayIndexOutOfBoundsException when processing large xml file with a lot of recursion

[EMAIL PROTECTED] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From [EMAIL PROTECTED]  2003-02-06 16:12 -------
Class: org.apache.xml.dtm.DTMManagerDefault
Method: getDTM(Source source, boolean unique, DTMWSFilter whiteSpaceFilter, 
boolean incremental, boolean doIndexing)

Due to the bit shift, documentID is overflowing when the
dtmPos index reaches 512. However, entries in the DTM array
are removed following use, so the loop I've included in the following code 
awaits a
free entry to reuse rather than moving past 512. This is not
the best solution.
The ideal solution is to change documentID into a long to prevent overflow. 
However, this field is nested in many different classes and would have a 
greater impact on coding and testing.

I may get around to the best solution soon, but the fix supplied has certainly 
corrected our problem, which sounds the same as yours:

Amended Code:

  public DTM getDTM(Source source, boolean unique,WSFilter whiteSpaceFilter, 
boolean incremental,boolean doIndexing)
  {

        if(DEBUG && null != source)
          System.out.println("Starting source: "+source.getSystemId());
        XMLStringFactory xstringFactory = m_xsf;
        int dtmPos = getFirstFreeDTMID();
        int documentID = dtmPos << IDENT_DTM_NODE_BITS;

        // Defect fix.
        // Due to the bit shift, documentID is overflowing when the
        // dtmPos index reaches 512. However, entries in the DTM array
        // are removed following use, so the following loop awaits a
        // free entry to reuse rather than moving past 512. This is not
        // the best solution.
        // The ideal solution is to change documentID into a long to prevent
        // overflow. However, this field is nested in many different classes
        // and would have a greater impact on coding and testing.
        while (documentID < 0)
        {
                dtmPos = getFirstFreeDTMID();
                documentID = dtmPos << IDENT_DTM_NODE_BITS;
        }
        
        if ((null != source) && source instanceof DOMSource)
        {
          DOM2DTM dtm = new DOM2DTM(this, (DOMSource) source, documentID,
                                                        
        whiteSpaceFilter, xstringFactory, doIndexing);

          addDTM(dtm, dtmPos);

AND SO ON !

Reply via email to