[Dive4elements-commits] [PATCH] Avoid NPE in sediment density factory and return a valid density if no exists
Wald Commits
scm-commit at wald.intevation.org
Mon Apr 15 17:04:42 CEST 2013
# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1366038278 -7200
# Node ID 84e02b3f7a4f1ba775770e322845c14b19f3adf4
# Parent 06f3a36a83b61009642b69b650653df0543da49b
Avoid NPE in sediment density factory and return a valid density if no exists.
diff -r 06f3a36a83b6 -r 84e02b3f7a4f flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentDensity.java
--- 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(
diff -r 06f3a36a83b6 -r 84e02b3f7a4f flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentDensityFactory.java
--- 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();
More information about the Dive4elements-commits
mailing list