From 84aa0381695a980d3587072d8b65f85ad0d17af1 Mon Sep 17 00:00:00 2001 From: Aymeric Cretin Date: Tue, 5 Nov 2019 16:41:43 +0100 Subject: [PATCH] [TW] Ignore malformed message --- src/main/java/fr/femto/extractor/track/Main.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/femto/extractor/track/Main.java b/src/main/java/fr/femto/extractor/track/Main.java index 9805b87..22cec0d 100644 --- a/src/main/java/fr/femto/extractor/track/Main.java +++ b/src/main/java/fr/femto/extractor/track/Main.java @@ -167,9 +167,13 @@ public class Main { String currentMessage = bufferedReader.readLine(); while (currentMessage != null) { if (!currentMessage.isEmpty()) { - final long timestamp = parseLong(currentMessage.substring(3).split(",")[0]); - if (lowerTimestamp <= timestamp && timestamp <= upperTimestamp) { - bufferedWriter.write(currentMessage + "\n"); + try { + final long timestamp = parseLong(currentMessage.substring(3).split(",")[0]); + if (lowerTimestamp <= timestamp && timestamp <= upperTimestamp) { + bufferedWriter.write(currentMessage + "\n"); + } + } catch (final Exception ignored) { + } } currentMessage = bufferedReader.readLine(); -- 1.7.10.4