From 0da87af564532028da9680bd8ca76ffa06ff480d Mon Sep 17 00:00:00 2001
From: Anna Babu Palathingal <148897727+annaibm@users.noreply.github.com>
Date: Wed, 2 Oct 2024 17:08:05 -0400
Subject: [PATCH 1/2] Updated the tools.jar location to be taken from the SDK
---
stf.build/include/top.xml | 6 +++---
.../net/adoptopenjdk/stf/environment/FileRef.java | 1 +
.../adoptopenjdk/stf/environment/StfEnvironmentCore.java | 8 ++++++++
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/stf.build/include/top.xml b/stf.build/include/top.xml
index f0f9f12..43ce102 100644
--- a/stf.build/include/top.xml
+++ b/stf.build/include/top.xml
@@ -132,7 +132,7 @@ limitations under the License.
-
+
@@ -332,9 +332,9 @@ limitations under the License.
-->
-
+
-
+
diff --git a/stf.core/src/stf.core/net/adoptopenjdk/stf/environment/FileRef.java b/stf.core/src/stf.core/net/adoptopenjdk/stf/environment/FileRef.java
index c15bb17..0785026 100644
--- a/stf.core/src/stf.core/net/adoptopenjdk/stf/environment/FileRef.java
+++ b/stf.core/src/stf.core/net/adoptopenjdk/stf/environment/FileRef.java
@@ -15,6 +15,7 @@
package net.adoptopenjdk.stf.environment;
import java.io.File;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.regex.Pattern;
diff --git a/stf.core/src/stf.core/net/adoptopenjdk/stf/environment/StfEnvironmentCore.java b/stf.core/src/stf.core/net/adoptopenjdk/stf/environment/StfEnvironmentCore.java
index 5935ba9..22c152b 100644
--- a/stf.core/src/stf.core/net/adoptopenjdk/stf/environment/StfEnvironmentCore.java
+++ b/stf.core/src/stf.core/net/adoptopenjdk/stf/environment/StfEnvironmentCore.java
@@ -94,6 +94,14 @@ public StfEnvironmentCore(ArrayList propertyFileDetails, Ar
this.testRoots.add(defaultTestRoot);
invocationProperties.put(Stf.ARG_TEST_ROOT.getName(), defaultTestRoot.getSpec());
}
+
+ try {
+ String javaHome = System.getProperty("java.home");
+ File javaLibDir = new File(javaHome, "../lib");
+ this.testRoots.add(new DirectoryRef(javaLibDir.getCanonicalPath())); // Add ../lib directory
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to add Java lib directory to test roots", e);
+ }
// Work out where the prereqs are
if (!getProperty(Stf.ARG_SYSTEMTEST_PREREQS).isEmpty()) {
From 915aa849dbb9da3d5055527bbc23a45de437f995 Mon Sep 17 00:00:00 2001
From: Anna Babu Palathingal <148897727+annaibm@users.noreply.github.com>
Date: Wed, 16 Oct 2024 11:08:47 -0400
Subject: [PATCH 2/2] Added null pointer check
---
.../adoptopenjdk/stf/environment/StfEnvironmentCore.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/stf.core/src/stf.core/net/adoptopenjdk/stf/environment/StfEnvironmentCore.java b/stf.core/src/stf.core/net/adoptopenjdk/stf/environment/StfEnvironmentCore.java
index 22c152b..3874b0a 100644
--- a/stf.core/src/stf.core/net/adoptopenjdk/stf/environment/StfEnvironmentCore.java
+++ b/stf.core/src/stf.core/net/adoptopenjdk/stf/environment/StfEnvironmentCore.java
@@ -98,7 +98,11 @@ public StfEnvironmentCore(ArrayList propertyFileDetails, Ar
try {
String javaHome = System.getProperty("java.home");
File javaLibDir = new File(javaHome, "../lib");
- this.testRoots.add(new DirectoryRef(javaLibDir.getCanonicalPath())); // Add ../lib directory
+ if (javaLibDir.exists() && javaLibDir.isDirectory()) {
+ this.testRoots.add(new DirectoryRef(javaLibDir.getCanonicalPath())); // Add ../lib directory
+ } else {
+ System.out.println("Java lib directory does not exist: " + javaLibDir.getCanonicalPath());
+ }
} catch (IOException e) {
throw new RuntimeException("Failed to add Java lib directory to test roots", e);
}