You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm in the process of migrating my applications to OpenJDK 11, I've discovered that copying a ChartPanel image to the WIndows clipboard now gives an IOException:
java.io.IOException: Registered service providers failed to encode BufferedImage@228e6026: type = 2 DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=ff000000 IntegerInterleavedRaster: width = 765 height = 420 #Bands = 4 xOff = 0 yOff = 0 dataOffset[0] 0 to image/jpeg
at java.desktop/sun.awt.datatransfer.DataTransferer.imageToStandardBytesImpl(DataTransferer.java:1799)
at java.desktop/sun.awt.datatransfer.DataTransferer.imageToStandardBytes(DataTransferer.java:1713)
at java.desktop/sun.awt.windows.WDataTransferer.imageToPlatformBytes(WDataTransferer.java:353)
at java.desktop/sun.awt.datatransfer.DataTransferer.translateTransferable(DataTransferer.java:855)
at java.desktop/sun.awt.windows.WDataTransferer.translateTransferable(WDataTransferer.java:220)
at java.desktop/sun.awt.windows.WClipboard.setContentsNative(WClipboard.java:83)
at java.desktop/sun.awt.datatransfer.SunClipboard.setContents(SunClipboard.java:105)
at org.jfree.chart.ChartPanel.doCopy(ChartPanel.java:2702)
Have done some research, it seems that the alpha channel of the JPEG image is no longer supported in the OpenJDK implementation.
I've tracked it down to org.jfree.chart.ChartTransferable.ChartTransferable.createBufferedImage(…)
BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
If BufferedImage.TYPE_INT_ARGB is replaced by BufferedImage.TYPE_INT_RGB, it works. Not sure if there are any other places with similar issues.
Here are some links from my research: https://github.com/fesch/Structorizer.D ... issues/685
Apparently, the clipboard converts the image into JPG format instead of PNG as the menu item promises. As you would expect, the stack trace vanishes if the image type BufferedImage.TYPE_INT_RGB is used to prepare the image for transfer. The visual result doesn't differ.
Thanks for the report. I presume the the JDK on Windows tries to convert the image to JPEG format? I don't get any exception on MacOS. Nevertheless, I've changed the BufferedImage type for the next release (v.1.5.2).
I'm in the process of migrating my applications to OpenJDK 11, I've discovered that copying a ChartPanel image to the WIndows clipboard now gives an IOException:
java.io.IOException: Registered service providers failed to encode BufferedImage@228e6026: type = 2 DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=ff000000 IntegerInterleavedRaster: width = 765 height = 420 #Bands = 4 xOff = 0 yOff = 0 dataOffset[0] 0 to image/jpeg
at java.desktop/sun.awt.datatransfer.DataTransferer.imageToStandardBytesImpl(DataTransferer.java:1799)
at java.desktop/sun.awt.datatransfer.DataTransferer.imageToStandardBytes(DataTransferer.java:1713)
at java.desktop/sun.awt.windows.WDataTransferer.imageToPlatformBytes(WDataTransferer.java:353)
at java.desktop/sun.awt.datatransfer.DataTransferer.translateTransferable(DataTransferer.java:855)
at java.desktop/sun.awt.windows.WDataTransferer.translateTransferable(WDataTransferer.java:220)
at java.desktop/sun.awt.windows.WClipboard.setContentsNative(WClipboard.java:83)
at java.desktop/sun.awt.datatransfer.SunClipboard.setContents(SunClipboard.java:105)
at org.jfree.chart.ChartPanel.doCopy(ChartPanel.java:2702)
Have done some research, it seems that the alpha channel of the JPEG image is no longer supported in the OpenJDK implementation.
I've tracked it down to org.jfree.chart.ChartTransferable.ChartTransferable.createBufferedImage(…)
BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
If BufferedImage.TYPE_INT_ARGB is replaced by BufferedImage.TYPE_INT_RGB, it works. Not sure if there are any other places with similar issues.
Here are some links from my research:
https://github.com/fesch/Structorizer.D ... issues/685
Apparently, the clipboard converts the image into JPG format instead of PNG as the menu item promises. As you would expect, the stack trace vanishes if the image type BufferedImage.TYPE_INT_RGB is used to prepare the image for transfer. The visual result doesn't differ.
https://bugs.openjdk.java.net/browse/JDK-8176556
https://bugs.openjdk.java.net/browse/JDK-8204188
JDK-8204187 removed support for ARGB channel for JPEG. Test uses ARGB input to encode JPEG image and we get IOException.
The text was updated successfully, but these errors were encountered: