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:
Serializable
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Object
private boolean
private static final long
For serialization -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty MultiExceptionThis allows for construction of a MultiException with one element in its listMultiException
(Throwable th, boolean reportToErrorService) This allows for construction of a MultiException with one element in its listMultiException
(List<Throwable> ths) This list must have at least one element in it. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an error to an existing exceptionGets all the errors associated with this MultiExceptionGets the message associated with this exceptionboolean
Returns true if this exception should be reported to the error service when thrown during a creation or deletion of a servicevoid
Prints the stack trace of this exception to the given PrintStreamvoid
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 servicetoString()
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, setStackTrace
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor serialization- See Also:
-
lock
-
throwables
-
reportToErrorService
private boolean reportToErrorService
-
-
Constructor Details
-
MultiException
public MultiException()Creates an empty MultiException -
MultiException
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
This allows for construction of a MultiException with one element in its list- Parameters:
th
- May not be null
-
MultiException
This allows for construction of a MultiException with one element in its list- Parameters:
th
- May not be null
-
-
Method Details
-
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
Adds an error to an existing exception- Parameters:
error
- The exception to add
-
getMessage
Gets the message associated with this exception- Overrides:
getMessage
in classThrowable
-
printStackTrace
Prints the stack trace of this exception to the given PrintStream- Overrides:
printStackTrace
in classThrowable
-
printStackTrace
Prints the stack trace of this exception to the given PrintWriter- Overrides:
printStackTrace
in classThrowable
-
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
-