Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedHeightAccess.java @ 4150:0f60efc39953
Workaround for #961
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Tue, 16 Oct 2012 12:17:53 +0200 |
parents | 68beaa827751 |
children | cd44d28d0fbc |
comparison
equal
deleted
inserted
replaced
4149:71a4b664a16a | 4150:0f60efc39953 |
---|---|
1 package de.intevation.flys.artifacts.access; | 1 package de.intevation.flys.artifacts.access; |
2 | |
3 import de.intevation.flys.artifacts.FLYSArtifact; | |
4 import de.intevation.flys.artifacts.states.SoundingsSelect; | |
2 | 5 |
3 import gnu.trove.TIntArrayList; | 6 import gnu.trove.TIntArrayList; |
4 | 7 |
5 import org.apache.log4j.Logger; | 8 import org.apache.log4j.Logger; |
6 | |
7 import de.intevation.flys.artifacts.FLYSArtifact; | |
8 import de.intevation.flys.artifacts.states.SoundingsSelect; | |
9 | 9 |
10 | 10 |
11 public class BedHeightAccess extends Access { | 11 public class BedHeightAccess extends Access { |
12 | 12 |
13 private static final Logger logger = Logger.getLogger(BedHeightAccess.class); | 13 private static final Logger logger = Logger.getLogger(BedHeightAccess.class); |
49 | 49 |
50 if (data == null) { | 50 if (data == null) { |
51 logger.warn("No 'soundings' parameter specified!"); | 51 logger.warn("No 'soundings' parameter specified!"); |
52 return null; | 52 return null; |
53 } | 53 } |
54 else { | |
55 logger.debug("getBedHeightSingleIDs(): data=" + data); | |
56 } | |
54 | 57 |
55 String[] parts = data.split(";"); | 58 String[] parts = data.split(";"); |
56 | 59 |
57 TIntArrayList ids = new TIntArrayList(); | 60 TIntArrayList ids = new TIntArrayList(); |
58 | 61 |
59 for (String part: parts) { | 62 for (String part: parts) { |
60 if (part.indexOf(SoundingsSelect.PREFIX_SINGLE) >= 0) { | 63 if (part.indexOf(SoundingsSelect.PREFIX_SINGLE) >= 0) { |
61 String tmp = part.replace(SoundingsSelect.PREFIX_SINGLE, ""); | 64 String tmp = part.replace(SoundingsSelect.PREFIX_SINGLE, ""); |
62 | 65 |
63 try { | 66 try { |
64 ids.add(Integer.parseInt(tmp)); | 67 int i = Integer.parseInt(tmp); |
68 if (!ids.contains(i)) { | |
69 ids.add(i); | |
70 } | |
65 } | 71 } |
66 catch (NumberFormatException nfe) { | 72 catch (NumberFormatException nfe) { |
67 logger.warn("Cannot parse int from string: '" + tmp + "'"); | 73 logger.warn("Cannot parse int from string: '" + tmp + "'"); |
68 } | 74 } |
69 } | 75 } |