JAFS API v2

org.openafs.jafs
Class AFSException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--org.openafs.jafs.AFSException
All Implemented Interfaces:
Serializable

public class AFSException
extends Exception

An exception indicating that an error has occurred in the Java AFS API, in the Java AFS JNI, or in the AFS file system.

Version:
1.0, 04/16/2001
See Also:
Exception, Serialized Form

Field Summary
protected  int errno
          The AFS specific error number (code).
 
Fields inherited from class java.lang.Exception
 
Constructor Summary
AFSException(int errno)
          Constructs an AFSException with the specified error code.
AFSException(String reason)
          Constructs an AFSException with the specified detail message.
AFSException(String reason, int errno)
          Constructs an AFSException with the specified detail message and specified error code.
 
Method Summary
 String getAFSMessage()
          Returns the AFS error message string defined by the ErrorTable class.
 String getAFSMessage(Locale locale)
          Returns the AFS error message defined by the ErrorTable class.
 int getErrorCode()
          Returns the AFS specific error number (code).
 String getMessage()
          Returns the error message string of this exception.
 String getMessage(Locale locale)
          Returns the locale specific error message string of this exception.
 String toString()
          Returns a string representation of this AFS Exception.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

errno

protected int errno
The AFS specific error number (code).

See Also:
getErrorCode()
Constructor Detail

AFSException

public AFSException(String reason)
Constructs an AFSException with the specified detail message.

Parameters:
reason - the detail message.

AFSException

public AFSException(int errno)
Constructs an AFSException with the specified error code. This constructor will also generate the appropriate error message respective to the specified error code.

Parameters:
errno - the AFS error number (error code).

AFSException

public AFSException(String reason,
                    int errno)
Constructs an AFSException with the specified detail message and specified error code. In this constructor the specified detail message overrides the default AFS error message defined by the ErrorTable class. Therefore, to retrieve the AFS specific error message, you must use the getAFSMessage() method. The getMessage() method will return the message specified in this constructor.

Parameters:
reason - the detail message.
errno - the AFS error number (error code).
Method Detail

getErrorCode

public int getErrorCode()
Returns the AFS specific error number (code). This code can be interpreted by use of the ErrorTable class method ErrorTable.getMessage(int).

Returns:
the AFS error code of this AFSException object.
See Also:
ErrorTable.getMessage(int)

getMessage

public String getMessage()
Returns the error message string of this exception.

Overrides:
getMessage in class Throwable
Returns:
the error message string of this exception object.
See Also:
getAFSMessage()

getMessage

public String getMessage(Locale locale)
Returns the locale specific error message string of this exception.

Parameters:
locale - the locale for which this message will be displayed
Returns:
the error message string of this exception object.
See Also:
getAFSMessage()

getAFSMessage

public String getAFSMessage()
Returns the AFS error message string defined by the ErrorTable class. The message will be formatted according to the default Locale.

This message is also available from this object's super class method getMessage. However, this method will always return the string message associated with the actual AFS error code/number specified, whereas the getMessage() method will return the string message intended for this Exception object, which may be an overridden message defined in the constructor of this Exception.

Returns:
the AFS error message string of this exception object.
See Also:
getAFSMessage(Locale), AFSException(String, int), ErrorTable.getMessage(int), Throwable.getMessage()

getAFSMessage

public String getAFSMessage(Locale locale)
Returns the AFS error message defined by the ErrorTable class. The message will be formatted according to the specified Locale.

This message is also available from this object's super class method getMessage. However, this method will always return the string message associated with the actual AFS error code/number specified, whereas the getMessage() method will return the string message intended for this Exception object, which may be an overridden message defined in the constructor of this Exception.

Parameters:
locale - the locale for which this message will be displayed
Returns:
the AFS error message string of this exception object.
See Also:
getAFSMessage(), AFSException(String, int), ErrorTable.getMessage(int, Locale), Throwable.getMessage()

toString

public String toString()
Returns a string representation of this AFS Exception.

The message will be formatted according to the specified Locale.

Overrides:
toString in class Throwable
Returns:
the AFS error message string of this exception object.
See Also:
getAFSMessage(), ErrorTable.getMessage(int), Throwable.getMessage()

JAFS API v2