Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8160421

Regression: JDK-8139192 causes NPE in java.awt.Toolkit.createCustomCursor()

    XMLWordPrintable

Details

    • b124
    • 9
    • b130
    • x86
    • linux, windows

    Description

      FULL PRODUCT VERSION :
      This is the first build that exhibits the problem:

      Java(TM) SE Runtime Environment (build 9-ea+124)
      Java HotSpot(TM) Server VM (build 9-ea+124, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux 3.4.63-2.44

      A DESCRIPTION OF THE PROBLEM :
      The fix to JDK-8139192 causes a null pointer exception in java.awt.Toolkit.createCustomCursor().

      This breaks the popular jEdit text editor. The NPE happens on the EDT.

      REGRESSION. Last worked in version 9

      ADDITIONAL REGRESSION INFORMATION:
      This is the last known good version:

      Java(TM) SE Runtime Environment (build 9-ea+123)
      Java HotSpot(TM) Server VM (build 9-ea+123, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run the test case below to reproduce the NPE. This is an excerpt from the jEdit text editor that I have prepared for your convenience.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      There should be no exception.
      ACTUAL -
      There is a null pointer exception (see below).

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.lang.NullPointerException
      at sun.awt.image.OffScreenImageSource.produce(java.desktop@9-ea/OffScreenImageSource.java:191)
      at sun.awt.image.OffScreenImageSource.addConsumer(java.desktop@9-ea/OffScreenImageSource.java:66)
      at sun.awt.image.OffScreenImageSource.startProduction(java.desktop@9-ea/OffScreenImageSource.java:80)
      at java.awt.image.PixelGrabber.grabPixels(java.desktop@9-ea/PixelGrabber.java:259)
      at java.awt.image.PixelGrabber.grabPixels(java.desktop@9-ea/PixelGrabber.java:226)
      at sun.awt.CustomCursor.<init>(java.desktop@9-ea/CustomCursor.java:94)
      at sun.awt.X11CustomCursor.<init>(java.desktop@9-ea/X11CustomCursor.java:44)
      at sun.awt.X11.XCustomCursor.<init>(java.desktop@9-ea/XCustomCursor.java:43)
      at sun.awt.X11.XToolkit.createCustomCursor(java.desktop@9-ea/XToolkit.java:1211)
      at Bug8139192Regression.main(Bug8139192Regression.java:5)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      class Bug8139192Regression extends javax.swing.JFrame {

      public static void main(String[] args) throws Exception {
      final java.awt.Component component = new Bug8139192Regression();
      component.getToolkit().createCustomCursor(
      component.getGraphicsConfiguration().createCompatibleImage(
      16, 16, java.awt.Transparency.BITMASK),
      new java.awt.Point(0,0),
      "Hidden");
      }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      This is internal to AWT. There is no workaround. You have two options to fix this:

      1) Back out bug #8139192

      2) Change the call site in java.awt.Toolkit.createCustomCursor()


      Attachments

        Issue Links

          Activity

            People

              aghaisas Ajit Ghaisas
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: