Source:
<code>public void run() { SharedRealm sharedRealm = null; try { sharedRealm = SharedRealm.getInstance(realmConfiguration); Result result; boolean updateSuccessful; if (updateMode == MODE_UPDATE_REALM_RESULTS) { result = Result.newRealmResultsResponse(); AlignedQueriesParameters alignedParameters = prepareQueriesParameters(); long[] handoverTableViewPointer = TableQuery.batchUpdateQueries(sharedRealm, alignedParameters.handoverQueries, alignedParameters.queriesParameters, alignedParameters.multiSortColumnIndices, alignedParameters.multiSortOrder); swapPointers(result, handoverTableViewPointer); updateSuccessful = true; result.versionID = sharedRealm.getVersionID(); } else { result = Result.newRealmObjectResponse(); updateSuccessful = updateRealmObjectQuery(sharedRealm, result); result.versionID = sharedRealm.getVersionID(); } RealmNotifier notifier = callerNotifier.get(); if (updateSuccessful && !isTaskCancelled() && notifier != null) { switch (event) { case COMPLETE_ASYNC_RESULTS: notifier.completeAsyncResults(result); break; case COMPLETE_ASYNC_OBJECT: notifier.completeAsyncObject(result); break; case COMPLETE_UPDATE_ASYNC_QUERIES: notifier.completeUpdateAsyncQueries(result); break; default: <START> throw new RuntimeException("Wrong event " + event); <END> } } } catch (BadVersionException e) { RealmLog.d("Query update task could not complete due to a BadVersionException. " + "Retry is scheduled by a REALM_CHANGED event."); } catch (Throwable e) { RealmLog.e(e.getMessage(), e); RealmNotifier notifier = callerNotifier.get(); if (notifier!= null) { notifier.throwBackgroundException(e); } } finally { if (sharedRealm != null) { sharedRealm.close(); } } }</code><technical_language>IllegalArgument instead</technical_language>

Target:
public void run() { SharedRealm sharedRealm = null; try { sharedRealm = SharedRealm.getInstance(realmConfiguration); Result result; boolean updateSuccessful; if (updateMode == MODE_UPDATE_REALM_RESULTS) { result = Result.newRealmResultsResponse(); AlignedQueriesParameters alignedParameters = prepareQueriesParameters(); long[] handoverTableViewPointer = TableQuery.batchUpdateQueries(sharedRealm, alignedParameters.handoverQueries, alignedParameters.queriesParameters, alignedParameters.multiSortColumnIndices, alignedParameters.multiSortOrder); swapPointers(result, handoverTableViewPointer); updateSuccessful = true; result.versionID = sharedRealm.getVersionID(); } else { result = Result.newRealmObjectResponse(); updateSuccessful = updateRealmObjectQuery(sharedRealm, result); result.versionID = sharedRealm.getVersionID(); } RealmNotifier notifier = callerNotifier.get(); if (updateSuccessful && !isTaskCancelled() && notifier != null) { switch (event) { case COMPLETE_ASYNC_RESULTS: notifier.completeAsyncResults(result); break; case COMPLETE_ASYNC_OBJECT: notifier.completeAsyncObject(result); break; case COMPLETE_UPDATE_ASYNC_QUERIES: notifier.completeUpdateAsyncQueries(result); break; default: throw new IllegalStateException(String.format("%s is not handled here.", event)); } } } catch (BadVersionException e) { RealmLog.d("Query update task could not complete due to a BadVersionException. " + "Retry is scheduled by a REALM_CHANGED event."); } catch (Throwable e) { RealmLog.e(e.getMessage(), e); RealmNotifier notifier = callerNotifier.get(); if (notifier!= null) { notifier.throwBackgroundException(e); } } finally { if (sharedRealm != null) { sharedRealm.close(); } } }