From 914d9755b157f337dfb76e90f6b0331f834096d6 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Mon, 20 Jul 2020 12:57:03 +0000 Subject: [PATCH] remove call to deprecated method (#58) * remove call to deprecated method --- .../apache/maven/shared/utils/xml/Xpp3DomBuilder.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomBuilder.java b/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomBuilder.java index bfa77f37..00f6f0b9 100644 --- a/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomBuilder.java +++ b/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomBuilder.java @@ -19,7 +19,6 @@ * under the License. */ -import org.apache.maven.shared.utils.io.IOUtil; import org.apache.maven.shared.utils.xml.pull.XmlPullParserException; import org.xml.sax.Attributes; import org.xml.sax.InputSource; @@ -95,10 +94,10 @@ public static Xpp3Dom build( @WillClose InputStream is, @Nonnull String encoding * @return the built dom * @throws XmlPullParserException in case of an error */ - public static Xpp3Dom build( @WillClose Reader reader, boolean trim ) + public static Xpp3Dom build( @WillClose Reader in, boolean trim ) throws XmlPullParserException { - try + try ( Reader reader = in ) { DocHandler docHandler = parseSax( new InputSource( reader ), trim ); reader.close(); @@ -108,10 +107,6 @@ public static Xpp3Dom build( @WillClose Reader reader, boolean trim ) { throw new XmlPullParserException( e ); } - finally - { - IOUtil.close( reader ); - } } private static DocHandler parseSax( @Nonnull InputSource inputSource, boolean trim )