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

NullPointerException thrown at at sun.awt.windows.WPrinterJob.getPrintService(WPrinterJob.java:632)

    XMLWordPrintable

Details

    • x86_64
    • windows_7

    Description

      FULL PRODUCT VERSION :
      java version "1.8.0_91"
      Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      Our application uses OHJ (Oracle Help For Java) and is deployed on glassfish server. When using the print function to print a topic in the ICE Browser, the following exception is thrown:
      java.lang.NullPointerException: null
      at sun.awt.windows.WPrinterJob.getPrintService(WPrinterJob.java:632) ~[na:na]
      at sun.print.RasterPrinterJob.setPrintable(RasterPrinterJob.java:1047) ~[na:na]
      at oracle.help.htmlBrowser.print.ICEPrintImplJava2._doJava2Printing(ICEPrintImplJava2.java:109) ~[na:na]
      at oracle.help.htmlBrowser.print.ICEPrintImplJava2.printURLs(ICEPrintImplJava2.java:79) ~[na:na]
      at oracle.help.htmlBrowser.print.ICEPrintImplJava2.printURL(ICEPrintImplJava2.java:64) ~[na:na]
      at oracle.help.htmlBrowser.ICEBrowser.printURL(ICEBrowser.java:151) ~[na:na]
      at oracle.help.topicDisplay.print.BrowserPrintJob.printTopicImpl(BrowserPrintJob.java:45) ~[na:na]
      at oracle.help.topicDisplay.print.BaseTopicPrintJob$PrintingThread.run(BaseTopicPrintJob.java:49) ~[na:na]
      at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_60]|#]

      The print function works when starting glassfish with JDK jdk1.8.0_45. The problem started occuring from jdk1.8.0_60.

      REGRESSION. Last worked in version 8u73

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.8.0_91"
      Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Use the print function from ICE Browser of Oracle Help.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Open print dialog
      ACTUAL -
      NullPointer Exception

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.lang.NullPointerException: null
      at sun.awt.windows.WPrinterJob.getPrintService(WPrinterJob.java:632) ~[na:na]
      at sun.print.RasterPrinterJob.setPrintable(RasterPrinterJob.java:1047) ~[na:na]
      at oracle.help.htmlBrowser.print.ICEPrintImplJava2._doJava2Printing(ICEPrintImplJava2.java:109) ~[na:na]
      at oracle.help.htmlBrowser.print.ICEPrintImplJava2.printURLs(ICEPrintImplJava2.java:79) ~[na:na]
      at oracle.help.htmlBrowser.print.ICEPrintImplJava2.printURL(ICEPrintImplJava2.java:64) ~[na:na]
      at oracle.help.htmlBrowser.ICEBrowser.printURL(ICEBrowser.java:151) ~[na:na]
      at oracle.help.topicDisplay.print.BrowserPrintJob.printTopicImpl(BrowserPrintJob.java:45) ~[na:na]
      at oracle.help.topicDisplay.print.BaseTopicPrintJob$PrintingThread.run(BaseTopicPrintJob.java:49) ~[na:na]
      at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_60]|#]

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
       public PrintService getPrintService() {
              if (myService == null) {
                  String printerName = getNativePrintService();

                  if (printerName != null) {
                      myService = Win32PrintServiceLookup.getWin32PrintLUS().
                          getPrintServiceByName(printerName);
                      // no need to call setNativePrintService as this name is
                      // currently set in native
                      if (myService != null) {
                          return myService;
                      }
                  }

                  myService = PrintServiceLookup.lookupDefaultPrintService();
                  if (myService instanceof Win32PrintService) {
                      try {
                          setNativePrintServiceIfNeeded(myService.getName());
                      } catch (Exception e) {
                          myService = null;
                      }
                  }

                }
                return myService;
          }

      Win32PrintServiceLookup.getWin32PrintLUS() is null
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Use jdk 1.8.0_45 for starting glassfish.

      Attachments

        Activity

          People

            psadhukhan Prasanta Sadhukhan
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: