Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/importer/parsers/AnnotationClassifier.java @ 3662:0d27d02b1208
backend: Completed the error messages of the importer.
flys-backend/trunk@5266 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 24 Aug 2012 15:47:31 +0000 |
parents | f08fe480092c |
children |
comparison
equal
deleted
inserted
replaced
3661:3ea5e835ecce | 3662:0d27d02b1208 |
---|---|
90 | 90 |
91 for (int i = 0, N = typeList.getLength(); i < N; ++i) { | 91 for (int i = 0, N = typeList.getLength(); i < N; ++i) { |
92 Element typeElement = (Element)typeList.item(i); | 92 Element typeElement = (Element)typeList.item(i); |
93 String name = typeElement.getAttribute("name"); | 93 String name = typeElement.getAttribute("name"); |
94 if (name.length() == 0) { | 94 if (name.length() == 0) { |
95 log.warn("rule has no name"); | 95 log.warn("ANNCLASS: rule has no name"); |
96 continue; | 96 continue; |
97 } | 97 } |
98 | 98 |
99 ImportAnnotationType aic = new ImportAnnotationType(name); | 99 ImportAnnotationType aic = new ImportAnnotationType(name); |
100 | 100 |
153 protected Pair buildPair(Element element) { | 153 protected Pair buildPair(Element element) { |
154 String pattern = element.getAttribute("pattern"); | 154 String pattern = element.getAttribute("pattern"); |
155 String type = element.getAttribute("type"); | 155 String type = element.getAttribute("type"); |
156 | 156 |
157 if (pattern.length() == 0) { | 157 if (pattern.length() == 0) { |
158 log.warn("pattern has no 'pattern' attribute."); | 158 log.warn("ANNCLASS: pattern has no 'pattern' attribute."); |
159 return null; | 159 return null; |
160 } | 160 } |
161 | 161 |
162 if (type.length() == 0) { | 162 if (type.length() == 0) { |
163 log.warn("pattern has no 'type' attribute."); | 163 log.warn("ANNCLASS: pattern has no 'type' attribute."); |
164 return null; | 164 return null; |
165 } | 165 } |
166 | 166 |
167 ImportAnnotationType annType = types.get(type); | 167 ImportAnnotationType annType = types.get(type); |
168 | 168 |
169 if (annType == null) { | 169 if (annType == null) { |
170 log.warn("pattern has unknown type '" + type + "'"); | 170 log.warn("ANNCLASS: pattern has unknown type '" + type + "'"); |
171 return null; | 171 return null; |
172 } | 172 } |
173 | 173 |
174 Pattern p; | 174 Pattern p; |
175 | 175 |
176 try { | 176 try { |
177 p = Pattern.compile(pattern, | 177 p = Pattern.compile(pattern, |
178 Pattern.CASE_INSENSITIVE|Pattern.UNICODE_CASE); | 178 Pattern.CASE_INSENSITIVE|Pattern.UNICODE_CASE); |
179 } | 179 } |
180 catch (IllegalArgumentException iae) { | 180 catch (IllegalArgumentException iae) { |
181 log.warn("pattern '" + pattern + "' is invalid.", iae); | 181 log.warn("ANNCLASS: pattern '" + pattern + "' is invalid.", iae); |
182 return null; | 182 return null; |
183 } | 183 } |
184 | 184 |
185 return new Pair(p, annType); | 185 return new Pair(p, annType); |
186 } | 186 } |