Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java @ 3303:96daa8a4c48f
Fix and workaround NullPointerExceptions
flys-artifacts/trunk@4988 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Fri, 13 Jul 2012 10:54:56 +0000 |
parents | 453d2d0c4258 |
children | 1b41dc00b1f7 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java Fri Jul 13 10:44:18 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java Fri Jul 13 10:54:56 2012 +0000 @@ -1,5 +1,14 @@ package de.intevation.flys.utils; +import de.intevation.artifacts.CallContext; +import de.intevation.artifacts.common.utils.Config; +import de.intevation.flys.artifacts.FLYSArtifact; +import de.intevation.flys.artifacts.model.LayerInfo; +import de.intevation.flys.artifacts.model.map.WMSDBLayerFacet; +import de.intevation.flys.artifacts.model.map.WMSLayerFacet; +import de.intevation.flys.artifacts.model.map.WSPLGENLayerFacet; +import de.intevation.flys.artifacts.resources.Resources; + import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; @@ -18,15 +27,6 @@ import org.geotools.data.shapefile.shp.ShapefileHeader; import org.geotools.data.shapefile.shp.ShapefileReader; -import de.intevation.artifacts.CallContext; -import de.intevation.artifacts.common.utils.Config; -import de.intevation.flys.artifacts.FLYSArtifact; -import de.intevation.flys.artifacts.model.LayerInfo; -import de.intevation.flys.artifacts.model.map.WMSDBLayerFacet; -import de.intevation.flys.artifacts.model.map.WMSLayerFacet; -import de.intevation.flys.artifacts.model.map.WSPLGENLayerFacet; -import de.intevation.flys.artifacts.resources.Resources; - /** * This class iterates over a bunch of directories, searches for meta * information coresponding to shapefiles and creates a mapfile which is used by @@ -67,7 +67,7 @@ private String velocityLogfile; private VelocityEngine velocityEngine; - private boolean lock[]; + private final boolean lock[]; @@ -610,7 +610,9 @@ layerinfo.setData(wms.getData()); layerinfo.setTitle(wms.getDescription()); layerinfo.setStyle(style); - layerinfo.setExtent(GeometryUtils.jtsBoundsToOLBounds(wms.getExtent())); + if(wms.getExtent() != null) { + layerinfo.setExtent(GeometryUtils.jtsBoundsToOLBounds(wms.getExtent())); + } layerinfo.setConnection(wms.getConnection()); layerinfo.setConnectionType(wms.getConnectionType()); layerinfo.setLabelItem(wms.getLabelItem());