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

PIT: "PrintToFile" feature is broken for cross-platform print dialog

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 5.0
    • client-libs

      I am trying to print some print data to a file using Cross-Platform print dialog. I am selecting 'PrintToFile' option from the print dialog and clicking 'OK'. A file dialog pops up and it is defaulted with 'out.ps' file name. When I click 'OK' in the file dialog a null pointer exception is thrown.

      This is reproducible on all platforms with the cross-platform dialog on the PIT build. This is working fine on the previous builds (tested on Tiger - b32a). I tested this on WinXP and Solaris 9 using the following PIT build:

      java version "2d.pit-jcg-sparc-01-2004-01-18.tiger"
      Java(TM) 2 Runtime Environment, Standard Edition (build 2d.pit-jcg-sparc-01-2004-01-18.tiger)
      Java HotSpot(TM) Client VM (build 1.5.0-beta2-b33, mixed mode)

      The exception is thrown only when we specify a file name that does not exist in the given directory. Same case applies for the default file name also.

      Printing to a file is a basic feature which has been working in all the previous builds and this has no workaround.

      I have attached a sample code. Execute the sample code. Choose 'PrintToFile' option and click 'OK'. Specify a non-existant file name in the file dialog and click 'OK' in the file dialog (or make sure you don't have the default file already in the selected dir). You will get the NPE on the console.

      Here is the exception:
      java.lang.NullPointerException
      at sun.print.ServiceDialog$ValidatingFileChooser.approveSelection(ServiceDialog.java:2717)
      at javax.swing.plaf.basic.BasicFileChooserUI$ApproveSelectionAction.actionPerformed(BasicFileChooserUI.java:918)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1834)
      at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2152)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
      at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
      at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
      at java.awt.Component.processMouseEvent(Component.java:5465)
      at javax.swing.JComponent.processMouseEvent(JComponent.java:3052)
      at java.awt.Component.processEvent(Component.java:5230)
      at java.awt.Container.processEvent(Container.java:1961)
      at java.awt.Component.dispatchEventImpl(Component.java:3933)
      at java.awt.Container.dispatchEventImpl(Container.java:2019)
      at java.awt.Component.dispatchEvent(Component.java:3781)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4203)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3883)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3813)
      at java.awt.Container.dispatchEventImpl(Container.java:2005)
      at java.awt.Window.dispatchEventImpl(Window.java:1757)
      at java.awt.Component.dispatchEvent(Component.java:3781)
      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.pumpEventsForHierarchy(EventDispatchThread.java:153)
      at java.awt.Dialog+1.run(Dialog.java:514)
      at java.awt.Dialog.show(Dialog.java:535)
      at javax.swing.JFileChooser.showDialog(JFileChooser.java:717)
      at sun.print.ServiceDialog.showFileChooser(ServiceDialog.java:407)
      at sun.print.ServiceDialog.actionPerformed(ServiceDialog.java:362)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1834)
      at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2152)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
      at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
      at java.awt.Component.processMouseEvent(Component.java:5465)
      at javax.swing.JComponent.processMouseEvent(JComponent.java:3052)
      at java.awt.Component.processEvent(Component.java:5230)
      at java.awt.Container.processEvent(Container.java:1961)
      at java.awt.Component.dispatchEventImpl(Component.java:3933)
      at java.awt.Container.dispatchEventImpl(Container.java:2019)
      at java.awt.Component.dispatchEvent(Component.java:3781)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4203)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3883)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3813)
      at java.awt.Container.dispatchEventImpl(Container.java:2005)
      at java.awt.Window.dispatchEventImpl(Window.java:1757)
      at java.awt.Component.dispatchEvent(Component.java:3781)
      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.pumpEventsForHierarchy(EventDispatchThread.java:153)
      at java.awt.Dialog+1.run(Dialog.java:514)
      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:201)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
      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)

            kereminsunw Konstantin Eremin (Inactive)
            pmohansunw Praveen Mohan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: