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

NPE in XPStyle$Skin.getWidth when changing between Win XP style and Win classic style

    Details

      Description

      NetBeans users are reporting NullPointerException thrown at com.sun.java.swing.plaf.windows.XPStyle$Skin.getWidth
      (XPStyle.java:507) when changing Win OS theme between Win XP style and Win classic style.

      Original reports here:
      http://www.netbeans.org/issues/show_bug.cgi?id=105790
      http://www.netbeans.org/issues/show_bug.cgi?id=121824

      Stack trace of an exception:
      java.lang.NullPointerException
              at com.sun.java.swing.plaf.windows.XPStyle$Skin.getWidth(XPStyle.java:507)
              at com.sun.java.swing.plaf.windows.XPStyle$Skin.getWidth(XPStyle.java:511)
              at com.sun.java.swing.plaf.windows.WindowsScrollBarUI.paintThumb(WindowsScrollBarUI.java:175)
              at javax.swing.plaf.basic.BasicScrollBarUI.paint(BasicScrollBarUI.java:366)
              at javax.swing.plaf.ComponentUI.update(ComponentUI.java:143)
              at javax.swing.JComponent.paintComponent(JComponent.java:763)
              at javax.swing.JComponent.paint(JComponent.java:1027)
              at javax.swing.JComponent.paintChildren(JComponent.java:864)
              at javax.swing.JComponent.paint(JComponent.java:1036)
              at javax.swing.JComponent.paintChildren(JComponent.java:864)
              at javax.swing.JComponent.paint(JComponent.java:1036)
              at javax.swing.JComponent.paintChildren(JComponent.java:864)
              at javax.swing.JComponent.paint(JComponent.java:1036)
              at javax.swing.JComponent.paintChildren(JComponent.java:864)
              at javax.swing.JComponent.paint(JComponent.java:1036)
              at javax.swing.JComponent.paintChildren(JComponent.java:864)
              at javax.swing.JComponent.paint(JComponent.java:1036)
              at javax.swing.JComponent.paintChildren(JComponent.java:864)
              at javax.swing.JComponent.paint(JComponent.java:1036)
              at javax.swing.JComponent.paintChildren(JComponent.java:864)
              at javax.swing.JComponent.paint(JComponent.java:1036)
              at javax.swing.JComponent.paintChildren(JComponent.java:864)
              at javax.swing.JComponent.paint(JComponent.java:1036)
              at org.netbeans.core.windows.view.ui.MultiSplitPane.paint(MultiSplitPane.java:316)
              at javax.swing.JComponent.paintChildren(JComponent.java:864)
              at javax.swing.JComponent.paint(JComponent.java:1036)
              at org.netbeans.core.windows.view.ui.MultiSplitPane.paint(MultiSplitPane.java:316)
              at javax.swing.JComponent.paintChildren(JComponent.java:864)
              at javax.swing.JComponent.paint(JComponent.java:1036)
              at org.netbeans.core.windows.view.ui.MultiSplitPane.paint(MultiSplitPane.java:316)
              at javax.swing.JComponent.paintChildren(JComponent.java:864)
              at javax.swing.JComponent.paint(JComponent.java:1036)
              at javax.swing.JComponent.paintChildren(JComponent.java:864)
              at javax.swing.JComponent.paint(JComponent.java:1036)
              at javax.swing.JLayeredPane.paint(JLayeredPane.java:564)
              at javax.swing.JComponent.paintChildren(JComponent.java:864)
              at javax.swing.JComponent.paint(JComponent.java:1036)
              at javax.swing.JComponent.paintChildren(JComponent.java:864)
              at javax.swing.JComponent.paint(JComponent.java:1036)
              at javax.swing.JComponent.paintChildren(JComponent.java:864)
              at javax.swing.JComponent.paint(JComponent.java:1036)
              at javax.swing.JLayeredPane.paint(JLayeredPane.java:564)
              at javax.swing.JComponent.paintChildren(JComponent.java:864)
              at javax.swing.JComponent.paintToOffscreen(JComponent.java:5129)
              at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1382)
              at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1313)
              at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:301)
              at javax.swing.RepaintManager.paint(RepaintManager.java:1128)
              at javax.swing.JComponent.paint(JComponent.java:1013)
              at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)
              at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
              at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
              at java.awt.Container.paint(Container.java:1797)
              at org.netbeans.core.windows.view.ui.MainWindow.paint(MainWindow.java:577)
              at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:734)
              at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:679)
              at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:659)
              at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128)
              at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
              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)

      Unfortunately, error seems to appear randomly, so I don't have any 100% reproducible scenario. Starring at the code, it seems that method getWidth(...) is not prepared to the situation when method getPartSize(...) returns null. So either getPartSize(...) should never return null or getWidth(...) and other methods shoudln't rely on non-null returned value.
      Actually I have found a way to reproduce this:
      it seems that it is always on switch FROM WindowsXP style.
      With NB6 RC1 build, using jdk1.6.0_03

      I start with my custom windows theme active. OK.

      1. created a NB ee5 web project
      2. set Windows Display -> XP style . OK. no exceptions
      3. create another NB web project
      4. switch Windows display from XP -> Classic
      >get the exception

      If I switch from XP -> Custom Theme I also get the exception.

        Attachments

          Activity

            People

            • Assignee:
              peterz Peter Zhelezniakov
              Reporter:
              dsimoneksunw David Simonek (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: