Package javax.xml.xquery
Class XQException
java.lang.Object
java.lang.Throwable
java.lang.Exception
javax.xml.xquery.XQException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
XQQueryException
An exception that provides information on XQJ, XQuery or other errors
reported by an XQJ implementation.
Each
Note that
It is possible that during the processing of a query that one or more errors could occur, each with their own potential causal relationship. This means that when an XQJ application catches an
An
Each
XQException provides several kinds of information:
- a string describing the error. This is used as the Java
Exception message, available via the method
getMessage. - the cause of the error. This is used as the Java Exception
cause, available via the method
getCause. - the vendor code identifying the error. Available via the
method
getVendorCode. Refer to the vendor documentation which specific codes can be returned. - a chain of
XQExceptionobjects. If more than one error occurred the exceptions are referenced via this chain.
Note that
XQException has a subclass
XQQueryException providing more detailed
information about errors that occurred during the processing of a query.
An implementation throws a base XQException when an error
occurs in the XQJ implementation. Further, implementations are encouraged to
use the more detailed XQQueryException in case of an
error reported by the XQuery engine.
It is possible that during the processing of a query that one or more errors could occur, each with their own potential causal relationship. This means that when an XQJ application catches an
XQException, there is a possibility that there may be
additional XQException objects chained to the original
thrown XQException. To access the additional chained
XQException objects, an application would recursively
invoke getNextException until a null value is
returned.
An
XQException may have a causal relationship, which
consists of one or more Throwable instances which caused
the XQException to be thrown. The application may
recursively call the method getCause, until a null
value is returned, to navigate the chain of causes.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionXQException(String message) Constructs anXQExceptionobject with a given message.XQException(String message, String vendorCode) Constructs anXQExceptionobject with a given message and vendor code. -
Method Summary
Modifier and TypeMethodDescriptionReturns the nextXQExceptionin the chain ornullif none.Gets the vendor code associated with this exception ornullif none.voidsetNextException(XQException next) Adds anXQExceptionto the chain of exceptions.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
XQException
Constructs anXQExceptionobject with a given message. An optional chain of additionalXQExceptionobjects may be set subsequently usingsetNextException.- Parameters:
message- the description of the error.nullindicates that the message string is non existant
-
XQException
Constructs anXQExceptionobject with a given message and vendor code. An optional chain of additionalXQExceptionobjects may be set subsequently usingsetNextException.- Parameters:
message- the description of the error.nullindicates that the message string is non existantvendorCode- a vendor-specific string identifying the error.nullindicates there is no vendor code or it is unknown
-
-
Method Details
-
getVendorCode
Gets the vendor code associated with this exception ornullif none. A vendor code is a vendor-specific string identifying the failure in a computer-comparable manner. For example, "NOCONNECT" if unable to connect or "DIVBYZERO" if division by zero occurred within the XQuery.- Returns:
- the vendor code string, or
nullif none available
-
getNextException
Returns the nextXQExceptionin the chain ornullif none.- Returns:
- the next exception, or
nullif none
-
setNextException
Adds anXQExceptionto the chain of exceptions.- Parameters:
next- the next exception to be added to the chain of exceptions
-