Spreadsheet export can cause NPE for some assessments
GENERAL
TESTING
GENERAL
TESTING
Description
is related to
Activity
Show:

Hui Tsao January 25, 2010 at 11:07 AM
2-6-x: r 72473.

Anthony Whyte January 25, 2010 at 7:33 AM
samigo-2.7.x, r 72454.
Stephen Marquard January 20, 2010 at 11:05 PM
Closing this as we have it in production successfuly in 2-6-x with no regressions.
Please could this be merged to 2-6-x and 2-7-x.
This appears to be a regression introduced by the change to add rationale to spreadsheet export. publishedItemData.getHasRationale() can be null, leading to an NPE when exporting to a spreadsheet, viz.
java.lang.NullPointerException
at org.sakaiproject.tool.assessment.facade.AssessmentGradingFacadeQueries.getExportResponsesData(AssessmentGradingFacadeQueries.java:1934)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:592)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy92.getExportResponsesData(Unknown Source)
at org.sakaiproject.tool.assessment.services.GradingService.getExportResponsesData(GradingService.java:1714)
at org.sakaiproject.tool.assessment.ui.bean.evaluation.ExportResponsesBean.getSpreadsheetData(ExportResponsesBean.java:192)
at org.sakaiproject.tool.assessment.ui.bean.evaluation.ExportResponsesBean.exportExcel(ExportResponsesBean.java:174)
Can be fixed by this patch against 2-6-x (line numbers may not be correct as we have some other local patches in this file)
Index: samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AssessmentGradingFacadeQueries.java
===================================================================
— samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AssessmentGradingFacadeQueries.java (revision 68361)
+++ samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AssessmentGradingFacadeQueries.java (working copy)
@@ -1927,7 +1931,7 @@
// taking care of rationale
if (!addRationale && (typeId.equals(TypeIfc.MULTIPLE_CHOICE) || typeId.equals(TypeIfc.MULTIPLE_CORRECT) || typeId.equals(TypeIfc.MULTIPLE_CORRECT_SINGLE_SELECTION) || typeId.equals(TypeIfc.TRUE_FALSE))) {
log.debug("MULTIPLE_CHOICE or MULTIPLE_CORRECT or MULTIPLE_CORRECT_SINGLE_SELECTION or TRUE_FALSE");
- if (publishedItemData.getHasRationale()) {
+ if (publishedItemData.getHasRationale() != null && publishedItemData.getHasRationale() ) {
addRationale = true;
rationale = grade.getRationale();
if (rationale == null) {