Skip to content
This repository has been archived by the owner on Aug 25, 2022. It is now read-only.

Unparseable date #6

Open
dmorosi opened this issue May 12, 2015 · 3 comments
Open

Unparseable date #6

dmorosi opened this issue May 12, 2015 · 3 comments

Comments

@dmorosi
Copy link

dmorosi commented May 12, 2015

Hi,

when the geoevent service (I'm on version 10.3) receive a tweet, in the log file (karaf) I see:

2015-05-12 14:24:16,544 | ERROR | uilder1962981307 | TweetStatusAdapter | tStatusAdapter$TweetEventBuilder 188 | 370 - com.esri.geoevent.adapter.twitter-adapter - 10.3.0 | Parse date exception in TweetStatusAdapter (Tue May 12 12:24:16 +0000 2015): Unparseable date: "Tue May 12 12:24:16 +0000 2015"
2015-05-12 14:24:16,545 | INFO | uilder1962981307 | TweetStatusAdapter | tStatusAdapter$TweetEventBuilder 189 | 370 - com.esri.geoevent.adapter.twitter-adapter - 10.3.0 | Unparseable date: "Tue May 12 12:24:16 +0000 2015"
java.text.ParseException: Unparseable date: "Tue May 12 12:24:16 +0000 2015"
at java.text.DateFormat.parse(DateFormat.java:357)[:1.7.0_65]
at com.esri.geoevent.adapter.twitter.TweetStatusAdapter$TweetEventBuilder.buildGeoEvent(TweetStatusAdapter.java:184)[370:com.esri.geoevent.adapter.twitter-adapter:10.3.0]
at com.esri.geoevent.adapter.twitter.TweetStatusAdapter$TweetEventBuilder.run(TweetStatusAdapter.java:218)[370:com.esri.geoevent.adapter.twitter-adapter:10.3.0]
at java.lang.Thread.run(Thread.java:745)[:1.7.0_65]

and then I can't see anything coming out from the service. Is this something wrong in my configuration?

Thanks

Damiano

@mzesri
Copy link
Contributor

mzesri commented May 12, 2015

Damiano,

The error messages are caused by a mismatch between the locales. The tweets come back as the English locale while the machine that is running GeoEvent is probably in a different locale. If you want a quick fix, make sure your system locale and language setting matches the locale of the tweets you receive.

Now, when I changed my language and locale to Spanish(Mexico) on my computer and receive the same error as you mentioned, it didn't stop me from receiving the tweets. I still get all the tweets just not the time field such as the "created_at". Are you using the latest code from here? Can you show me some more of the logs? Also, could you try to send tweets to a JSON file using the "Write to a JSON File" output?

Thanks,

Ming

@dmorosi
Copy link
Author

dmorosi commented May 13, 2015

Hi Ming,

you're right, I was relying on the datetime field to write to a feature service where it was a requested field, so it didn't write nothing, but if I put the output to a JSON file I can see tweets flowing in and out.

As far as I can understand, the problem isn't about reading the "created_at" param from the Twitter API (it always has the same format in the Twitter JSON response, e.g. "Wed May 13 06:42:16 +0000 2015"), so where/when exactly the exception is generated? Do you plan to solve this "problem" in one of the next releases?

Thanks

Damiano

@mzesri
Copy link
Contributor

mzesri commented May 13, 2015

Damiano,

If Twitter JSON response always return dates in English, we can specify the English locale when we create the SimpleDateFormat. That way, regardless of your computer's locale, it will always be able to parse the date. But I am not too sure about this. I am afraid that it will break for other users if we make this change. We will do more research. In the meantime, since we have the source code here, you can always make the following change and recompile the jar files.

image

The build instruction is on the README page.

Let me know if you need help with this change.

Thanks,

Ming

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants