[Dive4elements-commits] [PATCH] MainValuesArtifact: Possible NPE fix

Wald Commits scm-commit at wald.intevation.org
Thu Mar 14 12:27:22 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1363260880 -3600
# Node ID 394841a66c146db85a9640e3c2a27e083ecb51bf
# Parent  f6478773a5bb2c8f87932a55aa6c910d331e977f
MainValuesArtifact: Possible NPE fix.

diff -r f6478773a5bb -r 394841a66c14 flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java	Thu Mar 14 12:24:29 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java	Thu Mar 14 12:34:40 2013 +0100
@@ -175,14 +175,15 @@
         logger.debug("MainValuesArtifact.initialize");
         FLYSArtifact winfo = (FLYSArtifact) artifact;
         RangeAccess rangeAccess = new RangeAccess(winfo, null);
-        double [] locations = rangeAccess.getLocations();
+        double [] locations = rangeAccess.getKmRange();
+
         if (locations != null) {
             double location = locations[0];
             addData("ld_locations", new DefaultStateData("ld_locations", null, null,
                     String.valueOf(location)));
         }
         else {
-            logger.warn("No location for mainvalues given.");
+            logger.error("No location for mainvalues given.");
         }
         importData(winfo, "river");
     }
@@ -247,7 +248,13 @@
         // TODO use helper to get location as double
         String locationStr = getDataAsString("ld_locations");
 
-        if (river == null || locationStr == null) {
+        if (river == null) {
+            logger.error("River is null");
+            return null;
+        }
+
+        if (locationStr == null) {
+            logger.error("Locationstr is null");
             return null;
         }
 


More information about the Dive4elements-commits mailing list