Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-35899

Spreadsheet export can cause NPE for some assessments

    XMLWordPrintable

    Details

    • Previous Issue Keys:
      SAK-17402, SAM-709

      Description

      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) {

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  lydial@stanford.edu Lydia Li
                  Reporter:
                  smarquard Stephen Marquard
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Git Source Code