You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by db...@apache.org on 2011/11/22 18:47:13 UTC

svn commit: r1205106 - /geronimo/specs/trunk/geronimo-ejb_3.1_spec-alt/src/main/java/javax/ejb/EJBException.java

Author: dblevins
Date: Tue Nov 22 17:47:13 2011
New Revision: 1205106

URL: http://svn.apache.org/viewvc?rev=1205106&view=rev
Log:
Since this version of EJBException effectively holds two causes (getCause() and the legacy getCausedByException())
updated getCause(), getMessage(), and printStackTrace() methods to be sensitive of when the two causes are the same.

Modified:
    geronimo/specs/trunk/geronimo-ejb_3.1_spec-alt/src/main/java/javax/ejb/EJBException.java

Modified: geronimo/specs/trunk/geronimo-ejb_3.1_spec-alt/src/main/java/javax/ejb/EJBException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-ejb_3.1_spec-alt/src/main/java/javax/ejb/EJBException.java?rev=1205106&r1=1205105&r2=1205106&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-ejb_3.1_spec-alt/src/main/java/javax/ejb/EJBException.java (original)
+++ geronimo/specs/trunk/geronimo-ejb_3.1_spec-alt/src/main/java/javax/ejb/EJBException.java Tue Nov 22 17:47:13 2011
@@ -56,9 +56,14 @@ public class EJBException extends Runtim
         return causeException;
     }
 
+    @Override
+    public Throwable getCause() {
+        return super.getCause() != null? super.getCause(): getCausedByException();
+    }
+
     public String getMessage() {
 
-        if (causeException == null) return super.getMessage();
+        if (causeException == null || causeException == super.getCause()) return super.getMessage();
 
         StringBuilder sb = new StringBuilder();
 
@@ -74,7 +79,7 @@ public class EJBException extends Runtim
     }
 
     public void printStackTrace(PrintStream ps) {
-        if (causeException == null) {
+        if (causeException == null || causeException == super.getCause()) {
             super.printStackTrace(ps);
         } else synchronized (ps) {
             ps.println(this);
@@ -88,7 +93,7 @@ public class EJBException extends Runtim
     }
 
     public void printStackTrace(PrintWriter pw) {
-        if (causeException == null) {
+        if (causeException == null || causeException == super.getCause()) {
             super.printStackTrace(pw);
         } else synchronized (pw) {
             pw.println(this);