NPE in getTFMCScores() exporting results to spreadsheett

Description

Exporting one particular assessment (local ref VULA-675), we get an NPE as such:

java.lang.NullPointerException
at org.sakaiproject.tool.assessment.ui.listener.evaluation.HistogramListener.getTFMCScores(HistogramListener.java:1090)
at org.sakaiproject.tool.assessment.ui.listener.evaluation.HistogramListener.doAnswerStatistics(HistogramListener.java:644)
at org.sakaiproject.tool.assessment.ui.listener.evaluation.HistogramListener.determineResults(HistogramListener.java:607)
at org.sakaiproject.tool.assessment.ui.listener.evaluation.HistogramListener.histogramScores(HistogramListener.java:372)
at org.sakaiproject.tool.assessment.ui.listener.evaluation.HistogramListener.getDetailedStatisticsSpreadsheetData(HistogramListener.java:1939)
at org.sakaiproject.tool.assessment.ui.bean.evaluation.ExportResponsesBean.getSpreadsheetData(ExportResponsesBean.java:181)
at org.sakaiproject.tool.assessment.ui.bean.evaluation.ExportResponsesBean.exportExcel(ExportResponsesBean.java:174)

Matched against the source, this appears to be an NPE in getTFMCScores() here:

// NEW
int[] heights = calColumnHeight(numarray, responses);
// int[] heights = calColumnHeight(numarray);
for (i = 0; i < bars.length; i++)
bars[i].setColumnHeight(Integer.toString(heights[i]));

from a null value of bars[i] for some value of i.

Attachments

1
  • 09 Jul 2010, 05:49 PM

relates to

Activity

Show:

Stephen Marquard August 31, 2010 at 1:47 AM

I'm going to reopen this because it's poor practice to catch an NPE rather than identify the underlying cause or at least check for null.

We will find a test case locally to provide more detail about what causes this.

Hui Tsao July 15, 2010 at 11:40 AM

Revision 79509 and 79510.

Sam Ottenhoff July 9, 2010 at 6:09 PM

One more NPE at the end of the file:

if (questionBean.getHistogramBars()[i].getIsCorrect()) {

Sam Ottenhoff July 9, 2010 at 5:49 PM

Patch against trunk attached

Sam Ottenhoff July 9, 2010 at 5:40 PM
Edited

Karen,

Can we add a simple try/catch like in SAM-748?

Fixed

Details

Priority

Affects versions

Fix versions

Assignee

Reporter

Created November 17, 2009 at 1:21 AM
Updated April 17, 2018 at 8:40 AM
Resolved October 25, 2012 at 8:51 AM

Flag notifications