Skip to content

For Scoring contests, handle empty score.txt file better #1223

@johnbrvc

Description

@johnbrvc

Describe the issue:
If the output validator (usually a custom validator may do this) creates an empty "score.txt" file, we get an NPE when it goes to convert the (empty) contents of the file to a double value.

It is understood that an output validator should probably not do this (create an empty score.txt file), but alas, a sloppy one may do it, and in fact, we have a case where one did.

To Reproduce:
Create a scoring contest using an output validate that can produce an empty score.txt. the NAC2026, challenge2024_test contest does this.

Expected behavior:
An empty score.txt file should be taken as if the file didn't exist, thereby returning the test data group's reject score.

Actual behavior:
An NPE occurs, effectively causing a WA to be returned. Depending on the type of grading the grader is doing, this could cause premature exiting from the grading procedure. That is, if "accept any" is set, and we bail of the first case where the score.txt is empty, we will never finish the grading, and it will be marked as WA.

Environment:
All.

Log Info:

260216 112134.736|INFO|Thread-5|log|  Test case 2 passed = No ; validator returns: Wrong Answer
260216 112134.737|WARNING|Thread-5|log|Exception during execute()
|java.lang.NullPointerException: Cannot invoke "String.trim()" because "in" is null
|    at jdk.internal.math.FloatingDecimal.readJavaFormatString (FloatingDecimal.java:1838)
|    at jdk.internal.math.FloatingDecimal.parseDouble (FloatingDecimal.java:110)
|    at java.lang.Double.parseDouble (Double.java:792)
|    at edu.csus.ecs.pc2.core.execute.Executable.getRunTestCaseScore (Executable.java:1145)
|    at edu.csus.ecs.pc2.core.execute.Executable.executeAndValidateDataSet (Executable.java:1098)
|    at edu.csus.ecs.pc2.core.execute.Executable.execute (Executable.java:563)
|    at edu.csus.ecs.pc2.core.execute.Executable.execute (Executable.java:387)
|    at edu.csus.ecs.pc2.ui.AutoJudgingMonitor.executeAndAutoJudgeRun (AutoJudgingMonitor.java:512)
|    at edu.csus.ecs.pc2.ui.AutoJudgingMonitor.attemptToFetchNextRun (AutoJudgingMonitor.java:741)
|    at edu.csus.ecs.pc2.ui.AutoJudgingMonitor.attemptToFetchNextRun (AutoJudgingMonitor.java:686)
|    at edu.csus.ecs.pc2.ui.AutoJudgingMonitor.access$100 (AutoJudgingMonitor.java:55)
|    at edu.csus.ecs.pc2.ui.AutoJudgingMonitor$ControlLoop.run (AutoJudgingMonitor.java:112)
|    at edu.csus.ecs.pc2.ui.AutoJudgingMonitor.startAutoJudging (AutoJudgingMonitor.java:878)
|    at edu.csus.ecs.pc2.ui.judge.AutoJudgeModule$1.run (AutoJudgeModule.java:116)
|    at java.lang.Thread.run (Thread.java:1583)

Screenshots:

Additional context:

Metadata

Metadata

Assignees

Labels

CLICS CCS UpdateChanges to update to the CLICS specificationNEXT ContestConsider fixing for next contetOne ApprovalA very low risk and low LOE PR/ChangePrimary CCSRequired for PC2 to act as primary CCSbugSomething isn't workinghigh priorityBugs that are high priority (to fix)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions