nus-yam/ex-repair huggingface dataset:
Program: 98094
Project: 98094
Buggy source:
public void commit(boolean retainValues){
  checkOpen();
  ObjectGraphTraverser ogt=new ObjectGraphTraverser(this,cache);
  ogt.traverse();
  schemaManager.commit();
  try {
    commitInternal();
    for (    Node n : nodes) {
      n.commit();
    }
    cache.postCommit(retainValues);
  }
 catch (  RuntimeException e) {
    if (DBLogger.isUser(e)) {
      for (      ZooClassDef cs : cache.getSchemata()) {
        cs.getProvidedContext().getDataSink().reset();
        cs.getProvidedContext().getDataDeleteSink().reset();
      }
      for (      Node n : nodes) {
        n.revert();
      }
    }
    throw e;
  }
  for (  CloseableIterator<?> ext : extents.keySet()) {
    ext.refresh();
  }
  DBLogger.debugPrintln(2,"String_Node_Str");
  isActive=false;
}

Fixed version (ground truth):
public void commit(boolean retainValues){
  checkActive();
  ObjectGraphTraverser ogt=new ObjectGraphTraverser(this,cache);
  ogt.traverse();
  schemaManager.commit();
  try {
    commitInternal();
    for (    Node n : nodes) {
      n.commit();
    }
    cache.postCommit(retainValues);
  }
 catch (  RuntimeException e) {
    if (DBLogger.isUser(e)) {
      for (      ZooClassDef cs : cache.getSchemata()) {
        cs.getProvidedContext().getDataSink().reset();
        cs.getProvidedContext().getDataDeleteSink().reset();
      }
      for (      Node n : nodes) {
        n.revert();
      }
    }
    throw e;
  }
  for (  CloseableIterator<?> ext : extents.keySet()) {
    ext.refresh();
  }
  DBLogger.debugPrintln(2,"String_Node_Str");
  isActive=false;
}
Program: 98095
Project: 98095
Buggy source:
public void makePersistent(ZooPCImpl pc){
  checkOpen();
  if (pc.jdoZooIsPersistent()) {
    if (pc.jdoZooGetContext().getSession() != this) {
      throw DBLogger.newUser("String_Node_Str");
    }
    if (pc.jdoZooIsDeleted()) {
      throw DBLogger.newUser("String_Node_Str");
    }
    return;
  }
  primary.makePersistent(pc);
}

Fixed version (ground truth):
public void makePersistent(ZooPCImpl pc){
  checkActive();
  if (pc.jdoZooIsPersistent()) {
    if (pc.jdoZooGetContext().getSession() != this) {
      throw DBLogger.newUser("String_Node_Str");
    }
    if (pc.jdoZooIsDeleted()) {
      throw DBLogger.newUser("String_Node_Str");
    }
    return;
  }
  primary.makePersistent(pc);
}
Program: 98096
Project: 98096
Buggy source:
private void checkOpen(){
  if (!isActive) {
    throw new JDOUserException("String_Node_Str");
  }
  if (!isOpen) {
    throw DBLogger.newUser("String_Node_Str");
  }
}

Fixed version (ground truth):
private void checkOpen(){
  if (!isOpen) {
    throw DBLogger.newUser("String_Node_Str");
  }
}
Program: 98097
Project: 98097
Buggy source:
public void evictAll(boolean subClasses,Class<?> cls){
  checkOpen();
  cache.evictAll(subClasses,cls);
}

Fixed version (ground truth):
public void evictAll(boolean subClasses,Class<?> cls){
  checkActive();
  cache.evictAll(subClasses,cls);
}
Program: 98098
Project: 98098
Buggy source:
public void refreshAll(Collection<?> arg0){
  checkOpen();
  for (  Object obj : arg0) {
    refreshObject(obj);
  }
}

Fixed version (ground truth):
public void refreshAll(Collection<?> arg0){
  checkActive();
  for (  Object obj : arg0) {
    refreshObject(obj);
  }
}
Program: 98099
Project: 98099
Buggy source:
public void rollback(){
  checkOpen();
  schemaManager.rollback();
  for (  Node n : nodes) {
    n.rollback();
  }
  cache.rollback();
  isActive=false;
}

Fixed version (ground truth):
public void rollback(){
  checkActive();
  schemaManager.rollback();
  for (  Node n : nodes) {
    n.rollback();
  }
  cache.rollback();
  isActive=false;
}
Program: 98100
Project: 98100
Buggy source:
public void removeInstanceLifecycleListener(InstanceLifecycleListener listener){
  checkOpen();
  for (  ZooClassDef def : cache.getSchemata()) {
    def.getProvidedContext().removeLifecycleListener(listener);
  }
}

Fixed version (ground truth):
public void removeInstanceLifecycleListener(InstanceLifecycleListener listener){
  checkActive();
  for (  ZooClassDef def : cache.getSchemata()) {
    def.getProvidedContext().removeLifecycleListener(listener);
  }
}
Program: 98101
Project: 98101
Buggy source:
public void makeTransient(ZooPCImpl pc){
  checkOpen();
  if (!pc.jdoZooIsPersistent()) {
    return;
  }
  if (pc.jdoZooGetContext().getSession() != this) {
    throw DBLogger.newUser("String_Node_Str");
  }
  if (pc.jdoZooIsDirty()) {
    throw DBLogger.newUser("String_Node_Str");
  }
  cache.makeTransient((ZooPCImpl)pc);
}

Fixed version (ground truth):
public void makeTransient(ZooPCImpl pc){
  checkActive();
  if (!pc.jdoZooIsPersistent()) {
    return;
  }
  if (pc.jdoZooGetContext().getSession() != this) {
    throw DBLogger.newUser("String_Node_Str");
  }
  if (pc.jdoZooIsDirty()) {
    throw DBLogger.newUser("String_Node_Str");
  }
  cache.makeTransient((ZooPCImpl)pc);
}
Program: 98102
Project: 98102
Buggy source:
public Object getObjectById(Object arg0){
  checkOpen();
  long oid=(Long)arg0;
  ZooPCImpl co=cache.findCoByOID(oid);
  if (co != null) {
    if (co.jdoZooIsStateHollow() && !co.jdoZooIsDeleted()) {
      co.jdoZooGetNode().refreshObject(co);
    }
    return co;
  }
  for (  Node n : nodes) {
    co=n.loadInstanceById(oid);
    if (co != null) {
      break;
    }
  }
  return co;
}

