From 9b7b21c1185e57e3052f676ddf9204ea98cca729 Mon Sep 17 00:00:00 2001 From: "David M. Lloyd" Date: Tue, 27 Aug 2024 11:10:34 -0500 Subject: [PATCH] Use whole separator to delimit JAR file paths --- .../smallrye/common/classloader/ClassPathUtils.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/classloader/src/main/java/io/smallrye/common/classloader/ClassPathUtils.java b/classloader/src/main/java/io/smallrye/common/classloader/ClassPathUtils.java index e24aa01..2855062 100644 --- a/classloader/src/main/java/io/smallrye/common/classloader/ClassPathUtils.java +++ b/classloader/src/main/java/io/smallrye/common/classloader/ClassPathUtils.java @@ -132,7 +132,7 @@ public static void consumeAsPath(URL url, Consumer consumer) { public static R processAsPath(URL url, Function function) { if (JAR.equals(url.getProtocol())) { final String file = url.getFile(); - final int exclam = file.indexOf('!'); + final int exclam = file.indexOf("!/"); try { URL fileUrl; String subPath; @@ -147,6 +147,7 @@ public static R processAsPath(URL url, Function function) { if (!fileUrl.getProtocol().equals("file")) { throw new IllegalArgumentException("Sub-URL of JAR URL is expected to have a scheme of `file`"); } + return processAsJarPath(toLocalPath(fileUrl), subPath, function); } catch (MalformedURLException e) { throw new RuntimeException("Failed to create a URL for '" + file.substring(0, exclam) + "'", e); @@ -165,19 +166,16 @@ private static R processAsJarPath(Path jarPath, String path, Function