com.maverick.ssh
Class SshException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended bycom.maverick.ssh.SshException
All Implemented Interfaces:
java.io.Serializable

public class SshException
extends java.lang.Exception

Generic exception for J2SSH Maverick exception handling. When an exception is thrown a reason is attached to the exception so that the developer can determine if its possible to proceed with the connection.

This

Author:
Lee David Painter
See Also:
Serialized Form

Field Summary
static int AGENT_ERROR
          An error has occured within the agent.
static int BAD_API_USAGE
          The API has encountered an error because of incorrect usage.
static int CANCELLED_CONNECTION
          The user cancelled the connection.
static int CHANNEL_FAILURE
          Indicates that a channel has failed; this is used by channel implementations (such as port forwarding or session channels) to indicate that the channel has critically failed.
static int CONNECT_FAILED
          The connection could not be established.
static int CONNECTION_CLOSED
          An attempt has been made to use a connection that has been closed and is no longer valid.
static int FORWARDING_ERROR
          An error has occured the port forwarding system.
static int INTERNAL_ERROR
          An internal error occured within the API; in all cases contact 3sp.com support with the details of this error and the state of the connection when receiving this exception is unknown.
static int JCE_ERROR
          An error occured in the JCE; typically this would result from Maverick attempting to use an algorithm that the JCE does not support.
static int KEY_EXCHANGE_FAILED
          The protocol failed to negotiate a transport algorithm or failed to verify the host key of the remote host.
static int LICENSE_ERROR
          The API is not licensed!
static int POSSIBLE_CORRUPT_FILE
          An error occured reading the contents of a file.
static int PROMPT_TIMEOUT
          The Shell class failed to detect the prompt.
static int PROTOCOL_VIOLATION
          The SSH protocol was violated in some way by the remote host and the connection has been terminated.
static int PSEUDO_TTY_ERROR
          A request was made to allocate a pseudo terminal, but this request failed.
static int REMOTE_HOST_DISCONNECTED
          The remote host disconnected following the normal SSH protocol disconnection procedure.
static int SCP_TRANSFER_CANCELLED
          The user cancelled an active SCP transfer.
static int SESSION_STREAM_ERROR
          An error occured whilst accessing a sessions streams
static int SHELL_ERROR
          A request was made to start a shell, but this request failed.
static int SOCKET_TIMEOUT
          The API detected a socket timeout
static int UNEXPECTED_TERMINATION
          The connection unexpectedly terminated and so the connection can no longer be used.
static int UNSUPPORTED_ALGORITHM
          In setting up a context an algorithm was specified that is not supported by the API.
 
Constructor Summary
SshException(int reason, java.lang.Throwable cause)
          Create an exception with the given cause and reason.
SshException(java.lang.String msg, int reason)
          Create an exception with the given description and reason.
SshException(java.lang.String msg, int reason, java.lang.Throwable cause)
          Create an exception with the given description cause, reason.
SshException(java.lang.String msg, java.lang.Throwable cause)
          Create an exception with the given description and cause.
SshException(java.lang.Throwable cause)
          Create an exception by providing the cause of the error.
SshException(java.lang.Throwable cause, int reason)
           
 
Method Summary
 java.lang.Throwable getCause()
          If an INTERNAL_ERROR reason is given this method MAY return the cause of the error.
 int getReason()
          Get the reason for the exception
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNEXPECTED_TERMINATION

public static final int UNEXPECTED_TERMINATION
The connection unexpectedly terminated and so the connection can no longer be used. The exception message will contain the message from the exception that caused the termination.

See Also:
Constant Field Values

REMOTE_HOST_DISCONNECTED

public static final int REMOTE_HOST_DISCONNECTED
The remote host disconnected following the normal SSH protocol disconnection procedure. The exception message will contain the message received from the remote host that describes the reason for the disconnection

See Also:
Constant Field Values

PROTOCOL_VIOLATION

public static final int PROTOCOL_VIOLATION
The SSH protocol was violated in some way by the remote host and the connection has been terminated. The exception message will contain a description of the protocol violation.

See Also:
Constant Field Values

BAD_API_USAGE

public static final int BAD_API_USAGE
The API has encountered an error because of incorrect usage. The state of the connection upon receiving this exception is unknown.

See Also:
Constant Field Values

INTERNAL_ERROR

