You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2025/06/05 10:25:38 UTC
(maven) branch master updated: use try-with-resources statement in LookupWagonMojo (#2426)
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/master by this push:
new dacb81a4d1 use try-with-resources statement in LookupWagonMojo (#2426)
dacb81a4d1 is described below
commit dacb81a4d18c7ed91bbcfaa890a6bda00f3b5e39
Author: Pankraz76 <88...@users.noreply.github.com>
AuthorDate: Thu Jun 5 12:25:33 2025 +0200
use try-with-resources statement in LookupWagonMojo (#2426)
Co-authored-by: Vincent Potucek <vp...@me.com>
---
.../org/apache/maven/plugin/coreit/LookupWagonMojo.java | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/LookupWagonMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/LookupWagonMojo.java
index 278868010a..93d0bf9527 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/LookupWagonMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-uses-wagon/src/main/java/org/apache/maven/plugin/coreit/LookupWagonMojo.java
@@ -92,21 +92,11 @@ public void execute() throws MojoExecutionException, MojoFailureException {
getLog().info("[MAVEN-CORE-IT-LOG] Creating output file " + outputFile);
- OutputStream out = null;
- try {
- outputFile.getParentFile().mkdirs();
- out = new FileOutputStream(outputFile);
+ outputFile.getParentFile().mkdirs();
+ try (OutputStream out = new FileOutputStream(outputFile)) {
loaderProperties.store(out, "MAVEN-CORE-IT-LOG");
} catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + outputFile, e);
- } finally {
- if (out != null) {
- try {
- out.close();
- } catch (IOException e) {
- // just ignore
- }
- }
+ throw new MojoExecutionException(e);
}
getLog().info("[MAVEN-CORE-IT-LOG] Created output file " + outputFile);