This is related to 6358747.
Occurs in 1.5 update but not in 1.6.
To reproduce:
Run the following test and when the printDialog is shown, change the printer.
import java.awt.Graphics;
import java.awt.print.*;
import javax.swing.*;
import javax.swing.SwingUtilities;
public class CrashJVM
{ static public void main(String[] args)
{ new AFrame().setVisible(true);
}
private static class AFrame extends JFrame
{ public AFrame()
{ final APanel aPanel = new APanel();
SwingUtilities.invokeLater(new Runnable()
{ public void run()
{ aPanel.startPrint();
}
});
}
}
private static class APanel extends JPanel
{ private APrintable report;
public APanel()
{ report = new APrintable();
}
public Book getBook(PageFormat format)
{ return report.getBook(format);
}
public void startPrint()
{ PrinterJob job = PrinterJob.getPrinterJob();
Paper a4Paper = new Paper();
a4Paper.setSize(595, 840);
a4Paper.setImageableArea(40, 40, 515, 760);
PageFormat pageFormat = job.defaultPage();
pageFormat.setOrientation(PageFormat.PORTRAIT);
pageFormat.setPaper(a4Paper);
for (int i=0; i<4; ++i) {
//pageFormat = job.pageDialog(pageFormat);
//job.setPageable(getBook(pageFormat));
job.printDialog(); // <-- crashes the JVM
}
}
private class APrintable extends JPanel implements Printable
{ public Book getBook(PageFormat format)
{ return new PrintBook(format);
}
public int print(Graphics g, PageFormat format, int page)
{ return PAGE_EXISTS;
}
private class PrintBook extends Book
{ public PrintBook(PageFormat format)
{ append(APrintable.this, format, 1);
}
}
}
}
}
RESULT:
Crash on msctf.ime