JDK-6575098 : UIMM: Desktop print failed when printing bmp image
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6u2
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: solaris_2.5.1,windows_xp
  • CPU: x86,sparc
  • Submitted: 2007-06-28
  • Updated: 2011-04-29
Related Reports
Relates :  
Description
FULL JDK VERSION(S):
-------------------
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b04)
Java HotSpot(TM) Client VM (build 1.6.0_02-b04, mixed mode) 

DESCRIPTION:
------------
PROBLEM DESCRIPTION

Printing a bmp image failed when print() method of Desktop API introduced in Java6 is used.
 
Calling the print() method opens the photo printing wizard, but clicking on next does not show the bmp image selected for printing. 

Right clicking on the .bmp file and selecting windows print option, launches the photo printing wizard and displays a preview of the bmp image that has to be printed.

TESTCASE DESCRIPTION

This test case tests whether print() method of Desktop API introduced in Java6 prints a bmp image. The test gets the Desktop and calls the print method by passing a .bmp file. The program calls a sleep of 20 seconds for the user to print the bmp file through the photo printing 
wizard.

 
STEPS TO REPRODUCE

1) Execute the below command:
	>>java DesktopPrint 

2) Click on next in the photo print wizard, the bmp image that has to be printed is not shown.

TEST CASE:

import java.awt.Desktop;
import java.io.*;

class DesktopPrint
{

    DesktopPrint()
    {
    }

    public static void main(String args[])
    {
        Desktop desktop = null;
        if(Desktop.isDesktopSupported())
            desktop = Desktop.getDesktop();
        else
            System.out.println("Desktop is not supported on this platform");
        try
        {
            desktop.print(new File("sample.bmp"));
            //Thread.sleep(20000L);
        }
        catch(IOException ioexception)
        {
            System.out.println("Desktop print failed with IOException");
            ioexception.printStackTrace();
        }
        catch(Exception interruptedexception)
        {
            System.out.println("Desktop print failed with InterruptedException");
            interruptedexception.printStackTrace();
        }
    }
}

Comments
EVALUATION May be fixed with the fix for 6599987. Should be checked when the fix is available.
30-11-2007

EVALUATION An interesting thing is noticed. All the java.awt.Desktop calls on Windows platform are translated to the corresponding calls for ShellExecute. If a file is passed as 'c:\\dir\\file.ext', it is opened by Picture Viewer (on my desktop), but is it is passed as 'file://c:/dir/file.ext' - it is opened by Photo Printing Wizard, but is missed at the second wizard page. I think we should write a native test to see if this is a ShellExecute or Java problem.
29-06-2007

EVALUATION This doesn't look as a regression but rather hasn't been working since java.awt.Desktop class was introduced.
29-06-2007

WORK AROUND none
28-06-2007