softwareconstruction240 / autograder

Autograder for BYU's CS 240 Chess project
https://cs240.click
2 stars 2 forks source link

Fix commit verification null exception #357

Closed frozenfrank closed 5 months ago

frozenfrank commented 5 months ago

Overview

This fixes the null pointer exception that occurred in the commit verification process when students resubmitted their phase after a blocked submission but before it was manually approved.

Complete Solution

Beyond simply fixing the error, it also introduces improved error handling so that future errors will be caught and reported, but grading will still continue and the submission can still be saved in the database. Additionally, the call signatures of related functions have been adjusted to minimize the possibility of null pointer issues in the future.

Key adjustments are the titles of each commit in the PR.

Notifying Error Message

This is the sample exception it will resolve:

java.lang.NullPointerException: Cannot invoke "edu.byu.cs.model.Submission$ScoreVerification.penaltyPct()" because "scoreVerification" is null
        at edu.byu.cs.autograder.git.GitHelper.preserveOriginalVerification(GitHelper.java:128)
        at edu.byu.cs.autograder.git.GitHelper.verifyCommitRequirements(GitHelper.java:88)
        at edu.byu.cs.autograder.git.GitHelper.setUp(GitHelper.java:49)
        at edu.byu.cs.autograder.Grader.run(Grader.java:86)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1583)