[Building Sakai] samigo error

Niebel, William (wdn5e) wdn5e at eservices.virginia.edu
Mon Nov 4 04:57:59 PST 2013


Neil, which version of Sakai are you running?   Also, do you have any local source changes to org.sakaiproject.tool.assessment.ui.listener.author.AuthorActionListener.java?

The rest of this may be for other developers, instead of direct help to Neil.  I'm hoping that pointing a few things out might be helpful.

Regardless of there being specific data driving this NPE, it looks like Samigo's AssessmentSettingsBean.getGroupsAuthorized() sometimes returns null
and Samigo's AuthorActionListener.isActive() doesn't guard against that.

The fix for this may be as simple as initializing it to new String[0].   Can someone else familiar with this application logic weigh in on this being a safe approach?
This would probably fulfill the application logic intent here.  (Fine with me for someone else to take on making a patch for Neil.)

Speculating Neil's stack trace line
    caused by: java.lang.NullPointerException at org.sakaiproject.tool.assessment.ui.listener.author.AuthorActionListener.isActive(AuthorActionListener.java:321)
matches lines 320-1
    String [] groupsAuthorized = publishedAssessmentSettingsBean.getGroupsAuthorized();
    for (int i = 0; i < groupsAuthorized.length; i++) {
from https://source.sakaiproject.org/viewsvn/sam/trunk/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/AuthorActionListener.java?revision=107760&view=markup ,
the NPE would then be from groupsAuthorized being null, that is, that AssessmentSettingsBean.getGroupsAuthorized() returning null with Neil's run data.

This looks plausible from reviewing getGroupsAuthorized() at line 1715 in
https://source.sakaiproject.org/viewsvn/sam/trunk/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/AssessmentSettingsBean.java?view=markup
Its instance variable groupsAuthorized is returned (and in so doing may be conditionally set) by getGroupsAuthorized() and there are several paths through the code leaving this variable still uninitialized.
So the fix for this may be as simple as initializing it to new String[0] in that class.

Alternately (maybe additionally), getGroupsAuthorized() could be tightened up.  Reasoning through that logic shows that various combinations will return null,
involving the values of noGroupSelectedError, authz, authorizations;
whether noGroupSelectedError and groupsAuthorized were ever set;
and whether getGroupsAuthorized() ever earlier successfully set groupsAuthorized.

Again, though this may be somehow from wrong or unexpected data, this method should handle that.

Bill Niebel
University of Virginia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20131104/27ebf872/attachment.html 


More information about the sakai-dev mailing list