Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unparseable date Exception Windows Azure Mobile Services

I am new to Windows Azure Mobile Services. I am running a simple query on one of my tables via mobile services with the following piece of code:

mStudySpotTable = this.mClient.getTable(studyspot.class);
mStudySpotTable.where().field("ss_school_id").eq(1)
    .execute(new TableQueryCallback<studyspot>() {
          public void onCompleted(List<studyspot> result, 
                                  int count, 
                                  Exception exception,
                                  ServiceFilterResponse response) {

The studyspot class is an inner class that simply contains variables that match the columns in the table stored in the cloud:

public class studyspot {
    int id;
    int ss_school_id;
    int ss_course_id;
    Date ss_startdatetime;
    Date ss_enddatetime;
    int ss_creator;
}

The problem I have is when I try to run my application with the query from above, I receive a com.google.gson.JsonSyntaxException: java.text.ParseException "Unparseable date:"2013-11-03T20:00:00.000Z"

I suspect the issue has something to do with the type of the ss_startdatetime and ss_enddatetime being Date objects in Java and datetime in the sql table. Anyone out there run into this problem?

like image 768
user2951764 Avatar asked Nov 02 '22 11:11

user2951764


1 Answers

The client parser source suggests the data should be parsed as expected:

https://github.com/WindowsAzure/azure-mobile-services/blob/master/sdk/android/src/sdk/src/com/microsoft/windowsazure/mobileservices/DateSerializer.java

Maybe check the Google GSON library version you're using to make sure it's compatible with the Mobile Services SDK.

like image 156
Simon W Avatar answered Nov 15 '22 06:11

Simon W