nus-yam/ex-repair huggingface dataset:
Program: 155834
Project: 155834
Buggy source:
/** 
 * Set the auto-refresh status of the Realm instance. Auto-refresh is a feature that enables automatic update of the current realm instance and all its derived objects (RealmResults and RealmObjects instances) when a commit is performed on a Realm acting on the same file in another thread. This feature is only available if the realm instance lives is a   {@link android.os.Looper} enabled thread.
 * @param autoRefresh true will turn auto-refresh on, false will turn it off.
 * @throws java.lang.IllegalStateException if trying to enable auto-refresh in a thread without Looper.
 */
public void setAutoRefresh(boolean autoRefresh){
  if (autoRefresh && Looper.myLooper() == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (autoRefresh && !this.autoRefresh) {
    handler=new Handler(new RealmCallback());
    handlers.put(handler,id);
  }
 else   if (!autoRefresh && this.autoRefresh && handler != null) {
    handler.removeCallbacksAndMessages(null);
    handlers.remove(handler);
  }
  this.autoRefresh=autoRefresh;
}

Fixed version (ground truth):
/** 
 * Set the auto-refresh status of the Realm instance. Auto-refresh is a feature that enables automatic update of the current realm instance and all its derived objects (RealmResults and RealmObjects instances) when a commit is performed on a Realm acting on the same file in another thread. This feature is only available if the realm instance lives is a   {@link android.os.Looper} enabled thread.
 * @param autoRefresh true will turn auto-refresh on, false will turn it off.
 * @throws java.lang.IllegalStateException if trying to enable auto-refresh in a thread without Looper.
 */
public void setAutoRefresh(boolean autoRefresh){
  if (autoRefresh && Looper.myLooper() == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (autoRefresh && !this.autoRefresh) {
    handler=new Handler(new RealmCallback());
    handlers.put(handler,id);
  }
 else   if (!autoRefresh && this.autoRefresh && handler != null) {
    removeHandler(handler);
  }
  this.autoRefresh=autoRefresh;
}
Program: 155835
Project: 155835
Buggy source:
private long[] getColumnIndices(String fieldName,ColumnType fieldType){
  Table table=getTable().getTable();
  if (containsDot(fieldName)) {
    String[] names=splitString(fieldName);
    long[] columnIndices=new long[names.length];
    for (int i=0; i < names.length - 1; i++) {
      long index=table.getColumnIndex(names[i]);
      if (index < 0) {
        throw new IllegalArgumentException("String_Node_Str" + names[i] + "String_Node_Str");
      }
      ColumnType type=table.getColumnType(index);
      if (type == ColumnType.LINK || type == ColumnType.LINK_LIST) {
        table=table.getLinkTarget(index);
        columnIndices[i]=index;
      }
 else {
        throw new IllegalArgumentException("String_Node_Str" + names[i] + "String_Node_Str");
      }
    }
    columnIndices[names.length - 1]=table.getColumnIndex(names[names.length - 1]);
    if (fieldType != table.getColumnType(columnIndices[names.length - 1])) {
      throw new IllegalArgumentException(String.format("String_Node_Str",names[names.length - 1]));
    }
    return columnIndices;
  }
 else {
    if (columns.get(fieldName) == null) {
      throw new IllegalArgumentException(String.format("String_Node_Str",fieldName));
    }
    if (fieldType != table.getColumnType(columns.get(fieldName))) {
      throw new IllegalArgumentException(String.format("String_Node_Str",fieldName));
    }
    return new long[]{columns.get(fieldName)};
  }
}

Fixed version (ground truth):
private long[] getColumnIndices(String fieldName,ColumnType fieldType){
  Table table=getTable().getTable();
  if (containsDot(fieldName)) {
    String[] names=splitString(fieldName);
    long[] columnIndices=new long[names.length];
    for (int i=0; i < names.length - 1; i++) {
      long index=table.getColumnIndex(names[i]);
      if (index < 0) {
        throw new IllegalArgumentException("String_Node_Str" + names[i] + "String_Node_Str");
      }
      ColumnType type=table.getColumnType(index);
      if (type == ColumnType.LINK || type == ColumnType.LINK_LIST) {
        table=table.getLinkTarget(index);
        columnIndices[i]=index;
      }
 else {
        throw new IllegalArgumentException("String_Node_Str" + names[i] + "String_Node_Str");
      }
    }
    columnIndices[names.length - 1]=table.getColumnIndex(names[names.length - 1]);
    if (fieldType != table.getColumnType(columnIndices[names.length - 1])) {
      throw new IllegalArgumentException(String.format("String_Node_Str",names[names.length - 1]));
    }
    return columnIndices;
  }
 else {
    if (columns.get(fieldName) == null) {
      throw new IllegalArgumentException(String.format("String_Node_Str",fieldName));
    }
    ColumnType tableColumnType=table.getColumnType(columns.get(fieldName));
    if (fieldType != tableColumnType) {
      throw new IllegalArgumentException(String.format("String_Node_Str",fieldName,fieldType,tableColumnType));
    }
    return new long[]{columns.get(fieldName)};
  }
}
Program: 155836
Project: 155836
Buggy source:
TableOrView getTable(){
  if (realmList != null) {
    return realmList.getTable();
  }
 else {
    return realm.getTable(clazz);
  }
}

Fixed version (ground truth):
TableOrView getTable(){
  return realm.getTable(clazz);
}
Program: 155837
Project: 155837
Buggy source:
/** 
 * Create a RealmQuery instance from a @{link io.realm.RealmResults}.
 * @param realmList   The @{link io.realm.RealmResults} to query
 * @param clazz       The class to query
 * @throws java.lang.RuntimeException Any other error
 */
public RealmQuery(RealmResults realmList,Class<E> clazz){
  this.realmList=realmList;
  this.realm=realmList.getRealm();
  this.clazz=clazz;
  TableOrView dataStore=getTable();
  this.query=dataStore.where();
  for (int i=0; i < dataStore.getColumnCount(); i++) {
    this.columns.put(dataStore.getColumnName(i),i);
  }
}

Fixed version (ground truth):
RealmQuery(Realm realm,TableQuery query,Class<E> clazz){
  this.realm=realm;
  this.clazz=clazz;
  this.query=query;
  TableOrView dataStore=getTable();
  for (int i=0; i < dataStore.getColumnCount(); i++) {
    this.columns.put(dataStore.getColumnName(i),i);
  }
}
Program: 155838
Project: 155838
Buggy source:
private void emitEqualsMethod(JavaWriter writer) throws IOException {
  String proxyClassName=className + PROXY_SUFFIX;
  writer.emitAnnotation("String_Node_Str");
  writer.beginMethod("String_Node_Str","String_Node_Str",EnumSet.of(Modifier.PUBLIC),"String_Node_Str","String_Node_Str");
  writer.emitStatement("String_Node_Str");
  writer.emitStatement("String_Node_Str");
  writer.emitStatement("String_Node_Str",proxyClassName,className,proxyClassName);
  writer.emitEmptyLine();
  writer.emitStatement("String_Node_Str");
  writer.emitStatement("String_Node_Str",className);
  writer.emitStatement("String_Node_Str");
  writer.emitEmptyLine();
  writer.emitStatement("String_Node_Str");
  writer.emitStatement("String_Node_Str",className);
  writer.emitStatement("String_Node_Str");
  writer.emitEmptyLine();
  writer.emitStatement("String_Node_Str");
  writer.endMethod();
  writer.emitEmptyLine();
}

Fixed version (ground truth):
private void emitEqualsMethod(JavaWriter writer) throws IOException {
  String proxyClassName=className + PROXY_SUFFIX;
  writer.emitAnnotation("String_Node_Str");
  writer.beginMethod("String_Node_Str","String_Node_Str",EnumSet.of(Modifier.PUBLIC),"String_Node_Str","String_Node_Str");
  writer.emitStatement("String_Node_Str");
  writer.emitStatement("String_Node_Str");
  writer.emitStatement("String_Node_Str",proxyClassName,className,proxyClassName);
  writer.emitEmptyLine();
  writer.emitStatement("String_Node_Str");
  writer.emitStatement("String_Node_Str",className);
  writer.emitStatement("String_Node_Str");
  writer.emitEmptyLine();
  writer.emitStatement("String_Node_Str");
  writer.emitStatement("String_Node_Str",className);
  writer.emitStatement("String_Node_Str");
  writer.emitEmptyLine();
  writer.emitStatement("String_Node_Str",className);
  writer.emitEmptyLine();
  writer.emitStatement("String_Node_Str");
  writer.endMethod();
  writer.emitEmptyLine();
}
Program: 155839
Project: 155839
Buggy source:
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  AllTypesRealmProxy aAllTypes=(AllTypesRealmProxy)o;
  String path=realm.getPath();
  String otherPath=aAllTypes.realm.getPath();
  if (path != null ? !path.equals(otherPath) : otherPath != null)   return false;
  ;
  String tableName=row.getTable().getName();
  String otherTableName=aAllTypes.row.getTable().getName();
  if (tableName != null ? !tableName.equals(otherTableName) : otherTableName != null)   return false;
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  AllTypesRealmProxy aAllTypes=(AllTypesRealmProxy)o;
  String path=realm.getPath();
  String otherPath=aAllTypes.realm.getPath();
  if (path != null ? !path.equals(otherPath) : otherPath != null)   return false;
  ;
  String tableName=row.getTable().getName();
  String otherTableName=aAllTypes.row.getTable().getName();
  if (tableName != null ? !tableName.equals(otherTableName) : otherTableName != null)   return false;
  if (row.getIndex() != aAllTypes.row.getIndex())   return false;
  return true;
}
Program: 155840
Project: 155840
Buggy source:
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  BooleansRealmProxy aBooleans=(BooleansRealmProxy)o;
  String path=realm.getPath();
  String otherPath=aBooleans.realm.getPath();
  if (path != null ? !path.equals(otherPath) : otherPath != null)   return false;
  ;
  String tableName=row.getTable().getName();
  String otherTableName=aBooleans.row.getTable().getName();
  if (tableName != null ? !tableName.equals(otherTableName) : otherTableName != null)   return false;
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  BooleansRealmProxy aBooleans=(BooleansRealmProxy)o;
  String path=realm.getPath();
  String otherPath=aBooleans.realm.getPath();
  if (path != null ? !path.equals(otherPath) : otherPath != null)   return false;
  ;
  String tableName=row.getTable().getName();
  String otherTableName=aBooleans.row.getTable().getName();
  if (tableName != null ? !tableName.equals(otherTableName) : otherTableName != null)   return false;
  if (row.getIndex() != aBooleans.row.getIndex())   return false;
  return true;
}
Program: 155841
Project: 155841
Buggy source:
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  SimpleRealmProxy aSimple=(SimpleRealmProxy)o;
  String path=realm.getPath();
  String otherPath=aSimple.realm.getPath();
  if (path != null ? !path.equals(otherPath) : otherPath != null)   return false;
  ;
  String tableName=row.getTable().getName();
  String otherTableName=aSimple.row.getTable().getName();
  if (tableName != null ? !tableName.equals(otherTableName) : otherTableName != null)   return false;
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  SimpleRealmProxy aSimple=(SimpleRealmProxy)o;
  String path=realm.getPath();
  String otherPath=aSimple.realm.getPath();
  if (path != null ? !path.equals(otherPath) : otherPath != null)   return false;
  ;
  String tableName=row.getTable().getName();
  String otherTableName=aSimple.row.getTable().getName();
  if (tableName != null ? !tableName.equals(otherTableName) : otherTableName != null)   return false;
  if (row.getIndex() != aSimple.row.getIndex())   return false;
  return true;
}
Program: 155842
Project: 155842
Buggy source:
@Override protected Integer doInBackground(Void... params){
  Realm realm=Realm.getInstance(getActivity());
  realm.beginTransaction();
  realm.clear(Score.class);
  for (int i=0; i < TEST_OBJECTS; i++) {
    if (isCancelled())     return -1;
    Score score=realm.createObject(Score.class);
    score.setName("String_Node_Str" + i);
    score.setScore(i);
    publishProgress(i);
    try {
      Thread.sleep(50);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  realm.commitTransaction();
  Number sum=realm.allObjects(Score.class).sum("String_Node_Str");
  realm.close();
  return sum.intValue();
}

Fixed version (ground truth):
@Override protected Integer doInBackground(Void... params){
  Realm realm=Realm.getInstance(getActivity());
  realm.beginTransaction();
  realm.clear(Score.class);
  for (int i=0; i < TEST_OBJECTS; i++) {
    if (isCancelled())     break;
    Score score=realm.createObject(Score.class);
    score.setName("String_Node_Str" + i);
    score.setScore(i);
    publishProgress(i);
    try {
      Thread.sleep(50);
    }
 catch (    InterruptedException e) {
    }
  }
  realm.commitTransaction();
  Number sum=realm.allObjects(Score.class).sum("String_Node_Str");
  realm.close();
  return sum.intValue();
}
Program: 155843
Project: 155843
Buggy source:
public void testFailingSetAutoRefreshOnNonLooperThread() throws ExecutionException, InterruptedException {
  ExecutorService executorService=Executors.newSingleThreadExecutor();
  Future<Boolean> future=executorService.submit(new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      Realm realm=Realm.getInstance(getContext(),false);
      boolean autoRefresh=realm.isAutoRefresh();
      assertFalse(autoRefresh);
      try {
        realm.setAutoRefresh(true);
        realm.close();
        return false;
      }
 catch (      IllegalStateException ignored) {
        realm.close();
        return true;
      }
    }
  }
);
  assertTrue(future.get());
  assertTrue(Realm.realmsCache.get().isEmpty());
}

