Mercurial > mxd2map
comparison src/java/de/intevation/mxd/reader/FeatureLayerReader.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 | 6c3d880db7c5 |
children | 5991c1f90f91 |
comparison
equal
deleted
inserted
replaced
117:6c3d880db7c5 | 118:39957898c694 |
---|---|
56 /** | 56 /** |
57 * Reads the Layer content. | 57 * Reads the Layer content. |
58 * | 58 * |
59 * @return The layer XML element. | 59 * @return The layer XML element. |
60 */ | 60 */ |
61 public Element read() { | 61 public Element read() |
62 throws IOException{ | |
62 logger.debug("read()"); | 63 logger.debug("read()"); |
63 Element layerElement; | 64 Element layerElement; |
64 try { | 65 try { |
65 layerElement = util.addLayer(); | 66 layerElement = util.addLayer(); |
66 } | 67 } |
67 catch(Exception e) { | 68 catch(Exception e) { |
68 logger.error("Failed to create DOM-Element for Layer."); | 69 logger.error("Failed to create DOM-Element for Layer."); |
69 return null; | 70 throw new IOException( |
71 this.getClass()+toString() + | |
72 "Error creating dom element"); | |
70 } | 73 } |
71 | 74 |
72 try { | 75 try { |
73 layerElement.setAttribute("name", layer.getName()); | 76 layerElement.setAttribute("name", layer.getName()); |
74 } | 77 } |
155 fcn.getClass().toString()); | 158 fcn.getClass().toString()); |
156 } | 159 } |
157 } | 160 } |
158 catch(IOException ioe) { | 161 catch(IOException ioe) { |
159 logger.warn("Could not read datasource. Stopped reading layer."); | 162 logger.warn("Could not read datasource. Stopped reading layer."); |
160 return null; | 163 throw new IOException( |
164 this.getClass().toString() + | |
165 "Error reading datasource."); | |
161 } | 166 } |
162 | 167 |
163 try { | 168 try { |
164 String datatype = layer.getDataSourceType(); | 169 String datatype = layer.getDataSourceType(); |
165 if(datatype.equals("Shapefile Feature Class")) { | 170 if(datatype.equals("Shapefile Feature Class")) { |
196 } | 201 } |
197 catch(Exception e) { | 202 catch(Exception e) { |
198 logger.error( | 203 logger.error( |
199 "Could not read layer datasource." + | 204 "Could not read layer datasource." + |
200 " Stopped reading layer."); | 205 " Stopped reading layer."); |
201 return null; | 206 throw new IOException( |
207 this.getClass().toString() + | |
208 " Error reading data source."); | |
202 } | 209 } |
203 return layerElement; | 210 return layerElement; |
204 } | 211 } |
205 } | 212 } |
206 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 213 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |