[ http://issues.apache.org/jira/browse/COCOON-446?page=all ] Helma van der Linden reopened COCOON-446: -----------------------------------------
reopened just to set the resolution to fixed > [PATCH] PNG output of SVGSerializer broken in HEAD > -------------------------------------------------- > > Key: COCOON-446 > URL: http://issues.apache.org/jira/browse/COCOON-446 > Project: Cocoon > Type: Bug > Components: - Components: Sitemap > Versions: 2.0.5-dev (Current CVS) > Environment: Operating System: All > Platform: All > Reporter: Alfred Nathaniel > Assignee: Cocoon Developers Team > > The PNGTranscoder of Batik has the habit to close the stream. Together with > the cocoon.util.BufferedOutputStream used now in Cocoon.process the result > is, > that the buffer is never written out. > Here is the patch to blocks/batik/SVGSerializer 1.1 using an intermediate > ByteArrayBufferStream. (You may consider to fix it for all serializers by > implementing BufferedOutputStream.close()/realClose().) > Sorry, can't use cvs diff due to corporate firewall. > *** SVGSerializer.java.orig Mon Sep 16 17:35:06 2002 > --- SVGSerializer.java Wed Oct 2 19:55:49 2002 > *************** > *** 82,88 **** > import org.xml.sax.ext.LexicalHandler; > > import java.awt.Color; > ! import java.io.BufferedOutputStream; > import java.io.OutputStream; > > /** > --- 82,88 ---- > import org.xml.sax.ext.LexicalHandler; > > import java.awt.Color; > ! import java.io.ByteArrayOutputStream; > import java.io.OutputStream; > > /** > *************** > *** 128,134 **** > * Set the <code>OutputStream</code> where the XML should be serialized. > */ > public void setOutputStream(OutputStream out) { > ! this.output = new BufferedOutputStream(out); > } > > /** > --- 128,134 ---- > * Set the <code>OutputStream</code> where the XML should be serialized. > */ > public void setOutputStream(OutputStream out) { > ! this.output = out; > } > > /** > *************** > *** 264,272 **** > public void notify(Document doc) throws SAXException { > try { > TranscoderInput transInput = new TranscoderInput(doc); > ! TranscoderOutput transOutput = new > TranscoderOutput(this.output); > transcoder.transcode(transInput, transOutput); > ! //this.output.flush(); > } catch (Exception ex) { > log.error("SVGSerializer: Exception writing image", ex); > throw new SAXException("Exception writing image ", ex); > --- 264,279 ---- > public void notify(Document doc) throws SAXException { > try { > TranscoderInput transInput = new TranscoderInput(doc); > ! > ! // Batik's PNGTranscoder closes the output stream. > ! // Therefore we cannot pass it this.output directly. > ! // Otherwise we get an exception when Cocoon.process > ! // tries to flush/close the stream again. > ! ByteArrayOutputStream baos = new ByteArrayOutputStream(8192); > ! > ! TranscoderOutput transOutput = new TranscoderOutput(baos); > transcoder.transcode(transInput, transOutput); > ! baos.writeTo(this.output); > } catch (Exception ex) { > log.error("SVGSerializer: Exception writing image", ex); > throw new SAXException("Exception writing image ", ex); -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
