Skip to Content.
Sympa Menu

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

Subject: OpenSAML user discussion

List archive

Re: ClassCastException in SAMLResponse#toDOM()


Chronological Thread 
  • From: Hideki YOKOTA <>
  • To: Scott Cantor <>,
  • Subject: Re: ClassCastException in SAMLResponse#toDOM()
  • Date: Tue, 14 Feb 2006 16:11:30 +0900
  • Organization: NEC System Technologies, Ltd.

Hello Scott,

Thank you for your quick reply.
Reusing DOM works fine. I will also check CVS later.

Thank you again for your feedback.

Hideki

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

This appears to be the DOM deferral bug that was noticed after the release
of 1.1b. There's a fix in cvs, but it hasn't been released because the use
case is a little obscure.

You can work around the bug in most cases by reusing a common Document
instead of forcing adoption to happen. Just get the document from the
assertion parse (toDOM().getOwnerDocument()) and pass that to the
SAMLResponse.toDOM() method so that it reuses that DOM. That's more
efficient anyway.

Alternatively I can point you at the fix, which is in the XML.java
classfile:

http://anoncvs.internet2.edu/cgi-bin/viewcvs.cgi/opensaml/java/src/org/opens
aml/XML.java.diff?r1=1.27.2.1&r2=1.27.2.2

You have to add:

dbf.setFeature(
"http://apache.org/xml/features/dom/defer-node-expansion";, false
);

when building the DocumentBuilderFactory. Default defers expansion and their
own DOM implementation doesn't check for this and fully expand when
required.

-- Scott





Archive powered by MHonArc 2.6.16.

Top of Page