JDK-6693514 : PrinterJob.printDialog() window not shown in ubuntu linux
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2008-04-24
  • Updated: 2011-02-16
  • Resolved: 2008-04-24
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
user1@GF6100M9:~$ java -version
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_03-b05, mixed mode)
C:\Documents and Settings\Administrator>java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0-b105, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
user1@GF6100M9:~$ uname -a
Linux GF6100M9 2.6.22-14-generic #1 SMP Tue Feb 12 02:46:46 UTC 2008 x86_64 GNU/Linux
C:\Documents and Settings\Administrator>ver
Microsoft Windows [5.2.3790]



A DESCRIPTION OF THE PROBLEM :
The following Test.java program gives a dialog window in XPx64, but not in Ubuntu Linux.
//################### Test printDialog show only ############
import java.awt.print.PrinterJob;
public class Test {
  Test test;
  public static void main(String[]args) {
    Test test=new Test(); test.test=test; test.main2(); //escape static
  }
  protected void main2() { //escapes static
    PrinterJob prJ;
    prJ=PrinterJob.getPrinterJob();
    System.out.println("------------------LOOK FOR & CLICK PRINT DIALOG");
    if(prJ.printDialog()) { //Doesn't show window in Linux, but does in Windows
    } //pause("after printDialog");
  }
}  
Running gives the following output in Ubuntu Linux.
user1@GF6100M9:~$ javac Test.java

user1@GF6100M9:~$ java Test

------------------LOOK FOR & CLICK PRINT DIALOG

Exception in thread "main" java.lang.NullPointerException: null attribute

        at sun.print.IPPPrintService.isAttributeValueSupported(IPPPrintService.java:1147)

        at sun.print.ServiceDialog$OrientationPanel.updateInfo(ServiceDialog.java:2121)

        at sun.print.ServiceDialog$PageSetupPanel.updateInfo(ServiceDialog.java:1263)

        at sun.print.ServiceDialog.updatePanels(ServiceDialog.java:437)

        at sun.print.ServiceDialog.initPrintDialog(ServiceDialog.java:195)

        at sun.print.ServiceDialog.<init>(ServiceDialog.java:124)

        at javax.print.ServiceUI.printDialog(ServiceUI.java:188)

        at sun.print.RasterPrinterJob.printDialog(RasterPrinterJob.java:855)

        at sun.print.PSPrinterJob.printDialog(PSPrinterJob.java:421)

        at Test.main2(Test.java:12)

        at Test.main(Test.java:6)

user1@GF6100M9:~$



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
compile and run the program

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
user1@GF6100M9:~$ javac Test.java
user1@GF6100M9:~$ java Test
------------------LOOK FOR & CLICK PRINT DIALOG //Saw window in XPx64 and clicked it
user1@GF6100M9:~$
ACTUAL -
user1@GF6100M9:~$ javac Test.java
user1@GF6100M9:~$ java Test
------------------LOOK FOR & CLICK PRINT DIALOG
Exception in thread "main" java.lang.NullPointerException: null attribute
        at sun.print.IPPPrintService.isAttributeValueSupported(IPPPrintService.java:1147)
        at sun.print.ServiceDialog$OrientationPanel.updateInfo(ServiceDialog.java:2121)
        at sun.print.ServiceDialog$PageSetupPanel.updateInfo(ServiceDialog.java:1263)
        at sun.print.ServiceDialog.updatePanels(ServiceDialog.java:437)
        at sun.print.ServiceDialog.initPrintDialog(ServiceDialog.java:19)
        at sun.print.ServiceDialog.<init>(ServiceDialog.java:124)
        at javax.print.ServiceUI.printDialog(ServiceUI.java:188)
        at sun.print.RasterPrinterJob.printDialog(RasterPrinterJob.java:855)
        at sun.print.PSPrinterJob.printDialog(PSPrinterJob.java:421)
        at Test.main2(Test.java:12)
        at Test.main(Test.java:6)
user1@GF6100M9:~$


ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.NullPointerException: null attribute
        at sun.print.IPPPrintService.isAttributeValueSupported(IPPPrintService.java:1147)
        at sun.print.ServiceDialog$OrientationPanel.updateInfo(ServiceDialog.java:2121)
        at sun.print.ServiceDialog$PageSetupPanel.updateInfo(ServiceDialog.java:1263)
        at sun.print.ServiceDialog.updatePanels(ServiceDialog.java:437)
        at sun.print.ServiceDialog.initPrintDialog(ServiceDialog.java:19)
        at sun.print.ServiceDialog.<init>(ServiceDialog.java:124)
        at javax.print.ServiceUI.printDialog(ServiceUI.java:188)
        at sun.print.RasterPrinterJob.printDialog(RasterPrinterJob.java:855)
        at sun.print.PSPrinterJob.printDialog(PSPrinterJob.java:421)
        at Test.main2(Test.java:12)
        at Test.main(Test.java:6)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
//################### Test printDialog show only ############
import java.awt.print.PrinterJob;
public class Test {
  Test test;
  public static void main(String[]args) {
    Test test=new Test(); test.test=test; test.main2(); //escape static
  }
  protected void main2() { //escapes static
    PrinterJob prJ;
    prJ=PrinterJob.getPrinterJob();
    System.out.println("------------------LOOK FOR & CLICK PRINT DIALOG");
    if(prJ.printDialog()) { //Doesn't show window in Linux, but does in Windows
    } //pause("after printDialog");
  }
}  

---------- END SOURCE ----------