ContentResolver.query() method throws "Invalid token limit" error

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ContentResolver.query() method throws "Invalid token limit" error

HB-2
The following error occurs on Pixel devices with build number RQ1A.201205.003 or later.  
I would like to know the cause of the error and how to deal with it.  
Is this a bug or a spec change?

■code
```
      ContentResolver resolver = getContentResolver();
      String order = "date ASC limit 100";
      Cursor cursor = resolver.query(
          CallLog.Calls.CONTENT_URI,
          null,
          null,
          null,
          order);
```

■error
```
"Invalid token limit,LINE:142,Method:readExceptionFromParcel Exception:Invalid token limit"
```

■Build number where the error occurs
```
https://support.google.com/pixelphone/thread/87641266
・RQ1A.201205.003
・RQ1A.201205.008
・RQ1A.201205.011

https://support.google.com/pixelphone/thread/93232095
・RQ1A.210105.002
・RQ1A.210105.003

https://support.google.com/pixelphone/thread/96244000
・RQ1A.210205.004
```

■If you replace it with the following code, no error will occur.
```
buildUpon().appendQueryParameter("limit", "100")
```

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/4299f642-5493-49c2-8403-baba3ce2a4afn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: ContentResolver.query() method throws "Invalid token limit" error

HB-2
■Additional Information
When implemented using the official documentation method, no error occurred, but the `LIMIT` clause did not work (all records were retrieved).

[ContentProvider - query](https://developer.android.com/reference/android/content/ContentProvider#query(android.net.Uri,%20java.lang.String[],%20android.os.Bundle,%20android.os.CancellationSignal))

```
 // Request 20 records starting at row index 30.
 Bundle queryArgs = new Bundle();
 queryArgs.putInt(ContentResolver.QUERY_ARG_OFFSET, 30);
 queryArgs.putInt(ContentResolver.QUERY_ARG_LIMIT, 20);
 
 Cursor cursor = getContentResolver().query(
       contentUri,    // Content Uri is specific to individual content providers.
       projection,    // String[] describing which columns to return.
       queryArgs,     // Query arguments.
       null);         // Cancellation signal.
```
2021年2月23日火曜日 9:03:59 UTC+9 HB:
The following error occurs on Pixel devices with build number RQ1A.201205.003 or later.  
I would like to know the cause of the error and how to deal with it.  
Is this a bug or a spec change?

■code
```
      ContentResolver resolver = getContentResolver();
      String order = "date ASC limit 100";
      Cursor cursor = resolver.query(
          CallLog.Calls.CONTENT_URI,
          null,
          null,
          null,
          order);
```

■error
```
"Invalid token limit,LINE:142,Method:readExceptionFromParcel Exception:Invalid token limit"
```

■Build number where the error occurs
```
・RQ1A.201205.003
・RQ1A.201205.008
・RQ1A.201205.011

・RQ1A.210105.002
・RQ1A.210105.003

・RQ1A.210205.004
```

■If you replace it with the following code, no error will occur.
```
buildUpon().appendQueryParameter("limit", "100")
```

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/ce25f2b2-e6c8-42b1-8c64-68b09a873f7an%40googlegroups.com.