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

Printing to File throws NPE on Sol when the given file name represents a dir

XMLWordPrintable

    • 2d
    • beta
    • generic, x86, sparc
    • generic, solaris_8, windows_nt
    • Verified

      I am trying to print a frame to a file using the AWT printing APIs. I am setting the dialog type to NONE and specifying a file name which actually represents a directory, through JobAttributes.setFileName(). I have set the destination type to FILE. When calling frame.printAll() I am getting a NullPointerException on Solaris platform. This is not reproducible on Win32.

      This is reproducible right from JDK1.4 on Solaris alone. This is not reproducible when passing a valid file name.

      I have attached a sample test. Execute the sample test on Solaris. Enter an absolute path representing a directory in the text field provided. Choose NONE option from the drop-down and click the 'Print' button. If you see the following exception on the console then the bug is reproduced.

      java.lang.NullPointerException
       at java.awt.Component.printAll(Component.java:2834)
       at PrintJobTest.actionPerformed(PrintJobTest.java:47)
       at java.awt.Button.processActionEvent(Button.java:388)
       at java.awt.Button.processEvent(Button.java:356)
       at java.awt.Component.dispatchEventImpl(Component.java:3931)
       at java.awt.Component.dispatchEvent(Component.java:3779)
       at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
       at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
       at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
       at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

            jgodinez Jennifer Godinez (Inactive)
            pmohansunw Praveen Mohan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: