org.eclipse.jetty.util.MultiException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of testatoo-container-jetty-full Show documentation
Show all versions of testatoo-container-jetty-full Show documentation
Testatoo Jetty Container with JSP support
// ========================================================================
// Copyright (c) 1999-2009 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
// and Apache License v2.0 which accompanies this distribution.
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.util;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.List;
/* ------------------------------------------------------------ */
/** Wraps multiple exceptions.
*
* Allows multiple exceptions to be thrown as a single exception.
*
*
*/
public class MultiException extends Exception
{
private Object nested;
/* ------------------------------------------------------------ */
public MultiException()
{
super("Multiple exceptions");
}
/* ------------------------------------------------------------ */
public void add(Throwable e)
{
if (e instanceof MultiException)
{
MultiException me = (MultiException)e;
for (int i=0;i0)
throw this;
}
/* ------------------------------------------------------------ */
@Override
public String toString()
{
if (LazyList.size(nested)>0)
return MultiException.class.getSimpleName()+
LazyList.getList(nested);
return MultiException.class.getSimpleName()+"[]";
}
/* ------------------------------------------------------------ */
@Override
public void printStackTrace()
{
super.printStackTrace();
for (int i=0;i