Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
SAK-42630 Avoid a possible NPE when catching errors during assessment…
Browse files Browse the repository at this point in the history
… preview (sakaiproject#7435)

DeliveryActionListener has a large try/catch block that catches RuntimeException
and then adds an error the error log.

If an exception is caught for an assessment preview, the real error is masked
because the T&Q event logging code attempts to get an assessmentGradingId
which is null (and really there's nothing meaningful to log here since it's a
preview and the event log doesn't log previews).

So we should check for that and throw the real exception earlier before
attempting to update the event log.
  • Loading branch information
smarquard authored and Miguel Pellicer committed Oct 17, 2019
1 parent 439a9d0 commit 9215f83
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,12 @@ else if (action == DeliveryBean.TAKE_ASSESSMENT_VIA_URL) {
EventLogFacade eventLogFacade = new EventLogFacade();
EventLogData eventLogData = null;

if (delivery.getAssessmentGradingId() == null) {
// Probably an assessment preview
log.warn("No assessmentGradingId available for preview or delivery: this failure will not be recorded in the T&Q event log");
throw e;
}

List eventLogDataList = eventService.getEventLogData(delivery.getAssessmentGradingId());
if(eventLogDataList != null && eventLogDataList.size() > 0) {
eventLogData= (EventLogData) eventLogDataList.get(0);
Expand Down

0 comments on commit 9215f83

Please sign in to comment.