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

JComponent.setUI throws NPE in headless mode

XMLWordPrintable

    • sparc
    • solaris_7



      Name: sdR10048 Date: 02/14/2001


      protected void javax.swing.JComponent.setUI(ComponentUI newUI)
      throws unexpected exception NullPointerException ("SurfaceData is NULL
      or native ops missing") in headless mode.
      See example:
      --------------------------------------------------
      [falcon] ~/tmp
      % cat Test.java
      public class Test {
          public static void main(String args[]) {
              System.out.println("===");
              try {
                  new javax.swing.JScrollBar();
              } catch (Exception e) {
                  e.printStackTrace();
              }
              System.out.println("===");
              try {
                  new javax.swing.JInternalFrame();
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      }

      [falcon] ~/tmp
      % java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b50)
      Java HotSpot(TM) Client VM (build 1.4beta-B50, mixed mode)

      [falcon] ~/tmp
      % java -Djava.awt.headless=true Test
      Java HotSpot(TM) Client VM warning: ValueGen::do_LoopEnter(...) not implemented yet
      Java HotSpot(TM) Client VM warning: ValueGen::do_LoopExit(...) not implemented yet
      ===
      java.lang.NullPointerException: SurfaceData is NULL or native ops missing
              at sun.java2d.loops.FillRect.FillRect(Native Method)
              at sun.java2d.pipe.LoopPipe.fillRect(LoopPipe.java:109)
              at sun.java2d.pipe.ValidatePipe.fillRect(ValidatePipe.java:42)
              at sun.java2d.SunGraphics2D.fillRect(SunGraphics2D.java:2014)
              at javax.swing.plaf.metal.BumpBuffer.fillBumpBuffer(MetalBumps.java:177)
              at javax.swing.plaf.metal.BumpBuffer.<init>(MetalBumps.java:152)
              at javax.swing.plaf.metal.MetalBumps.createBuffer(MetalBumps.java:62)
              at javax.swing.plaf.metal.MetalBumps.setBumpColors(MetalBumps.java:97)
              at javax.swing.plaf.metal.MetalBumps.<init>(MetalBumps.java:54)
              at javax.swing.plaf.metal.MetalScrollBarUI.installDefaults(MetalScrollBarUI.java:78)
              at javax.swing.plaf.basic.BasicScrollBarUI.installUI(BasicScrollBarUI.java:105)
              at javax.swing.JComponent.setUI(JComponent.java:360)
              at javax.swing.JScrollBar.setUI(JScrollBar.java:186)
              at javax.swing.JScrollBar.updateUI(JScrollBar.java:206)
              at javax.swing.JScrollBar.<init>(JScrollBar.java:140)
              at javax.swing.JScrollBar.<init>(JScrollBar.java:155)
              at javax.swing.JScrollBar.<init>(JScrollBar.java:169)
              at Test.main(Test.java:5)
      ===
      java.lang.NullPointerException: SurfaceData is NULL or native ops missing
              at sun.java2d.loops.FillRect.FillRect(Native Method)
              at sun.java2d.pipe.LoopPipe.fillRect(LoopPipe.java:109)
              at sun.java2d.pipe.ValidatePipe.fillRect(ValidatePipe.java:42)
              at sun.java2d.SunGraphics2D.fillRect(SunGraphics2D.java:2014)
              at javax.swing.plaf.metal.BumpBuffer.fillBumpBuffer(MetalBumps.java:177)
              at javax.swing.plaf.metal.BumpBuffer.<init>(MetalBumps.java:152)
              at javax.swing.plaf.metal.MetalBumps.createBuffer(MetalBumps.java:62)
              at javax.swing.plaf.metal.MetalBumps.setBumpColors(MetalBumps.java:97)
              at javax.swing.plaf.metal.MetalBumps.<init>(MetalBumps.java:54)
              at javax.swing.plaf.metal.MetalDesktopIconUI.installComponents(MetalDesktopIconUI.java:65)
              at javax.swing.plaf.basic.BasicDesktopIconUI.installUI(BasicDesktopIconUI.java:53)
              at javax.swing.JComponent.setUI(JComponent.java:360)
              at javax.swing.JInternalFrame$JDesktopIcon.setUI(JInternalFrame.java:2099)
              at javax.swing.JInternalFrame$JDesktopIcon.updateUI(JInternalFrame.java:2147)
              at javax.swing.JInternalFrame$JDesktopIcon.<init>(JInternalFrame.java:2079)
              at javax.swing.JInternalFrame.<init>(JInternalFrame.java:285)
              at javax.swing.JInternalFrame.<init>(JInternalFrame.java:203)
              at Test.main(Test.java:11)

      ======================================================================

            mmartaksunw Michael Martak (Inactive)
            dsvsunw Dsv Dsv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: