[teiid-commits] teiid SVN: r949 - in trunk: common-core/src/main/java/com/metamatrix/api/exception and 4 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Fri May 15 12:40:17 EDT 2009


Author: shawkins
Date: 2009-05-15 12:40:17 -0400 (Fri, 15 May 2009)
New Revision: 949

Modified:
   trunk/client/src/main/java/com/metamatrix/client/ExceptionUtil.java
   trunk/common-core/src/main/java/com/metamatrix/api/exception/ExceptionHolder.java
   trunk/common-core/src/main/java/com/metamatrix/api/exception/MetaMatrixException.java
   trunk/common-core/src/main/java/com/metamatrix/core/MetaMatrixRuntimeException.java
   trunk/console/src/main/java/com/metamatrix/console/util/ExceptionUtility.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
   trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/ServerWorkItem.java
Log:
TEIID-602 checks to prevent child exceptions from reporting their cause as themselves (which shouldn't be happening, but may be coming from an inappropriate override by a third-party).  this doesn't prevent more exotic recursive scenarios, but those typically don't happen.  

Modified: trunk/client/src/main/java/com/metamatrix/client/ExceptionUtil.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/client/ExceptionUtil.java	2009-05-15 15:37:25 UTC (rev 948)
+++ trunk/client/src/main/java/com/metamatrix/client/ExceptionUtil.java	2009-05-15 16:40:17 UTC (rev 949)
@@ -39,6 +39,9 @@
             if (cls.isAssignableFrom(ex.getClass())) {
                 return (T)ex;
             } 
+            if (ex.getCause() == ex) {
+            	break;
+            }
             ex = ex.getCause();
         }
         return null;

Modified: trunk/common-core/src/main/java/com/metamatrix/api/exception/ExceptionHolder.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/api/exception/ExceptionHolder.java	2009-05-15 15:37:25 UTC (rev 948)
+++ trunk/common-core/src/main/java/com/metamatrix/api/exception/ExceptionHolder.java	2009-05-15 16:40:17 UTC (rev 949)
@@ -110,7 +110,7 @@
 		out.writeObject(exception.getStackTrace());
 		
 		// specify that this cause is nested exception; not top level
-		if (this.exception.getCause() != null) {
+		if (this.exception.getCause() != null && this.exception.getCause() != this.exception) {
 			out.writeObject(new ExceptionHolder(this.exception.getCause(), true));
 		}
 		else {

Modified: trunk/common-core/src/main/java/com/metamatrix/api/exception/MetaMatrixException.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/api/exception/MetaMatrixException.java	2009-05-15 15:37:25 UTC (rev 948)
+++ trunk/common-core/src/main/java/com/metamatrix/api/exception/MetaMatrixException.java	2009-05-15 16:40:17 UTC (rev 949)
@@ -22,9 +22,6 @@
 
 package com.metamatrix.api.exception;
 
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
 import java.util.Iterator;
 
 import com.metamatrix.core.MetaMatrixCoreException;

Modified: trunk/common-core/src/main/java/com/metamatrix/core/MetaMatrixRuntimeException.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/MetaMatrixRuntimeException.java	2009-05-15 15:37:25 UTC (rev 948)
+++ trunk/common-core/src/main/java/com/metamatrix/core/MetaMatrixRuntimeException.java	2009-05-15 16:40:17 UTC (rev 949)
@@ -166,10 +166,7 @@
      * @return The linked exception
      */
     public Throwable getChild() {
-        if (this.getCause() != this) {
-        	return this.getCause();
-        }
-        return null;
+        return this.getCause();
     }
     
     /**

Modified: trunk/console/src/main/java/com/metamatrix/console/util/ExceptionUtility.java
===================================================================
--- trunk/console/src/main/java/com/metamatrix/console/util/ExceptionUtility.java	2009-05-15 15:37:25 UTC (rev 948)
+++ trunk/console/src/main/java/com/metamatrix/console/util/ExceptionUtility.java	2009-05-15 16:40:17 UTC (rev 949)
@@ -134,7 +134,7 @@
             }
         }
 
-        showMessage(text, comment, thr.getCause(), root);
+        showMessage(text, comment, thr.getCause() != thr?thr.getCause():null, root);
     }
 
     public static void showMessage(String text, Throwable t) {

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java	2009-05-15 15:37:25 UTC (rev 948)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java	2009-05-15 16:40:17 UTC (rev 949)
@@ -231,7 +231,7 @@
                 //log the processing errors as warnings only
                 if(e instanceof MetaMatrixProcessingException) {                          
                 	Throwable cause = e;
-                	while (cause.getCause() != null) {
+                	while (cause.getCause() != null && cause.getCause() != cause) {
                 		cause = e.getCause();
                 	}
                 	StackTraceElement elem = cause.getStackTrace()[0];

Modified: trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/ServerWorkItem.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/ServerWorkItem.java	2009-05-15 15:37:25 UTC (rev 948)
+++ trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/ServerWorkItem.java	2009-05-15 16:40:17 UTC (rev 949)
@@ -169,7 +169,7 @@
 	
 	private void logProcessingException(Throwable e, String context) {
 		Throwable cause = e;
-		while (cause.getCause() != null) {
+		while (cause.getCause() != null && cause != cause.getCause()) {
 			cause = e.getCause();
 		}
 		StackTraceElement elem = cause.getStackTrace()[0];




More information about the teiid-commits mailing list