Re: [OpenJDK 2D-Dev] [9] RFR: JDK-8066139, , Null return from PrintJob.getGraphics() running closed/java/awt/PrintJob/HighResTest/HighResTest.java

2016-03-16 Thread Jayathirth D V
HI Prasanta,

 

Changes are fine. Both the print dialogs are coming and there is no NPE. 

In test case please change copyright year to 2016 and also it is better to have 
jtreg comments before import statements for readability. 

 

Thanks,

Jay

 

From: Phil Race 
Sent: Wednesday, March 16, 2016 3:45 AM
To: prasanta sadhukhan
Cc: 2d-dev@openjdk.java.net
Subject: Re: [OpenJDK 2D-Dev] [9] RFR: JDK-8066139, , Null return from 
PrintJob.getGraphics() running 
closed/java/awt/PrintJob/HighResTest/HighResTest.java

 

On 03/10/2016 02:34 AM, prasanta sadhukhan wrote:

Hi Phil,

Please find the modified webrev 
HYPERLINK 
"http://cr.openjdk.java.net/%7Epsadhukhan/8066139/webrev.02/"http://cr.openjdk.java.net/~psadhukhan/8066139/webrev.02/


+1




I tested in Mac too but there it seems to be working (ie no NPE) without and 
with this fix.


The mac code is sufficiently different that it is not a surprise that it 
behaves differently.





For issue seen on windows , I have raised a bug HYPERLINK 
"https://bugs.openjdk.java.net/browse/JDK-8151589"JDK-8151589 (strangely it is 
not seen in jdk1.8.0_76 but seen from  1.9.0-ea-b01 onwards, can you tell me 
what is the release version before b01?]


That suggests a bug introduced before 8GA, fixed in an 8-update, but not in 9.
But I find that a bit unlikely and I don't want to speculate more. It just 
needs investigation.

-phil.





Regards
Prasanta

On 3/8/2016 9:45 PM, Philip Race wrote:

> However, I am finding a strange issue with and without this fix too. The 
> "Center" string is not printed

Sounds completely unrelated to anything to do with the NPE bug.

It is probably appropriate to file that as a separate bug.
No big surprise that the behaviour is platform-specific as there
is a lot of difference in Windows vs Linux (or vs Mac) in the printing code.

-phil.

On 3/8/16, 2:30 AM, prasanta sadhukhan wrote: 

 

On 3/8/2016 2:17 AM, Phil Race wrote:

I don't think starting a new thread can be right. That would re-invoke
printerJob.print() which even if you can reuse a PrinterJob (something that
was never set out in spec.) you are surely getting a new spool job .. not
a continuation. There a couple of other things I am not sure about either.

I've looked into this - only on Linux - and I believe the issue is that
the test program has decided up-front how many pages it is going to
print and it is paying no attention to the selected page ranges.
Not what the 'user' asked for but it is perfectly within its rights to do so.

However the 2D PrinterJob operates in a way where it calls back
asking for the specific pages it wants to be printed and there the
app. must comply. The PrinterJob terminates once it has done.

In the case when the 2D PrinterJob is being used to 'run' a
PrintJob then it must *never* return until the application has
called "end" - or some exception occurs.

So we need to remove the elements that will cause the job to exit.

