Mercurial > mxd2map
comparison src/java/de/intevation/mxd/reader/RasterLayerReader.java @ 306:ea3fde77ea48
Catch generic Exceptions to avoid leaking them and creating
silent errors
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Thu, 06 Sep 2012 18:56:20 +0200 |
parents | a9684178cb29 |
children | f9e53dcc7424 |
comparison
equal
deleted
inserted
replaced
305:ebf974199309 | 306:ea3fde77ea48 |
---|---|
99 } | 99 } |
100 | 100 |
101 try { | 101 try { |
102 layerElement.setAttribute("name", layer.getName()); | 102 layerElement.setAttribute("name", layer.getName()); |
103 } | 103 } |
104 catch(IOException ioe) { | 104 catch(Exception e) { |
105 logger.warn( | 105 logger.warn( |
106 "Could not read layer name." + | 106 "Could not read layer name." + |
107 " Stopped reading layer."); | 107 " Stopped reading layer."); |
108 throw new IOException("Error reading layer name."); | 108 throw new IOException("Error reading layer name."); |
109 } | 109 } |
118 | 118 |
119 try { | 119 try { |
120 layerElement.setAttribute("max_scale", | 120 layerElement.setAttribute("max_scale", |
121 String.valueOf(layer.getMaximumScale())); | 121 String.valueOf(layer.getMaximumScale())); |
122 } | 122 } |
123 catch(IOException ioe) { | 123 catch(Exception e) { |
124 logger.warn( | 124 logger.warn( |
125 "Could not read maximum scale."); | 125 "Could not read maximum scale."); |
126 } | 126 } |
127 | 127 |
128 try { | 128 try { |
131 } | 131 } |
132 else { | 132 else { |
133 layerElement.setAttribute("status", "off"); | 133 layerElement.setAttribute("status", "off"); |
134 } | 134 } |
135 } | 135 } |
136 catch(IOException ioe) { | 136 catch(Exception e) { |
137 logger.warn( | 137 logger.warn( |
138 "Could not read layer status." + | 138 "Could not read layer status." + |
139 " Setting layer status to \"on\"."); | 139 " Setting layer status to \"on\"."); |
140 layerElement.setAttribute("status", "on"); | 140 layerElement.setAttribute("status", "on"); |
141 } | 141 } |
142 try { | 142 try { |
143 layerElement.setAttribute("data_source", layer.getFilePath()); | 143 layerElement.setAttribute("data_source", layer.getFilePath()); |
144 } | 144 } |
145 catch(IOException ioe) { | 145 catch(Exception e) { |
146 logger.warn( | 146 logger.warn( |
147 "Could not read datasource." + | 147 "Could not read datasource." + |
148 " Stopped reading layer " + layer.getName() + "."); | 148 " Stopped reading layer " + layer.getName() + "."); |
149 util.removeLayer(layerElement); | 149 util.removeLayer(layerElement); |
150 return null; | 150 return null; |