From 519c71b076926af00a97466dd3e859eda030eaef Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sun, 11 May 2014 16:26:25 +0200 Subject: Catch IOException and print faulty tweet number On IOException (via GZipInputStream), the tweet would be missed. Catch that too and print the tweet number in other exceptional cases. --- src/main/Main.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/Main.java b/src/main/Main.java index 2644db9..1f45fe9 100644 --- a/src/main/Main.java +++ b/src/main/Main.java @@ -119,7 +119,7 @@ public class Main implements Callable { ++tweetNo; } return true; - } catch (JsonParseException ex) { + } catch (JsonParseException | IOException ex) { if (tweet != null) { System.err.println("Faulty tweet " + tweetNo + ": " + tweet); } @@ -161,6 +161,7 @@ public class Main implements Callable { } catch (IOException ex) { System.err.println("Cannot open tweets: " + ex); } finally { + System.err.println("Last tweet that got processed: " + tweetNo); if (reader != null) { reader.close(); } -- cgit v1.2.1