mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 13:20:57 +00:00
fixed NPEs for non-overall leaderboard deserialization
This commit is contained in:
1 parent
7fd3ac25ae
commit
f9fa0e35a8
1 file changed
+25
-9
+25
-9
@@ -233,18 +233,34 @@ public class LeaderboardMasterDataJsonDeserializer implements JsonDeserializer<L
|
||||
}
|
||||
|
||||
public static ScoringScheme deserializeScoringScheme(JSONObject jsonObject, DomainFactory domainFactory) {
|
||||
String type = (String) jsonObject.get(LeaderboardMasterDataJsonSerializer.FIELD_TYPE);
|
||||
return domainFactory.createScoringScheme(ScoringSchemeType.valueOf(type));
|
||||
final ScoringScheme result;
|
||||
if (jsonObject == null) {
|
||||
result = null;
|
||||
} else {
|
||||
String type = (String) jsonObject.get(LeaderboardMasterDataJsonSerializer.FIELD_TYPE);
|
||||
if (type == null) {
|
||||
result = null;
|
||||
} else {
|
||||
result = domainFactory.createScoringScheme(ScoringSchemeType.valueOf(type));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static int[] deserializeResultDesicardingRule(JSONObject jsonObject) {
|
||||
JSONArray indeces = (JSONArray) jsonObject.get(LeaderboardMasterDataJsonSerializer.FIELD_INDICES);
|
||||
if (indeces == null) {
|
||||
return null;
|
||||
}
|
||||
int[] result = new int[indeces.size()];
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = ((Long) indeces.get(i)).intValue();
|
||||
final int[] result;
|
||||
if (jsonObject == null) {
|
||||
result = null;
|
||||
} else {
|
||||
JSONArray indeces = (JSONArray) jsonObject.get(LeaderboardMasterDataJsonSerializer.FIELD_INDICES);
|
||||
if (indeces == null) {
|
||||
result = null;
|
||||
} else {
|
||||
result = new int[indeces.size()];
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = ((Long) indeces.get(i)).intValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user