Changeset 5330 for branches/release-0.15.x/pustefix-core/src/main/java/de/schlund/pfixxml/resources/ModuleResourceProvider.java
- Timestamp:
- 09/01/10 10:24:14 (21 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/release-0.15.x/pustefix-core/src/main/java/de/schlund/pfixxml/resources/ModuleResourceProvider.java
r5014 r5330 60 60 ModuleDescriptor desc = ModuleInfo.getInstance().getModuleDescriptor(module); 61 61 if (desc != null) { 62 URL url = getJarURL(desc.getURL());62 URL url = desc.getURL().getProtocol().equals("jar") ? getJarURL(desc.getURL()) : getFileUrl(desc.getURL()); 63 63 // Ensure module resources are read from classpath in production environment 64 64 boolean checkLive = !BuildTimeProperties.getProperties().getProperty("mode").equals("prod"); … … 89 89 } 90 90 91 private static URL getFileUrl(URL url) { 92 if (!url.getProtocol().equals("file")) 93 throw new PustefixRuntimeException("Invalid protocol: " + url); 94 String urlStr = url.toString(); 95 int ind = urlStr.indexOf("META-INF"); 96 if (ind > -1) { 97 urlStr = urlStr.substring(0, ind); 98 } else 99 throw new PustefixRuntimeException("Unexpected module descriptor URL: " + url); 100 try { 101 return new URL(urlStr); 102 } catch (MalformedURLException x) { 103 throw new PustefixRuntimeException("Invalid module URL: " + urlStr); 104 } 105 } 106 91 107 private static URL getJarURL(URL url) { 92 108 if(!url.getProtocol().equals("jar")) throw new PustefixRuntimeException("Invalid protocol: "+url);
