You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2003/03/03 18:33:18 UTC

DO NOT REPLY [Bug 17610] New: - JPEG attachment serialization fails under JDK 1.4

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=17610>.
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=17610

JPEG attachment serialization fails under JDK 1.4

           Summary: JPEG attachment serialization fails under JDK 1.4
           Product: Axis
           Version: 1.1RC1
          Platform: PC
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Serialization/Deserialization
        AssignedTo: axis-dev@ws.apache.org
        ReportedBy: gary.gordon@softwareagusa.com


There is a bug in org.apache.axis.components.image.MerlinIO that causes 
serialization of a JPEG attachment to fail if you are using JDK 1.4.  The 
program below shows the problem.  The problem is caused by the MerlinIO class 
attempting to pass an OutputStream as a parameter directly to 
ImageWriter.setOutput(), instead of wrapping the output stream in a 
javax.imageio.ImageOutputStream, as required per the JDK documentation.

To fix the problem, change one line in MerlinIO.java:
90c90
<        writer.setOutput(os);
---
>        writer.setOutput(javax.imageio.ImageIO.createImageOutputStream(os));

Version info: java full version "1.4.1-b21"

public class istst {
public static void main(String[] args) throws Exception {
  java.awt.image.BufferedImage img = javax.imageio.ImageIO.read(
    new java.net.URL("http://www.sun.com/im/home_exec_boardroom.jpg"));
    new org.apache.axis.attachments.ImageDataSource("foo", "image/jpeg", img);
  }
}

This leads to the follwing stack trace:
Mar 3, 2003 11:41:32 AM org.apache.axis.attachments.ImageDataSource <init>
SEVERE: Exception:
java.lang.IllegalArgumentException: Illegal output type!
        at javax.imageio.ImageWriter.setOutput(ImageWriter.java:200)
        at com.sun.imageio.plugins.jpeg.JPEGImageWriter.setOutput(JPEGImageWrite
r.java:165)
        at org.apache.axis.components.image.MerlinIO.saveImage(MerlinIO.java:90)

        at org.apache.axis.attachments.ImageDataSource.<init>(ImageDataSource.ja
va:92)
        at istst.main(istst.java:5)