Skip to content

Commit 7e65c49

Browse files
committed
i_1109 Allow exception of bad values in scoreboard deserialization
Previously, Utilities.nullSafeToInt() and StringUtilities.getIntegerValue() were used to obtain the values of total_time and time. Basically, those routines would assign a value of zero if the string was empty or null, and, in the former case, if a bad string to integer conversion occurred. Now, since these are for score values, we will call Integer.parseInt() which will throw an exception if bad values are found. All values should be good at this point and this shouldn't happen, Tammy.
1 parent 01eafbf commit 7e65c49

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/edu/csus/ecs/pc2/clics/API202306/CLICSScore.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.fasterxml.jackson.annotation.JsonInclude;
66
import com.fasterxml.jackson.annotation.JsonProperty;
77

8-
import edu.csus.ecs.pc2.core.StringUtilities;
98
import edu.csus.ecs.pc2.core.Utilities;
109
import edu.csus.ecs.pc2.core.standings.TeamStanding;
1110

@@ -43,13 +42,14 @@ public CLICSScore() {
4342
* Fill in the properties for a team's score
4443
*
4544
* @param teamStanding The team's scoring information
45+
* @throws NumberFormatException if bad scores are in the standings
4646
*/
4747
public CLICSScore(TeamStanding teamStanding) {
4848
num_solved = Utilities.nullSafeToInt(teamStanding.getSolved(), 0);
49-
total_time = Utilities.nullSafeToInt(teamStanding.getPoints(), 0);
49+
total_time = Integer.parseInt(teamStanding.getPoints());
5050
if(num_solved > 0) {
5151
// Problem solution time is in minutes.
52-
time = StringUtilities.getIntegerValue(teamStanding.getLastSolved(), 0);
52+
time = Integer.parseInt(teamStanding.getLastSolved());
5353
}
5454
}
5555

0 commit comments

Comments
 (0)