ResourceUtils.extractArchiveURL properly deals with top-level war URLs

Issue: SPR-15556
This commit is contained in:
Juergen Hoeller 2017-05-17 14:22:43 +02:00
parent e835f4d025
commit 7b3f5fd855
1 changed files with 4 additions and 3 deletions

View File

@ -341,8 +341,11 @@ public abstract class ResourceUtils {
int endIndex = urlFile.indexOf(WAR_URL_SEPARATOR);
if (endIndex != -1) {
// Tomcat's "jar:war:file:...mywar.war*/WEB-INF/lib/myjar.jar!/myentry.txt"
// Tomcat's "war:file:...mywar.war*/WEB-INF/lib/myjar.jar!/myentry.txt"
String warFile = urlFile.substring(0, endIndex);
if (URL_PROTOCOL_WAR.equals(jarUrl.getProtocol())) {
return new URL(warFile);
}
int startIndex = warFile.indexOf(WAR_URL_PREFIX);
if (startIndex != -1) {
return new URL(warFile.substring(startIndex + WAR_URL_PREFIX.length()));
@ -356,8 +359,6 @@ public abstract class ResourceUtils {
/**
* Create a URI instance for the given URL,
* replacing spaces with "%20" URI encoding first.
* <p>Furthermore, this method works on JDK 1.4 as well,
* in contrast to the {@code URL.toURI()} method.
* @param url the URL to convert into a URI instance
* @return the URI instance
* @throws URISyntaxException if the URL wasn't a valid URI