<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Jay,<div><br></div><div>Sorry to be picky here but in doTest() could you not instead have</div><div><br></div><div><div style="margin: 0px; font-family: Courier;">        try {</div><div style="margin: 0px; font-family: Courier;">            writeTo(file, src);</div><div style="margin: 0px; font-family: Courier;">            ITXtTest dst = readFrom(file);</div><div style="margin: 0px; font-family: Courier;">            if (dst == null || !dst.equals(src)) {</div><div style="margin: 0px; font-family: Courier;">                throw new RuntimeException("Test failed.");</div><div style="margin: 0px; font-family: Courier;">            }</div><div style="margin: 0px; font-family: Courier;">        } catch (RuntimeException re) {</div><div style="margin: 0px; font-family: Courier;">            throw re;</div><div style="margin: 0px; font-family: Courier;">        } finally {</div><div style="margin: 0px; font-family: Courier;">            file.delete();</div><div style="margin: 0px; font-family: Courier;">        }</div><div style="margin: 0px; font-family: Courier;">        System.out.println("Test passed.");</div><div><div><br></div><div>and therefore remove <span style="font-family: Courier;">f.delete()</span> from <span style="font-family: Courier;">writeTo()</span> and  <span style="font-family: Courier;">readFrom()</span>?</div><div><br></div><div>Thanks,</div><div><br></div><div>Brian</div><div><br></div><div>On Jul 8, 2016, at 12:04 AM, Jayathirth D V <<a href="mailto:jayathirth.d.v@oracle.com">jayathirth.d.v@oracle.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span style="color: rgb(31, 73, 125); font-family: Calibri, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">I can’t perform f.delete() in finally block of  writeTo() and readFrom() because “test.png” is shared resource between the methods. So I am deleting “test.png” at places where we are throwing RumtimeException.</span></blockquote></div><br></div></body></html>