JDK-4860728 : Print-dialog of PrintJob wrongly returns MediaType 'iso-a10' for large media
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: generic,x86
  • Submitted: 2003-05-08
  • Updated: 2003-08-20
  • Resolved: 2003-08-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 tigerFixed
Related Reports
Relates :  
Description

Name: rmT116609			Date: 05/08/2003


FULL PRODUCT VERSION :
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)


FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]

EXTRA RELEVANT SYSTEM CONFIGURATION :
HP DesignJet printer driver 4.63


A DESCRIPTION OF THE PROBLEM :
When the print dialog for a PrintJob is show, and a large media type has been selected, the returned PageAttributes contains the wrong media type iso-a10. The problem only happens when selecting a large media type, not a smaller one.

Selecting media types A,B,C,D,E and A4,A3 works; selecting F, A2,A1 or A0 returns media type A10 (maybe an overflow somewhere causes a negative page size, which is closest to the (possibly?) smallest media type A10?).

We have this problem on combination of any JRE 1.4.x version, with any Windows NT or 2000 computer (XP not tested yet) and any HP DesignJet printer (we could find, like 450C, 500, 750C and 750C+).

I also tried to reset the page-size to ISO_A4 and continue working with the PrintJob object, but under Windows NT, I get a Blue-Screen-Of-Death (!) every time, and under Windows 2000, the printer produces an empty page.

The only way to get the print to work is by not showing the print dialog :
jobAttributes.setDialog(JobAttributes.DialogType.NONE)

When the print dialog is not shown, the PrintJob performs without problems. The problem is that we cannot detect from Java if we have a DesignJet printer. So we put two 'Print' buttons in our application, one with print dialog and another without the print dialog. But some of our (100+) users tend to forget to use the second print button when printing to a DesignJet printer.

I hope you can find a DesignJet printer to reproduce this problem.


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a PrintJob, and choose media type A2 or F
2. Print the selected Media Type of the PageAttributes

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expected : the user selected media type (like iso-a2)

ACTUAL -
Actual : media type iso-a10


ERROR MESSAGES/STACK TRACES THAT OCCUR :
No exceptions or error messages occur

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.*;

public class PrinterTest
{
    static public void main(String[] args)
    {
        try
        {
            System.out.println("start");
            JFrame frame = new JFrame("test");
            JobAttributes jobAttributes = new JobAttributes();
            PageAttributes pageAttributes = new PageAttributes();
            pageAttributes.setMedia(PageAttributes.MediaType.ISO_A4);
            System.out.println("before : "+pageAttributes.getMedia());
            PrintJob printJob = Toolkit.getDefaultToolkit().getPrintJob(frame,"title",jobAttributes,pageAttributes);
            printJob.end();
            System.out.println("after : "+pageAttributes.getMedia());
            System.exit(0);
        }
        catch (Exception e)
        {
            e.printStackTrace();
            System.out.println("error");
            System.exit(1);
        }
    }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Not showing the print dialog :
jobAttributes.setDialog(JobAttributes.DialogType.NONE)
(Review ID: 185250) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger
14-06-2004

EVALUATION -------------- Not reproducible in other drivers and seems specific to Designjet drivers by HP. This is also not related to large media because using designjet 800PS driver, the bug also occurs in Letter or A4 media. I suspect that the driver is returning an invalid paper width and height for these media which maps to a10. ###@###.### 2003-05-10 ----------------------------- Already fixed by changes to print dialog in tiger b05. See also 4394889. ###@###.### 2003-08-20 ------------------------------------
10-05-2003