Details
-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
None
-
None
Description
tldr;
So the “getName()” method can return a null.And if the thing that is trying to use the value and does not protect against getting a null back then that thing using the null value blows up. ( That is the bug. )
-------------------------------
Carey Black 17 hours ago
java.lang.NullPointerException
at edu.internet2.middleware.subject.provider.SubjectImpl.getName(SubjectImpl.java:245)
I bet you have a subject that does not have a name in your Subject Source.
Add logging for this. // I think it should show you details about subject’s by source and ID. But it may still take some work to get the “problem” one…log4j.logger.edu.internet2.middleware.grouper.subj.cache.SubjectSourceCache = DEBUG
Liam Hoekenga 16 hours ago
The docs suggest that that shouldn’t be fatal
getName
public String getName()
Gets this Subject’s name.
Specified by:
getName in interface Subject
Returns:
name or null if not there
yea.. “Returns name or null”… So the “getName()” method can return a null.And if the thing that is trying to use the value and does not protect against getting a null back then that thing using the null value blows up. ( That is the bug. )And your stack trace points right at it.
SubjectSourceCache.java:1873
—
if (attributes != null && attributes.containsKey(nameAttribute) && attributes.get(nameAttribute).size() > 0) {
When attributes.get(nameAttribute) is null then calling “.size()” on null is an NPE.Should have also had a
&& attributes.get(nameAttribute) != null
before the size check. Well, if the size check is really necessary at that point. ( An empty string seems like a string to me. And a much better thing, maybe with a logged warning, to return instead of a null. )Basically the attributes Map has the key but no value. ( Which is exactly as documented for the .getName() that was called to add the name value to the Map. )