Issue #628 resolve by checking for existing jar: prefix on uri

Signed-off-by: Robin Bygrave <robin.bygrave@gmail.com>
This commit is contained in:
Robin Bygrave 2016-06-09 20:12:32 +12:00
parent d458d41632
commit 1494906b9d
1 changed files with 14 additions and 3 deletions

View File

@ -402,7 +402,8 @@ public class MetaInfConfiguration extends AbstractConfiguration
{
HashSet<URL> tlds = new HashSet<URL>();
URL url = new URL("jar:"+uri+"!/");
String jarUri = uriJarPrefix(uri);
URL url = new URL(jarUri);
JarURLConnection jarConn = (JarURLConnection) url.openConnection();
jarConn.setUseCaches(Resource.getDefaultUseCaches());
JarFile jarFile = jarConn.getJarFile();
@ -413,11 +414,21 @@ public class MetaInfConfiguration extends AbstractConfiguration
String name = e.getName();
if (name.startsWith("META-INF") && name.endsWith(".tld"))
{
tlds.add(new URL("jar:"+uri+"!/"+name));
tlds.add(new URL(jarUri + name));
}
}
if (!Resource.getDefaultUseCaches())
jarFile.close();
return tlds;
}
private String uriJarPrefix(URI uri) {
String uriString = uri.toString();
if (uriString.startsWith("jar:")) {
return uriString + "!/";
} else {
return "jar:"+uriString+"!/";
}
}
}