changeset 3591:f046a44e92fd

7022228: JPRT failure: RuntimeException in SupportedMedia regression test Reviewed-by: igor, prr
author jgodinez
date Thu, 24 Feb 2011 15:00:50 -0800
parents 3ebece41badd
children 094c70388ab0
files src/windows/classes/sun/print/Win32PrintService.java
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/classes/sun/print/Win32PrintService.java	Mon Feb 21 14:33:58 2011 -0800
+++ b/src/windows/classes/sun/print/Win32PrintService.java	Thu Feb 24 15:00:50 2011 -0800
@@ -273,6 +273,20 @@
                 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 @@
 
             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 {