Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/importer/parsers/AnnotationsParser.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 | b2aac19a8982 |
children | c0bdbe24c115 |
comparison
equal
deleted
inserted
replaced
3661:3ea5e835ecce | 3662:0d27d02b1208 |
---|---|
79 } | 79 } |
80 | 80 |
81 String [] parts = line.split("\\s*;\\s*"); | 81 String [] parts = line.split("\\s*;\\s*"); |
82 | 82 |
83 if (parts.length < 3) { | 83 if (parts.length < 3) { |
84 log.warn("not enough columns in line " | 84 log.warn("ANN: not enough columns in line " |
85 + in.getLineNumber()); | 85 + in.getLineNumber()); |
86 continue; | 86 continue; |
87 } | 87 } |
88 | 88 |
89 ImportPosition position = positions.get(parts[0]); | 89 ImportPosition position = positions.get(parts[0]); |
108 if (to != null && from.compareTo(to) > 0) { | 108 if (to != null && from.compareTo(to) > 0) { |
109 BigDecimal t = from; from = to; to = t; | 109 BigDecimal t = from; from = to; to = t; |
110 } | 110 } |
111 } | 111 } |
112 catch (NumberFormatException nfe) { | 112 catch (NumberFormatException nfe) { |
113 log.warn("invalid number in line " + in.getLineNumber()); | 113 log.warn("ANN: invalid number in line " + in.getLineNumber()); |
114 continue; | 114 continue; |
115 } | 115 } |
116 | 116 |
117 ImportEdge edge = null; | 117 ImportEdge edge = null; |
118 | 118 |
121 edge = new ImportEdge( | 121 edge = new ImportEdge( |
122 null, | 122 null, |
123 new BigDecimal(parts[3].trim().replace(',', '.'))); | 123 new BigDecimal(parts[3].trim().replace(',', '.'))); |
124 } | 124 } |
125 catch (NumberFormatException nfe) { | 125 catch (NumberFormatException nfe) { |
126 log.warn("cannot parse 'Unterkante' in line " + | 126 log.warn("ANN: cannot parse 'Unterkante' in line " + |
127 in.getLineNumber()); | 127 in.getLineNumber()); |
128 } | 128 } |
129 } | 129 } |
130 else if (parts.length > 4) { // 'Unterkante' and 'Oberkante' | 130 else if (parts.length > 4) { // 'Unterkante' and 'Oberkante' |
131 String bottom = parts[3].trim().replace(',', '.'); | 131 String bottom = parts[3].trim().replace(',', '.'); |
139 : new BigDecimal(top); | 139 : new BigDecimal(top); |
140 edge = new ImportEdge(t, b); | 140 edge = new ImportEdge(t, b); |
141 } | 141 } |
142 catch (NumberFormatException nfe) { | 142 catch (NumberFormatException nfe) { |
143 log.warn( | 143 log.warn( |
144 "cannot parse 'Unterkante' or 'Oberkante' in line " | 144 "ANN: cannot parse 'Unterkante' or 'Oberkante' in line " |
145 + in.getLineNumber()); | 145 + in.getLineNumber()); |
146 } | 146 } |
147 } | 147 } |
148 | 148 |
149 ImportRange range = new ImportRange(from, to); | 149 ImportRange range = new ImportRange(from, to); |
154 | 154 |
155 ImportAnnotation annotation = new ImportAnnotation( | 155 ImportAnnotation annotation = new ImportAnnotation( |
156 attribute, position, range, edge, type); | 156 attribute, position, range, edge, type); |
157 | 157 |
158 if (!annotations.add(annotation)) { | 158 if (!annotations.add(annotation)) { |
159 log.warn("duplicated annotation '" + parts[0] + | 159 log.warn("ANN: duplicated annotation '" + parts[0] + |
160 "' in line " + in.getLineNumber()); | 160 "' in line " + in.getLineNumber()); |
161 } | 161 } |
162 } | 162 } |
163 } | 163 } |
164 finally { | 164 finally { |
171 public void parse(File root) throws IOException { | 171 public void parse(File root) throws IOException { |
172 | 172 |
173 for (String toScan: TO_SCAN) { | 173 for (String toScan: TO_SCAN) { |
174 File directory = FileTools.repair(new File(root, toScan)); | 174 File directory = FileTools.repair(new File(root, toScan)); |
175 if (!directory.isDirectory()) { | 175 if (!directory.isDirectory()) { |
176 log.warn("'" + directory + "' is not a directory."); | 176 log.warn("ANN: '" + directory + "' is not a directory."); |
177 continue; | 177 continue; |
178 } | 178 } |
179 File [] files = directory.listFiles(); | 179 File [] files = directory.listFiles(); |
180 if (files == null) { | 180 if (files == null) { |
181 log.warn("cannot list directory '" + directory + "'"); | 181 log.warn("ANN: cannot list directory '" + directory + "'"); |
182 continue; | 182 continue; |
183 } | 183 } |
184 | 184 |
185 for (File file: files) { | 185 for (File file: files) { |
186 if (file.isFile() && file.canRead() | 186 if (file.isFile() && file.canRead() |