Skip to content

Commit

Permalink
CDI: Ensure a path with whitespace will not cause a issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
ened committed Apr 7, 2015
1 parent 6c682ca commit 6ef3f4d
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ protected void discoverResources(ResourceLoader resourceLoader,
} else if ("jar".equals(resourceURL.getProtocol())) {

File archiveFile =
new File(URI.create(resourcePath.substring(0, resourcePath.indexOf("!"))));
new File(URI.create(resourcePath.substring(0, resourcePath.indexOf("!")).replace(" ", "%20")));
discoverResourcesInArchive(archiveFile, discoveredClasses, discoveredBeanXmlUrls);

} else {
Expand Down Expand Up @@ -189,7 +189,7 @@ protected void discoverResourcesInArchive(String path,
classesInArchive.add(toClassName(entry.getName()));
} else if (entry.getName().endsWith(BEANS_XML)) {
archiveHasBeansXml = true;
discoveredBeanXmlUrls.add(URI.create("jar:file:" + entryPath).toURL());
discoveredBeanXmlUrls.add(URI.create("jar:file:" + entryPath.replace(" ", "%20")).toURL());
} else if (isArchive(entry.getName())) {
discoverResourcesInArchive(entryPath, zipInputStream, discoveredClasses, discoveredBeanXmlUrls);
}
Expand Down Expand Up @@ -232,8 +232,8 @@ protected String getDecodedPath(URL url) {
protected String toClassName(String path) {
// Turn the file path into a fully qualified class name
return path
.substring(0, path.lastIndexOf(".class"))
.replace('\\', '.').replace('/', '.');
.substring(0, path.lastIndexOf(".class"))
.replace('\\', '.').replace('/', '.');
}

protected boolean isArchive(String name) {
Expand Down

0 comments on commit 6ef3f4d

Please sign in to comment.