Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/importer/parsers/PRFParser.java @ 3340:509af52db23b
Fix for issue 359
flys-backend/trunk@4946 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 12 Jul 2012 09:01:43 +0000 |
parents | 2ae732e2c65c |
children | 36edf9a71cbd |
comparison
equal
deleted
inserted
replaced
3339:790c12c55abb | 3340:509af52db23b |
---|---|
222 } | 222 } |
223 } | 223 } |
224 return null; | 224 return null; |
225 } | 225 } |
226 | 226 |
227 private static final String removeExtension(String name) { | |
228 int index = name.lastIndexOf('.'); | |
229 return index == -1 | |
230 ? name | |
231 : name.substring(0, index); | |
232 } | |
233 | |
227 public boolean parse(File file) { | 234 public boolean parse(File file) { |
228 | 235 |
229 if (!(file.isFile() && file.canRead())) { | 236 if (!(file.isFile() && file.canRead())) { |
230 log.warn("cannot open file '" + file + "'"); | 237 log.warn("cannot open file '" + file + "'"); |
231 return false; | 238 return false; |
232 } | 239 } |
233 | 240 |
234 log.info("parsing PRF file: '" + file + "'"); | 241 log.info("parsing PRF file: '" + file + "'"); |
235 | 242 |
236 description = file.getName(); | 243 description = removeExtension(file.getName()); |
237 | 244 |
238 year = findYear(file.getName()); | 245 year = findYear(file.getName()); |
239 | 246 |
240 if (year == null) { | 247 if (year == null) { |
241 File parent = file.getParentFile(); | 248 File parent = file.getParentFile(); |