//
// ========================================================================
-// 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
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;
/* ------------------------------------------------------------ */
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)
{
/* ------------------------------------------------------------ */
public List<Throwable> getThrowables()
{
- if(nested == null) {
+ if(nested == null)
return Collections.emptyList();
- }
return nested;
}
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);
- }
- }
- }
-
}