Fixed version (ground truth):
public void testFailingSetAutoRefreshOnNonLooperThread() throws ExecutionException, InterruptedException {
  ExecutorService executorService=Executors.newSingleThreadExecutor();
  Future<Boolean> future=executorService.submit(new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      Realm realm=Realm.getInstance(getContext(),false);
      boolean autoRefresh=realm.isAutoRefresh();
      assertFalse(autoRefresh);
      try {
        realm.setAutoRefresh(true);
        return false;
      }
 catch (      IllegalStateException ignored) {
        return true;
      }
 finally {
        realm.close();
      }
    }
  }
);
  assertTrue(future.get());
  assertTrue(Realm.realmsCache.get().isEmpty());
}
Program: 155844
Project: 155844
Buggy source:
@Override protected void setUp() throws InterruptedException {
  boolean result=Realm.deleteRealmFile(getContext());
  assertTrue(result);
  testRealm=Realm.getInstance(getContext());
  testRealm.beginTransaction();
  testRealm.allObjects(AllTypes.class).clear();
  for (int i=0; i < TEST_DATA_SIZE; ++i) {
    AllTypes allTypes=testRealm.createObject(AllTypes.class);
    allTypes.setColumnBoolean((i % 2) == 0);
    allTypes.setColumnBinary(new byte[]{1,2,3});
    allTypes.setColumnDate(new Date((long)1000 * i));
    allTypes.setColumnDouble(3.1415 + i);
    allTypes.setColumnFloat(1.234567f + i);
    allTypes.setColumnString("String_Node_Str" + i);
    allTypes.setColumnLong(i);
  }
  testRealm.commitTransaction();
}

Fixed version (ground truth):
@Override protected void setUp() throws InterruptedException {
  boolean result=Realm.deleteRealmFile(getContext());
  assertTrue(result);
  testRealm=Realm.getInstance(getContext());
  testRealm.beginTransaction();
  testRealm.allObjects(AllTypes.class).clear();
  testRealm.allObjects(NonLatinFieldNames.class).clear();
  for (int i=0; i < TEST_DATA_SIZE; ++i) {
    AllTypes allTypes=testRealm.createObject(AllTypes.class);
    allTypes.setColumnBoolean((i % 2) == 0);
    allTypes.setColumnBinary(new byte[]{1,2,3});
    allTypes.setColumnDate(new Date((long)1000 * i));
    allTypes.setColumnDouble(3.1415 + i);
    allTypes.setColumnFloat(1.234567f + i);
    allTypes.setColumnString("String_Node_Str" + i);
    allTypes.setColumnLong(i);
    NonLatinFieldNames nonLatinFieldNames=testRealm.createObject(NonLatinFieldNames.class);
    nonLatinFieldNames.set델타(i);
    nonLatinFieldNames.setΔέλτα(i);
  }
  testRealm.commitTransaction();
}
Program: 155845
Project: 155845
Buggy source:
@Override protected void setUp() throws InterruptedException {
  boolean result=Realm.deleteRealmFile(getContext());
  assertTrue(result);
  testRealm=Realm.getInstance(getContext());
  testRealm.beginTransaction();
  testRealm.allObjects(AllTypes.class).clear();
  for (int i=0; i < TEST_DATA_SIZE; ++i) {
    AllTypes allTypes=testRealm.createObject(AllTypes.class);
    allTypes.setColumnBoolean((i % 2) == 0);
    allTypes.setColumnBinary(new byte[]{1,2,3});
    allTypes.setColumnDate(new Date((long)1000 * i));
    allTypes.setColumnDouble(3.1415 + i);
    allTypes.setColumnFloat(1.234567f + i);
    allTypes.setColumnString("String_Node_Str" + i);
    allTypes.setColumnLong(i);
  }
  testRealm.commitTransaction();
}

Fixed version (ground truth):
@Override protected void setUp() throws InterruptedException {
  boolean result=Realm.deleteRealmFile(getContext());
  assertTrue(result);
  testRealm=Realm.getInstance(getContext());
  testRealm.beginTransaction();
  testRealm.allObjects(AllTypes.class).clear();
  testRealm.allObjects(NonLatinFieldNames.class).clear();
  for (int i=0; i < TEST_DATA_SIZE; ++i) {
    AllTypes allTypes=testRealm.createObject(AllTypes.class);
    allTypes.setColumnBoolean((i % 2) == 0);
    allTypes.setColumnBinary(new byte[]{1,2,3});
    allTypes.setColumnDate(new Date((long)1000 * i));
    allTypes.setColumnDouble(3.1415 + i);
    allTypes.setColumnFloat(1.234567f + i);
    allTypes.setColumnString("String_Node_Str" + i);
    allTypes.setColumnLong(i);
    NonLatinFieldNames nonLatinFieldNames=testRealm.createObject(NonLatinFieldNames.class);
    nonLatinFieldNames.set델타(i);
    nonLatinFieldNames.setΔέλτα(i);
  }
  testRealm.commitTransaction();
}
Program: 155846
Project: 155846
Buggy source:
public void testSortWithAdapter(){
  RealmResults<AllTypes> resultList=testRealm.where(AllTypes.class).findAll().sort(FIELD_STRING,RealmResults.SORT_ORDER_DECENDING);
  RealmAdapter realmAdapter=new RealmAdapter(getContext(),resultList,automaticUpdate);
  assertEquals(resultList.first(),realmAdapter.getRealmResults().first());
  assertEquals(resultList.size(),realmAdapter.getRealmResults().size());
  realmAdapter.updateRealmResults(realmAdapter.getRealmResults().sort(FIELD_STRING));
  assertEquals(resultList.first(),realmAdapter.getRealmResults().first());
  assertEquals(resultList.size(),realmAdapter.getRealmResults().size());
}

