diff options
author | Peter Wu <peter@lekensteyn.nl> | 2016-11-04 12:34:48 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2016-11-04 12:34:48 +0100 |
commit | 9513ce12e73d7e208766bd27f71ca05eccc522b4 (patch) | |
tree | d3891e7565fb295c80b2bfd968a982a85423724d | |
parent | 752d05b155254d4651031a39cf989454a30166d0 (diff) | |
download | Datafiller-9513ce12e73d7e208766bd27f71ca05eccc522b4.tar.gz |
Allow empty URLs
Retweets with the URL being cutoff by an ellipsis have an invalid URL in
the entities field of the retweet:
"urls": [{
"url": "",
"expanded_url": null,
"indices": [137, 137]
}],
Just skip such URLs then.
-rw-r--r-- | src/data/Tweet.java | 2 | ||||
-rw-r--r-- | src/main/DataFiller.java | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/data/Tweet.java b/src/data/Tweet.java index d9b1de0..6ee89f4 100644 --- a/src/data/Tweet.java +++ b/src/data/Tweet.java @@ -57,7 +57,7 @@ public class Tweet { @ValidatingJsonDeserializer.Validator public Hashtag[] hashtags; - @ValidatingJsonDeserializer.Validator + //@ValidatingJsonDeserializer.Validator public Url[] urls; @ValidatingJsonDeserializer.Validator public Mention[] user_mentions; diff --git a/src/main/DataFiller.java b/src/main/DataFiller.java index a400975..2a06026 100644 --- a/src/main/DataFiller.java +++ b/src/main/DataFiller.java @@ -113,6 +113,9 @@ public class DataFiller { m_insertHash.executeUpdate(); } for (Tweet.Url url : tweet.entities.urls) { + if (url.expanded_url == null) { + continue; + } m_insertTweetUrl.setLong("tweetid", tweet.id); m_insertTweetUrl.setString("url", url.expanded_url); m_insertTweetUrl.executeUpdate(); @@ -126,6 +129,9 @@ public class DataFiller { User user = tweet.user; if (user.entities != null) { for (Tweet.Url url : tweet.entities.urls) { + if (url.expanded_url == null) { + continue; + } m_insertUserUrl.setLong("userid", user.id); m_insertUserUrl.setString("url", url.expanded_url); m_insertUserUrl.executeUpdate(); |