You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/05/22 16:55:06 UTC

svn commit: r1681138 - in /tomcat/trunk/java/org/apache/catalina/util: LifecycleBase.java LocalStrings.properties

Author: markt
Date: Fri May 22 14:55:06 2015
New Revision: 1681138

URL: http://svn.apache.org/r1681138
Log:
Log errors processing LifecycleListener events and continue rather than allowing uncaught exception to propagate

Modified:
    tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java
    tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties

Modified: tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java?rev=1681138&r1=1681137&r2=1681138&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java Fri May 22 14:55:06 2015
@@ -117,7 +117,13 @@ public abstract class LifecycleBase impl
         LifecycleEvent event = new LifecycleEvent(this, type, data);
         LifecycleListener interested[] = listeners;
         for (int i = 0; i < interested.length; i++) {
-            interested[i].lifecycleEvent(event);
+            try {
+                interested[i].lifecycleEvent(event);
+            } catch (Throwable t) {
+                ExceptionUtils.handleThrowable(t);
+                log.error(sm.getString("lifecycleBase.listenerFail",
+                        type, interested[i].getClass().getName()), t);
+            }
         }
     }
 

Modified: tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties?rev=1681138&r1=1681137&r2=1681138&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties Fri May 22 14:55:06 2015
@@ -30,6 +30,7 @@ lifecycleBase.destroyFail=Failed to dest
 lifecycleBase.destroyStopFail=Calling stop() on failed component [{0}] to trigger clean-up did not complete.
 lifecycleBase.initFail=Failed to initialize component [{0}]
 lifecycleBase.invalidTransition=An invalid Lifecycle transition was attempted ([{0}]) for component [{1}] in state [{2}]
+lifecycleBase.listenerFail=Failed to processes [{0}] event for an instance of [{1}]
 lifecycleBase.setState=Setting state for [{0}] to [{1}]
 lifecycleBase.startFail=Failed to start component [{0}]
 lifecycleBase.stopFail=Failed to stop component [{0}]



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1681138 - in /tomcat/trunk/java/org/apache/catalina/util: LifecycleBase.java LocalStrings.properties

Posted by Rainer Jung <ra...@kippdata.de>.
> Feel free to revert my change  (I won't be near my laptop for a few days.). The bz issue needs a more careful look. It might end up as won't fix.  Throw during start, log during stop might work but I can't remember how this interacts with the error state.

Will do. Have a nice time far from the keyboard :)

Regards,

Rainer


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1681138 - in /tomcat/trunk/java/org/apache/catalina/util: LifecycleBase.java LocalStrings.properties

Posted by Mark Thomas <ma...@homeinbox.net>.
On 23 May 2015 09:19:15 BST, Rainer Jung <ra...@kippdata.de> wrote:
>Am 22.05.2015 um 16:55 schrieb markt@apache.org:
>> Author: markt
>> Date: Fri May 22 14:55:06 2015
>> New Revision: 1681138
>>
>> URL: http://svn.apache.org/r1681138
>> Log:
>> Log errors processing LifecycleListener events and continue rather
>than allowing uncaught exception to propagate
>>
>> Modified:
>>      tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java
>>     
>tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties
>>
>> Modified:
>tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java
>> URL:
>http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java?rev=1681138&r1=1681137&r2=1681138&view=diff
>>
>==============================================================================
>> --- tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java
>(original)
>> +++ tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java Fri
>May 22 14:55:06 2015
>> @@ -117,7 +117,13 @@ public abstract class LifecycleBase impl
>>           LifecycleEvent event = new LifecycleEvent(this, type,
>data);
>>           LifecycleListener interested[] = listeners;
>>           for (int i = 0; i < interested.length; i++) {
>> -            interested[i].lifecycleEvent(event);
>> +            try {
>> +                interested[i].lifecycleEvent(event);
>> +            } catch (Throwable t) {
>> +                ExceptionUtils.handleThrowable(t);
>> +                log.error(sm.getString("lifecycleBase.listenerFail",
>> +                        type, interested[i].getClass().getName()),
>t);
>> +            }
>>           }
>>       }
>
>Currently the unit test testWebappListenerConfigureFail() in 
>TestStandardContext fails due to the context startup with a 
>FailingLifecycleListener no longer throwing an exception.
>
>Regards,
>
>Rainer
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: dev-help@tomcat.apache.org

Feel free to revert my change  (I won't be near my laptop for a few days.). The bz issue needs a more careful look. It might end up as won't fix.  Throw during start, log during stop might work but I can't remember how this interacts with the error state.

Mark

Re: svn commit: r1681138 - in /tomcat/trunk/java/org/apache/catalina/util: LifecycleBase.java LocalStrings.properties

Posted by Rainer Jung <ra...@kippdata.de>.
Am 22.05.2015 um 16:55 schrieb markt@apache.org:
> Author: markt
> Date: Fri May 22 14:55:06 2015
> New Revision: 1681138
>
> URL: http://svn.apache.org/r1681138
> Log:
> Log errors processing LifecycleListener events and continue rather than allowing uncaught exception to propagate
>
> Modified:
>      tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java
>      tomcat/trunk/java/org/apache/catalina/util/LocalStrings.properties
>
> Modified: tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java?rev=1681138&r1=1681137&r2=1681138&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java (original)
> +++ tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java Fri May 22 14:55:06 2015
> @@ -117,7 +117,13 @@ public abstract class LifecycleBase impl
>           LifecycleEvent event = new LifecycleEvent(this, type, data);
>           LifecycleListener interested[] = listeners;
>           for (int i = 0; i < interested.length; i++) {
> -            interested[i].lifecycleEvent(event);
> +            try {
> +                interested[i].lifecycleEvent(event);
> +            } catch (Throwable t) {
> +                ExceptionUtils.handleThrowable(t);
> +                log.error(sm.getString("lifecycleBase.listenerFail",
> +                        type, interested[i].getClass().getName()), t);
> +            }
>           }
>       }

Currently the unit test testWebappListenerConfigureFail() in 
TestStandardContext fails due to the context startup with a 
FailingLifecycleListener no longer throwing an exception.

Regards,

Rainer


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org