changeset 5780:5e3c9027e09c

avoid NPE in time interval import (made by R. Renkert)
author Tom Gottfried <tom.gottfried@intevation.de>
date Mon, 22 Apr 2013 10:48:37 +0200
parents ebec12def170
children a5d4904e6bb2 f145a0ce38f2 76d40d257c8c
files flys-backend/src/main/java/de/intevation/flys/importer/ImportTimeInterval.java
diffstat 1 files changed, 16 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportTimeInterval.java	Sun Apr 21 12:48:09 2013 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportTimeInterval.java	Mon Apr 22 10:48:37 2013 +0200
@@ -27,13 +27,24 @@
     }
 
     public ImportTimeInterval(Date startTime, Date stopTime) {
-        if (startTime.after(stopTime)) {
-            this.stopTime = startTime;
-            this.startTime = stopTime;
+	Date start;
+	Date stop;
+	if (startTime == null) {
+	    start = stopTime;
+	    stop = null;
+	}
+	else {
+	    start = startTime;
+	    stop = stopTime;
+	}
+
+        if (stop != null && start.after(stop)) {
+            this.stopTime = start;
+            this.startTime = stop;
         }
         else {
-            this.startTime = startTime;
-            this.stopTime  = stopTime;
+            this.startTime = start;
+            this.stopTime  = stop;
         }
     }
 

http://dive4elements.wald.intevation.org