public class DAP2Exception
extends java.lang.Exception
Unlike the other OPeNDAP exceptions, this one contains extra methods to
get the various fields sent by the server, and a parse
method
to parse the Error
sent from the server.
Modifier and Type | Field and Description |
---|---|
static int |
CANNOT_READ_FILE
The file specified by the OPeNDAP URL can not be read.
|
static int |
JAVA_PROGRAM
This Error contains Java bytecode.
|
static int |
MALFORMED_EXPR
The expression specified in the OPeNDAP URL is not valid.
|
static int |
NO_AUTHORIZATION
The user has no authorization to read the OPeNDAP URL.
|
static int |
NO_PROGRAM
This Error does not contain a program.
|
static int |
NO_SUCH_FILE
The file specified by the OPeNDAP URL does not exist.
|
static int |
NO_SUCH_VARIABLE
The variable specified in the OPeNDAP URL does not exist.
|
static int |
TCL_PROGRAM
This Error contains TCL code.
|
static int |
UNDEFINED_ERROR
Undefined error.
|
static int |
UNDEFINED_PROG_TYPE
Undefined program type.
|
static int |
UNKNOWN_ERROR
Unknown error.
|
Constructor and Description |
---|
DAP2Exception()
Construct an empty
DAP2Exception . |
DAP2Exception(java.lang.Exception cause)
Construct a
DAP2Exception with the given causal exception. |
DAP2Exception(int code,
java.lang.Exception cause)
Construct a
DAP2Exception with the given causal exception. |
DAP2Exception(int code,
java.lang.String msg)
Construct a
DAP2Exception with the given message. |
DAP2Exception(java.lang.String msg)
Construct a
DAP2Exception . |
Modifier and Type | Method and Description |
---|---|
int |
getErrorCode()
Returns the error code.
|
java.lang.String |
getErrorMessage()
Returns the error message.
|
java.lang.String |
getMessage()
Returns the detail message of this throwable object.
|
java.lang.String |
getProgramSource()
Returns the program source.
|
int |
getProgramType()
Returns the program type.
|
boolean |
parse(java.io.InputStream stream)
Reads an Error description from the named InputStream.
|
void |
print(java.io.OutputStream os)
Print the Error message on the given
OutputStream . |
void |
print(java.io.PrintWriter os)
Print the Error message on the given
PrintWriter . |
void |
setErrorCode(int code)
Sets the error code.
|
void |
setErrorMessage(java.lang.String msg)
Sets the error message.
|
void |
setProgramSource(java.lang.String source)
Sets the program source.
|
void |
setProgramType(int type)
Sets the program type.
|
public static final int UNDEFINED_ERROR
public static final int UNKNOWN_ERROR
public static final int NO_SUCH_FILE
public static final int NO_SUCH_VARIABLE
public static final int MALFORMED_EXPR
public static final int NO_AUTHORIZATION
public static final int CANNOT_READ_FILE
public static final int UNDEFINED_PROG_TYPE
public static final int NO_PROGRAM
public static final int JAVA_PROGRAM
public static final int TCL_PROGRAM
public DAP2Exception()
DAP2Exception
.public DAP2Exception(java.lang.String msg)
DAP2Exception
.public DAP2Exception(int code, java.lang.String msg)
DAP2Exception
with the given message.code
- the error coremsg
- the error messagepublic DAP2Exception(java.lang.Exception cause)
DAP2Exception
with the given causal exception.cause
- the causing exceptionpublic DAP2Exception(int code, java.lang.Exception cause)
DAP2Exception
with the given causal exception.cause
- the causing exceptionpublic final int getErrorCode()
public final java.lang.String getErrorMessage()
public final int getProgramType()
public final java.lang.String getProgramSource()
public java.lang.String getMessage()
getMessage
in class java.lang.Throwable
public final void setErrorCode(int code)
code
- the error code.public final void setErrorMessage(java.lang.String msg)
msg
- the error message.public final void setProgramType(int type)
type
- the program type.public final void setProgramSource(java.lang.String source)
source
- the program source.public final boolean parse(java.io.InputStream stream)
Error
, and regenerate it as a DAP2Exception
.stream
- the text containing the Error
to parse.public void print(java.io.PrintWriter os)
PrintWriter
.
This code can be used by servlets to throw DAP2Exception to client.os
- the PrintWriter
to use for output.public final void print(java.io.OutputStream os)
OutputStream
.os
- the OutputStream
to use for output.print(PrintWriter)