[Dive4elements-commits] [PATCH] Workaround for NPE in FloodMapState
Wald Commits
scm-commit at wald.intevation.org
Tue Nov 20 12:53:22 CET 2012
# HG changeset patch
# User Christian Lins <christian.lins at intevation.de>
# Date 1353412394 -3600
# Node ID 276d9bd3c77d66af77b995e567cdd672856ab8d2
# Parent bbd82bd8e5417952e6f162e4c3a11c830509b69f
Workaround for NPE in FloodMapState.
diff -r bbd82bd8e541 -r 276d9bd3c77d flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java Mon Nov 19 00:07:53 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java Tue Nov 20 12:53:14 2012 +0100
@@ -1,19 +1,5 @@
package de.intevation.flys.artifacts.states;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import org.geotools.feature.FeatureCollection;
-import org.geotools.feature.FeatureCollections;
-import org.geotools.feature.simple.SimpleFeatureBuilder;
-import org.opengis.feature.simple.SimpleFeature;
-import org.opengis.feature.simple.SimpleFeatureType;
-
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.LineString;
@@ -48,6 +34,20 @@
import de.intevation.flys.wsplgen.JobObserver;
import de.intevation.flys.wsplgen.Scheduler;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.geotools.feature.FeatureCollection;
+import org.geotools.feature.FeatureCollections;
+import org.geotools.feature.simple.SimpleFeatureBuilder;
+import org.opengis.feature.simple.SimpleFeature;
+import org.opengis.feature.simple.SimpleFeatureType;
+
public class FloodMapState
extends DefaultState
@@ -517,11 +517,11 @@
if (geom instanceof LineString) {
- geom = applyElevationAttribute(feature, (LineString) geom);
+ geom = applyElevationAttribute(feature, geom);
lines.add(feature);
}
else if (geom instanceof Polygon) {
- geom = applyElevationAttribute(feature, (Polygon) geom);
+ geom = applyElevationAttribute(feature, geom);
polygons.add(feature);
}
else {
@@ -743,8 +743,11 @@
protected WQKms getWQKms(FLYSArtifact flys, CallContext cc) {
String wspString = flys.getDataAsString(WSP_ARTIFACT);
- String[] parts = wspString.split(";");
-
+ if (wspString == null) {
+ logger.debug("getWQKms(): wspString == null");
+ return null;
+ }
+ String[] parts = wspString.split(";");
String otherArtifact = parts[0];
int idx = -1;
@@ -843,6 +846,7 @@
target.mkdir();
}
FileTools.walkTree(source, new FileTools.FileVisitor() {
+ @Override
public boolean visit(File file) {
if (!file.isDirectory()) {
String name = file.getName();
More information about the Dive4elements-commits
mailing list