OK, give it a try.  I may tweak my fix after I sleep on it, but the problem
should be fixed in the current CVS.

I'll wait to hear from you before I close the bug.

-scott




                                                                                
                                                       
                      [EMAIL PROTECTED]                                         
                                                       
                      .com                     To:       "Frank E. Weiss" 
<[EMAIL PROTECTED]>                                            
                                               cc:       [EMAIL PROTECTED], 
[EMAIL PROTECTED], (bcc: Scott        
                      04/02/2002 01:57          Boag/Cambridge/IBM)             
                                                       
                      PM                       Subject:  Re: Stylesheet Reuse 
NullPointerException                                     
                                                                                
                                                       
                                                                                
                                                       





I think I've diagnosed the problem:

1) Transform#1 creates an XRTreeFrag.  This has a reference to a DTM, that
in turn is registered with a DTMManager.  The DTM will need to be deleted
from the DTMManager when the XRTreeFrag is deleted.  The XRTreeFrag  also
contains a reference to the XPathContext.
2) Transform#1 completes.  The XPathContext is reset... namely the a bunch
of structures are reset or rebuilt, including DTMManagerDefault#m_dtms.
BUT, the XRTreeFrags are still hanging around, waiting to unregister
themselves.
3) Transform#2 starts humming along.  It builds a XRTreeFrag and installs
that RTF DTM into DTMManagerDefault#m_dtms[2].
4) The finalizer thread wakes and decides to delete some of those old
XRTreeFrags from Transform#1.
5) The XRTreeFrag#finalize() method references through the XPathContext,
and deletes what it thinks is it's DTM from  DTMManagerDefault#m_dtms[2]
(via getDTMIdentity(dtm)).
6) Transform#2 tries to reference DTMManagerDefault#m_dtms[2], finds it is
null, and chaos results.

Working on a (safe and reasonable) solution.

-scott





                      "Frank E. Weiss"

                      <[EMAIL PROTECTED]>        To:

                                               cc:
[EMAIL PROTECTED], (bcc: Scott Boag/Cambridge/IBM)

                      04/02/2002 12:28         Subject:  Re: Stylesheet
Reuse NullPointerException
                      PM







Scott, thanks for the update.

> I can reproduce it from the DOS command prompt, but
> not in my debugger.

Ouch. Maybe I'll try runiing it on Linux and see if it reproduces. Sounds
like as, Joseph said, a timing problem.

> Also, your tests are not reusing the transformer... you create a new
transformer every time...
> so it's got nothing to do with that either.

Hmm. Really? The transformer is created outside the loop

Transformer transformer = tfactory.newTransformer(new StreamSource(xslID));

and inside the loop the call

   transformer.transform( new StreamSource(sourceID),
           new StreamResult("reuse00"));

I thought that's the way the example shows transformer reuse.











Reply via email to