8181192: [macos] javafx.print.PrinterJob.showPrintDialog() hangs on macOS
authoralitvinov
Fri, 02 Jun 2017 18:40:55 +0300
changeset 45520 78fc4902bcbf
parent 45354 47b01400f779
child 45521 df88b9c9b4ae
8181192: [macos] javafx.print.PrinterJob.showPrintDialog() hangs on macOS Reviewed-by: prr, serb
jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m
jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
jdk/test/java/awt/print/PageFormat/WrongPaperPrintingTest.java
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m	Fri May 26 09:07:25 2017 -0700
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m	Fri Jun 02 18:40:55 2017 +0300
@@ -376,7 +376,7 @@
     static JNF_MEMBER_CACHE(jm_getMaxPage, sjc_CPrinterJob, "getMaxPageAttrib", "()I");
     static JNF_MEMBER_CACHE(jm_getSelectAttrib, sjc_CPrinterJob, "getSelectAttrib", "()I");
     static JNF_MEMBER_CACHE(jm_getNumberOfPages, jc_Pageable, "getNumberOfPages", "()I");
-    static JNF_MEMBER_CACHE(jm_getPageFormat, sjc_CPrinterJob, "getPageFormat", "(I)Ljava/awt/print/PageFormat;");
+    static JNF_MEMBER_CACHE(jm_getPageFormat, sjc_CPrinterJob, "getPageFormatFromAttributes", "()Ljava/awt/print/PageFormat;");
 
     NSMutableDictionary* printingDictionary = [dst dictionary];
 
@@ -412,7 +412,7 @@
     [printingDictionary setObject:[NSNumber numberWithInteger:fromPage] forKey:NSPrintFirstPage];
     [printingDictionary setObject:[NSNumber numberWithInteger:toPage] forKey:NSPrintLastPage];
 
-    jobject page = JNFCallObjectMethod(env, srcPrinterJob, jm_getPageFormat, (jint)0);
+    jobject page = JNFCallObjectMethod(env, srcPrinterJob, jm_getPageFormat); 
     if (page != NULL) {
         javaPageFormatToNSPrintInfo(env, NULL, page, dst);
     }
--- a/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java	Fri May 26 09:07:25 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java	Fri Jun 02 18:40:55 2017 +0300
@@ -886,6 +886,14 @@
         }
    }
 
+   protected PageFormat getPageFormatFromAttributes() {
+       if (attributes == null || attributes.isEmpty()) {
+            return null;
+        }
+        return attributeToPageFormat(getPrintService(), this.attributes);
+   }
+
+
    /**
      * Presents the user a dialog for changing properties of the
      * print job interactively.
--- a/jdk/test/java/awt/print/PageFormat/WrongPaperPrintingTest.java	Fri May 26 09:07:25 2017 -0700
+++ b/jdk/test/java/awt/print/PageFormat/WrongPaperPrintingTest.java	Fri Jun 02 18:40:55 2017 +0300
@@ -24,6 +24,7 @@
 /* @test
    @bug 8167102
    @summary PrintRequestAttributeSet breaks page size set using PageFormat
+   @ignore Exclude the test until 8167102 is resolved by a new reassessed fix
    @run main/manual WrongPaperPrintingTest
  */