Skip to content

Commit

Permalink
SAK-49489 Samigo cleanup NPEs related to lack of startDate when doing…
Browse files Browse the repository at this point in the history
… a quick publish (sakaiproject#12347)
  • Loading branch information
ottenhoff authored Feb 8, 2024
1 parent 2587f70 commit 91a919e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1966,7 +1966,7 @@ public String getExtendedTimeStartString() {
}

public Date getExtendedTimeStart() {
return this.extendedTime.getStartDate();
return this.extendedTime != null ? this.extendedTime.getStartDate() : null;
}

public void setExtendedTimeStartString(String exTimeStartString) {
Expand All @@ -1981,7 +1981,7 @@ public String getExtendedTimeDueString() {
}

public Date getExtendedTimeDue() {
return this.extendedTime.getDueDate();
return this.extendedTime != null ? this.extendedTime.getDueDate() : null;
}

public void setExtendedTimeDueString(String exTimeDueString) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ public PublishedAssessmentData preparePublishedAssessment(AssessmentData a){
// metadata
Set publishedMetaDataSet = preparePublishedMetaDataSet(
publishedAssessment, a.getAssessmentMetaDataSet());
log.debug("******* metadata set" + a.getAssessmentMetaDataSet());
log.debug("******* published metadata set" + publishedMetaDataSet);
log.debug("******* metadata set: {}", a.getAssessmentMetaDataSet());
log.debug("******* published metadata set: {}", publishedMetaDataSet);
publishedAssessment.setAssessmentMetaDataSet(publishedMetaDataSet);

// IPAddress
Expand Down Expand Up @@ -235,12 +235,15 @@ public PublishedAccessControl preparePublishedAccessControl(
if (a == null) {
return new PublishedAccessControl();
}

// If instructor does an instant-publish without viewing settings, we may not have a start date
final Date startDate = a.getStartDate() != null ? a.getStartDate() : new Date();
PublishedAccessControl publishedAccessControl = new PublishedAccessControl(
a.getSubmissionsAllowed(), a.getSubmissionsSaved(), a
.getAssessmentFormat(), a.getBookMarkingItem(), a
.getTimeLimit(), a.getTimedAssessment(), a
.getRetryAllowed(), a.getLateHandling(), a.getInstructorNotification(), a
.getStartDate(), a.getDueDate(), a.getScoreDate(), a
.getRetryAllowed(), a.getLateHandling(), a.getInstructorNotification(),
startDate, a.getDueDate(), a.getScoreDate(), a
.getFeedbackDate());
publishedAccessControl.setRetractDate(a.getRetractDate());
publishedAccessControl.setAutoSubmit(a.getAutoSubmit());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,13 @@ public void removeCalendarEvent(String siteId, String eventId){
try{
CalendarEvent calendarEvent = calendar.getEvent(eventId);
calendar.removeEvent(calendar.getEditEvent(calendarEvent.getId(), CalendarService.EVENT_REMOVE_CALENDAR));
}catch (PermissionException | InUseException | IdUnusedException e)
{
} catch (PermissionException | InUseException | IdUnusedException e) {
log.warn(e.getMessage(), e);
}
}

}catch (IdUnusedException | PermissionException e)
{
} catch (IdUnusedException e) {
log.debug("Calendar not found for site: {}", siteId);
} catch (PermissionException e) {
log.warn(e.getMessage(), e);
}
}
Expand Down

0 comments on commit 91a919e

Please sign in to comment.