From 5b24455870522e7d3a0d590145fef6b1cc2f7e9c Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Thu, 23 Mar 2023 09:29:13 -0700 Subject: [PATCH] Do not log `null` build log file (#502) --- .../tools/test/maven/ExternalMavenRunner.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jenkins/tools/test/maven/ExternalMavenRunner.java b/src/main/java/org/jenkins/tools/test/maven/ExternalMavenRunner.java index 6c12b8601..26928341e 100644 --- a/src/main/java/org/jenkins/tools/test/maven/ExternalMavenRunner.java +++ b/src/main/java/org/jenkins/tools/test/maven/ExternalMavenRunner.java @@ -75,10 +75,17 @@ public void run( } cmd.addAll(mavenArgs); cmd.addAll(List.of(args)); - LOGGER.log( - Level.INFO, - "Running {0} in {1} >> {2}", - new Object[] {String.join(" ", cmd), baseDirectory, buildLogFile}); + if (buildLogFile != null) { + LOGGER.log( + Level.INFO, + "Running {0} in {1} >> {2}", + new Object[] {String.join(" ", cmd), baseDirectory, buildLogFile}); + } else { + LOGGER.log( + Level.INFO, + "Running {0} in {1}", + new Object[] {String.join(" ", cmd), baseDirectory}); + } Process p; try { p = new ProcessBuilder(cmd).directory(baseDirectory).redirectErrorStream(true).start();