JDK-6549555 : ArrayIndexOutOfBoundsExcep when using PrintDialog with HP Color LaserJet 5500
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-04-24
  • Updated: 2010-04-04
  • Resolved: 2007-04-25
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
Occurs with both 6.0 (mustang) and

Java 1.6.0_01 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

EXTRA RELEVANT SYSTEM CONFIGURATION :
HP Color LaserJet 5500

A DESCRIPTION OF THE PROBLEM :
This appears to be the same bug as 6174596, but that is marked fixed in Mustang.  I am still seeing the problem in both 6.0 and 6.0_01.

When HP Color LaserJet 5500 is set to be my default printer, I get the following exception when I first bring up the print dialog (using 1.4 printing API):

java.lang.ArrayIndexOutOfBoundsException: 26
	at sun.print.Win32PrintService.getMediaTrays(Unknown Source)
	at sun.print.Win32PrintService.getSupportedAttributeValues(Unknown Source)
	at sun.print.ServiceDialog$MediaPanel.updateInfo(Unknown Source)
	at sun.print.ServiceDialog$PageSetupPanel.updateInfo(Unknown Source)
	at sun.print.ServiceDialog.updatePanels(Unknown Source)
	at sun.print.ServiceDialog.access$1300(Unknown Source)
	at sun.print.ServiceDialog$PrintServicePanel.popupMenuWillBecomeInvisible(Unknown Source)
	at javax.swing.JComboBox.firePopupMenuWillBecomeInvisible(Unknown Source)
	at javax.swing.plaf.basic.BasicComboPopup.firePopupMenuWillBecomeInvisible(Unknown Source)
	at javax.swing.JPopupMenu.setVisible(Unknown Source)
	at javax.swing.JPopupMenu.menuSelectionChanged(Unknown Source)
	at javax.swing.MenuSelectionManager.setSelectedPath(Unknown Source)
	at javax.swing.MenuSelectionManager.clearSelectedPath(Unknown Source)
	at javax.swing.plaf.basic.BasicComboPopup.hide(Unknown Source)
	at javax.swing.plaf.basic.BasicComboBoxUI.setPopupVisible(Unknown Source)
	at javax.swing.JComboBox.setPopupVisible(Unknown Source)
	at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(Unknown Source)
	at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at javax.swing.plaf.basic.BasicComboPopup$1.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.Dialog$1.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Set HP Color LaserJet 5500 to be your system's default printer
Run a test application that brings up the 1.4 print dialog.
Exception is thrown.  Another way to reproduce this is to have a different default printer and then select the HP printer from the print dialog dropdown.  The exception is thrown at that point.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expect no exception.
ACTUAL -
Exception occurred during event dispatching:
java.lang.ArrayIndexOutOfBoundsException: 26
	at sun.print.Win32PrintService.getMediaTrays(Unknown Source)
	at sun.print.Win32PrintService.getSupportedAttributeValues(Unknown Source)
	at sun.print.ServiceDialog$MediaPanel.updateInfo(Unknown Source)
	at sun.print.ServiceDialog$PageSetupPanel.updateInfo(Unknown Source)
	at sun.print.ServiceDialog.updatePanels(Unknown Source)
	at sun.print.ServiceDialog.access$1300(Unknown Source)
	at sun.print.ServiceDialog$PrintServicePanel.popupMenuWillBecomeInvisible(Unknown Source)
	at javax.swing.JComboBox.firePopupMenuWillBecomeInvisible(Unknown Source)
	at javax.swing.plaf.basic.BasicComboPopup.firePopupMenuWillBecomeInvisible(Unknown Source)
	at javax.swing.JPopupMenu.setVisible(Unknown Source)
	at javax.swing.JPopupMenu.menuSelectionChanged(Unknown Source)
	at javax.swing.MenuSelectionManager.setSelectedPath(Unknown Source)
	at javax.swing.MenuSelectionManager.clearSelectedPath(Unknown Source)
	at javax.swing.plaf.basic.BasicComboPopup.hide(Unknown Source)
	at javax.swing.plaf.basic.BasicComboBoxUI.setPopupVisible(Unknown Source)
	at javax.swing.JComboBox.setPopupVisible(Unknown Source)
	at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(Unknown Source)

ERROR MESSAGES/STACK TRACES THAT OCCUR :
See above

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;
import javax.print.DocFlavor;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.ServiceUI;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.HashPrintRequestAttributeSet;
import java.awt.*;
import java.awt.print.Printable;
import java.awt.print.PageFormat;
import java.awt.print.PrinterException;


public class PrintTest{
   private JFrame fFrame;
   private MyTextArea fTextArea;

   public PrintTest(){
       //bring up a 1.4 print dialog for a text area.
       fFrame = new JFrame("Text Area");
       fTextArea = new MyTextArea("foo bar test\n" +
               "foo bar test\n" +
               "test test test");
       fFrame.getContentPane().add(fTextArea);
       fFrame.setSize(200, 200);
       fFrame.setVisible(true);
       print();
   }

   public void print(){
       DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
       PrintService defaultService =
PrintServiceLookup.lookupDefaultPrintService();
       final PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();

       PrintService[] printService = // using pras above causes problems-- no printers returned
               PrintServiceLookup.lookupPrintServices(flavor, new HashPrintRequestAttributeSet());

       Point location = fFrame.getLocationOnScreen();
       ServiceUI.printDialog(null, location.x + 100, location.y + 100,
               printService, defaultService, flavor, pras);

   }

   public class MyTextArea extends JTextArea implements Printable{
       public MyTextArea(String text){
           super(text);
       }

       public int print(Graphics g, PageFormat pf, int pageIndex) throws PrinterException{
           return -1;
       }
   }

   public static void main(String[] args){
       new PrintTest();
   }
}


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

Comments
EVALUATION Still not reproducible with PS driver 60.34.153.31 13 May 2005. Suggested to customer to re-install driver. Here's the comment: >We tried re-installing the '05 PostScript driver, and that did not fix >> the problem. We cannot use the PCL5c or PCL6 drivers because of our >> environment (multiple operating systems). >> >> But the good news is that we tried the HP Universal Postscript print >> driver (4.0, 16 Apr 2007), and that did fix the problem! We will stick >> with that driver. Unknown specifics on how to reproduce problem with their original driver so I'm closing as not reproducible.
25-04-2007

EVALUATION Submitter's reply: ------------------------------------------------------------------------- Our printer has PS driver 60.34.153.31 13 May 2005, which looks like the most recent postscript driver according to HP's web site: http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareIndex.jsp?lang= en&cc=us&prodNameId=406808&prodTypeId=18972&prodSeriesId=409994&swLang=8 &taskId=135&swEnvOID=228
24-04-2007

EVALUATION I got the latest driver from hp.com and it's not reproducible with PCL 6 and PCL 5c drivers using JDK 6u1. Maybe the submitter is using a different driver. What is the version of the driver? Marking incomplete.
24-04-2007