Fixed version (ground truth):
public void testSortWithAdapter(){
  RealmResults<AllTypes> resultList=testRealm.where(AllTypes.class).findAll().sort(FIELD_STRING,RealmResults.SORT_ORDER_DECENDING);
  RealmAdapter realmAdapter=new RealmAdapter(getContext(),resultList,automaticUpdate);
  assertEquals(resultList.first(),realmAdapter.getRealmResults().first());
  assertEquals(resultList.size(),realmAdapter.getRealmResults().size());
  realmAdapter.updateRealmResults(realmAdapter.getRealmResults().sort(FIELD_STRING));
  assertEquals(resultList.last(),realmAdapter.getRealmResults().first());
  assertEquals(resultList.size(),realmAdapter.getRealmResults().size());
}
Program: 155847
Project: 155847
Buggy source:
private long[] getColumnIndices(String fieldName,ColumnType fieldType){
  Table table=(Table)getTable();
  if (containsDot(fieldName)) {
    String[] names=splitString(fieldName);
    long[] columnIndices=new long[names.length];
    for (int i=0; i < names.length - 1; i++) {
      long index=table.getColumnIndex(names[i]);
      ColumnType type=table.getColumnType(index);
      if (type == ColumnType.LINK || type == ColumnType.LINK_LIST) {
        table=table.getLinkTarget(index);
        columnIndices[i]=index;
      }
 else {
        throw new IllegalArgumentException("String_Node_Str" + names[i] + "String_Node_Str");
      }
    }
    columnIndices[names.length - 1]=table.getColumnIndex(names[names.length - 1]);
    if (fieldType != table.getColumnType(columnIndices[names.length - 1])) {
      throw new IllegalArgumentException(String.format("String_Node_Str",names[names.length - 1]));
    }
    return columnIndices;
  }
 else {
    if (fieldType != table.getColumnType(columns.get(fieldName))) {
      throw new IllegalArgumentException(String.format("String_Node_Str",fieldName));
    }
    return new long[]{columns.get(fieldName)};
  }
}

Fixed version (ground truth):
private long[] getColumnIndices(String fieldName,ColumnType fieldType){
  Table table=(Table)getTable();
  if (containsDot(fieldName)) {
    String[] names=splitString(fieldName);
    long[] columnIndices=new long[names.length];
    for (int i=0; i < names.length - 1; i++) {
      long index=table.getColumnIndex(names[i]);
      if (index < 0) {
        throw new IllegalArgumentException("String_Node_Str" + names[i] + "String_Node_Str");
      }
      ColumnType type=table.getColumnType(index);
      if (type == ColumnType.LINK || type == ColumnType.LINK_LIST) {
        table=table.getLinkTarget(index);
        columnIndices[i]=index;
      }
 else {
        throw new IllegalArgumentException("String_Node_Str" + names[i] + "String_Node_Str");
      }
    }
    columnIndices[names.length - 1]=table.getColumnIndex(names[names.length - 1]);
    if (fieldType != table.getColumnType(columnIndices[names.length - 1])) {
      throw new IllegalArgumentException(String.format("String_Node_Str",names[names.length - 1]));
    }
    return columnIndices;
  }
 else {
    if (fieldType != table.getColumnType(columns.get(fieldName))) {
      throw new IllegalArgumentException(String.format("String_Node_Str",fieldName));
    }
    return new long[]{columns.get(fieldName)};
  }
}
Program: 155851
Project: 155851
Buggy source:
public void testRealmGetRowReturnsValidRow(){
  testRealm.beginTransaction();
  RealmObject realmObject=testRealm.createObject(AllTypes.class);
  Row row=realmObject.realmGetRow();
  testRealm.commitTransaction();
  assertNotNull("String_Node_Str",row);
  assertEquals("String_Node_Str",7,row.getColumnCount());
}

Fixed version (ground truth):
public void testRealmGetRowReturnsValidRow(){
  testRealm.beginTransaction();
  RealmObject realmObject=testRealm.createObject(AllTypes.class);
  Row row=realmObject.realmGetRow();
  testRealm.commitTransaction();
  assertNotNull("String_Node_Str",row);
  assertEquals("String_Node_Str",8,row.getColumnCount());
}
Program: 155853
Project: 155853
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_realm_basic_example);
  rootLayout=((LinearLayout)findViewById(R.id.container));
  rootLayout.removeAllViews();
  String path0=copyBundledRealmFile(this.getResources().openRawResource(R.raw.default0),"String_Node_Str");
  String path1=copyBundledRealmFile(this.getResources().openRawResource(R.raw.default1),"String_Node_Str");
  String path2=copyBundledRealmFile(this.getResources().openRawResource(R.raw.default2),"String_Node_Str");
  try {
    Realm.getInstance(this,"String_Node_Str");
  }
 catch (  RealmMigrationNeededException ex) {
    Log.i(TAG,"String_Node_Str");
  }
  Realm.migrateRealmAtPath(path0,new Migration());
  Realm realm0=Realm.getInstance(this,"String_Node_Str");
  showStatus(realm0);
  Realm.migrateRealmAtPath(path1,new Migration());
  Realm realm1=Realm.getInstance(this,"String_Node_Str");
  showStatus(realm1);
  Realm.migrateRealmAtPath(path2,new Migration());
  Realm realm2=Realm.getInstance(this,"String_Node_Str");
  showStatus(realm2);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_realm_basic_example);
  rootLayout=((LinearLayout)findViewById(R.id.container));
  rootLayout.removeAllViews();
  String path0=copyBundledRealmFile(this.getResources().openRawResource(R.raw.default0),"String_Node_Str");
  String path1=copyBundledRealmFile(this.getResources().openRawResource(R.raw.default1),"String_Node_Str");
  String path2=copyBundledRealmFile(this.getResources().openRawResource(R.raw.default2),"String_Node_Str");
  try {
    Realm.getInstance(this,"String_Node_Str");
  }
 catch (  RealmMigrationNeededException ex) {
    Log.i(TAG,"String_Node_Str");
  }
  Realm.migrateRealmAtPath(path2,new Migration());
  Realm realm2=Realm.getInstance(this,"String_Node_Str");
  showStatus(realm2);
  Realm.migrateRealmAtPath(path1,new Migration());
  Realm realm1=Realm.getInstance(this,"String_Node_Str");
  showStatus(realm1);
  Realm.migrateRealmAtPath(path0,new Migration());
  Realm realm0=Realm.getInstance(this,"String_Node_Str");
  showStatus(realm0);
}
Program: 155854
Project: 155854
Buggy source:
private long getIndexForProperty(Table table,String name){
  for (int i=0; i < table.getColumnCount(); i++) {
    if (table.getColumnName(i).equals("String_Node_Str")) {
      return i;
    }
  }
  return -1;
}

Fixed version (ground truth):
private long getIndexForProperty(Table table,String name){
  for (int i=0; i < table.getColumnCount(); i++) {
    if (table.getColumnName(i).equals(name)) {
      return i;
    }
  }
  return -1;
}
Program: 155857
Project: 155857
Buggy source:
private long getVersion(){
  Table metadataTable=transaction.getTable("String_Node_Str");
  if (metadataTable.getColumnCount() == 0) {
    setVersion(-1);
  }
  return metadataTable.getLong(0,0);
}

Fixed version (ground truth):
private long getVersion(){
  if (!transaction.hasTable("String_Node_Str")) {
    return UNVERSIONED;
  }
  Table metadataTable=transaction.getTable("String_Node_Str");
  return metadataTable.getLong(0,0);
}
Program: 155862
Project: 155862
Buggy source:
public boolean generate() throws IOException {
  writer.setIndent("String_Node_Str");
  if (!emitPackage())   return false;
  if (!emitClass())   return false;
  if (!emitFields())   return false;
  writer.beginMethod("String_Node_Str","String_Node_Str",EnumSet.of(Modifier.PUBLIC,Modifier.STATIC),"String_Node_Str","String_Node_Str").beginControlFlow("String_Node_Str" + this.className + "String_Node_Str").emitStatement("String_Node_Str" + this.className + "String_Node_Str");
  for (int index=0; index < fields.size(); ++index) {
    FieldInfo field=fields.get(index);
    String fieldName=field.fieldId.substring("String_Node_Str".length());
    writer.emitStatement(field.fieldId + "String_Node_Str" + Integer.toString(index));
    writer.emitStatement("String_Node_Str",field.columnType,fieldName.toLowerCase(Locale.getDefault()));
  }
  writer.emitStatement("String_Node_Str");
  writer.endControlFlow();
  writer.emitStatement("String_Node_Str" + this.className + "String_Node_Str");
  writer.endMethod().emitEmptyLine();
  writer.endType();
  writer.close();
  fields.clear();
  generatorState=GeneratorStates.PACKAGE;
  return true;
}

Fixed version (ground truth):
public boolean generate() throws IOException {
  writer.setIndent("String_Node_Str");
  if (!emitPackage())   return false;
  if (!emitClass())   return false;
  if (!emitFields())   return false;
  writer.beginMethod("String_Node_Str","String_Node_Str",EnumSet.of(Modifier.PUBLIC,Modifier.STATIC),"String_Node_Str","String_Node_Str").beginControlFlow("String_Node_Str" + this.className + "String_Node_Str").emitStatement("String_Node_Str" + this.className + "String_Node_Str");
  for (int index=0; index < fields.size(); ++index) {
    FieldInfo field=fields.get(index);
    String fieldName=field.fieldId.substring("String_Node_Str".length());
    writer.emitStatement("String_Node_Str",field.columnType,fieldName.toLowerCase(Locale.getDefault()));
  }
  writer.emitStatement("String_Node_Str");
  writer.endControlFlow();
  writer.emitStatement("String_Node_Str" + this.className + "String_Node_Str");
  writer.endMethod().emitEmptyLine();
  writer.endType();
  writer.close();
  fields.clear();
  generatorState=GeneratorStates.PACKAGE;
  return true;
}
Program: 155863
Project: 155863
Buggy source:
public void setName(String value){
  row.setString(rowIndexName,value);
}

Fixed version (ground truth):
@Override public void setName(String value){
  row.setString(index_name,value);
}
Program: 155864
Project: 155864
Buggy source:
public int getAge(){
  return (int)row.getLong(rowIndexAge);
}

Fixed version (ground truth):
@Override public int getAge(){
  return (int)row.getLong(index_age);
}
Program: 155865
Project: 155865
Buggy source:
public String getName(){
  return row.getString(rowIndexName);
}

Fixed version (ground truth):
@Override public String getName(){
  return row.getString(index_name);
}
Program: 155866
Project: 155866
Buggy source:
public void setAge(int value){
  row.setLong(rowIndexAge,value);
}

Fixed version (ground truth):
@Override public void setAge(int value){
  row.setLong(index_age,value);
}
Program: 155867
Project: 155867
Buggy source:
public void setName(String value){
  row.setString(rowIndexName,value);
}

Fixed version (ground truth):
@Override public void setName(String value){
  row.setString(index_name,value);
}
Program: 155868
Project: 155868
Buggy source:
public String getName(){
  return row.getString(rowIndexName);
}

Fixed version (ground truth):
@Override public String getName(){
  return row.getString(index_name);
}
Program: 155869
Project: 155869
Buggy source:
public void addObjectsToRealm(){
  realm.beginWrite();
  for (int i=0; i < 10; i++) {
    AllColumns allColumns=realm.create(AllColumns.class);
    allColumns.setColumnString("String_Node_Str");
    allColumns.setColumnLong(i);
    allColumns.setColumnFloat(1.1F);
    allColumns.setColumnDouble(1.1);
    allColumns.setColumnBoolean(true);
    allColumns.setColumnDate(new Date());
    allColumns.setColumnBinary(new byte[20]);
    User user=realm.create(User.class);
    user.setId(i);
    user.setName("String_Node_Str");
    user.setEmail("String_Node_Str");
    allColumns.setColumnRealmObject(user);
  }
  realm.commit();
}

Fixed version (ground truth):
public void addObjectsToRealm(){
  realm.beginWrite();
  for (int i=0; i < 10; i++) {
    AllColumns allColumns=realm.create(AllColumns.class);
    allColumns.setColumnString("String_Node_Str");
    allColumns.setColumnLong(i);
    allColumns.setColumnFloat(1.1F);
    allColumns.setColumnDouble(1.1);
    allColumns.setColumnBoolean(true);
    allColumns.setColumnDate(new Date());
    User user=realm.create(User.class);
    user.setId(i);
    user.setName("String_Node_Str");
    user.setEmail("String_Node_Str");
  }
  realm.commit();
}
Program: 155870
Project: 155870
Buggy source:
public void testAddObject(){
  realm.beginWrite();
  AllColumns allColumns=realm.create(AllColumns.class);
  allColumns.setColumnString("String_Node_Str");
  allColumns.setColumnLong(1);
  allColumns.setColumnFloat(1.1F);
  allColumns.setColumnDouble(1.1);
  allColumns.setColumnBoolean(true);
  allColumns.setColumnDate(new Date());
  allColumns.setColumnBinary(new byte[20]);
  RealmTableOrViewList<AllColumns> list=realm.allObjects(AllColumns.class);
  assertEquals(1,list.size());
  try {
    realm.commit();
  }
 catch (  UnsupportedOperationException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void testAddObject(){
  realm.beginWrite();
  AllColumns allColumns=realm.create(AllColumns.class);
  allColumns.setColumnString("String_Node_Str");
  allColumns.setColumnLong(1);
  allColumns.setColumnFloat(1.1F);
  allColumns.setColumnDouble(1.1);
  allColumns.setColumnBoolean(true);
  allColumns.setColumnDate(new Date());
  RealmTableOrViewList<AllColumns> list=realm.allObjects(AllColumns.class);
  assertEquals(1,list.size());
  try {
    realm.commit();
  }
 catch (  UnsupportedOperationException e) {
    e.printStackTrace();
  }
}
Program: 155871
Project: 155871
Buggy source:
public void testCreate(){
  realm.beginWrite();
  AllColumns obj=realm.create(AllColumns.class);
  obj.setColumnString("String_Node_Str");
  obj.setColumnLong(1);
  obj.setColumnFloat(1.1F);
  obj.setColumnDouble(1.1);
  obj.setColumnBoolean(true);
  obj.setColumnDate(new Date());
  obj.setColumnBinary(new byte[20]);
  realm.commit();
  RealmList<AllColumns> result=realm.where(AllColumns.class).findAll();
  assertEquals(1,result.size());
}

Fixed version (ground truth):
public void testCreate(){
  realm.beginWrite();
  AllColumns obj=realm.create(AllColumns.class);
  obj.setColumnString("String_Node_Str");
  obj.setColumnLong(1);
  obj.setColumnFloat(1.1F);
  obj.setColumnDouble(1.1);
  obj.setColumnBoolean(true);
  obj.setColumnDate(new Date());
  realm.commit();
  RealmList<AllColumns> result=realm.where(AllColumns.class).findAll();
  assertEquals(1,result.size());
}
Program: 155872
Project: 155872
Buggy source:
public void testAdd(){
  realm.beginWrite();
  AllColumns obj=realm.create(AllColumns.class);
  obj.setColumnString("String_Node_Str");
  obj.setColumnLong(1);
  obj.setColumnFloat(1.1F);
  obj.setColumnDouble(1.1);
  obj.setColumnBoolean(true);
  obj.setColumnDate(new Date());
  obj.setColumnBinary(new byte[20]);
  User user=realm.create(User.class);
  user.setName("String_Node_Str");
  user.setEmail("String_Node_Str");
  user.setId(0);
  realm.commit();
  assertEquals(1,realm.allObjects(AllColumns.class).size());
  assertEquals(1,realm.allObjects(User.class).size());
}

Fixed version (ground truth):
public void testAdd(){
  realm.beginWrite();
  AllColumns obj=realm.create(AllColumns.class);
  obj.setColumnString("String_Node_Str");
  obj.setColumnLong(1);
  obj.setColumnFloat(1.1F);
  obj.setColumnDouble(1.1);
  obj.setColumnBoolean(true);
  obj.setColumnDate(new Date());
  User user=realm.create(User.class);
  user.setName("String_Node_Str");
  user.setEmail("String_Node_Str");
  user.setId(0);
  realm.commit();
  assertEquals(1,realm.allObjects(AllColumns.class).size());
  assertEquals(1,realm.allObjects(User.class).size());
}
Program: 155873
Project: 155873
Buggy source:
public Date getColumnDate(){
  return columnDate;
}

Fixed version (ground truth):
public java.util.Date getColumnDate(){
  return columnDate;
}
Program: 155874
Project: 155874
Buggy source:
public void setColumnString(String columnString){
  this.columnString=columnString;
}

Fixed version (ground truth):
public void setColumnString(String value){
  columnString=value;
}
Program: 155875
Project: 155875
Buggy source:
public void setColumnDouble(double columnDouble){
  this.columnDouble=columnDouble;
}

Fixed version (ground truth):
public void setColumnDouble(double value){
  columnDouble=value;
}
Program: 155876
Project: 155876
Buggy source:
public void setColumnFloat(float columnFloat){
  this.columnFloat=columnFloat;
}

Fixed version (ground truth):
public void setColumnFloat(float value){
  columnFloat=value;
}
Program: 155877
Project: 155877
Buggy source:
public void setColumnLong(long columnLong){
  this.columnLong=columnLong;
}

Fixed version (ground truth):
public void setColumnLong(long value){
  columnLong=value;
}
Program: 155878
Project: 155878
Buggy source:
public void setColumnDate(Date columnDate){
  this.columnDate=columnDate;
}

Fixed version (ground truth):
public void setColumnDate(java.util.Date value){
  columnDate=value;
}
Program: 155879
Project: 155879
Buggy source:
public void setColumnBoolean(boolean columnBoolean){
  this.columnBoolean=columnBoolean;
}

Fixed version (ground truth):
public void setColumnBoolean(boolean value){
  columnBoolean=value;
}
Program: 155881
Project: 155881
Buggy source:
private boolean checkState(int checkState){
  if (writer == null) {
    error("String_Node_Str");
    return false;
  }
  if (state != checkState) {
    error("String_Node_Str");
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean checkState(GeneratorStates checkState){
  if (writer == null) {
    setError("String_Node_Str");
    return false;
  }
  if (generatorState != checkState) {
    setError("String_Node_Str");
    return false;
  }
  return true;
}
Program: 155882
Project: 155882
Buggy source:
public boolean setPackageName(String packageName) throws IOException {
  if (!checkState(0))   return false;
  this.packageName=packageName;
  writer.emitPackage(packageName).emitEmptyLine();
  state=1;
  return true;
}

Fixed version (ground truth):
public boolean setPackageName(String packageName) throws IOException {
  if (!checkState(GeneratorStates.PACKAGE))   return false;
  this.packageName=packageName;
  writer.emitPackage(packageName).emitEmptyLine().emitImports("String_Node_Str");
  generatorState=GeneratorStates.CLASS;
  return true;
}
Program: 155883
Project: 155883
Buggy source:
public boolean setClassName(String className) throws IOException {
  if (!checkState(1))   return false;
  writer.beginType(packageName + "String_Node_Str" + className+ "String_Node_Str","String_Node_Str",EnumSet.of(Modifier.PUBLIC,Modifier.FINAL),className).emitEmptyLine();
  state=2;
  fieldIndex=0;
  return true;
}

Fixed version (ground truth):
public boolean setClassName(String className) throws IOException {
  if (!checkState(GeneratorStates.CLASS))   return false;
  this.className=className;
  writer.beginType(packageName + "String_Node_Str" + className+ "String_Node_Str","String_Node_Str",EnumSet.of(Modifier.PUBLIC,Modifier.FINAL),className).emitEmptyLine();
  generatorState=GeneratorStates.METHODS;
  return true;
}
Program: 155884
Project: 155884
Buggy source:
public boolean generate() throws IOException {
  if (!checkState(2))   return false;
  writer.endType();
  writer.close();
  ignoreFields.clear();
  state=0;
  return true;
}

Fixed version (ground truth):
public boolean generate() throws IOException {
  if (!checkState(GeneratorStates.METHODS))   return false;
  writer.beginInitializer(true).emitStatement("String_Node_Str" + className + "String_Node_Str").emitStatement("String_Node_Str");
  writer.beginControlFlow("String_Node_Str");
  for (  String field : fields) {
    String fieldName=field.substring("String_Node_Str".length());
    writer.beginControlFlow("String_Node_Str",fieldName).emitStatement("String_Node_Str",field).endControlFlow();
  }
  writer.emitStatement("String_Node_Str");
  writer.endControlFlow();
  writer.endInitializer();
  writer.endType();
  writer.close();
  ignoreFields.clear();
  fields.clear();
  generatorState=GeneratorStates.PACKAGE;
  return true;
}
Program: 155885
Project: 155885
Buggy source:
@Test public void testLinkColumns(){
  Group group=new Group();
  Table table1=group.getTable("String_Node_Str");
  Table table2=group.getTable("String_Node_Str");
  table2.addColumn(ColumnType.INTEGER,"String_Node_Str");
  table2.addColumn(ColumnType.STRING,"String_Node_Str");
  table2.add(1,"String_Node_Str");
  table2.add(2,"String_Node_Str");
  table2.add(3,"String_Node_Str");
  table1.addColumnLink(ColumnType.LINK,"String_Node_Str",table2);
  table1.addEmptyRow();
  table1.setLink(0,0,1);
  Table target=table1.getLinkTarget(0);
  System.gc();
  assertEquals(target.getColumnCount(),2);
  String test=target.getString(1,table1.getLink(0,0));
  assertEquals(test,"String_Node_Str");
  group.close();
}

Fixed version (ground truth):
@Test public void testLinkColumns(){
  Group group=new Group();
  Table table1=group.getTable("String_Node_Str");
  Table table2=group.getTable("String_Node_Str");
  table2.addColumn(ColumnType.INTEGER,"String_Node_Str");
  table2.addColumn(ColumnType.STRING,"String_Node_Str");
  table2.add(1,"String_Node_Str");
  table2.add(2,"String_Node_Str");
  table2.add(3,"String_Node_Str");
  table1.addColumnLink(ColumnType.LINK,"String_Node_Str",table2);
  table1.addEmptyRow();
  table1.setLink(0,0,1);
  Table target=table1.getLinkTarget(0);
  System.gc();
  assertEquals(target.getColumnCount(),2);
  String test=target.getString(1,table1.getLink(0,0));
  assertEquals(test,"String_Node_Str");
}
Program: 155886
Project: 155886
Buggy source:
@Override public Date getDate(long columnIndex,long rowIndex){
  return new Date(nativeGetDateTime(nativePtr,columnIndex,rowIndex) * 1000);
}

Fixed version (ground truth):
@Override public Date getDate(long columnIndex,long rowIndex){
  System.err.println("String_Node_Str");
  System.err.println(nativeGetDateTime(nativePtr,columnIndex,rowIndex) * 1000);
  return new Date(nativeGetDateTime(nativePtr,columnIndex,rowIndex) * 1000);
}
Program: 155887
Project: 155887
Buggy source:
@Override public void setDate(long columnIndex,long rowIndex,Date date){
  if (immutable)   throwImmutable();
  nativeSetDate(nativePtr,columnIndex,rowIndex,date.getTime() / 1000);
}

Fixed version (ground truth):
@Override public void setDate(long columnIndex,long rowIndex,Date date){
  if (immutable)   throwImmutable();
  System.err.print("String_Node_Str");
  System.err.println(date.getTime() / 1000);
  nativeSetDate(nativePtr,columnIndex,rowIndex,date.getTime() / 1000);
}
Program: 155888
Project: 155888
Buggy source:
@BeforeMethod void init(){
  t=new Table();
  t.addColumn(ColumnType.STRING,"String_Node_Str");
  t.addColumn(ColumnType.BOOLEAN,"String_Node_Str");
  t.addColumn(ColumnType.INTEGER,"String_Node_Str");
  t.addColumn(ColumnType.DATE,"String_Node_Str");
  t.addColumn(ColumnType.STRING,"String_Node_Str");
  t.addColumn(ColumnType.FLOAT,"String_Node_Str");
  t.addColumn(ColumnType.DOUBLE,"String_Node_Str");
  t.addColumn(ColumnType.MIXED,"String_Node_Str");
  t.addColumn(ColumnType.TABLE,"String_Node_Str");
  t.add("String_Node_Str",true,24,date1,"String_Node_Str",0.0f,0.0,0,null);
  t.add("String_Node_Str",false,35,date2,"String_Node_Str",0.0f,0.0,0,null);
  t.add("String_Node_Str",true,22,date3,"String_Node_Str",0.0f,0.0,0,null);
  t.add("String_Node_Str",false,22,date4,"String_Node_Str",0.0f,0.0,0,null);
}

Fixed version (ground truth):
@BeforeMethod void init(){
  t=new Table();
  t.addColumn(ColumnType.STRING,"String_Node_Str");
  t.addColumn(ColumnType.BOOLEAN,"String_Node_Str");
  t.addColumn(ColumnType.INTEGER,"String_Node_Str");
  t.addColumn(ColumnType.DATE,"String_Node_Str");
  t.addColumn(ColumnType.STRING,"String_Node_Str");
  t.addColumn(ColumnType.FLOAT,"String_Node_Str");
  t.addColumn(ColumnType.DOUBLE,"String_Node_Str");
  t.addColumn(ColumnType.MIXED,"String_Node_Str");
  t.addColumn(ColumnType.TABLE,"String_Node_Str");
  t.add("String_Node_Str",true,24,date1,"String_Node_Str",0.0f,0.0,0,null);
  t.add("String_Node_Str",false,35,date2,"String_Node_Str",0.0f,0.0,0,null);
  t.add("String_Node_Str",true,22,date3,"String_Node_Str",0.0f,0.0,0,null);
  t.add("String_Node_Str",false,22,date4,"String_Node_Str",0.0f,0.0,0,null);
  System.err.println("String_Node_Str");
  System.err.println(date1.getTime() / 1000);
  t.setDate(3,0,date1);
  assertEquals(date1,t.getDate(3,0));
  assertEquals(date2,t.getDate(3,1));
  assertEquals(date3,t.getDate(3,2));
  assertEquals(date4,t.getDate(3,3));
}
Program: 155889
Project: 155889
Buggy source:
@Override public Date getDate(long columnIndex,long rowIndex){
  System.err.println("String_Node_Str");
  System.err.println(nativeGetDateTime(nativePtr,columnIndex,rowIndex) * 1000);
  return new Date(nativeGetDateTime(nativePtr,columnIndex,rowIndex) * 1000);
}

Fixed version (ground truth):
@Override public Date getDate(long columnIndex,long rowIndex){
  return new Date(nativeGetDateTime(nativePtr,columnIndex,rowIndex) * 1000);
}
Program: 155890
Project: 155890
Buggy source:
@Override public void setDate(long columnIndex,long rowIndex,Date date){
  if (immutable)   throwImmutable();
  System.err.print("String_Node_Str");
  System.err.println(date.getTime() / 1000);
  nativeSetDate(nativePtr,columnIndex,rowIndex,date.getTime() / 1000);
}

Fixed version (ground truth):
@Override public void setDate(long columnIndex,long rowIndex,Date date){
  if (immutable)   throwImmutable();
  nativeSetDate(nativePtr,columnIndex,rowIndex,date.getTime() / 1000);
}
Program: 155891
Project: 155891
Buggy source:
@BeforeMethod void init(){
  t=new Table();
  t.addColumn(ColumnType.STRING,"String_Node_Str");
  t.addColumn(ColumnType.BOOLEAN,"String_Node_Str");
  t.addColumn(ColumnType.INTEGER,"String_Node_Str");
  t.addColumn(ColumnType.DATE,"String_Node_Str");
  t.addColumn(ColumnType.STRING,"String_Node_Str");
  t.addColumn(ColumnType.FLOAT,"String_Node_Str");
  t.addColumn(ColumnType.DOUBLE,"String_Node_Str");
  t.addColumn(ColumnType.MIXED,"String_Node_Str");
  t.addColumn(ColumnType.TABLE,"String_Node_Str");
  t.add("String_Node_Str",true,24,date1,"String_Node_Str",0.0f,0.0,0,null);
  t.add("String_Node_Str",false,35,date2,"String_Node_Str",0.0f,0.0,0,null);
  t.add("String_Node_Str",true,22,date3,"String_Node_Str",0.0f,0.0,0,null);
  t.add("String_Node_Str",false,22,date4,"String_Node_Str",0.0f,0.0,0,null);
  System.err.println("String_Node_Str");
  System.err.println(date1.getTime() / 1000);
  t.setDate(3,0,date1);
  assertEquals(date1,t.getDate(3,0));
  assertEquals(date2,t.getDate(3,1));
  assertEquals(date3,t.getDate(3,2));
  assertEquals(date4,t.getDate(3,3));
}

Fixed version (ground truth):
@BeforeMethod void init(){
  t=new Table();
  t.addColumn(ColumnType.STRING,"String_Node_Str");
  t.addColumn(ColumnType.BOOLEAN,"String_Node_Str");
  t.addColumn(ColumnType.INTEGER,"String_Node_Str");
  t.addColumn(ColumnType.DATE,"String_Node_Str");
  t.addColumn(ColumnType.STRING,"String_Node_Str");
  t.addColumn(ColumnType.FLOAT,"String_Node_Str");
  t.addColumn(ColumnType.DOUBLE,"String_Node_Str");
  t.addColumn(ColumnType.MIXED,"String_Node_Str");
  t.addColumn(ColumnType.TABLE,"String_Node_Str");
  t.add("String_Node_Str",true,24,date1,"String_Node_Str",0.0f,0.0,0,null);
  t.add("String_Node_Str",false,35,date2,"String_Node_Str",0.0f,0.0,0,null);
  t.add("String_Node_Str",true,22,date3,"String_Node_Str",0.0f,0.0,0,null);
  t.add("String_Node_Str",false,22,date4,"String_Node_Str",0.0f,0.0,0,null);
  assertEquals(date1,t.getDate(3,0));
  assertEquals(date2,t.getDate(3,1));
  assertEquals(date3,t.getDate(3,2));
  assertEquals(date4,t.getDate(3,3));
}
Program: 155892
Project: 155892
Buggy source:
@Test public void tableBinaryTest(){
  Table t=new Table();
  t.addColumn(ColumnType.ColumnTypeBinary,"String_Node_Str");
  byte[] row0=new byte[]{1,2,3};
  byte[] row1=new byte[]{10,20,30};
  t.insertBinary(0,0,row0);
  t.insertBinary(0,1,row1);
  t.insertDone();
  byte[] nullByte=null;
  try {
    t.insertBinary(0,2,nullByte);
    fail("String_Node_Str");
  }
 catch (  NullPointerException e) {
  }
  ByteBuffer nullBuffer=null;
  try {
    t.insertBinary(0,2,nullBuffer);
    fail("String_Node_Str");
  }
 catch (  NullPointerException e) {
  }
  assertEquals(new byte[]{1,2,3},t.getBinaryByteArray(0,0));
  assertEquals(false,t.getBinaryByteArray(0,0) == new byte[]{1,2,3});
  byte[] newRow0=new byte[]{7,77,77};
  t.setBinaryByteArray(0,0,newRow0);
  assertEquals(new byte[]{7,77,77},t.getBinaryByteArray(0,0));
  assertEquals(false,t.getBinaryByteArray(0,0) == new byte[]{1,2,3});
  try {
    t.setBinaryByteArray(0,2,nullByte);
    fail("String_Node_Str");
  }
 catch (  NullPointerException e) {
  }
  try {
    t.setBinaryByteBuffer(0,2,nullBuffer);
    fail("String_Node_Str");
  }
 catch (  NullPointerException e) {
  }
}

Fixed version (ground truth):
@Test public void tableBinaryTest(){
  Table t=new Table();
  t.addColumn(ColumnType.ColumnTypeBinary,"String_Node_Str");
  byte[] row0=new byte[]{1,2,3};
  byte[] row1=new byte[]{10,20,30};
  t.insertBinary(0,0,row0);
  t.insertDone();
  t.insertBinary(0,1,row1);
  t.insertDone();
  byte[] nullByte=null;
  try {
    t.insertBinary(0,2,nullByte);
    fail("String_Node_Str");
  }
 catch (  NullPointerException e) {
  }
  ByteBuffer nullBuffer=null;
  try {
    t.insertBinary(0,2,nullBuffer);
    fail("String_Node_Str");
  }
 catch (  NullPointerException e) {
  }
  assertEquals(new byte[]{1,2,3},t.getBinaryByteArray(0,0));
  assertEquals(false,t.getBinaryByteArray(0,0) == new byte[]{1,2,3});
  byte[] newRow0=new byte[]{7,77,77};
  t.setBinaryByteArray(0,0,newRow0);
  assertEquals(new byte[]{7,77,77},t.getBinaryByteArray(0,0));
  assertEquals(false,t.getBinaryByteArray(0,0) == new byte[]{1,2,3});
  try {
    t.setBinaryByteArray(0,2,nullByte);
    fail("String_Node_Str");
  }
 catch (  NullPointerException e) {
  }
  try {
    t.setBinaryByteBuffer(0,2,nullBuffer);
    fail("String_Node_Str");
  }
 catch (  NullPointerException e) {
  }
}