Package javax.xml.xquery
Class XQException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- javax.xml.xquery.XQException
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
XQQueryException
public class XQException extends java.lang.Exception
An exception that provides information on XQJ, XQuery or other errors reported by an XQJ implementation.
EachXQException
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
XQException
objects. If more than one error occurred the exceptions are referenced via this chain.
Note thatXQException
has a subclassXQQueryException
providing more detailed information about errors that occurred during the processing of a query. An implementation throws a baseXQException
when an error occurs in the XQJ implementation. Further, implementations are encouraged to use the more detailedXQQueryException
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 anXQException
, there is a possibility that there may be additionalXQException
objects chained to the original thrownXQException
. To access the additional chainedXQException
objects, an application would recursively invokegetNextException
until anull
value is returned.
AnXQException
may have a causal relationship, which consists of one or moreThrowable
instances which caused theXQException
to be thrown. The application may recursively call the methodgetCause
, until anull
value is returned, to navigate the chain of causes.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description XQException(java.lang.String message)
Constructs anXQException
object with a given message.XQException(java.lang.String message, java.lang.String vendorCode)
Constructs anXQException
object with a given message and vendor code.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XQException
getNextException()
Returns the nextXQException
in the chain ornull
if none.java.lang.String
getVendorCode()
Gets the vendor code associated with this exception ornull
if none.void
setNextException(XQException next)
Adds anXQException
to the chain of exceptions.
-
-
-
Constructor Detail
-
XQException
public XQException(java.lang.String message)
Constructs anXQException
object with a given message. An optional chain of additionalXQException
objects may be set subsequently usingsetNextException
.- Parameters:
message
- the description of the error.null
indicates that the message string is non existant
-
XQException
public XQException(java.lang.String message, java.lang.String vendorCode)
Constructs anXQException
object with a given message and vendor code. An optional chain of additionalXQException
objects may be set subsequently usingsetNextException
.- Parameters:
message
- the description of the error.null
indicates that the message string is non existantvendorCode
- a vendor-specific string identifying the error.null
indicates there is no vendor code or it is unknown
-
-
Method Detail
-
getVendorCode
public java.lang.String getVendorCode()
Gets the vendor code associated with this exception ornull
if 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
null
if none available
-
getNextException
public XQException getNextException()
Returns the nextXQException
in the chain ornull
if none.- Returns:
- the next exception, or
null
if none
-
setNextException
public void setNextException(XQException next)
Adds anXQException
to the chain of exceptions.- Parameters:
next
- the next exception to be added to the chain of exceptions
-
-