changeset 1225:2bc06e7f6fb5

We might want to serialize an object without geom. This happens e.g. if an object is returned to the client before a geometry has been constructed, due to validation error.
author Tom Gottfried <tom@intevation.de>
date Fri, 09 Dec 2016 16:32:10 +0100
parents 73ad827faa81
children 85a8221e957a
files src/main/java/de/intevation/lada/model/stammdaten/Ort.java
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/model/stammdaten/Ort.java	Fri Dec 09 15:34:15 2016 +0100
+++ b/src/main/java/de/intevation/lada/model/stammdaten/Ort.java	Fri Dec 09 16:32:10 2016 +0100
@@ -197,7 +197,10 @@
     }
 
     public Double getLatitude() {
-        return this.geom.getY();
+        // We might want to serialize an object without geom
+        return this.geom != null
+            ? this.geom.getY()
+            : null;
     }
 
     public Timestamp getLetzteAenderung() {
@@ -209,7 +212,10 @@
     }
 
     public Double getLongitude() {
-        return this.geom.getX();
+        // We might want to serialize an object without geom
+        return this.geom != null
+            ? this.geom.getX()
+            : null;
     }
 
     public String getMpArt() {
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)