comparison artifacts/src/main/java/org/dive4elements/river/artifacts/context/RiverContextFactory.java @ 7074:a2abd87c0d3b generator-refactoring

Trim "names" and "class" attribute of out generators before using.
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 20 Sep 2013 15:44:39 +0200
parents beb9e94f04d3
children 24f153ad1f40
comparison
equal deleted inserted replaced
7073:beb9e94f04d3 7074:a2abd87c0d3b
330 int idx = 0; 330 int idx = 0;
331 331
332 for (int i = 0; i < num; i++) { 332 for (int i = 0; i < num; i++) {
333 Element item = (Element)outGenerators.item(i); 333 Element item = (Element)outGenerators.item(i);
334 334
335 String name = item.getAttribute("names"); 335 String names = item.getAttribute("names").trim();
336 String clazz = item.getAttribute("class"); 336 String clazz = item.getAttribute("class").trim();
337 337
338 if (name.isEmpty() || clazz.isEmpty()) { 338 if (names.isEmpty() || clazz.isEmpty()) {
339 continue; 339 continue;
340 } 340 }
341 341
342 Class<OutGenerator> generatorClass = null; 342 Class<OutGenerator> generatorClass = null;
343 343
350 } 350 }
351 351
352 Pair<Class<OutGenerator>, Element> pair = 352 Pair<Class<OutGenerator>, Element> pair =
353 new Pair<Class<OutGenerator>, Element>(generatorClass, item); 353 new Pair<Class<OutGenerator>, Element>(generatorClass, item);
354 354
355 for (String key: name.split("[\\s,]")) { 355 for (String key: names.split("[\\s,]")) {
356 if (!(key = key.trim()).isEmpty()) { 356 if (!(key = key.trim()).isEmpty()) {
357 generators.put(key, pair); 357 generators.put(key, pair);
358 idx++; 358 idx++;
359 } 359 }
360 } 360 }

http://dive4elements.wald.intevation.org