changeset 74:7eba97e8201b

Catch all exceptions in the MXDReader.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 26 May 2011 18:11:29 +0200 (2011-05-26)
parents acbe36fb45e0
children 9ea64427ac7e
files ChangeLog src/java/de/intevation/mxd/reader/ArrowMarkerSymbolReader.java src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java src/java/de/intevation/mxd/reader/ClassBreakRendererReader.java src/java/de/intevation/mxd/reader/FeatureLayerReader.java src/java/de/intevation/mxd/reader/GdbRasterCatalogLayerReader.java src/java/de/intevation/mxd/reader/HashLineSymbolReader.java src/java/de/intevation/mxd/reader/ILayerReader.java src/java/de/intevation/mxd/reader/IRendererReader.java src/java/de/intevation/mxd/reader/MXDReader.java src/java/de/intevation/mxd/reader/MarkerLineSymbolReader.java src/java/de/intevation/mxd/reader/MarkerSymbolReader.java src/java/de/intevation/mxd/reader/MultiLayerFillSymbolReader.java src/java/de/intevation/mxd/reader/MultiLayerLineSymbolReader.java src/java/de/intevation/mxd/reader/MultiLayerMarkerSymbolReader.java src/java/de/intevation/mxd/reader/PictureLineSymbolReader.java src/java/de/intevation/mxd/reader/PictureMarkerSymbolReader.java src/java/de/intevation/mxd/reader/SimpleFillSymbolReader.java src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java src/java/de/intevation/mxd/reader/SimpleMarkerSymbolReader.java src/java/de/intevation/mxd/reader/SimpleRendererReader.java src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java
diffstat 23 files changed, 208 insertions(+), 303 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu May 26 17:29:09 2011 +0200
+++ b/ChangeLog	Thu May 26 18:11:29 2011 +0200
@@ -1,3 +1,29 @@
+2011-05-26  Raimund Renkert  <raimund.renkert@intevation.de>
+
+	* src/java/de/intevation/mxd/reader/ArrowMarkerSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/ClassBreakRendererReader.java,
+	  src/java/de/intevation/mxd/reader/FeatureLayerReader.java,
+	  src/java/de/intevation/mxd/reader/GdbRasterCatalogLayerReader.java,
+	  src/java/de/intevation/mxd/reader/HashLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/ILayerReader.java,
+	  src/java/de/intevation/mxd/reader/IRendererReader.java,
+	  src/java/de/intevation/mxd/reader/MXDReader.java,
+	  src/java/de/intevation/mxd/reader/MarkerLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/MarkerSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/MultiLayerFillSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/MultiLayerLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/MultiLayerMarkerSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/PictureLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/PictureMarkerSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/SimpleFillSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/SimpleMarkerSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/SimpleRendererReader.java,
+	  src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
+	  Catch all exceptions in the MXDReader.
+
 2011-05-26  Raimund Renkert  <raimund.renkert@intevation.de>
 
 	* src/java/de/intevation/mxd/reader/ClassBreakRendererReader.java,
