RFR(JDK 12/java.xml) 8213734: SAXParser.parse(File, ..) does not close resources when Exception occurs.

Joe Wang huizhe.wang at oracle.com
Thu Nov 29 20:25:47 UTC 2018


Thanks Lance. Changed the for loop to a while loop:

http://cr.openjdk.java.net/~joehw/jdk12/8213734/webrev_02/

previous:
http://cr.openjdk.java.net/~joehw/jdk12/8213734/webrev_01/

-Joe

On 11/29/18, 11:17 AM, Joe Wang wrote:
> Hi,
>
> Please review a fix for the issue as reported that the SAXParser does 
> not close the underlying reader. This code always existed in Xerces, 
> but it was somehow removed as the comment for the closeReaders method 
> showed. The comment stated "readers are closed in the endEntity 
> method", that is true in general. However when the parsing is 
> interrupted, as in this case by an Exception, the endEntity method 
> won't get called, but closeReaders does through the Parser's cleanup 
> process. This patch recovers the original Xerces' code.
>
> JBS: https://bugs.openjdk.java.net/browse/JDK-8213734
> webrev: http://cr.openjdk.java.net/~joehw/jdk12/8213734/webrev/
>
> Thanks,
> Joe


More information about the core-libs-dev mailing list