Revision: 18419
          http://sourceforge.net/p/gate/code/18419
Author:   ian_roberts
Date:     2014-10-30 18:42:13 +0000 (Thu, 30 Oct 2014)
Log Message:
-----------
Null guard.

Modified Paths:
--------------
    gate/trunk/plugins/Twitter/src/gate/corpora/JSONTweetFormat.java

Modified: gate/trunk/plugins/Twitter/src/gate/corpora/JSONTweetFormat.java
===================================================================
--- gate/trunk/plugins/Twitter/src/gate/corpora/JSONTweetFormat.java    
2014-10-30 18:38:33 UTC (rev 18418)
+++ gate/trunk/plugins/Twitter/src/gate/corpora/JSONTweetFormat.java    
2014-10-30 18:42:13 UTC (rev 18419)
@@ -97,8 +97,13 @@
       StringBuilder concatenation = new StringBuilder();
       while(tweetSource.hasNext()) {
         Tweet tweet = tweetSource.next();
-        tweetStarts.put(tweet, (long) concatenation.length());
-        concatenation.append(tweet.getString()).append("\n\n");
+        if(tweet != null) {
+          // TweetStreamIterator can return null even when hasNext is true,
+          // for search result style JSON.  This is not a problem, just ignore
+          // and check hasNext again.
+          tweetStarts.put(tweet, (long) concatenation.length());
+          concatenation.append(tweet.getString()).append("\n\n");
+        }
       }
 
       // Set new document content 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
GATE-cvs mailing list
GATE-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to