diff src/java/de/intevation/mxd/reader/ClassBreakRendererReader.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 acbe36fb45e0
children 59e06c405a9a
line wrap: on
line diff
--- 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;
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)