nus-yam/ex-repair huggingface dataset:
Program: 155755
Project: 155755
Buggy source:
public String getFieldString(){
  return fieldString;
}

Fixed version (ground truth):
public String getFieldString(){
  return realmGetter$fieldString();
}
Program: 155756
Project: 155756
Buggy source:
public void setFieldString(String fieldString){
  this.fieldString=fieldString;
}

Fixed version (ground truth):
public void setFieldString(String fieldString){
  realmSetter$fieldString(fieldString);
}
Program: 155757
Project: 155757
Buggy source:
public AllJavaTypes getFieldObject(){
  return fieldObject;
}

Fixed version (ground truth):
public AllJavaTypes getFieldObject(){
  return realmGetter$fieldObject();
}
Program: 155758
Project: 155758
Buggy source:
public void setFieldList(RealmList<AllJavaTypes> columnRealmList){
  this.fieldList=columnRealmList;
}

Fixed version (ground truth):
public void setFieldList(RealmList<AllJavaTypes> fieldList){
  realmSetter$fieldList(fieldList);
}
Program: 155759
Project: 155759
Buggy source:
public RealmList<AllJavaTypes> getFieldList(){
  return fieldList;
}

Fixed version (ground truth):
public RealmList<AllJavaTypes> getFieldList(){
  return realmGetter$fieldList();
}
Program: 155760
Project: 155760
Buggy source:
public void setFieldBinary(byte[] fieldBinary){
  this.fieldBinary=fieldBinary;
}

Fixed version (ground truth):
public void setFieldBinary(byte[] fieldBinary){
  realmSetter$fieldBinary(fieldBinary);
}
Program: 155761
Project: 155761
Buggy source:
public void setFieldObject(AllJavaTypes columnRealmObject){
  this.fieldObject=columnRealmObject;
}

Fixed version (ground truth):
public void setFieldObject(AllJavaTypes fieldObject){
  realmSetter$fieldObject(fieldObject);
}
Program: 155762
Project: 155762
Buggy source:
public Date getFieldDate(){
  return fieldDate;
}

Fixed version (ground truth):
public Date getFieldDate(){
  return realmGetter$fieldDate();
}
Program: 155763
Project: 155763
Buggy source:
public byte getFieldByte(){
  return fieldByte;
}

Fixed version (ground truth):
public byte getFieldByte(){
  return realmGetter$fieldByte();
}
Program: 155764
Project: 155764
Buggy source:
public void setFieldBoolean(boolean fieldBoolean){
  this.fieldBoolean=fieldBoolean;
}

Fixed version (ground truth):
public void setFieldBoolean(boolean fieldBoolean){
  realmSetter$fieldBoolean(fieldBoolean);
}
Program: 155765
Project: 155765
Buggy source:
public void setFieldInt(int fieldInt){
  this.fieldInt=fieldInt;
}

Fixed version (ground truth):
public void setFieldInt(int fieldInt){
  realmSetter$fieldInt(fieldInt);
}
Program: 155766
Project: 155766
Buggy source:
public void setFieldDate(Date fieldDate){
  this.fieldDate=fieldDate;
}

Fixed version (ground truth):
public void setFieldDate(Date fieldDate){
  realmSetter$fieldDate(fieldDate);
}
Program: 155767
Project: 155767
Buggy source:
public void setFieldFloat(float fieldFloat){
  this.fieldFloat=fieldFloat;
}

Fixed version (ground truth):
public void setFieldFloat(float fieldFloat){
  realmSetter$fieldFloat(fieldFloat);
}
Program: 155768
Project: 155768
Buggy source:
public double getFieldDouble(){
  return fieldDouble;
}

Fixed version (ground truth):
public double getFieldDouble(){
  return realmGetter$fieldDouble();
}
Program: 155769
Project: 155769
Buggy source:
public String getFieldIgnored(){
  return fieldIgnored;
}

Fixed version (ground truth):
public String getFieldIgnored(){
  return realmGetter$fieldIgnored();
}
Program: 155770
Project: 155770
Buggy source:
public short getFieldShort(){
  return fieldShort;
}

Fixed version (ground truth):
public short getFieldShort(){
  return realmGetter$fieldShort();
}
Program: 155771
Project: 155771
Buggy source:
public void setFieldDouble(double fieldDouble){
  this.fieldDouble=fieldDouble;
}

Fixed version (ground truth):
public void setFieldDouble(double fieldDouble){
  realmSetter$fieldDouble(fieldDouble);
}
Program: 155772
Project: 155772
Buggy source:
public void setFieldIgnored(String fieldIgnored){
  this.fieldIgnored=fieldIgnored;
}

Fixed version (ground truth):
public void setFieldIgnored(String fieldIgnored){
  realmSetter$fieldIgnored(fieldIgnored);
}
Program: 155773
Project: 155773
Buggy source:
public int getFieldInt(){
  return fieldInt;
}

Fixed version (ground truth):
public int getFieldInt(){
  return realmGetter$fieldInt();
}
Program: 155774
Project: 155774
Buggy source:
public long getFieldLong(){
  return fieldLong;
}

Fixed version (ground truth):
public long getFieldLong(){
  return realmGetter$fieldLong();
}
Program: 155775
Project: 155775
Buggy source:
public void setFieldLong(long fieldLong){
  this.fieldLong=fieldLong;
}

Fixed version (ground truth):
public void setFieldLong(long fieldLong){
  realmSetter$fieldLong(fieldLong);
}
Program: 155776
Project: 155776
Buggy source:
public byte[] getFieldBinary(){
  return fieldBinary;
}

Fixed version (ground truth):
public byte[] getFieldBinary(){
  return realmGetter$fieldBinary();
}
Program: 155777
Project: 155777
Buggy source:
public void setFieldShort(short fieldShort){
  this.fieldShort=fieldShort;
}

