tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1005108 - in /tuscany/sca-java-1.x/branches/sca-java-1.6.1: itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/ itest/jms-nonscaclient-exceptions/src/test/java/org/apache/tuscany/sca/binding/jms/ ...
Date Wed, 06 Oct 2010 16:24:19 GMT
Author: antelder
Date: Wed Oct  6 16:24:19 2010
New Revision: 1005108

URL: http://svn.apache.org/viewvc?rev=1005108&view=rev
Log:
Merge TUSCANY-3698 fix from 1.x trunk to 1.6.1 branch. Have tested with a full build which
wen through fine, jms samples run and the jms webapp one works ok in tomcat

Modified:
    tuscany/sca-java-1.x/branches/sca-java-1.6.1/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java
    tuscany/sca-java-1.x/branches/sca-java-1.6.1/itest/jms-nonscaclient-exceptions/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java
    tuscany/sca-java-1.x/branches/sca-java-1.6.1/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java
    tuscany/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java

Modified: tuscany/sca-java-1.x/branches/sca-java-1.6.1/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/branches/sca-java-1.6.1/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java?rev=1005108&r1=1005107&r2=1005108&view=diff
==============================================================================
--- tuscany/sca-java-1.x/branches/sca-java-1.6.1/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java
(original)
+++ tuscany/sca-java-1.x/branches/sca-java-1.6.1/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java
Wed Oct  6 16:24:19 2010
@@ -103,7 +103,7 @@ public class HelloWorldReferenceImpl imp
         try {
             helloWorldServiceDontWrapSingle.throwUnChecked(person);
         } catch (Exception e) {
-            returnString += " " + e.getCause().getMessage();
+            returnString += " " + (e.getCause().getMessage().startsWith("Message = java.lang.RuntimeException:
bla") ? "java.lang.RuntimeException: bla" : e.getCause().getMessage());
         }           
         
         return returnString;

Modified: tuscany/sca-java-1.x/branches/sca-java-1.6.1/itest/jms-nonscaclient-exceptions/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/branches/sca-java-1.6.1/itest/jms-nonscaclient-exceptions/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java?rev=1005108&r1=1005107&r2=1005108&view=diff
==============================================================================
--- tuscany/sca-java-1.x/branches/sca-java-1.6.1/itest/jms-nonscaclient-exceptions/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java
(original)
+++ tuscany/sca-java-1.x/branches/sca-java-1.6.1/itest/jms-nonscaclient-exceptions/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java
Wed Oct  6 16:24:19 2010
@@ -104,7 +104,7 @@ public class ExceptionsTestCase {
         Object o = ((ObjectMessage)m).getObject();
         assertTrue(o instanceof RuntimeException);
         assertTrue("java.lang.RuntimeException".equals(o.getClass().getName()));
-        assertEquals("java.lang.RuntimeException: bla", ((RuntimeException)o).getMessage());
+        assertTrue(((RuntimeException)o).getMessage().startsWith("Message = java.lang.RuntimeException:
bla"));
     }
 
     @Test
@@ -150,7 +150,7 @@ public class ExceptionsTestCase {
         Object o = ((ObjectMessage)m).getObject();
         assertTrue(o instanceof RuntimeException);
         assertTrue("java.lang.RuntimeException".equals(o.getClass().getName()));
-        assertEquals("java.lang.RuntimeException: bla", ((RuntimeException)o).getMessage());
+        assertTrue(((RuntimeException)o).getMessage().startsWith("Message = java.lang.RuntimeException:
bla"));
     }
 
     @After

Modified: tuscany/sca-java-1.x/branches/sca-java-1.6.1/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/branches/sca-java-1.6.1/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java?rev=1005108&r1=1005107&r2=1005108&view=diff
==============================================================================
--- tuscany/sca-java-1.x/branches/sca-java-1.6.1/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java
(original)
+++ tuscany/sca-java-1.x/branches/sca-java-1.6.1/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java
Wed Oct  6 16:24:19 2010
@@ -19,7 +19,7 @@
 package org.apache.tuscany.sca.binding.jms;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import org.apache.tuscany.sca.host.embedded.SCADomain;
@@ -96,7 +96,7 @@ public class ExceptionsTestCase {
             service.throwUnChecked();
             fail();
         } catch (Exception e) {
-            assertEquals("java.lang.RuntimeException: bla", e.getCause().getMessage());
+            assertTrue(e.getCause().getMessage().startsWith("Message = java.lang.RuntimeException:
bla"));
         }
     }
 

Modified: tuscany/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java?rev=1005108&r1=1005107&r2=1005108&view=diff
==============================================================================
--- tuscany/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java
(original)
+++ tuscany/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java
Wed Oct  6 16:24:19 2010
@@ -19,6 +19,8 @@
 package org.apache.tuscany.sca.binding.jms.provider;
 
 import java.lang.reflect.InvocationTargetException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.util.logging.Logger;
 
 import javax.jms.JMSException;
@@ -112,15 +114,39 @@ public abstract class AbstractMessagePro
             return null;
         }
         try {
-
             ObjectMessage message = session.createObjectMessage();
-            String causeMsg;
-            if (o instanceof RuntimeException) {
-                message.setObject(new RuntimeException(o.getMessage()));
-            } else {
-                // for a checked exception return the checked exception
+
+            if (o instanceof RuntimeException || o instanceof Error) {
+                int recursionKlugeDetector = 20;
+                Throwable rootCause = o;
+                Throwable deepRootCause = rootCause.getCause();
+                do {
+                    if (rootCause == deepRootCause) {
+                        break;
+                    } else if (deepRootCause != null) {
+                        rootCause = deepRootCause;
+                    }
+
+                    if (recursionKlugeDetector-- <= 0) {
+                        break;
+                    }
+                } while (deepRootCause != null);
+
+				final StringWriter sw = new StringWriter();
+				final PrintWriter pw = new PrintWriter(sw);
+				pw.print("Message = " + o.getMessage());
+				StackTraceElement[] stackElements = o.getStackTrace();
+				for (int i = 0; i < stackElements.length; i++) {
+					pw.print("\t>> \t at ");
+					pw.println(stackElements[i].toString());
+				}
+				pw.flush();
+
+				message.setObject(new RuntimeException( sw.toString() ));
+            }else{
                 message.setObject(o);
             }
+			
             message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
             return message;
 



Mime
View raw message