dgraham 2003/07/07 17:39:21
Modified: src/share/org/apache/struts/action ActionServlet.java
Log:
Reverse if logic to continue to next loop iteration in destroyModules()
to prevent a large block of code being nested in the if.
Revision Changes Path
1.160 +30 -23
jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java
Index: ActionServlet.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -r1.159 -r1.160
--- ActionServlet.java 4 Jul 2003 18:38:37 -0000 1.159
+++ ActionServlet.java 8 Jul 2003 00:39:21 -0000 1.160
@@ -528,28 +528,35 @@
while (keys.hasNext()) {
String name = (String) keys.next();
Object value = getServletContext().getAttribute(name);
- if (value instanceof ModuleConfig) {
- ModuleConfig config = (ModuleConfig) value;
- try {
- getRequestProcessor(config).destroy();
- } catch (ServletException e) {
- log.error(e);
- }
-
- getServletContext().removeAttribute(name);
+
+ if (!(value instanceof ModuleConfig)) {
+ continue;
+ }
+
+ ModuleConfig config = (ModuleConfig) value;
+ try {
+ getRequestProcessor(config).destroy();
+
+ } catch (ServletException e) {
+ log.error(e);
+ }
- PlugIn plugIns[] =
- (PlugIn[]) getServletContext().getAttribute(
- Globals.PLUG_INS_KEY + config.getPrefix());
- if (plugIns != null) {
- for (int i = 0; i < plugIns.length; i++) {
- int j = plugIns.length - (i + 1);
- plugIns[j].destroy();
- }
- getServletContext().removeAttribute
- (Globals.PLUG_INS_KEY + config.getPrefix());
+ getServletContext().removeAttribute(name);
+
+ PlugIn plugIns[] =
+ (PlugIn[]) getServletContext().getAttribute(
+ Globals.PLUG_INS_KEY + config.getPrefix());
+
+ if (plugIns != null) {
+ for (int i = 0; i < plugIns.length; i++) {
+ int j = plugIns.length - (i + 1);
+ plugIns[j].destroy();
}
+
+ getServletContext().removeAttribute(
+ Globals.PLUG_INS_KEY + config.getPrefix());
}
+
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]