-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
9
-
x86
-
other
FULL PRODUCT VERSION :
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 10
A DESCRIPTION OF THE PROBLEM :
Getting NullPointerException while accessing the Print method of RasterPrinterJob Class
xception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.desktop/sun.print.RasterPrinterJob.setAttributes(RasterPrinterJob.java:1240)
at java.desktop/sun.awt.windows.WPrinterJob.setAttributes(WPrinterJob.java:696)
at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1510)
at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1443)
at com.test.HelloWorldPrinter.actionPerformed(HelloWorldPrinter.java:70)
REGRESSION. Last worked in version 8u151
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
public void actionPerformed(ActionEvent e) {
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(this);
boolean ok = job.printDialog();
if (ok) {
try {
job.print();
} catch (PrinterException ex) {
/* The job did not successfully complete */
}
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It should start printing the page as the print command is given.
ACTUAL -
Getting NullPointerException while accessing the Print method of RasterPrinterJob Class
xception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.desktop/sun.print.RasterPrinterJob.setAttributes(RasterPrinterJob.java:1240)
at java.desktop/sun.awt.windows.WPrinterJob.setAttributes(WPrinterJob.java:696)
at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1510)
at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1443)
at com.test.HelloWorldPrinter.actionPerformed(HelloWorldPrinter.java:70)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Getting NullPointerException while accessing the Print method of RasterPrinterJob Class
xception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.desktop/sun.print.RasterPrinterJob.setAttributes(RasterPrinterJob.java:1240)
at java.desktop/sun.awt.windows.WPrinterJob.setAttributes(WPrinterJob.java:696)
at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1510)
at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1443)
at com.test.HelloWorldPrinter.actionPerformed(HelloWorldPrinter.java:70)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public void actionPerformed(ActionEvent e) {
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(this);
boolean ok = job.printDialog();
if (ok) {
try {
job.print();
} catch (PrinterException ex) {
/* The job did not successfully complete */
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
public void actionPerformed(ActionEvent e) {
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(this);
boolean ok = job.printDialog();
if (ok) {
try {
job.print();
} catch (PrinterException ex) {
/* The job did not successfully complete */
}
}
}
SUPPORT :
YES
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 10
A DESCRIPTION OF THE PROBLEM :
Getting NullPointerException while accessing the Print method of RasterPrinterJob Class
xception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.desktop/sun.print.RasterPrinterJob.setAttributes(RasterPrinterJob.java:1240)
at java.desktop/sun.awt.windows.WPrinterJob.setAttributes(WPrinterJob.java:696)
at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1510)
at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1443)
at com.test.HelloWorldPrinter.actionPerformed(HelloWorldPrinter.java:70)
REGRESSION. Last worked in version 8u151
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
public void actionPerformed(ActionEvent e) {
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(this);
boolean ok = job.printDialog();
if (ok) {
try {
job.print();
} catch (PrinterException ex) {
/* The job did not successfully complete */
}
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It should start printing the page as the print command is given.
ACTUAL -
Getting NullPointerException while accessing the Print method of RasterPrinterJob Class
xception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.desktop/sun.print.RasterPrinterJob.setAttributes(RasterPrinterJob.java:1240)
at java.desktop/sun.awt.windows.WPrinterJob.setAttributes(WPrinterJob.java:696)
at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1510)
at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1443)
at com.test.HelloWorldPrinter.actionPerformed(HelloWorldPrinter.java:70)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Getting NullPointerException while accessing the Print method of RasterPrinterJob Class
xception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.desktop/sun.print.RasterPrinterJob.setAttributes(RasterPrinterJob.java:1240)
at java.desktop/sun.awt.windows.WPrinterJob.setAttributes(WPrinterJob.java:696)
at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1510)
at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1443)
at com.test.HelloWorldPrinter.actionPerformed(HelloWorldPrinter.java:70)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public void actionPerformed(ActionEvent e) {
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(this);
boolean ok = job.printDialog();
if (ok) {
try {
job.print();
} catch (PrinterException ex) {
/* The job did not successfully complete */
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
public void actionPerformed(ActionEvent e) {
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(this);
boolean ok = job.printDialog();
if (ok) {
try {
job.print();
} catch (PrinterException ex) {
/* The job did not successfully complete */
}
}
}
SUPPORT :
YES
- duplicates
-
JDK-8186987 NullPointerException in RasterPrinterJob without PrinterResolution
- Resolved