Fixed version (ground truth):
public void setFieldShort(short fieldShort){
  realmSetter$fieldShort(fieldShort);
}
Program: 155778
Project: 155778
Buggy source:
public Date getColumnDate(){
  return columnDate;
}

Fixed version (ground truth):
public Date getColumnDate(){
  return realmGetter$columnDate();
}
Program: 155779
Project: 155779
Buggy source:
public float getColumnFloat(){
  return columnFloat;
}

Fixed version (ground truth):
public float getColumnFloat(){
  return realmGetter$columnFloat();
}
Program: 155780
Project: 155780
Buggy source:
public String getColumnString(){
  return columnString;
}

Fixed version (ground truth):
public String getColumnString(){
  return realmGetter$columnString();
}
Program: 155781
Project: 155781
Buggy source:
public Dog getColumnRealmObject(){
  return columnRealmObject;
}

Fixed version (ground truth):
public Dog getColumnRealmObject(){
  return realmGetter$columnRealmObject();
}
Program: 155782
Project: 155782
Buggy source:
public void setColumnRealmList(RealmList<Dog> columnRealmList){
  this.columnRealmList=columnRealmList;
}

Fixed version (ground truth):
public void setColumnRealmList(RealmList<Dog> columnRealmList){
  realmSetter$columnRealmList(columnRealmList);
}
Program: 155783
Project: 155783
Buggy source:
public double getColumnDouble(){
  return columnDouble;
}

Fixed version (ground truth):
public double getColumnDouble(){
  return realmGetter$columnDouble();
}
Program: 155784
Project: 155784
Buggy source:
public void setColumnRealmObject(Dog columnRealmObject){
  this.columnRealmObject=columnRealmObject;
}

Fixed version (ground truth):
public void setColumnRealmObject(Dog columnRealmObject){
  realmSetter$columnRealmObject(columnRealmObject);
}
Program: 155785
Project: 155785
Buggy source:
public void setColumnString(String columnString){
  this.columnString=columnString;
}

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

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

Fixed version (ground truth):
public void setColumnFloat(float columnFloat){
  realmSetter$columnFloat(columnFloat);
}
Program: 155788
Project: 155788
Buggy source:
public long getColumnLong(){
  return columnLong;
}

Fixed version (ground truth):
public long getColumnLong(){
  return realmGetter$columnLong();
}
Program: 155789
Project: 155789
Buggy source:
public void setColumnLong(long columnLong){
  this.columnLong=columnLong;
}

Fixed version (ground truth):
public void setColumnLong(long columnLong){
  realmSetter$columnLong(columnLong);
}
Program: 155790
Project: 155790
Buggy source:
public byte[] getColumnBinary(){
  return columnBinary;
}

Fixed version (ground truth):
public byte[] getColumnBinary(){
  return realmGetter$columnBinary();
}
Program: 155791
Project: 155791
Buggy source:
public void setColumnDate(Date columnDate){
  this.columnDate=columnDate;
}

Fixed version (ground truth):
public void setColumnDate(Date columnDate){
  realmSetter$columnDate(columnDate);
}
Program: 155792
Project: 155792
Buggy source:
public void setColumnBinary(byte[] columnBinary){
  this.columnBinary=columnBinary;
}

Fixed version (ground truth):
public void setColumnBinary(byte[] columnBinary){
  realmSetter$columnBinary(columnBinary);
}
Program: 155793
Project: 155793
Buggy source:
public RealmList<Dog> getColumnRealmList(){
  return columnRealmList;
}

Fixed version (ground truth):
public RealmList<Dog> getColumnRealmList(){
  return realmGetter$columnRealmList();
}
Program: 155794
Project: 155794
Buggy source:
public void setColumnBoolean(boolean columnBoolean){
  this.columnBoolean=columnBoolean;
}

Fixed version (ground truth):
public void setColumnBoolean(boolean columnBoolean){
  realmSetter$columnBoolean(columnBoolean);
}
Program: 155795
Project: 155795
Buggy source:
public boolean isColumnBoolean(){
  return columnBoolean;
}

Fixed version (ground truth):
public boolean isColumnBoolean(){
  return realmGetter$columnBoolean();
}
Program: 155798
Project: 155798
Buggy source:
/** 
 * Deletes the Realm file defined by the given configuration.
 */
protected static synchronized boolean deleteRealm(RealmConfiguration configuration){
  if (isFileOpen(configuration)) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
  }
  boolean realmDeleted=true;
  String canonicalPath=configuration.getPath();
  File realmFolder=configuration.getRealmFolder();
  String realmFileName=configuration.getRealmFileName();
  List<File> filesToDelete=Arrays.asList(new File(canonicalPath),new File(realmFolder,realmFileName + "String_Node_Str"),new File(realmFolder,realmFileName + "String_Node_Str"),new File(realmFolder,realmFileName + "String_Node_Str"),new File(realmFolder,realmFileName + "String_Node_Str"));
  for (  File fileToDelete : filesToDelete) {
    if (fileToDelete.exists()) {
      boolean deleteResult=fileToDelete.delete();
      if (!deleteResult) {
        realmDeleted=false;
        RealmLog.w("String_Node_Str" + fileToDelete);
      }
    }
  }
  return realmDeleted;
}

Fixed version (ground truth):
/** 
 * Deletes the Realm file defined by the given configuration.
 */
