changeset 561:3f39756e0c8a

Fixed a NPE. Now it is possible to put an Mapservice without an Layer into the Request-Document of am Mapviewer-Interface-Call. gnv/trunk@667 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 09 Feb 2010 13:05:49 +0000
parents 1fb55ff633db
children 4df3347d6d1d
files gnv/ChangeLog gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java
diffstat 2 files changed, 19 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/gnv/ChangeLog	Fri Feb 05 14:16:03 2010 +0000
+++ b/gnv/ChangeLog	Tue Feb 09 13:05:49 2010 +0000
@@ -1,3 +1,9 @@
+2010-02-09  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java (createMetaDataRequestBody): 
+	  Fixed a NPE. Now it is possible to  put an Mapservice without an Layer into
+	  the Request-Document of am Mapviewer-Interface-Call.
+
 2010-02-05  Ingo Weinzierl <ingo.weinzierl@intevation.de>
 
 	  Issue170
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java	Fri Feb 05 14:16:03 2010 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java	Tue Feb 09 13:05:49 2010 +0000
@@ -862,17 +862,19 @@
             mapServiceNode.setAttribute("id", mapService.getID());
             mapServiceNode.setAttribute("type", mapService.getType());
             mapServiceNode.setAttribute("url", mapService.getURL());
-            Iterator<Layer> layer = mapService.getLayer().iterator();
-            while (layer.hasNext()){
-                Layer tmpLayer = layer.next();
-                Element layerNode = this.createArtifactElement(document,
-                                                               "layer");
-                layerNode.setAttribute("id", tmpLayer.getID());
-                layerNode.setAttribute("name", tmpLayer.getName());
-                layerNode.setAttribute("isgrouplayer",
-                                       ""+tmpLayer.isGroupLayer());
-                layerNode.setAttribute("parentid", tmpLayer.parentID());
-                mapServiceNode.appendChild(layerNode);
+            if (mapService.getLayer() != null){
+                Iterator<Layer> layer = mapService.getLayer().iterator();
+                while (layer.hasNext()){
+                    Layer tmpLayer = layer.next();
+                    Element layerNode = this.createArtifactElement(document,
+                                                                   "layer");
+                    layerNode.setAttribute("id", tmpLayer.getID());
+                    layerNode.setAttribute("name", tmpLayer.getName());
+                    layerNode.setAttribute("isgrouplayer",
+                                           ""+tmpLayer.isGroupLayer());
+                    layerNode.setAttribute("parentid", tmpLayer.parentID());
+                    mapServiceNode.appendChild(layerNode);
+                }
             }
             mapServicesNode.appendChild(mapServiceNode);
         }

http://dive4elements.wald.intevation.org