From 34c600891613280e41cfd1ec1ad1bee8f23d043a Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Fri, 9 May 2014 23:03:09 +0200 Subject: Entities can be missing, user.place is not a string * User: place is not a string but a Place object. * User: entities is nullable. * Tweet: in_reply_to_user_id, coordinates is nullable. * ValidatingJsonDeserializer: Treat null values as missing fields. * ValidatingJsonDeserializerTest: Test for null values. --- src/database/QueryUtils.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/database/QueryUtils.java') diff --git a/src/database/QueryUtils.java b/src/database/QueryUtils.java index f87ba47..228ccc8 100644 --- a/src/database/QueryUtils.java +++ b/src/database/QueryUtils.java @@ -103,7 +103,11 @@ public class QueryUtils { } tweetStatement.setLong("replyid", tweet.in_reply_to_user_id); // TODO: place is not a string... - tweetStatement.setString("place", tweet.place); + if (tweet.place != null) { + tweetStatement.setString("place", tweet.place.full_name + " " + tweet.place.country); + } else { + tweetStatement.setString("place", null); + } User twuser = tweet.user; tweetStatement.setLong("userid", twuser.id); -- cgit v1.2.1