Select to view content in your preferred language

Unable to parse date

4952
3
12-07-2015 12:44 AM
ErikNilsson1
Deactivated User

Im trying to Get JSON-data from http://opendata-download-warnings.smhi.se/api/alerts.json using the “Poll an External Website for JSON”- connector.

But as soon as I start reading data I get an error in the log-files before I even have the possibility to use any processors. The error message looks like this:

Unable to parse date: Sat, 05 Dec 2015 21:09:21 GMT. java.text.ParseException: Unparseable date: "Sat, 05 Dec 2015 21:09:21 GMT"  at
java.text.DateFormat.parse(DateFormat.java:357)[:1.7.0_76] at
com.esri.ges.transport.http.LastModifiedToDateFormatter.toDate(LastModifiedToDateFormatter.java:26)[272:com.esri.ges.framework.transport.http-transport:10.3.1] at
com.esri.ges.transport.http.HttpInboundTransport.onReceive(HttpInboundTransport.java:541)[272:com.esri.ges.framework.transport.http-transport:10.3.1] at
com.esri.ges.transport.http.HttpInboundTransport.getData(HttpInboundTransport.java:242)[272:com.esri.ges.framework.transport.http-transport:10.3.1] at
com.esri.ges.transport.http.HttpInboundTransport$WorkerThread.run(HttpInboundTransport.java:127)[272:com.esri.ges.framework.transport.http-transport:10.3.1]

The date format I am trying to read is formatted like this: 2015-12-05T21:09:29+01:00

How do I avoid the errors?

Im running GeoEvent Exteniosn ver 10.3.1 on Windows Server 2012 R2 Standard.

3 Replies
ErikNilsson1
Deactivated User

Further detalis:

It seems like the error stops further processing when I am using the connector to "Push Text to an External TCP Socket". When I changed output to a JSON-file I can at least process the data but the errors are still present in the log-files.

0 Kudos
RJSunderman
Esri Regular Contributor

Hello Erik -

Erik Nilsson wrote:

The date format I am trying to read is formatted like this: 2015-12-05T21:09:29+01:00

How do I avoid the errors?

I was able to configure a 10.3.1 Poll an External Website for JSON input to retrieve event data from the http://opendata-download-warnings.smhi.se/api/alerts.json site. My input successfully generated a GeoEvent Definition whose date/time fields were handled using the Date data type (refer to smhi-alerts.png illustration attached).

When I display a single response from that page in a browser, it looks like all of the date/time values conform to the ISO 8601 standard:  YYYY-MM-DDThh:mm:ssTZD (e.g. 1997-07-16T19:20:30+01:00)

GeoEvent's inputs prefer date/time values represented in the ISO 8601 standard. Inputs such as Poll an External Website for JSON make an attempt to parse other common string representations - which is why date/time strings common in the U.S. (such as 3/16/2012 02:25:31) ingest without error. The error message you illustrate above looks like GeoEvent is receiving a String representation of a date/time which it does not recognize, specifically:  Sat, 05 Dec 2015 21:09:21 GMT

I'm not sure that these date/time values are (or were) coming from the SMHI open data.

You can configure a GeoEvent input to interpret such representations by specifying a Java SimpleDateFormat pattern as the input's Expected Date Format parameter. In order to illustrate this, I configured a Receive JSON on a REST Endpoint and sent the following simple data record to the input's endpoint:

[{

  "TrackID": "AA-1234",

  "LastUpdated": "Sat, 05 Dec 2015 21:09:21 GMT"

}]

Initially, I had the input generate a GeoEvent Definition without specifying an Expected Date Format. GeoEvent selected a data type String to represent the LastUpdated value. I then updated the GeoEvent Definition to specify that LastUpdated should be handled as a Date, not a String, and updated my input's configuration to specify EEE, dd MMM yyyy HH:mm:ss z as the Expected Date Format.

Again, you should not need to do this if the data being polled already represents its date/time values using the ISO 8601 standard. But in case you encounter uncommon date/time representations, the illustrations below should help you accommodate them.

Hope this information helps -

RJ

Click on the images below to see them display in a pop-up.

Pattern letters used to construct a Java SimpleDateFormat pattern. Hover over the (?) next to Expected Date Format to see these. Also, refer to SimpleDateFormat (Java Platform SE 6)

The ISO 8601 specification is laid out here, Date and Time Formats​, on the World Wide Web Consortium (W3C) site.

Han-WenLIU
Emerging Contributor

I also get the same problem

here is the error message:

my data link is here: https://pm25.lass-net.org/data/last-all-airbox.json 

I am using geoevent 10.5, with Poll an External Website for JSON as input and update feature as output

my time data look like this:   "timestamp": "2018-05-30T00:01:48Z"   (timestamp is the attribute name)

I follow the instruction fill in the expected date format like figure below

I have also check my geoevent definition for both input and out put the timestamp attribute is Date format.

Than I put it in arcgis online to show the attribute, the timestamp look like this

I can successfully update the features, but still get the error message

Can you help me with that?

thanks

kevin

0 Kudos