diff options
author | Peter Wu <peter@lekensteyn.nl> | 2016-11-04 14:25:35 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2016-11-04 14:26:36 +0100 |
commit | 427ebf5ef67251406fcd69347ed79df29b43682a (patch) | |
tree | 2afa882a3e3a220789b5d673779003f55b89a278 | |
parent | 9513ce12e73d7e208766bd27f71ca05eccc522b4 (diff) | |
download | Datafiller-427ebf5ef67251406fcd69347ed79df29b43682a.tar.gz |
TweetReader: print tweet that failed validation
-rw-r--r-- | src/io/TweetReader.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/io/TweetReader.java b/src/io/TweetReader.java index 15ddcea..eefcee2 100644 --- a/src/io/TweetReader.java +++ b/src/io/TweetReader.java @@ -1,7 +1,7 @@ package io; import com.google.gson.Gson; -import com.google.gson.JsonSyntaxException; +import com.google.gson.JsonParseException; import data.Tweet; import data.TwitterJsonDeserializer; import java.io.BufferedReader; @@ -36,7 +36,7 @@ public class TweetReader implements ITweetReader { if (line != null) { try { tweet = gson.fromJson(line, Tweet.class); - } catch (JsonSyntaxException ex) { + } catch (JsonParseException ex) { debugTweet(line, ex); throw ex; } @@ -52,8 +52,9 @@ public class TweetReader implements ITweetReader { } } - private void debugTweet(String line, JsonSyntaxException ex) { - System.err.println("Faulty line: " + line); - ex.printStackTrace(); + private void debugTweet(String line, JsonParseException ex) { + System.err.println(ex); + System.err.println("Faulty line:"); + System.err.println(line); } } |