New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException finding Default printer on Mac #295

Closed
tresf opened this Issue Apr 3, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@tresf
Contributor

tresf commented Apr 3, 2018

A fresh install of MacOS 10.13 and Java 1.8 u161 throws a NullPointerException when looking for the default printer.

What's happening is the following line is returning null:

PrintServiceLookup.lookupDefaultPrintService()

And subsequently, .getName() fails.

case PRINTERS_GET_DEFAULT:
sendResult(session, UID, PrintServiceLookup.lookupDefaultPrintService().getName());

A permanent workaround is to change "Last printer used" to an actual printer in the Settings dialog.

screen shot 2018-04-03 at 12 19 01 am

screen shot 2018-04-03 at 12 06 14 am

This may be a bug with the way Java "uses" the PDFWriter driver, it may never register it as being used since it was printed to without manual intervention. This may be a base bug with Oracle. Will reference upstream bug if determined.

@tresf tresf closed this in 873d720 Oct 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment