summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-05-11 16:26:25 +0200
committerPeter Wu <peter@lekensteyn.nl>2014-05-11 16:26:25 +0200
commit519c71b076926af00a97466dd3e859eda030eaef (patch)
tree4d28799ab526da4973f580881bbdf48ded70acf8
parent15a683934ee1a7eee210955fe9cb063feeee5f63 (diff)
downloadDatafiller-519c71b076926af00a97466dd3e859eda030eaef.tar.gz
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.
-rw-r--r--src/main/Main.java3
1 files changed, 2 insertions, 1 deletions
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<Boolean> {
++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<Boolean> {
} 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();
}