United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-8019201 Regression: java.awt.image.ConvolveOp throws java.awt.image.ImagingOpException
JDK-8019201 : Regression: java.awt.image.ConvolveOp throws java.awt.image.ImagingOpException

Details
Type:
Bug
Submit Date:
2013-06-26
Status:
Closed
Updated Date:
2013-11-07
Project Name:
JDK
Resolved Date:
2013-07-25
Component:
client-libs
OS:
windows_7
Sub-Component:
2d
CPU:
Priority:
P2
Resolution:
Fixed
Affected Versions:
7u25
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:

Sub Tasks

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
Please get SQE-OK - once that is added - this can be approved.

                                     
2013-07-15
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.
                                     
2013-07-16
URL:   http://hg.openjdk.java.net/jdk8/2d/jdk/rev/833f05116f7b
User:  bae
Date:  2013-07-25 13:16:49 +0000

                                     
2013-07-25
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. 
                                     
2013-07-25
URL:   http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/833f05116f7b
User:  lana
Date:  2013-08-06 17:34:56 +0000

                                     
2013-08-06
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
                                     
2013-11-07



Hardware and Software, Engineered to Work Together