Transport exceptions
TransportException is the exception class that should be thrown by a transport plug-in whenever the IAF calls one of its methods and an error prevents the method from successfully completing — for example, a message that cannot be sent on to an external sink in sendTransportEvent, or a serious problem that prevents the plug-in from initializing when start is called.
A TransportException object always has an associated message, which is a String explaining the problem (this may include information about another exception that caused the TransportException to be thrown). There is also a code field that specifies the kind of error that occurred; the possible codes are defined as constants in the TransportException class:
/**
* Some unspecified internal error occurred
*/
public static final int INTERNALERROR = 1;
/**
* Trouble reading/writing the external transport
*/
public static final int TRANSPORTFAILURE = 2;
/**
* Trouble sending transport event to decoder
*/
public static final int DECODINGFAILURE = 3;
/**
* Transport was passed an invalid property set
*/
public static final int BADPROPERTIES = 4;
TransportException defines a number of constructors, to make it easy to set up the exception’s information quickly in different situations:
/**
* Constructs a TransportException from a string message describing the
* error, and assumes an error code of TRANSPORTFAILURE.
*
* @param message The cause of the error.
*/
public TransportException(String message) { ... }
/**
* Constructs a TransportException from a string message describing the
* error and a numeric code representing the class of error.
*
* @param message The cause of the error.
* @param code One of the TransportException error codes.
*/
public TransportException(String message, int code) { ... }
/**
* Constructs a TransportException from a string message describing the
* error, and an exception object that is the cause of the error. It
* assumes an error code of TRANSPORTFAILURE.
*
* @param message The cause of the error. This message will be suffixed
* with the message of the 'cause' exception.
* @param cause The exception object that caused the error.
*/
public TransportException(String message, Throwable cause) { ... }
/**
* Constructs a TransportException from a string message describing the
* error, a numeric code representing the class of error and an exception
* object that is the cause of the error.
*
* @param message The cause of the error. This message will be suffixed
* with the message of the 'cause' exception.
* @param cause The exception object that caused the error.
* @param code One of the TransportException error codes.
*/
public TransportException(String message, Throwable cause, int code) { ... }