Fixed version (ground truth):
public Object getObjectById(Object arg0){
  checkActive();
  long oid=(Long)arg0;
  ZooPCImpl co=cache.findCoByOID(oid);
  if (co != null) {
    if (co.jdoZooIsStateHollow() && !co.jdoZooIsDeleted()) {
      co.jdoZooGetNode().refreshObject(co);
    }
    return co;
  }
  for (  Node n : nodes) {
    co=n.loadInstanceById(oid);
    if (co != null) {
      break;
    }
  }
  return co;
}
Program: 98103
Project: 98103
Buggy source:
public Object[] getObjectsById(Collection<? extends Object> arg0){
  checkOpen();
  Object[] res=new Object[arg0.size()];
  int i=0;
  for (  Object obj : arg0) {
    res[i]=getObjectById(obj);
    i++;
  }
  return res;
}

Fixed version (ground truth):
public Object[] getObjectsById(Collection<? extends Object> arg0){
  checkActive();
  Object[] res=new Object[arg0.size()];
  int i=0;
  for (  Object obj : arg0) {
    res[i]=getObjectById(obj);
    i++;
  }
  return res;
}
Program: 98104
Project: 98104
Buggy source:
public void begin(){
  if (isActive) {
    throw DBLogger.newUser("String_Node_Str");
  }
  isActive=true;
}

Fixed version (ground truth):
public void begin(){
  checkOpen();
  if (isActive) {
    throw DBLogger.newUser("String_Node_Str");
  }
  isActive=true;
}
Program: 98105
Project: 98105
Buggy source:
public Session(PersistenceManagerImpl pm,String dbPath,boolean autoCreateSchema){
  this.pm=pm;
  System.out.println("String_Node_Str");
  isActive=true;
  this.cache=new ClientSessionCache(this);
  this.schemaManager=new SchemaManager(cache,autoCreateSchema);
  this.primary=ZooFactory.get().createNode(dbPath,cache);
  this.nodes.add(primary);
  this.cache.addNode(primary);
  this.primary.connect();
  System.out.println("String_Node_Str");
  isActive=false;
}

Fixed version (ground truth):
public Session(PersistenceManagerImpl pm,String dbPath,boolean autoCreateSchema){
  this.pm=pm;
  this.cache=new ClientSessionCache(this);
  this.schemaManager=new SchemaManager(cache,autoCreateSchema);
  this.primary=ZooFactory.get().createNode(dbPath,cache);
  this.nodes.add(primary);
  this.cache.addNode(primary);
  this.primary.connect();
}
Program: 98106
Project: 98106
Buggy source:
public Collection<ZooPCImpl> getCachedObjects(){
  checkOpen();
  HashSet<ZooPCImpl> ret=new HashSet<ZooPCImpl>();
  for (  ZooPCImpl o : cache.getAllObjects()) {
    ret.add(o);
  }
  return ret;
}

Fixed version (ground truth):
public Collection<ZooPCImpl> getCachedObjects(){
  checkActive();
  HashSet<ZooPCImpl> ret=new HashSet<ZooPCImpl>();
  for (  ZooPCImpl o : cache.getAllObjects()) {
    ret.add(o);
  }
  return ret;
}
Program: 98107
Project: 98107
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.PersistenceManagerFactory#setRetainValues(boolean)
 */
@Override public void setRetainValues(boolean flag){
  checkFrozen();
  isRetainValues=flag;
}

Fixed version (ground truth):
/** 
 * @see PersistenceManagerFactory#setRetainValues(boolean)
 */
@Override public void setRetainValues(boolean flag){
  checkFrozen();
  isRetainValues=flag;
}
Program: 98108
Project: 98108
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.PersistenceManagerFactory#getRetainValues()
 */
@Override public boolean getRetainValues(){
  return isRetainValues;
}

Fixed version (ground truth):
/** 
 * @see PersistenceManagerFactory#getRetainValues()
 */
@Override public boolean getRetainValues(){
  return isRetainValues;
}
Program: 98109
Project: 98109
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.Extent#getPersistenceManager()
 */
@Override public PersistenceManager getPersistenceManager(){
  return pm;
}

Fixed version (ground truth):
/** 
 * @see Extent#getPersistenceManager()
 */
@Override public PersistenceManager getPersistenceManager(){
  return pm;
}
Program: 98110
Project: 98110
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.Extent#hasSubclasses()
 */
@Override public boolean hasSubclasses(){
  return subclasses;
}

Fixed version (ground truth):
/** 
 * @see Extent#hasSubclasses()
 */
@Override public boolean hasSubclasses(){
  return subclasses;
}
Program: 98111
Project: 98111
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.Extent#iterator()
 */
@Override public Iterator<T> iterator(){
  @SuppressWarnings("String_Node_Str") CloseableIterator<T> it=(CloseableIterator<T>)pm.getSession().loadAllInstances(extClass,subclasses,!ignoreCache);
  allIterators.add(it);
  return it;
}

Fixed version (ground truth):
/** 
 * @see Extent#iterator()
 */
@Override public Iterator<T> iterator(){
  @SuppressWarnings("String_Node_Str") CloseableIterator<T> it=(CloseableIterator<T>)pm.getSession().loadAllInstances(extClass,subclasses,!ignoreCache);
  allIterators.add(it);
  return it;
}
Program: 98112
Project: 98112
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.Extent#closeAll()
 */
@Override public void closeAll(){
  for (  CloseableIterator<T> i : allIterators) {
    i.close();
  }
  allIterators.clear();
}

Fixed version (ground truth):
/** 
 * @see Extent#closeAll()
 */
@Override public void closeAll(){
  for (  CloseableIterator<T> i : allIterators) {
    i.close();
  }
  allIterators.clear();
}
Program: 98113
Project: 98113
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.Extent#close(java.util.Iterator)
 */
@Override public void close(Iterator<T> i){
  CloseableIterator.class.cast(i).close();
  allIterators.remove(i);
}

Fixed version (ground truth):
/** 
 * @see Extent#close(java.util.Iterator)
 */
@Override public void close(Iterator<T> i){
  CloseableIterator.class.cast(i).close();
  allIterators.remove(i);
}
Program: 98114
Project: 98114
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.PersistenceManagerFactory#getProperties()
 */
@Override public Properties getProperties(){
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
/** 
 * @see PersistenceManagerFactory#getProperties()
 */
@Override public Properties getProperties(){
  throw new UnsupportedOperationException();
}
Program: 98115
Project: 98115
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.PersistenceManager#getPersistenceManagerFactory()
 */
@Override public PersistenceManagerFactory getPersistenceManagerFactory(){
  return factory;
}

Fixed version (ground truth):
/** 
 * @see PersistenceManager#getPersistenceManagerFactory()
 */
@Override public PersistenceManagerFactory getPersistenceManagerFactory(){
  return factory;
}
Program: 98116
Project: 98116
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.PersistenceManager#getObjectId(java.lang.Object)
 */
@Override public Object getObjectId(Object pc){
  checkOpen();
  if (pc == null) {
    return null;
  }
  if (!(pc instanceof ZooPCImpl)) {
    return null;
  }
  long oid=((ZooPCImpl)pc).jdoZooGetOid();
  return ((Long)Session.OID_NOT_ASSIGNED).equals(oid) ? null : oid;
}

Fixed version (ground truth):
/** 
 * @see PersistenceManager#getObjectId(java.lang.Object)
 */
@Override public Object getObjectId(Object pc){
  checkOpen();
  if (pc == null) {
    return null;
  }
  if (!(pc instanceof ZooPCImpl)) {
    return null;
  }
  long oid=((ZooPCImpl)pc).jdoZooGetOid();
  return ((Long)Session.OID_NOT_ASSIGNED).equals(oid) ? null : oid;
}
Program: 98117
Project: 98117
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.PersistenceManager#getObjectIdClass(Class)
 */
@SuppressWarnings("String_Node_Str") @Override public Class<?> getObjectIdClass(Class cls){
  checkOpen();
  if (cls == null) {
    return null;
  }
  return OBJECT_ID_CLASS;
}

Fixed version (ground truth):
/** 
 * @see PersistenceManager#getObjectIdClass(Class)
 */
@SuppressWarnings("String_Node_Str") @Override public Class<?> getObjectIdClass(Class cls){
  checkOpen();
  if (cls == null) {
    return null;
  }
  return OBJECT_ID_CLASS;
}
Program: 98118
Project: 98118
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.PersistenceManager#currentTransaction()
 */
@Override public Transaction currentTransaction(){
  checkOpenIgnoreTx();
  return transaction;
}

Fixed version (ground truth):
/** 
 * @see PersistenceManager#currentTransaction()
 */
@Override public Transaction currentTransaction(){
  checkOpenIgnoreTx();
  return transaction;
}
Program: 98119
Project: 98119
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.PersistenceManager#newInstance(Class)
 */
@Override public <T>T newInstance(Class<T> pcClass){
  checkOpen();
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
/** 
 * @see PersistenceManager#newInstance(Class)
 */
@Override public <T>T newInstance(Class<T> pcClass){
  checkOpen();
  throw new UnsupportedOperationException();
}
Program: 98120
Project: 98120
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.PersistenceManager#deletePersistent(java.lang.Object)
 */
@Override public void deletePersistent(Object pc){
  checkOpen();
  nativeConnection.deletePersistent(pc);
}

Fixed version (ground truth):
/** 
 * @see PersistenceManager#deletePersistent(java.lang.Object)
 */
@Override public void deletePersistent(Object pc){
  checkOpen();
  nativeConnection.deletePersistent(pc);
}
Program: 98121
Project: 98121
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.PersistenceManager#close()
 */
@Override public void close(){
  if (isClosed) {
    throw new JDOUserException("String_Node_Str");
  }
  if (transaction.isActive()) {
    throw new JDOUserException("String_Node_Str");
  }
  TransientField.deregisterTx(transaction);
  defaultSession.compareAndSet(this,null);
  nativeConnection.close();
  transaction=null;
  isClosed=true;
  factory.deRegister(this);
}

Fixed version (ground truth):
/** 
 * @see PersistenceManager#close()
 */
@Override public void close(){
  if (isClosed) {
    throw new JDOUserException("String_Node_Str");
  }
  if (transaction.isActive()) {
    throw new JDOUserException("String_Node_Str");
  }
  TransientField.deregisterTx(transaction);
  defaultSession.compareAndSet(this,null);
  nativeConnection.close();
  transaction=null;
  isClosed=true;
  factory.deRegister(this);
}
Program: 98122
Project: 98122
Buggy source:
@Override public <T>T[] detachCopyAll(T... arg0){
  checkOpen();
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
@Override @SafeVarargs public final <T>T[] detachCopyAll(T... arg0){
  checkOpen();
  throw new UnsupportedOperationException();
}
Program: 98123
Project: 98123
Buggy source:
/** 
 * Refreshes and places a ReadLock on the object.
 * @see org.zoodb.jdo.oldStuff.PersistenceManager#refresh(java.lang.Object)
 */
@Override public void refresh(Object pc){
  checkOpen();
  nativeConnection.refreshObject(pc);
}

Fixed version (ground truth):
/** 
 * Refreshes and places a ReadLock on the object.
 * @see PersistenceManager#refresh(java.lang.Object)
 */
@Override public void refresh(Object pc){
  checkOpen();
  nativeConnection.refreshObject(pc);
}
Program: 98124
Project: 98124
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.PersistenceManager#isClosed()
 */
@Override public boolean isClosed(){
  return isClosed;
}

Fixed version (ground truth):
/** 
 * @see PersistenceManager#isClosed()
 */
@Override public boolean isClosed(){
  return isClosed;
}
Program: 98125
Project: 98125
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.Transaction#commit()
 */
@Override public synchronized void rollback(){
  if (!isOpen) {
    throw new JDOUserException("String_Node_Str" + "String_Node_Str");
  }
  connection.rollback();
  isOpen=false;
  if (sync != null) {
    sync.afterCompletion(Status.STATUS_ROLLEDBACK);
  }
}

Fixed version (ground truth):
/** 
 * @see Transaction#commit()
 */
@Override public synchronized void rollback(){
  if (!isOpen) {
    throw new JDOUserException("String_Node_Str" + "String_Node_Str");
  }
  connection.rollback();
  isOpen=false;
  if (sync != null) {
    sync.afterCompletion(Status.STATUS_ROLLEDBACK);
  }
}
Program: 98126
Project: 98126
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.Transaction#getPersistenceManager()
 */
@Override public PersistenceManager getPersistenceManager(){
  return pm;
}

Fixed version (ground truth):
/** 
 * @see Transaction#getPersistenceManager()
 */
@Override public PersistenceManager getPersistenceManager(){
  return pm;
}
Program: 98127
Project: 98127
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.Transaction#commit()
 */
@Override public synchronized void commit(){
  if (!isOpen) {
    throw new JDOUserException("String_Node_Str" + "String_Node_Str");
  }
  if (sync != null) {
    sync.beforeCompletion();
  }
  connection.commit(retainValues);
  isOpen=false;
  if (sync != null) {
    sync.afterCompletion(Status.STATUS_COMMITTED);
  }
}

Fixed version (ground truth):
/** 
 * @see Transaction#commit()
 */
@Override public synchronized void commit(){
  if (!isOpen) {
    throw new JDOUserException("String_Node_Str" + "String_Node_Str");
  }
  if (sync != null) {
    sync.beforeCompletion();
  }
  connection.commit(retainValues);
  isOpen=false;
  if (sync != null) {
    sync.afterCompletion(Status.STATUS_COMMITTED);
  }
}
Program: 98128
Project: 98128
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.Transaction#isActive()
 */
@Override public boolean isActive(){
  return isOpen;
}

Fixed version (ground truth):
/** 
 * @see Transaction#isActive()
 */
@Override public boolean isActive(){
  return isOpen;
}
Program: 98129
Project: 98129
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.Transaction#setSynchronization(javax.Transaction.Synchronization)
 */
@Override public synchronized void setSynchronization(Synchronization sync){
  this.sync=sync;
}

Fixed version (ground truth):
/** 
 * @see Transaction#setSynchronization(Synchronization)
 */
@Override public synchronized void setSynchronization(Synchronization sync){
  this.sync=sync;
}
Program: 98130
Project: 98130
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.Transaction#getSynchronization()
 */
@Override synchronized public Synchronization getSynchronization(){
  return sync;
}

Fixed version (ground truth):
/** 
 * @see Transaction#getSynchronization()
 */
@Override synchronized public Synchronization getSynchronization(){
  return sync;
}
Program: 98131
Project: 98131
Buggy source:
/** 
 * @see org.zoodb.jdo.oldStuff.Transaction#begin()
 */
@Override public synchronized void begin(){
  if (isOpen) {
    throw new JDOUserException("String_Node_Str");
  }
  isOpen=true;
}

Fixed version (ground truth):
/** 
 * @see Transaction#begin()
 */
@Override public synchronized void begin(){
  if (isOpen) {
    throw new JDOUserException("String_Node_Str");
  }
  isOpen=true;
}
Program: 98132
Project: 98132
Buggy source:
/** 
 * Returns the number of instances in the database. This operation ignores modifications of the current transactions, such as new or deleted instances. In other words, only committed objects are considered.
 * @param b Whether sub-classes should be counted as well. 
 * @return Number of instances in the database.
 */
public abstract long instanceCount(boolean subClasses);

Fixed version (ground truth):
/** 
 * Returns the number of instances in the database. This operation ignores modifications of the current transactions, such as new or deleted instances. In other words, only committed objects are considered.
 * @param subClasses Whether sub-classes should be counted as well. 
 * @return Number of instances in the database.
 */
public abstract long instanceCount(boolean subClasses);
Program: 98133
Project: 98133
Buggy source:
/** 
 * @param i page size in bytes.
 */
public static void setFilePageSize(int pageSize){
  defaultPageSize=pageSize;
}

Fixed version (ground truth):
/** 
 * @param pageSize page size in bytes.
 */
public static void setFilePageSize(int pageSize){
  defaultPageSize=pageSize;
}
Program: 98134
Project: 98134
Buggy source:
/** 
 * Instantiate a new DataSerializer.
 * @param out
 * @param filter
 */
public DataSerializer(ObjectWriter out,AbstractCache cache,Node node){
  this.out=out;
  this.cache=cache;
  this.node=node;
}

Fixed version (ground truth):
/** 
 * Instantiate a new DataSerializer.
 * @param out
 */
public DataSerializer(ObjectWriter out,AbstractCache cache,Node node){
  this.out=out;
  this.cache=cache;
  this.node=node;
}
Program: 98135
Project: 98135
Buggy source:
@Before public void before(){
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  pm.newQuery(TestClass.class).deletePersistentAll();
  TestClass tc1=new TestClass();
  tc1.setData(1,false,'c',(byte)127,(short)32001,1234567890L,"String_Node_Str",new byte[]{1,2},-1.1f,35);
  pm.makePersistent(tc1);
  tc1=new TestClass();
  tc1.setData(12,false,'d',(byte)126,(short)32002,1234567890L,"String_Node_Str",new byte[]{1,2},-0.1f,34);
  pm.makePersistent(tc1);
  tc1=new TestClass();
  tc1.setData(123,false,'e',(byte)125,(short)32003,1234567890L,null,new byte[]{1,2},0.1f,3.0);
  pm.makePersistent(tc1);
  tc1=new TestClass();
  tc1.setData(1234,false,'f',(byte)124,(short)32004,1234567890L,"String_Node_Str",new byte[]{1,2},1.1f,-0.01);
  pm.makePersistent(tc1);
  tc1=new TestClass();
  tc1.setData(12345,false,'g',(byte)123,(short)32005,1234567890L,"String_Node_Str",new byte[]{1,2},11.1f,-35);
  pm.makePersistent(tc1);
  pm.currentTransaction().commit();
  TestTools.closePM();
  ;
}

Fixed version (ground truth):
@Before public void before(){
  TestTools.defineSchema(TestClass.class);
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  pm.newQuery(TestClass.class).deletePersistentAll();
  TestClass tc1=new TestClass();
  tc1.setData(1,false,'c',(byte)127,(short)32001,1234567890L,"String_Node_Str",new byte[]{1,2},-1.1f,35);
  pm.makePersistent(tc1);
  tc1=new TestClass();
  tc1.setData(12,false,'d',(byte)126,(short)32002,1234567890L,"String_Node_Str",new byte[]{1,2},-0.1f,34);
  pm.makePersistent(tc1);
  tc1=new TestClass();
  tc1.setData(123,false,'e',(byte)125,(short)32003,1234567890L,null,new byte[]{1,2},0.1f,3.0);
  pm.makePersistent(tc1);
  tc1=new TestClass();
  tc1.setData(1234,false,'f',(byte)124,(short)32004,1234567890L,"String_Node_Str",new byte[]{1,2},1.1f,-0.01);
  pm.makePersistent(tc1);
  tc1=new TestClass();
  tc1.setData(12345,false,'g',(byte)123,(short)32005,1234567890L,"String_Node_Str",new byte[]{1,2},11.1f,-35);
  pm.makePersistent(tc1);
  pm.currentTransaction().commit();
  TestTools.closePM();
  ;
}
Program: 98136
Project: 98136
Buggy source:
@Test public void testSetFilterForParameters(){
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  Query q=null;
  Collection<?> r;
  q=pm.newQuery(TestClass.class,"String_Node_Str");
  q.setFilter("String_Node_Str");
  r=(Collection<?>)q.execute();
  assertEquals(1,r.size());
}

Fixed version (ground truth):
/** 
 * See issue #21.
 */
@Test public void testSetFilterForParameters(){
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  Query q=null;
  Collection<?> r;
  q=pm.newQuery(TestClass.class,"String_Node_Str");
  q.setFilter("String_Node_Str");
  r=(Collection<?>)q.execute();
  assertEquals(1,r.size());
}
Program: 98137
Project: 98137
Buggy source:
@BeforeClass public static void setUp(){
  TestTools.removeDb();
  TestTools.createDb();
  TestTools.defineSchema(TestClass.class);
}

Fixed version (ground truth):
@BeforeClass public static void setUp(){
  TestTools.removeDb();
  TestTools.createDb();
}
Program: 98138
Project: 98138
Buggy source:
@Test public void testStringIndex(){
  TestTools.defineIndex(TestClass.class,"String_Node_Str",false);
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  Query q=null;
  Collection<?> r;
  q=pm.newQuery(TestClass.class,"String_Node_Str");
  r=(Collection<?>)q.execute();
  assertEquals(3,r.size());
  q=pm.newQuery(TestClass.class,"String_Node_Str");
  r=(Collection<?>)q.execute();
  assertEquals(1,r.size());
  q=pm.newQuery(TestClass.class,"String_Node_Str");
  r=(Collection<?>)q.execute();
  assertEquals(4,r.size());
}

Fixed version (ground truth):
/** 
 * See issue #20.
 */
@Test public void testStringIndex(){
  TestTools.defineIndex(TestClass.class,"String_Node_Str",false);
  testStringQuery();
}
Program: 98139
Project: 98139
Buggy source:
@After public void afterTest(){
  TestTools.closePM();
}

Fixed version (ground truth):
@After public void afterTest(){
  TestTools.closePM();
  TestTools.removeSchema(TestClass.class);
}
Program: 98140
Project: 98140
Buggy source:
public void setFieldRawSCO(int i,Object deObj){
  variableValues[i]=deObj;
}

Fixed version (ground truth):
public void setFieldRawSCO(int i,Object deObj){
  variableValues[i]=deObj;
  if (deObj instanceof String) {
    fixedValues[i]=BitTools.toSortableLong((String)deObj);
  }
}
Program: 98142
Project: 98142
Buggy source:
private static StorageChannel createPageAccessFile(String dbPath,String options,FreeSpaceManager fsm){
  try {
    Class<?> cls=Class.forName(ZooConfig.getFileProcessor());
    Constructor<?> con=cls.getConstructor(String.class,String.class,Integer.TYPE,FreeSpaceManager.class);
    StorageChannel paf=(StorageChannel)con.newInstance(dbPath,options,ZooConfig.getFilePageSize(),fsm);
    return paf;
  }
 catch (  Exception e) {
    throw new JDOFatalDataStoreException("String_Node_Str" + dbPath,e);
  }
}

Fixed version (ground truth):
private static StorageChannel createPageAccessFile(String dbPath,String options,FreeSpaceManager fsm){
  try {
    Class<?> cls=Class.forName(ZooConfig.getFileProcessor());
    Constructor<?> con=cls.getConstructor(String.class,String.class,Integer.TYPE,FreeSpaceManager.class);
    StorageChannel paf=(StorageChannel)con.newInstance(dbPath,options,ZooConfig.getFilePageSize(),fsm);
    return paf;
  }
 catch (  Exception e) {
    if (e instanceof InvocationTargetException) {
      Throwable t2=e.getCause();
      if (t2 instanceof JDOUserException) {
        throw (JDOUserException)t2;
      }
    }
    throw DBLogger.newFatal("String_Node_Str" + dbPath,e);
  }
}
Program: 98143
Project: 98143
Buggy source:
public StorageRootFile(String dbPath,String options,int pageSize,FreeSpaceManager fsm){
  this.fsm=fsm;
  PAGE_SIZE=pageSize;
  File file=new File(dbPath);
  if (!file.exists()) {
    throw DBLogger.newUser("String_Node_Str" + dbPath);
  }
  try {
    raf=new RandomAccessFile(file,options);
    fc=raf.getChannel();
    try {
      fileLock=fc.tryLock();
      if (ZooDebug.isTesting()) {
        ZooDebug.registerFile(fc);
      }
    }
 catch (    OverlappingFileLockException e) {
      fc.close();
      raf.close();
      throw DBLogger.newUser("String_Node_Str" + dbPath);
    }
  }
 catch (  IOException e) {
    throw DBLogger.newFatal("String_Node_Str" + dbPath,e);
  }
}

Fixed version (ground truth):
public StorageRootFile(String dbPath,String options,int pageSize,FreeSpaceManager fsm){
  this.fsm=fsm;
  PAGE_SIZE=pageSize;
  File file=new File(dbPath);
  if (!file.exists()) {
    throw DBLogger.newUser("String_Node_Str" + dbPath);
  }
  try {
    raf=new RandomAccessFile(file,options);
    fc=raf.getChannel();
    try {
      fileLock=fc.tryLock();
      if (fileLock == null) {
        fc.close();
        raf.close();
        throw DBLogger.newUser("String_Node_Str" + dbPath);
      }
    }
 catch (    OverlappingFileLockException e) {
      fc.close();
      raf.close();
      throw DBLogger.newUser("String_Node_Str" + dbPath);
    }
    if (ZooDebug.isTesting()) {
      ZooDebug.registerFile(fc);
    }
  }
 catch (  IOException e) {
    throw DBLogger.newFatal("String_Node_Str" + dbPath,e);
  }
}
Program: 98144
Project: 98144
Buggy source:
@AfterClass public static void tearDown(){
  TestTools.removeDb(DB_NAME);
}

Fixed version (ground truth):
@AfterClass public static void tearDown(){
  if (rmi != null) {
    rmi.stop();
  }
  TestTools.removeDb(DB_NAME);
}
Program: 98145
Project: 98145
Buggy source:
/** 
 * Test import of ZooDB 0.3 xml files.
 */
@Test public void testImport0_3(){
  String path=Test_014_XmlImportExport.class.getResource("String_Node_Str").getPath();
  TestTools.defineSchema(TestSerializer.class,TestSuper.class);
  ZooXmlImport.main(new String[]{TestTools.getDbName(),path});
  PersistenceManager pm2=TestTools.openPM(DB2);
  pm2.currentTransaction().begin();
  Extent<TestSerializer> ext=pm2.getExtent(TestSerializer.class);
  TestSerializer ts2=ext.iterator().next();
  ts2.check(false);
  pm2.currentTransaction().rollback();
  TestTools.closePM();
}

Fixed version (ground truth):
/** 
 * Test import of ZooDB 0.3 xml files.
 */
@Test public void testImport0_3(){
  String path=Test_014_XmlImportExport.class.getResource("String_Node_Str").getPath();
  TestTools.defineSchema(TestSerializer.class,TestSuper.class);
  ZooXmlImport.main(new String[]{TestTools.getDbName(),path});
  PersistenceManager pm2=TestTools.openPM();
  pm2.currentTransaction().begin();
  Extent<TestSerializer> ext=pm2.getExtent(TestSerializer.class);
  TestSerializer ts2=ext.iterator().next();
  ts2.check(false);
  pm2.currentTransaction().rollback();
  TestTools.closePM();
}
Program: 98146
Project: 98146
Buggy source:
private static final boolean isSimpleType(Field field){
  int mod=field.getModifiers();
  if (Modifier.isStatic(mod) || Modifier.isTransient(mod)) {
    return true;
  }
  Class<?> cls=field.getType();
  while (cls.isArray()) {
    cls=cls.getComponentType();
  }
  return SIMPLE_TYPES.contains(cls);
}

Fixed version (ground truth):
private static final boolean isSimpleType(Field field){
  int mod=field.getModifiers();
  if (Modifier.isStatic(mod) || Modifier.isTransient(mod)) {
    return true;
  }
  Class<?> cls=field.getType();
  while (cls.isArray()) {
    cls=cls.getComponentType();
  }
  if (ILLEGAL_TYPES.contains(cls)) {
    throw DBLogger.newUser("String_Node_Str" + "String_Node_Str" + cls + "String_Node_Str"+ field.getDeclaringClass().getName()+ "String_Node_Str"+ field.getName());
  }
  return SIMPLE_TYPES.contains(cls);
}
Program: 98147
Project: 98147
Buggy source:
final private void addToWorkList(Object object){
  if (object == null)   return;
  Class<? extends Object> cls=object.getClass();
  if (SIMPLE_TYPES.contains(cls)) {
    return;
  }
  if (object instanceof ZooPCImpl) {
    ZooPCImpl pc=(ZooPCImpl)object;
    if (!pc.jdoZooIsPersistent()) {
      if (isTraversingCache) {
        toBecomePersistent.add(pc);
      }
 else {
        pm.makePersistent(pc);
        mpCount++;
      }
    }
 else {
      return;
    }
  }
  if (!seenObjects.contains(object)) {
    workList.add(object);
    seenObjects.add(object);
  }
}

Fixed version (ground truth):
final private void addToWorkList(Object object){
  if (object == null)   return;
  Class<? extends Object> cls=object.getClass();
  if (SIMPLE_TYPES.contains(cls)) {
    return;
  }
  if (ILLEGAL_TYPES.contains(cls)) {
    throw DBLogger.newUser("String_Node_Str" + "String_Node_Str" + cls);
  }
  if (object instanceof ZooPCImpl) {
    ZooPCImpl pc=(ZooPCImpl)object;
    if (!pc.jdoZooIsPersistent()) {
      if (isTraversingCache) {
        toBecomePersistent.add(pc);
      }
 else {
        pm.makePersistent(pc);
        mpCount++;
      }
    }
 else {
      return;
    }
  }
  if (!seenObjects.contains(object)) {
    workList.add(object);
    seenObjects.add(object);
  }
}
Program: 98148
Project: 98148
Buggy source:
/** 
 * Returns a List containing all of the Field objects for the given class. The fields include all public and private fields from the given class  and its super classes.
 * @param c Class object
 * @return Returns list of interesting fields
 */
private static final Field[] getFields(Class<? extends Object> cls){
  Field[] ret=SEEN_CLASSES.get(cls);
  if (ret != null) {
    return ret;
  }
  if (cls == Class.class) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  List<Field> retL=new ArrayList<Field>();
  for (  Field f : cls.getDeclaredFields()) {
    if (!isSimpleType(f)) {
      retL.add(f);
      f.setAccessible(true);
    }
  }
  if (cls.getSuperclass() != Object.class) {
    for (    Field f : getFields(cls.getSuperclass())) {
      retL.add(f);
    }
  }
  ret=retL.toArray(new Field[retL.size()]);
  SEEN_CLASSES.put(cls,ret);
  return ret;
}

Fixed version (ground truth):
/** 
 * Returns a List containing all of the Field objects for the given class. The fields include all public and private fields from the given class  and its super classes.
 * @param c Class object
 * @return Returns list of interesting fields
 */
private static final Field[] getFields(Class<? extends Object> cls){
  Field[] ret=SEEN_CLASSES.get(cls);
  if (ret != null) {
    return ret;
  }
  List<Field> retL=new ArrayList<Field>();
  for (  Field f : cls.getDeclaredFields()) {
    if (!isSimpleType(f)) {
      retL.add(f);
      f.setAccessible(true);
    }
  }
  if (cls.getSuperclass() != Object.class && cls != Object.class) {
    for (    Field f : getFields(cls.getSuperclass())) {
      retL.add(f);
    }
  }
  ret=retL.toArray(new Field[retL.size()]);
  SEEN_CLASSES.put(cls,ret);
  return ret;
}
Program: 98149
Project: 98149
Buggy source:
private void compileQuery(){
  if (filter == null || filter.length() == 0) {
    return;
  }
  QueryParser qp=new QueryParser(filter,candClsDef,parameters);
  queryTree=qp.parseQuery();
}

Fixed version (ground truth):
private void compileQuery(){
  if (filter == null || filter.length() == 0) {
    return;
  }
  parameters.clear();
  QueryParser qp=new QueryParser(filter,candClsDef,parameters);
  queryTree=qp.parseQuery();
}
Program: 98150
Project: 98150
Buggy source:
@Override public void dropInstances(ZooClassProxy def){
  SchemaIndexEntry sie=schemaIndex.getSchema(def.getSchemaId());
  for (int i=0; i < sie.getObjectIndexVersionCount(); i++) {
    PagedPosIndex oi=sie.getObjectIndexVersion(i);
    PagedPosIndex.ObjectPosIterator it=oi.iteratorObjects();
    DataDeSerializerNoClass dds=new DataDeSerializerNoClass(fileInAP);
    while (it.hasNextOPI()) {
      long pos=it.nextPos();
      freeIndex.reportFreePage(BitTools.getPage(pos));
      dds.seekPos(pos);
      long oid=dds.getOid();
      oidIndex.removeOidNoFail(oid,-1);
    }
    it.close();
    for (    AbstractPagedIndex ind : sie.getIndices()) {
      ind.clear();
    }
    oi.clear();
  }
}

Fixed version (ground truth):
@Override public void dropInstances(ZooClassProxy def){
  SchemaIndexEntry sie=schemaIndex.getSchema(def.getSchemaId());
  for (int i=0; i < sie.getObjectIndexVersionCount(); i++) {
    PagedPosIndex oi=sie.getObjectIndexVersion(i);
    PagedPosIndex.ObjectPosIterator it=oi.iteratorObjects();
    DataDeSerializerNoClass dds=new DataDeSerializerNoClass(fileInAP);
    while (it.hasNextOPI()) {
      long pos=it.nextPos();
      freeIndex.reportFreePage(BitTools.getPage(pos));
      dds.seekPos(pos);
      long oid=dds.getOid();
      oidIndex.removeOidNoFail(oid,-1);
    }
    it.close();
    sie.clearIndices();
    oi.clear();
  }
}
Program: 98151
Project: 98151
Buggy source:
private void readHeader(){
  byte pageType=buf.get();
  if (pageType != currentType.getId()) {
    throw DBLogger.newFatal("String_Node_Str" + currentType.getId() + "String_Node_Str"+ currentType+ "String_Node_Str"+ pageType+ "String_Node_Str"+ currentPage);
  }
  buf.position(PAGE_HEADER_SIZE);
  if (isAutoPaging) {
    pageHeader=buf.getLong();
  }
}

Fixed version (ground truth):
private void readHeader(){
  byte pageType=buf.get();
  if (pageType != currentType.getId()) {
    buf.get();
    buf.getShort();
    long txId=buf.getLong();
    throw DBLogger.newFatal("String_Node_Str" + currentType.getId() + "String_Node_Str"+ currentType+ "String_Node_Str"+ txId+ "String_Node_Str"+ pageType+ "String_Node_Str"+ root.getTxId()+ "String_Node_Str"+ currentPage);
  }
  buf.position(PAGE_HEADER_SIZE);
  if (isAutoPaging) {
    pageHeader=buf.getLong();
  }
}
Program: 98152
Project: 98152
Buggy source:
final void clear(){
  if (!isLeaf) {
    for (int i=0; i < getNKeys() + 1; i++) {
      AbstractIndexPage p=readPage(i);
      p.clear();
      ind.file.reportFreePage(p.pageId);
    }
  }
  setNEntries(-1);
}

Fixed version (ground truth):
final void clear(){
  if (!isLeaf) {
    for (int i=0; i < getNKeys() + 1; i++) {
      AbstractIndexPage p=readPage(i);
      p.clear();
      ind.file.reportFreePage(p.pageId);
    }
  }
  if (subPageIds != null) {
    for (int i=0; i < subPageIds.length; i++) {
      subPageIds[i]=0;
    }
  }
  if (subPages != null) {
    for (int i=0; i < subPages.length; i++) {
      subPages[i]=null;
    }
  }
  setNEntries(-1);
  setDirty(true);
}
Program: 98153
Project: 98153
Buggy source:
public void clear(){
  getRoot().clear();
  file.reportFreePage(getRoot().pageId());
  AbstractIndexPage newRoot=createPage(null,false);
  updateRoot(newRoot);
  for (  AbstractPageIterator<?> i : iterators.keySet()) {
    i.close();
  }
  iterators.clear();
}

Fixed version (ground truth):
public void clear(){
  getRoot().clear();
  file.reportFreePage(getRoot().pageId());
  markDirty();
  for (  AbstractPageIterator<?> i : iterators.keySet()) {
    i.close();
  }
  iterators.clear();
}
Program: 98154
Project: 98154
Buggy source:
/** 
 * This test reproduces a bug related to dropInstances
 */
@Test public void testDropInstancesBug(){
  final int N=1000;
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  ZooSchema.defineClass(pm,TestClassTiny.class);
  ZooClass r=ZooSchema.defineClass(pm,TestClass.class);
  r.locateField("String_Node_Str").createIndex(false);
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  r=ZooSchema.locateClass(pm,TestClass.class);
  r.dropInstances();
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  for (int i=0; i < N; i++) {
    TestClassTiny p=new TestClassTiny();
    pm.makePersistent(p);
  }
  pm.currentTransaction().commit();
  pm.close();
  pm=TestTools.openPM();
  pm.currentTransaction().begin();
  int n=0;
  Query q=pm.newQuery(TestClass.class,"String_Node_Str" + 1);
  System.out.println("String_Node_Str" + 1);
  for (  Object o : (Collection<?>)q.execute()) {
    assertTrue(o instanceof TestClass);
    n++;
  }
  q.closeAll();
  assertEquals(N,n);
  pm.currentTransaction().rollback();
  pm.close();
}

Fixed version (ground truth):
/** 
 * This test reproduces a bug related to dropInstances
 */
@Test public void testDropInstancesBug(){
  final int N=1000;
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  ZooSchema.defineClass(pm,TestClassTiny.class);
  ZooClass r=ZooSchema.defineClass(pm,TestClass.class);
  r.locateField("String_Node_Str").createIndex(false);
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  r=ZooSchema.locateClass(pm,TestClass.class);
  r.dropInstances();
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  for (int i=0; i < N; i++) {
    TestClassTiny p=new TestClassTiny();
    p.setInt(1);
    pm.makePersistent(p);
  }
  pm.currentTransaction().commit();
  pm.close();
  pm=TestTools.openPM();
  pm.currentTransaction().begin();
  int n=0;
  Query q=pm.newQuery(TestClass.class,"String_Node_Str");
  for (  Object o : (Collection<?>)q.execute()) {
    assertTrue(o instanceof TestClass);
    n++;
  }
  q.closeAll();
  assertEquals(0,n);
  n=0;
  q=pm.newQuery(TestClassTiny.class,"String_Node_Str");
  for (  Object o : (Collection<?>)q.execute()) {
    assertTrue(o instanceof TestClassTiny);
    n++;
  }
  q.closeAll();
  assertEquals(N,n);
  pm.currentTransaction().rollback();
  pm.close();
}
Program: 98155
Project: 98155
Buggy source:
public static String run(String db1,String db2){
  out=new StringBuilder();
  ZooJdoProperties props1=new ZooJdoProperties(db1);
  PersistenceManagerFactory pmf1=JDOHelper.getPersistenceManagerFactory(props1);
  PersistenceManager pm1=pmf1.getPersistenceManager();
  pm1.currentTransaction().begin();
  ZooJdoProperties props2=new ZooJdoProperties(db2);
  PersistenceManagerFactory pmf2=JDOHelper.getPersistenceManagerFactory(props2);
  PersistenceManager pm2=pmf2.getPersistenceManager();
  pm2.currentTransaction().begin();
  List<ZooClass> commonClasses=compareClasses(pm1,pm2);
  compareInstances(pm1,pm2,commonClasses);
  pm1.currentTransaction().rollback();
  pm1.close();
  pmf1.close();
  pm2.currentTransaction().rollback();
  pm2.close();
  pmf2.close();
  return out.toString();
}

Fixed version (ground truth):
public static String run(String db1,String db2){
  PersistenceManager pm1=null;
  PersistenceManager pm2=null;
  try {
    out=new StringBuilder();
    ZooJdoProperties props1=new ZooJdoProperties(db1);
    PersistenceManagerFactory pmf1=JDOHelper.getPersistenceManagerFactory(props1);
    pm1=pmf1.getPersistenceManager();
    pm1.currentTransaction().begin();
    ZooJdoProperties props2=new ZooJdoProperties(db2);
    PersistenceManagerFactory pmf2=JDOHelper.getPersistenceManagerFactory(props2);
    pm2=pmf2.getPersistenceManager();
    pm2.currentTransaction().begin();
    List<ZooClass> commonClasses=compareClasses(pm1,pm2);
    compareInstances(pm1,pm2,commonClasses);
    return out.toString();
  }
  finally {
    if (pm1 != null) {
      pm1.currentTransaction().rollback();
      pm1.close();
    }
    if (pm2 != null) {
      pm2.currentTransaction().rollback();
      pm2.close();
    }
  }
}
Program: 98156
Project: 98156
Buggy source:
@Before public void before(){
  TestTools.createDb();
}

Fixed version (ground truth):
@Before public void before(){
  TestTools.createDb();
  TestSerializer.resetStatic();
}
Program: 98157
Project: 98157
Buggy source:
@Before public void before(){
}

Fixed version (ground truth):
@Before public void before(){
  TestSerializer.resetStatic();
}
Program: 98158
Project: 98158
Buggy source:
public void setDirty(boolean b){
  if (!isDirty) {
    isDirty=true;
    context.getSession().internalGetCache().addGeneric(this);
    getPrevValues();
  }
}

Fixed version (ground truth):
public void setDirty(boolean b){
  if (!isDirty) {
    isDirty=true;
    context.getSession().internalGetCache().addGeneric(this);
    if (!isNew) {
      getPrevValues();
    }
  }
}
Program: 98159
Project: 98159
Buggy source:
static GenericObject newEmptyInstance(long oid,ZooClassDef def,AbstractCache cache){
  def.getProvidedContext().getNode().getOidBuffer().ensureValidity(oid);
  GenericObject go=new GenericObject(def,oid,true,cache);
  System.err.println("String_Node_Str");
  System.err.println("String_Node_Str");
  go.setNew(true);
  go.setDirty(true);
  for (  ZooFieldDef f : def.getAllFields()) {
    if (f.isPrimitiveType()) {
      Object x;
switch (f.getPrimitiveType()) {
case BOOLEAN:
        x=false;
      break;
case BYTE:
    x=(byte)0;
  break;
case CHAR:
x=(char)0;
break;
case DOUBLE:
x=(double)0;
break;
case FLOAT:
x=(float)0;
break;
case INT:
x=(int)0;
break;
case LONG:
x=(long)0;
break;
case SHORT:
x=(short)0;
break;
default :
throw new IllegalStateException();
}
go.setField(f,x);
}
 else {
System.out.println("String_Node_Str");
}
}
return go;
}

Fixed version (ground truth):
static GenericObject newEmptyInstance(long oid,ZooClassDef def,AbstractCache cache){
  def.getProvidedContext().getNode().getOidBuffer().ensureValidity(oid);
  GenericObject go=new GenericObject(def,oid,true,cache);
  go.setNew(true);
  for (  ZooFieldDef f : def.getAllFields()) {
    if (f.isPrimitiveType()) {
      Object x;
switch (f.getPrimitiveType()) {
case BOOLEAN:
        x=false;
      break;
case BYTE:
    x=(byte)0;
  break;
case CHAR:
x=(char)0;
break;
case DOUBLE:
x=(double)0;
break;
case FLOAT:
x=(float)0;
break;
case INT:
x=(int)0;
break;
case LONG:
x=(long)0;
break;
case SHORT:
x=(short)0;
break;
default :
throw new IllegalStateException();
}
go.setField(f,x);
}
 else {
System.out.println("String_Node_Str");
}
}
return go;
}
Program: 98160
Project: 98160
Buggy source:
@Override public void setValue(ZooHandle hdl,Object val){
  checkInvalid();
  ZooHandleImpl h=checkHandle(hdl);
  h.getGenericObject().setField(fieldDef,val);
  h.getGenericObject().setDirty(true);
}

Fixed version (ground truth):
@Override public void setValue(ZooHandle hdl,Object val){
  checkInvalid();
  ZooHandleImpl h=checkHandle(hdl);
  h.getGenericObject().setDirty(true);
  h.getGenericObject().setField(fieldDef,val);
}
Program: 98161
Project: 98161
Buggy source:
private void updateFieldIndicesGO(){
  final GenericObject[] buffer=this.bufferGO;
  final int bufferCnt=this.bufferGOCnt;
  int iInd=-1;
  for (  ZooFieldDef field : cls.getAllFields()) {
    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()) {
          if (co.jdoZooGetBackup() != null) {
            long l=co.jdoZooGetBackup()[iInd];
            fieldInd.removeLong(l,co.getOid());
            continue;
          }
        }
        long l;
        if (field.isString()) {
          if (co.isHollow()) {
            throw new UnsupportedOperationException();
          }
          l=(Long)co.getFieldRaw(iInd);
        }
 else {
          Object primO=co.getFieldRaw(iInd);
          l=SerializerTools.primitiveToLong(primO,field.getPrimitiveType());
        }
        fieldInd.removeLong(l,co.getOid());
      }
    }
 catch (    IllegalArgumentException e) {
      throw new JDOFatalDataStoreException("String_Node_Str" + field.getName(),e);
    }
  }
  PagedPosIndex ois=sie.getObjectIndexLatestSchemaVersion();
  for (int i=0; i < bufferCnt; i++) {
    long oid=buffer[i].getOid();
    delete(oid,ois);
  }
}

Fixed version (ground truth):
private void updateFieldIndicesGO(){
  final GenericObject[] buffer=this.bufferGO;
  final int bufferCnt=this.bufferGOCnt;
  int iInd=-1;
  for (  ZooFieldDef field : cls.getAllFields()) {
    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()) {
          if (co.jdoZooGetBackup() != null) {
            long l=co.jdoZooGetBackup()[iInd];
            fieldInd.removeLong(l,co.getOid());
            continue;
          }
        }
        long l;
        if (field.isString()) {
          if (co.isHollow()) {
            throw new UnsupportedOperationException();
          }
          l=(Long)co.getFieldRaw(field.getFieldPos());
        }
 else {
          Object primO=co.getFieldRaw(field.getFieldPos());
          l=SerializerTools.primitiveToLong(primO,field.getPrimitiveType());
        }
        fieldInd.removeLong(l,co.getOid());
      }
    }
 catch (    IllegalArgumentException e) {
      throw new JDOFatalDataStoreException("String_Node_Str" + field.getName(),e);
    }
  }
  PagedPosIndex ois=sie.getObjectIndexLatestSchemaVersion();
  for (int i=0; i < bufferCnt; i++) {
    long oid=buffer[i].getOid();
    delete(oid,ois);
  }
}