Re: [OpenJDK 2D-Dev] [9] RFR JDK-6357887: selected printertray is ignored under linux

2016-08-25 Thread Vadim Pakhnushev
You see, you now have 102 MediaTray mt = null; 114 return( mt); This can be just return null; No need for new webrev for that, +1. Vadim On 25.08.2016 19:14, Prasanta Sadhukhan wrote: On 8/25/2016 7:29 PM, Vadim Pakhnushev wrote: In the PSPrinterJob.java customTray.getChoic

Re: [OpenJDK 2D-Dev] [9] RFR JDK-6357887: selected printertray is ignored under linux

2016-08-25 Thread Prasanta Sadhukhan
On 8/25/2016 7:29 PM, Vadim Pakhnushev wrote: In the PSPrinterJob.java customTray.getChoiceName() is not checked for null but in the UnixPrintJob it is checked. Could this be a problem? Checked for null just to be safe and simplified test method Modified webrev http://cr.openjdk.java.net/~ps

Re: [OpenJDK 2D-Dev] [9] RFR JDK-6357887: selected printertray is ignored under linux

2016-08-25 Thread Vadim Pakhnushev
In the PSPrinterJob.java customTray.getChoiceName() is not checked for null but in the UnixPrintJob it is checked. Could this be a problem? The getMediaTray method in the test could be simplified to for (Media m : media) { if (m instanceof MediaTray) { if (m.toString().trim()...) {

Re: [OpenJDK 2D-Dev] [9] RFR JDK-6357887: selected printertray is ignored under linux

2016-08-25 Thread Philip Race
+1 -phil On 8/24/16, 11:27 PM, Prasanta Sadhukhan wrote: Thanks Phil for the comments. Modified webrev: http://cr.openjdk.java.net/~psadhukhan/6357887/webrev.02/ Regards Prasanta On 8/25/2016 12:05 AM, Phil Race wrote: In fact what you should be doing here is Attribute attr = attrs.get(Media.

Re: [OpenJDK 2D-Dev] [9] RFR JDK-6357887: selected printertray is ignored under linux

2016-08-24 Thread Prasanta Sadhukhan
Thanks Phil for the comments. Modified webrev: http://cr.openjdk.java.net/~psadhukhan/6357887/webrev.02/ Regards Prasanta On 8/25/2016 12:05 AM, Phil Race wrote: In fact what you should be doing here is Attribute attr = attrs.get(Media.class); if (attr instanceof CustomMediaTray) The progr

Re: [OpenJDK 2D-Dev] [9] RFR JDK-6357887: selected printertray is ignored under linux

2016-08-24 Thread Phil Race
In fact what you should be doing here is Attribute attr = attrs.get(Media.class); if (attr instanceof CustomMediaTray) The program below should show that the lookup works so long as the key is the class understood by the API - not a sub-type. -phil. import javax.print.*; import javax.print.

Re: [OpenJDK 2D-Dev] [9] RFR JDK-6357887: selected printertray is ignored under linux

2016-08-18 Thread Prasanta Sadhukhan
On 8/19/2016 3:36 AM, Philip Race wrote: Oh .. right under the covers the map is just a HashMap and the key to the map is the class so just decides if these are equal class objects. Hmm .. I don't know anymore if that was the original intent but we probably should not mess with it right now ju

Re: [OpenJDK 2D-Dev] [9] RFR JDK-6357887: selected printertray is ignored under linux

2016-08-18 Thread Philip Race
Oh .. right under the covers the map is just a HashMap and the key to the map is the class so just decides if these are equal class objects. Hmm .. I don't know anymore if that was the original intent but we probably should not mess with it right now just for the optimisation. But now I am wonde

Re: [OpenJDK 2D-Dev] [9] RFR JDK-6357887: selected printertray is ignored under linux

2016-08-17 Thread Prasanta Sadhukhan
On 8/18/2016 12:11 PM, Prasanta Sadhukhan wrote: MediaTray values are bundled with "Media" attribute so calling attributes.get(CustomMediatray.class) returns null. Modified webrev to get Media attribute and then see if the attribute is an instance of CustomMediatray. http://cr.openjdk.java.n

Re: [OpenJDK 2D-Dev] [9] RFR JDK-6357887: selected printertray is ignored under linux

2016-08-17 Thread Prasanta Sadhukhan
MediaTray values are bundled with "Media" attribute so calling attributes.get(CustomMediatray.class) returns null. Modified webrev to get Media attribute and then see if the attribute is an instance of CustomMediatray. http://cr.openjdk.java.net/~psadhukhan/6357887/webrev.01/ Regards Prasanta

Re: [OpenJDK 2D-Dev] [9] RFR JDK-6357887: selected printertray is ignored under linux

2016-08-17 Thread Philip Race
This all looks fine although this can be a simple call to attributes.get(CustomMediaTray.class) can't it ? 502 for (int i=0; i< attrs.length; i++) { 503 Attribute attr = attrs[i]; 504 try { 505 if (attr instanceof CustomMediaTray) { 506

[OpenJDK 2D-Dev] [9] RFR JDK-6357887: selected printertray is ignored under linux

2016-08-10 Thread Prasanta Sadhukhan
Hi All, Please review a fix for an issue where it is seen that the selected printer tray is ignored in linux and default standard tray is used for printing. Bug: https://bugs.openjdk.java.net/browse/JDK-6357887 webrev: http://cr.openjdk.java.net/~psadhukhan/6357887/webrev.00/ Issue was lpr c