diff src/java/de/intevation/mxd/writer/MapScriptWriter.java @ 196:5350621a0294

Verify the SDE databse jointable attribute.
author raimund renkert <raimund.renkert@intevation.de>
date Wed, 20 Jul 2011 17:51:38 +0200
parents c640fb351f66
children cdbf2f2dca35
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java	Wed Jul 20 16:27:49 2011 +0200
+++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java	Wed Jul 20 17:51:38 2011 +0200
@@ -111,13 +111,15 @@
         //Write the map attributes.
         writeMap();
         //Write the layers.
-        writeLayer();
+	boolean ret = writeLayer();
         //Save the map.
-        mapObj cloneMap = map.cloneMap();
-
-        cloneMap.save(mapFilename);
-        logger.info("Mapfile created: " + mapFilename);
-        return true;
+	if (ret) {
+            mapObj cloneMap = map.cloneMap();
+            cloneMap.save(mapFilename);
+            logger.info("Mapfile created: " + mapFilename);
+            return true;
+	}
+	return false;
     }
 
     /**
@@ -180,7 +182,7 @@
     /**
      * Create layer objects and set the attributes.
      */
-    private void writeLayer() {
+    private boolean writeLayer() {
         logger.debug("writeLayer()");
         Element mapNode = (Element)XMLUtils.xpath(
             root,
@@ -278,6 +280,13 @@
                 layer.setProcessing("CLOSE_CONNECTION=defer");
                 layer.setProcessing("ATTRIBUTE_QUALIFIED=TRUE");
                 if(layerElement.hasAttribute("join_table")) {
+		    String join = layerElement.getAttribute("join_table");
+		    if (join.indexOf(".") <= 0) {
+		    	logger.warn ("Incomplete join table in layer " +
+				     layerElement.getAttribute("name") +
+				     ". Aborting.");
+			return false;
+		    }
                     layer.setProcessing(
                         "JOINTABLE=" +
                     layerElement.getAttribute("join_table"));
@@ -318,6 +327,7 @@
             //Write classes.
             writeClass(layer, layerElement);
         }
+	return true;
     }
 
     /**
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)