JDK-4407772 : basic headless graphics operations don't work in headless mode.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.0
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_7
  • CPU: sparc
  • Submitted: 2001-01-24
  • Updated: 2002-02-22
  • Resolved: 2001-02-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.0 betaFixed
Related Reports
Duplicate :  
Relates :  
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)

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin-beta FIXED IN: merlin-beta INTEGRATED IN: merlin-beta VERIFIED IN: merlin-beta3
14-06-2004

EVALUATION Commit to fix in Merlin-beta (headless). I'm providing a temporary workaround by adding a separate flag to load a headless library (-Djava.awt.headlesslib=true) in order to get SQE headless testing working again. In the meantime, I have reopened 4365371 as an incomplete fix. michael.martak@Eng 2001-02-06
06-02-2001