]> WPIA git - gigi.git/blobdiff - lib/jetty/org/eclipse/jetty/util/MultiException.java
Merge "Update notes about password security"
[gigi.git] / lib / jetty / org / eclipse / jetty / util / MultiException.java
index 2e71f3c58ccc26ff9b0d671799806e980455ed41..7653ca6636385b769c4721f66f475c713aa78390 100644 (file)
@@ -1,6 +1,6 @@
 //
 //  ========================================================================
-//  Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
+//  Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
 //  ------------------------------------------------------------------------
 //  All rights reserved. This program and the accompanying materials
 //  are made available under the terms of the Eclipse Public License v1.0
@@ -18,8 +18,6 @@
 
 package org.eclipse.jetty.util;
 
-import java.io.PrintStream;
-import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -43,10 +41,16 @@ public class MultiException extends Exception
     /* ------------------------------------------------------------ */
     public void add(Throwable e)
     {
+        if (e==null)
+            throw new IllegalArgumentException();
+
         if(nested == null)
         {
+            initCause(e);
             nested = new ArrayList<>();
         }
+        else
+            addSuppressed(e);
         
         if (e instanceof MultiException)
         {
@@ -66,9 +70,8 @@ public class MultiException extends Exception
     /* ------------------------------------------------------------ */
     public List<Throwable> getThrowables()
     {
-        if(nested == null) {
+        if(nested == null)
             return Collections.emptyList();
-        }
         return nested;
     }
     
@@ -168,47 +171,4 @@ public class MultiException extends Exception
         return str.toString();
     }
 
-    /* ------------------------------------------------------------ */
-    @Override
-    public void printStackTrace()
-    {
-        super.printStackTrace();
-        if(nested != null) {
-            for(Throwable t: nested) {
-                t.printStackTrace();
-            }
-        }
-    }
-   
-
-    /* ------------------------------------------------------------------------------- */
-    /**
-     * @see java.lang.Throwable#printStackTrace(java.io.PrintStream)
-     */
-    @Override
-    public void printStackTrace(PrintStream out)
-    {
-        super.printStackTrace(out);
-        if(nested != null) {
-            for(Throwable t: nested) {
-                t.printStackTrace(out);
-            }
-        }
-    }
-
-    /* ------------------------------------------------------------------------------- */
-    /**
-     * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter)
-     */
-    @Override
-    public void printStackTrace(PrintWriter out)
-    {
-        super.printStackTrace(out);
-        if(nested != null) {
-            for(Throwable t: nested) {
-                t.printStackTrace(out);
-            }
-        }
-    }
-
 }