[Dive4elements-commits] [PATCH] avoid NPE in time interval import (made by R. Renkert)

Wald Commits scm-commit at wald.intevation.org
Mon Apr 22 10:48:41 CEST 2013


# HG changeset patch
# User Tom Gottfried <tom.gottfried at intevation.de>
# Date 1366620517 -7200
# Node ID 5e3c9027e09c100d48a7f6da48862ecca4930315
# Parent  ebec12def170acbd8c3e8ddef5a9c74b0e1a880d
avoid NPE in time interval import (made by R. Renkert)

diff -r ebec12def170 -r 5e3c9027e09c flys-backend/src/main/java/de/intevation/flys/importer/ImportTimeInterval.java
--- 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;
         }
     }
 


More information about the Dive4elements-commits mailing list