JDK-4784164 : REGRESSION: Crash in printer dlls if printer changed from default in dialog
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.4.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_98
  • CPU: x86
  • Submitted: 2002-11-25
  • Updated: 2002-11-27
  • Resolved: 2002-11-27
Related Reports
Duplicate :  
Description

Name: jl125535			Date: 11/25/2002


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


FULL OPERATING SYSTEM VERSION : Window 98 [version
4.10.2222]


ADDITIONAL OPERATING SYSTEMS : Windows 95 various flavors



EXTRA RELEVANT SYSTEM CONFIGURATION :
Happens with network and direct printers.

A DESCRIPTION OF THE PROBLEM :
Executing printJob.print causes a GPF in the printer dlls
if the user swithches printers in the Print dialog.

I am stumped.

This very same code worked fine under J2SE 1.3.x. After
migrating to 1.4 I found this happening.

I develop off site and both of my direct printers (HP Lazer
6P and Lexmark Z32) worked fine. I immediatly got reports
from the alpha team about this crashing problem. I traveled
on location I have tried this on various computers on our
networks and in multiple plant locations(on the same
network) and I get the GPF on many printers. I first
thought it was our network, but some direct printers seem
to have the same problem.

I am using the printing API introduced in J2 (Merlin?) The
one that uses Printable, PageFomat, Page etc. It happens
when calling printJob.print(). According to my debugger, my
Printable.print() is not called. The GPF occurs before.

We are in beta. I had to migrate to 1.4 hoping to fix a
myriad of other printing anomolies. It seems now that when
printing is successful, those anomolies have gone away, but
now I have this.

The program is a 100% java client application that will be
boxed and sold commercially. But not with this bug...


REGRESSION.  Last worked in version 1.3.1

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run first code example with the 1.4.0 release
preferrably in an environment with multiple networked
printers.
2. Change the printer from the default.
3. Click print on the print dialog.

EXPECTED VERSUS ACTUAL BEHAVIOR :
A GPF.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
JAVAW caused a general protection fault
in module HPFWIN05.DLL at 0013:00006561.
Registers: (blah, blah)

Note: Depending on the printer, the dll name varies (HPFWIN03.DLL for example).
These all seem to be HP inkjet printers, but some lasers crash as well.


This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.util.*;
import javax.print.*;
import java.awt.print.*;
import java.awt.*;

public class TestSwitchPrinters
{
	public static void main(String args[])
	{
		PageFormat format = null;
		PrinterJob printJob = null;

		//setup the page format and printer job
		printJob = PrinterJob.getPrinterJob();
		printJob.setJobName("Numasizing Survey - ");
		format = printJob.defaultPage();

	     //setup margins
		Paper paper = new Paper();
		paper.setImageableArea(36d, 36d, 576d, 738d); //1/2" on top and
left, 1/4" on bottom and right
		format.setPaper(paper);
		format.setOrientation(PageFormat.LANDSCAPE);

		//print to window or printer
		Book book = new Book();
		for(int i = 0; i < 1; i++)
		{
			 book.append(new Printable(){
			     public int print(Graphics graphics, PageFormat
pageFormat, int pageIndex){System.out,println("Not Here!");return 0;}
			   }, format);
		}
		printJob.setPageable(book);

		//show printer dialog
		if (printJob.printDialog())
		{
			try
			{
				//print
				printJob.print();
			}
			catch(PrinterException e)
			{
				System.out.println(e);
			}
		}
	}
}

/**
 * Oddly enough, I ran this code in an unrelated test project and it crashes at
* PrintServiceLookup.lookupPrintServices
 */
import java.util.*;
import javax.print.*;

public class Test
{
	public static void main(String args[])
	{
		PrintService[] services = PrintServiceLookup.lookupPrintServices
(DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
		System.out.println(Arrays.asList(services));
	}
}
---------- END SOURCE ----------

CUSTOMER WORKAROUND :
On some tests it seems that if the java application is
started with the printer as default, it will print on that
printer. But if the printer is switched in the print dialog
it will crash.

Release Regression From : 1.3.1
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.

(Review ID: 145646) 
======================================================================

Comments
EVALUATION This is no longer reproducible in 1.4.1 and looks like this is due to the fix for 4510477. Marking as duplicate. ###@###.### 2002-11-27
27-11-2002