Author: markt
Date: Wed Feb 16 14:18:12 2011
New Revision: 1071262
URL: http://svn.apache.org/viewvc?rev=1071262&view=rev
Log:
Move test outside the loop
Modified:
tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1071262&r1=1071261&r2=1071262&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Wed Feb 16
14:18:12 2011
@@ -5817,30 +5817,30 @@ public class StandardContext extends Con
if ((instances != null) && (instances.length > 0)) {
- ServletRequestEvent event =
- new ServletRequestEvent(getServletContext(), request);
-
- for (int i = 0; i < instances.length; i++) {
- if (instances[i] == null)
- continue;
- if (!(instances[i] instanceof ServletRequestListener))
- continue;
- ServletRequestListener listener =
- (ServletRequestListener) instances[i];
+ // Don't fire the listener for async requests
+ if (!DispatcherType.ASYNC.equals(request.getDispatcherType())) {
- try {
- // Don't fire the listener for async requests
- if (!DispatcherType.ASYNC.equals(
- request.getDispatcherType())) {
+ ServletRequestEvent event =
+ new ServletRequestEvent(getServletContext(), request);
+
+ for (int i = 0; i < instances.length; i++) {
+ if (instances[i] == null)
+ continue;
+ if (!(instances[i] instanceof ServletRequestListener))
+ continue;
+ ServletRequestListener listener =
+ (ServletRequestListener) instances[i];
+
+ try {
listener.requestInitialized(event);
+ } catch (Throwable t) {
+ ExceptionUtils.handleThrowable(t);
+ getLogger().error(sm.getString(
+ "standardContext.requestListener.requestInit",
+ instances[i].getClass().getName()), t);
+
request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t);
+ return false;
}
- } catch (Throwable t) {
- ExceptionUtils.handleThrowable(t);
- getLogger().error(sm.getString(
- "standardContext.requestListener.requestInit",
- instances[i].getClass().getName()), t);
- request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t);
- return false;
}
}
}
@@ -5854,31 +5854,31 @@ public class StandardContext extends Con
if ((instances != null) && (instances.length > 0)) {
- ServletRequestEvent event =
+ // Don't fire the listener for async requests
+ if (!DispatcherType.ASYNC.equals(request.getDispatcherType())) {
+
+ ServletRequestEvent event =
new ServletRequestEvent(getServletContext(), request);
- for (int i = 0; i < instances.length; i++) {
- int j = (instances.length -1) -i;
- if (instances[j] == null)
- continue;
- if (!(instances[j] instanceof ServletRequestListener))
- continue;
- ServletRequestListener listener =
- (ServletRequestListener) instances[j];
-
- try {
- // Don't fire the listener for async requests
- if (!DispatcherType.ASYNC.equals(
- request.getDispatcherType())) {
+ for (int i = 0; i < instances.length; i++) {
+ int j = (instances.length -1) -i;
+ if (instances[j] == null)
+ continue;
+ if (!(instances[j] instanceof ServletRequestListener))
+ continue;
+ ServletRequestListener listener =
+ (ServletRequestListener) instances[j];
+
+ try {
listener.requestDestroyed(event);
+ } catch (Throwable t) {
+ ExceptionUtils.handleThrowable(t);
+ getLogger().error(sm.getString(
+ "standardContext.requestListener.requestInit",
+ instances[j].getClass().getName()), t);
+
request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t);
+ return false;
}
- } catch (Throwable t) {
- ExceptionUtils.handleThrowable(t);
- getLogger().error(sm.getString(
- "standardContext.requestListener.requestInit",
- instances[j].getClass().getName()), t);
- request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t);
- return false;
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]