Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[MJAVADOC-755] replace IOUtil.close with try with resources #209

Merged
merged 1 commit into from
Jul 6, 2023
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
10 changes: 2 additions & 8 deletions src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
import org.codehaus.plexus.languages.java.version.JavaVersion;
import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.cli.CommandLineException;
import org.codehaus.plexus.util.cli.CommandLineUtils;
import org.codehaus.plexus.util.cli.Commandline;
Expand Down Expand Up @@ -983,7 +982,7 @@ private static InvocationResult invoke(
InvocationOutputHandler outputHandler = new PrintStreamHandler(ps, false);
request.setOutputHandler(outputHandler);

try {
try (OutputStream closeMe = os) {
outputHandler.consumeLine("Invoking Maven for the goals: " + goals + " with "
+ (properties == null ? "no properties" : "properties=" + properties));
outputHandler.consumeLine("");
Expand All @@ -992,15 +991,10 @@ private static InvocationResult invoke(
outputHandler.consumeLine("JAVA_HOME=" + getJavaHome(log));
outputHandler.consumeLine("JAVA_OPTS=" + getJavaOpts(log));
outputHandler.consumeLine("");
return invoker.execute(request);
} catch (IOException ioe) {
throw new MavenInvocationException("IOException while consuming invocation output", ioe);
}

try {
return invoker.execute(request);
} finally {
IOUtil.close(os);
}
}

/**
Expand Down