changeset 5712:84e02b3f7a4f

Avoid NPE in sediment density factory and return a valid density if no exists.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 15 Apr 2013 17:04:38 +0200
parents 06f3a36a83b6
children f5d966428703
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentDensity.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentDensityFactory.java
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentDensity.java	Mon Apr 15 16:29:54 2013 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentDensity.java	Mon Apr 15 17:04:38 2013 +0200
@@ -78,7 +78,7 @@
                 }
             }
         }
-        return -1d;
+        return 1.8d;
     }
 
     private double getDensityAtKm(
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentDensityFactory.java	Mon Apr 15 16:29:54 2013 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentDensityFactory.java	Mon Apr 15 17:04:38 2013 +0200
@@ -81,7 +81,9 @@
         results = sqlQuery.list();
         SedimentDensity density = new SedimentDensity();
         for (Object[] row : results) {
-            density.addDensity((Double)row[0], (Double)row[1], (Integer)row[2]);
+            if (row[0] != null && row[1] != null && row[2] != null) {
+                density.addDensity((Double)row[0], (Double)row[1], (Integer)row[2]);
+            }
         }
 
         density.cleanUp();

http://dive4elements.wald.intevation.org