Mercurial > mxd2map
comparison 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 |
comparison
equal
deleted
inserted
replaced
117:6c3d880db7c5 | 118:39957898c694 |
---|---|
37 */ | 37 */ |
38 private String filename = ""; | 38 private String filename = ""; |
39 private ArcGISInitializer initializer = null; | 39 private ArcGISInitializer initializer = null; |
40 private MapToXMLUtils util; | 40 private MapToXMLUtils util; |
41 private IMap map; | 41 private IMap map; |
42 | 42 private int invalidLayerCount; |
43 | 43 |
44 public MXDReader() | 44 public MXDReader() |
45 throws IOException { | 45 throws IOException { |
46 logger.debug("constructor()"); | 46 logger.debug("constructor()"); |
47 initializer = new ArcGISInitializer(); | 47 initializer = new ArcGISInitializer(); |
48 util = new MapToXMLUtils(); | 48 util = new MapToXMLUtils(); |
49 invalidLayerCount = 0; | |
49 } | 50 } |
50 | 51 |
51 | 52 |
52 /** | 53 /** |
53 * Initialize the ArcGIS Objects. | 54 * Initialize the ArcGIS Objects. |
186 renderer.getClass().toString()); | 187 renderer.getClass().toString()); |
187 } | 188 } |
188 } | 189 } |
189 } | 190 } |
190 catch(Exception e) { | 191 catch(Exception e) { |
191 e.printStackTrace(); | 192 invalidLayerCount++; |
192 return false; | 193 if(i == 0 && (i + 1) < map.getLayerCount() || |
194 invalidLayerCount == map.getLayerCount()) { | |
195 throw new IOException( | |
196 "No valid layer in MXD file." + | |
197 " Aborting."); | |
198 } | |
193 } | 199 } |
194 } | 200 } |
195 util.print(); | |
196 } | 201 } |
197 return true; | 202 return true; |
198 } | 203 } |
199 | 204 |
200 /** | 205 /** |