Package org.glassfish.hk2.api
Class MultiException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.glassfish.hk2.api.HK2RuntimeException
-
- org.glassfish.hk2.api.MultiException
-
- All Implemented Interfaces:
java.io.Serializable
public class MultiException extends HK2RuntimeException
This exception can contain multiple other exceptions. However, it will also have the causal chain of the first exception added to the list of exceptions- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object
lock
private boolean
reportToErrorService
private static long
serialVersionUID
For serializationprivate java.util.List<java.lang.Throwable>
throwables
-
Constructor Summary
Constructors Constructor Description MultiException()
Creates an empty MultiExceptionMultiException(java.lang.Throwable th)
This allows for construction of a MultiException with one element in its listMultiException(java.lang.Throwable th, boolean reportToErrorService)
This allows for construction of a MultiException with one element in its listMultiException(java.util.List<java.lang.Throwable> ths)
This list must have at least one element in it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addError(java.lang.Throwable error)
Adds an error to an existing exceptionjava.util.List<java.lang.Throwable>
getErrors()
Gets all the errors associated with this MultiExceptionjava.lang.String
getMessage()
Gets the message associated with this exceptionboolean
getReportToErrorService()
Returns true if this exception should be reported to the error service when thrown during a creation or deletion of a servicevoid
printStackTrace(java.io.PrintStream s)
Prints the stack trace of this exception to the given PrintStreamvoid
printStackTrace(java.io.PrintWriter s)
Prints the stack trace of this exception to the given PrintWritervoid
setReportToErrorService(boolean report)
Sets if this exception should be reported to the error service when thrown during a creation or deletion of a servicejava.lang.String
toString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization- See Also:
- Constant Field Values
-
lock
private final java.lang.Object lock
-
throwables
private final java.util.List<java.lang.Throwable> throwables
-
reportToErrorService
private boolean reportToErrorService
-
-
Constructor Detail
-
MultiException
public MultiException()
Creates an empty MultiException
-
MultiException
public MultiException(java.util.List<java.lang.Throwable> ths)
This list must have at least one element in it. The first element of the list will become the cause of this exception, and its message will become the message of this exception- Parameters:
ths
- A non-null, non-empty list of exceptions
-
MultiException
public MultiException(java.lang.Throwable th, boolean reportToErrorService)
This allows for construction of a MultiException with one element in its list- Parameters:
th
- May not be null
-
MultiException
public MultiException(java.lang.Throwable th)
This allows for construction of a MultiException with one element in its list- Parameters:
th
- May not be null
-
-
Method Detail
-
getErrors
public java.util.List<java.lang.Throwable> getErrors()
Gets all the errors associated with this MultiException- Returns:
- All the errors associated with this MultiException. Will not return null, but may return an empty object
-
addError
public void addError(java.lang.Throwable error)
Adds an error to an existing exception- Parameters:
error
- The exception to add
-
getMessage
public java.lang.String getMessage()
Gets the message associated with this exception- Overrides:
getMessage
in classjava.lang.Throwable
-
printStackTrace
public void printStackTrace(java.io.PrintStream s)
Prints the stack trace of this exception to the given PrintStream- Overrides:
printStackTrace
in classjava.lang.Throwable
-
printStackTrace
public void printStackTrace(java.io.PrintWriter s)
Prints the stack trace of this exception to the given PrintWriter- Overrides:
printStackTrace
in classjava.lang.Throwable
-
getReportToErrorService
public boolean getReportToErrorService()
Returns true if this exception should be reported to the error service when thrown during a creation or deletion of a service- Returns:
- true if this exception should be reported to the error service when creating or deleting a service
-
setReportToErrorService
public void setReportToErrorService(boolean report)
Sets if this exception should be reported to the error service when thrown during a creation or deletion of a service- Parameters:
report
- true if this exception should be reported to the error service when creating or deleting a service
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Throwable
-
-