public class IfsException extends Exception implements Cloneable
Each IfsException has an integer error code that specifies the type of error encountered.
An IfsException may also have an array of object parameters that can be
substituted into a string (obtained from the iFS resource bundle) using
java.text.MessageFormat
to produce a more descriptive,
localized error message.
An exception often leads to another higher-level exception, which in turn
may result in even higher-level exceptions. Although only the top-level
exception is presented to the application by the iFS API, an IfsException
keeps track of the underlying, or "nested", exceptions (or more precisely,
the nested java.lang.Throwable
s). For any IfsException, the
immediately underlying Throwable can be obtained by calling the method
getNestedThrowable
.
Modifier and Type | Field and Description |
---|---|
protected int |
m_ErrorCode
The error code.
|
protected Object |
m_Info
The exception information.
|
protected String |
m_InfoDescription
The description (identifer) for the exception information,
|
protected Throwable |
m_NestedThrowable
The Throwable that led to this IfsException.
|
protected Throwable |
m_OriginatingThrowable
The last Throwable in the chain.
|
protected Object[] |
m_Parameters
The error message parameters.
|
protected String |
m_RemoteBacktrace
If this IfsException was thrown in a different process,
the backtrace in that process; null otherwise.
|
protected static boolean |
s_VerboseMessage
Whether
toString and toLocalizedString
produce concise or verbose messages. |
Constructor and Description |
---|
IfsException(int errorCode)
Constructs an IfsException.
|
IfsException(int errorCode,
Object[] parameters)
Constructs an IfsException.
|
IfsException(int errorCode,
Object[] parameters,
String infoDescription,
Object info)
Constructs an IfsException.
|
IfsException(int errorCode,
Object[] parameters,
Throwable nestedThrowable)
Constructs an IfsException.
|
IfsException(int errorCode,
Object[] parameters,
Throwable nestedThrowable,
String infoDescription,
Object info)
Constructs an IfsException.
|
IfsException(int errorCode,
Object[] parameters,
Throwable nestedThrowable,
Traceable object)
Constructs an IfsException.
|
IfsException(int errorCode,
Object[] parameters,
Traceable object)
Constructs an IfsException.
|
IfsException(int errorCode,
String infoDescription,
Object info)
Constructs an IfsException.
|
IfsException(int errorCode,
Throwable nestedThrowable)
Constructs an IfsException.
|
IfsException(int errorCode,
Throwable nestedThrowable,
String infoDescription,
Object info)
Constructs an IfsException.
|
IfsException(int errorCode,
Throwable nestedThrowable,
Traceable object)
Constructs an IfsException.
|
IfsException(int errorCode,
Traceable object)
Constructs an IfsException.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsErrorCode(int errorCode)
Gets whether this IfsException or any nested IfsExceptions
have the specified error code.
|
IfsException |
fillInRemoteStackTrace()
Sets the remote backtrace of this IfsException.
|
void |
fillInRemoteStackTrace(String backtrace)
Fills in the remote backtrace of this IfsException to the specified
string.
|
int |
getErrorCode()
Gets the error code of this IfsException.
|
Object |
getInfo()
Gets the exception information.
|
String |
getInfoDescription()
Gets the description of the exception information.
|
String |
getLocalizedMessage()
Gets the description of this IfsException for the default locale
of the Java VM.
|
String |
getLocalizedMessage(LibrarySessionInterface session)
Gets the description of this IfsException for the locale of the
specified session's Localizer.
|
String |
getLocalizedMessage(Localizer localizer)
Gets the description of this IfsException for the locale of the
specified Localizer.
|
String |
getMessage()
Gets the US English description of this IfsException.
|
Exception |
getNestedException()
Deprecated.
iFS 9.0 use getNestedThrowable
|
IfsException |
getNestedIfsException(int errorCode)
Gets a nested IfsException that matches the specified error code.
|
Throwable |
getNestedThrowable()
Gets the Throwable that led to this IfsException.
|
Object[] |
getParameters()
Gets the parameter values for the error message.
|
void |
ignoreObjectNotFoundException()
Re-throw the target exception unless it reflects
an "object not found" condition.
|
static boolean |
isVerboseMessage()
Gets whether
toString and toLocalizedString
produces verbose messages. |
void |
printLocalizedStackTrace()
Prints the stack trace of this IfsException to the standard error
stream, using the default locale of the Java VM.
|
void |
printLocalizedStackTrace(LibrarySessionInterface session)
Prints the stack trace of this IfsException to the standard error
stream, using the locale of the specified session's Localizer.
|
void |
printLocalizedStackTrace(Localizer localizer)
Prints the stack trace of this IfsException to the standard error
stream, using the locale of the specified Localizer.
|
void |
printLocalizedStackTrace(PrintStream stream)
Prints the stack trace of this IfsException to the specified
PrintStream, using the default locale of the Java VM.
|
void |
printLocalizedStackTrace(PrintStream stream,
LibrarySessionInterface session)
Prints the stack trace of this IfsException to the specified
PrintStream, using the locale of the specified session's Localizer.
|
void |
printLocalizedStackTrace(PrintStream stream,
Localizer localizer)
Prints the stack trace of this IfsException to the specified
PrintStream, using the locale of the specified Localizer.
|
void |
printLocalizedStackTrace(PrintWriter writer)
Prints the stack trace of this IfsException to the specified
PrintWriter, using the default locale of the Java VM.
|
void |
printLocalizedStackTrace(PrintWriter writer,
LibrarySessionInterface session)
Prints the stack trace of this IfsException to the specified
PrintWriter, using the locale of the specified session's Localizer.
|
void |
printLocalizedStackTrace(PrintWriter writer,
Localizer localizer)
Prints the stack trace of this IfsException to the specified
PrintWriter, using the locale of the specified Localizer.
|
void |
printStackTrace()
Prints the stack trace of this IfsException to the standard error
stream, using US English.
|
void |
printStackTrace(PrintStream stream)
Prints the stack trace of this IfsException to the specified
PrintStream, using US English.
|
void |
printStackTrace(PrintWriter writer)
Prints the stack trace of this IfsException to the specified
PrintWriter, using US English.
|
static void |
setVerboseMessage(boolean verbose)
Specifies whether
toString and toLocalizedString
produces verbose messages. |
String |
toLocalizedString()
Represents this IfsException as a localized string, using the default
locale of the Java VM.
|
String |
toLocalizedString(LibrarySessionInterface session)
Represents this IfsException as a localized string, using the locale
of the specified session's Localizer.
|
String |
toLocalizedString(Localizer localizer)
Represents this IfsException as a localized string, using the locale
of the specified Localizer.
|
String |
toString()
Represents this IfsException as a US English string.
|
addSuppressed, fillInStackTrace, getCause, getStackTrace, getSuppressed, initCause, setStackTrace
protected int m_ErrorCode
protected Object[] m_Parameters
protected String m_InfoDescription
protected Object m_Info
protected Throwable m_NestedThrowable
protected Throwable m_OriginatingThrowable
protected String m_RemoteBacktrace
protected static boolean s_VerboseMessage
toString
and toLocalizedString
produce concise or verbose messages.
Verbose messages include the messages of nested Throwables.
public IfsException(int errorCode, Object[] parameters, Throwable nestedThrowable, String infoDescription, Object info)
errorCode
- the error codeparameters
- an array of Objects to be substituted into
the resource bundle message using using
java.text.MessageFormat
to
produce a localized error messagenestedThrowable
- the Throwable that led to this IfsExceptioninfoDescription
- description of the exception informationinfo
- the exception informationpublic IfsException(int errorCode, Object[] parameters, Throwable nestedThrowable)
This constructor variant is used when the error message has no included information.
errorCode
- the error codeparameters
- an array of Objects to be substituted into
the resource bundle message using using
java.text.MessageFormat
to
produce a localized error messagenestedThrowable
- the Throwable that led to this IfsExceptionpublic IfsException(int errorCode, Object[] parameters, Throwable nestedThrowable, Traceable object)
This constructor variant is used when the error message has no included information.
This variant also issues a trace on the CHANNEL_EXCEPTION
channel of level LEVEL_ERROR
.
errorCode
- the error codeparameters
- an array of Objects to be substituted into
the resource bundle message using using
java.text.MessageFormat
to
produce a localized error messagenestedThrowable
- the Throwable that led to this IfsExceptionobject
- the Traceable associated with the IfsExceptionpublic IfsException(int errorCode, Throwable nestedThrowable)
This constructor variant is used when the error message for the specified error code has no parameters and no included information.
errorCode
- the error codenestedThrowable
- the Throwable that led to this IfsExceptionpublic IfsException(int errorCode, Throwable nestedThrowable, Traceable object)
This constructor variant is used when the error message for the specified error code has no parameters and no included information.
This variant also issues a trace on the CHANNEL_EXCEPTION
channel of level LEVEL_ERROR
.
errorCode
- the error codenestedThrowable
- the Throwable that led to this IfsExceptionobject
- the Traceable associated with the IfsExceptionpublic IfsException(int errorCode, Object[] parameters)
This constructor variant is used when the IfsException has no nested Throwable and no included information.
errorCode
- the error codeparameters
- an array of Objects to be substituted into
the resource bundle message using using
java.text.MessageFormat
to
produce a localized error messagepublic IfsException(int errorCode, Object[] parameters, Traceable object)
This constructor variant is used when the IfsException has no nested Throwable and no included information.
This variant also issues a trace on the CHANNEL_EXCEPTION
channel of level LEVEL_ERROR
.
errorCode
- the error codeparameters
- an array of Objects to be substituted into
the resource bundle message using using
java.text.MessageFormat
to
produce a localized error messageobject
- the Traceable associated with the IfsExceptionpublic IfsException(int errorCode)
This constructor variant is used when the IfsException has no nested Throwable and the error message for the specified error code has no parameters, and no included information.
errorCode
- the error codepublic IfsException(int errorCode, Traceable object)
This constructor variant is used when the IfsException has no nested Throwable and the error message for the specified error code has no parameters, and no included information.
This variant also issues a trace on the CHANNEL_EXCEPTION
channel of level LEVEL_ERROR
.
errorCode
- the error codeobject
- the Traceable associated with the IfsExceptionpublic IfsException(int errorCode, String infoDescription, Object info)
This constructor variant is used when the IfsException has no nested Throwable and the error message for the specified error code has no parameters.
errorCode
- the error codeinfoDescription
- description of the exception informationinfo
- the exception informationpublic IfsException(int errorCode, Object[] parameters, String infoDescription, Object info)
This constructor variant is used when the IfsException has no nested Throwable.
errorCode
- the error codeparameters
- an array of Objects to be substituted into
the resource bundle message using using
java.text.MessageFormat
to
produce a localized error messageinfoDescription
- description of the exception informationinfo
- the exception informationpublic IfsException(int errorCode, Throwable nestedThrowable, String infoDescription, Object info)
This constructor variant is used when the error message for the specified error code has no parameters.
errorCode
- the error codenestedThrowable
- the Throwable that led to this IfsExceptioninfoDescription
- description of the exception informationinfo
- the exception informationpublic final int getErrorCode()
public final Object[] getParameters()
public final String getInfoDescription()
public final Object getInfo()
public final Throwable getNestedThrowable()
public final Exception getNestedException()
public final IfsException getNestedIfsException(int errorCode)
errorCode
- the specified error codepublic final boolean containsErrorCode(int errorCode)
errorCode
- the error code of interestpublic void printStackTrace()
printStackTrace
in class Throwable
public void printStackTrace(PrintStream stream)
printStackTrace
in class Throwable
stream
- the PrintStreampublic void printStackTrace(PrintWriter writer)
printStackTrace
in class Throwable
writer
- the PrintWriterpublic void printLocalizedStackTrace()
The default locale of the Java virtual machine is determined by
invoking the java.util.Locale.getDefault
method.
public void printLocalizedStackTrace(PrintStream stream)
The default locale of the Java virtual machine is determined by
invoking the java.util.Locale.getDefault
method.
stream
- the PrintStreampublic void printLocalizedStackTrace(PrintWriter writer)
The default locale of the Java virtual machine is determined by
invoking the java.util.Locale.getDefault
method.
writer
- the PrintWriterpublic void printLocalizedStackTrace(LibrarySessionInterface session)
session
- the sessionpublic void printLocalizedStackTrace(PrintStream stream, LibrarySessionInterface session)
stream
- the PrintStreamsession
- the sessionpublic void printLocalizedStackTrace(PrintWriter writer, LibrarySessionInterface session)
writer
- the PrintWritersession
- the sessionpublic void printLocalizedStackTrace(Localizer localizer)
localizer
- the Localizerpublic void printLocalizedStackTrace(PrintStream stream, Localizer localizer)
stream
- the PrintStreamlocalizer
- the Localizerpublic void printLocalizedStackTrace(PrintWriter writer, Localizer localizer)
writer
- the PrintWriterlocalizer
- the Localizerpublic String getMessage()
getMessage
in class Throwable
public String getLocalizedMessage()
The default locale of the Java virtual machine is determined by
invoking the java.util.Locale.getDefault
method.
getLocalizedMessage
in class Throwable
public String getLocalizedMessage(LibrarySessionInterface session)
session
- the sessionpublic String getLocalizedMessage(Localizer localizer)
localizer
- the Localizerpublic String toString()
public String toLocalizedString()
The default locale of the Java virtual machine is determined by
invoking the java.util.Locale.getDefault
method.
public String toLocalizedString(LibrarySessionInterface session)
session
- the sessionpublic String toLocalizedString(Localizer localizer)
localizer
- the Localizerpublic static final void setVerboseMessage(boolean verbose)
toString
and toLocalizedString
produces verbose messages.
Verbose messages include the messages of nested Throwables.
Verbose messages are produced by default.
verbose
- whether the messages are verbosepublic static final boolean isVerboseMessage()
toString
and toLocalizedString
produces verbose messages.
Verbose messages include the messages of nested Throwables.
Verbose messages are produced by default.
public final IfsException fillInRemoteStackTrace()
public final void fillInRemoteStackTrace(String backtrace)
backtrace
- the backtracepublic void ignoreObjectNotFoundException() throws IfsException
IfsException
- if the target exception is for any condition other
than bject not found; re-throws specified exceptionCopyright © 2023. All rights reserved.