sakaicontrib / gradebook1

0 stars 5 forks source link

Comparator on GradingEvent #18

Closed ottenhoff closed 3 years ago

ottenhoff commented 3 years ago

From @austin48 to the list:

`With Sakai 20.3 and the Gradebook Classic contrib tool, we're seeing a bug where updating a grade in gradebook classic throws an exception

29-Jun-2021 15:06:11.802 SEVERE [http-nio-8980-exec-6] org.apache.catalina.core.ApplicationDispatcher.invoke Servlet.service() for servlet [jsp] threw exception java.lang.ClassCastException: org.sakaiproject.tool.gradebook.GradingEvent cannot be cast to java.lang.Comparable at java.util.Arrays.mergeSort(Arrays.java:1348) at java.util.Arrays.legacyMergeSort(Arrays.java:1319) at java.util.Arrays.sort(Arrays.java:1310) at java.util.Arrays.sort(Arrays.java:1506) at java.util.ArrayList.sort(ArrayList.java:1464) at java.util.Collections.sort(Collections.java:143) at org.sakaiproject.tool.gradebook.ui.AssignmentDetailsBean$ScoreRow.(AssignmentDetailsBean.java:89) at org.sakaiproject.tool.gradebook.ui.AssignmentDetailsBean.init(AssignmentDetailsBean.java:464) at org.sakaiproject.tool.gradebook.ui.InitializableBean.startRenderResponse(InitializableBean.java:71) . . .

and the line it's failing on is

Collections.sort(gradingEvents);

I took a look at the edu-service's GradingEvent class in Sakai 19.6 vs 20.3 and a comparreTo() override function was removed and possibly replaced with a Comparator variable, compareByDateGraded?

Anyone have any ideas on how to fix this? Should I file a JIRA for edu-services? or an Issue (in GIT) for GBClassic? `

austin48 commented 3 years ago

https://jira.sakaiproject.org/browse/SAK-45742

austin48 commented 3 years ago

Thanks @ottenhoff! your fix works on our 20.3 instance