Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAK-51005 Assignments invalid user can cause an NPE in peer review logic #13314

Merged
merged 5 commits into from
Feb 18, 2025

Conversation

ottenhoff
Copy link
Contributor

@ottenhoff ottenhoff commented Feb 14, 2025

@ern if you want any of this, please create a Jira.

The validUsers stuff seems fairly important. i believe event handling in assignments can throw an Exception causing important stuff (after saving an assignment) to fail ....

the PeerReview stuff is just optimization i think.

@ottenhoff ottenhoff changed the title accept until date is in the past; peer review is in the future SAK-51005 Assignments bad user avoid NPE during assignment save Feb 15, 2025
@ottenhoff ottenhoff marked this pull request as ready for review February 15, 2025 15:33
@ottenhoff ottenhoff requested a review from ern February 15, 2025 15:50
@@ -165,7 +161,7 @@ public void execute(String opaqueContext) {
AssignmentSubmission s = submissionIdMap.get(p.getId().getSubmissionId());
Optional<AssignmentSubmissionSubmitter> ass = assignmentService.getSubmissionSubmittee(s);//Next, increment the count for studentAssessorsMap
String submitterId = assignmentService.getSubmitterIdForAssignment(assignment, ass.get().getSubmitter());
Integer count = ass.isPresent() ? studentAssessorsMap.get(submitterId) : 0;
Integer count = studentAssessorsMap.get(submitterId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this doesn't introduce a potential NPE?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check is redundant because calling ass.get().getSubmitter() earlier already guarantees that the Optional is present—otherwise, an exception would have been thrown.

@ern ern changed the title SAK-51005 Assignments bad user avoid NPE during assignment save SAK-51005 Assignments invalid user can cause an NPE in peer review logic Feb 18, 2025
Copy link
Contributor

@ern ern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improved the logic and the use of Optionals that were not used correctly

@ottenhoff ottenhoff merged commit c00befd into sakaiproject:master Feb 18, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants