JDK-6221207 : Font2DTest:ClassCastException occured while saving the Font as JPEG file.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_10
  • CPU: sparc
  • Submitted: 2005-01-25
  • Updated: 2010-04-02
  • Resolved: 2005-01-25
Related Reports
Duplicate :  
Description
Bug Info:
---------
Font2DTest($JAVA_HOME/demo/jfc/Font2DTest) is throwing ClassCastException while saving a Font as JPEG file.

JDK Info:
--------
java version "1.6.0-ea"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b19)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0-ea-b19, mixed mode)

BUG Details:
-------------
java.lang.ClassCastException: sun.awt.image.DataBufferNative cannot be cast to java.awt.image.DataBufferInt
        at sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:405)
        at sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:228)
        at FontPanel$FontCanvas.writeJPEG(FontPanel.java:1079)
        at FontPanel.doSaveJPEG(FontPanel.java:392)
        at Font2DTest.actionPerformed(Font2DTest.java:780)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1863)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2183)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
        at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1109)
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1150)
        at java.awt.Component.processMouseEvent(Component.java:5517)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3214)
        at java.awt.Component.processEvent(Component.java:5282)
        at java.awt.Container.processEvent(Container.java:1965)
        at java.awt.Component.dispatchEventImpl(Component.java:3958)
        at java.awt.Container.dispatchEventImpl(Container.java:2023)
        at java.awt.Component.dispatchEvent(Component.java:3806)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4211)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3891)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3821)
        at java.awt.Container.dispatchEventImpl(Container.java:2009)
        at java.awt.Window.dispatchEventImpl(Window.java:1768)
        at java.awt.Component.dispatchEvent(Component.java:3806)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:591)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)


Steps to Reproduce:
-------------------
1. Enter ther following command in the console.
${JAVA_HOME}/bin/java -jar -d64 ${JAVA_HOME}/demo/jfc/Font2DTest.jar
2. Click on FileMenu and choose SaveAsJPEG option and save the Font as image.
3.Check the console for error.

Expected Behavior:
------------------
The Font should save as JPEG file.

Actual Behavior:
----------------
It throws an exception.

Desktop Session:
----------------
GNOME2.0

###@###.### 2005-1-25 12:41:17 GMT