microsoft / Cognitive-Face-Android

Cognitive Services Face client library for Android.
https://www.microsoft.com/cognitive-services/en-us/face-api
Other
269 stars 151 forks source link

JsonSyntaxException at FaceServiceRestClient.getPersonGroupTrainingStatus?? #31

Closed sunnyyssc closed 6 years ago

sunnyyssc commented 6 years ago

Hi there. I am working on identifying a face. But when I run this line to get the training status

TrainingStatus trainingStatus = faceServiceClient.getPersonGroupTrainingStatus(groupID);

I get the JsonSyntaxException and I am not so sure how to fix it.

Logs from console:

03-02 12:01:10.035 18597-19544/? W/System.err: com.google.gson.JsonSyntaxException: 03/01/2018 23:00:09 03-02 12:01:10.035 18597-19544/? W/System.err: at com.google.gson.DefaultDateTypeAdapter.deserializeToDate(DefaultDateTypeAdapter.java:127) 03-02 12:01:10.036 18597-19544/? W/System.err: at com.google.gson.DefaultDateTypeAdapter.read(DefaultDateTypeAdapter.java:103) 03-02 12:01:10.036 18597-19544/? W/System.err: at com.google.gson.DefaultDateTypeAdapter.read(DefaultDateTypeAdapter.java:40) 03-02 12:01:10.036 18597-19544/? W/System.err: at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129) 03-02 12:01:10.036 18597-19544/? W/System.err: at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220) 03-02 12:01:10.036 18597-19544/? W/System.err: at com.google.gson.Gson.fromJson(Gson.java:888) 03-02 12:01:10.036 18597-19544/? W/System.err: at com.google.gson.Gson.fromJson(Gson.java:853) 03-02 12:01:10.036 18597-19544/? W/System.err: at com.google.gson.Gson.fromJson(Gson.java:802) 03-02 12:01:10.036 18597-19544/? W/System.err: at com.google.gson.Gson.fromJson(Gson.java:774) 03-02 12:01:10.036 18597-19544/? W/System.err: at com.microsoft.projectoxford.face.FaceServiceRestClient.getPersonGroupTrainingStatus(FaceServiceRestClient.java:454) 03-02 12:01:10.036 18597-19544/? W/System.err: at com.sunny.myproject.Preview$IdentificationTask.doInBackground(Preview.java:312) 03-02 12:01:10.036 18597-19544/? W/System.err: at com.sunny.myproject.Preview$IdentificationTask.doInBackground(Preview.java:296) 03-02 12:01:10.036 18597-19544/? W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:305) 03-02 12:01:10.036 18597-19544/? W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237) 03-02 12:01:10.036 18597-19544/? W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243) 03-02 12:01:10.036 18597-19544/? W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 03-02 12:01:10.036 18597-19544/? W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 03-02 12:01:10.036 18597-19544/? W/System.err: at java.lang.Thread.run(Thread.java:762) 03-02 12:01:10.037 18597-19544/? W/System.err: Caused by: java.text.ParseException: Failed to parse date ["03/01/2018 23:00:09']: Invalid number: 03/0 03-02 12:01:10.037 18597-19544/? W/System.err: at com.google.gson.internal.bind.util.ISO8601Utils.parse(ISO8601Utils.java:274) 03-02 12:01:10.037 18597-19544/? W/System.err: at com.google.gson.DefaultDateTypeAdapter.deserializeToDate(DefaultDateTypeAdapter.java:125) 03-02 12:01:10.037 18597-19544/? W/System.err: ... 17 more 03-02 12:01:10.037 18597-19544/? W/System.err: Caused by: java.lang.NumberFormatException: Invalid number: 03/0 03-02 12:01:10.037 18597-19544/? W/System.err: at com.google.gson.internal.bind.util.ISO8601Utils.parseInt(ISO8601Utils.java:318) 03-02 12:01:10.037 18597-19544/? W/System.err: at com.google.gson.internal.bind.util.ISO8601Utils.parse(ISO8601Utils.java:129) 03-02 12:01:10.038 18597-19544/? W/System.err: ... 18 more

huxuan commented 6 years ago

Thanks for the reporting. Will look into it right now.

huxuan commented 6 years ago

Hi @SunnyYSSC, the error is caused by a service side date format change. The issue should have been fixed by commit b1952140707d736ad190ddc27d4fa017db1ae9e8. The latest version is already uploaded to maven Please use version 1.4.1 and keep enjoy using Face API. Thanks so much for your prompt report.