--- a/src/java/de/intevation/mxd/reader/ArrowMarkerSymbolReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/ArrowMarkerSymbolReader.java	Thu May 26 18:11:29 2011 +0200
@@ -84,16 +84,9 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element symbolElement;
-        try {
-            symbolElement = util.addSymbol(renderer);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element symbolElement = util.addSymbol(renderer);
 
         IColor c = symbol.getColor();
         symbolElement.setAttribute(
--- a/src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java	Thu May 26 18:11:29 2011 +0200
@@ -87,16 +87,9 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element symbolElement;
-        try {
-            symbolElement = util.addSymbol(renderer);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element symbolElement = util.addSymbol(renderer);
 
         symbolElement.setAttribute("name", symbol.getNameString());
         symbolElement.setAttribute("style", "line");
--- a/src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java	Thu May 26 18:11:29 2011 +0200
@@ -83,16 +83,9 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element symbolElement;
-        try {
-            symbolElement = util.addSymbol(renderer);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element symbolElement = util.addSymbol(renderer);
 
         IColor c = symbol.getColor();
         symbolElement.setAttribute(
--- a/src/java/de/intevation/mxd/reader/ClassBreakRendererReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/ClassBreakRendererReader.java	Thu May 26 18:11:29 2011 +0200
@@ -1,6 +1,6 @@
 package de.intevation.mxd.reader;
 
-import java.io.IOException;
+import java.lang.Exception;
 
 import org.apache.log4j.Logger;
 
@@ -69,59 +69,52 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
 
         for(int i = 0; i < renderer.getBreakCount(); i++){
-            Element rendererElement;
-            try {
-                rendererElement = util.addRenderer(layer);
-                rendererElement.setAttribute("value",
-                    String.valueOf(renderer.getBreak(i)));
+            Element rendererElement = util.addRenderer(layer);
+            rendererElement.setAttribute("value",
+                String.valueOf(renderer.getBreak(i)));
+            rendererElement.setAttribute(
+                "field_count",
+                String.valueOf(renderer.getFieldCount()));
+            for(int j = 0; j < renderer.getFieldCount(); j++) {
                 rendererElement.setAttribute(
-                    "field_count",
-                    String.valueOf(renderer.getFieldCount()));
-                for(int j = 0; j < renderer.getFieldCount(); j++) {
-                    rendererElement.setAttribute(
-                        "expression_field_" + j,
-                        renderer.getField(j));
-
-                }
-                rendererElement.setAttribute(
-                    "min_value",
-                    String.valueOf(renderer.getMinimumBreak()));
-                rendererElement.setAttribute("expression_operator", "<=");
+                    "expression_field_" + j,
+                    renderer.getField(j));
 
-                ISymbol sym = renderer.getSymbol(i);
-                MarkerSymbolReader markerReader = new MarkerSymbolReader();
-                LineSymbolReader lineReader = new LineSymbolReader();
-                FillSymbolReader fillReader = new FillSymbolReader();
-                if(markerReader.canRead(sym)) {
-                    markerReader.setSymbol(sym);
-                    markerReader.setUtil(util);
-                    markerReader.setParent(rendererElement);
-                    markerReader.read();
-                }
-                else if(lineReader.canRead(sym)) {
-                    lineReader.setSymbol(sym);
-                    lineReader.setUtil(util);
-                    lineReader.setParent(rendererElement);
-                    lineReader.read();
-                }
-                else if(fillReader.canRead(sym)) {
-                    fillReader.setSymbol(sym);
-                    fillReader.setUtil(util);
-                    fillReader.setParent(rendererElement);
-                    fillReader.read();
-                }
-                else {
-                    logger.debug("Not a known symbol type: " +
-                                 sym.getClass().toString());
-                }
             }
-            catch(Exception e) {
-                e.printStackTrace();
-                return null;
+            rendererElement.setAttribute(
+                "min_value",
+                String.valueOf(renderer.getMinimumBreak()));
+            rendererElement.setAttribute("expression_operator", "<=");
+
+            ISymbol sym = renderer.getSymbol(i);
+            MarkerSymbolReader markerReader = new MarkerSymbolReader();
+            LineSymbolReader lineReader = new LineSymbolReader();
+            FillSymbolReader fillReader = new FillSymbolReader();
+            if(markerReader.canRead(sym)) {
+                markerReader.setSymbol(sym);
+                markerReader.setUtil(util);
+                markerReader.setParent(rendererElement);
+                markerReader.read();
+            }
+            else if(lineReader.canRead(sym)) {
+                lineReader.setSymbol(sym);
+                lineReader.setUtil(util);
+                lineReader.setParent(rendererElement);
+                lineReader.read();
+            }
+            else if(fillReader.canRead(sym)) {
+                fillReader.setSymbol(sym);
+                fillReader.setUtil(util);
+                fillReader.setParent(rendererElement);
+                fillReader.read();
+            }
+            else {
+                logger.debug("Not a known symbol type: " +
+                             sym.getClass().toString());
             }
         }
         return layer;
--- a/src/java/de/intevation/mxd/reader/FeatureLayerReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/FeatureLayerReader.java	Thu May 26 18:11:29 2011 +0200
@@ -62,16 +62,9 @@
      * @return The layer XML element.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element layerElement;
-        try {
-            layerElement = util.addLayer();
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element layerElement = util.addLayer();
 
         layerElement.setAttribute("name", layer.getName());
         layerElement.setAttribute("min_scale",
--- a/src/java/de/intevation/mxd/reader/GdbRasterCatalogLayerReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/GdbRasterCatalogLayerReader.java	Thu May 26 18:11:29 2011 +0200
@@ -58,16 +58,9 @@
      * @return The layer XML element.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element layerElement;
-        try {
-            layerElement = util.addLayer();
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element layerElement = util.addLayer();
 
         layerElement.setAttribute("name", layer.getName());
         layerElement.setAttribute("min_scale",
--- a/src/java/de/intevation/mxd/reader/HashLineSymbolReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/HashLineSymbolReader.java	Thu May 26 18:11:29 2011 +0200
@@ -94,14 +94,7 @@
     public Element read()
     throws IOException {
         logger.debug("read()");
-        Element symbolElement;
-        try {
-            symbolElement = util.addSymbol(renderer);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element symbolElement = util.addSymbol(renderer);
 
         symbolElement.setAttribute("name", symbol.getNameString());
         symbolElement.setAttribute("style", "line");
--- a/src/java/de/intevation/mxd/reader/ILayerReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/ILayerReader.java	Thu May 26 18:11:29 2011 +0200
@@ -14,7 +14,7 @@
 public interface ILayerReader{
 
     void setUtil(MapToXMLUtils util);
-    Element read() throws IOException;
+    Element read() throws Exception;
 
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/src/java/de/intevation/mxd/reader/IRendererReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/IRendererReader.java	Thu May 26 18:11:29 2011 +0200
@@ -1,6 +1,6 @@
 package de.intevation.mxd.reader;
 
-import java.io.IOException;
+import java.lang.Exception;
 
 import org.w3c.dom.Element;
 
@@ -13,7 +13,7 @@
  */
 public interface IRendererReader{
 
-    Element read() throws IOException;
+    Element read() throws Exception;
 
     void setParent(Element parent);
     void setUtil(MapToXMLUtils util);
--- a/src/java/de/intevation/mxd/reader/MXDReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MXDReader.java	Thu May 26 18:11:29 2011 +0200
@@ -120,6 +120,7 @@
             for(int i = 0; i < map.getLayerCount();i++) {
                 ILayer layer = map.getLayer(i);
                 try {
+                    //TODO Implement wrapper for renderer reader
                     if (layer instanceof FeatureLayer) {
                         FeatureLayerReader lr = new FeatureLayerReader(layer);
                         lr.setUtil(util);
@@ -184,6 +185,7 @@
                 }
                 catch(Exception e) {
                     e.printStackTrace();
+                    return false;
                 }
             }
             util.print();
--- a/src/java/de/intevation/mxd/reader/MarkerLineSymbolReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MarkerLineSymbolReader.java	Thu May 26 18:11:29 2011 +0200
@@ -86,23 +86,18 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        try {
-            IMarkerSymbol sym = symbol.getMarkerSymbol();
-            if(sym instanceof MultiLayerMarkerSymbol) {
-                ISymbolReader sreader = new MultiLayerMarkerSymbolReader(sym);
-                sreader.setParent(renderer);
-                sreader.setUtil(util);
-                sreader.read();
-            }
-            else {
-                logger.debug("The type of " + sym.getClass().toString() +
-                             " is not implemented!");
-            }
+        IMarkerSymbol sym = symbol.getMarkerSymbol();
+        if(sym instanceof MultiLayerMarkerSymbol) {
+            ISymbolReader sreader = new MultiLayerMarkerSymbolReader(sym);
+            sreader.setParent(renderer);
+            sreader.setUtil(util);
+            sreader.read();
         }
-        catch (Exception e) {
-            e.printStackTrace();
+        else {
+            logger.debug("The type of " + sym.getClass().toString() +
+                         " is not implemented!");
         }
         return renderer;
     }
--- a/src/java/de/intevation/mxd/reader/MarkerSymbolReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MarkerSymbolReader.java	Thu May 26 18:11:29 2011 +0200
@@ -40,7 +40,8 @@
         this.symbol = null;
     }
 
-    public Element read() throws Exception {
+    public Element read()
+    throws Exception {
         if(symbol == null) {
             return parent;
         }
--- a/src/java/de/intevation/mxd/reader/MultiLayerFillSymbolReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MultiLayerFillSymbolReader.java	Thu May 26 18:11:29 2011 +0200
@@ -87,26 +87,20 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
         for(int i = 0; i < symbol.getLayerCount(); i++) {
-            try {
-                ISymbol sym = (ISymbol)symbol.getLayer(i);
+            ISymbol sym = (ISymbol)symbol.getLayer(i);
 
-                if(sym instanceof SimpleFillSymbol) {
-                    ISymbolReader sreader = new SimpleFillSymbolReader(sym);
-                    sreader.setParent(renderer);
-                    sreader.setUtil(util);
-                    sreader.read();
-                }
-                else {
-                    logger.debug("The type of " + sym.getClass().toString() +
-                                 " is not implemented!");
-                }
+            if(sym instanceof SimpleFillSymbol) {
+                ISymbolReader sreader = new SimpleFillSymbolReader(sym);
+                sreader.setParent(renderer);
+                sreader.setUtil(util);
+                sreader.read();
             }
-            catch(Exception e) {
-                e.printStackTrace();
-                return null;
+            else {
+                logger.debug("The type of " + sym.getClass().toString() +
+                             " is not implemented!");
             }
         }
         return renderer;
--- a/src/java/de/intevation/mxd/reader/MultiLayerLineSymbolReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MultiLayerLineSymbolReader.java	Thu May 26 18:11:29 2011 +0200
@@ -89,20 +89,14 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
         for(int i = 0; i < symbol.getLayerCount(); i++) {
-            try {
-                ISymbol sym = (ISymbol)symbol.getLayer(i);
-                ISymbolReader sreader = new LineSymbolReader(sym);
-                sreader.setParent(renderer);
-                sreader.setUtil(util);
-                sreader.read();
-            }
-            catch(Exception e) {
-                e.printStackTrace();
-                return null;
-            }
+            ISymbol sym = (ISymbol)symbol.getLayer(i);
+            ISymbolReader sreader = new LineSymbolReader(sym);
+            sreader.setParent(renderer);
+            sreader.setUtil(util);
+            sreader.read();
         }
         return renderer;
     }
--- a/src/java/de/intevation/mxd/reader/MultiLayerMarkerSymbolReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MultiLayerMarkerSymbolReader.java	Thu May 26 18:11:29 2011 +0200
@@ -79,19 +79,14 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
         for(int i = 0; i < symbol.getLayerCount(); i++) {
-            try {
-                ISymbol sym = (ISymbol)symbol.getLayer(i);
-                ISymbolReader sreader = new MarkerSymbolReader(sym);
-                sreader.setParent(renderer);
-                sreader.setUtil(util);
-                sreader.read();
-            }
-            catch(Exception e) {
-                e.printStackTrace();
-            }
+            ISymbol sym = (ISymbol)symbol.getLayer(i);
+            ISymbolReader sreader = new MarkerSymbolReader(sym);
+            sreader.setParent(renderer);
+            sreader.setUtil(util);
+            sreader.read();
         }
         return renderer;
     }
--- a/src/java/de/intevation/mxd/reader/PictureLineSymbolReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/PictureLineSymbolReader.java	Thu May 26 18:11:29 2011 +0200
@@ -86,16 +86,9 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element symbolElement;
-        try {
-            symbolElement = util.addSymbol(renderer);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element symbolElement = util.addSymbol(renderer);
 
         symbolElement.setAttribute("name", symbol.getNameString());
         symbolElement.setAttribute("style", "picture");
--- a/src/java/de/intevation/mxd/reader/PictureMarkerSymbolReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/PictureMarkerSymbolReader.java	Thu May 26 18:11:29 2011 +0200
@@ -82,16 +82,9 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element symbolElement;
-        try {
-            symbolElement = util.addSymbol(renderer);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element symbolElement = util.addSymbol(renderer);
 
         symbolElement.setAttribute(
             "angle",
--- a/src/java/de/intevation/mxd/reader/SimpleFillSymbolReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/SimpleFillSymbolReader.java	Thu May 26 18:11:29 2011 +0200
@@ -84,16 +84,9 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element symbolElement;
-        try {
-            symbolElement = util.addSymbol(renderer);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element symbolElement = util.addSymbol(renderer);
 
         symbolElement.setAttribute("name", symbol.getNameString());
         symbolElement.setAttribute("style", "fill");
@@ -139,22 +132,17 @@
                 String.valueOf(col.getTransparency()));
         }
 
-        try {
-            ILineSymbol ls = symbol.getOutline();
-            LineSymbolReader lsr = new LineSymbolReader();
-            if(lsr.canRead(ls)) {
-                lsr.setSymbol(ls);
-                lsr.setUtil(util);
-                lsr.setParent(symbolElement);
-                lsr.read();
-            }
-            else {
-                logger.debug("The type of " + ls.getClass().toString() +
-                             " is not implemented!");
-            }
+        ILineSymbol ls = symbol.getOutline();
+        LineSymbolReader lsr = new LineSymbolReader();
+        if(lsr.canRead(ls)) {
+            lsr.setSymbol(ls);
+            lsr.setUtil(util);
+            lsr.setParent(symbolElement);
+            lsr.read();
         }
-        catch(Exception e) {
-            e.printStackTrace();
+        else {
+            logger.debug("The type of " + ls.getClass().toString() +
+                         " is not implemented!");
         }
 
         return symbolElement;
--- a/src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java	Thu May 26 18:11:29 2011 +0200
@@ -84,16 +84,9 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element symbolElement;
-        try {
-            symbolElement = util.addSymbol(renderer);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element symbolElement = util.addSymbol(renderer);
 
         symbolElement.setAttribute("name", symbol.getNameString());
         symbolElement.setAttribute("style", "line");
--- a/src/java/de/intevation/mxd/reader/SimpleMarkerSymbolReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/SimpleMarkerSymbolReader.java	Thu May 26 18:11:29 2011 +0200
@@ -53,16 +53,9 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element symbolElement;
-        try {
-            symbolElement = util.addSymbol(parent);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element symbolElement = util.addSymbol(parent);
 
         symbolElement.setAttribute("name", symbol.getNameString());
         if(symbol.getStyle() == esriSimpleMarkerStyle.esriSMSCircle)
--- a/src/java/de/intevation/mxd/reader/SimpleRendererReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/SimpleRendererReader.java	Thu May 26 18:11:29 2011 +0200
@@ -75,46 +75,40 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
         Element rendererElement;
-        try {
-            rendererElement = util.addRenderer(layer);
-
-            rendererElement.setAttribute("label", renderer.getLabel());
-            rendererElement.setAttribute("description", renderer.getDescription());
-            symbol = renderer.getSymbol();
+        rendererElement = util.addRenderer(layer);
 
-            MarkerSymbolReader markerReader = new MarkerSymbolReader();
-            LineSymbolReader lineReader = new LineSymbolReader();
-            FillSymbolReader fillReader = new FillSymbolReader();
-            if(markerReader.canRead(symbol)) {
-                markerReader.setSymbol(symbol);
-                markerReader.setUtil(util);
-                markerReader.setParent(rendererElement);
-                markerReader.read();
-            }
-            else if(lineReader.canRead(symbol)) {
-                lineReader.setSymbol(symbol);
-                lineReader.setUtil(util);
-                lineReader.setParent(rendererElement);
-                lineReader.read();
-            }
-            else if(fillReader.canRead(symbol)) {
-                fillReader.setSymbol(symbol);
-                fillReader.setUtil(util);
-                fillReader.setParent(rendererElement);
-                fillReader.read();
-            }
-            else {
-                logger.debug("No known Symbol type: " + symbol.getClass().toString());
-            }
-            return layer;
+        rendererElement.setAttribute("label", renderer.getLabel());
+        rendererElement.setAttribute("description", renderer.getDescription());
+        symbol = renderer.getSymbol();
+
+        MarkerSymbolReader markerReader = new MarkerSymbolReader();
+        LineSymbolReader lineReader = new LineSymbolReader();
+        FillSymbolReader fillReader = new FillSymbolReader();
+        if(markerReader.canRead(symbol)) {
+            markerReader.setSymbol(symbol);
+            markerReader.setUtil(util);
+            markerReader.setParent(rendererElement);
+            markerReader.read();
         }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
+        else if(lineReader.canRead(symbol)) {
+            lineReader.setSymbol(symbol);
+            lineReader.setUtil(util);
+            lineReader.setParent(rendererElement);
+            lineReader.read();
         }
+        else if(fillReader.canRead(symbol)) {
+            fillReader.setSymbol(symbol);
+            fillReader.setUtil(util);
+            fillReader.setParent(rendererElement);
+            fillReader.read();
+        }
+        else {
+            logger.debug("No known Symbol type: " + symbol.getClass().toString());
+        }
+        return layer;
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java	Thu May 26 17:29:09 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java	Thu May 26 18:11:29 2011 +0200
@@ -69,59 +69,52 @@
      * @return The parent XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
         for(int i = 0; i < renderer.getClassCount() - 1; i++) {
-            Element rendererElement;
-            try {
-                rendererElement = util.addRenderer(layer);
-
-                String value = renderer.getValue(i);
-                rendererElement.setAttribute("name", renderer.esri_getClass(i));
-                rendererElement.setAttribute("description",
-                renderer.getDescription(value));
-                rendererElement.setAttribute("value", value);
-                rendererElement.setAttribute("label", renderer.getLabel(value));
-                rendererElement.setAttribute(
-                    "field_count",
-                    String.valueOf(renderer.getFieldCount()));
-                for(int j = 0; j < renderer.getFieldCount(); j++) {
-                    rendererElement.setAttribute(
-                        "expression_field_" + j,
-                        renderer.getField(j));
-                }
-                rendererElement.setAttribute("expression_operator", "=");
+            Element rendererElement = util.addRenderer(layer);
 
-                ISymbol sym = renderer.getSymbol(value);
-                MarkerSymbolReader markerReader = new MarkerSymbolReader();
-                LineSymbolReader lineReader = new LineSymbolReader();
-                FillSymbolReader fillReader = new FillSymbolReader();
-                if(markerReader.canRead(sym)) {
-                    markerReader.setSymbol(sym);
-                    markerReader.setUtil(util);
-                    markerReader.setParent(rendererElement);
-                    markerReader.read();
-                }
-                else if(lineReader.canRead(sym)) {
-                    lineReader.setSymbol(sym);
-                    lineReader.setUtil(util);
-                    lineReader.setParent(rendererElement);
-                    lineReader.read();
-                }
-                else if(fillReader.canRead(sym)) {
-                    fillReader.setSymbol(sym);
-                    fillReader.setUtil(util);
-                    fillReader.setParent(rendererElement);
-                    fillReader.read();
-                }
-                else {
-                    logger.debug("Not a known symbol type: " +
-                                 sym.getClass().toString());
-                }
+            String value = renderer.getValue(i);
+            rendererElement.setAttribute("name", renderer.esri_getClass(i));
+            rendererElement.setAttribute("description",
+            renderer.getDescription(value));
+            rendererElement.setAttribute("value", value);
+            rendererElement.setAttribute("label", renderer.getLabel(value));
+            rendererElement.setAttribute(
+                "field_count",
+                String.valueOf(renderer.getFieldCount()));
+            for(int j = 0; j < renderer.getFieldCount(); j++) {
+                rendererElement.setAttribute(
+                    "expression_field_" + j,
+                    renderer.getField(j));
             }
-            catch(Exception e) {
-                e.printStackTrace();
-                return null;
+            rendererElement.setAttribute("expression_operator", "=");
+
+            ISymbol sym = renderer.getSymbol(value);
+            MarkerSymbolReader markerReader = new MarkerSymbolReader();
+            LineSymbolReader lineReader = new LineSymbolReader();
+            FillSymbolReader fillReader = new FillSymbolReader();
+            if(markerReader.canRead(sym)) {
+                markerReader.setSymbol(sym);
+                markerReader.setUtil(util);
+                markerReader.setParent(rendererElement);
+                markerReader.read();
+            }
+            else if(lineReader.canRead(sym)) {
+                lineReader.setSymbol(sym);
+                lineReader.setUtil(util);
+                lineReader.setParent(rendererElement);
+                lineReader.read();
+            }
+            else if(fillReader.canRead(sym)) {
+                fillReader.setSymbol(sym);
+                fillReader.setUtil(util);
+                fillReader.setParent(rendererElement);
+                fillReader.read();
+            }
+            else {
+                logger.debug("Not a known symbol type: " +
+                             sym.getClass().toString());
             }
         }
         return layer;
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)