Package opendap.dap
Class DAP2Exception
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- opendap.dap.DAP2Exception
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DASException,DDSException,InvalidDimensionException
public class DAP2Exception extends Exception
Holds an exception thrown by OPeNDAP server to a client.Unlike the other OPeNDAP exceptions, this one contains extra methods to get the various fields sent by the server, and a
parsemethod to parse theErrorsent from the server.This class will be changing it's name to opendap.dap.DAP2Exception. I expect that it will be deprecated in the next release.
You've been warned.
Questions? Ask ndp@opendap.org.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intCANNOT_READ_FILEThe file specified by the OPeNDAP URL can not be read.static intJAVA_PROGRAMThis Error contains Java bytecode.static intMALFORMED_EXPRThe expression specified in the OPeNDAP URL is not valid.static intNO_AUTHORIZATIONThe user has no authorization to read the OPeNDAP URL.static intNO_PROGRAMThis Error does not contain a program.static intNO_SUCH_FILEThe file specified by the OPeNDAP URL does not exist.static intNO_SUCH_VARIABLEThe variable specified in the OPeNDAP URL does not exist.static intTCL_PROGRAMThis Error contains TCL code.static intUNDEFINED_ERRORUndefined error.static intUNDEFINED_PROG_TYPEUndefined program type.static intUNKNOWN_ERRORUnknown error.
-
Constructor Summary
Constructors Constructor Description DAP2Exception()Construct an emptyDAP2Exception.DAP2Exception(int code, Exception cause)Construct aDAP2Exceptionwith the given causal exception.DAP2Exception(int code, String msg)Construct aDAP2Exceptionwith the given message.DAP2Exception(Exception cause)Construct aDAP2Exceptionwith the given causal exception.DAP2Exception(String msg)Construct aDAP2Exception.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetErrorCode()Returns the error code.StringgetErrorMessage()Returns the error message.StringgetMessage()Returns the detail message of this throwable object.StringgetProgramSource()Returns the program source.intgetProgramType()Returns the program type.booleanparse(InputStream stream)Reads an Error description from the named InputStream.voidprint(OutputStream os)Print the Error message on the givenOutputStream.voidprint(PrintWriter os)Print the Error message on the givenPrintWriter.voidsetErrorCode(int code)Sets the error code.voidsetErrorMessage(String msg)Sets the error message.voidsetProgramSource(String source)Sets the program source.voidsetProgramType(int type)Sets the program type.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
UNDEFINED_ERROR
public static final int UNDEFINED_ERROR
Undefined error.- See Also:
- Constant Field Values
-
UNKNOWN_ERROR
public static final int UNKNOWN_ERROR
Unknown error.- See Also:
- Constant Field Values
-
NO_SUCH_FILE
public static final int NO_SUCH_FILE
The file specified by the OPeNDAP URL does not exist.- See Also:
- Constant Field Values
-
NO_SUCH_VARIABLE
public static final int NO_SUCH_VARIABLE
The variable specified in the OPeNDAP URL does not exist.- See Also:
- Constant Field Values
-
MALFORMED_EXPR
public static final int MALFORMED_EXPR
The expression specified in the OPeNDAP URL is not valid.- See Also:
- Constant Field Values
-
NO_AUTHORIZATION
public static final int NO_AUTHORIZATION
The user has no authorization to read the OPeNDAP URL.- See Also:
- Constant Field Values
-
CANNOT_READ_FILE
public static final int CANNOT_READ_FILE
The file specified by the OPeNDAP URL can not be read.- See Also:
- Constant Field Values
-
UNDEFINED_PROG_TYPE
public static final int UNDEFINED_PROG_TYPE
Undefined program type.- See Also:
- Constant Field Values
-
NO_PROGRAM
public static final int NO_PROGRAM
This Error does not contain a program.- See Also:
- Constant Field Values
-
JAVA_PROGRAM
public static final int JAVA_PROGRAM
This Error contains Java bytecode.- See Also:
- Constant Field Values
-
TCL_PROGRAM
public static final int TCL_PROGRAM
This Error contains TCL code.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DAP2Exception
public DAP2Exception()
Construct an emptyDAP2Exception.
-
DAP2Exception
public DAP2Exception(String msg)
Construct aDAP2Exception.
-
DAP2Exception
public DAP2Exception(int code, String msg)Construct aDAP2Exceptionwith the given message.- Parameters:
code- the error coremsg- the error message
-
DAP2Exception
public DAP2Exception(Exception cause)
Construct aDAP2Exceptionwith the given causal exception.- Parameters:
cause- the causing exception
-
DAP2Exception
public DAP2Exception(int code, Exception cause)Construct aDAP2Exceptionwith the given causal exception.- Parameters:
cause- the causing exception
-
-
Method Detail
-
getErrorCode
public final int getErrorCode()
Returns the error code.- Returns:
- the error code.
-
getErrorMessage
public final String getErrorMessage()
Returns the error message.- Returns:
- the error message.
-
getProgramType
public final int getProgramType()
Returns the program type.- Returns:
- the program type.
-
getProgramSource
public final String getProgramSource()
Returns the program source.- Returns:
- the program source.
-
getMessage
public String getMessage()
Returns the detail message of this throwable object.- Overrides:
getMessagein classThrowable- Returns:
- the detail message of this throwable object.
-
setErrorCode
public final void setErrorCode(int code)
Sets the error code.- Parameters:
code- the error code.
-
setErrorMessage
public final void setErrorMessage(String msg)
Sets the error message.- Parameters:
msg- the error message.
-
setProgramType
public final void setProgramType(int type)
Sets the program type.- Parameters:
type- the program type.
-
setProgramSource
public final void setProgramSource(String source)
Sets the program source.- Parameters:
source- the program source.
-
parse
public final boolean parse(InputStream stream)
Reads an Error description from the named InputStream. This method calls a generated parser to interpret an ASCII representation of anError, and regenerate it as aDAP2Exception.- Parameters:
stream- the text containing theErrorto parse.
-
print
public void print(PrintWriter os)
Print the Error message on the givenPrintWriter. This code can be used by servlets to throw DAP2Exception to client.- Parameters:
os- thePrintWriterto use for output.
-
print
public final void print(OutputStream os)
Print the Error message on the givenOutputStream.- Parameters:
os- theOutputStreamto use for output.- See Also:
print(PrintWriter)
-
-