From 92e488bc1eae845c672d4eedda5edf958cb7fb51 Mon Sep 17 00:00:00 2001 From: John Eberhard Date: Thu, 23 Jul 2026 06:58:41 -0500 Subject: [PATCH 1/2] Update load from jar file Signed-off-by: John Eberhard --- src/test/JDJSTPTestcase.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/JDJSTPTestcase.java b/src/test/JDJSTPTestcase.java index 5f8a7e7..50bac2b 100644 --- a/src/test/JDJSTPTestcase.java +++ b/src/test/JDJSTPTestcase.java @@ -2649,7 +2649,7 @@ public static void refreshLocalFile(String localFile) throws Exception { // Determine if the local file needs to be extracted from the classpath // // Get the URL of the resource inside the JAR file - URL url = JDJSTPTestcase.class.getResource(localFile); + URL url = JDJSTPTestcase.class.getResource("/"+localFile); File file = new File(localFile); long currentTime = file.lastModified(); long lastJarModifiedMs = 0; @@ -2658,9 +2658,10 @@ public static void refreshLocalFile(String localFile) throws Exception { if (url.getProtocol().equals("jar")) { URLConnection connection = url.openConnection(); lastJarModifiedMs = connection.getLastModified(); + if (debug) System.out.println("Resource "+localFile+" found in jar."); } } else { - System.out.println("Resource not found."); + if (debug) System.out.println("Resource "+localFile+" not found in jar."); } if (lastJarModifiedMs > currentTime) { int lastSlashIndex = localFile.lastIndexOf('/'); From 461d7ee70a3157d8598025c2546cd5cb2f0cebbc Mon Sep 17 00:00:00 2001 From: John Eberhard Date: Thu, 23 Jul 2026 11:39:25 -0500 Subject: [PATCH 2/2] Fix extraction from Jar file Signed-off-by: John Eberhard --- src/test/JDJSTPTestcase.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/test/JDJSTPTestcase.java b/src/test/JDJSTPTestcase.java index 50bac2b..cef5c22 100644 --- a/src/test/JDJSTPTestcase.java +++ b/src/test/JDJSTPTestcase.java @@ -86,6 +86,8 @@ public class JDJSTPTestcase private static String HCLIConnect_ = null; private static String ZCLIConnect_ = null; private static String LCLIConnect_ = null; + @SuppressWarnings("resource") + static FileSystem fsDefault = FileSystems.getDefault(); public static String getGCLIConnect() { if (GCLIConnect_ == null) { @@ -2674,9 +2676,7 @@ public static void refreshLocalFile(String localFile) throws Exception { } InputStream is = url.openStream(); - FileSystem fsDefault = FileSystems.getDefault(); Files.copy(is, fsDefault.getPath(localFile), StandardCopyOption.REPLACE_EXISTING); - fsDefault.close(); is.close(); currentTime = file.lastModified(); } @@ -2699,7 +2699,7 @@ public static boolean updateServerFile(String localFile, String serverPf, String // Determine if the local file needs to be extracted from the classpath // // Get the URL of the resource inside the JAR file - URL url = JDJSTPTestcase.class.getResource(localFile); + URL url = JDJSTPTestcase.class.getResource("/"+localFile); File file = new File(localFile); long currentTime = file.lastModified(); long lastJarModifiedMs = 0; @@ -2708,9 +2708,10 @@ public static boolean updateServerFile(String localFile, String serverPf, String if (url.getProtocol().equals("jar")) { URLConnection connection = url.openConnection(); lastJarModifiedMs = connection.getLastModified(); + if (debug) System.out.println("Resource "+localFile+" copied from jar file."); } } else { - System.out.println("Resource not found."); + if (debug) System.out.println("Resource "+localFile+" not found."); } if (lastJarModifiedMs > currentTime) { int lastSlashIndex = localFile.lastIndexOf('/');