public static final int INTERNAL_ERROR
An internal error occured within the API; in all cases contact 3sp.com support with the details of this error and the state of the connection when receiving this exception is unknown.

See Also:
Constant Field Values

CHANNEL_FAILURE

public static final int CHANNEL_FAILURE
Indicates that a channel has failed; this is used by channel implementations (such as port forwarding or session channels) to indicate that the channel has critically failed. Upon receiving this exception you should check the connection state to determine whether its still possible to use the connection.

See Also:
Constant Field Values

UNSUPPORTED_ALGORITHM

public static final int UNSUPPORTED_ALGORITHM
In setting up a context an algorithm was specified that is not supported by the API.

See Also:
Constant Field Values

CANCELLED_CONNECTION

public static final int CANCELLED_CONNECTION
The user cancelled the connection.

See Also:
Constant Field Values

KEY_EXCHANGE_FAILED

public static final int KEY_EXCHANGE_FAILED
The protocol failed to negotiate a transport algorithm or failed to verify the host key of the remote host.

See Also:
Constant Field Values

CONNECT_FAILED

public static final int CONNECT_FAILED
The connection could not be established.

See Also:
Constant Field Values

LICENSE_ERROR

public static final int LICENSE_ERROR
The API is not licensed!

See Also:
Constant Field Values

CONNECTION_CLOSED

public static final int CONNECTION_CLOSED
An attempt has been made to use a connection that has been closed and is no longer valid.

See Also:
Constant Field Values

AGENT_ERROR

public static final int AGENT_ERROR
An error has occured within the agent.

See Also:
Constant Field Values

FORWARDING_ERROR

public static final int FORWARDING_ERROR
An error has occured the port forwarding system.

See Also:
Constant Field Values

PSEUDO_TTY_ERROR

public static final int PSEUDO_TTY_ERROR
A request was made to allocate a pseudo terminal, but this request failed.

See Also:
Constant Field Values

SHELL_ERROR

public static final int SHELL_ERROR
A request was made to start a shell, but this request failed.

See Also:
Constant Field Values

SESSION_STREAM_ERROR

public static final int SESSION_STREAM_ERROR
An error occured whilst accessing a sessions streams

See Also:
Constant Field Values

JCE_ERROR

public static final int JCE_ERROR
An error occured in the JCE; typically this would result from Maverick attempting to use an algorithm that the JCE does not support.

See Also:
Constant Field Values

POSSIBLE_CORRUPT_FILE

public static final int POSSIBLE_CORRUPT_FILE
An error occured reading the contents of a file. Its possible that the file is not correctly formatted.

See Also:
Constant Field Values

SCP_TRANSFER_CANCELLED

public static final int SCP_TRANSFER_CANCELLED
The user cancelled an active SCP transfer.

See Also:
Constant Field Values

SOCKET_TIMEOUT

public static final int SOCKET_TIMEOUT
The API detected a socket timeout

See Also:
Constant Field Values

PROMPT_TIMEOUT

public static final int PROMPT_TIMEOUT
The Shell class failed to detect the prompt.

See Also:
Constant Field Values
Constructor Detail

SshException

public SshException(java.lang.String msg,
                    int reason)
Create an exception with the given description and reason.

Parameters:
msg -
reason -

SshException

public SshException(int reason,
                    java.lang.Throwable cause)
Create an exception with the given cause and reason.

Parameters:
reason -
cause -

SshException

public SshException(java.lang.Throwable cause,
                    int reason)

SshException

public SshException(java.lang.String msg,
                    java.lang.Throwable cause)
Create an exception with the given description and cause. The reason given will be INTERNAL_ERROR.

Parameters:
msg -
cause -

SshException

public SshException(java.lang.Throwable cause)
Create an exception by providing the cause of the error. This constructor sets the reason to INTERNAL_ERROR.

Parameters:
cause -

SshException

public SshException(java.lang.String msg,
                    int reason,
                    java.lang.Throwable cause)
Create an exception with the given description cause, reason.

Parameters:
msg -
reason -
cause -
Method Detail

getReason

public int getReason()
Get the reason for the exception

Returns:

getCause

public java.lang.Throwable getCause()
If an INTERNAL_ERROR reason is given this method MAY return the cause of the error.

Returns:


Copyright © 2003 3SP LTD. All Rights Reserved.