Public Member Functions | |
AcsJException () | |
AcsJException (String message) | |
AcsJException (String message, Throwable cause) | |
AcsJException (ErrorTrace etCause) | |
AcsJException (String message, ErrorTrace etCause) | |
String | toString () |
String | getShortDescription () |
abstract UserException | toCorbaException () |
AcsJCompletion | toAcsJCompletion () |
void | setSeverity () |
Severity | getSeverity () |
Object | setProperty (String key, String value) |
String | getProperty (String key) |
NameValue[] | getNameValueArray () |
long | getTimestampMillis () |
ErrorTrace | getErrorTrace () |
void | log (Logger logger) |
int | getTraceDepth () |
String | getFile () |
String | getHost () |
int | getLine () |
String | getMethod () |
String | getProcess () |
String | getThreadName () |
String | getSourceObject () |
Static Public Member Functions | |
static void | setProcessName (String name) |
static ErrorTrace | createSingleErrorTrace (Throwable thr, long defaultTimeMilli) |
Protected Member Functions | |
abstract int | getErrorType () |
abstract int | getErrorCode () |
ErrorTrace | createSingleErrorTrace () |
Protected Attributes | |
String | m_host |
String | m_process |
int | m_line |
String | m_method |
String | m_file |
String | m_sourceObject |
String | m_threadName |
Severity | m_severity |
Properties | m_properties |
long | m_timeMilli |
Package Functions | |
LogRecord | createSingleErrorTraceLogRecord (ErrorTrace et, String stackID, int stackLevel) |
Base class for any checked exceptions defined in ALMA Java code. Allows these Java exceptions to be interoperable with the ACS error system, i.e. that they can be converted to and from ErrorTrace or ACSException objects. See AcsJException(ErrorTrace), getErrorTrace, getACSException.
Not to be confused with alma.ACSErr.ACSException
, which is a CORBA user exception with an alma.ACSErr.ErrorTrace
inside. ACSException
is declared as final
, so that it's not an option to make our AcsJException
a subclass of it. (todo check if that's due to OMG spec or JacORB).
For the conversion to and from the CORBA exception types, two ErrorTrace
properties (i.e. NameValue objects referenced from ErrorTrace#data) are added:
javaex.class
to store the exception class for later reconstruction javaex.msg
to store the message text provided in the various constructors of Throwable
and subclasses.alma.acs.exceptions.AcsJException.AcsJException | ( | ) |
alma.acs.exceptions.AcsJException.AcsJException | ( | String | message | ) |
alma.acs.exceptions.AcsJException.AcsJException | ( | String | message, | |
Throwable | cause | |||
) |
Constructor from another exception, with a message. Subclass ctors call this ctor even if the message is null, to avoid the Throwable.ctor taking the cause.toString() as the message.
If cause
is a CORBA exception generated by the ACS error system, then its ErrorTrace is automatically converted to a chain of AcsJ-style exceptions.
cause | the causing exception |
alma.acs.exceptions.AcsJException.AcsJException | ( | ErrorTrace | etCause | ) |
alma.acs.exceptions.AcsJException.AcsJException | ( | String | message, | |
ErrorTrace | etCause | |||
) |
Creates a new exception, with the chain of causing exceptions derived from etCause
.
message | ||
etCause |
ErrorTrace alma.acs.exceptions.AcsJException.createSingleErrorTrace | ( | ) | [protected] |
Creates an ErrorTrace
object that represents this exception. Linked exceptions are not considered, so the returned ErrorTrace.previousError
is left as null
.
Reimplemented in alma.acs.exceptions.DefaultAcsJException.
References alma.acs.exceptions.AcsJException.getErrorCode(), alma.acs.exceptions.AcsJException.getErrorType(), alma.acs.exceptions.AcsJException.getNameValueArray(), alma.acs.exceptions.AcsJException.getSeverity(), alma.acs.exceptions.AcsJException.getShortDescription(), alma.acs.exceptions.AcsJException.m_file, alma.acs.exceptions.AcsJException.m_host, alma.acs.exceptions.AcsJException.m_line, alma.acs.exceptions.AcsJException.m_method, alma.acs.exceptions.AcsJException.m_process, alma.acs.exceptions.AcsJException.m_sourceObject, alma.acs.exceptions.AcsJException.m_threadName, and alma.acs.exceptions.AcsJException.m_timeMilli.
Referenced by alma.acs.exceptions.AcsJException.log().
static ErrorTrace alma.acs.exceptions.AcsJException.createSingleErrorTrace | ( | Throwable | thr, | |
long | defaultTimeMilli | |||
) | [static] |
Converts a Throwable that may not be an AcsJException to an ErrorTrace
.
For example, thr
could be a NullPointerException
thrown in the same process and thus not yet converted to DefaultAcsJException
, but wrapped by some subclass of AcsJException which contains the NPE as its cause.
defaultTimeMilli | Java-time (1970-based) used to estimate a time stamp if none is available, in order to avoid something from October 1582 in the new ErrorTrace. Typically the timestamp from the wrapping AcsJException. |
LogRecord alma.acs.exceptions.AcsJException.createSingleErrorTraceLogRecord | ( | ErrorTrace | et, | |
String | stackID, | |||
int | stackLevel | |||
) | [package] |
Creates a LogRecord with the data from the given ErrorTrace object. Some data such as thread name, line of code, user-defined properties etc which do not correspond to any field of LogRecord
are stored inside a Map
that is set as a parameter of the LogRecord
. Later when the ACS logging system will process this LogRecord
, it will recognize the special data and turn them into the XML attributes of elements like <Debug>
et | the ErrorTrace input object | |
stackID | the stackID that must be the same for all linked ErrorTrace objects. | |
stackLevel | 0-based index for LogRecords from an ErrorTrace chain. |
Referenced by alma.acs.exceptions.AcsJException.log().
abstract int alma.acs.exceptions.AcsJException.getErrorCode | ( | ) | [protected, pure virtual] |
Forces a subclass to choose an ACS error code.
Implemented in alma.acs.exceptions.DefaultAcsJException.
Referenced by alma.acs.exceptions.AcsJException.createSingleErrorTrace(), and alma.acs.exceptions.AcsJCompletion.init().
ErrorTrace alma.acs.exceptions.AcsJException.getErrorTrace | ( | ) |
Converts this exception (and all "caused-by" throwables it might have) to an ErrorTrace
that links to its caused-by ErrorTrace
objects.
To be used whenever the Corba wall is hit and the Java exception must be converted to an ACS-Corba-exception.
References alma.acs.exceptions.AcsJException.m_timeMilli.
Referenced by alma.demo.LampCallbackImpl.LampCallbackImpl.acsExceptionMethodVoid(), alma.ACS.jbaci.CompletionUtil.generateCompletion(), alma.acs.exceptions.AcsJCompletion.toCorbaCompletion(), and alma.acs.exceptions.DefaultAcsJException.toCorbaException().
abstract int alma.acs.exceptions.AcsJException.getErrorType | ( | ) | [protected, pure virtual] |
Forces a subclass to choose an ACS error type.
Implemented in alma.acs.exceptions.DefaultAcsJException.
Referenced by alma.acs.exceptions.AcsJException.createSingleErrorTrace(), and alma.acs.exceptions.AcsJCompletion.init().
String alma.acs.exceptions.AcsJException.getFile | ( | ) |
References alma.acs.exceptions.AcsJException.m_file.
String alma.acs.exceptions.AcsJException.getHost | ( | ) |
References alma.acs.exceptions.AcsJException.m_host.
int alma.acs.exceptions.AcsJException.getLine | ( | ) |
References alma.acs.exceptions.AcsJException.m_line.
String alma.acs.exceptions.AcsJException.getMethod | ( | ) |
References alma.acs.exceptions.AcsJException.m_method.
NameValue [] alma.acs.exceptions.AcsJException.getNameValueArray | ( | ) |
To be used by getErrorTrace() or whoever else cares about a NameValue[]
.
References alma.acs.exceptions.AcsJException.m_properties.
Referenced by alma.acs.exceptions.AcsJException.createSingleErrorTrace().
String alma.acs.exceptions.AcsJException.getProcess | ( | ) |
References alma.acs.exceptions.AcsJException.m_process.
String alma.acs.exceptions.AcsJException.getProperty | ( | String | key | ) |
References alma.acs.exceptions.AcsJException.m_properties.
Referenced by alma.acs.exceptions.AcsJCompletion.getProperty().
Severity alma.acs.exceptions.AcsJException.getSeverity | ( | ) |
Returns the Severity level currently associated with this exception instance.
References alma.acs.exceptions.AcsJException.m_severity.
Referenced by alma.acs.exceptions.AcsJException.createSingleErrorTrace().
String alma.acs.exceptions.AcsJException.getShortDescription | ( | ) |
Returns the short description which is a hardcoded text particular for a (type, code) combination. The subclass that represents the exception code will have to override this method. This method is not abstract
because the exception class that corresponds to an error type (but not an error code) would otherwise have to overload it with returning an empty string.
Reimplemented in alma.acs.exceptions.DefaultAcsJException.
Referenced by alma.acs.exceptions.AcsJException.createSingleErrorTrace().
String alma.acs.exceptions.AcsJException.getSourceObject | ( | ) |
References alma.acs.exceptions.AcsJException.m_sourceObject.
String alma.acs.exceptions.AcsJException.getThreadName | ( | ) |
References alma.acs.exceptions.AcsJException.m_threadName.
long alma.acs.exceptions.AcsJException.getTimestampMillis | ( | ) |
Gets the timestamp when this exception was created.
References alma.acs.exceptions.AcsJException.m_timeMilli.
Referenced by alma.acs.exceptions.AcsJCompletion.init().
int alma.acs.exceptions.AcsJException.getTraceDepth | ( | ) |
Gets the total number of linked ("caused-by") exceptions including this one.
Not to be confused with the length of Throwable#getStackTrace(), which refers to the call stack for the current exception, and not to linked causing exception.
Referenced by alma.acs.exceptions.AcsJException.log().
void alma.acs.exceptions.AcsJException.log | ( | Logger | logger | ) |
Logs this exception and all causing exceptions. For each such exception, a separate log entry is created, in accordance with the ACS error logging specification.
logger | the JDK logger to be used for logging this exception. |
References alma.acs.exceptions.AcsJException.createSingleErrorTrace(), alma.acs.exceptions.AcsJException.createSingleErrorTraceLogRecord(), alma.acs.exceptions.AcsJException.getTraceDepth(), and alma.acs.exceptions.AcsJException.m_timeMilli.
Referenced by alma.demo.client.XmlComponentClient.testException().
static void alma.acs.exceptions.AcsJException.setProcessName | ( | String | name | ) | [static] |
If we have some better name than "java", for example the unique name of the java container.
name |
Object alma.acs.exceptions.AcsJException.setProperty | ( | String | key, | |
String | value | |||
) |
Allows extra information to be attached to the exception.
null
if it did not have one. References alma.acs.exceptions.AcsJException.m_properties.
Referenced by alma.acs.exceptions.AcsJCompletion.setProperty().
void alma.acs.exceptions.AcsJException.setSeverity | ( | ) |
Sets the default severity level to Severity#Error. May be overridden by a subclass to set the default severity for that exception, or may be called from application code to set it for a specific exception instance.
References alma.acs.exceptions.AcsJException.m_severity.
AcsJCompletion alma.acs.exceptions.AcsJException.toAcsJCompletion | ( | ) |
Creates an AcsJCompletion that contains this exception.
Referenced by alma.acs.container.AcsContainer.activate_component_async(), and com.cosylab.acs.maci.plug.ManagerProxyImpl.release_component_async().
abstract UserException alma.acs.exceptions.AcsJException.toCorbaException | ( | ) | [pure virtual] |
Creates a CORBA UserException
from this exception.
Subclasses must return their associated UserException
with an ErrorTrace
member.
By convention, subclasses must also implement another method that returns the correct subtype of UserException
. No problem with a code generator of course...
Implemented in alma.acs.exceptions.DefaultAcsJException.
String alma.acs.exceptions.AcsJException.toString | ( | ) |
Reimplemented in alma.acs.exceptions.DefaultAcsJException.
References alma.acs.exceptions.AcsJException.m_properties.
Referenced by alma.ACS.MasterComponentImpl.StateChangeListener.logNotification().
String alma.acs.exceptions.AcsJException.m_file [protected] |
String alma.acs.exceptions.AcsJException.m_host [protected] |
int alma.acs.exceptions.AcsJException.m_line [protected] |
String alma.acs.exceptions.AcsJException.m_method [protected] |
String alma.acs.exceptions.AcsJException.m_process [protected] |
Properties alma.acs.exceptions.AcsJException.m_properties [protected] |
Severity alma.acs.exceptions.AcsJException.m_severity [protected] |
String alma.acs.exceptions.AcsJException.m_sourceObject [protected] |
String alma.acs.exceptions.AcsJException.m_threadName [protected] |
long alma.acs.exceptions.AcsJException.m_timeMilli [protected] |