Re: Stream Closed on xsl transformation

"Trenton D. Adams" <[email protected]>
Newsgroups gmane.text.xml.xalan.java.user
Message-ID <479074118.3603001257637531959.JavaMail.root@amundsen.cs.athabascau.ca>
I do have the java 1.4 restriction set in the pom, but I figured I'd give you my exact java version...

java version "1.4.2-03"
Java(TM) 2 Runtime Environment, Standard Edition (build Blackdown-1.4.2-03)
Java HotSpot(TM) 64-Bit Server VM (build Blackdown-1.4.2-03, mixed mode)


Trenton D. Adams
Systems Analyst/Web Software Engineer
Navy Penguins at your service!
Athabasca University
(780) 675-6195
:wq!

----- "Trenton D. Adams" <[email protected]> wrote:

> From: "Trenton D. Adams" <[email protected]>
> To: "Michael Ludwig" <[email protected]>
> Cc: [email protected]
> Sent: Saturday, November 7, 2009 4:09:07 PM GMT -07:00 US/Canada Mountain
> Subject: Re: Stream Closed on xsl transformation
>
> Hi Michael
> 
> Here is a 10K tar.gz file of a test case with a maven build project. 
> Run with the "test" profile, as in...
> 
> mvn -P test install
> 
> The full stack trace is in xml-util.log.
> 
> Take note of the comment in XMLUtil.java:167, as I can get it to work
> if I convert to a DOMSource instead.
> 
> http://www.trentonadams.ca/xml-util.tar.gz
> 
> Thanks.
> 
> Trenton D. Adams
> Systems Analyst/Web Software Engineer
> Navy Penguins at your service!
> Athabasca University
> (780) 675-6195
> :wq!
> 
> ----- "Michael Ludwig" <[email protected]> wrote:
> 
> > From: "Michael Ludwig" <[email protected]>
> > To: [email protected]
> > Sent: Thursday, November 5, 2009 6:08:04 PM GMT -07:00 US/Canada
> Mountain
> > Subject: Re: Stream Closed on xsl transformation
> >
> > Hi Trenton,
> > 
> > Trenton D. Adams schrieb am 05.11.2009 um 13:00:00 (-0700):
> > 
> > > I'm having some strange problems with a stream being closed when
> I
> > do
> > > an XSL transformation on an XML document that has an
> xml-stylesheet
> > > that is at a remote location.  If I instead put it locally, and
> and
> > > specify it as an xsltSource, it works fine.
> > > 
> > > I have also narrowed it down to the following working...
> > >             final Document doc = stringToDocument((String) xml);
> > >             logger.debug(documentToString(doc));
> > >             xmlSource = new DOMSource(doc);
> > > 
> > > But not this...
> > >             xmlSource = new StreamSource(new
> StringReader((String)
> > xml));
> > 
> > This approach works fine for me as in:
> > 
> >   Source src = new StreamSource(new StringReader("<Urmel/>"));
> > 
> > > I get a stack trace like the following; where the final "Caused
> by"
> > > indicates it has a problem with the StringReader in the second
> > example
> > > above.  But, my stringToDocument() method also does a
> StringReader.
> > 
> > > Caused by: java.io.IOException: Stream closed                     
>  
> >                                                
> > >         at java.io.StringReader.ensureOpen(StringReader.java:39)  
>  
> >                                                
> > >         at java.io.StringReader.read(StringReader.java:73)        
>  
> >                                                
> > >         at
> >
> org.apache.xerces.impl.XMLEntityManager$EntityScanner.load(XMLEntityManager.java:3257)
> > 
> > The exception seems to occur in a large program. There must be
> > something
> > wrong in those lines that you haven't shown. Rather than posting
> the
> > massive program, try boiling it down to a small, self-contained
> test
> > case. If the error persists, you might want to post the small test
> > program.
> > 
> > Best,
> > 
> > Michael Ludwig
> 
> __ 
>     This communication is intended for the use of the recipient to
> whom it
>     is addressed, and may contain confidential, personal, and or
> privileged
>     information. Please contact us immediately if you are not the
> intended
>     recipient of this communication, and do not copy, distribute, or
> take
>     action relying on it. Any communications received in error, or
>     subsequent reply, should be deleted or destroyed.
> ---
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.