← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2642: Made a hack work

 

------------------------------------------------------------
revno: 2642
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-01-19 15:18:22 +0100
message:
  Made a hack work
modified:
  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/resources/META-INF/dhis/beans.xml


--
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	2010-11-26 10:52:50 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/ExceptionInterceptor.java	2011-01-19 14:18:22 +0000
@@ -27,8 +27,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.io.IOException;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.commons.logging.Log;
@@ -70,6 +71,13 @@
     {
         this.showStackTrace = showStackTrace;
     }
+    
+    private List<String> ignoredExceptions = new ArrayList<String>();
+
+    public void setIgnoredExceptions( List<String> ignoredExceptions )
+    {
+        this.ignoredExceptions = ignoredExceptions;
+    }
 
     // -------------------------------------------------------------------------
     // Interface implementation
@@ -117,13 +125,10 @@
                 return EXCEPTION_RESULT_ACCESS_DENIED; // Access denied as nice page
             }
 
-            // HACK to get rid of useless stack traces when the client closes the connection in tomcat
-            if (e instanceof IOException && e.getClass().getName().equals("org.apache.catalina.connector.ClientAbortException") )
+            if ( e != null && !ignoredExceptions.contains( e.getClass().getName() ) )
             {
-                LOG.info( "Client aborted connection." );
+                LOG.error( "Error while executing action", e );
             }
-            
-            LOG.error( "Error while executing action", e );
 
             if ( exceptionResultName != null )
             {

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2011-01-17 17:03:05 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2011-01-19 14:18:22 +0000
@@ -753,6 +753,11 @@
 
 	<bean id="org.hisp.dhis.interceptor.ExceptionInterceptor" class="org.hisp.dhis.interceptor.ExceptionInterceptor">
 		<property name="showStackTrace" value="true" />
+		<property name="ignoredExceptions">
+			<list>
+				<value>org.apache.catalina.connector.ClientAbortException</value>
+			</list>
+		</property>
 	</bean>
 
 	<bean id="org.hisp.dhis.interceptor.I18nInterceptor" class="org.hisp.dhis.interceptor.I18nInterceptor">