You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "michael-o (via GitHub)" <gi...@apache.org> on 2023/03/07 22:56:46 UTC

[GitHub] [maven] michael-o commented on a diff in pull request #1043: Fix callee closing streams and readers instead of callers

michael-o commented on code in PR #1043:
URL: https://github.com/apache/maven/pull/1043#discussion_r1128707959


##########
maven-xml-impl/src/main/java/org/codehaus/plexus/util/xml/Xpp3DomBuilder.java:
##########
@@ -62,8 +64,10 @@ public static Xpp3Dom build(Reader reader, boolean trim) throws XmlPullParserExc
      */
     public static Xpp3Dom build(Reader reader, boolean trim, InputLocationBuilder locationBuilder)
             throws XmlPullParserException, IOException {
-        return new Xpp3Dom(
-                XmlNodeBuilder.build(reader, trim, locationBuilder != null ? locationBuilder::toInputLocation : null));
+        try (Reader closeMe = reader) {
+            return new Xpp3Dom(XmlNodeBuilder.build(
+                    reader, trim, locationBuilder != null ? locationBuilder::toInputLocation : null));
+        }
     }

Review Comment:
   These two hunks I don't understand.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org