Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 63154 invoked by uid 500); 3 Oct 2002 15:21:28 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 63140 invoked from network); 3 Oct 2002 15:21:27 -0000 Date: 3 Oct 2002 15:04:55 -0000 Message-ID: <20021003150455.19827.qmail@nagoya.betaversion.org> From: bugzilla@apache.org To: cocoon-dev@xml.apache.org Cc: Subject: DO NOT REPLY [Bug 13247] New: - [PATCH] PNG output of SVGSerializer broken in HEAD X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13247 [PATCH] PNG output of SVGSerializer broken in HEAD Summary: [PATCH] PNG output of SVGSerializer broken in HEAD Product: Cocoon 2 Version: Current CVS Platform: All OS/Version: All Status: NEW Severity: Major Priority: Other Component: sitemap components AssignedTo: cocoon-dev@xml.apache.org ReportedBy: Alfred.Nathaniel@swx.com 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 OutputStream where the XML should be serialized. */ public void setOutputStream(OutputStream out) { ! this.output = new BufferedOutputStream(out); } /** --- 128,134 ---- * Set the OutputStream 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); --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org