diff src/java/de/intevation/mxd/reader/SimpleRendererReader.java @ 74:7eba97e8201b

Catch all exceptions in the MXDReader.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 26 May 2011 18:11:29 +0200
parents 2cbe423b1fda
children 59e06c405a9a
line wrap: on
line diff
--- 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 :
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)