From 70fd8bdb645c99a106e7c265e33648ca2a3d2922 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 24 Mar 2026 04:23:52 +0000 Subject: [PATCH] Replace e.printStackTrace() with proper logging Replaced e.printStackTrace() with log.error(e) in ForkedGroovyCompiler. Moved the initialization of the Log instance outside of the try block to ensure it's available in the catch block. Co-authored-by: keeganwitt <64612+keeganwitt@users.noreply.github.com> --- .../org/codehaus/gmavenplus/util/ForkedGroovyCompiler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/codehaus/gmavenplus/util/ForkedGroovyCompiler.java b/src/main/java/org/codehaus/gmavenplus/util/ForkedGroovyCompiler.java index c90b2f33..9928e86e 100644 --- a/src/main/java/org/codehaus/gmavenplus/util/ForkedGroovyCompiler.java +++ b/src/main/java/org/codehaus/gmavenplus/util/ForkedGroovyCompiler.java @@ -27,9 +27,9 @@ public static void main(String[] args) { } String configFilePath = args[0]; + Log log = new SystemStreamLog(); try (ObjectInputStream ois = new ObjectInputStream(Files.newInputStream(Paths.get(configFilePath)))) { Object configuration = ois.readObject(); - Log log = new SystemStreamLog(); List classpath = Collections.emptyList(); org.codehaus.gmavenplus.model.IncludeClasspath includeClasspath = null; @@ -73,7 +73,7 @@ public static void main(String[] args) { throw new IllegalArgumentException("Unknown configuration type: " + configuration.getClass().getName()); } } catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException | java.lang.reflect.InvocationTargetException e) { - e.printStackTrace(); + log.error(e); System.exit(1); } }