dev@glassfish.java.net

[Fwd: [Issue 7060] [web_container] old bundled jar not removed during redeploy]

From: Dies Koper <diesk_at_fast.au.fujitsu.com>
Date: Mon, 23 Feb 2009 14:41:00 +1100

Hi Amy,

I have a question about the way you fixed the openJARs method in
WebappClassLoader for issue #7060.

It is about the if-block added to close jar file streams (see below).

                     try {
                         jarFiles[i] = new JarFile(jarRealFiles[i]);
                     } catch (IOException e) {
                         if (logger.isLoggable(Level.FINE)) {
                             logger.log(Level.FINE, "Failed to open
JAR", e);
                         }
                         if (jarFiles[i] != null) {
                             try {
                                 jarFiles[i].close();
                             } catch (Throwable t) {
                                 // Ignore
                             }
                         }
                         return false;
                    }

If an exception would occur in the try block, jarFiles[i] will be null,
so the extra code would not be executed.
However, the streams opened to the point when the exception occurred are
not closed. Shouldn't it be doing the following?

                     try {
                         jarFiles[i] = new JarFile(jarRealFiles[i]);
                     } catch (IOException e) {
                         if (logger.isLoggable(Level.FINE)) {
                             logger.log(Level.FINE, "Failed to open
JAR", e);
                         }
                         for (int j = 0; j < i; j++) {
                             try {
                                 jarFiles[j].close();
                             } catch (Throwable t) {
                                 // Ignore
                             }
                         }
                         return false;
                    }

Thanks,
Dies


-------- Original Message --------
Subject: [Issue 7060] [web_container] old bundled jar not removed
during redeploy
Date: Tue, 27 Jan 2009 23:51:01 +0000
From: <amyroh_at_dev.java.net>
Reply-To: issues_at_glassfish.dev.java.net
To: <issues_at_glassfish.dev.java.net>

https://glassfish.dev.java.net/issues/show_bug.cgi?id=7060



User amyroh changed the following:

                 What |Old value |New value
================================================================================
                   Status|NEW |RESOLVED
--------------------------------------------------------------------------------
               Resolution| |FIXED
--------------------------------------------------------------------------------




------- Additional comments from amyroh_at_dev.java.net Tue Jan 27 23:50:59
+0000 2009 -------
Author: amyroh
Date: 2009-01-27 04:50:10+0000
New Revision: 24465

Modified:

trunk/v3/web/war-util/src/main/java/org/glassfish/web/loader/WebappClassLoader.java
 
trunk/v3/web/web-core/src/main/java/org/apache/catalina/startup/TldConfig.java

Author: amyroh
Date: 2009-01-27 23:49:36+0000
New Revision: 24488

Modified:

trunk/v3/core/bootstrap/src/main/java/com/sun/enterprise/glassfish/bootstrap/Rejar.java