--- a/src/java.desktop/share/classes/sun/print/PrintJob2D.java
+++ b/src/java.desktop/share/classes/sun/print/PrintJob2D.java
@@ -995,6 +995,7 @@
 public void run() {
 
 try {
+    attributes.remove(PageRanges.class);
 printerJob.print(attributes);
 } catch (PrinterException e) {
 //REMIND: need to store this away and not rethrow it.
diff --git a/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java 
b/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
--- a/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
+++ b/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
@@ -1172,6 +1172,7 @@
 pageRangesAttr =  (PageRanges)attributes.get(PageRanges.class);
 if (!isSupportedValue(pageRangesAttr, attributes)) {
 pageRangesAttr = null;
+    setPageRange(-1, -1);
 } else {
 if ((SunPageSelection)attributes.get(SunPageSelection.class)
  == SunPageSelection.RANGE) {


This works for me on Linux although 
a) I have not tried Windows)

I tried on windows. The NPE is not seen and it prints 2 pages.
However, I am finding a strange issue with and without this fix too. The 
"Center" string is not printed in the 1st page in both "Portrait" and 
"Landscape" mode (although the rectangles are printed) but is printed in the 
2nd page.
I do not find this issue in linux.

Regards
Prasanta



b) I have not verified if there are no negative consequences from the 2nd 
change.

-phil.

On 03/01/2016 03:14 AM, prasanta sadhukhan wrote:

Hi Phil,

Please find an updated webrev:
HYPERLINK 
"http://cr.openjdk.java.net/%7Epsadhukhan/8066139/webrev.01/"http://cr.openjdk.java.net/~psadhukhan/8066139/webrev.01/

It seems if printerJobThread finished printing, it will set 
graphicsToBeDrawn/graphicsDrawn ArrayList to null resulting in getGraphics() 
returning null in the 2nd iteration causing NPE so
 I have modified printerJobThread#run so that when it has finished printing, do 
not set the 

Re: [OpenJDK 2D-Dev] [9] RFR: JDK-8066139, , Null return from PrintJob.getGraphics() running closed/java/awt/PrintJob/HighResTest/HighResTest.java

2016-03-16 Thread prasanta sadhukhan

Hi Jay,

Updated testcase
http://cr.openjdk.java.net/~psadhukhan/8066139/webrev.03/

Regards
Prasanta
On 3/16/2016 12:58 PM, Jayathirth D V wrote:


HI Prasanta,

Changes are fine. Both the print dialogs are coming and there is no NPE.

In test case please change copyright year to 2016 and also it is 
better to have jtreg comments before import statements for readability.


Thanks,

Jay

*From:*Phil Race
*Sent:* Wednesday, March 16, 2016 3:45 AM
*To:* prasanta sadhukhan
*Cc:* 2d-dev@openjdk.java.net
*Subject:* Re: [OpenJDK 2D-Dev] [9] RFR: JDK-8066139, , Null return 
from PrintJob.getGraphics() running 
closed/java/awt/PrintJob/HighResTest/HighResTest.java


On 03/10/2016 02:34 AM, prasanta sadhukhan wrote:

Hi Phil,

Please find the modified webrev
http://cr.openjdk.java.net/~psadhukhan/8066139/webrev.02/



+1


I tested in Mac too but there it seems to be working (ie no NPE)
without and with this fix.


The mac code is sufficiently different that it is not a surprise that 
it behaves differently.




For issue seen on windows , I have raised a bug JDK-8151589
 (strangely it
is not seen in jdk1.8.0_76 but seen from  1.9.0-ea-b01 onwards,
can you tell me what is the release version before b01?]


That suggests a bug introduced before 8GA, fixed in an 8-update, but 
not in 9.
But I find that a bit unlikely and I don't want to speculate more. It 
just needs investigation.


-phil.



Regards
Prasanta

On 3/8/2016 9:45 PM, Philip Race wrote:

> However, I am finding a strange issue with and without this
fix too. The "Center" string is not printed

Sounds completely unrelated to anything to do with the NPE bug.

It is probably appropriate to file that as a separate bug.
No big surprise that the behaviour is platform-specific as there
is a lot of difference in Windows vs Linux (or vs Mac) in the
printing code.

-phil.

On 3/8/16, 2:30 AM, prasanta sadhukhan wrote:

On 3/8/2016 2:17 AM, Phil Race wrote:

I don't think starting a new thread can be right. That
would re-invoke
printerJob.print() which even if you can reuse a
PrinterJob (something that
was never set out in spec.) you are surely getting a
new spool job .. not
a continuation. There a couple of other things I am
not sure about either.

I've looked into this - only on Linux - and I believe
the issue is that
the test program has decided up-front how many pages
it is going to
print and it is paying no attention to the selected
page ranges.
Not what the 'user' asked for but it is perfectly
within its rights to do so.

However the 2D PrinterJob operates in a way where it
calls back
asking for the specific pages it wants to be printed
and there the
app. must comply. The PrinterJob terminates once it
has done.

In the case when the 2D PrinterJob is being used to
'run' a
PrintJob then it must *never* return until the
application has
called "end" - or some exception occurs.

So we need to remove the elements that will cause the
job to exit.

---
a/src/java.desktop/share/classes/sun/print/PrintJob2D.java
+++
b/src/java.desktop/share/classes/sun/print/PrintJob2D.java
@@ -995,6 +995,7 @@
 public void run() {

 try {
+attributes.remove(PageRanges.class);
 printerJob.print(attributes);
 } catch (PrinterException e) {
 //REMIND: need to store this away and not
rethrow it.
diff --git
a/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
b/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
---
a/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
+++
b/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
@@ -1172,6 +1172,7 @@
 pageRangesAttr =
(PageRanges)attributes.get(PageRanges.class);
 if (!isSupportedValue(pageRangesAttr,
attributes)) {
 pageRangesAttr = null;
+setPageRange(-1, -1);
 } else {
   

Re: [OpenJDK 2D-Dev] [9] RFR: JDK-8066139, , Null return from PrintJob.getGraphics() running closed/java/awt/PrintJob/HighResTest/HighResTest.java

2016-03-16 Thread Jayathirth D V
Looks good to go.

 

Thanks,

Jay

 

From: prasanta sadhukhan 
Sent: Wednesday, March 16, 2016 2:17 PM
To: Jayathirth D V
Cc: 2d-dev@openjdk.java.net
Subject: Re: [OpenJDK 2D-Dev] [9] RFR: JDK-8066139, , Null return from 
PrintJob.getGraphics() running 
closed/java/awt/PrintJob/HighResTest/HighResTest.java

 

Hi Jay,

Updated testcase
http://cr.openjdk.java.net/~psadhukhan/8066139/webrev.03/

Regards
Prasanta

On 3/16/2016 12:58 PM, Jayathirth D V wrote:

HI Prasanta,

 

Changes are fine. Both the print dialogs are coming and there is no NPE. 

In test case please change copyright year to 2016 and also it is better to have 
jtreg comments before import statements for readability. 

 

Thanks,

Jay

 

From: Phil Race 
Sent: Wednesday, March 16, 2016 3:45 AM
To: prasanta sadhukhan
Cc: HYPERLINK "mailto:2d-dev@openjdk.java.net"2d-dev@openjdk.java.net
Subject: Re: [OpenJDK 2D-Dev] [9] RFR: JDK-8066139, , Null return from 
PrintJob.getGraphics() running 
closed/java/awt/PrintJob/HighResTest/HighResTest.java

 

On 03/10/2016 02:34 AM, prasanta sadhukhan wrote:

Hi Phil,

Please find the modified webrev 
HYPERLINK 
"http://cr.openjdk.java.net/%7Epsadhukhan/8066139/webrev.02/"http://cr.openjdk.java.net/~psadhukhan/8066139/webrev.02/


+1





I tested in Mac too but there it seems to be working (ie no NPE) without and 
with this fix.


The mac code is sufficiently different that it is not a surprise that it 
behaves differently.






For issue seen on windows , I have raised a bug HYPERLINK 
"https://bugs.openjdk.java.net/browse/JDK-8151589"JDK-8151589 (strangely it is 
not seen in jdk1.8.0_76 but seen from  1.9.0-ea-b01 onwards, can you tell me 
what is the release version before b01?]


That suggests a bug introduced before 8GA, fixed in an 8-update, but not in 9.
But I find that a bit unlikely and I don't want to speculate more. It just 
needs investigation.

-phil.






Regards
Prasanta

On 3/8/2016 9:45 PM, Philip Race wrote:

> However, I am finding a strange issue with and without this fix too. The 
> "Center" string is not printed

Sounds completely unrelated to anything to do with the NPE bug.

It is probably appropriate to file that as a separate bug.
No big surprise that the behaviour is platform-specific as there
is a lot of difference in Windows vs Linux (or vs Mac) in the printing code.

-phil.

On 3/8/16, 2:30 AM, prasanta sadhukhan wrote: 

 

On 3/8/2016 2:17 AM, Phil Race wrote:

I don't think starting a new thread can be right. That would re-invoke
printerJob.print() which even if you can reuse a PrinterJob (something that
was never set out in spec.) you are surely getting a new spool job .. not
a continuation. There a couple of other things I am not sure about either.

I've looked into this - only on Linux - and I believe the issue is that
the test program has decided up-front how many pages it is going to
print and it is paying no attention to the selected page ranges.
Not what the 'user' asked for but it is perfectly within its rights to do so.

However the 2D PrinterJob operates in a way where it calls back
asking for the specific pages it wants to be printed and there the
app. must comply. The PrinterJob terminates once it has done.

In the case when the 2D PrinterJob is being used to 'run' a
PrintJob then it must *never* return until the application has
called "end" - or some exception occurs.

So we need to remove the elements that will cause the job to exit.

--- a/src/java.desktop/share/classes/sun/print/PrintJob2D.java
+++ b/src/java.desktop/share/classes/sun/print/PrintJob2D.java
@@ -995,6 +995,7 @@
 public void run() {
 
 try {
+    attributes.remove(PageRanges.class);
 printerJob.print(attributes);
 } catch (PrinterException e) {
 //REMIND: need to store this away and not rethrow it.
diff --git a/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java 
b/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
--- a/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
+++ b/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
@@ -1172,6 +1172,7 @@
 pageRangesAttr =  (PageRanges)attributes.get(PageRanges.class);
 if (!isSupportedValue(pageRangesAttr, attributes)) {
 pageRangesAttr = null;
+    setPageRange(-1, -1);
 } else {
 if ((SunPageSelection)attributes.get(SunPageSelection.class)
  == SunPageSelection.RANGE) {


This works for me on Linux although 
a) I have not tried Windows)

I tried on windows. The NPE is not seen and it prints 2 pages.
However, I am finding a strange issue with and without this fix too. The 
"Center" string is not printed in the 1st page in both "Portrait" and 
"Landscape" mode (although the rectangles are printed) but is printed in the 
2nd page.
I do not find this issue in linux.

Regards
Prasanta




b) I have not verified if there are no negative consequences from the 2nd 
change.

-phil

Re: [OpenJDK 2D-Dev] [9] RFR: JDK-6379088, , Suboptimal expression in javax.imageio.ImageTypeSpecifier.getBitsPerBand(int)

2016-03-16 Thread Jayathirth D V
Change is fine. Looks like this is the only place in ImageTypeSpecifier where 
we are not using short-circuit logical "or".

-Original Message-
From: prasanta sadhukhan 
Sent: Tuesday, March 15, 2016 5:36 PM
To: Sergey Bylokhov; Jayathirth D V; 2d-dev@openjdk.java.net
Subject: [9] RFR: JDK-6379088,,Suboptimal expression in 
javax.imageio.ImageTypeSpecifier.getBitsPerBand(int)

Hi All,

Bug: https://bugs.openjdk.java.net/browse/JDK-6379088
webrev: http://cr.openjdk.java.net/~psadhukhan/6379088/webrev.00/

Please review a simple fix where we should be using short-circuit logical 
operators so that if left side of the expression is false, right side will not 
be evaluated.
I intend to put noreg-trivial label for this fix.

Regards
Prasanta


Re: [OpenJDK 2D-Dev] [9] RFR: JDK-6379088, , Suboptimal expression in javax.imageio.ImageTypeSpecifier.getBitsPerBand(int)

2016-03-16 Thread prasanta sadhukhan

Thanks Jay. Sergey, could you please give your +1 on this?

Regards
Prasanta
On 3/16/2016 2:46 PM, Jayathirth D V wrote:

Change is fine. Looks like this is the only place in ImageTypeSpecifier where we are not 
using short-circuit logical "or".

-Original Message-
From: prasanta sadhukhan
Sent: Tuesday, March 15, 2016 5:36 PM
To: Sergey Bylokhov; Jayathirth D V; 2d-dev@openjdk.java.net
Subject: [9] RFR: JDK-6379088,,Suboptimal expression in 
javax.imageio.ImageTypeSpecifier.getBitsPerBand(int)

Hi All,

Bug: https://bugs.openjdk.java.net/browse/JDK-6379088
webrev: http://cr.openjdk.java.net/~psadhukhan/6379088/webrev.00/

Please review a simple fix where we should be using short-circuit logical 
operators so that if left side of the expression is false, right side will not 
be evaluated.
I intend to put noreg-trivial label for this fix.

Regards
Prasanta




[OpenJDK 2D-Dev] Review Request for JDK-6185114: Undefined Exception in SampleModel, method createCompatibleSampleModel

2016-03-16 Thread Ajit Ghaisas
Hi,

 

Bug : https://bugs.openjdk.java.net/browse/JDK-6185114

 

Issue : Undefined Exception in SampleModel, method createCompatibleSampleModel

 

Root Cause : 

The SampleModel constructor documentation says -  it throws the 
IllegalArgumentException if the product of width and height parameters is 
greater than Integer.MAX_VALUE.

The condition for this check is incorrectly checks for "greater than equal to" 
where it should be only "greater than".

 

Fix :

Corrected the erroneous condition in below webrev and added a test.

http://cr.openjdk.java.net/~arapte/ajit/6185114/webrev.00/

 

Regards,

Ajit


Re: [OpenJDK 2D-Dev] Review Request for JDK-6185114: Undefined Exception in SampleModel, method createCompatibleSampleModel

2016-03-16 Thread prasanta sadhukhan
Fix Looks ok. Test failure message does not say what it is failing for. 
Maybe you can mention "Expected IAE count <>, got IAE count <>" . lune 
52 has a typo heiht


Regards
Prasanta
On 3/16/2016 3:57 PM, Ajit Ghaisas wrote:


Hi,

Bug : https://bugs.openjdk.java.net/browse/JDK-6185114

Issue : Undefined Exception in SampleModel, method 
createCompatibleSampleModel


Root Cause :

The SampleModel constructor documentation says –  it throws the 
IllegalArgumentException if the product of width and height parameters 
is greater than Integer.MAX_VALUE.


The condition for this check is incorrectly checks for “greater than 
equal to” where it should be only “greater than”.


Fix :

Corrected the erroneous condition in below webrev and added a test.

http://cr.openjdk.java.net/~arapte/ajit/6185114/webrev.00/ 



Regards,

Ajit