Skip to content

Commit

Permalink
SAK-33719 Bulk file download - NullPointer getDateSubmitted, submitte…
Browse files Browse the repository at this point in the history
…dText, s.getFeedbackText(), (sakaiproject#5111)
  • Loading branch information
axxter99 authored and ern committed Dec 12, 2017
1 parent 1dc2b84 commit b3a83f6
Showing 1 changed file with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2765,7 +2765,8 @@ private void zipSubmissions(String assignmentReference, String assignmentTitle,
submittersString = escapeInvalidCharsEntry(submittersString);
// Work out if submission is late.
String latenessStatus = whenSubmissionMade(s);

log.debug("latenessStatus: " + latenessStatus);

String anonTitle = resourceLoader.getString("grading.anonymous.title");
String fullAnonId = s.getId() + " " + anonTitle;

Expand All @@ -2781,20 +2782,29 @@ private void zipSubmissions(String assignmentReference, String assignmentTitle,

// SAK-17606
if (!isAnon) {
log.debug("Zip user: " + submitters[i].toString());
params[0] = submitters[i].getDisplayId();
params[1] = submitters[i].getEid();
params[2] = submitters[i].getLastName();
params[3] = submitters[i].getFirstName();
params[4] = s.getGrade(); // TODO may need to look at this
params[5] = s.getDateSubmitted().toString(); // TODO may need to be formatted
if (s.getDateSubmitted() != null) {
params[5] = s.getDateSubmitted().toString(); // TODO may need to be formatted
} else {
params[5] = "";
}
params[6] = latenessStatus;
} else {
params[0] = fullAnonId;
params[1] = fullAnonId;
params[2] = anonTitle;
params[3] = anonTitle;
params[4] = s.getGrade();
params[5] = s.getDateSubmitted().toString(); // TODO same as above
if (s.getDateSubmitted() != null) {
params[5] = s.getDateSubmitted().toString(); // TODO may need to be formatted
} else {
params[5] = "";
}
params[6] = latenessStatus;
}
sheet.addRow(params);
Expand Down Expand Up @@ -2841,20 +2851,25 @@ private void zipSubmissions(String assignmentReference, String assignmentTitle,
}
ZipEntry textEntry = new ZipEntry(submittersNameString + "_submissionText" + AssignmentConstants.ZIP_SUBMITTED_TEXT_FILE_TYPE);
out.putNextEntry(textEntry);
byte[] text = submittedText.getBytes();
out.write(text);
textEntry.setSize(text.length);
if (submittedText != null) {
byte[] text = submittedText.getBytes();
out.write(text);
textEntry.setSize(text.length);
}
out.closeEntry();

}

// include student submission feedback text
if (withFeedbackText) {
// create a feedbackText file into zip
ZipEntry fTextEntry = new ZipEntry(submittersName + "feedbackText.html");
out.putNextEntry(fTextEntry);
byte[] fText = s.getFeedbackText().getBytes();
out.write(fText);
fTextEntry.setSize(fText.length);
if (s.getFeedbackText() != null) {
byte[] fText = s.getFeedbackText().getBytes();
out.write(fText);
fTextEntry.setSize(fText.length);
}
out.closeEntry();
}
}
Expand Down

0 comments on commit b3a83f6

Please sign in to comment.