You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/04/03 20:22:31 UTC

svn commit: r1088364 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/DiscoveryException.java

Author: simonetripodi
Date: Sun Apr  3 18:22:31 2011
New Revision: 1088364

URL: http://svn.apache.org/viewvc?rev=1088364&view=rev
Log:
since the required JDK is 5, DiscoveryException uses the 2 args ctor

Modified:
    commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/DiscoveryException.java

Modified: commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/DiscoveryException.java
URL: http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/DiscoveryException.java?rev=1088364&r1=1088363&r2=1088364&view=diff
==============================================================================
--- commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/DiscoveryException.java (original)
+++ commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/DiscoveryException.java Sun Apr  3 18:22:31 2011
@@ -57,7 +57,7 @@ public class DiscoveryException extends 
      * @param cause The underlying cause
      */
     public DiscoveryException(Throwable cause) {
-        this((cause == null) ? null : cause.toString(), cause);
+        super(cause);
     }
 
     /**
@@ -67,38 +67,6 @@ public class DiscoveryException extends 
      * @param cause The underlying cause
      */
     public DiscoveryException(String message, Throwable cause) {
-        super(message);
-        this.cause = cause; // Two-argument version requires JDK 1.4 or later
-    }
-
-    /**
-     * The underlying cause of this exception.
-     */
-    protected Throwable cause = null;
-
-    /**
-     * Return the underlying cause of this exception (if any).
-     */
-    public Throwable getCause() {
-        return this.cause;
-    }
-
-    public String toString() {
-        String ls = System.getProperty("line.separator");
-        String str = super.toString();
-        if (cause != null) {
-            str = str + ls +
-                  "*****" + ls +
-                  stackToString(cause);
-        }
-        return str;
-    }
-
-    private static String stackToString(Throwable e){
-      java.io.StringWriter sw= new java.io.StringWriter(1024); 
-      java.io.PrintWriter pw= new java.io.PrintWriter(sw); 
-      e.printStackTrace(pw);
-      pw.close();
-      return sw.toString();
+        super(message, cause);
     }
 }