diff src/java/de/intevation/mxd/reader/MXDReader.java @ 118:39957898c694

Improved top level exception handling and logging.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 16 Jun 2011 14:06:09 +0200
parents 163d474165b0
children 9f74f4d36822
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/reader/MXDReader.java	Thu Jun 16 12:05:34 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MXDReader.java	Thu Jun 16 14:06:09 2011 +0200
@@ -39,13 +39,14 @@
     private ArcGISInitializer initializer = null;
     private MapToXMLUtils util;
     private IMap map;
-
+    private int invalidLayerCount;
 
     public MXDReader()
     throws IOException {
         logger.debug("constructor()");
         initializer = new ArcGISInitializer();
         util = new MapToXMLUtils();
+        invalidLayerCount = 0;
     }
 
 
@@ -188,11 +189,15 @@
                     }
                 }
                 catch(Exception e) {
-                    e.printStackTrace();
-                    return false;
+                    invalidLayerCount++;
+                    if(i == 0 && (i + 1) < map.getLayerCount() ||
+                       invalidLayerCount == map.getLayerCount()) {
+                        throw new IOException(
+                            "No valid layer in MXD file." +
+                            " Aborting.");
+                    }
                 }
             }
-            util.print();
         }
         return true;
     }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)