From 40482472548742bfe2fa15f5ecfa34b8d6324f2d Mon Sep 17 00:00:00 2001 From: jgodinez Date: Thu, 24 Feb 2011 15:00:50 -0800 Subject: [PATCH] 7022228: JPRT failure: RuntimeException in SupportedMedia regression test Reviewed-by: igor, prr --- .../classes/sun/print/Win32PrintService.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/windows/classes/sun/print/Win32PrintService.java b/src/windows/classes/sun/print/Win32PrintService.java index 6e6088809..e9f1eb7df 100644 --- a/src/windows/classes/sun/print/Win32PrintService.java +++ b/src/windows/classes/sun/print/Win32PrintService.java @@ -273,6 +273,20 @@ public class Win32PrintService implements PrintService, AttributeUpdater, return DMPAPER_B6_JIS; } } + + // If not found in predefined Windows ID, then we search through + // the returned IDs of the driver because they can define their own + // unique IDs. + initMedia(); + + if ((idList != null) && (mediaSizes != null) && + (idList.size() == mediaSizes.length)) { + for (int i=0; i< idList.size(); i++) { + if (mediaSizes[i].getMediaSizeName() == msn) { + return ((Integer)idList.get(i)).intValue(); + } + } + } return 0; } @@ -439,7 +453,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater, if (mediaName != null) { int defPaper = findPaperID(mediaName); - float[] prnArea = getMediaPrintableArea(printer, defPaper); + float[] prnArea = (defPaper != 0) ? getMediaPrintableArea(printer, defPaper) : null; MediaPrintableArea printableArea = null; if (prnArea != null) { try { -- GitLab