mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-16 02:38:44 +00:00
bug6226: added logging and fallback in case the CALCULATOR_VERSION is missing
This commit is contained in:
+11
-1
@@ -1,5 +1,7 @@
|
||||
package com.sap.sailing.domain.markpassinghash.impl;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
@@ -19,6 +21,8 @@ import com.sap.sse.common.Util.Pair;
|
||||
import com.sap.sse.common.Util.Triple;
|
||||
|
||||
public class MarkPassingRaceFingerprintImpl implements MarkPassingRaceFingerprint {
|
||||
private static final Logger logger = Logger.getLogger(MarkPassingRaceFingerprintImpl.class.getName());
|
||||
|
||||
private final int calculatorVersion;
|
||||
private final int competitorHash;
|
||||
private final TimePoint startOfTracking;
|
||||
@@ -70,7 +74,13 @@ public class MarkPassingRaceFingerprintImpl implements MarkPassingRaceFingerprin
|
||||
}
|
||||
|
||||
public MarkPassingRaceFingerprintImpl(JSONObject json) {
|
||||
this.calculatorVersion = ((Number) json.get(JSON_FIELDS.CALCULATOR_VERSION.name())).intValue();
|
||||
final Number calculatorVersionNumber = (Number) json.get(JSON_FIELDS.CALCULATOR_VERSION.name());
|
||||
if (calculatorVersionNumber == null) {
|
||||
this.calculatorVersion = -1;
|
||||
logger.warning("Mark passing fingerprint JSON document did not contain CALCULATOR_VERSION field: "+json);
|
||||
} else {
|
||||
this.calculatorVersion = calculatorVersionNumber.intValue();
|
||||
}
|
||||
this.competitorHash = ((Number) json.get(JSON_FIELDS.COMPETITOR_HASH.name())).intValue();
|
||||
this.startOfTracking = TimePoint.of((Long) json.get(JSON_FIELDS.START_OF_TRACKING_AS_MILLIS.name()));
|
||||
this.endOfTracking = TimePoint.of((Long) json.get(JSON_FIELDS.END_OF_TRACKING_AS_MILLIS.name()));
|
||||
|
||||
@@ -45,7 +45,9 @@ Require-Bundle: com.sap.sailing.domain,
|
||||
com.sap.sailing.server.gateway.serialization.shared.android,
|
||||
com.sap.sailing.shared.persistence,
|
||||
com.sap.sailing.competitorimport,
|
||||
org.apache.shiro.core;bundle-version="1.2.2"
|
||||
org.apache.shiro.core;bundle-version="1.2.2",
|
||||
net.bytebuddy.byte-buddy;bundle-version="1.14.12",
|
||||
net.bytebuddy.byte-buddy-agent;bundle-version="1.14.12"
|
||||
Import-Package: com.sap.sailing.domain.common,
|
||||
com.sap.sailing.domain.common.impl,
|
||||
com.sap.sailing.domain.common.orc,
|
||||
|
||||
Reference in New Issue
Block a user