Remove exceptions chain from eclipse.
authorMathieu Baudier <mbaudier@argeo.org>
Tue, 18 Feb 2020 10:34:13 +0000 (11:34 +0100)
committerMathieu Baudier <mbaudier@argeo.org>
Tue, 18 Feb 2020 10:34:13 +0000 (11:34 +0100)
org.argeo.cms/src/org/argeo/cms/integration/CmsExceptionsChain.java
org.argeo.util/src/org/argeo/util/ExceptionsChain.java [deleted file]

index 12ac96da2ead656d14388a9bd8a5feb8a427d691..bbac176a5fd7c916b8ea686e5c06b342197ce0f4 100644 (file)
@@ -2,27 +2,30 @@ package org.argeo.cms.integration;
 
 import java.io.IOException;
 import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
 
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.argeo.util.ExceptionsChain;
 
 import com.fasterxml.jackson.core.JsonGenerator;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 
 /** Serialisable wrapper of a {@link Throwable}. */
-public class CmsExceptionsChain extends ExceptionsChain {
+public class CmsExceptionsChain {
        public final static Log log = LogFactory.getLog(CmsExceptionsChain.class);
 
+       private List<SystemException> exceptions = new ArrayList<>();
+
        public CmsExceptionsChain() {
                super();
        }
 
        public CmsExceptionsChain(Throwable exception) {
-               super(exception);
+               writeException(exception);
                if (log.isDebugEnabled())
                        log.error("Exception chain", exception);
        }
@@ -54,6 +57,77 @@ public class CmsExceptionsChain extends ExceptionsChain {
                }
        }
 
+       /** recursive */
+       protected void writeException(Throwable exception) {
+               SystemException systemException = new SystemException(exception);
+               exceptions.add(systemException);
+               Throwable cause = exception.getCause();
+               if (cause != null)
+                       writeException(cause);
+       }
+
+       public List<SystemException> getExceptions() {
+               return exceptions;
+       }
+
+       public void setExceptions(List<SystemException> exceptions) {
+               this.exceptions = exceptions;
+       }
+
+       /** An exception in the chain. */
+       public static class SystemException {
+               private String type;
+               private String message;
+               private List<String> stackTrace;
+
+               public SystemException() {
+               }
+
+               public SystemException(Throwable exception) {
+                       this.type = exception.getClass().getName();
+                       this.message = exception.getMessage();
+                       this.stackTrace = new ArrayList<>();
+                       StackTraceElement[] elems = exception.getStackTrace();
+                       for (int i = 0; i < elems.length; i++)
+                               stackTrace.add("at " + elems[i].toString());
+               }
+
+               public String getType() {
+                       return type;
+               }
+
+               public void setType(String type) {
+                       this.type = type;
+               }
+
+               public String getMessage() {
+                       return message;
+               }
+
+               public void setMessage(String message) {
+                       this.message = message;
+               }
+
+               public List<String> getStackTrace() {
+                       return stackTrace;
+               }
+
+               public void setStackTrace(List<String> stackTrace) {
+                       this.stackTrace = stackTrace;
+               }
+
+               @Override
+               public String toString() {
+                       return "System exception: " + type + ", " + message + ", " + stackTrace;
+               }
+
+       }
+
+       @Override
+       public String toString() {
+               return exceptions.toString();
+       }
+
 //     public static void main(String[] args) throws Exception {
 //             try {
 //                     try {
diff --git a/org.argeo.util/src/org/argeo/util/ExceptionsChain.java b/org.argeo.util/src/org/argeo/util/ExceptionsChain.java
deleted file mode 100644 (file)
index 773a1b7..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.argeo.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/** Serialisable wrapper of a {@link Throwable}. */
-public class ExceptionsChain {
-       private List<SystemException> exceptions = new ArrayList<>();
-
-       public ExceptionsChain() {
-       }
-
-       public ExceptionsChain(Throwable exception) {
-               writeException(exception);
-       }
-
-       /** recursive */
-       protected void writeException(Throwable exception) {
-               SystemException systemException = new SystemException(exception);
-               exceptions.add(systemException);
-               Throwable cause = exception.getCause();
-               if (cause != null)
-                       writeException(cause);
-       }
-
-       public List<SystemException> getExceptions() {
-               return exceptions;
-       }
-
-       public void setExceptions(List<SystemException> exceptions) {
-               this.exceptions = exceptions;
-       }
-
-       /** An exception in the chain. */
-       public static class SystemException {
-               private String type;
-               private String message;
-               private List<String> stackTrace;
-
-               public SystemException() {
-               }
-
-               public SystemException(Throwable exception) {
-                       this.type = exception.getClass().getName();
-                       this.message = exception.getMessage();
-                       this.stackTrace = new ArrayList<>();
-                       StackTraceElement[] elems = exception.getStackTrace();
-                       for (int i = 0; i < elems.length; i++)
-                               stackTrace.add("at " + elems[i].toString());
-               }
-
-               public String getType() {
-                       return type;
-               }
-
-               public void setType(String type) {
-                       this.type = type;
-               }
-
-               public String getMessage() {
-                       return message;
-               }
-
-               public void setMessage(String message) {
-                       this.message = message;
-               }
-
-               public List<String> getStackTrace() {
-                       return stackTrace;
-               }
-
-               public void setStackTrace(List<String> stackTrace) {
-                       this.stackTrace = stackTrace;
-               }
-
-               @Override
-               public String toString() {
-                       return "System exception: " + type + ", " + message + ", " + stackTrace;
-               }
-
-       }
-
-       @Override
-       public String toString() {
-               return exceptions.toString();
-       }
-}