Revision: 18496
          http://sourceforge.net/p/gate/code/18496
Author:   ian_roberts
Date:     2014-12-12 15:13:48 +0000 (Fri, 12 Dec 2014)
Log Message:
-----------
Force English locale for the Tweet timestamp date format parser, as the Twitter 
API uses English month names.

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

Modified: gate/trunk/plugins/Twitter/src/gate/corpora/twitter/TweetUtils.java
===================================================================
--- gate/trunk/plugins/Twitter/src/gate/corpora/twitter/TweetUtils.java 
2014-12-12 02:20:37 UTC (rev 18495)
+++ gate/trunk/plugins/Twitter/src/gate/corpora/twitter/TweetUtils.java 
2014-12-12 15:13:48 UTC (rev 18496)
@@ -17,6 +17,8 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
+
 import org.apache.commons.lang.StringUtils;
 import org.joda.time.format.DateTimeFormat;
 import org.joda.time.format.DateTimeFormatter;
@@ -56,8 +58,9 @@
    * The parser can cope with dates in any timezone but the returned
    * DateTime objects will always be anchored in UTC.
    */
+  // Month names in Twitter API responses are English, so force locale
   public static final DateTimeFormatter CREATED_AT_FORMAT = 
DateTimeFormat.forPattern(
-          "EEE MMM dd HH:mm:ss Z yyyy").withZoneUTC();
+          "EEE MMM dd HH:mm:ss Z 
yyyy").withZoneUTC().withLocale(Locale.ENGLISH);
 
   
   public static List<Tweet> readTweets(String string) throws IOException {

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


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to