From 8b5e7ff5af9d125c151e19a701101c7b8094a6b4 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Thu, 26 Sep 2024 15:58:38 +0200 Subject: [PATCH] AWS: Fix CLASSPATH to prevent NULL entry --- deploy/aws/java11Exec/src/main/java/poseidon/App.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deploy/aws/java11Exec/src/main/java/poseidon/App.java b/deploy/aws/java11Exec/src/main/java/poseidon/App.java index a81a0973..ac3bcbae 100644 --- a/deploy/aws/java11Exec/src/main/java/poseidon/App.java +++ b/deploy/aws/java11Exec/src/main/java/poseidon/App.java @@ -96,7 +96,11 @@ public APIGatewayProxyResponseEvent handleRequest(final APIGatewayV2WebSocketEve ProcessBuilder pb = new ProcessBuilder(cmd); pb.directory(workingDirectory); Map env = pb.environment(); - env.put("CLASSPATH", ".:/var/task/lib/org.hamcrest.hamcrest-3.0.jar:/var/task/lib/junit.junit-4.13.2.jar:" + env.get("CLASSPATH")); + if (env.containsKey("CLASSPATH")) { + env.put("CLASSPATH", ".:/var/task/lib/org.hamcrest.hamcrest-3.0.jar:/var/task/lib/junit.junit-4.13.2.jar:" + env.get("CLASSPATH")); + } else { + env.put("CLASSPATH", ".:/var/task/lib/org.hamcrest.hamcrest-3.0.jar:/var/task/lib/junit.junit-4.13.2.jar"); + } Process p = pb.start(); InputStream stdout = p.getInputStream(), stderr = p.getErrorStream(); this.forwardOutput(p, stdout, stderr);