nus-yam/ex-repair huggingface dataset:
Program: 98162
Project: 98162
Buggy source:
private void updateFieldIndicesGO(){
  final GenericObject[] buffer=this.bufferGO;
  final int bufferCnt=this.bufferGOCnt;
  int iInd=-1;
  int iField=-1;
  for (  ZooFieldDef field : cls.getAllFields()) {
    iField++;
    if (!field.isIndexed()) {
      continue;
    }
    iInd++;
    SchemaIndexEntry schemaTop=node.getSchemaIE(field.getDeclaringType());
    LongLongIndex fieldInd=(LongLongIndex)schemaTop.getIndex(field);
    try {
      for (int i=0; i < bufferCnt; i++) {
        GenericObject co=buffer[i];
        if (!co.isNew()) {
          long l=co.jdoZooGetBackup()[iInd];
          fieldInd.removeLong(l,co.getOid());
        }
        final long l;
        if (field.isString()) {
          l=(Long)co.getFieldRaw(iInd);
        }
 else {
          Object primO=co.getFieldRaw(iInd);
          l=SerializerTools.primitiveToLong(primO,field.getPrimitiveType());
        }
        if (field.isIndexUnique()) {
          if (!fieldInd.insertLongIfNotSet(l,co.getOid())) {
            if (fieldUpdateBuffer[iField] == null) {
              fieldUpdateBuffer[iField]=new ArrayList<Pair>();
            }
            fieldUpdateBuffer[iField].add(new Pair(co.getOid(),l));
          }
        }
 else {
          fieldInd.insertLong(l,co.getOid());
        }
      }
    }
 catch (    IllegalArgumentException e) {
      throw new JDOFatalDataStoreException("String_Node_Str" + field.getName(),e);
    }
  }
}