protected static synchronized boolean deleteRealm(RealmConfiguration configuration){
  if (isFileOpen(configuration)) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str" + configuration.getPath());
  }
  boolean realmDeleted=true;
  String canonicalPath=configuration.getPath();
  File realmFolder=configuration.getRealmFolder();
  String realmFileName=configuration.getRealmFileName();
  List<File> filesToDelete=Arrays.asList(new File(canonicalPath),new File(realmFolder,realmFileName + "String_Node_Str"),new File(realmFolder,realmFileName + "String_Node_Str"),new File(realmFolder,realmFileName + "String_Node_Str"),new File(realmFolder,realmFileName + "String_Node_Str"));
  for (  File fileToDelete : filesToDelete) {
    if (fileToDelete.exists()) {
      boolean deleteResult=fileToDelete.delete();
      if (!deleteResult) {
        realmDeleted=false;
        RealmLog.w("String_Node_Str" + fileToDelete);
      }
    }
  }
  return realmDeleted;
}
Program: 155799
Project: 155799
Buggy source:
private void completedAsyncFindFirst(QueryUpdateTask.Result result){
  Set<WeakReference<RealmObject>> updatedRowKey=result.updatedRow.keySet();
  if (updatedRowKey.size() > 0) {
    WeakReference<RealmObject> realmObjectWeakReference=updatedRowKey.iterator().next();
    RealmObject realmObject=realmObjectWeakReference.get();
    if (realmObject != null) {
      SharedGroup.VersionID callerVersionID=realm.sharedGroupManager.getVersion();
      int compare=callerVersionID.compareTo(result.versionID);
      if (compare == 0) {
        realmObject.onCompleted(result.updatedRow.get(realmObjectWeakReference));
        asyncRealmObjects.remove(realmObjectWeakReference);
      }
 else       if (compare > 0) {
        RealmQuery<?> realmQuery=asyncRealmObjects.get(realmObjectWeakReference);
        QueryUpdateTask queryUpdateTask=QueryUpdateTask.newBuilder().realmConfiguration(realm.getConfiguration()).addObject(realmObjectWeakReference,realmQuery.handoverQueryPointer(),realmQuery.getArgument()).sendToHandler(realm.handler,Realm.REALM_COMPLETED_ASYNC_FIND_FIRST).build();
        Realm.asyncQueryExecutor.submit(queryUpdateTask);
      }
 else {
        throw new IllegalStateException("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
private void completedAsyncFindFirst(QueryUpdateTask.Result result){
  Set<WeakReference<? extends RealmObject>> updatedRowKey=result.updatedRow.keySet();
  if (updatedRowKey.size() > 0) {
    WeakReference<? extends RealmObject> realmObjectWeakReference=updatedRowKey.iterator().next();
    RealmObject realmObject=realmObjectWeakReference.get();
    if (realmObject != null) {
      SharedGroup.VersionID callerVersionID=realm.sharedGroupManager.getVersion();
      int compare=callerVersionID.compareTo(result.versionID);
      if (compare == 0) {
        realmObject.onCompleted(result.updatedRow.get(realmObjectWeakReference));
        asyncRealmObjects.remove(realmObjectWeakReference);
      }
 else       if (compare > 0) {
        RealmQuery<?> realmQuery=asyncRealmObjects.get(realmObjectWeakReference);
        QueryUpdateTask queryUpdateTask=QueryUpdateTask.newBuilder().realmConfiguration(realm.getConfiguration()).addObject(realmObjectWeakReference,realmQuery.handoverQueryPointer(),realmQuery.getArgument()).sendToHandler(realm.handler,Realm.REALM_COMPLETED_ASYNC_FIND_FIRST).build();
        Realm.asyncQueryExecutor.submit(queryUpdateTask);
      }
 else {
        throw new IllegalStateException("String_Node_Str");
      }
    }
  }
}
Program: 155800
Project: 155800
Buggy source:
/** 
 * Similar to   {@link #findAllSorted(String,boolean,String,boolean,String,boolean)} butruns asynchronously on a worker thread
 * @return immediately an empty {@link RealmResults}. Users need to register a listener  {@link io.realm.RealmResults#addChangeListener(RealmChangeListener)} to be notifiedwhen the query completes.
 * @throws java.lang.IllegalArgumentException if a field name does not exist.
 */
public RealmResults<E> findAllSortedAsync(String fieldName1,boolean sortAscending1,String fieldName2,boolean sortAscending2,String fieldName3,boolean sortAscending3){
  return findAllSortedAsync(new String[]{fieldName1,fieldName2,fieldName3},new boolean[]{sortAscending1,sortAscending2,sortAscending3});
}

Fixed version (ground truth):
/** 
 * Similar to   {@link #findAllSorted(String,boolean,String,boolean,String,boolean)} butruns asynchronously on a worker thread. (Need a Realm opened from a looper thread to work).
 * @return immediately an empty {@link RealmResults}. Users need to register a listener  {@link io.realm.RealmResults#addChangeListener(RealmChangeListener)} to be notifiedwhen the query completes.
 * @throws java.lang.IllegalArgumentException if a field name does not exist.
 */
public RealmResults<E> findAllSortedAsync(String fieldName1,boolean sortAscending1,String fieldName2,boolean sortAscending2,String fieldName3,boolean sortAscending3){
  return findAllSortedAsync(new String[]{fieldName1,fieldName2,fieldName3},new boolean[]{sortAscending1,sortAscending2,sortAscending3});
}
Program: 155803
Project: 155803
Buggy source:
/** 
 * Add a change listener to this RealmResults.
 * @param listener the change listener to be notified
 */
public void addChangeListener(RealmChangeListener listener){
  if (listener == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (realm != null) {
    realm.checkIfValid();
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (!listeners.contains(listener)) {
    listeners.add(listener);
  }
}

Fixed version (ground truth):
/** 
 * Add a change listener to this RealmResults.
 * @param listener the change listener to be notified
 */
public void addChangeListener(RealmChangeListener listener){
  if (listener == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (realm != null) {
    realm.checkIfValid();
  }
  if (!listeners.contains(listener)) {
    listeners.add(listener);
  }
}
Program: 155804
Project: 155804
Buggy source:
/** 
 * Remove all registered listeners.
 */
public void removeChangeListeners(){
  if (realm != null) {
    realm.checkIfValid();
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  listeners.clear();
}

Fixed version (ground truth):
/** 
 * Remove all registered listeners.
 */
public void removeChangeListeners(){
  if (realm != null) {
    realm.checkIfValid();
  }
  listeners.clear();
}
Program: 155805
Project: 155805
Buggy source:
/** 
 * Remove a previously registered listener.
 * @param listener the instance to be removed.
 */
public void removeChangeListener(RealmChangeListener listener){
  if (listener == null)   throw new IllegalArgumentException("String_Node_Str");
  if (realm != null) {
    realm.checkIfValid();
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  listeners.remove(listener);
}

Fixed version (ground truth):
/** 
 * Remove a previously registered listener.
 * @param listener the instance to be removed.
 */
public void removeChangeListener(RealmChangeListener listener){
  if (listener == null)   throw new IllegalArgumentException("String_Node_Str");
  if (realm != null) {
    realm.checkIfValid();
  }
  listeners.remove(listener);
}
Program: 155806
Project: 155806
Buggy source:
@Override public RealmResultsQueryStep add(WeakReference<RealmResults<?>> weakReference,long handoverQueryPointer,ArgumentsHolder queryArguments){
  if (this.realmResultsEntries == null) {
    this.realmResultsEntries=new ArrayList<QueryEntry<RealmResults<?>>>(1);
  }
  this.realmResultsEntries.add(new QueryEntry<RealmResults<?>>(weakReference,handoverQueryPointer,queryArguments));
  return this;
}

Fixed version (ground truth):
@Override public RealmResultsQueryStep add(WeakReference<RealmResults<?>> weakReference,long handoverQueryPointer,ArgumentsHolder queryArguments){
  if (this.realmResultsEntries == null) {
    this.realmResultsEntries=new ArrayList<QueryEntry>(1);
  }
  this.realmResultsEntries.add(new QueryEntry(weakReference,handoverQueryPointer,queryArguments));
  return this;
}
Program: 155807
Project: 155807
Buggy source:
private QueryUpdateTask(int mode,RealmConfiguration realmConfiguration,List<Builder.QueryEntry<RealmResults<?>>> listOfRealmResults,Builder.QueryEntry<RealmObject> realmObject,WeakReference<Handler> handler,int message){
  this.updateMode=mode;
  this.realmConfiguration=realmConfiguration;
  this.realmResultsEntries=listOfRealmResults;
  this.realmObjectEntry=realmObject;
  this.callerHandler=handler;
  this.message=message;
}

Fixed version (ground truth):
private QueryUpdateTask(int mode,RealmConfiguration realmConfiguration,List<Builder.QueryEntry> listOfRealmResults,Builder.QueryEntry realmObject,WeakReference<Handler> handler,int message){
  this.updateMode=mode;
  this.realmConfiguration=realmConfiguration;
  this.realmResultsEntries=listOfRealmResults;
  this.realmObjectEntry=realmObject;
  this.callerHandler=handler;
  this.message=message;
}
Program: 155808
Project: 155808
Buggy source:
private QueryEntry(WeakReference<T> element,long handoverQueryPointer,ArgumentsHolder queryArguments){
  this.element=element;
  this.handoverQueryPointer=handoverQueryPointer;
  this.queryArguments=queryArguments;
}

Fixed version (ground truth):
private QueryEntry(WeakReference element,long handoverQueryPointer,ArgumentsHolder queryArguments){
  this.element=element;
  this.handoverQueryPointer=handoverQueryPointer;
  this.queryArguments=queryArguments;
}
Program: 155809
Project: 155809
Buggy source:
public static Result newRealmObjectResponse(){
  Result result=new Result();
  result.updatedRow=new IdentityHashMap<WeakReference<RealmObject>,Long>(1);
  return result;
}

Fixed version (ground truth):
public static Result newRealmObjectResponse(){
  Result result=new Result();
  result.updatedRow=new IdentityHashMap<WeakReference<? extends RealmObject>,Long>(1);
  return result;
}
Program: 155811
Project: 155811
Buggy source:
@Override public HandlerStep addObject(WeakReference<RealmObject> weakReference,long handoverQueryPointer,ArgumentsHolder queryArguments){
  realmObjectEntry=new QueryEntry<RealmObject>(weakReference,handoverQueryPointer,queryArguments);
  return this;
}

Fixed version (ground truth):
@Override public HandlerStep addObject(WeakReference<? extends RealmObject> weakReference,long handoverQueryPointer,ArgumentsHolder queryArguments){
  realmObjectEntry=new QueryEntry(weakReference,handoverQueryPointer,queryArguments);
  return this;
}
Program: 155812
Project: 155812
Buggy source:
@Override public void run(){
  NativeObjectReference reference;
  while (true) {
    try {
      reference=(NativeObjectReference)referenceQueue.remove();
      UncheckedRow.nativeClose(reference.nativePointer);
    }
 catch (    InterruptedException e) {
      Thread.currentThread().interrupt();
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  NativeObjectReference reference;
  while (true) {
    try {
      reference=(NativeObjectReference)referenceQueue.remove();
      references.remove(reference);
      UncheckedRow.nativeClose(reference.nativePointer);
    }
 catch (    InterruptedException e) {
      Thread.currentThread().interrupt();
    }
  }
}
Program: 155813
Project: 155813
Buggy source:
/** 
 * Sets the   {@link io.realm.RealmConfiguration} used when calling {@link #getDefaultInstance()}
 * @param configuration RealmConfiguration to use as the default configuration
 * @see {@link io.realm.RealmConfiguration} for details on how to configure a Realm
 */
public static void setDefaultConfiguration(RealmConfiguration configuration){
  if (configuration == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  defaultConfiguration=configuration;
}

Fixed version (ground truth):
/** 
 * Sets the   {@link io.realm.RealmConfiguration} used when calling {@link #getDefaultInstance()}.
 * @param configuration RealmConfiguration to use as the default configuration.
 * @see RealmConfiguration for details on how to configure a Realm.
 */
public static void setDefaultConfiguration(RealmConfiguration configuration){
  if (configuration == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  defaultConfiguration=configuration;
}
Program: 155814
Project: 155814
Buggy source:
/** 
 * Realm static constructor that returns the Realm instance defined by provided   {@link io.realm.RealmConfiguration}
 * @return an instance of the Realm class
 * @throws RealmMigrationNeededException If no migration has been provided by the configuration and themodel classes or version has has changed so a migration is required.
 * @see {@link io.realm.RealmConfiguration} for details on how to configure a Realm.
 */
public static Realm getInstance(RealmConfiguration configuration){
  if (configuration == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return create(configuration);
}

Fixed version (ground truth):
/** 
 * Realm static constructor that returns the Realm instance defined by provided   {@link io.realm.RealmConfiguration}
 * @return an instance of the Realm class
 * @throws RealmMigrationNeededException If no migration has been provided by the configuration and themodel classes or version has has changed so a migration is required.
 * @see RealmConfiguration for details on how to configure a Realm.
 */
public static Realm getInstance(RealmConfiguration configuration){
  if (configuration == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return create(configuration);
}
Program: 155815
Project: 155815
Buggy source:
/** 
 * Replaces the existing module(s) with one or more   {@link RealmModule}s. Using this method will replace the current schema for this Realm with the schema defined by the provided modules. A reference to the default Realm module containing all Realm classes in the project (but not dependencies), can be found using   {@link Realm#getDefaultModule()}. Combining the schema from the app project and a library dependency is thus done using the following code:  {@code builder.setModules(Realm.getDefaultMode(), new MyLibraryModule()); }
 * @param baseModule        First Realm module (required).
 * @param additionalModules Additional Realm modules
 * @throws {@link IllegalArgumentException} if any of the modules are {@code null} or doesn't have the{@link RealmModule} annotation.
 * @see Realm#getDefaultModule()
 */
public Builder setModules(Object baseModule,Object... additionalModules){
  modules.clear();
  addModule(baseModule);
  if (additionalModules != null) {
    for (int i=0; i < additionalModules.length; i++) {
      Object module=additionalModules[i];
      checkModule(module);
      addModule(module);
    }
  }
  return this;
}

Fixed version (ground truth):
/** 
 * Replaces the existing module(s) with one or more   {@link RealmModule}s. Using this method will replace the current schema for this Realm with the schema defined by the provided modules. A reference to the default Realm module containing all Realm classes in the project (but not dependencies), can be found using   {@link Realm#getDefaultModule()}. Combining the schema from the app project and a library dependency is thus done using the following code:  {@code builder.setModules(Realm.getDefaultMode(), new MyLibraryModule()); }
 * @param baseModule        First Realm module (required).
 * @param additionalModules Additional Realm modules
 * @throws IllegalArgumentException if any of the modules are {@code null} or doesn't have the{@link RealmModule} annotation.
 * @see Realm#getDefaultModule()
 */
public Builder setModules(Object baseModule,Object... additionalModules){
  modules.clear();
  addModule(baseModule);
  if (additionalModules != null) {
    for (int i=0; i < additionalModules.length; i++) {
      Object module=additionalModules[i];
      checkModule(module);
      addModule(module);
    }
  }
  return this;
}
Program: 155816
Project: 155816
Buggy source:
/** 
 * Setting this will change the behavior of how migration exceptions are handled. Instead of throwing a  {@link io.realm.exceptions.RealmMigrationNeededException} the on-disc Realm will be cleared and recreatedwith the new Realm schema. <bold>WARNING!</bold> This will result in loss of data.
 */
public Builder deleteRealmIfMigrationNeeded(){
  this.deleteRealmIfMigrationNeeded=true;
  return this;
}

Fixed version (ground truth):
/** 
 * Setting this will change the behavior of how migration exceptions are handled. Instead of throwing a  {@link io.realm.exceptions.RealmMigrationNeededException} the on-disc Realm will be cleared and recreatedwith the new Realm schema. <b>WARNING!</b> This will result in loss of data.
 */
public Builder deleteRealmIfMigrationNeeded(){
  this.deleteRealmIfMigrationNeeded=true;
  return this;
}
Program: 155819
Project: 155819
Buggy source:
/** 
 * Instantiates and adds a new object to the realm
 * @param clazz The Class of the object to create
 * @return The new object
 * @throws RealmException An object could not be created
 */
public <E extends RealmObject>E createObject(Class<E> clazz){
  Table table;
  table=tables.get(clazz);
  if (table == null) {
    Class<?> generatedClass=getProxyClass(clazz);
    Method method=initTableMethods.get(generatedClass);
    if (method == null) {
      try {
        method=generatedClass.getMethod("String_Node_Str",new Class[]{ImplicitTransaction.class});
      }
 catch (      NoSuchMethodException e) {
        throw new RealmException("String_Node_Str" + APT_NOT_EXECUTED_MESSAGE);
      }
      initTableMethods.put(generatedClass,method);
    }
    try {
      table=(Table)method.invoke(null,transaction);
      tables.put(clazz,table);
    }
 catch (    IllegalAccessException e) {
      throw new RealmException("String_Node_Str" + APT_NOT_EXECUTED_MESSAGE);
    }
catch (    InvocationTargetException e) {
      e.printStackTrace();
      throw new RealmException("String_Node_Str" + APT_NOT_EXECUTED_MESSAGE);
    }
  }
  long rowIndex=table.addEmptyRow();
  return get(clazz,rowIndex);
}

Fixed version (ground truth):
/** 
 * Creates a new object inside the Realm with the Primary key value initially set. If the value violates the primary key constraint, no object will be added and and  {@link RealmException will be thrown}.
 * @param clazz The Class of the object to create
 * @param primaryKeyValue Value for the primary key field.
 * @return The new object
 * @throws {@link RealmException} if object could not be created.
 */
<E extends RealmObject>E createObject(Class<E> clazz,Object primaryKeyValue){
  Table table;
  table=tables.get(clazz);
  if (table == null) {
    Class<?> generatedClass=getProxyClass(clazz);
    Method method=initTableMethods.get(generatedClass);
    if (method == null) {
      try {
        method=generatedClass.getMethod("String_Node_Str",new Class[]{ImplicitTransaction.class});
      }
 catch (      NoSuchMethodException e) {
        throw new RealmException("String_Node_Str" + APT_NOT_EXECUTED_MESSAGE);
      }
      initTableMethods.put(generatedClass,method);
    }
    try {
      table=(Table)method.invoke(null,transaction);
      tables.put(clazz,table);
    }
 catch (    IllegalAccessException e) {
      throw new RealmException("String_Node_Str" + APT_NOT_EXECUTED_MESSAGE);
    }
catch (    InvocationTargetException e) {
      e.printStackTrace();
      throw new RealmException("String_Node_Str" + APT_NOT_EXECUTED_MESSAGE);
    }
  }
  long rowIndex=table.addEmptyRowWithPrimaryKey(primaryKeyValue);
  return get(clazz,rowIndex);
}
Program: 155820
Project: 155820
Buggy source:
/** 
 * Returns a typed @{link io.realm.RealmQuery}, which can be used to query for specific objects of this type.
 * @return A typed RealmQuery
 * @see io.realm.RealmQuery
 */
public RealmQuery<E> where(){
  realm.checkIfValid();
  return new RealmQuery<E>(this,classSpec);
}

Fixed version (ground truth):
/** 
 * Returns a typed   {@link io.realm.RealmQuery}, which can be used to query for specific objects of this type.
 * @return A typed RealmQuery
 * @see io.realm.RealmQuery
 */
public RealmQuery<E> where(){
  realm.checkIfValid();
  return new RealmQuery<E>(this,classSpec);
}
Program: 155821
Project: 155821
Buggy source:
/** 
 * Sort existing {link io.realm.RealmResults} using three fields.
 * @param fieldName1 first field name.
 * @param sortAscending1 sort order for first field.
 * @param fieldName2 second field name.
 * @param sortAscending2 sort order for second field.
 * @param fieldName3 third field name.
 * @param sortAscending3 sort order for third field.
 * @throws java.lang.IllegalArgumentException if a field name does not exist.
 */
public void sort(String fieldName1,boolean sortAscending1,String fieldName2,boolean sortAscending2,String fieldName3,boolean sortAscending3){
  sort(new String[]{fieldName1,fieldName2,fieldName3},new boolean[]{sortAscending1,sortAscending2,sortAscending3});
}

Fixed version (ground truth):
/** 
 * Sort existing   {@link io.realm.RealmResults} using three fields.
 * @param fieldName1 first field name.
 * @param sortAscending1 sort order for first field.
 * @param fieldName2 second field name.
 * @param sortAscending2 sort order for second field.
 * @param fieldName3 third field name.
 * @param sortAscending3 sort order for third field.
 * @throws java.lang.IllegalArgumentException if a field name does not exist.
 */
public void sort(String fieldName1,boolean sortAscending1,String fieldName2,boolean sortAscending2,String fieldName3,boolean sortAscending3){
  sort(new String[]{fieldName1,fieldName2,fieldName3},new boolean[]{sortAscending1,sortAscending2,sortAscending3});
}
Program: 155822
Project: 155822
Buggy source:
/** 
 * Override the standard behavior of all classes extended RealmObject being part of the schema. Use this method to define the schema as only the classes given here. This class must be called before calling   {@link #getInstance(android.content.Context)}If   {@code null} is given as parameter, the Schema is reset to use all known classes.
 */
static void setSchema(Class<? extends RealmObject>... schemaClass){
  customSchema.clear();
  if (schemaClass != null) {
    for (int i=0; i < schemaClass.length; i++) {
      customSchema.add(schemaClass[i]);
    }
  }
}

Fixed version (ground truth):
/** 
 * Override the standard behavior of all classes extended RealmObject being part of the schema. Use this method to define the schema as only the classes given here. This class must be called before calling   {@link #getInstance(android.content.Context)}If   {@code null} is given as parameter, the Schema is reset to use all known classes.
 */
@SafeVarargs static void setSchema(Class<? extends RealmObject>... schemaClass){
  customSchema.clear();
  if (schemaClass != null) {
    Collections.addAll(customSchema,schemaClass);
  }
}
Program: 155823
Project: 155823
Buggy source:
/** 
 * Starts a write transaction, this must be closed with   {@link io.realm.Realm#commitTransaction()}or aborted by @{link io.realm.Realm#cancelTransaction()}. Write transactions are used to atomically create, update and delete objects within a realm. <br> Before beginning the write transaction, @{link io.realm.Realm#beginTransaction()} updates the realm in the case of pending updates from other threads. <br> Notice: it is not possible to nest write transactions. If you start a write transaction within a write transaction an exception is thrown. <br>
 * @throws java.lang.IllegalStateException If already in a write transaction or incorrect thread.
 */
public void beginTransaction(){
  checkIfValid();
  transaction.promoteToWrite();
}

Fixed version (ground truth):
/** 
 * Starts a write transaction, this must be closed with   {@link io.realm.Realm#commitTransaction()}or aborted by   {@link io.realm.Realm#cancelTransaction()}. Write transactions are used to atomically create, update and delete objects within a realm. <br> Before beginning the write transaction,   {@link io.realm.Realm#beginTransaction()} updates therealm in the case of pending updates from other threads. <br> Notice: it is not possible to nest write transactions. If you start a write transaction within a write transaction an exception is thrown. <br>
 * @throws java.lang.IllegalStateException If already in a write transaction or incorrect thread.
 */
public void beginTransaction(){
  checkIfValid();
  transaction.promoteToWrite();
}
Program: 155824
Project: 155824
Buggy source:
/** 
 * All changes since @{link io.realm.Realm#beginTransaction()} are persisted to disk and the realm reverts back to being read-only. An event is sent to notify all other realm instances that a change has occurred. When the event is received, the other realms will get their objects and @{link io.realm.RealmResults} updated to reflect the changes from this commit.
 * @throws java.lang.IllegalStateException If the write transaction is in an invalid state or incorrect thread.
 */
public void commitTransaction(){
  checkIfValid();
  transaction.commitAndContinueAsRead();
  for (  Map.Entry<Handler,Integer> handlerIntegerEntry : handlers.entrySet()) {
    Handler handler=handlerIntegerEntry.getKey();
    int realmId=handlerIntegerEntry.getValue();
    if (realmId == id && !handler.hasMessages(REALM_CHANGED) && handler.getLooper().getThread().isAlive() && !handler.equals(this.handler)) {
      handler.sendEmptyMessage(REALM_CHANGED);
    }
  }
  sendNotifications();
}

Fixed version (ground truth):
/** 
 * All changes since   {@link io.realm.Realm#beginTransaction()} are persisted to disk and therealm reverts back to being read-only. An event is sent to notify all other realm instances that a change has occurred. When the event is received, the other realms will get their objects and  {@link io.realm.RealmResults} updated to reflectthe changes from this commit.
 * @throws java.lang.IllegalStateException If the write transaction is in an invalid state or incorrect thread.
 */
public void commitTransaction(){
  checkIfValid();
  transaction.commitAndContinueAsRead();
  for (  Map.Entry<Handler,Integer> handlerIntegerEntry : handlers.entrySet()) {
    Handler handler=handlerIntegerEntry.getKey();
    int realmId=handlerIntegerEntry.getValue();
    if (realmId == id && !handler.hasMessages(REALM_CHANGED) && handler.getLooper().getThread().isAlive() && !handler.equals(this.handler)) {
      handler.sendEmptyMessage(REALM_CHANGED);
    }
  }
  sendNotifications();
}
Program: 155825
Project: 155825
Buggy source:
/** 
 * Delete the Realm file from the filesystem for a custom named Realm. The realm must be unused and closed before calling this method.
 * @param context  an Android @{{@link android.content.Context}.
 * @param fileName the name of the custom Realm (i.e. "myCustomRealm.realm").
 * @return false if a file could not be deleted. The failing file will be logged.
 */
public static synchronized boolean deleteRealmFile(Context context,String fileName){
  boolean result=true;
  File writableFolder=context.getFilesDir();
  File realmFile=new File(writableFolder,fileName);
  int realmId=realmFile.getAbsolutePath().hashCode();
  AtomicInteger counter=openRealms.get(realmId);
  if (counter != null && counter.get() > 0) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
  }
  List<File> filesToDelete=Arrays.asList(realmFile,new File(writableFolder,fileName + "String_Node_Str"));
  for (  File fileToDelete : filesToDelete) {
    if (fileToDelete.exists()) {
      boolean deleteResult=fileToDelete.delete();
      if (!deleteResult) {
        result=false;
        Log.w(TAG,"String_Node_Str" + fileToDelete);
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Delete the Realm file from the filesystem for a custom named Realm. The realm must be unused and closed before calling this method.
 * @param context  an Android {@link android.content.Context}.
 * @param fileName the name of the custom Realm (i.e. "myCustomRealm.realm").
 * @return false if a file could not be deleted. The failing file will be logged.
 */
public static synchronized boolean deleteRealmFile(Context context,String fileName){
  boolean result=true;
  File writableFolder=context.getFilesDir();
  File realmFile=new File(writableFolder,fileName);
  int realmId=realmFile.getAbsolutePath().hashCode();
  AtomicInteger counter=openRealms.get(realmId);
  if (counter != null && counter.get() > 0) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
  }
  List<File> filesToDelete=Arrays.asList(realmFile,new File(writableFolder,fileName + "String_Node_Str"));
  for (  File fileToDelete : filesToDelete) {
    if (fileToDelete.exists()) {
      boolean deleteResult=fileToDelete.delete();
      if (!deleteResult) {
        result=false;
        Log.w(TAG,"String_Node_Str" + fileToDelete);
      }
    }
  }
  return result;
}
Program: 155826
Project: 155826
Buggy source:
/** 
 * Realm static constructor. {link io.realm.close} must be called when you are done using the Realm instance. <p> It sets auto-refresh on if the current thread has a Looper, off otherwise.
 * @param writeableFolder a File object representing a writeable folder
 * @param fileName the name of the Realm file
 * @param key     a 64-byte encryption key
 * @return an instance of the Realm class
 * @throws RealmMigrationNeededException The model classes have been changed and the Realmmust be migrated
 * @throws RealmIOException              Error when accessing underlying file
 * @throws RealmException                Other errors
 */
@SuppressWarnings("String_Node_Str") public static Realm getInstance(File writeableFolder,String fileName,byte[] key){
  return Realm.create(writeableFolder,fileName,key);
}

Fixed version (ground truth):
/** 
 * Realm static constructor.  {@link #close()} must be called when you are done using the Realm instance.<p> It sets auto-refresh on if the current thread has a Looper, off otherwise.
 * @param writeableFolder a File object representing a writeable folder
 * @param fileName the name of the Realm file
 * @param key     a 64-byte encryption key
 * @return an instance of the Realm class
 * @throws RealmMigrationNeededException The model classes have been changed and the Realmmust be migrated
 * @throws RealmIOException              Error when accessing underlying file
 * @throws RealmException                Other errors
 */
@SuppressWarnings("String_Node_Str") public static Realm getInstance(File writeableFolder,String fileName,byte[] key){
  return Realm.create(writeableFolder,fileName,key);
}
Program: 155827
Project: 155827
Buggy source:
public static void emitFillJavaTypeWithJsonValue(String setter,String fieldName,String qualifiedFieldType,JavaWriter writer) throws IOException {
  if (JAVA_TO_JSON_TYPES.containsKey(qualifiedFieldType)) {
    writer.beginControlFlow("String_Node_Str",fieldName);
    JAVA_TO_JSON_TYPES.get(qualifiedFieldType).emitTypeConversion(setter,fieldName,qualifiedFieldType,writer);
    writer.endControlFlow();
  }
}

Fixed version (ground truth):
public static void emitFillJavaTypeWithJsonValue(String setter,String fieldName,String qualifiedFieldType,JavaWriter writer) throws IOException {
  JsonToRealmTypeConverter typeEmitter=JAVA_TO_JSON_TYPES.get(qualifiedFieldType);
  if (typeEmitter != null) {
    typeEmitter.emitTypeConversion(setter,fieldName,qualifiedFieldType,writer);
  }
}
Program: 155828
Project: 155828
Buggy source:
private void checkNativePtrNotZero(){
  if (this.nativePtr == 0) {
    throw new java.lang.OutOfMemoryError("String_Node_Str");
  }
}

Fixed version (ground truth):
private void checkNativePtrNotZero(){
  if (this.nativePtr == 0) {
    throw new IOError(new RealmIOException("String_Node_Str"));
  }
}
Program: 155830
Project: 155830
Buggy source:
/** 
 * Closes the Realm instance and all its resources. It's important to always remember to close Realm instances when you're done with it in order  not to leak memory, file descriptors or grow the size of Realm file out of measure.
 */
@Override public void close(){
  Map<Integer,Integer> localRefCount=referenceCount.get();
  Integer references=localRefCount.get(id);
  if (references == null) {
    references=0;
  }
  if (sharedGroup != null && references == 1) {
    realmsCache.get().remove(id);
    sharedGroup.close();
    sharedGroup=null;
  }
  localRefCount.put(id,references - 1);
  referenceCount.set(localRefCount);
  if (handler != null) {
    handlers.remove(handler);
  }
}

Fixed version (ground truth):
/** 
 * Closes the Realm instance and all its resources. It's important to always remember to close Realm instances when you're done with it in order  not to leak memory, file descriptors or grow the size of Realm file out of measure.
 */
@Override public void close(){
  Map<Integer,Integer> localRefCount=referenceCount.get();
  Integer references=localRefCount.get(id);
  if (references == null) {
    references=0;
  }
  if (sharedGroup != null && references == 1) {
    realmsCache.get().remove(id);
    sharedGroup.close();
    sharedGroup=null;
  }
  localRefCount.put(id,Math.max(0,references - 1));
  if (handler != null) {
    handlers.remove(handler);
    handler=null;
  }
}
Program: 155831
Project: 155831
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) {
    handler.removeCallbacksAndMessages(null);
    handlers.remove(handler);
    handler=null;
  }
  this.autoRefresh=autoRefresh;
}
Program: 155832
Project: 155832
Buggy source:
@Override public Boolean call() throws Exception {
  Looper.prepare();
  Realm realm=null;
  try {
    realm=Realm.getInstance(getContext());
    final RealmResults<Dog> dogs=realm.allObjects(Dog.class);
    assertEquals(0,dogs.size());
    realm.addChangeListener(new RealmChangeListener(){
      @Override public void onChange(){
        int c=counter.incrementAndGet();
        results.put(c,dogs.size());
      }
    }
);
    isReady.set(true);
    Looper.loop();
  }
  finally {
    if (realm != null) {
      realm.close();
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public Boolean call() throws Exception {
  Looper.prepare();
  Realm realm=Realm.getInstance(getContext());
  backgroundLooperStarted.countDown();
  final RealmResults<Dog> dogs=realm.allObjects(Dog.class);
  if (dogs.size() != 0) {
    return false;
  }
  addHandlerMessages.await(1,TimeUnit.SECONDS);
  Handler threadHandler=null;
  for (  final Handler handler : Realm.handlers.keySet()) {
    if (Realm.handlers.get(handler).equals(realm.getPath().hashCode())) {
      threadHandler=handler;
      break;
    }
  }
  realm.close();
  threadHandler.post(new Runnable(){
    @Override public void run(){
      Looper.myLooper().quit();
    }
  }
);
  try {
    Looper.loop();
  }
 catch (  IllegalStateException e) {
    return false;
  }
  return true;
}
Program: 155833
Project: 155833
Buggy source:
/** 
 * Closes the Realm instance and all its resources. It's important to always remember to close Realm instances when you're done with it in order  not to leak memory, file descriptors or grow the size of Realm file out of measure.
 */
@Override public void close(){
  Map<Integer,Integer> localRefCount=referenceCount.get();
  Integer references=localRefCount.get(id);
  if (references == null) {
    references=0;
  }
  if (sharedGroup != null && references == 1) {
    realmsCache.get().remove(id);
    sharedGroup.close();
    sharedGroup=null;
  }
  localRefCount.put(id,references - 1);
  referenceCount.set(localRefCount);
  if (handler != null) {
    handlers.remove(handler);
  }
}

Fixed version (ground truth):
/** 
 * Closes the Realm instance and all its resources. It's important to always remember to close Realm instances when you're done with it in order  not to leak memory, file descriptors or grow the size of Realm file out of measure.
 */
@Override public void close(){
  Map<Integer,Integer> localRefCount=referenceCount.get();
  Integer references=localRefCount.get(id);
  if (references == null) {
    references=0;
  }
  if (sharedGroup != null && references == 1) {
    realmsCache.get().remove(id);
    sharedGroup.close();
    sharedGroup=null;
  }
  localRefCount.put(id,references - 1);
  referenceCount.set(localRefCount);
  if (handler != null) {
    removeHandler(handler);
  }
}