cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 13247] New: - [PATCH] PNG output of SVGSerializer broken in HEAD
Date Thu, 03 Oct 2002 15:04:55 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13247>.
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 <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);

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message