Issue #3743 - Handling StringReader using try-with-resources

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2019-06-06 14:06:23 -05:00
parent a72a6ab875
commit c065eaa3cc
1 changed files with 10 additions and 6 deletions

View File

@ -237,14 +237,18 @@ public class XmlConfiguration
@Deprecated
public XmlConfiguration(String configuration) throws SAXException, IOException
{
configuration = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE Configure PUBLIC \"-//Jetty//Configure//EN\" \"http://eclipse.org/jetty/configure.dtd\">"
configuration = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<!DOCTYPE Configure PUBLIC \"-//Jetty//Configure//EN\" \"http://www.eclipse.org/jetty/configure_9_3.dtd\">"
+ configuration;
InputSource source = new InputSource(new StringReader(configuration));
synchronized (__parser)
try (StringReader reader = new StringReader(configuration))
{
_location = null;
setConfig(__parser.parse(source));
_dtd = __parser.getDTD();
InputSource source = new InputSource(reader);
synchronized (__parser)
{
_location = null;
setConfig(__parser.parse(source));
_dtd = __parser.getDTD();
}
}
}