Skip to content

Commit 1614915

Browse files
committed
fix #652 if there are spaces in the directory name, custom plugin cannot be scanned
1 parent 4538789 commit 1614915

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

hotswap-agent-core/src/main/java/org/hotswap/agent/util/scanner/ClassPathScanner.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ public void scan(ClassLoader classLoader, String path, ScannerVisitor visitor) t
5454
Enumeration<URL> en = classLoader == null ? ClassLoader.getSystemResources(path) : classLoader.getResources(path);
5555
while (en.hasMoreElements()) {
5656
URL pluginDirURL = en.nextElement();
57-
File pluginDir = new File(pluginDirURL.getFile());
57+
File pluginDir;
58+
try {
59+
pluginDir = new File(pluginDirURL.toURI());
60+
} catch (URISyntaxException e) {
61+
// Fallback for URLs that are not valid URIs
62+
pluginDir = new File(pluginDirURL.getFile());
63+
}
5864
if (pluginDir.isDirectory()) {
5965
scanDirectory(pluginDir, visitor);
6066
} else {

0 commit comments

Comments
 (0)