Skip to content

Commit

Permalink
[cleanup] Replace another plexus ioutil close with try with resources
Browse files Browse the repository at this point in the history
  • Loading branch information
hazendaz committed Dec 19, 2023
1 parent e6d2150 commit 180766f
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
package org.eluder.coveralls.maven.plugin.parser;

import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.xml.XmlStreamReader;
import org.eluder.coveralls.maven.plugin.CoverageParser;
Expand Down Expand Up @@ -53,9 +52,9 @@ public AbstractXmlEventParser(final File coverageFile, final SourceLoader source

@Override
public final void parse(final SourceCallback callback) throws ProcessingException, IOException {
XmlStreamReader reader = ReaderFactory.newXmlReader(coverageFile);
XMLStreamReader xml = createEventReader(reader);
try {
XMLStreamReader xml = null;
try (XmlStreamReader reader = ReaderFactory.newXmlReader(coverageFile)) {
xml = createEventReader(reader);
while (xml.hasNext()) {
xml.next();
onEvent(xml, callback);
Expand All @@ -64,7 +63,6 @@ public final void parse(final SourceCallback callback) throws ProcessingExceptio
throw new ProcessingException(ex);
} finally {
close(xml);
IOUtil.close(reader);
}
}

Expand Down

0 comments on commit 180766f

Please sign in to comment.