JDK-8019201 : Regression: java.awt.image.ConvolveOp throws java.awt.image.ImagingOpException
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7u25
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_7
  • Submitted: 2013-06-26
  • Updated: 2013-11-07
  • Resolved: 2013-07-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other Other JDK 6 JDK 7 JDK 8
5.0u55Fixed 5.0u61Fixed 6-poolResolved 7u40Fixed 8 b102Fixed
Description
FULL PRODUCT VERSION :
java version  " 1.7.0_25 " 
Java(TM) SE Runtime Environment (build 1.7.0_25-b16)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Windows 7
Windows XP
Mac OS X 10.8.4

A DESCRIPTION OF THE PROBLEM :
Invoking java.awt.image.ConvolveOp#filter(java.awt.image.BufferedImage, java.awt.image.BufferedImage) with the source image a locally created image (i.e. new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB)) and the target image a device configuration compatible image (i.e. deviceConfiguration.createCompatibleImage(w, h, Transparency.TRANSLUCENT)) results in java.awt.image.ImagingOpException: Unable to convolve src image.

This is a regression as this code works up to JDK 1.7.0_21! (Unfortunately, it does not seem possible to select that version in the regression field below.)

Only Windows and Mac OS X JDKs seem to be affected.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached test case.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No output on system err.
ACTUAL -
A stacktrace is printed to system err.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.awt.image.ImagingOpException: Unable to convolve src image
at java.awt.image.ConvolveOp.filter(Unknown Source)
at ConvolveOpTest$TestComponent.paintComponent(ConvolveOpTest.java:61)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
at java.awt.Container.paint(Unknown Source)
at java.awt.Window.paint(Unknown Source)
at javax.swing.RepaintManager$3.run(Unknown Source)
at javax.swing.RepaintManager$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.access$1000(Unknown Source)
at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.Transparency;
import java.awt.image.BufferedImage;
import java.awt.image.ConvolveOp;
import java.awt.image.ImagingOpException;
import java.awt.image.Kernel;
import javax.swing.JComponent;
import javax.swing.JFrame;

/**
 * Demonstrates java.awt.image.ImagingOpException: Unable to convolve src image
 * in JDK 1.7.0_25.
 */
public class ConvolveOpTest {
  private void start() {
    final JFrame frame = new JFrame(ConvolveOpTest.class.getName());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(new TestComponent());
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }

  public static void main( String[] args ) {
    EventQueue.invokeLater(new Runnable() {
      public void run() {
        (new ConvolveOpTest()).start();
      }
    });
  }

  private static final class TestComponent extends JComponent {
    TestComponent() {
      setPreferredSize(new Dimension(480, 320));
    }

    protected void paintComponent( final Graphics g ) {
      super.paintComponent(g);

      float[] data = {1, 1, 1,};
      Kernel kernel = new Kernel(1, data.length, data);
      ConvolveOp convolveOp = new ConvolveOp(kernel, ConvolveOp.EDGE_NO_OP, null);

      int size = 96;

      BufferedImage src = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB);
      Graphics2D gfx = src.createGraphics();
      gfx.setColor(Color.WHITE);
      gfx.fillRect(0, 0, size, size);
      gfx.dispose();

      GraphicsConfiguration gc = ((Graphics2D) g).getDeviceConfiguration();
      BufferedImage dst =  gc.createCompatibleImage(size, size, Transparency.TRANSLUCENT);

      try {
        convolveOp.filter(src, dst);
      } catch (ImagingOpException e) {
        e.printStackTrace();
      }
    }
  }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Instead of using a locally created and a device compatible image either use two locally created or two device compatible images.
Comments
Verified in jdk8b114 Environment: Windows 7 x64 OS X 10.9 x64 java version "1.8.0-ea" Java(TM) SE Runtime Environment (build 1.8.0-ea-b114) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b56, mixed mode) Test test/sun/awt/image/ImagingLib/SamePackingTypeTest.java passed successful
07-11-2013

Recommended scope of testing: The usual regression tests, SQE have some imaging tests as part of the SQE 2D tests. And being part of whatever running manual tests across system configs there might be.
25-07-2013

I had some conversation with Andrew who explained impact to me and now I believe this bug can wait till 7u60. So SQE is OK to defer this.
16-07-2013

Please get SQE-OK - once that is added - this can be approved.
15-07-2013