Commit 84aa0381695a980d3587072d8b65f85ad0d17af1

Authored by Aymeric Cretin
1 parent 705a274be0
Exists in master

[TW] Ignore malformed message

Showing 1 changed file with 7 additions and 3 deletions Side-by-side Diff

src/main/java/fr/femto/extractor/track/Main.java View file @ 84aa038
... ... @@ -167,9 +167,13 @@
167 167 String currentMessage = bufferedReader.readLine();
168 168 while (currentMessage != null) {
169 169 if (!currentMessage.isEmpty()) {
170   - final long timestamp = parseLong(currentMessage.substring(3).split(",")[0]);
171   - if (lowerTimestamp <= timestamp && timestamp <= upperTimestamp) {
172   - bufferedWriter.write(currentMessage + "\n");
  170 + try {
  171 + final long timestamp = parseLong(currentMessage.substring(3).split(",")[0]);
  172 + if (lowerTimestamp <= timestamp && timestamp <= upperTimestamp) {
  173 + bufferedWriter.write(currentMessage + "\n");
  174 + }
  175 + } catch (final Exception ignored) {
  176 +
173 177 }
174 178 }
175 179 currentMessage = bufferedReader.readLine();