com.filenet.api.exception
Class EngineRuntimeException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.filenet.api.exception.EngineRuntimeException
-
- All Implemented Interfaces:
- java.io.Externalizable, java.io.Serializable
- Direct Known Subclasses:
- EventExternalFailureException
public class EngineRuntimeException extends java.lang.RuntimeException implements java.io.Externalizable
Used for all unchecked exceptions. The exceptions are defined asExceptionCode
objects.EngineRuntimeException
supports use of an error stack, as well as exception chaining (constructing a chain of exceptions by wrapping additional exceptions). You can usegetAsErrorStack
to do a stack trace of either the error stack or the exception chain.- See Also:
ExceptionCode
,ErrorStack
, Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description EngineRuntimeException()
This constructor exists for the implementation of the Externalizable interface.EngineRuntimeException(EngineRuntimeException cause, com.filenet.apiimpl.exception.ExceptionContext ctx, java.lang.Object[] ctxArgs)
(FileNet internal use only) SpecifiesEngineRuntimeException
cause, exception code, and context.EngineRuntimeException(ErrorStack errStack)
Use this to implement an error stack, specifying theErrorStack
object to use for this instance.EngineRuntimeException(ExceptionCode code)
Use this to specify only theExceptionCode
object for this exception.EngineRuntimeException(ExceptionCode code, java.lang.Object codeArg0)
Use this to specify theExceptionCode
object and the specific value in use (code argument) when the error occurred for this exception.EngineRuntimeException(ExceptionCode code, java.lang.Object[] codeArgs)
Use this to specify theExceptionCode
object and an array of specific values (code arguments) in use when the error occurred for this exception.EngineRuntimeException(ExceptionCode code, java.lang.Object[] codeArgs, com.filenet.apiimpl.exception.ExceptionContext ctx, java.lang.Object[] ctxArgs)
(FileNet internal use only) Specifies exception code and context.EngineRuntimeException(ExceptionCode code, java.lang.Object[] codeArgs, com.filenet.apiimpl.exception.ExceptionContext ctx, java.lang.Object[] ctxArgs, com.filenet.apiimpl.exception.ExceptionContext addlCtx, java.lang.Object[] addlCtxArgs)
(FileNet internal use only) Specifies exception code and context.EngineRuntimeException(ExceptionCode code, java.lang.Object codeArg0, com.filenet.apiimpl.exception.ExceptionContext ctx, java.lang.Object[] ctxArgs)
Use this to specify theExceptionCode
object and the specific value in use (code argument) when the error occurred for this exception.EngineRuntimeException(java.lang.Throwable cause, ExceptionCode code, java.lang.Object[] codeArgs)
Use this for exception chaining.EngineRuntimeException(java.lang.Throwable cause, ExceptionCode code, java.lang.Object[] codeArgs, com.filenet.apiimpl.exception.ExceptionContext ctx, java.lang.Object[] ctxArgs)
(FileNet internal use only) Specifies Throwable cause, exception code, and context.
-
Method Summary
Methods Modifier and Type Method and Description ErrorStack
getAsErrorStack()
Returns the error stack, if an error stack is used; otherwise this instance is returned as anErrorStack
object.ExceptionCode
getExceptionCode()
Gets theExceptionCode
object specified for this instance.java.lang.String
getLocalizedMessage()
Gets a localized version of the description string (using the default locale) specified in theExceptionCode
object used for this instance.java.lang.String
getMessage()
Gets a localized version of the description string (using the default locale) specified in theExceptionCode
object used for this instance.static java.lang.Throwable
mergeStackTraces(java.lang.Throwable current, java.lang.Throwable backGround)
Merges the stack trace elements from two threads and returns it as a single stack trace.void
readExternal(java.io.ObjectInput s)
Reads this instance from the underlying stream and stores it in the error stack.java.lang.String
toString()
Returns a description of this exception.void
writeExternal(java.io.ObjectOutput s)
Writes this instance to the underlying stream.
-
-
-
Constructor Detail
-
EngineRuntimeException
public EngineRuntimeException()
This constructor exists for the implementation of the Externalizable interface. It is not useful, in practice, for any other purpose.
-
EngineRuntimeException
public EngineRuntimeException(ErrorStack errStack)
Use this to implement an error stack, specifying theErrorStack
object to use for this instance. If unspecified, an error stack is not used.- Parameters:
errStack
- AnErrorStack
object to use.
-
EngineRuntimeException
public EngineRuntimeException(ExceptionCode code, java.lang.Object[] codeArgs)
Use this to specify theExceptionCode
object and an array of specific values (code arguments) in use when the error occurred for this exception.- Parameters:
code
- TheExceptionCode
object to use.codeArgs
- AnObject
array containing the code arguments. This can be null.
-
EngineRuntimeException
public EngineRuntimeException(ExceptionCode code)
Use this to specify only theExceptionCode
object for this exception.- Parameters:
code
- TheExceptionCode
object to use.
-
EngineRuntimeException
public EngineRuntimeException(ExceptionCode code, java.lang.Object codeArg0)
Use this to specify theExceptionCode
object and the specific value in use (code argument) when the error occurred for this exception.- Parameters:
code
- TheExceptionCode
object to use.codeArg0
- AnObject
containing the code argument. This can be null.
-
EngineRuntimeException
public EngineRuntimeException(ExceptionCode code, java.lang.Object codeArg0, com.filenet.apiimpl.exception.ExceptionContext ctx, java.lang.Object[] ctxArgs)
Use this to specify theExceptionCode
object and the specific value in use (code argument) when the error occurred for this exception.- Parameters:
code
- TheExceptionCode
object to use.codeArg0
- AnObject
containing the code argument. This can be null.ctx
- Used to localize the context message.ctxArgs
- AnObject
array containing the context arguments.
-
EngineRuntimeException
public EngineRuntimeException(java.lang.Throwable cause, ExceptionCode code, java.lang.Object[] codeArgs)
Use this for exception chaining. TheExceptionCode
object and an array of specific values (code arguments) in use when the error occurred for this (wrapping) exception. TheThrowable
object specified is wrapped (nested) within this exception.- Parameters:
cause
- Ajava.lang.Throwable
object containing the exception to wrap.code
- TheExceptionCode
object to use.codeArgs
- AnObject
array containing the code arguments. This can be null.
-
EngineRuntimeException
public EngineRuntimeException(ExceptionCode code, java.lang.Object[] codeArgs, com.filenet.apiimpl.exception.ExceptionContext ctx, java.lang.Object[] ctxArgs)
(FileNet internal use only) Specifies exception code and context.- Parameters:
code
- TheExceptionCode
object to use.codeArgs
- AnObject
array containing the code arguments.ctx
- Used to localize the context message.ctxArgs
- AnObject
array containing the context arguments.
-
EngineRuntimeException
public EngineRuntimeException(ExceptionCode code, java.lang.Object[] codeArgs, com.filenet.apiimpl.exception.ExceptionContext ctx, java.lang.Object[] ctxArgs, com.filenet.apiimpl.exception.ExceptionContext addlCtx, java.lang.Object[] addlCtxArgs)
(FileNet internal use only) Specifies exception code and context.- Parameters:
code
- TheExceptionCode
object to use.codeArgs
- AnObject
array containing the code arguments.ctx
- Used to localize the context message.ctxArgs
- AnObject
array containing the context arguments.addlCtx
- Used to localize the additional context message.addlCtxArgs
- AnObject
array containing the additional context arguments.
-
EngineRuntimeException
public EngineRuntimeException(java.lang.Throwable cause, ExceptionCode code, java.lang.Object[] codeArgs, com.filenet.apiimpl.exception.ExceptionContext ctx, java.lang.Object[] ctxArgs)
(FileNet internal use only) Specifies Throwable cause, exception code, and context.- Parameters:
cause
- Ajava.lang.Throwable
object containing the exception to wrap.code
- TheExceptionCode
object to use.codeArgs
- AnObject
array containing the code arguments.ctx
- Used to localize context message.ctxArgs
- AnObject
array containing the context arguments.
-
EngineRuntimeException
public EngineRuntimeException(EngineRuntimeException cause, com.filenet.apiimpl.exception.ExceptionContext ctx, java.lang.Object[] ctxArgs)
(FileNet internal use only) SpecifiesEngineRuntimeException
cause, exception code, and context.- Parameters:
cause
- AnEngineRuntimeException
containing the exception to wrap. The exception code and its argument array are retrieved from this object.ctx
- Used to localize context message.ctxArgs
- AnObject
array containing the context arguments.
-
-
Method Detail
-
getExceptionCode
public ExceptionCode getExceptionCode()
Gets theExceptionCode
object specified for this instance.- Returns:
- The
ExceptionCode
object for this exception.
-
getMessage
public java.lang.String getMessage()
Gets a localized version of the description string (using the default locale) specified in theExceptionCode
object used for this instance. This method overridesjava.lang.Throwable.getMessage
.- Overrides:
getMessage
in classjava.lang.Throwable
- Returns:
- A String containing the localized exception description.
-
getLocalizedMessage
public java.lang.String getLocalizedMessage()
Gets a localized version of the description string (using the default locale) specified in theExceptionCode
object used for this instance. This method overridesjava.lang.Throwable.getLocalizedMessage
.- Overrides:
getLocalizedMessage
in classjava.lang.Throwable
- Returns:
- A String containing the localized exception description.
-
getAsErrorStack
public ErrorStack getAsErrorStack()
Returns the error stack, if an error stack is used; otherwise this instance is returned as anErrorStack
object. The stack can contain an exception chain (if the instance was created usingEngineRuntimeException(Throwable, ExceptionCode, Object[])
.- Returns:
- An
ErrorStack
object containing an exception or exceptions from either the error stack or this instance.
-
toString
public java.lang.String toString()
Returns a description of this exception. The result is the concatenation of the following:- The name of this exception's class
- The name of the exception code
- The localized error message
- Extra info, such as a failedBatchItem=#
- The exception's error stack enclosed in errorStack={ ... } if applicable
- Overrides:
toString
in classjava.lang.Throwable
- Returns:
- A
String
representation of this exception.
-
writeExternal
public void writeExternal(java.io.ObjectOutput s) throws java.io.IOException
Writes this instance to the underlying stream.- Specified by:
writeExternal
in interfacejava.io.Externalizable
- Parameters:
s
- A java.io.ObjectOutput object representing this instance.- Throws:
java.io.IOException
- if an IO error occurs.
-
readExternal
public void readExternal(java.io.ObjectInput s) throws java.io.IOException, java.lang.ClassNotFoundException
Reads this instance from the underlying stream and stores it in the error stack.- Specified by:
readExternal
in interfacejava.io.Externalizable
- Parameters:
s
- A java.io.ObjectInput object representing this instance.- Throws:
java.io.IOException
- if an IO error occurs, or the class cannot be found.java.lang.ClassNotFoundException
-
mergeStackTraces
public static java.lang.Throwable mergeStackTraces(java.lang.Throwable current, java.lang.Throwable backGround)
Merges the stack trace elements from two threads and returns it as a single stack trace. It is especially useful to merge the threaded stack traces when the background thread raises an exception.- Parameters:
current
- Ajava.lang.Throwable
object containing the stack trace elements for the current thread.backGround
- Ajava.lang.Throwable
object containing the stack trace elements for the background thread.- Returns:
- A new
java.lang.Throwable
object containing the merged stack trace elements.
-
-