[OpenJDK 2D-Dev] Review Request for JDK-7059970 : Test case: javax/imageio/plugins/png/ITXtTest.java is not closing a file

Phil Race philip.race at oracle.com
Thu Jul 7 19:27:22 UTC 2016


you need to add the new bug to @bug ..

197             imageWriter.write(new IIOImage(src, null, m));
198             imageOutputStream.close();                   <<<
  199             System.out.println("Writing done.");
  200         } catch (Throwable e) {
  201             if (imageOutputStream != null) {          <<<<
  202                 imageOutputStream.close();
  203             }
  204             f.delete();
  205             throw new RuntimeException("Writin


maybe use finally for this instead ?

something like :-

    imageWriter.write(new IIOImage(src, null, m))
   System.out.println("Writing done.");
} finally {
    if(imageOutputStream != null) {      
       imageOutputStream.close();
    }
    f.delete();
}

And perhaps the same can be don in doTest() for the file.delete()
rather than having so many of these calls scattered around.

-phil.



On 07/07/2016 04:38 AM, Jayathirth D V wrote:
>
> Hi,
>
> Please review the following fix in JDK9 :
>
> Bug : https://bugs.openjdk.java.net/browse/JDK-7059970
>
> Webrev : http://cr.openjdk.java.net/~jdv/7059970/webrev.00/ 
> <http://cr.openjdk.java.net/%7Ejdv/7059970/webrev.00/>
>
> Root cause : Test case ITXtTest.java is not deleting the file it is 
> creating(test.png). Also it is not closing ImageInputStream that it is 
> creating in between.
>
> Fix : Close the stream and file that is used in the test case with 
> tighter checks.
>
> Thanks,
>
> Jay
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20160707/f24bf7aa/attachment.html>


More information about the 2d-dev mailing list