Top Description Fields Constructors Methods
org.glassfish.hk2.api

public Class MultiException

extends HK2RuntimeException
Class Inheritance
Imports
java.io.PrintStream, .PrintWriter, java.util.LinkedList, .List, java.util.concurrent.locks.ReentrantLock

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
Author
jwells

Field Summary

Modifier and TypeField and Description
private final ReentrantLock
private boolean
private static final long
private final List<Throwable>

Constructor Summary

AccessConstructor and Description
public
MultiException()

Creates an empty MultiException

public
MultiException(List<Throwable>
A non-null, non-empty list of exceptions
ths
)

This list must have at least one element in it.

public
MultiException(Throwable
May not be null
th
,
boolean reportToErrorService)

This allows for construction of a MultiException with one element in its list

public
MultiException(Throwable
May not be null
th
)

This allows for construction of a MultiException with one element in its list

Method Summary

Modifier and TypeMethod and Description
public void
addError(Throwable
The exception to add
error
)

Adds an error to an existing exception

public List<Throwable>

Returns:

All the errors associated with this MultiException. Will not return null, but may return an empty object
getErrors
()

Gets all the errors associated with this MultiException

public String
getMessage()

Overrides java.lang.Throwable.getMessage.

Gets the message associated with this exception

public boolean

Returns:

true if this exception should be reported to the error service when creating or deleting a service
getReportToErrorService
()

Returns true if this exception should be reported to the error service when thrown during a creation or deletion of a service

public void
printStackTrace(PrintStream s)

Overrides java.lang.Throwable.printStackTrace.

Prints the stack trace of this exception to the given PrintStream

public void
printStackTrace(PrintWriter s)

Overrides java.lang.Throwable.printStackTrace.

Prints the stack trace of this exception to the given PrintWriter

public void
setReportToErrorService(boolean
true if this exception should be reported to the error service when creating or deleting a service
report
)

Sets if this exception should be reported to the error service when thrown during a creation or deletion of a service

public String
toString()

Overrides java.lang.Throwable.toString.

Returns a short description of this throwable.

Field Detail

lockback to summary
private final ReentrantLock lock
reportToErrorServiceback to summary
private boolean reportToErrorService
serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.glassfish.hk2.api.HK2RuntimeException.serialVersionUID.

For serialization

throwablesback to summary
private final List<Throwable> throwables

Constructor Detail

MultiExceptionback to summary
public MultiException()

Creates an empty MultiException

MultiExceptionback to summary
public MultiException(List<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:List<Throwable>

A non-null, non-empty list of exceptions

MultiExceptionback to summary
public MultiException(Throwable th, boolean reportToErrorService)

This allows for construction of a MultiException with one element in its list

Parameters
th:Throwable

May not be null

MultiExceptionback to summary
public MultiException(Throwable th)

This allows for construction of a MultiException with one element in its list

Parameters
th:Throwable

May not be null

Method Detail

addErrorback to summary
public void addError(Throwable error)

Adds an error to an existing exception

Parameters
error:Throwable

The exception to add

getErrorsback to summary
public List<Throwable> getErrors()

Gets all the errors associated with this MultiException

Returns:List<Throwable>

All the errors associated with this MultiException. Will not return null, but may return an empty object

getMessageback to summary
public String getMessage()

Overrides java.lang.Throwable.getMessage.

Gets the message associated with this exception

getReportToErrorServiceback to summary
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:boolean

true if this exception should be reported to the error service when creating or deleting a service

printStackTraceback to summary
public void printStackTrace(PrintStream s)

Overrides java.lang.Throwable.printStackTrace.

Prints the stack trace of this exception to the given PrintStream

printStackTraceback to summary
public void printStackTrace(PrintWriter s)

Overrides java.lang.Throwable.printStackTrace.

Prints the stack trace of this exception to the given PrintWriter

setReportToErrorServiceback to summary
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:boolean

true if this exception should be reported to the error service when creating or deleting a service

toStringback to summary
public String toString()

Overrides java.lang.Throwable.toString.

Doc from java.lang.Throwable.toString.

Returns a short description of this throwable. The result is the concatenation of:

  • the name of the class of this object
  • ": " (a colon and a space)
  • the result of invoking this object's getLocalizedMessage method
If getLocalizedMessage returns null, then just the class name is returned.
Annotations
@Override