Issue #3743 - Handling StringReader using try-with-resources
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
parent
a72a6ab875
commit
c065eaa3cc
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue