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

basic headless graphics operations don't work in headless mode.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 1.4.0
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      beta
    • CPU:
      sparc
    • OS:
      solaris_7
    • Verification:
      Verified

      Description

      I don't know how widespread this problem is but inspection of code in
      share/native/sun/awt/image/BufImgSurfaceData.c shows that when HEADLESS is
      defined for a build that a lot of functions/code for drawing to offscreen
      images is incorrectly stubbed out. Its hard to see how any image operations
      or apis which depend on it - such as printing - could possibly work.
      The following basic test fails :-

      import java.awt.*;
      import java.awt.image.*;

      public class ImgDraw {

          public static void main(String[] args) {

              BufferedImage bim =
                  new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);
              Graphics ig = bim.getGraphics();
              ig.setColor(Color.black);
              ig.drawLine(0,0,200,200);
          }
      }



      % /usr/local/java/jdk1.4/solsparc/bin/java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b48)
      Java HotSpot(TM) Client VM (build 1.4beta-B48, mixed mode)

      % /usr/local/java/jdk1.4/solsparc/bin/java -Djava.awt.headless=true ImgDraw
      Exception in thread "main" java.lang.NullPointerException: SurfaceData is NULL or native ops missing
              at sun.java2d.loops.DrawLine.DrawLine(Native Method)
              at sun.java2d.pipe.LoopPipe.drawLine(LoopPipe.java:44)
              at sun.java2d.pipe.ValidatePipe.drawLine(ValidatePipe.java:30)
              at sun.java2d.SunGraphics2D.drawLine(SunGraphics2D.java:1847)
              at ImgDraw.main(ImgDraw.java:12)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mmartaksunw Michael Martak (Inactive)
              Reporter:
              prr Philip Race
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: