--- old/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java 2015-11-03 14:22:08.887498700 +0530 +++ new/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java 2015-11-03 14:22:08.378934100 +0530 @@ -766,8 +766,15 @@ // Check for native, note that default dialog is COMMON. if (dlg == DialogTypeSelection.NATIVE) { PrintService pservice = getPrintService(); - PageFormat page = pageDialog(attributeToPageFormat(pservice, - attributes)); + PageFormat pageFrmAttrib = attributeToPageFormat(pservice, + attributes); + PageFormat page = pageDialog(pageFrmAttrib); + + // If user cancels the dialog, pageDialog() will return the original + // page object and as per spec, we should return null in that case. + if (page.equals(pageFrmAttrib)) { + return null; + } updateAttributesWithPageFormat(pservice, page, attributes); return page; }