-
Bug
-
Resolution: Fixed
-
P4
-
1.4.0
-
hopper
-
x86
-
windows_2000
Name: md23716 Date: 10/05/2001
JPEG file works with Internet Explorer 5, but fails on JDK 1.2.2, 1.3.0, 1.3.1, 1.4.
Error messages:
Corrupt JPEG data: premature end of data segment
Unsupported marker type 0x0a
Test case below. Failing JPEG file JPEGErrorTest.jpg available.
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import java.io.File;
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import javax.swing.*;
import com.sun.image.codec.jpeg.*;
public class Display extends JFrame
{
public Display (String filename)
{
super(filename);
FileInputStream inStream = null;
try
{
inStream = new FileInputStream(filename);
}
catch (java.io.FileNotFoundException e)
{
System.out.println("File " + filename + " not found.");
}
JPEGImageDecoder dec = null;
dec = JPEGCodec.createJPEGDecoder(inStream);
System.out.println("JPEGImageDecoderImpl->" + dec );
BufferedImage image = null;
System.out.println("Before decodeAsBufferedImage");
try
{
image = dec.decodeAsBufferedImage();
}
catch (java.io.IOException e)
{
System.out.println("IOException decoding " + filename + "= " + e.getMessage());
}
catch (ImageFormatException e)
{
System.out.println("General exception decoding: " + e.getMessage());
}
catch(Exception e)
{
System.out.println("General exception decoding: " + e.getMessage());
}
System.out.println("After decodeAsBufferedImage");
JLabel view = new JLabel(new ImageIcon(image));
getContentPane().add(view);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent event)
{
System.exit(0);
}
});
}
public static void main(String[] argv)
{
String filename;
if (argv.length > 0)
{
filename = argv[0];
}
else
{
filename = "JPEGErrorTest.jpg";
}
try
{
JFrame frame = new Display(filename);
frame.pack();
frame.setVisible(true);
}
catch (Exception e)
{
System.exit(1);
}
}
}
======================================================================
###@###.### 2001-10-22
Licensee states .jpeg was created using Paint Shop Pro.
###@###.### 2001-10-26
Chris-As a followup to our discussion, and your request feed; here's the reply:
Licensee states their customer's view is that since IE and Netscape ca both handle the image (and there are other similar ones that the customer has produced, also using PaintShopPro), then the Sun JDK should also display whatever it can.