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

Printing an image using BYTE_ARRAY throws NPE on Win2K

XMLWordPrintable

    • 2d
    • generic
    • windows_2000


      The program attached attempts to print a jpeg file using byte array
      representation class. It throws a NullPointerException on Win2000,
      but works fine with Windows NT.
      The printer used was "Lexmark Optra S 1855" with the same driver name.
      The problem has been there since B66. In B65(beta), it didn't throw any
      exception, but there wasn't any printout as well.

      The image gets printed with other representation classes like
       java.io.InputStream and java.net.URL.

      I haven't tried with other printers yet.

      The stack trace of the program is as below:

      Print service supports ByteArray representation class.
      About to print ./flor2.jpg image using DocFlavor.BYTE_ARRAY
      getStreamForBytes called...
      Exception: caught
      java.lang.NullPointerException
              at sun.print.Win32PrintService.initMedia(Win32PrintService.java:367)
              at sun.print.Win32PrintService.getDefaultAttributeValue(Win32PrintServic
      e.java:782)
              at sun.print.Win32PrintJob.printableJob(Win32PrintJob.java:414)
              at sun.print.Win32PrintJob.print(Win32PrintJob.java:308)
              at Test.print(Test.java:58)
              at Test.init(Test.java:36)
              at Test.main(Test.java:76)
      Printing Failed...


      Attachments:
      -----------
      Source File: Test.java
      Resource File: flor2.jpg

      The bug is no longer reproduceable with the
      driver 'Lexmark Optra S 1855'

      ###@###.### 2001-11-13

            jgodinez Jennifer Godinez (Inactive)
            kbalasubsunw Kannan Balasubramanian (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: