SimpleAuthenticationInfo.merge() NullPointerException

When using the AllSuccessfulModularAuthenticationStrategy with the ModularRealmAuthenticator in 0.9.0-RC1, a NullPointerException is thrown when the method ModularRealmAuthenticator.doMultiRealmAuthentication(..) attempts to merge the first realm's AuthenticationInfo into the aggregate.

It seems to be caused by this piece of code in SimpleAuthenticationInfo.merge():

// this is null!
Object thisCredentials = getCredentials();

Object otherCredentials = info.getCredentials();

if (!(thisCredentials instanceof Collection)) {
Set newSet = new HashSet();
if (thisCredentials != null) {
newSet.add(thisCredentials);
// this doesn't get called because thisCredentials is null
setCredentials(newSet);

}
}

// At this point, the credentials should be a collection
Collection credentialCollection = (Collection) getCredentials();
// both of these paths will throw a NPE
if (otherCredentials instanceof Collection) {
credentialCollection.addAll((Collection) otherCredentials);

} else if (otherCredentials != null) {
credentialCollection.add(otherCredentials);
}

thisCredentials is null and is never set to an empty HashSet as it seems it should be, causing the following credentialCollection.add calls to fail.

Re: SimpleAuthenticationInfo.merge() NullPointerException

Thanks so much for reporting this!

We've got it entered in Jira and we'll get the fix out asap for RC2. I hope to do that this coming week.

Regards,

Les

Re: Re: SimpleAuthenticationInfo.merge() NullPointerException

This issue has been fixed. Thanks!