mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-02 02:13:55 +00:00
avoid explicit cast to Double in Mongo persistence adapters; cast to Number instead and use doubleValue();
this should fix issues with wind databases after export/import where it seems that an exported even double value is imported again as an Integer object instead of the Double that it originally was written as.
This commit is contained in:
1 parent
9ba5122096
commit
767289f284
1 file changed
+4
-4
+4
-4
@@ -55,8 +55,8 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
|
||||
}
|
||||
|
||||
private Position loadPosition(DBObject object) {
|
||||
Double lat = (Double) object.get(FieldNames.LAT_DEG.name());
|
||||
Double lng = (Double) object.get(FieldNames.LNG_DEG.name());
|
||||
Double lat = ((Number) object.get(FieldNames.LAT_DEG.name())).doubleValue();
|
||||
Double lng = ((Number) object.get(FieldNames.LNG_DEG.name())).doubleValue();
|
||||
if (lat != null && lng != null) {
|
||||
return new DegreePosition(lat, lng);
|
||||
} else {
|
||||
@@ -69,8 +69,8 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
|
||||
}
|
||||
|
||||
private SpeedWithBearing loadSpeedWithBearing(DBObject object) {
|
||||
return new KnotSpeedWithBearingImpl((Double) object.get(FieldNames.KNOT_SPEED.name()),
|
||||
new DegreeBearingImpl((Double) object.get(FieldNames.DEGREE_BEARING.name())));
|
||||
return new KnotSpeedWithBearingImpl(((Number) object.get(FieldNames.KNOT_SPEED.name())).doubleValue(),
|
||||
new DegreeBearingImpl(((Number) object.get(FieldNames.DEGREE_BEARING.name())).doubleValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user