Sites with multiple groups/sections with the same name cause publish/settings to crash

Description

If a site contains 2 or more groups or sections with the same name then samigo will crash when attempting to control settings or publish a quiz in that site. This relates to where it was partially but not entirely fixed. See the comments at the end of that jira for more details about when this can happen.

Here is the exception:
org.sakaiproject.portal.api.PortalHandlerException: org.sakaiproject.tool.api.ToolException: javax.servlet.jsp.JspException: null
at org.sakaiproject.portal.charon.handlers.ToolHandler.doPost(ToolHandler.java:73)
caused by: org.sakaiproject.tool.api.ToolException: javax.servlet.jsp.JspException: null
at org.sakaiproject.portal.charon.SkinnableCharonPortal.forwardTool(SkinnableCharonPortal.java:1221)
caused by: org.apache.jasper.JasperException: javax.servlet.jsp.JspException: null
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
caused by: javax.servlet.ServletException: javax.servlet.jsp.JspException: null
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
caused by: java.lang.NullPointerException
at com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer.renderOption(SelectManyCheckboxListRenderer.java:179)
at com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer.encodeEnd(SelectManyCheckboxListRenderer.java:156)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:720)
at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:623)
at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:546)
at com.sun.faces.taglib.html_basic.SelectManyCheckboxTag.doEndTag(SelectManyCheckboxTag.java:534)
.....

Activity

Show:

Aaron Zeckoski March 14, 2012 at 2:32 PM

Notes from

Earle R Nietzel added a comment - 03-Aug-2009 10:27
I have found out what causes this issue is in the following method
public SelectItem[] getGroupsForSite()
....
Set keySet = sortedSelectItems.keySet();
....
If there are groups with exactly the same name then this will reduce the size of the list that was orginally set up with:

groupSelectItems = new SelectItem[groups.size()];

Then there will be null values in groupSelectItems and this will cause the JSP to throw the NPE.

Brooke Biltimier added a comment - 10-Aug-2009 10:47
wouldn't the real issue be that groups with the same name are being created?

Earle R Nietzel added a comment - 10-Aug-2009 11:52
Agreed.

I would think if they wanted to use the set to weed out duplicate groups or sort that they would use the size of the set, and not use the original size of the list (asking for trouble)!

So before you populate the list recreate it with the size of the set.

groupSelectItems = new SelectItem[keySet.size()];

then populate the list.

Duplicate

Details

Priority

Affects versions

Components

Assignee

Reporter

Environment

sakai 2.7.1 (have not tested in newer versions)
Created March 14, 2012 at 2:31 PM
Updated April 17, 2018 at 8:25 AM
Resolved October 10, 2012 at 7:09 AM