dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16242
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6134: Improved ignore exception logic
------------------------------------------------------------
revno: 6134
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-02-28 19:56:37 +0100
message:
Improved ignore exception logic
modified:
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/ExceptionInterceptor.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/ExceptionInterceptor.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/ExceptionInterceptor.java 2012-01-22 04:20:13 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/ExceptionInterceptor.java 2012-02-28 18:56:37 +0000
@@ -27,6 +27,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.apache.commons.lang.StringUtils.defaultIfEmpty;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -40,8 +42,6 @@
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
-import static org.apache.commons.lang.StringUtils.defaultIfEmpty;
-
/**
* This interceptor will intercept exceptions and redirect to appropriate
* exception results / pages defined in the global-results section in the XWork
@@ -126,13 +126,37 @@
return EXCEPTION_RESULT_ACCESS_DENIED; // Access denied as nice page
}
-
- boolean ignore = ignoredExceptions.contains( e.getClass().getName() );
+
+ // -----------------------------------------------------------------
+ // Check if exception should be ignored
+ // -----------------------------------------------------------------
+
+ Throwable t = e;
+
+ boolean ignore = false;
+
+ checkIgnore : do
+ {
+ if ( ignoredExceptions.contains( t.getClass().getName() ) )
+ {
+ ignore = true;
+ break checkIgnore;
+ }
+ }
+ while ( ( t = t.getCause() ) != null );
+
+ // -----------------------------------------------------------------
+ // Log exception
+ // -----------------------------------------------------------------
if ( !ignore )
{
LOG.error( "Error while executing action", e );
}
+ else
+ {
+ LOG.info( "Ignored exception: " + e.getClass().getName() );
+ }
exceptionResultName = defaultIfEmpty( exceptionResultName, EXCEPTION_RESULT_DEFAULT );