JDK-5005196 : Java2Demo throws NPE when dereferencing null returned from createImage()
  • Type: Bug
  • Component: client-libs
  • Sub-Component: demo
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2004-02-28
  • Updated: 2019-12-17
  • Resolved: 2019-12-17
Related Reports
Relates :  
Description
Name: agR10216			Date: 02/28/2004


Running demo/jfc/Java2D/Java2Demo.jar with the tiger build 36,
I occasionally got the following exception:
    java.lang.NullPointerException
            at java2d.PerformanceMonitor$Surface.run(PerformanceMonitor.java:153)
            at java.lang.Thread.run(Thread.java:566)

Here are the pertinent lines from java2d.PerformanceMonitor$Surface.run():
            bimg = (BufferedImage) createImage(d.width, d.height);
            Graphics2D big = bimg.createGraphics();

The second line may throw NPE since createImage() may return null as it's
specified in the javadoc for Component.createImage(int width, int height).

The demo should be revised to work correctly in this case.

###@###.### 2004-02-28
======================================================================

Comments
EVALUATION Very rarely reproducible. Seen rarely when running on faster machines. The fix suggested in the description looks reasonable and will be taken up in Dolphin.
26-07-2005

EVALUATION Not reproduceable by 2D-SQE. Could be a threading issue. Need more info from the submitter ###@###.### Name: agR10216 Date: 03/25/2004 The issue is time-dependent and may be difficult to reproduce. Component.createImage() may return null if the component is not displayable (refer to the javadoc). ###@###.### 2004-03-25 ======================================================================
25-03-2004