I have frame which has button to invoke a file dialog & select any image that can be draw on a canvas. When i try to display the animated image , i am getting java.lang.NullPointerException. This works fine jdk7.0 b07 , but fails in jdk7.0 b08. Hence this is a regression. This happens only in windows, it works fine in solaris.
The problem can be reproduced in two ways.
First method to Reproduce the problem
-----------------------------------
1) Run the attached program.
2) Click on "Get Dialog" button. Select animdog.gif file attached. Observe that animdog.gif is seen on the canvas.
3) Click on "Get Dialog" button. Select flower.gif file attached. Observe that flower is seen on the canvas.
4) Repeat step (2). If you see the java.lang.NullPointer exception , then the bug is reproduced.
Second method to Reproduce the problem
---------------------------------------
1) Run the attached program.
2) Click on "Get Dialog" button. Select animdog.gif file attached. Observe that animdog.gif is seen on the canvas.
3) Resize the frame. If you see the java.lang.NullPointer exception , then the bug is reproduced.
Java(TM) SE Runtime Environment (build 1.7.0-ea-b08)
Java HotSpot(TM) Client VM (build 1.7.0-ea-b08, mixed mode, sharing)
Exception occurred during event dispatching:
java.lang.NullPointerException
at sun.java2d.windows.Win32SurfaceDataProxy$Bitmask.findUnusedPixelICM(Win32SurfaceDataProxy.java:363)
at sun.java2d.windows.Win32SurfaceDataProxy$Bitmask.findTransparentPixel(Win32SurfaceDataProxy.java:330)
at sun.java2d.windows.Win32SurfaceDataProxy$Bitmask.validateSurfaceData(Win32SurfaceDataProxy.java:274)
at sun.java2d.SurfaceDataProxy.replaceData(SurfaceDataProxy.java:426)
at sun.java2d.SurfaceData.getSourceSurfaceData(SurfaceData.java:209)
at sun.java2d.pipe.DrawImage.renderImageCopy(DrawImage.java:545)
at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:53)
at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:990)
at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3023)
at sun.awt.image.ImageRepresentation.drawToBufImage(ImageRepresentation.java:746)
at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:997)
at sun.java2d.pipe.ValidatePipe.copyImage(ValidatePipe.java:168)
at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3023)
at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3008)
at ReproduceException$ImageCanvas.paint(ReproduceException.java:64)
at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
at sun.awt.RepaintArea.paint(RepaintArea.java:224)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:301)
at java.awt.Component.dispatchEventImpl(Component.java:4481)
at java.awt.Component.dispatchEvent(Component.java:4235)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:177)
at java.awt.Dialog$1.run(Dialog.java:1045)
at java.awt.Dialog$3.run(Dialog.java:1099)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:1097)
at java.awt.Component.show(Component.java:1414)
at java.awt.Component.setVisible(Component.java:1367)
at java.awt.Window.setVisible(Window.java:818)
at java.awt.Dialog.setVisible(Dialog.java:984)
at ReproduceException$1.actionPerformed(ReproduceException.java:18)
at java.awt.Button.processActionEvent(Button.java:392)
at java.awt.Button.processEvent(Button.java:360)
at java.awt.Component.dispatchEventImpl(Component.java:4405)
at java.awt.Component.dispatchEvent(Component.java:4235)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Machine details
---------------
Windows XP Home Edition
Version 2002
Service Pack 2
Intel Pentium 3 processor
730 MHz , 256 MB of RAM.
There is an another way to reproduce the same exception.
Lunch SwingSet2 in windows. You can see exception on the console.