Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.util.Map;

import org.apache.maven.api.xml.XmlNode;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.xml.pull.MXParser;
import org.codehaus.plexus.util.xml.pull.XmlPullParser;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
Expand Down Expand Up @@ -61,17 +60,12 @@ public static XmlNodeImpl build(InputStream is, String encoding) throws XmlPullP

public static XmlNodeImpl build(InputStream is, String encoding, boolean trim)
throws XmlPullParserException, IOException {
try {
try (InputStream closeMe = is) {
final XmlPullParser parser = new MXParser();
parser.setInput(is, encoding);

final XmlNodeImpl node = build(parser, trim);
is.close();
is = null;

return node;
} finally {
IOUtil.close(is);
}
}

Expand All @@ -90,17 +84,13 @@ public static XmlNodeImpl build(Reader reader, boolean trim) throws XmlPullParse
*/
public static XmlNodeImpl build(Reader reader, boolean trim, InputLocationBuilder locationBuilder)
throws XmlPullParserException, IOException {
try {
try (Reader closeMe = reader) {
final XmlPullParser parser = new MXParser();
parser.setInput(reader);

final XmlNodeImpl node = build(parser, trim, locationBuilder);
reader.close();
reader = null;

return node;
} finally {
IOUtil.close(reader);
}
}

Expand Down