Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java @ 7339:40e5ad76103c
WST Import: Added parse error exception to WST parser.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Tue, 15 Oct 2013 18:31:59 +0200 |
parents | c894b7b45c4c |
children | 2ce7bacc940f |
comparison
equal
deleted
inserted
replaced
7338:f37c7e183b5e | 7339:40e5ad76103c |
---|---|
82 } | 82 } |
83 | 83 |
84 public void setWst(ImportWst wst) { | 84 public void setWst(ImportWst wst) { |
85 this.wst = wst; | 85 this.wst = wst; |
86 } | 86 } |
87 | |
88 public static final class ParseException extends Exception { | |
89 public ParseException() { | |
90 } | |
91 | |
92 public ParseException(String msg) { | |
93 super(msg); | |
94 } | |
95 } // class ParseException | |
87 | 96 |
88 /** Returns a new ImportTimeInterval with a date guessed from string. */ | 97 /** Returns a new ImportTimeInterval with a date guessed from string. */ |
89 public static ImportTimeInterval guessDate(String string) { | 98 public static ImportTimeInterval guessDate(String string) { |
90 try { | 99 try { |
91 Matcher m = YEAR_INTERVAL.matcher(string); | 100 Matcher m = YEAR_INTERVAL.matcher(string); |
103 "' could not be interpreted as valid timestamp"); | 112 "' could not be interpreted as valid timestamp"); |
104 } | 113 } |
105 return null; | 114 return null; |
106 } | 115 } |
107 | 116 |
108 public void parse(File file) throws IOException { | 117 public void parse(File file) throws IOException, ParseException { |
109 | 118 |
110 log.info("Parsing WST file '" + file + "'"); | 119 log.info("Parsing WST file '" + file + "'"); |
111 | 120 |
112 wst = new ImportWst(file.getName()); | 121 wst = new ImportWst(file.getName()); |
113 | 122 |