8067059: PrinterJob.pageDialog() with DialogSelectionType.NATIVE returns a PageFormat when cancelled

Reviewed-by: jgodinez, prr
This commit is contained in:
Prasanta Sadhukhan 2015-11-18 00:20:15 +03:00
parent 73b1044258
commit 18cd974bce
2 changed files with 74 additions and 2 deletions

View file

@ -778,8 +778,15 @@ public abstract class RasterPrinterJob extends PrinterJob {
// 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 == pageFrmAttrib) {
return null;
}
updateAttributesWithPageFormat(pservice, page, attributes);
return page;
}