-
Bug
-
Resolution: Cannot Reproduce
-
P3
-
6, 9
-
generic
-
generic
I have written an application using Java PrintService APIs. I am passing a list of print services to ServiceUI.printDialog() method alongwith the doc flavor and attribute set. One of the print services does not support the specified doc flavor.
1. If this print service is the default one, print dialog throws an exception upfront. The issue is, this exception is not documented. It must be documented under 'Throws' for printDialog() method.
If the print service that does not support the doc flavor is not the default one, no action is taken at the time of showing the dialog. But when the user chooses this print service from the drop-down, an IllegalArgumentException is thrown by the print dialog. There are various issues on this.
1. This exception is thrown on the Event Dispatch Thread. The application is not able to catch this exception.
2. Please note that print dialog is modal and blocks the current thread until it is disposed. So there is no way the application can catch this exception.
3. Even if we assume that the application can catch it, it can hardly do anything. Suppose if I want to show a error dialog myself, I need the handle of the print dialog so as to make the error dialog show on top of the print dialog. But we don't get the handle of print dialog. If we could not make the print dialog as the parent of the error dlg, error dialog will be hidden below the print dialog. All these are applicable only if the application can catch the exception which itself is not possible currently.
4. There is no point in throwing an exception that the application can not handle. If at all it has to be thrown, it must be done upfront ie, before the dialog is shown. At least, the application will get a chance to rectify it.
5. When the exception is thrown, the dialog freezes and the user could not do anything on the dialog. A bug has been filed on this already: 4929305. This is a regression on Tiger.
Ideally, the print dialog should catch this exception and show an error dialog to the user stating that the selected print service does not support the specified doc flavor. Otherwise, all the print services must be validated against the specified doc flavor upfront before the dialog is shown and the unsupported print services can be eliminated from the drop-down.
This is reproducible on all the platforms since JDK1.4.
I have attached a sample testcase. Execute the testcase on a system that has a default postscript printer. A print dialog will come up. Select the 'Test Printer' from the drop-down. You would see the exception at the console and the print dialog freezes.
1. If this print service is the default one, print dialog throws an exception upfront. The issue is, this exception is not documented. It must be documented under 'Throws' for printDialog() method.
If the print service that does not support the doc flavor is not the default one, no action is taken at the time of showing the dialog. But when the user chooses this print service from the drop-down, an IllegalArgumentException is thrown by the print dialog. There are various issues on this.
1. This exception is thrown on the Event Dispatch Thread. The application is not able to catch this exception.
2. Please note that print dialog is modal and blocks the current thread until it is disposed. So there is no way the application can catch this exception.
3. Even if we assume that the application can catch it, it can hardly do anything. Suppose if I want to show a error dialog myself, I need the handle of the print dialog so as to make the error dialog show on top of the print dialog. But we don't get the handle of print dialog. If we could not make the print dialog as the parent of the error dlg, error dialog will be hidden below the print dialog. All these are applicable only if the application can catch the exception which itself is not possible currently.
4. There is no point in throwing an exception that the application can not handle. If at all it has to be thrown, it must be done upfront ie, before the dialog is shown. At least, the application will get a chance to rectify it.
5. When the exception is thrown, the dialog freezes and the user could not do anything on the dialog. A bug has been filed on this already: 4929305. This is a regression on Tiger.
Ideally, the print dialog should catch this exception and show an error dialog to the user stating that the selected print service does not support the specified doc flavor. Otherwise, all the print services must be validated against the specified doc flavor upfront before the dialog is shown and the unsupported print services can be eliminated from the drop-down.
This is reproducible on all the platforms since JDK1.4.
I have attached a sample testcase. Execute the testcase on a system that has a default postscript printer. A print dialog will come up. Select the 'Test Printer' from the drop-down. You would see the exception at the console and the print dialog freezes.
- relates to
-
JDK-4929305 REG: Print Dialog freezes when selected print service does not support Doc Flvr
-
- Closed
-