summaryrefslogtreecommitdiff
path: root/core/java/android/content/ContentProviderNative.java
diff options
context:
space:
mode:
authorFabrice Di Meglio <fdimeglio@google.com>2010-12-01 20:24:40 -0800
committerFabrice Di Meglio <fdimeglio@google.com>2010-12-02 14:28:32 -0800
commiteca53640a863b40ea9f96f280a90ce8aa538f9d1 (patch)
tree00712dd6321dd1ebf7e0c677189eee73e72e834c /core/java/android/content/ContentProviderNative.java
parentae3834ef9e3c488a209970e7779cffa3580ae78f (diff)
Add better SQL exception handling to the Sync framework (see bug #3202693)
- do the reply.writeNoException() only if there are NO exceptions - before, the code could actually generate an exception when asking for the count or the index, and then the exception could not be unmaarshalled because we previously calling reply.writeNoException() Change-Id: I241120878c3fc10fea5fbaeb74f9124b1413a3d4
Diffstat (limited to 'core/java/android/content/ContentProviderNative.java')
-rw-r--r--core/java/android/content/ContentProviderNative.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/core/java/android/content/ContentProviderNative.java b/core/java/android/content/ContentProviderNative.java
index d1ab8d576412..abeeb7406957 100644
--- a/core/java/android/content/ContentProviderNative.java
+++ b/core/java/android/content/ContentProviderNative.java
@@ -110,16 +110,23 @@ abstract public class ContentProviderNative extends Binder implements IContentPr
IBulkCursor bulkCursor = bulkQuery(url, projection, selection,
selectionArgs, sortOrder, observer, window);
- reply.writeNoException();
if (bulkCursor != null) {
- reply.writeStrongBinder(bulkCursor.asBinder());
-
+ final IBinder binder = bulkCursor.asBinder();
if (wantsCursorMetadata) {
- reply.writeInt(bulkCursor.count());
- reply.writeInt(BulkCursorToCursorAdaptor.findRowIdColumnIndex(
- bulkCursor.getColumnNames()));
+ final int count = bulkCursor.count();
+ final int index = BulkCursorToCursorAdaptor.findRowIdColumnIndex(
+ bulkCursor.getColumnNames());
+
+ reply.writeNoException();
+ reply.writeStrongBinder(binder);
+ reply.writeInt(count);
+ reply.writeInt(index);
+ } else {
+ reply.writeNoException();
+ reply.writeStrongBinder(binder);
}
} else {
+ reply.writeNoException();
reply.writeStrongBinder(null);
}