I have an application that reuses the same Transformer
object as has been laid out here. I have been unable
to use any version past 2.2.D10. The problem with the
parameters stopped me and I believe is supposed to be
fixed by 2.3.1. Version 2.2.D10 does have the
parameter problem which I got by using local
parameters as opposed to global.

Unfortunately, when running my application with 2.3.1,
I get the following problem after about 30
transformations (any suggestions?):

javax.xml.transform.TransformerException:
java.lang.NullPointerException
        at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1226)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:634)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1088)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1066)
        at
ddrrjx.xml.DOMTransformer.transformDOMs(DOMTransformer.java)
        at
ddrrjx.ReportGenerator.main(ReportGenerator.java)
---------
java.lang.NullPointerException
        at
org.apache.xpath.objects.XRTreeFrag.xstr(XRTreeFrag.java:256)
        at
org.apache.xpath.objects.XRTreeFragSelectWrapper.xstr(XRTreeFragSelectWrapper.java:87)
        at
org.apache.xpath.objects.XObject.dispatchCharactersEvents(XObject.java:187)
        at
org.apache.xpath.Expression.executeCharsToContentHandler(Expression.java:303)
        at
org.apache.xalan.templates.ElemValueOf.execute(ElemValueOf.java:319)
        at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2243)
        at
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:710)
        at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2243)
        at
org.apache.xalan.templates.ElemTemplate.execute(ElemTemplate.java:432)
        at
org.apache.xalan.templates.ElemCallTemplate.execute(ElemCallTemplate.java:279)
        at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2243)
        at
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:710)
        at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2243)
        at
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2069)
        at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1171)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:634)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1088)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1066)
        at
ddrrjx.xml.DOMTransformer.transformDOMs(DOMTransformer.java)
        at
ddrrjx.ReportGenerator.main(ReportGenerator.java)




--- [EMAIL PROTECTED] wrote:
> Can anybody tell what version of Xalan is safe to
> reuse transformer object 
> (I'm not using transformer parameters)?
> I've been reusing transfomer objects for a while and
> didn't know I cold 
> have a potential problem here.
> I guess I should have checked documentation first.
> 
> Vlad
> 
> 
> 
> To:     scott_boag <[EMAIL PROTECTED]>,
> Christopher Giblin 
> <[EMAIL PROTECTED]>
> cc:     cgi <[EMAIL PROTECTED]>, xalan-j-users
> <[EMAIL PROTECTED]> 
> 
> Subject:        RE: Reuse of transformers
> 
> Scott:
> 
> This is good news. So with latest version of Xalan,
> I could reuse the
> "transformer" object as opposed to underlying
> "templates". Need to test 
> this
> out.
> 
> Also, do we need to update the
>
http://xml.apache.org/xalan-j/usagepatterns.html#multithreading
> ??
> 
> --Naren
> 
> 
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 08, 2002 5:43 AM
> To: Christopher Giblin
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: Reuse of transformers
> 
> 
> 
> The statement about not reusing them sequentially is
> incorrect.  When a
> given transformation finishes it calls a reset()
> method on itself.  This 
> is
> supposed to be highly tested, and should work OK. 
> There were some bugs
> fixed with resetting of parameters in the case in
> the last released
> version.
> 
> -scott
> 
> 
> 
> 
> 
>                       "Christopher
>                       Giblin"                  To:
> [EMAIL PROTECTED]
>                       <[EMAIL PROTECTED]        cc:
> [EMAIL PROTECTED],
> (bcc: Scott Boag/Cambridge/IBM)
>                       om>                     
> Subject:  Reuse of
> transformers
> 
>                       03/08/2002 03:42
>                       AM
> 
> 
> 
> 
> 
> 
> Hi
> 
> The JAXP spec suggests to me  that Transformers can
> be reused at will,
> threading considerations aside.
> Xalan trax examples even demonstrate this.
> 
> Yet the Xalan "Usage Patterns" page, under the title
> "Multithreading",
> states:
> 
> "A Transformer ... is a lightweight object that
> tracks state information
> during the transformation, and should only be used
> to perform a single
> transformation.  If you want to perform multiple
> transformations
> (sequentially or concurrently) with the same
> stylesheet instructions, do
> the following: ...
>    2. ..For each transformation, use the Templates
> object newTransformer()
> method to create a Transformer, and use that
> Transformer's 
> transform(Source
> xmlSource, Result transformResult) method to perform
> the transformation."
> 
> Multithreading is not a consideration for me but
> performance is very much
> so. I am tweeking and need to apply the same
> transformation possibly
> hundreds of times. If I can reuse the same
> transformer, great. I am now
> skeptical due to the above statements, however.
> 
> Is Xalan recommending a "Best Practice" by endorsing
> new Transform 
> instance
> for each transformation? Or did I misread the JAXP
> spec?
> 
> Thanks, chris
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

Reply via email to