From 915b5289b02db9c4809b009f4b8d9196c8436104 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Tue, 20 May 2014 10:49:38 +0200 Subject: Reply user ID can be NULL --- src/data/Tweet.java | 2 +- src/database/QueryUtils.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/data/Tweet.java b/src/data/Tweet.java index 91bb3d1..2e1a1f1 100644 --- a/src/data/Tweet.java +++ b/src/data/Tweet.java @@ -11,7 +11,7 @@ public class Tweet { @ValidatingJsonDeserializer.Nullable public String lang; @ValidatingJsonDeserializer.Nullable - public long in_reply_to_user_id; + public Long in_reply_to_user_id; public DateTime created_at; public int favorite_count; @ValidatingJsonDeserializer.Nullable diff --git a/src/database/QueryUtils.java b/src/database/QueryUtils.java index a37b806..dac3ffc 100644 --- a/src/database/QueryUtils.java +++ b/src/database/QueryUtils.java @@ -113,7 +113,11 @@ public class QueryUtils { } else { tweetStatement.setLong("retweetid", null); } - tweetStatement.setLong("replyid", tweet.in_reply_to_user_id); + if (tweet.in_reply_to_user_id != null) { + tweetStatement.setLong("replyid", tweet.in_reply_to_user_id); + } else { + tweetStatement.setLong("replyid", null); + } // TODO: place is not a string... if (tweet.place != null) { tweetStatement.setString("place", tweet.place.full_name + " " + tweet.place.country); -- cgit v1.2.1