/** * Expands the URL into the temporary folder if the URL points to a resource inside of a jar * file * * @param result * @return URL to the expanded result or null if an error occurred */ private URL expandIfNecessary(URL result) { if (result == null || !"jar".equals(result.getProtocol())) { return result; } File tmpFolder = getLibCacheFolderForModule(module); return OpenmrsClassLoader.expandURL(result, tmpFolder); }
/** * @see java.net.URLClassLoader#findResource(java.lang.String) */ @Override public URL findResource(final String name) { log.trace("finding resource: {}", name); URL result; for (ModuleClassLoader classLoader : ModuleFactory.getModuleClassLoaders()) { result = classLoader.findResource(name); if (result != null) { return result; } } // look for the resource in the parent result = super.findResource(name); // expand the jar url if necessary if (result != null && "jar".equals(result.getProtocol()) && name.contains("openmrs")) { result = expandURL(result, getLibCacheFolder()); } return result; }