[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: [OpenJDK 2D-Dev] [9] RFR: JDK-8066139, , Null return from PrintJob.getGraphics() running
From:       Philip Race <philip.race () oracle ! com>
Date:       2016-02-22 8:17:35
Message-ID: 56CAC14F.4030602 () oracle ! com
[Download RAW message or body]

> It seems this behaviour is same in linux too for this HighResTest 
testcase.

OK that is good information .. so is not really a regression from 
8061267 <https://bugs.openjdk.java.net/browse/JDK-8061267> as that is not in
any way touching linux .. it is a pre-existing issue in a code path that 
was not being tested.

-phil.

On 2/22/16, 11:59 AM, prasanta sadhukhan wrote:
> Hi Phil,
> 
> > > Additionally, have you tried running the original test case provided 
> with 8061267
> > > against your fix ?
> The 8061267 testcase behaves similarly before and after my fix.
> 
> > > If I manually select it, (ie select that "Pages" radio button) then 
> press print,
> > > then voila, the NPE is back!
> It seems this behaviour is same in linux too for this HighResTest 
> testcase.
> 
> Regards
> Prasanta
> On 2/20/2016 1:55 AM, Phil Race wrote:
> > I am having trouble building JDK 9 at the moment so i applied 8061267 
> > to jdk8u-dev
> > and was able to reproduce the regression and have a couple of 
> > observations
> > 
> > - I am now seeing the NPE after the first page as you did .. puzzling.
> > - I next applied your fix but still see the NPE !
> > 
> > It appears that all your fix did is stop the "PD_PAGENUMS"  flag 
> > being automatically
> > set. If I manually select it, (ie select that "Pages" radio button) 
> > then press print,
> > then voila, the NPE is back!
> > 
> > -phil.
> > 
> > 
> > On 02/19/2016 10:53 AM, Phil Race wrote:
> > > I am not sure I can be correctly understanding the fix as the 
> > > ramification seems
> > > to be that if the users wants to print only Page 3 of a 10 page 
> > > document and so sets
> > > from page=3 and to page=3, that this request will be ignored and all 
> > > pages will
> > > be printed .. can you test such a scenario.
> > > 
> > > Additionally, have you tried running the original test case provided 
> > > with 8061267
> > > against your fix ?
> > > 
> > > Also when I ran the HighResTest on a current build I saw a null 
> > > graphics on
> > > the very first call to getGraphics() which is different than what I 
> > > interpret
> > > you as saying - you see the null *after* the first page is printed.
> > > 
> > > -phil.
> > > 
> > > On 02/19/2016 01:18 AM, prasanta sadhukhan wrote:
> > > > Hi Phil, All,
> > > > 
> > > > Bug: https://bugs.openjdk.java.net/browse/JDK-8066139
> > > > webrev: http://cr.openjdk.java.net/~psadhukhan/8066139/webrev.00/
> > > > 
> > > > It was seen after fix of JDK-8061267 
> > > > <https://bugs.openjdk.java.net/browse/JDK-8061267>: PrinterJob: 
> > > > Specified Page Ranges not displayed in Windows Native Print Dialog
> > > > the closed/java/awt/PrintJob/HighResTest/HighResTest.java was 
> > > > failing with NPE when PrinterJob.getGraphics() is called the 2nd 
> > > > time before calling PrinterJob.end().
> > > > 
> > > > The above fix caused this regression because it sets the 
> > > > PD_PAGENUMS flag for windows PrintDlg struct which causes *Pages* 
> > > > radio button to be selected in print dialog.
> > > > However, fromPage and toPage was both set to 1 so after the 1st 
> > > > page is printed, RasterPrinterJob.print(attributes) finishes and 
> > > > graphicsToBeDrawn.closeWhenEmpty() gets called
> > > > http://hg.openjdk.java.net/jdk9/client/jdk/file/d8def65c6c00/src/java.desktop/share/classes/sun/print/PrintJob2D.java#l1006
> > > >  
> > > > which sets the queue to null so when PrinterJob2D#getGraphics() 
> > > > calls graphicsToBeDrawn.pop() it sees queue to be null and sets 
> > > > graphics object to be null so
> > > > PrinterJob.getGraphics() gets null and g.drawLine in testcase 
> > > > causes NPE since g is null.
> > > > 
> > > > Fix was done to set the PD_PAGENUMS flag only when toPage is more 
> > > > than fromPage in which case, "All" will be selected in printer 
> > > > dialog and RasterPrinterJob.print() will finish only after printing 
> > > > all the pages.
> > > > 
> > > > Regards
> > > > Prasanta
> > > 
> > 
> 


[Attachment #3 (text/html)]

<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    &gt; It seems this behaviour is same in linux too for this
    HighResTest testcase.<br>
    <br>
    OK that is good information .. so is not really a regression from <a
      moz-do-not-send="true" class="issue-link"
      data-issue-key="JDK-8061267"
      href="https://bugs.openjdk.java.net/browse/JDK-8061267"
      id="key-val" rel="4750956">8061267</a> as that is not in<br>
    any way touching linux .. it is a pre-existing issue in a code path
    that was not being tested.<br>
    <br>
    -phil.<br>
    <br>
    On 2/22/16, 11:59 AM, prasanta sadhukhan wrote:
    <blockquote cite="mid:56CAAAC8.40009@oracle.com" type="cite">
      <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
      Hi Phil,<br>
      <br>
      &gt;&gt;Additionally, have you tried running the original test
      case provided with 8061267<br>
      &gt;&gt; against your fix ?<br>
      The 8061267 testcase behaves similarly before and after my fix.<br>
      <br>
      &gt;&gt; If I manually select it, (ie select that "Pages" radio
      button) then press print,<br>
      &gt;&gt; then voila, the NPE is back!<br>
      It seems this behaviour is same in linux too for this HighResTest
      testcase.<br>
      <br>
      Regards<br>
      Prasanta<br>
      <div class="moz-cite-prefix">On 2/20/2016 1:55 AM, Phil Race
        wrote:<br>
      </div>
      <blockquote cite="mid:56C77A50.7010605@oracle.com" type="cite">
        <meta content="text/html; charset=UTF-8"
          http-equiv="Content-Type">
        <div class="moz-cite-prefix">I am having trouble building JDK 9
          at the moment so i applied 8061267 to jdk8u-dev<br>
          and was able to reproduce the regression and have a couple of
          observations<br>
          <br>
          - I am now seeing the NPE after the first page as you did ..
          puzzling.<br>
          - I next applied your fix but still see the NPE !<br>
          <br>
          It appears that all your fix did is stop the "PD_PAGENUMS"  
          flag being automatically<br>
          set. If I manually select it, (ie select that "Pages" radio
          button) then press print,<br>
          then voila, the NPE is back!<br>
          <br>
          -phil.<br>
          <br>
          <br>
          On 02/19/2016 10:53 AM, Phil Race wrote:<br>
        </div>
        <blockquote cite="mid:56C764B3.9020005@oracle.com" type="cite">
          <meta content="text/html; charset=UTF-8"
            http-equiv="Content-Type">
          <div class="moz-cite-prefix">I am not sure I can be correctly
            understanding the fix as the ramification seems<br>
            to be that if the users wants to print only Page 3 of a 10
            page document and so sets<br>
            from page=3 and to page=3, that this request will be ignored
            and all pages will<br>
            be printed .. can you test such a scenario.<br>
            <br>
            Additionally, have you tried running the original test case
            provided with 8061267<br>
            against your fix ?<br>
            <br>
            Also when I ran the HighResTest on a current build I saw a
            null graphics on<br>
            the very first call to getGraphics() which is different than
            what I interpret<br>
            you as saying - you see the null *after* the first page is
            printed.<br>
            <br>
            -phil.<br>
            <br>
            On 02/19/2016 01:18 AM, prasanta sadhukhan wrote:<br>
          </div>
          <blockquote cite="mid:56C6DDF1.1020009@oracle.com" type="cite">
            <meta http-equiv="content-type" content="text/html;
              charset=UTF-8">
            Hi Phil, All,<br>
            <br>
            Bug: <a moz-do-not-send="true"
              class="moz-txt-link-freetext"
              href="https://bugs.openjdk.java.net/browse/JDK-8066139">https://bugs.openjdk.java.net/browse/JDK-8066139</a><br>
  webrev: <a moz-do-not-send="true"
              class="moz-txt-link-freetext"
              href="http://cr.openjdk.java.net/%7Epsadhukhan/8066139/webrev.00/">http://cr.openjdk.java.net/~psadhukhan/8066139/webrev.00/</a><br>
  <br>
            It was seen after fix of <a moz-do-not-send="true"
              class="issue-link" data-issue-key="JDK-8061267"
              href="https://bugs.openjdk.java.net/browse/JDK-8061267"
              id="key-val" rel="4750956">JDK-8061267</a>: PrinterJob:
            Specified Page Ranges not displayed in Windows Native Print
            Dialog<br>
            the closed/java/awt/PrintJob/HighResTest/HighResTest.java
            was failing with NPE when PrinterJob.getGraphics() is called
            the 2nd time before calling PrinterJob.end().<br>
            <br>
            The above fix caused this regression because it sets the
            PD_PAGENUMS flag for windows PrintDlg struct which causes \
<strong>Pages</strong>  radio button to be selected in print dialog.<br>
            However, fromPage and toPage was both set to 1 so after the
            1st page is printed, RasterPrinterJob.print(attributes)
            finishes and graphicsToBeDrawn.closeWhenEmpty() gets called<br>
            <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://hg.openjdk.java.net/jdk9/client/jdk/file/d8def65c6c00/src/java.desktop/sh \
are/classes/sun/print/PrintJob2D.java#l1006">http://hg.openjdk.java.net/jdk9/client/jd \
k/file/d8def65c6c00/src/java.desktop/share/classes/sun/print/PrintJob2D.java#l1006</a><br>
  <br>
            which sets the queue to null so when
            PrinterJob2D#getGraphics() calls graphicsToBeDrawn.pop() it
            sees queue to be null and sets graphics object to be null so<br>
            PrinterJob.getGraphics() gets null and g.drawLine in
            testcase causes NPE since g is null.<br>
            <br>
            Fix was done to set the PD_PAGENUMS flag only when toPage is
            more than fromPage in which case, "All" will be selected in
            printer dialog and RasterPrinterJob.print() will finish only
            after printing all the pages.<br>
            <br>
            Regards<br>
            Prasanta<br>
          </blockquote>
          <br>
        </blockquote>
        <br>
      </blockquote>
      <br>
    </blockquote>
  </body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic