Start a new topic

Offline storage parse error


I'm using the offline datastore but the sqlite storage is never used :

> trackDao.setCache(new InMemoryLRUCache(), CachePolicy.CACHEFIRST); // add memory caching

> trackDao.setOffline(OfflinePolicy.LOCAL_FIRST, new SqlLiteOfflineStore

(getActivity().getApplicationContext())); // add offline disk storage

> trackDao.get(query, new KinveyListCallback() {

> @Override

> public void onSuccess(Track[] tracks) {

> if(tracks == null) {

> onLoadingError();

> } else {

> // use of tracks here

> }

> }

If no connection is available, tracks == null (not using the offline sqlite datastore).

There is an IO exception shown in the stacktrace :

@Damien , do I made a mistake ?

Thank you.

Good morning @fabreax ,

So, upon reviewing your stack trace we found the following:

02-01 13:44:53.340 7634-7669/ W/System.err? Unable to parse the JSON in the request

If you have any idea why this might be happening it might be a quick fix for you. Otherwise if you can turn on debug logging ( ) and get back to us with a log, that would be very helpful in us troubleshooting this.

It is worth mentioning that all JSON must be UTF-8 encoded, as non UTF-8 charsets can throw errors.

Please let me know if you have any other questions or concerns,

Thank you Damien, it seems to be related to the user (bad request) but I don't understand why.

This is the complete log file :
Fabreax: I can't get to that url. It doesn't load properly for me.
Please retry
Fabreax: Upon digging through that stacktrace I found the following request:{"country":"United States"}&sort={"trackName" : 1}

Can you tell me how you're creating that query?

Thank you Damien.

I don't see the difference because of the forum formatter.

This is how I create the query :

final Client kinveyClient = new Client.Builder(getActivity().getApplicationContext()).build();

AsyncAppData trackDao = kinveyClient.appData("Track", Track.class);

Query query = new Query();

query.equals("country", country);

query.addSort("trackName", AbstractQuery.SortOrder.ASC);

trackDao.setCache(new InMemoryLRUCache(), CachePolicy.CACHEFIRST);

trackDao.setOffline(OfflinePolicy.LOCAL_FIRST, new SqlLiteOfflineStore(getActivity().getApplicationContext()));

trackDao.get(query, new KinveyListCallback() {...});

Can you try to disable the offline stuff and see if you are still getting errors? We are thinking that there may be an issue with the library encoding offline requests.

This is the log without the following lines :

trackDao.setCache(new InMemoryLRUCache(), CachePolicy.CACHEFIRST);

trackDao.setOffline(OfflinePolicy.LOCAL_FIRST, new SqlLiteOfflineStore(getActivity().getApplicationContext()));

I'm sure that there is no error without the offline sync management.

It appears the issue you're running into is due to a problem with urlencoding in our offline library. I will get back to you (hopefully later today) with a timeline about how long it will take to fix this.

Thank you Damien, please let me know when the bug will be fixed.
Fabreax: We believe that this issue will be resolved by the end of next week. The engineer who will be fixing it is confident that it won't be a difficult fix, but it will involve releasing an update to the library, so you will need to download that when it becomes available.

I will update this post when we get this issue resolved. Thank you for reporting this issue.
I understand, thank you.
Hello Damien, could you tell me when a new version of the Android SDK will be released ?
Fabreax: This was fixed last night, but I don't believe that we've finished internally testing the SDK yet. I would expect a release before the end of this week.

Login or Signup to post a comment