mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-10 14:20:55 +00:00
# some fixes for NPE
This commit is contained in:
1 parent
91006ec964
commit
458c583d9c
10 files changed
+111
-75
No files matched your search
+12
-4
@@ -26,10 +26,18 @@ public class MarkJsonSerializer extends BaseControlPointJsonSerializer implement
|
||||
JSONObject result = super.serialize(mark);
|
||||
|
||||
result.put(FIELD_ID, mark.getId().toString());
|
||||
result.put(FIELD_COLOR, mark.getColor());
|
||||
result.put(FIELD_PATTERN, mark.getPattern());
|
||||
result.put(FIELD_SHAPE, mark.getShape());
|
||||
result.put(FIELD_TYPE, mark.getType().toString());
|
||||
if (mark.getColor() != null) {
|
||||
result.put(FIELD_COLOR, mark.getColor());
|
||||
}
|
||||
if (mark.getPattern() != null) {
|
||||
result.put(FIELD_PATTERN, mark.getPattern());
|
||||
}
|
||||
if (mark.getShape() != null) {
|
||||
result.put(FIELD_SHAPE, mark.getShape());
|
||||
}
|
||||
if (mark.getType() != null) {
|
||||
result.put(FIELD_TYPE, mark.getType());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+2
@@ -10,6 +10,7 @@ import com.sap.sailing.server.gateway.serialization.JsonSerializer;
|
||||
|
||||
public class RegattaJsonSerializer implements JsonSerializer<Regatta> {
|
||||
public static final String FIELD_ID = "id";
|
||||
public static final String FIELD_NAME = "name";
|
||||
public static final String FIELD_BASE_NAME = "baseName";
|
||||
public static final String FIELD_BOAT_CLASS = "boatClass";
|
||||
public static final String FIELD_RACES = "races";
|
||||
@@ -30,6 +31,7 @@ public class RegattaJsonSerializer implements JsonSerializer<Regatta> {
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
result.put(FIELD_ID, object.getId().toString());
|
||||
result.put(FIELD_NAME, object.getName());
|
||||
result.put(FIELD_BASE_NAME, object.getBaseName());
|
||||
result.put(FIELD_BOAT_CLASS, boatClassSerializer.serialize(object.getBoatClass()));
|
||||
|
||||
|
||||
+3
-1
@@ -24,7 +24,9 @@ public class WaypointJsonSerializer implements JsonSerializer<Waypoint> {
|
||||
|
||||
result.put(FIELD_ID, object.getId().toString());
|
||||
result.put(FIELD_NAME, object.getName());
|
||||
result.put(FIELD_PASSING_SIDE, object.getPassingSide().toString());
|
||||
if (object.getPassingSide() != null) {
|
||||
result.put(FIELD_PASSING_SIDE, object.getPassingSide());
|
||||
}
|
||||
result.put(FIELD_CONTROL_POINT,
|
||||
controlPointSerializer.serialize(object.getControlPoint()));
|
||||
|
||||
|
||||
Reference in new issue
Block a user