Skip to Content.
Sympa Menu

mace-opensaml-users - Re: NullPointerException in SAMLAssertion

Subject: OpenSAML user discussion

List archive

Re: NullPointerException in SAMLAssertion


Chronological Thread 
  • From: W Strater <>
  • To: Scott Cantor <>,
  • Subject: Re: NullPointerException in SAMLAssertion
  • Date: Sun, 26 Feb 2006 19:09:01 -0800 (PST)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=M6t2NwiRzecWZis8vm9Wh7RS90xP13oGg7U3mf8c5kB+pEs7ddGSv16XWLr0UpHpqFLxupd/v5w3l3OY+p7fRX+cP11XCH4YWxvjwPDLNihzMDHwZgYDR9l/w6NGPs+ugDXqLv20uHOuVjsXR0h2y+zG9HbVcm36i0Lt7udL588= ;

I tried your suggestion but have yet been able to get it to work. I did find out where root was beeing set to null and causing the null pointer exception. The SAMLObject.toDOM(Document, boolean) method makes a call to Document.adoptNode. This method is returning null and so root is set to null.

Thanks, Wes.

----- Original Message ----
From: Scott Cantor <>
To: W Strater <>;
Sent: Sunday, February 26, 2006 4:36:52 PM
Subject: RE: NullPointerException in SAMLAssertion

> Test 1 is my own code. Test 2 was copied from WSS4J test
> code, test\wssec\TestWSSecurityST2.java. Both are triggered
> during the WSSignEnvelope.build call because I logged the
> SAMLAssertion before doing the sign. If I log the assertion,
> I get the null pointer exception because root is null so
> assertion is null and it is not dirty. If I do not log the
> assertion, I do not get the exception.

I don't see any way for this to happen. But leaving that aside, you want to
take better care of the document situation. If you want to log it and you
know you're going to pump it into an existing document later, then use
toDOM() up front with that document and then print it. Then it won't have to
play games with the DOM later.

> // This is what sets up the situation for the null pointer exception.
> // If I comment out this line, I won't get the exception.
>     System.out.println(assertion);

Call toDOM(envelope.getBody().getOwnerDocument()) first.

That said, I still don't see any way for that specific error to happen. I'd
have to look into it, and without any experience with WSS4J, I really don't
have time. If you figure out what the actual bug is, I'll fix it (assuming
it's mine and not theirs).

-- Scott




Archive powered by MHonArc 2.6.16.

Top of Page