Fixed version (ground truth):
private void updateFieldIndicesGO(){
  final GenericObject[] buffer=this.bufferGO;
  final int bufferCnt=this.bufferGOCnt;
  int iInd=-1;
  int iField=-1;
  for (  ZooFieldDef field : cls.getAllFields()) {
    iField++;
    if (!field.isIndexed()) {
      continue;
    }
    iInd++;
    SchemaIndexEntry schemaTop=node.getSchemaIE(field.getDeclaringType());
    LongLongIndex fieldInd=(LongLongIndex)schemaTop.getIndex(field);
    try {
      for (int i=0; i < bufferCnt; i++) {
        GenericObject co=buffer[i];
        if (!co.isNew()) {
          long l=co.jdoZooGetBackup()[iInd];
          fieldInd.removeLong(l,co.getOid());
        }
        final long l;
        if (field.isString()) {
          l=(Long)co.getFieldRaw(iField);
        }
 else {
          Object primO=co.getFieldRaw(iField);
          l=SerializerTools.primitiveToLong(primO,field.getPrimitiveType());
        }
        if (field.isIndexUnique()) {
          if (!fieldInd.insertLongIfNotSet(l,co.getOid())) {
            if (fieldUpdateBuffer[iField] == null) {
              fieldUpdateBuffer[iField]=new ArrayList<Pair>();
            }
            fieldUpdateBuffer[iField].add(new Pair(co.getOid(),l));
          }
        }
 else {
          fieldInd.insertLong(l,co.getOid());
        }
      }
    }
 catch (    IllegalArgumentException e) {
      throw new JDOFatalDataStoreException("String_Node_Str" + field.getName(),e);
    }
  }
}
Program: 98163
Project: 98163
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void addInstanceLifecycleListener(InstanceLifecycleListener arg0,Class[] arg1){
  checkOpen();
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void addInstanceLifecycleListener(InstanceLifecycleListener arg0,Class[] arg1){
  checkFrozen();
  List<Class<?>> clsL=lcListeners.get(arg0);
  if (clsL == null) {
    clsL=new LinkedList<Class<?>>();
    lcListeners.put(arg0,clsL);
  }
  if (arg1 != null) {
    for (    Class<?> c : arg1) {
      clsL.add(c);
    }
  }
 else {
    clsL.add(ZooPCImpl.class);
  }
}
Program: 98164
Project: 98164
Buggy source:
public void addInstanceLifecycleListener(InstanceLifecycleListener listener,Class<?>[] classes){
  for (  Class<?> cls : classes) {
    ZooClassDef def=cache.getSchema(cls,primary);
    def.getProvidedContext().addLifecycleListener(listener);
  }
}

Fixed version (ground truth):
public void addInstanceLifecycleListener(InstanceLifecycleListener listener,Class<?>[] classes){
  if (classes == null) {
    classes=new Class[]{null};
  }
  for (  Class<?> cls : classes) {
    if (cls == null) {
      cls=ZooPCImpl.class;
    }
    ZooClassDef def=cache.getSchema(cls,primary);
    if (def == null) {
      throw DBLogger.newUser("String_Node_Str" + cls);
    }
    def.getProvidedContext().addLifecycleListener(listener);
  }
}
Program: 98166
Project: 98166
Buggy source:
@Test public void testLifecycleListener(){
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  pm.addInstanceLifecycleListener(new ListenerClear(),TestClass.class);
  pm.addInstanceLifecycleListener(new ListenerCreate(),TestClass.class);
  pm.addInstanceLifecycleListener(new ListenerDelete(),TestClass.class);
  pm.addInstanceLifecycleListener(new ListenerDirty(),TestClass.class);
  pm.addInstanceLifecycleListener(new ListenerLoad(),TestClass.class);
  pm.addInstanceLifecycleListener(new ListenerStore(),TestClass.class);
  TestClass t1=new TestClass();
  t1.setRef2(t1);
  assertTrue(calls.isEmpty());
  pm.makePersistent(t1);
  checkCall(ZooInstanceEvent.CREATE);
  assertTrue(calls.isEmpty());
  pm.currentTransaction().commit();
  checkCall(ZooInstanceEvent.PRE_STORE);
  checkCall(ZooInstanceEvent.PRE_CLEAR);
  checkCall(ZooInstanceEvent.POST_CLEAR);
  checkCall(ZooInstanceEvent.POST_STORE);
  assertTrue(calls.isEmpty());
  pm.currentTransaction().begin();
  assertNotNull(t1.getRef2());
  checkCall(ZooInstanceEvent.LOAD);
  assertTrue(calls.isEmpty());
  t1.setRef2(null);
  checkCall(ZooInstanceEvent.PRE_DIRTY);
  checkCall(ZooInstanceEvent.POST_DIRTY);
  System.err.println("String_Node_Str" + "String_Node_Str");
  assertTrue(calls.isEmpty());
  pm.refresh(t1);
  checkCall(ZooInstanceEvent.LOAD);
  assertTrue(calls.isEmpty());
  pm.deletePersistent(t1);
  assertTrue(calls.isEmpty());
  pm.currentTransaction().commit();
  checkCall(ZooInstanceEvent.PRE_DELETE);
  checkCall(ZooInstanceEvent.POST_DELETE);
  assertTrue(calls.isEmpty());
  TestTools.closePM();
}

Fixed version (ground truth):
@Test public void testLifecycleListener(){
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  pm.addInstanceLifecycleListener(new ListenerClear(),TestClass.class);
  pm.addInstanceLifecycleListener(new ListenerCreate(),TestClass.class);
  pm.addInstanceLifecycleListener(new ListenerDelete(),TestClass.class);
  pm.addInstanceLifecycleListener(new ListenerDirty(),TestClass.class);
  pm.addInstanceLifecycleListener(new ListenerLoad(),TestClass.class);
  pm.addInstanceLifecycleListener(new ListenerStore(),TestClass.class);
  internalTest(pm);
  TestTools.closePM();
}
Program: 98167
Project: 98167
Buggy source:
@Test public void testLifecycleListenerRemoval(){
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  ListenerCreate lc=new ListenerCreate();
  pm.addInstanceLifecycleListener(lc,TestClass.class);
  TestClass t1=new TestClass();
  assertTrue(calls.isEmpty());
  pm.makePersistent(t1);
  checkCall(ZooInstanceEvent.CREATE);
  assertTrue(calls.isEmpty());
  pm.removeInstanceLifecycleListener(lc);
  TestClass t2=new TestClass();
  pm.makePersistent(t2);
  assertTrue(calls.isEmpty());
  pm.currentTransaction().rollback();
  TestTools.closePM();
}

Fixed version (ground truth):
@Test public void testLifecycleListenerRemoval(){
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  ListenerCreate lc=new ListenerCreate();
  pm.addInstanceLifecycleListener(lc,TestClass.class);
  TestClass t1=new TestClass();
  assertTrue(calls.isEmpty());
  pm.makePersistent(t1);
  checkCall(ZooInstanceEvent.CREATE,t1);
  assertTrue(calls.isEmpty());
  pm.removeInstanceLifecycleListener(lc);
  TestClass t2=new TestClass();
  pm.makePersistent(t2);
  assertTrue(calls.isEmpty());
  pm.currentTransaction().rollback();
  TestTools.closePM();
}
Program: 98168
Project: 98168
Buggy source:
private void checkCall(ZooInstanceEvent expected){
  assertTrue(calls.size() > 0);
  assertEquals(expected,calls.get(0).type);
  assertEquals(TestClass.class,calls.get(0).e.getSource().getClass());
  calls.remove(0);
}

Fixed version (ground truth):
private void checkCall(ZooInstanceEvent expected,Object pc){
  assertTrue(calls.size() > 0);
  Pair p=calls.get(0);
  System.out.println("String_Node_Str" + calls.size() + "String_Node_Str"+ p.e.getPersistentInstance());
  System.out.println("String_Node_Str" + p.type + "String_Node_Str"+ p.e.getPersistentInstance().getClass());
  assertEquals(expected,p.type);
  assertEquals(TestClass.class,p.e.getSource().getClass());
  assertTrue(pc == p.e.getPersistentInstance());
  calls.remove(0);
}
Program: 98170
Project: 98170
Buggy source:
/** 
 * Method for serializing data with constant size so that it can be stored in the object header where the field offsets are valid.
 */
private final void serializeObjectNoSCO(Object v,ZooFieldDef def){
  if (v == null) {
    writeClassInfo(null,null);
    out.skipWrite(def.getLength() - 1);
    if (def.isString() || def.isDate()) {
      scos.add(null);
      return;
    }
    return;
  }
  Class<? extends Object> cls=v.getClass();
  writeClassInfo(cls,v);
  if (isPersistentCapable(cls)) {
    serializeOid(v);
    return;
  }
 else   if (String.class == cls) {
    scos.add(v);
    String s=(String)v;
    out.writeLong(BitTools.toSortableLong(s));
    return;
  }
 else   if (Date.class == cls) {
    out.writeLong(((Date)v).getTime());
    return;
  }
  throw new IllegalArgumentException("String_Node_Str" + cls);
}

Fixed version (ground truth):
/** 
 * Method for serializing data with constant size so that it can be stored in the object header where the field offsets are valid.
 */
private final void serializeObjectNoSCO(Object v,ZooFieldDef def){
  if (v == null) {
    writeClassInfo(null,null);
    out.skipWrite(def.getLength() - 1);
    if (def.isString()) {
      scos.add(null);
      return;
    }
    return;
  }
  Class<? extends Object> cls=v.getClass();
  writeClassInfo(cls,v);
  if (isPersistentCapable(cls)) {
    serializeOid(v);
    return;
  }
 else   if (String.class == cls) {
    scos.add(v);
    String s=(String)v;
    out.writeLong(BitTools.toSortableLong(s));
    return;
  }
 else   if (Date.class == cls) {
    out.writeLong(((Date)v).getTime());
    return;
  }
  throw new IllegalArgumentException("String_Node_Str" + cls);
}
Program: 98171
Project: 98171
Buggy source:
/** 
 * Declares a new class with a given super-class. 
 * @param pm
 * @param className
 * @param superCls
 * @return New schema object
 */
public static ZooClass declareClass(PersistenceManager pm,String className,ZooClass superCls){
  checkValidity(pm);
  Node node=Session.getSession(pm).getPrimaryNode();
  return Session.getSession(pm).getSchemaManager().declareSchema(className,superCls,node);
}

Fixed version (ground truth):
/** 
 * Declares a new class with a given super-class. 
 * @param pm
 * @param className
 * @param superCls
 * @return New schema object
 */
public static ZooClass declareClass(PersistenceManager pm,String className,ZooClass superCls){
  checkValidity(pm);
  if (!checkJavaClassNameConformity(className)) {
    throw new IllegalArgumentException("String_Node_Str" + className + "String_Node_Str");
  }
  Node node=Session.getSession(pm).getPrimaryNode();
  return Session.getSession(pm).getSchemaManager().declareSchema(className,superCls,node);
}
Program: 98172
Project: 98172
Buggy source:
@Override public void removeField(ZooField field){
  checkInvalid();
  if (!def.jdoZooIsDirty()) {
    def=def.newVersion();
  }
  def.removeField(((ISchemaField)field).getInternal());
}

Fixed version (ground truth):
@Override public void removeField(ZooField field){
  checkInvalid();
  getLatestVersion(true).removeField(((ISchemaField)field).getInternal());
}
Program: 98173
Project: 98173
Buggy source:
@Override public ZooField declareField(String fieldName,ZooClass type,int arrayDepth){
  checkAddField(fieldName);
  return def.addField(fieldName,((ISchema)type).getSchemaDef(),arrayDepth).getApiHandle();
}

Fixed version (ground truth):
@Override public ZooField declareField(String fieldName,ZooClass type,int arrayDepth){
  checkAddField(fieldName);
  return getLatestVersion(true).addField(fieldName,((ISchema)type).getSchemaDef(),arrayDepth).getApiHandle();
}
Program: 98174
Project: 98174
Buggy source:
protected void checkInvalid(){
  Session s=def.getProvidedContext().getSession();
  if (s.getPersistenceManager().isClosed() || !s.getPersistenceManager().currentTransaction().isActive()) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (def.jdoZooIsDeleted()) {
    throw new JDOUserException("String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
protected void checkInvalid(){
  Session s=def.getProvidedContext().getSession();
  if (s.getPersistenceManager().isClosed() || !s.getPersistenceManager().currentTransaction().isActive()) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (def.jdoZooIsDeleted()) {
    throw new JDOUserException("String_Node_Str" + "String_Node_Str");
  }
  getLatestVersion(false);
}
Program: 98175
Project: 98175
Buggy source:
private void checkAddField(String fieldName){
  checkInvalid();
  if (fieldName == null || fieldName.equals("String_Node_Str")) {
    throw new IllegalArgumentException();
  }
  for (  ZooFieldDef fd : def.getAllFields()) {
    if (fd.getName().equals(fieldName)) {
      throw new IllegalArgumentException("String_Node_Str" + fieldName);
    }
  }
  if (!def.jdoZooIsDirty()) {
    def=def.newVersion();
  }
}

Fixed version (ground truth):
private void checkAddField(String fieldName){
  checkInvalid();
  if (!checkJavaFieldNameConformity(fieldName)) {
    throw new IllegalArgumentException("String_Node_Str" + fieldName);
  }
  for (  ZooFieldDef fd : def.getAllFields()) {
    if (fd.getName().equals(fieldName)) {
      throw new IllegalArgumentException("String_Node_Str" + fieldName);
    }
  }
  getLatestVersion(true);
}
Program: 98176
Project: 98176
Buggy source:
@Override public void rename(String name){
  checkInvalid();
}

Fixed version (ground truth):
@Override public void rename(String fieldName){
  checkInvalid();
  if (!ISchema.checkJavaFieldNameConformity(fieldName)) {
    throw new IllegalArgumentException("String_Node_Str" + fieldName);
  }
  if (fieldDef.getDeclaringType().getApiHandle().locateField(fieldName) != null) {
    throw new IllegalArgumentException("String_Node_Str" + fieldName);
  }
  fieldDef.updateName(fieldName);
}
Program: 98177
Project: 98177
Buggy source:
private void checkInvalid(){
  System.err.println("String_Node_Str");
  if (isInvalid) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
  }
  Session s=fieldDef.getDeclaringType().getProvidedContext().getSession();
  if (s.getPersistenceManager().isClosed() || !s.getPersistenceManager().currentTransaction().isActive()) {
    throw new IllegalStateException("String_Node_Str");
  }
}

Fixed version (ground truth):
private void checkInvalid(){
  Session s=fieldDef.getDeclaringType().getProvidedContext().getSession();
  if (s.getPersistenceManager().isClosed() || !s.getPersistenceManager().currentTransaction().isActive()) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (isInvalid) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
  }
}
Program: 98178
Project: 98178
Buggy source:
/** 
 * Only to be used during database startup to load the schema-tree.
 * @param superDef
 */
public void associateSuperDef(ZooClassDef superDef){
  if (this.superDef != null) {
    throw new IllegalStateException();
  }
  if (superDef != null) {
    if (superDef.getOid() != oidSuper) {
      throw new IllegalStateException("String_Node_Str" + oidSuper + "String_Node_Str"+ superDef.getOid()+ "String_Node_Str"+ className);
    }
    superDef.addSubClass(this);
  }
  this.superDef=superDef;
}

Fixed version (ground truth):
/** 
 * Only to be used during database startup to load the schema-tree.
 * @param superDef
 */
public void associateSuperDef(ZooClassDef superDef){
  if (this.superDef != null) {
    throw new IllegalStateException();
  }
  if (superDef == null) {
    throw new IllegalArgumentException();
  }
  if (superDef.getOid() != oidSuper) {
    throw new IllegalStateException("String_Node_Str" + oidSuper + "String_Node_Str"+ superDef.getOid()+ "String_Node_Str"+ className);
  }
  superDef.addSubClass(this);
  this.superDef=superDef;
}
Program: 98179
Project: 98179
Buggy source:
public ZooClassDef newVersion(){
  if (nextVersion != null) {
    throw new IllegalStateException();
  }
  long oid=jdoZooGetContext().getNode().getOidBuffer().allocateOid();
  ZooClassDef newDef=new ZooClassDef(className,oid,oidSuper);
  newDef.associateSuperDef(superDef);
  newDef.prevVersionOid=jdoZooGetOid();
  newDef.prevVersion=this;
  nextVersion=newDef;
  newDef.apiHandle=apiHandle;
  apiHandle=null;
  newDef.providedContext=new PCContext(newDef,providedContext.getSession(),providedContext.getNode());
  newDef.subs.addAll(subs);
  for (  ZooFieldDef f : localFields) {
    ZooFieldDef fNew=new ZooFieldDef(newDef,f.getName(),f.getTypeName(),f.getJdoType());
    newDef.localFields.add(fNew);
  }
  newDef.associateFields();
  providedContext.getSession().makePersistent(newDef);
  return newDef;
}

Fixed version (ground truth):
/** 
 * Schema versioning: We only create new schema instance when we add or remove fields. Renaming a field should not result in a new version! A new version is only required when the modified schema does not match the stored data. Such changes require also new versions of all sub-classes.  WHY? If every class stored only their own fields would we still have a problem? Yes, because the new version of the referenced superclass has a different OID.
 * @return New version.
 */
public ZooClassDef newVersion(){
  if (nextVersion != null) {
    throw new IllegalStateException();
  }
  long oid=jdoZooGetContext().getNode().getOidBuffer().allocateOid();
  ZooClassDef newDef=new ZooClassDef(className,oid,oidSuper);
  superDef.removeSubClass(this);
  newDef.associateSuperDef(superDef);
  newDef.prevVersionOid=jdoZooGetOid();
  newDef.prevVersion=this;
  nextVersion=newDef;
  newDef.apiHandle=apiHandle;
  apiHandle=null;
  newDef.providedContext=new PCContext(newDef,providedContext.getSession(),providedContext.getNode());
  for (  ZooFieldDef f : localFields) {
    ZooFieldDef fNew=new ZooFieldDef(newDef,f.getName(),f.getTypeName(),f.getJdoType());
    newDef.localFields.add(fNew);
  }
  newDef.associateFields();
  providedContext.getSession().makePersistent(newDef);
  for (  ZooClassDef sub : subs) {
    newDef.subs.add(sub.newVersion());
  }
  return newDef;
}
Program: 98180
Project: 98180
Buggy source:
public void deleteSchema(ISchema iSchema){
  ZooClassDef def=iSchema.getSchemaDef();
  if (!def.getSubClasses().isEmpty()) {
    throw new JDOUserException("String_Node_Str" + "String_Node_Str" + def.getSubClasses().get(0).getClassName());
  }
  if (def.jdoZooIsDeleted()) {
    throw new JDOObjectNotFoundException("String_Node_Str");
  }
  for (  ZooPCImpl pci : cache.getAllObjects()) {
    if (pci.jdoZooGetClassDef() == def) {
      pci.jdoZooMarkDeleted();
    }
  }
  Node node=iSchema.getNode();
  ops.add(new SchemaOperation.SchemaDelete(node,iSchema.getSchemaDef()));
  def.jdoZooMarkDeleted();
}

Fixed version (ground truth):
public void deleteSchema(ISchema iSchema){
  ZooClassDef def=iSchema.getSchemaDef();
  if (!def.getSubClasses().isEmpty()) {
    throw new JDOUserException("String_Node_Str" + "String_Node_Str" + def.getSubClasses().get(0).getClassName());
  }
  if (def.jdoZooIsDeleted()) {
    throw new JDOObjectNotFoundException("String_Node_Str");
  }
  for (  ZooPCImpl pci : cache.getAllObjects()) {
    if (pci.jdoZooGetClassDef() == def) {
      pci.jdoZooMarkDeleted();
    }
  }
  Node node=iSchema.getNode();
  ops.add(new SchemaOperation.SchemaDelete(node,iSchema.getSchemaDef()));
  def.jdoZooMarkDeleted();
  System.err.println("String_Node_Str");
}
Program: 98181
Project: 98181
Buggy source:
@Before public void before(){
  TestTools.removeDb(DB_NAME);
  TestTools.createDb(DB_NAME);
}

Fixed version (ground truth):
@Before public void before(){
  TestTools.closePM();
  TestTools.removeDb(DB_NAME);
  TestTools.createDb(DB_NAME);
}
Program: 98182
Project: 98182
Buggy source:
@Override public ZooField locateField(String fieldName){
  checkInvalid();
  for (  ZooFieldDef f : def.getAllFields()) {
    if (f.getName().equals(fieldName)) {
      return f.getApiHandle();
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public ZooField locateField(String fieldName){
  checkInvalid();
  for (  ZooFieldDef f : def.getAllFields()) {
    System.out.println("String_Node_Str" + f.getName() + "String_Node_Str"+ f.getDeclaringType().getClassName()+ "String_Node_Str"+ f.getDeclaringType().getOid());
    if (f.getName().equals(fieldName)) {
      return f.getApiHandle();
    }
  }
  return null;
}
Program: 98183
Project: 98183
Buggy source:
ZooClassDef getLatestVersion(boolean updateIntended){
  ZooClassDef def1=def;
  while (def.getNextVersion() != null) {
    def=def.getNextVersion();
  }
  if (def != def1) {
    throw new IllegalStateException();
  }
  return def;
}

Fixed version (ground truth):
ZooClassDef getLatestVersion(boolean updateIntended){
  ZooClassDef def1=def;
  System.out.println("String_Node_Str" + def);
  while (def.getNextVersion() != null) {
    def=def.getNextVersion();
    System.out.println("String_Node_Str" + def);
  }
  if (def != def1) {
    throw new IllegalStateException();
  }
  return def;
}
Program: 98184
Project: 98184
Buggy source:
@Override public String toString(){
  return className + "String_Node_Str" + Util.oidToString(getOid())+ "String_Node_Str"+ super.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  return className + "String_Node_Str" + Util.oidToString(getOid())+ "String_Node_Str"+ superDef;
}
Program: 98188
Project: 98188
Buggy source:
@After public void after(){
  System.err.println("String_Node_Str");
  try {
    TestTools.closePM();
  }
 catch (  Throwable t) {
    t.printStackTrace();
  }
  System.err.println("String_Node_Str");
  TestTools.removeDb();
  System.err.println("String_Node_Str");
}

Fixed version (ground truth):
@After public void after(){
  try {
    TestTools.closePM();
  }
 catch (  Throwable t) {
    t.printStackTrace();
  }
  TestTools.removeDb();
}
Program: 98189
Project: 98189
Buggy source:
/** 
 * For example: Query q = pm.newQuery (Employee.class, "salary > sal && name.startsWith(begin"); q.declareParameters ("Float sal, String begin");
 */
@Override public void declareParameters(String parameters){
  checkUnmodifiable();
  parameters=parameters.trim();
  int i1=parameters.indexOf(',');
  while (i1 >= 0) {
    String p1=parameters.substring(0,i1).trim();
    _parameters.add(new QueryParameter(p1));
    parameters=parameters.substring(i1 + 1,parameters.length()).trim();
    i1=parameters.indexOf(',');
  }
  _parameters.add(new QueryParameter(parameters));
}

Fixed version (ground truth):
/** 
 * For example: Query q = pm.newQuery (Employee.class, "salary > sal && name.startsWith(begin"); q.declareParameters ("Float sal, String begin");
 */
@Override public void declareParameters(String parameters){
  checkUnmodifiable();
  parameters=parameters.trim();
  int i1=parameters.indexOf(',');
  while (i1 >= 0) {
    String p1=parameters.substring(0,i1).trim();
    this.parameters.add(new QueryParameter(p1));
    parameters=parameters.substring(i1 + 1,parameters.length()).trim();
    i1=parameters.indexOf(',');
  }
  this.parameters.add(new QueryParameter(parameters));
}
Program: 98190
Project: 98190
Buggy source:
private void assignParametersToQueryTree(QueryTreeNode queryTree){
  QueryTreeIterator iter=queryTree.termIterator();
  while (iter.hasNext()) {
    QueryTerm term=iter.next();
    if (!term.isParametrized()) {
      continue;
    }
    String pName=term.getParamName();
    boolean isAssigned=false;
    for (    QueryParameter param : _parameters) {
      if (pName.equals(param.getName())) {
        term.setParameter(param);
        isAssigned=true;
        break;
      }
    }
    if (!isAssigned) {
      System.out.println("String_Node_Str" + pName + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
private void assignParametersToQueryTree(QueryTreeNode queryTree){
  QueryTreeIterator iter=queryTree.termIterator();
  while (iter.hasNext()) {
    QueryTerm term=iter.next();
    if (!term.isParametrized()) {
      continue;
    }
    String pName=term.getParamName();
    boolean isAssigned=false;
    for (    QueryParameter param : parameters) {
      if (pName.equals(param.getName())) {
        term.setParameter(param);
        isAssigned=true;
        break;
      }
    }
    if (!isAssigned) {
      System.out.println("String_Node_Str" + pName + "String_Node_Str");
    }
  }
}
Program: 98191
Project: 98191
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Object execute(Object p1,Object p2,Object p3){
  _parameters.get(0).setValue(p1);
  _parameters.get(1).setValue(p2);
  _parameters.get(2).setValue(p3);
  return execute();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Object execute(Object p1,Object p2,Object p3){
  parameters.get(0).setValue(p1);
  parameters.get(1).setValue(p2);
  parameters.get(2).setValue(p3);
  return execute();
}
Program: 98192
Project: 98192
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Object executeWithArray(Object... parameters){
  for (int i=0; i < parameters.length; i++) {
    _parameters.get(i).setValue(parameters[i]);
  }
  return execute();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Object executeWithArray(Object... parameters){
  for (int i=0; i < parameters.length; i++) {
    this.parameters.get(i).setValue(parameters[i]);
  }
  return execute();
}
Program: 98193
Project: 98193
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private void applyQueryOnExtent(List<Object> ret,QueryAdvice qa){
  QueryTreeNode queryTree=qa.getQuery();
  Iterator<?> ext;
  if (qa.getIndex() != null) {
    ext=pm.getSession().getPrimaryNode().readObjectFromIndex(qa.getIndex(),qa.getMin(),qa.getMax(),!ignoreCache);
  }
 else {
    if (_ext != null) {
      ext=_ext.iterator();
    }
 else {
      ext=new ExtentImpl(candCls,subClasses,pm,ignoreCache).iterator();
    }
  }
  if (_ext != null && (!_ext.hasSubclasses() || !_ext.getCandidateClass().isAssignableFrom(candCls))) {
    final boolean hasSub=_ext.hasSubclasses();
    final Class supCls=_ext.getCandidateClass();
    while (ext.hasNext()) {
      Object o=ext.next();
      if (hasSub) {
        if (!supCls.isAssignableFrom(o.getClass())) {
          continue;
        }
      }
 else {
        if (supCls != o.getClass()) {
          continue;
        }
      }
      boolean isMatch=queryTree.evaluate(o);
      if (isMatch) {
        ret.add(o);
      }
    }
  }
 else {
    while (ext.hasNext()) {
      Object o=ext.next();
      boolean isMatch=queryTree.evaluate(o);
      if (isMatch) {
        ret.add(o);
      }
    }
  }
  if (ext instanceof CloseableIterator) {
    ((CloseableIterator)ext).close();
  }
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private void applyQueryOnExtent(List<Object> ret,QueryAdvice qa){
  QueryTreeNode queryTree=qa.getQuery();
  Iterator<?> ext2;
  if (qa.getIndex() != null) {
    ext2=pm.getSession().getPrimaryNode().readObjectFromIndex(qa.getIndex(),qa.getMin(),qa.getMax(),!ignoreCache);
  }
 else {
    if (ext != null) {
      ext2=ext.iterator();
    }
 else {
      ext2=new ExtentImpl(candCls,subClasses,pm,ignoreCache).iterator();
    }
  }
  if (ext != null && (!ext.hasSubclasses() || !ext.getCandidateClass().isAssignableFrom(candCls))) {
    final boolean hasSub=ext.hasSubclasses();
    final Class supCls=ext.getCandidateClass();
    while (ext2.hasNext()) {
      Object o=ext2.next();
      if (hasSub) {
        if (!supCls.isAssignableFrom(o.getClass())) {
          continue;
        }
      }
 else {
        if (supCls != o.getClass()) {
          continue;
        }
      }
      boolean isMatch=queryTree.evaluate(o);
      if (isMatch) {
        ret.add(o);
      }
    }
  }
 else {
    while (ext2.hasNext()) {
      Object o=ext2.next();
      boolean isMatch=queryTree.evaluate(o);
      if (isMatch) {
        ret.add(o);
      }
    }
  }
  if (ext2 instanceof CloseableIterator) {
    ((CloseableIterator)ext2).close();
  }
}
Program: 98194
Project: 98194
Buggy source:
/** 
 * This class is only public so it can be accessed by the test harness.  Please do not use.
 */
public synchronized final void traverse(){
  DatabaseLogger.debugPrintln(1,"String_Node_Str" + workList.size());
  long t1=System.currentTimeMillis();
  long nObjects=0;
  nObjects+=traverseCache();
  nObjects+=traverseWorkList();
  long t2=System.currentTimeMillis();
  DatabaseLogger.debugPrintln(1,"String_Node_Str" + nObjects + "String_Node_Str"+ seenObjects.size()+ "String_Node_Str"+ (t2 - t1) / 1000.0 + "String_Node_Str" + mpCount);
}

Fixed version (ground truth):
/** 
 * This class is only public so it can be accessed by the test harness.  Please do not use.
 */
public final void traverse(){
  DatabaseLogger.debugPrintln(1,"String_Node_Str" + workList.size());
  long t1=System.currentTimeMillis();
  long nObjects=0;
  nObjects+=traverseCache();
  nObjects+=traverseWorkList();
  long t2=System.currentTimeMillis();
  DatabaseLogger.debugPrintln(1,"String_Node_Str" + nObjects + "String_Node_Str"+ seenObjects.size()+ "String_Node_Str"+ (t2 - t1) / 1000.0 + "String_Node_Str" + mpCount);
}
Program: 98197
Project: 98197
Buggy source:
public Object getValue(){
  if (paramName != null) {
    return _param.getValue();
  }
  return value;
}

Fixed version (ground truth):
public Object getValue(){
  if (paramName != null) {
    return param.getValue();
  }
  return value;
}
Program: 98198
Project: 98198
Buggy source:
public void setParameter(QueryParameter param){
  _param=param;
}

Fixed version (ground truth):
public void setParameter(QueryParameter param){
  this.param=param;
}
Program: 98199
Project: 98199
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public boolean evaluate(Object o){
  Field f=fieldDef.getJavaField();
  Object oVal;
  try {
    oVal=f.get(o);
  }
 catch (  IllegalArgumentException e) {
    throw new JDOFatalInternalException("String_Node_Str" + fieldDef.getName() + "String_Node_Str"+ o.getClass().getName()+ "String_Node_Str"+ f.getDeclaringClass().getName(),e);
  }
catch (  IllegalAccessException e) {
    throw new JDOFatalInternalException("String_Node_Str" + fieldDef.getName(),e);
  }
  Object qVal=getValue();
  if (oVal == null && qVal == QueryParser.NULL) {
    return true;
  }
 else   if (qVal != QueryParser.NULL) {
    if (qVal.equals(oVal) && (op == COMP_OP.EQ || op == COMP_OP.LE || op == COMP_OP.AE)) {
      return true;
    }
    if (qVal instanceof Comparable) {
      Comparable qComp=(Comparable)qVal;
      int res=qComp.compareTo(oVal);
      if (res == 1 && (op == COMP_OP.LE || op == COMP_OP.L || op == COMP_OP.NE)) {
        return true;
      }
 else       if (res == -1 && (op == COMP_OP.AE || op == COMP_OP.A || op == COMP_OP.NE)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public boolean evaluate(Object o){
  Field f=fieldDef.getJavaField();
  Object oVal;
  try {
    oVal=f.get(o);
  }
 catch (  IllegalArgumentException e) {
    throw new JDOFatalInternalException("String_Node_Str" + fieldDef.getName() + "String_Node_Str"+ o.getClass().getName()+ "String_Node_Str"+ f.getDeclaringClass().getName(),e);
  }
catch (  IllegalAccessException e) {
    throw new JDOFatalInternalException("String_Node_Str" + fieldDef.getName(),e);
  }
  Object qVal=getValue();
  if (oVal == null && qVal == QueryParser.NULL) {
    return true;
  }
 else   if (qVal != QueryParser.NULL && oVal != null) {
    if (qVal.equals(oVal) && (op == COMP_OP.EQ || op == COMP_OP.LE || op == COMP_OP.AE)) {
      return true;
    }
    if (qVal instanceof Comparable) {
      Comparable qComp=(Comparable)qVal;
      int res=qComp.compareTo(oVal);
      if (res == 1 && (op == COMP_OP.LE || op == COMP_OP.L || op == COMP_OP.NE)) {
        return true;
      }
 else       if (res == -1 && (op == COMP_OP.AE || op == COMP_OP.A || op == COMP_OP.NE)) {
        return true;
      }
    }
  }
  return false;
}
Program: 98200
Project: 98200
Buggy source:
public QueryParameter getParameter(){
  return _param;
}

Fixed version (ground truth):
public QueryParameter getParameter(){
  return param;
}
Program: 98203
Project: 98203
Buggy source:
/** 
 * Constructor for creating new Index.
 * @param id
 * @param cName
 * @param schPage
 * @param schPageOfs
 * @param raf
 * @throws IOException 
 */
private SchemaIndexEntry(String cName,PageAccessFile raf,long oid){
  this.oid=oid;
  this.cName=cName;
  this.objIndex=PagedPosIndex.newIndex(raf);
}

Fixed version (ground truth):
/** 
 * Constructor for creating new Index.
 * @param id
 * @param cName
 * @param schPage
 * @param schPageOfs
 * @param raf
 * @param def 
 * @throws IOException 
 */
private SchemaIndexEntry(String cName,PageAccessFile raf,long oid,ZooClassDef def){
  this.oid=oid;
  this.cName=cName;
  this.objIndex=PagedPosIndex.newIndex(raf);
  this.classDef=def;
}
Program: 98204
Project: 98204
Buggy source:
public void defineSchema(ZooClassDef def){
  String clsName=def.getClassName();
  SchemaIndexEntry theSchema=getSchema(def.getOid());
  if (theSchema != null) {
    throw new JDOUserException("String_Node_Str" + clsName);
  }
  addSchemaIndexEntry(clsName,def.getOid());
}

Fixed version (ground truth):
public void defineSchema(ZooClassDef def){
  String clsName=def.getClassName();
  long oid=def.getOid();
  if (getSchema(clsName) != null || getSchema(def.getOid()) != null) {
    throw new JDOFatalDataStoreException("String_Node_Str" + clsName + "String_Node_Str"+ Util.oidToString(oid));
  }
  SchemaIndexEntry entry=new SchemaIndexEntry(clsName,raf,oid,def);
  schemaIndex.put(oid,entry);
  markDirty();
}
Program: 98205
Project: 98205
Buggy source:
/** 
 * The generated method asks the current StateManager to approve the change or validates the caller�s authority to set the state.
 */
@Override public final synchronized void jdoReplaceStateManager(javax.jdo.spi.StateManager sm){
  if (jdoStateManager != null) {
    jdoStateManager=jdoStateManager.replacingStateManager(this,sm);
  }
 else {
    JDOImplHelper.checkAuthorizedStateManager(sm);
    jdoStateManager=sm;
    this.jdoFlags=LOAD_REQUIRED;
  }
}

Fixed version (ground truth):
/** 
 * The generated method asks the current StateManager to approve the change or validates the caller�s authority to set the state.
 */
@Override public final void jdoReplaceStateManager(javax.jdo.spi.StateManager sm){
  if (jdoStateManager != null) {
    jdoStateManager=jdoStateManager.replacingStateManager(this,sm);
  }
 else {
    JDOImplHelper.checkAuthorizedStateManager(sm);
    jdoStateManager=sm;
    this.jdoFlags=LOAD_REQUIRED;
  }
}
Program: 98206
Project: 98206
Buggy source:
/** 
 * This method will fail if called on the first page in the tree. However this should not happen, because when called, we already have a reference to a previous page.
 * @param oidIndexPage
 * @return The position of the given page with 0 <= pos < nEntries.
 */
int getPagePosition(AbstractIndexPage indexPage){
  for (int i=0; i < leaves.length; i++) {
    if (leaves[i] == indexPage) {
      return i;
    }
  }
  throw new JDOFatalDataStoreException("String_Node_Str" + indexPage.pageId + "String_Node_Str"+ Arrays.toString(leafPages));
}

Fixed version (ground truth):
/** 
 * This method will fail if called on the first page in the tree. However this should not happen, because when called, we already have a reference to a previous page.
 * @param oidIndexPage
 * @return The position of the given page in the child-array with 0 <= pos <= nEntries.
 */
int getPagePosition(AbstractIndexPage indexPage){
  for (int i=0; i < leaves.length; i++) {
    if (leaves[i] == indexPage) {
      return i;
    }
  }
  throw new JDOFatalDataStoreException("String_Node_Str" + indexPage.pageId + "String_Node_Str"+ Arrays.toString(leafPages));
}
Program: 98207
Project: 98207
Buggy source:
final AbstractIndexPage readPage(int pageId,AbstractIndexPage parentPage){
  if (pageId == 0) {
    throw new IllegalArgumentException();
  }
  paf.seekPageForRead(pageId,false);
  int nL=paf.readShort();
  AbstractIndexPage newPage;
  if (nL == 0) {
    newPage=createPage(parentPage,true);
    newPage.readData();
  }
 else {
    newPage=createPage(parentPage,false);
    paf.noCheckRead(newPage.leafPages);
    newPage.readKeys();
  }
  newPage.pageId=pageId;
  return newPage;
}

Fixed version (ground truth):
final AbstractIndexPage readPage(int pageId,AbstractIndexPage parentPage){
  if (pageId == 0) {
    throw new IllegalArgumentException();
  }
  paf.seekPageForRead(pageId,false);
  int nL=paf.readShort();
  AbstractIndexPage newPage;
  if (nL == 0) {
    newPage=createPage(parentPage,true);
    newPage.readData();
  }
 else {
    newPage=createPage(parentPage,false);
    paf.noCheckRead(newPage.leafPages);
    newPage.readKeys();
  }
  newPage.pageId=pageId;
  newPage.isDirty=false;
  return newPage;
}
Program: 98208
Project: 98208
Buggy source:
protected void assignThisAsRootToLeaves(){
  for (  AbstractIndexPage leaf : leaves) {
    if (leaf != null) {
      leaf.setParent(this);
    }
  }
}

Fixed version (ground truth):
protected void assignThisAsRootToLeaves(){
  for (int i=0; i <= getNEntries(); i++) {
    if (leaves[i] != null) {
      leaves[i].setParent(this);
    }
  }
}
Program: 98209
Project: 98209
Buggy source:
protected final AbstractIndexPage findPage(AbstractIndexPage currentPage,short pagePos){
  return currentPage.readOrCreatePage(pagePos,pageClones);
}

Fixed version (ground truth):
protected final AbstractIndexPage findPage(AbstractIndexPage currentPage,short pagePos){
  return currentPage.readPage(pagePos,pageClones);
}
Program: 98210
Project: 98210
Buggy source:
protected final void markPageDirtyAndClone(){
  if (getNEntries() > 0 || !isLeaf) {
    AbstractIndexPage clone=null;
    for (    AbstractPageIterator<?> indexIter : ind.iterators.keySet()) {
      clone=indexIter.pageUpdateNotify(this,clone,ind.modcount);
    }
  }
  markPageDirty();
}

Fixed version (ground truth):
protected final void markPageDirtyAndClone(){
  if (getNEntries() >= 0 || !isLeaf) {
    AbstractIndexPage clone=null;
    for (    AbstractPageIterator<?> indexIter : ind.iterators.keySet()) {
      clone=indexIter.pageUpdateNotify(this,clone,ind.modcount);
    }
  }
  markPageDirty();
}
Program: 98211
Project: 98211
Buggy source:
protected final AbstractIndexPage readOrCreatePage(short pos,Map<AbstractIndexPage,AbstractIndexPage> transientClones){
  int pageId=leafPages[pos];
  AbstractIndexPage page=leaves[pos];
  if (page != null) {
    if (transientClones.containsKey(page)) {
      return transientClones.get(page);
    }
    return page;
  }
  if (pageId == 0) {
    page=ind.createPage(this,true);
  }
 else {
    page=ind.readPage(pageId,this);
  }
  leaves[pos]=page;
  return page;
}

Fixed version (ground truth):
protected final AbstractIndexPage readOrCreatePage(int pos,boolean allowCreate){
  AbstractIndexPage page=leaves[pos];
  if (page != null) {
    return page;
  }
  int pageId=leafPages[pos];
  if (pageId == 0) {
    if (!allowCreate) {
      return null;
    }
    page=ind.createPage(this,true);
    markPageDirtyAndClone();
    if (getNEntries() != -1) {
      throw new RuntimeException("String_Node_Str" + getNEntries());
    }
    incrementNEntries();
  }
 else {
    page=ind.readPage(pageId,this);
  }
  leaves[pos]=page;
  return page;
}
Program: 98212
Project: 98212
Buggy source:
private boolean checkObject(LLEntry entry,PersistenceCapableImpl pc){
  try {
    long val=entry.getKey();
    Field jField=field.getJavaField();
    if (field.isString()) {
      return val == BitTools.toSortableLong((String)jField.get(pc));
    }
switch (field.getPrimitiveType()) {
case BOOLEAN:
      return val == (jField.getBoolean(pc) ? 1 : 0);
case BYTE:
    return val == jField.getByte(pc);
case DOUBLE:
  System.out.println("String_Node_Str");
case FLOAT:
System.out.println("String_Node_Str");
case INT:
return val == jField.getInt(pc);
case LONG:
return val == jField.getLong(pc);
case SHORT:
return val == jField.getShort(pc);
default :
throw new IllegalArgumentException("String_Node_Str" + field.getPrimitiveType());
}
}
 catch (SecurityException e) {
throw new JDOFatalDataStoreException("String_Node_Str" + field.getName(),e);
}
catch (IllegalArgumentException e) {
throw new JDOFatalDataStoreException("String_Node_Str" + field.getName(),e);
}
catch (IllegalAccessException e) {
throw new JDOFatalDataStoreException("String_Node_Str" + field.getName(),e);
}
}

Fixed version (ground truth):
private boolean checkObject(LLEntry entry,PersistenceCapableImpl pc){
  try {
    long val=entry.getKey();
    Field jField=field.getJavaField();
    if (field.isString()) {
      return val == BitTools.toSortableLong((String)jField.get(pc));
    }
switch (field.getPrimitiveType()) {
case BOOLEAN:
      return val == (jField.getBoolean(pc) ? 1 : 0);
case BYTE:
    return val == jField.getByte(pc);
case DOUBLE:
  System.out.println("String_Node_Str");
return false;
case FLOAT:
System.out.println("String_Node_Str");
return false;
case INT:
return val == jField.getInt(pc);
case LONG:
return val == jField.getLong(pc);
case SHORT:
return val == jField.getShort(pc);
default :
throw new IllegalArgumentException("String_Node_Str" + field.getPrimitiveType());
}
}
 catch (SecurityException e) {
throw new JDOFatalDataStoreException("String_Node_Str" + field.getName(),e);
}
catch (IllegalArgumentException e) {
throw new JDOFatalDataStoreException("String_Node_Str" + field.getName(),e);
}
catch (IllegalAccessException e) {
throw new JDOFatalDataStoreException("String_Node_Str" + field.getName(),e);
}
}
Program: 98213
Project: 98213
Buggy source:
private void findNext(){
  LLEntry e;
  PersistenceCapableImpl pc;
  while (iter.hasNextULL()) {
    e=iter.nextULL();
    pc=file.readObject(deSer,e.getValue());
    if (pc != null && checkObject(e,pc)) {
      this.pc=pc;
      return;
    }
    DatabaseLogger.debugPrintln(1,"String_Node_Str" + Util.oidToString(e.getValue()));
    try {
      index.removeLong(e.getKey(),e.getValue());
    }
 catch (    NoSuchElementException e2) {
      System.err.println("String_Node_Str" + e.getKey() + "String_Node_Str"+ e.getValue());
    }
  }
  this.pc=null;
}

Fixed version (ground truth):
private void findNext(){
  LLEntry e;
  PersistenceCapableImpl pc;
  while (iter.hasNextULL()) {
    e=iter.nextULL();
    pc=file.readObject(deSer,e.getValue());
    if (pc != null && checkObject(e,pc)) {
      this.pc=pc;
      return;
    }
    DatabaseLogger.debugPrintln(1,"String_Node_Str" + Util.oidToString(e.getValue()));
    try {
      index.removeLong(e.getKey(),e.getValue());
    }
 catch (    NoSuchElementException e2) {
      System.err.println("String_Node_Str" + e.getKey() + "String_Node_Str"+ Util.oidToString(e.getValue()));
    }
  }
  this.pc=null;
}
Program: 98214
Project: 98214
Buggy source:
private PageAccessFile createPageAccessFile(){
  FreeSpaceManager fsm=new FreeSpaceManager();
  PageAccessFile paf=new PageAccessFileInMemory(Config.getFilePageSize(),fsm);
  fsm.initBackingIndexNew(paf);
  return paf;
}

Fixed version (ground truth):
private PageAccessFile createPageAccessFile(){
  FreeSpaceManager fsm=new FreeSpaceManager();
  PageAccessFile paf=new PageAccessFileInMemory(Config.getFilePageSize(),fsm);
  fsm.initBackingIndexNew(paf);
  fsm.getNextPage(0);
  return paf;
}
Program: 98215
Project: 98215
Buggy source:
private PageAccessFile createPageAccessFile(){
  FreeSpaceManager fsm=new FreeSpaceManager();
  PageAccessFile paf=new PageAccessFileInMemory(Config.getFilePageSize(),fsm);
  fsm.initBackingIndexNew(paf);
  return paf;
}

Fixed version (ground truth):
private PageAccessFile createPageAccessFile(){
  FreeSpaceManager fsm=new FreeSpaceManager();
  PageAccessFile paf=new PageAccessFileInMemory(Config.getFilePageSize(),fsm);
  fsm.initBackingIndexNew(paf);
  fsm.getNextPage(0);
  return paf;
}
Program: 98216
Project: 98216
Buggy source:
@Test public void testAddStrongCheck(){
  final int MAX=5000;
  PageAccessFile paf=createPageAccessFile();
  PagedOidIndex ind=new PagedOidIndex(paf);
  for (int i=1000; i < 1000 + MAX; i++) {
    ind.insertLong(i,32,32 + i);
    for (int j=1000; j <= i; j++) {
      FilePos fp2=ind.findOid(j);
      if (fp2 == null) {
        ind.print();
        throw new RuntimeException();
      }
    }
  }
  System.out.println("String_Node_Str" + ind.statsGetInnerN() + "String_Node_Str"+ ind.statsGetLeavesN());
  assertNull(ind.findOid(-1));
  assertNull(ind.findOid(0));
  assertNull(ind.findOid(999));
  assertNull(ind.findOid(1000 + MAX));
}

Fixed version (ground truth):
@Test public void testAddStrongCheck(){
  final int MAX=5000;
  PageAccessFile paf=createPageAccessFile();
  PagedOidIndex ind=new PagedOidIndex(paf);
  for (int i=1000; i < 1000 + MAX; i++) {
    ind.insertLong(i,32,32 + i);
    for (int j=1000; j <= i; j++) {
      FilePos fp2=ind.findOid(j);
      if (fp2 == null) {
        ind.print();
        throw new RuntimeException("String_Node_Str" + j + "String_Node_Str"+ i);
      }
    }
  }
  System.out.println("String_Node_Str" + ind.statsGetInnerN() + "String_Node_Str"+ ind.statsGetLeavesN());
  assertNull(ind.findOid(-1));
  assertNull(ind.findOid(0));
  assertNull(ind.findOid(999));
  assertNull(ind.findOid(1000 + MAX));
}
Program: 98217
Project: 98217
Buggy source:
@AfterClass public static void tearDown(){
  TestTools.removeDb(DB_NAME);
  Config.setFilePageSize(Config.FILE_PAGE_SIZE_DEFAULT);
}

Fixed version (ground truth):
@AfterClass public static void tearDown(){
  Config.setFilePageSize(Config.FILE_PAGE_SIZE_DEFAULT);
}
Program: 98218
Project: 98218
Buggy source:
@BeforeClass public static void setUp(){
  Config.setFilePageSize(128);
  TestTools.createDb(DB_NAME);
  TestTools.defineSchema(DB_NAME,TestClass.class);
}

Fixed version (ground truth):
@BeforeClass public static void setUp(){
  Config.setFilePageSize(PAGE_SIZE);
}
Program: 98219
Project: 98219
Buggy source:
@Test public void testSpaceUsage(){
  final int MAX=1000000;
  PageAccessFile paf=createPageAccessFile();
  PagedOidIndex ind=new PagedOidIndex(paf);
  for (int i=1000; i < 1000 + MAX; i++) {
    ind.insertLong(i,32,32 + i);
  }
  System.out.println("String_Node_Str" + ind.statsGetInnerN() + "String_Node_Str"+ ind.statsGetLeavesN());
  double epp=MAX / ind.statsGetLeavesN();
  System.out.println("String_Node_Str" + epp);
  double lpi=(ind.statsGetLeavesN() + ind.statsGetInnerN()) / ind.statsGetInnerN();
  System.out.println("String_Node_Str" + lpi);
}

Fixed version (ground truth):
@Test public void testSpaceUsage(){
  final int MAX=1000000;
  PageAccessFile paf=createPageAccessFile();
  PagedOidIndex ind=new PagedOidIndex(paf);
  for (int i=1000; i < 1000 + MAX; i++) {
    ind.insertLong(i,32,32 + i);
  }
  System.out.println("String_Node_Str" + ind.statsGetInnerN() + "String_Node_Str"+ ind.statsGetLeavesN());
  double epp=MAX / ind.statsGetLeavesN();
  System.out.println("String_Node_Str" + epp);
  assertTrue(epp >= PAGE_SIZE / 32);
  double lpi=(ind.statsGetLeavesN() + ind.statsGetInnerN()) / ind.statsGetInnerN();
  System.out.println("String_Node_Str" + lpi);
  assertTrue(lpi >= PAGE_SIZE / 32);
}
Program: 98220
Project: 98220
Buggy source:
public void setDefaults(){
  fileDefault=FILE_PAF_BB;
  fileManagerDefault=FILE_MGR_ONE_FILE;
  defaultPageSize=FILE_PAGE_SIZE_DEFAULT;
}

Fixed version (ground truth):
public static void setDefaults(){
  fileDefault=FILE_PAF_BB;
  fileManagerDefault=FILE_MGR_ONE_FILE;
  defaultPageSize=FILE_PAGE_SIZE_DEFAULT;
}
Program: 98221
Project: 98221
Buggy source:
public boolean contains(Object o){
  if (!(o instanceof Map.Entry)) {
    return false;
  }
  Map.Entry<Long,V> e=(Map.Entry<Long,V>)o;
  Entry<V> candidate=getEntry(e.getKey());
  return candidate != null && candidate.equals(e);
}

Fixed version (ground truth):
public boolean contains(Object o){
  if (!(o instanceof Entry)) {
    return false;
  }
  Entry<V> e=(Entry<V>)o;
  Entry<V> candidate=getEntry(e.getKey());
  return candidate != null && candidate.equals(e);
}