Details
Description
It seems that there's a null element in the returned array.
Code to get the NPE:
PrinterJob.createPrinterJob().showPrintDialog(stage);
It happenes when I have Lisanet PDFWriter (http://sourceforge.net/projects/pdfwriterformac/) as default printer. It works ok from other programmes though. If I don't have it as default it still happens if I select the PDFWriter.
java.lang.NullPointerException
at com.sun.prism.j2d.print.J2DPrinter.printableArea(J2DPrinter.java:844)
at javafx.print.Printer.createPageLayout(Printer.java:249)
at javafx.print.Printer.getDefaultPageLayout(Printer.java:221)
at javafx.print.JobSettings.updateForPrinter(JobSettings.java:373)
at javafx.print.PrinterJob$1.set(PrinterJob.java:184)
at javafx.print.PrinterJob$1.set(PrinterJob.java:172)
at javafx.print.PrinterJob.setPrinter(PrinterJob.java:246)
at com.sun.prism.j2d.print.J2DPrinterJob.updatePrinter(J2DPrinterJob.java:462)
at com.sun.prism.j2d.print.J2DPrinterJob.updateSettingsFromDialog(J2DPrinterJob.java:466)
at com.sun.prism.j2d.print.J2DPrinterJob.showPrintDialog(J2DPrinterJob.java:133)
at javafx.print.PrinterJob.showPrintDialog(PrinterJob.java:290)
at wing.reports_new.print.PrintTestApp.start(PrintTestApp.java:86)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$138(LauncherImpl.java:821)
at com.sun.javafx.application.LauncherImpl$$Lambda$50/2097733115.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$150(PlatformImpl.java:319)
at com.sun.javafx.application.PlatformImpl$$Lambda$46/1061772143.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$148(PlatformImpl.java:288)
at com.sun.javafx.application.PlatformImpl$$Lambda$48/766606369.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$149(PlatformImpl.java:287)
at com.sun.javafx.application.PlatformImpl$$Lambda$47/84781936.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
Code in J2DPrinter in this release:
MediaPrintableArea[] mpa = (MediaPrintableArea[])service. getSupportedAttributeValues(MediaPrintableArea.class,
null, pras);
if (mpa != null && mpa.length > 0) {
int MPA_INCH = MediaPrintableArea.INCH;
here-> area = new Rectangle2D(mpa[0].getX(MPA_INCH),
mpa[0].getY(MPA_INCH),
mpa[0].getWidth(MPA_INCH),
mpa[0].getHeight(MPA_INCH));
}
Code to get the NPE:
PrinterJob.createPrinterJob().showPrintDialog(stage);
It happenes when I have Lisanet PDFWriter (http://sourceforge.net/projects/pdfwriterformac/) as default printer. It works ok from other programmes though. If I don't have it as default it still happens if I select the PDFWriter.
java.lang.NullPointerException
at com.sun.prism.j2d.print.J2DPrinter.printableArea(J2DPrinter.java:844)
at javafx.print.Printer.createPageLayout(Printer.java:249)
at javafx.print.Printer.getDefaultPageLayout(Printer.java:221)
at javafx.print.JobSettings.updateForPrinter(JobSettings.java:373)
at javafx.print.PrinterJob$1.set(PrinterJob.java:184)
at javafx.print.PrinterJob$1.set(PrinterJob.java:172)
at javafx.print.PrinterJob.setPrinter(PrinterJob.java:246)
at com.sun.prism.j2d.print.J2DPrinterJob.updatePrinter(J2DPrinterJob.java:462)
at com.sun.prism.j2d.print.J2DPrinterJob.updateSettingsFromDialog(J2DPrinterJob.java:466)
at com.sun.prism.j2d.print.J2DPrinterJob.showPrintDialog(J2DPrinterJob.java:133)
at javafx.print.PrinterJob.showPrintDialog(PrinterJob.java:290)
at wing.reports_new.print.PrintTestApp.start(PrintTestApp.java:86)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$138(LauncherImpl.java:821)
at com.sun.javafx.application.LauncherImpl$$Lambda$50/2097733115.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$150(PlatformImpl.java:319)
at com.sun.javafx.application.PlatformImpl$$Lambda$46/1061772143.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$148(PlatformImpl.java:288)
at com.sun.javafx.application.PlatformImpl$$Lambda$48/766606369.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$149(PlatformImpl.java:287)
at com.sun.javafx.application.PlatformImpl$$Lambda$47/84781936.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
Code in J2DPrinter in this release:
MediaPrintableArea[] mpa = (MediaPrintableArea[])service. getSupportedAttributeValues(MediaPrintableArea.class,
null, pras);
if (mpa != null && mpa.length > 0) {
int MPA_INCH = MediaPrintableArea.INCH;
here-> area = new Rectangle2D(mpa[0].getX(MPA_INCH),
mpa[0].getY(MPA_INCH),
mpa[0].getWidth(MPA_INCH),
mpa[0].getHeight(MPA_INCH));
}