Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8089053

PrinterJob.printPage() triggers a stack with message "*** unexpected PG access"

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8, 9
    • Fix Version/s: tbd_major
    • Component/s: javafx
    • Environment:

      FX 8 b85 on Windows. Didn't try Mac nor Linux.

      Description

      Every single time I call PrinterJob.printPage() I read one or more stacks as the one below. It seems harmless by the way.
      *** unexpected PG access
      java.lang.Exception: Stack trace
          at java.lang.Thread.dumpStack(Thread.java:1345)
          at javafx.scene.Node.impl_getPGNode(Node.java:2175)
          at com.sun.prism.j2d.print.J2DPrinterJob$J2DPageable.printNode(J2DPrinterJob.java:1002)
          at com.sun.prism.j2d.print.J2DPrinterJob$J2DPageable.print(J2DPrinterJob.java:993)
          at sun.print.RasterPrinterJob.printPage(RasterPrinterJob.java:1973)
          at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1461)
          at com.sun.prism.j2d.print.J2DPrinterJob$PrintJobRunnable.run(J2DPrinterJob.java:736)
          at java.lang.Thread.run(Thread.java:722)

        Activity

        Hide
        kcr Kevin Rushforth added a comment -
        This is an assertion check. As long as the node in question is not attached to a visible stage then it should be OK. Otherwise it could indicate a threading problem.
        Show
        kcr Kevin Rushforth added a comment - This is an assertion check. As long as the node in question is not attached to a visible stage then it should be OK. Otherwise it could indicate a threading problem.
        Hide
        kcr Kevin Rushforth added a comment -
        Too late to fix P4 bugs for FX 8.
        Show
        kcr Kevin Rushforth added a comment - Too late to fix P4 bugs for FX 8.
        Hide
        skuklewicjfx Szymon Kuklewicz (Inactive) added a comment -
        Similar case but using WebEngine.print(). Here it's test case:

        public class Test extends Application {

            public static void main(String[] args) throws IOException {
                Application.launch(Test.class, args);
            }

            @Override
            public void start(Stage stage) throws Exception {
                WebEngine webEngine = new WebView().getEngine();
                webEngine.getLoadWorker().stateProperty().addListener(observable -> {
                    Worker.State state = webEngine.getLoadWorker().getState();
                    System.out.println(state);
                    switch (state) {
                        case READY:
                        case SCHEDULED:
                        case RUNNING:
                            break;
                        case CANCELLED:
                        case FAILED:
                            System.out.println("Failed or cancelled");
                            break;
                        case SUCCEEDED:
                            Platform.runLater(() -> {
                                for (Printer printer : Printer.getAllPrinters()) {
                                    if (printer.getName().equalsIgnoreCase("Bullzip PDF Printer")) {
                                        PrinterJob printerJob = PrinterJob.createPrinterJob(printer);
                                        if (printerJob != null) {
                                            webEngine.print(printerJob);
                                            System.out.println("Printed succeeded ? " + printerJob.endJob());
                                        }
                                    }
                                }
                            });
                            break;
                    }
                });
                webEngine.loadContent("<!DOCTYPE html><html><body>Hello</body></html>");
            }

        }
        Show
        skuklewicjfx Szymon Kuklewicz (Inactive) added a comment - Similar case but using WebEngine.print(). Here it's test case: public class Test extends Application {     public static void main(String[] args) throws IOException {         Application.launch(Test.class, args);     }     @Override     public void start(Stage stage) throws Exception {         WebEngine webEngine = new WebView().getEngine();         webEngine.getLoadWorker().stateProperty().addListener(observable -> {             Worker.State state = webEngine.getLoadWorker().getState();             System.out.println(state);             switch (state) {                 case READY:                 case SCHEDULED:                 case RUNNING:                     break;                 case CANCELLED:                 case FAILED:                     System.out.println("Failed or cancelled");                     break;                 case SUCCEEDED:                     Platform.runLater(() -> {                         for (Printer printer : Printer.getAllPrinters()) {                             if (printer.getName().equalsIgnoreCase("Bullzip PDF Printer")) {                                 PrinterJob printerJob = PrinterJob.createPrinterJob(printer);                                 if (printerJob != null) {                                     webEngine.print(printerJob);                                     System.out.println("Printed succeeded ? " + printerJob.endJob());                                 }                             }                         }                     });                     break;             }         });         webEngine.loadContent("<!DOCTYPE html><html><body>Hello</body></html>");     } }
        Hide
        vdyakov Victor Dyakov added a comment -
        keeping nicetohave label, and issue might be fixed in 9 later in positive case of time resources available
        Show
        vdyakov Victor Dyakov added a comment - keeping nicetohave label, and issue might be fixed in 9 later in positive case of time resources available

          People

          • Assignee:
            prr Philip Race
            Reporter:
            yjoan Yves Joan (Inactive)
          • Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Imported: