Mercurial > dive4elements > river
changeset 4569:276d9bd3c77d
Workaround for NPE in FloodMapState.
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Tue, 20 Nov 2012 12:53:14 +0100 |
parents | bbd82bd8e541 |
children | 8ca06d3040d0 |
files | flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java |
diffstat | 1 files changed, 22 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- 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();