|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Throwable
java.lang.Exception
org.opensaml.SAMLException
Encapsulates a general SAML error.
If the runtime needs to pass through other types of exceptions, it must wrap those exceptions in a SAMLException or an exception derived from a SAMLxception.
The association with the SAML Status element is loose, but is intentional. The codes you pass into this object are embedded in nested sequence inside the XML representation. There is currently no support for the StatusDetail element.
Ideally, this would also inherit from SAMLObject, but Java is limited to single inheritance, so there's no way to inherit the functionality; instead we reimplement the SAMLObject code here. (Note that interfaces!=multiple inheritance and don't solve the problem.)
Field Summary | |
protected ArrayList |
codes
Collection of status codes (QNames) |
protected SAMLConfig |
config
OpenSAML configuration |
protected Exception |
e
Embedded exception, if any |
protected org.apache.log4j.Logger |
log
Class-specific logging object |
protected String |
msg
Status message embedded in exception |
protected SAMLObject |
parentObject
Back pointer to SAML "parent" to allow back-walking and prevent double-containment |
static QName |
REQUESTER
SAML Requester status code |
static QName |
RESPONDER
SAML Responder status code |
protected Node |
root
Root node of a DOM tree capturing the object |
static QName |
SUCCESS
SAML Success status code |
static QName |
VERSION
SAML Version Mismatch status code |
Constructor Summary | |
|
SAMLException(Collection codes)
Creates a new SAMLException |
|
SAMLException(Collection codes,
Exception e)
Creates a new SAMLException wrapping an existing exception |
|
SAMLException(Collection codes,
String msg)
Creates a new SAMLException |
|
SAMLException(Collection codes,
String msg,
Exception e)
Creates a new SAMLException from an existing exception. |
protected |
SAMLException(Element e)
Initializes an exception from a DOM tree |
|
SAMLException(String msg)
Creates a new SAMLException |
|
SAMLException(String msg,
Exception e)
Creates a new SAMLException |
Method Summary | |
Object |
clone()
Copies a SAML object such that no dependencies exist between the original and the copy. |
void |
fromDOM(Element e)
Handles initialization of exceptions from a DOM element |
Iterator |
getCodes()
Gets the status or fault code QNames |
Exception |
getException()
Returns the embedded exception, if any |
static SAMLException |
getInstance(Element e)
Locates an implementation class for an exception and constructs it based on the DOM provided. |
static SAMLException |
getInstance(InputStream in)
Locates an implementation class for an exception and constructs it based on the stream provided. |
String |
getMessage()
Returns a detail message for this exception |
SAMLObject |
getParent()
Returns the containing object, if any. |
SAMLException |
setParent(SAMLObject parent)
Informs the object that it is being inserted into a composite structure, allowing it to check for existing containment and throw an exception, preventing unexplained errors due to multiple object containment. |
Node |
toDOM()
Transforms the object into a DOM tree without an existing document context, including namespace declarations |
Node |
toDOM(boolean xmlns)
Transforms the object into a DOM tree without an existing document context |
Node |
toDOM(Document doc)
Transforms the object into a DOM tree using an existing document context, including namespace declarations |
Node |
toDOM(Document doc,
boolean xmlns)
Transforms the object into a DOM tree using an existing document context |
void |
toStream(OutputStream out)
Serializes the XML representation of a SAML Status to a stream |
String |
toString()
Overrides toString to pick up any embedded exception |
Methods inherited from class java.lang.Throwable |
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final QName SUCCESS
public static final QName REQUESTER
public static final QName RESPONDER
public static final QName VERSION
protected String msg
protected Exception e
protected ArrayList codes
protected Node root
protected SAMLObject parentObject
protected org.apache.log4j.Logger log
protected SAMLConfig config
Constructor Detail |
protected SAMLException(Element e) throws SAMLException
e
- The root of a DOM tree
SAMLException
- Raised if an exception occurs while constructing
the object.public SAMLException(String msg)
msg
- The detail messagepublic SAMLException(String msg, Exception e)
msg
- The detail messagee
- The exception to be wrapped in a SAMLExceptionpublic SAMLException(Collection codes)
codes
- A collection of QNamespublic SAMLException(Collection codes, String msg)
codes
- A collection of QNamesmsg
- The detail messagepublic SAMLException(Collection codes, Exception e)
The existing exception will be embedded in the new one, and its message will become the default message for the SAMLException.
codes
- A collection of QNamese
- The exception to be wrapped in a SAMLExceptionpublic SAMLException(Collection codes, String msg, Exception e)
The existing exception will be embedded in the new one, but the new exception will have its own message.
codes
- A collection of QNamesmsg
- The detail messagee
- The exception to be wrapped in a SAMLExceptionMethod Detail |
public static SAMLException getInstance(Element e) throws SAMLException
e
- The root of a DOM containing the SAML exception
SAMLException
- Thrown if an error occurs while constructing the objectpublic static SAMLException getInstance(InputStream in) throws SAMLException
in
- The stream to deserialize from
SAMLException
- Thrown if an error occurs while constructing the objectpublic SAMLException setParent(SAMLObject parent) throws SAMLException
parent
- The object into which this object is being inserted
SAMLException
- Raised if this object already has a parentpublic SAMLObject getParent()
public void fromDOM(Element e) throws SAMLException
e
-
SAMLException
- Raised if an exception occurs while initializing the objectpublic void toStream(OutputStream out) throws IOException, SAMLException
out
- Stream to use for output
IOException
- Raised if an I/O problem is detected
SAMLException
- Raised if the object is invalidpublic Node toDOM(Document doc, boolean xmlns) throws SAMLException
doc
- A Document object to use in manufacturing the treexmlns
- Include namespace(s) on root element?
SAMLException
- Raised if the object is incompletely definedpublic Node toDOM(boolean xmlns) throws SAMLException
xmlns
- Include namespace(s) on root element?
SAMLException
- Raised if the exception is invalidpublic Node toDOM(Document doc) throws SAMLException
doc
- A Document object to use in manufacturing the tree
SAMLException
- Raised if the exception is invalidpublic Node toDOM() throws SAMLException
SAMLException
- Raised if the exception is invalidpublic Iterator getCodes()
public String getMessage()
If there is an embedded exception, and if the SAMLException has no detail message of its own, this method will return the detail message from the embedded exception.
public Exception getException()
public String toString()
One quirk is that this method does not produce a serialized XML representation of the object. toString is oriented around the usual expectations of Exception clients, while toStream implements the behavior expected by SAMLObject clients.
public Object clone() throws CloneNotSupportedException
CloneNotSupportedException
Object.clone()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |