Program: 155810
Project: 155810
Buggy source:
private boolean updateRealmResultsQueries(SharedGroup sharedGroup,Result result){
  for (  Builder.QueryEntry<RealmResults<?>> queryEntry : realmResultsEntries) {
    if (!isTaskCancelled()) {
switch (queryEntry.queryArguments.type) {
case ArgumentsHolder.TYPE_FIND_ALL:
{
          long handoverTableViewPointer=TableQuery.nativeFindAllWithHandover(sharedGroup.getNativePointer(),sharedGroup.getNativeReplicationPointer(),queryEntry.handoverQueryPointer,0,Table.INFINITE,Table.INFINITE);
          result.updatedTableViews.put(queryEntry.element,handoverTableViewPointer);
          queryEntry.handoverQueryPointer=0L;
          break;
        }
case ArgumentsHolder.TYPE_FIND_ALL_SORTED:
{
        long handoverTableViewPointer=TableQuery.nativeFindAllSortedWithHandover(sharedGroup.getNativePointer(),sharedGroup.getNativeReplicationPointer(),queryEntry.handoverQueryPointer,0,Table.INFINITE,Table.INFINITE,queryEntry.queryArguments.columnIndex,queryEntry.queryArguments.ascending);
        result.updatedTableViews.put(queryEntry.element,handoverTableViewPointer);
        queryEntry.handoverQueryPointer=0L;
        break;
      }
case ArgumentsHolder.TYPE_FIND_ALL_MULTI_SORTED:
    long handoverTableViewPointer=TableQuery.nativeFindAllMultiSortedWithHandover(sharedGroup.getNativePointer(),sharedGroup.getNativeReplicationPointer(),queryEntry.handoverQueryPointer,0,Table.INFINITE,Table.INFINITE,queryEntry.queryArguments.columnIndices,queryEntry.queryArguments.ascendings);
  result.updatedTableViews.put(queryEntry.element,handoverTableViewPointer);
queryEntry.handoverQueryPointer=0L;
break;
default :
throw new IllegalArgumentException("String_Node_Str" + queryEntry.queryArguments.type + "String_Node_Str");
}
}
 else {
for (Long handoverQueryPointer : result.updatedTableViews.values()) {
if (handoverQueryPointer != 0) {
TableQuery.nativeCloseQueryHandover(handoverQueryPointer);
}
}
return false;
}
}
return true;
}

Fixed version (ground truth):
private boolean updateRealmResultsQueries(SharedGroup sharedGroup,Result result){
  for (  Builder.QueryEntry queryEntry : realmResultsEntries) {
    if (!isTaskCancelled()) {
switch (queryEntry.queryArguments.type) {
case ArgumentsHolder.TYPE_FIND_ALL:
{
          long handoverTableViewPointer=TableQuery.nativeFindAllWithHandover(sharedGroup.getNativePointer(),sharedGroup.getNativeReplicationPointer(),queryEntry.handoverQueryPointer,0,Table.INFINITE,Table.INFINITE);
          result.updatedTableViews.put(queryEntry.element,handoverTableViewPointer);
          queryEntry.handoverQueryPointer=0L;
          break;
        }
case ArgumentsHolder.TYPE_FIND_ALL_SORTED:
{
        long handoverTableViewPointer=TableQuery.nativeFindAllSortedWithHandover(sharedGroup.getNativePointer(),sharedGroup.getNativeReplicationPointer(),queryEntry.handoverQueryPointer,0,Table.INFINITE,Table.INFINITE,queryEntry.queryArguments.columnIndex,queryEntry.queryArguments.ascending);
        result.updatedTableViews.put(queryEntry.element,handoverTableViewPointer);
        queryEntry.handoverQueryPointer=0L;
        break;
      }
case ArgumentsHolder.TYPE_FIND_ALL_MULTI_SORTED:
    long handoverTableViewPointer=TableQuery.nativeFindAllMultiSortedWithHandover(sharedGroup.getNativePointer(),sharedGroup.getNativeReplicationPointer(),queryEntry.handoverQueryPointer,0,Table.INFINITE,Table.INFINITE,queryEntry.queryArguments.columnIndices,queryEntry.queryArguments.ascendings);
  result.updatedTableViews.put(queryEntry.element,handoverTableViewPointer);
queryEntry.handoverQueryPointer=0L;
break;
default :
throw new IllegalArgumentException("String_Node_Str" + queryEntry.queryArguments.type + "String_Node_Str");
}
}
 else {
for (Long handoverQueryPointer : result.updatedTableViews.values()) {
if (handoverQueryPointer != 0) {
TableQuery.nativeCloseQueryHandover(handoverQueryPointer);
}
}
return false;
}
}
return true;
}