private static final org.apache.juli.logging.Log log=
org.apache.juli.logging.LogFactory.getLog( BaseDirContext.class );
- // -------------------------------------------------------------- Constants
-
-
// ----------------------------------------------------------- Constructors
* a requested resource can not be found in the main context.
*/
public void addResourcesJar(URL url) {
+ JarFile jarFile = null;
try {
JarURLConnection conn = (JarURLConnection) url.openConnection();
- JarFile jarFile = conn.getJarFile();
+ jarFile = conn.getJarFile();
ZipEntry entry = jarFile.getEntry("/");
WARDirContext warDirContext = new WARDirContext(jarFile,
new WARDirContext.Entry("/", entry));
warDirContext.loadEntries();
altDirContexts.add(warDirContext);
} catch (IOException ioe) {
- // TODO: Log failure
+ log.warn(sm.getString("resources.addResourcesJarFail", url), ioe);
} finally {
- // TODO: Clean up
+ if (jarFile != null) {
+ try {
+ jarFile.close();
+ } catch (IOException e) {
+ // Ignore
+ }
+ }
}
}
*/
public Name composeName(Name name, Name prefix)
throws NamingException {
- prefix = (Name) prefix.clone();
- return prefix.addAll(name);
+ Name clone = (Name) prefix.clone();
+ return clone.addAll(name);
}
warResources.notWar=Doc base must point to a WAR file
warResources.invalidWar=Invalid or unreadable WAR file : {0}
jarResources.syntax=Document base {0} must start with ''jar:'' and end with ''!/''
+resources.addResourcesJarFail=Failed to add resources jar [{0}]
resources.alreadyStarted=Resources has already been started
resources.connect=Cannot connect to document base {0}
resources.input=Cannot create input stream for resource {0}