[teiid-commits] teiid SVN: r2884 - branches/7.1.x/test-integration/db/src/main/java/org/teiid/test/util.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Sun Jan 30 09:53:25 EST 2011


Author: vhalbert at redhat.com
Date: 2011-01-30 09:53:25 -0500 (Sun, 30 Jan 2011)
New Revision: 2884

Modified:
   branches/7.1.x/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java
Log:
SOA-2853 traversing to the inner most chained exception to use in reporting

Modified: branches/7.1.x/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java
===================================================================
--- branches/7.1.x/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java	2011-01-29 04:41:29 UTC (rev 2883)
+++ branches/7.1.x/test-integration/db/src/main/java/org/teiid/test/util/TestResultSetUtil.java	2011-01-30 14:53:25 UTC (rev 2884)
@@ -39,8 +39,10 @@
 import java.util.Collections;
 import java.util.List;
 
+import org.teiid.jdbc.TeiidSQLException;
 
 
+
 /** 
  * TestResultSetUtil was built in order to override the {@link #printThrowable(Throwable, PrintStream)} method
  * in order to call  out.print  instead of out.println
@@ -73,8 +75,22 @@
     
     public static void printThrowable(Throwable t, String sql, PrintStream out) {
       out.println(sql);
+      
+      Throwable answer = t;
+      if (t instanceof TeiidSQLException) {
+    	  TeiidSQLException sqle = (TeiidSQLException) t;
+    	  SQLException se = sqle.getNextException();
+    	  if (se != null) {
+    		  SQLException s = null;
+	    	  while( (s = se.getNextException()) != null) {
+	    		  se = s;
+	    	  }
+	    	  
+	    	  answer = se;
+    	  } 
+      }
         
-      out.print(t.getClass().getName() + " : " + t.getMessage()); //$NON-NLS-1$
+      out.print(t.getClass().getName() + " : " + answer.getMessage()); //$NON-NLS-1$
         	
     }
     



More information about the teiid-commits mailing list