Skip to Content.
Sympa Menu

mace-opensaml-users - ClassCastException in SAMLResponse#toDOM()

Subject: OpenSAML user discussion

List archive

ClassCastException in SAMLResponse#toDOM()


Chronological Thread 
  • From: Hideki YOKOTA <>
  • To:
  • Subject: ClassCastException in SAMLResponse#toDOM()
  • Date: Tue, 14 Feb 2006 13:42:47 +0900
  • Organization: NEC System Technologies, Ltd.

Hi all,

I am using opensaml 1.1b.

When I create SAMLResponse having SAMLAssertion which created from
InputStream,
I get ClassCastException from SAMLResponse#toDOM().

java.lang.ClassCastException
at
org.apache.xerces.dom.DeferredAttrNSImpl.synchronizeChildren(Unknown Source)
at org.apache.xerces.dom.AttrImpl.setOwnerDocument(Unknown Source)
at org.apache.xerces.dom.NamedNodeMapImpl.setOwnerDocument(Unknown
Source)
at org.apache.xerces.dom.ElementImpl.setOwnerDocument(Unknown Source)
at org.apache.xerces.dom.CoreDocumentImpl.adoptNode(Unknown Source)
at org.opensaml.SAMLObject.toDOM(SAMLObject.java:255)
at org.opensaml.SAMLAssertion.toDOM(SAMLAssertion.java:553)
at org.opensaml.SAMLObject.toDOM(SAMLObject.java:290)
at org.opensaml.SAMLResponse.toDOM(SAMLResponse.java:424)
at org.opensaml.SAMLObject.toDOM(SAMLObject.java:278)
at org.opensaml.SAMLSignedObject.toDOM(SAMLSignedObject.java:103)
at org.opensaml.SAMLObject.toDOM(SAMLObject.java:301)

The following is a sample code.
----------------------------------------------------
InputStream is = this.getClass().getResourceAsStream("sampleAssertion.xml");
SAMLAssertion assertion = new SAMLAssertion(is);

// if I do assertion.toString() here, this code goes well.
// assertion.toString();

SAMLResponse res = new SAMLResponse("id", new Date(), null, null,
Collections.singleton(assertion), null);

res.toDOM(); // ClassCastException happens here.
----------------------------------------------------

This code goes well If I call SAMLAssertion#toString()
before creating SAMLResponse. But I think this is a wrong way to escape.

Which is a right way to handle SAMLAssertion created from InputStream?

Thanks and Regards,

Hideki





Archive powered by MHonArc 2.6.16.

Top of Page