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 19:17:15 UTC 2018


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