diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-05-10 20:10:13 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2014-05-10 20:10:13 +0200 |
commit | 6cbe48603e8957a4324d49149f0d46682188a3a7 (patch) | |
tree | 459b9bc7582a28230b66f3d634aab2a750b3991d /src/main/Main.java | |
parent | 84917e8789b9eece2b5ddc2353c3ddcc32a4301e (diff) | |
download | Datafiller-6cbe48603e8957a4324d49149f0d46682188a3a7.tar.gz |
More nullable annotations, print tweets for parse errors too
Nullable is based on Twitter platform (users, tweets) documentation.
Now the line number is also printed.
Diffstat (limited to 'src/main/Main.java')
-rw-r--r-- | src/main/Main.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/Main.java b/src/main/Main.java index bd4055f..fcae971 100644 --- a/src/main/Main.java +++ b/src/main/Main.java @@ -1,5 +1,6 @@ package main; +import com.google.gson.JsonParseException; import com.google.gson.JsonSyntaxException; import data.Tweet; import database.ConnectionBuilder; @@ -72,9 +73,15 @@ public class Main { filler.processTweet(tweet); ++tweetNo; } + } catch (JsonParseException ex) { + if (tweet != null) { + System.err.println("Faulty tweet " + tweetNo + ": " + tweet); + } + Logger.getLogger(Main.class.getName()).log(Level.SEVERE, + "Tweet read error", ex); } catch (SQLException ex) { if (tweet != null) { - System.err.println("Faulty tweet: " + tweet); + System.err.println("Faulty tweet " + tweetNo + ": " + tweet); } Logger.getLogger(Main.class.getName()).log(Level.SEVERE, "DB error", ex); |