--- old/src/java.desktop/macosx/classes/sun/lwawt/LWToolkit.java 2016-04-12 16:33:55.000000000 +0530 +++ new/src/java.desktop/macosx/classes/sun/lwawt/LWToolkit.java 2016-04-12 16:33:55.000000000 +0530 @@ -399,6 +399,10 @@ public final PrintJob getPrintJob(Frame frame, String doctitle, JobAttributes jobAttributes, PageAttributes pageAttributes) { + if (frame == null) { + throw new NullPointerException("frame must not be null"); + } + if (GraphicsEnvironment.isHeadless()) { throw new IllegalArgumentException(); }