cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott_B...@lotus.com
Subject Re: Fwd: Re: WG: Xalan 2.0.0 breaks Cocoon2 [C2][Xalan2J]
Date Fri, 09 Feb 2001 04:29:00 GMT

Davanum, thank you very very much for the good reproduction of the problem.

This is a kind of nasty problem that I believe I knew about (and have
documented somewhere in the code).  I don't think it is a regression from
D07 or earlier, at least from the information in your example.

In your example you create your own reader, and pass the TransformerHandler
into it.  The TransformerHandler never knows about the reader... the input
could be created programatically for all it knows.  Under the covers, the
TransformerHandler is a org.apache.xalan.stree.SourceTreeHandler, which
creates a secondary thread once it receives a startDocument event.  The
reader then parses for a bit, sending ContentHandler events on, and then
barfs on an exception, and throws out to your catch.  The transformer
thread is left hanging around, rightfully so in some sense, waiting for
more nodes of the source tree to be added.

The only way to fix this, that I know of, is from the calling program.
BUT, there is know interface to deal with this kind of thing in TrAX, since
the use of multiple threads is really an implementation issue.

What you can do is:

       try
       {
          reader.parse(xmlFile);
       }
       catch(SAXException se)
       {

((org.apache.xalan.stree.SourceTreeHandler)handler).setExceptionThrown(se);
           throw se;
       }

This will let the handler know that an exception has occured, and will
inform the transformer thread.  If you do this by reflection, you can call
this method without creating any direct dependencies on Xalan (i.e. only
call it if the handler implements a method called "setExceptionThrown".
Not great, but the best I can come up with.  Perhaps folks can help me
brainstorm on potentially better solutions.

Sorry, the two-thread model should not be visible on your level, but this
model is the only way to implement an incremental pipeline with
event-driven input (well, the only practical way).  I'm hoping the the
example above will be good enough, at least for now.

Don Leslie, we need to heavily document this, or whatever better solution
someone can come up with.

-scott




                                                                                         
                         
                    Davanum                                                              
                         
                    Srinivas             To:     scott_boag@lotus.com                    
                         
                    <dims@yahoo.c        cc:                                          
                            
                    om>                  Subject:     Fwd: Re: WG: Xalan 2.0.0 breaks Cocoon2
[C2][Xalan2J]        
                                                                                         
                         
                    02/08/2001                                                           
                         
                    11:37 AM                                                             
                         
                    Please                                                               
                         
                    respond to                                                           
                         
                    dims                                                                 
                         
                                                                                         
                         
                                                                                         
                         




Not sure if this went thru...Here it is again.

Thanks,
dims

Note: forwarded message attached.


=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year!  http://personal.mail.yahoo.com/
----- Message from on -----
   
   
   

Hi Scott, Xalan2J Team,

Here's a stripped-down sample that recreates the problem(s).

Scenario #1:
if the error in error-giving-page.xml is fixed
then using the same content handler for both the first and the second
transforms works fine.

Scenario #2:
if the first xml is bad and we use the same content handler for both
transforms,
then the second transforms hangs in the
"synchronized(m_outputContentHandler)" statement in
TransformerImpl.java.

Scenario #3:
if the first xml is bad and we use the 2 content handlers one for each
transform,
then the second transforms works ok. But the threads started by the first
transform are still
around....

Please take a look and let us know...

Thanks,
dims


=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year!  http://personal.mail.yahoo.com/




Mime
View raw message