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

Toolkit.getPrintJob() changes JobAttributes.getPrinter() to default(?) printer.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • 9
    • 6u17
    • client-libs
    • 2d
    • x86
    • linux_ubuntu

      FULL PRODUCT VERSION :
      java version "1.6.0_17"
      Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
      Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode)
      (Same version on Linux and Windows.)
      (Same problem on 1.6.0_15, at least.)

      ADDITIONAL OS VERSION INFORMATION :
      Linux athena 2.6.31-15-generic #50-Ubuntu SMP Tue Nov 10 14:53:52 UTC 2009 x86_64 GNU/Linux
      Windows 7 (32-bit)

      A DESCRIPTION OF THE PROBLEM :
      After return from calling Toolkit.getPrintJob(), the JobAttributes.getPrinter() is set to the default(?) printer, and NOT to the user's selection.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Since I have had quite a few problems with minor bugs in Printing, I built a test program, and placed on Kenai.com (as a NetBeans project).

        http://kenai.com/projects/print-explorer

        To reproduce, run the program (from the command line or within NetBeans):

        java -jar dist/PrintExplorer.jar

      1) Select a non-default printer (other than the initial value). Note you must have more than one printer configured.

      2) Select the "PrintJob" tab.

      3) Click the "Toolkit.getPrintJob()" button.

      4) The OS Print dialog will appear. Change nothing. Just click "Print".

      Note the two columns show the JobAttributes before and after the call. Note the "printer" value (from PrinterJob.getPrinter()) has changed from the user-selected value to the default(?) printer.

      5) Close the application window.

      Note that values presented in the UI, and the commands issued (from pressing buttons) are both recorded into a log file "print-test-log.html", so you can see exactly what you did, and the changed values.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The value in JobAttributes.getPrinter() should not have changed after the Toolkit.getPrinterJob() call.
      ACTUAL -
      The value in JobAttributes.getPrinter() changed after the Toolkit.getPrinterJob() call to the default(?) printer.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Hopefully the referenced test program should obviate the need for a simplified example. I have too many small printing bugs to identify and report. :)
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      No work-around seems possible (using this API). After the call returns, there is no way to determine which PrintService was selected by the user. The PrintJob seems to know the correct printer (as printed output goes to the right place), but the application cannot know which printer was used.

            psadhukhan Prasanta Sadhukhan
            igor Igor Nekrestyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: