Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eca53640 authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

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
parent ae3834ef
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -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);
                    }