diff src/java/de/intevation/mxd/reader/FillSymbolReader.java @ 115:fb93f20478cc

Improved exception handling for symbol reader.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 15 Jun 2011 16:48:42 +0200
parents 3087c89a5bb8
children f4eb506499f5
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/reader/FillSymbolReader.java	Wed Jun 15 16:13:32 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/FillSymbolReader.java	Wed Jun 15 16:48:42 2011 +0200
@@ -48,44 +48,60 @@
         this.symbol= null;
     }
 
-    public Element read() throws Exception {
+    public Element read() {
         ISymbolReader sreader = null;
         if(symbol != null) {
-            if(symbol instanceof SimpleFillSymbol) {
-                sreader = new SimpleFillSymbolReader(symbol);
-            }
-            else if(symbol instanceof MultiLayerFillSymbol) {
-                sreader = new MultiLayerFillSymbolReader(symbol);
+            try {
+                if(symbol instanceof SimpleFillSymbol) {
+                    sreader = new SimpleFillSymbolReader(symbol);
+                }
+                else if(symbol instanceof MultiLayerFillSymbol) {
+                    sreader = new MultiLayerFillSymbolReader(symbol);
+                }
+                else if(symbol instanceof MarkerFillSymbol) {
+                    sreader = new MarkerFillSymbolReader(symbol);
+                }
+                else if(symbol instanceof LineFillSymbol) {
+                    sreader = new LineFillSymbolReader(symbol);
+                }
+                else {
+                    logger.debug("The reader for type " + symbol.getClass().toString() +
+                                 " is not implemented!");
+                    return parent;
+                }
             }
-            else if(symbol instanceof MarkerFillSymbol) {
-                sreader = new MarkerFillSymbolReader(symbol);
-            }
-            else if(symbol instanceof LineFillSymbol) {
-                sreader = new LineFillSymbolReader(symbol);
-            }
-            else {
-                logger.debug("The reader for type " + symbol.getClass().toString() +
-                             " is not implemented!");
+            catch(Exception e) {
+                logger.error(
+                    "Could not read the symbol " +
+                    symbol.getClass().toString());
                 return parent;
             }
         }
         else if(fillSymbol != null) {
-            if(fillSymbol instanceof SimpleFillSymbol) {
-                sreader = new SimpleFillSymbolReader(fillSymbol);
-            }
-            else if(fillSymbol instanceof MultiLayerFillSymbol) {
-                sreader = new MultiLayerFillSymbolReader(fillSymbol);
+            try {
+                if(fillSymbol instanceof SimpleFillSymbol) {
+                    sreader = new SimpleFillSymbolReader(fillSymbol);
+                }
+                else if(fillSymbol instanceof MultiLayerFillSymbol) {
+                    sreader = new MultiLayerFillSymbolReader(fillSymbol);
+                }
+                else if(fillSymbol instanceof MarkerFillSymbol) {
+                    sreader = new MarkerFillSymbolReader(fillSymbol);
+                }
+                else if(fillSymbol instanceof LineFillSymbol) {
+                    sreader = new LineFillSymbolReader(fillSymbol);
+                }
+                else {
+                    logger.debug("The reader for type " +
+                                 fillSymbol.getClass().toString() +
+                                 " is not implemented!");
+                    return parent;
+                }
             }
-            else if(fillSymbol instanceof MarkerFillSymbol) {
-                sreader = new MarkerFillSymbolReader(fillSymbol);
-            }
-            else if(fillSymbol instanceof LineFillSymbol) {
-                sreader = new LineFillSymbolReader(fillSymbol);
-            }
-            else {
-                logger.debug("The reader for type " +
-                             fillSymbol.getClass().toString() +
-                             " is not implemented!");
+            catch(Exception e) {
+                logger.error(
+                    "Could not read the symbol " +
+                    symbol.getClass().toString());
                 return parent;
             }
         }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)