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

NullPointerException in java.awt.Component.BltBufferStrategy.showSubRegion

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • None
    • 6u18
    • client-libs
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0_18"
      Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
      Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Versione 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      I'm starting a Java Web Start application, with the Java console always shown. It happens that the Java console gets displayed, then hidden, then displayed again, and only then the application main window is displayed.

      It seems that in some circumstances, as stated in bug #6281999, a window (I think that of the Java console) can get disposed while painting. This leads to a NullPointerException in java.awt.Component.BltBufferStrategy.showSubRegion(int, int, int, int). Bug #6281999 fixed such a case by null-checking the Graphics object obtained from getGraphics_NoClientCode(); however, it does not null-check against the Graphics obtained from the backbuffers array. If java.awt.Component.BltBufferStrategy.dispose() is called meanwhile, a NPE can occur inside the for loop of showSubRegion.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. in the Java Control Panel, Advanced Tab, check "Java console", "Show console"
      2. try to start a Java application via JNLP through Java Web Start; this application might set some VM properties that cause the JWS client to show the Java console, then hide, then show it again before showing the main application window. For instance, suppose that the JNLP specifies the following:

      <property name="swing.defaultlaf" value="javax.swing.plaf.metal.MetalLookAndFeel"/>

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The application starts with no errors.
      ACTUAL -
      The application starts, but in the last opened Java console an exception gets printed (see Error Message field).

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
       at java.awt.Component$BltBufferStrategy.showSubRegion(Unknown Source)
       at java.awt.Component$BltSubRegionBufferStrategy.show(Unknown Source)
       at javax.swing.BufferStrategyPaintManager.flushAccumulatedRegion(Unknown Source)
       at javax.swing.BufferStrategyPaintManager.endPaint(Unknown Source)
       at javax.swing.RepaintManager.endPaint(Unknown Source)
       at javax.swing.JComponent._paintImmediately(Unknown Source)
       at javax.swing.JComponent.paintImmediately(Unknown Source)
       at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
       at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
       at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
       at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
       at java.awt.event.InvocationEvent.dispatch(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)

      (unfortunately, I'm using a standard JRE when this happens, so I don't have line numbers)

      REPRODUCIBILITY :
      This bug can be reproduced occasionally.

      Release Regression From : 6u5
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

            denis Denis Fokin (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: