nus-yam/ex-repair huggingface dataset:
Program: 98222
Project: 98222
Buggy source:
/** 
 * Returns a shallow copy of this <tt>TreeMap</tt> instance. (The keys and values themselves are not cloned.)
 * @return a shallow copy of this map
 */
public Object clone(){
  PrimLongTreeMap<V> clone=null;
  try {
    clone=(PrimLongTreeMap<V>)super.clone();
  }
 catch (  CloneNotSupportedException e) {
    throw new InternalError();
  }
  clone.root=null;
  clone.size=0;
  clone.modCount=0;
  clone.entrySet=null;
  clone.navigableKeySet=null;
  try {
    clone.buildFromSorted(size,entrySet().iterator(),null,null);
  }
 catch (  java.io.IOException cannotHappen) {
  }
catch (  ClassNotFoundException cannotHappen) {
  }
  return clone;
}

Fixed version (ground truth):
/** 
 * Returns a shallow copy of this <tt>TreeMap</tt> instance. (The keys and values themselves are not cloned.)
 * @return a shallow copy of this map
 */
public Object clone(){
  PrimLongTreeMap<V> clone=null;
  try {
    clone=(PrimLongTreeMap<V>)super.clone();
  }
 catch (  CloneNotSupportedException e) {
    throw new InternalError();
  }
  clone.root=null;
  clone.size=0;
  clone.modCount=0;
  clone.entrySet=null;
  clone.navigableKeySet=null;
  try {
    clone.buildFromSorted(size,entrySet().iterator(),null,null);
  }
 catch (  IOException cannotHappen) {
    throw new RuntimeException(cannotHappen);
  }
catch (  ClassNotFoundException cannotHappen) {
    throw new RuntimeException(cannotHappen);
  }
  return clone;
}
Program: 98223
Project: 98223
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());
  }
 else {
    if (_ext != null) {
      ext=_ext.iterator();
    }
 else {
      ext=new ExtentImpl(_candCls,_subClasses,_pm).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<?> ext;
  if (qa.getIndex() != null) {
    ext=_pm.getSession().getPrimaryNode().readObjectFromIndex(qa.getIndex(),qa.getMin(),qa.getMax());
  }
 else {
    if (_ext != null) {
      ext=_ext.iterator();
    }
 else {
      ext=new ExtentImpl(_candCls,_subClasses,_pm).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();
  }
}
Program: 98224
Project: 98224
Buggy source:
/** 
 * @param data For example: "avg(salary), sum(salary)".  min, max, avg, sum, count
 * @param candCls
 */
QueryResultProcessor(String data,Class<?> candCls){
  while (data.length() > 0) {
    Item item;
    if (data.startsWith("String_Node_Str") || data.startsWith("String_Node_Str")) {
      item=new AVG();
      data=data.substring(3);
    }
 else     if (data.startsWith("String_Node_Str") || data.startsWith("String_Node_Str")) {
      item=new MIN();
      data=data.substring(3);
    }
 else     if (data.startsWith("String_Node_Str") || data.startsWith("String_Node_Str")) {
      item=new SUM();
      data=data.substring(3);
    }
 else     if (data.startsWith("String_Node_Str") || data.startsWith("String_Node_Str")) {
      item=new COUNT();
      data=data.substring(5);
    }
 else {
      throw new JDOUserException("String_Node_Str" + data);
    }
    data.trim();
    if (data.charAt(0) != '(') {
      throw new JDOUserException("String_Node_Str" + data);
    }
    data=data.substring(1);
    int i=data.indexOf(')');
    if (i < 0) {
      throw new JDOUserException("String_Node_Str" + data);
    }
    String fieldName=data.substring(0,i).trim();
    data=data.substring(i).trim();
    data=data.substring(1).trim();
    items.add(item);
    item.setField(getField(candCls,fieldName));
    if (data.charAt(0) == ',') {
      data=data.substring(1).trim();
    }
  }
}

Fixed version (ground truth):
/** 
 * @param data For example: "avg(salary), sum(salary)".  min, max, avg, sum, count
 * @param candCls
 */
QueryResultProcessor(String data,Class<?> candCls){
  while (data.length() > 0) {
    Item item;
    if (data.startsWith("String_Node_Str") || data.startsWith("String_Node_Str")) {
      item=new AVG();
      data=data.substring(3);
    }
 else     if (data.startsWith("String_Node_Str") || data.startsWith("String_Node_Str")) {
      item=new MIN();
      data=data.substring(3);
    }
 else     if (data.startsWith("String_Node_Str") || data.startsWith("String_Node_Str")) {
      item=new SUM();
      data=data.substring(3);
    }
 else     if (data.startsWith("String_Node_Str") || data.startsWith("String_Node_Str")) {
      item=new COUNT();
      data=data.substring(5);
    }
 else {
      throw new JDOUserException("String_Node_Str" + data);
    }
    data=data.trim();
    if (data.charAt(0) != '(') {
      throw new JDOUserException("String_Node_Str" + data);
    }
    data=data.substring(1);
    int i=data.indexOf(')');
    if (i < 0) {
      throw new JDOUserException("String_Node_Str" + data);
    }
    String fieldName=data.substring(0,i).trim();
    data=data.substring(i).trim();
    data=data.substring(1).trim();
    items.add(item);
    item.setField(getField(candCls,fieldName));
    if (data.charAt(0) == ',') {
      data=data.substring(1).trim();
    }
  }
}
Program: 98225
Project: 98225
Buggy source:
private final void serializeDBHashtable(DBHashtable<?,?> l){
  _out.writeInt(l.size());
  for (  Object k : l.keySet()) {
    serializeObject(k);
    serializeObject(l.get(k));
  }
}

Fixed version (ground truth):
private final void serializeDBHashtable(DBHashtable<?,?> l){
  _out.writeInt(l.size());
  for (  Map.Entry<?,?> e : l.entrySet()) {
    serializeObject(e.getKey());
    serializeObject(e.getValue());
  }
}
Program: 98226
Project: 98226
Buggy source:
private final void serializeDBHashtable(DBHashtable<?,?> l){
  _out.writeInt(l.size());
  for (  Object k : l.keySet()) {
    serializeObject(k);
    serializeObject(l.get(k));
  }
}

Fixed version (ground truth):
private final void serializeDBHashtable(DBHashtable<?,?> l){
  _out.writeInt(l.size());
  for (  Map.Entry<?,?> e : l.entrySet()) {
    serializeObject(e.getKey());
    serializeObject(e.getValue());
  }
}
Program: 98228
Project: 98228
Buggy source:
public QueryTreeNode createSubs(List<QueryTreeNode> subQueriesCandidates){
  if (LOG_OP.OR.equals(_op) && getBranchType() == BRANCH_TYPE.INDEXED) {
    QueryTreeNode n1;
    QueryTerm t1;
    if (_n1 != null) {
      n1=_n1.cloneBranch();
      t1=null;
    }
 else {
      n1=null;
      t1=_t1;
    }
    QueryTreeNode n2;
    QueryTerm t2;
    if (_n2 != null) {
      n2=_n2.cloneBranch();
      t2=null;
    }
 else {
      n2=null;
      t2=_t2;
    }
    QueryTreeNode newTree;
    if (_p != null) {
      if (_p._n1 == this) {
        _p._n1=n1;
        _p._t1=t1;
        _p.relateToChildren();
      }
 else       if (_p._n2 == this) {
        _p._n2=n1;
        _p._t2=t1;
        _p.relateToChildren();
      }
 else {
        throw new IllegalStateException();
      }
    }
 else {
      if (n1 != null) {
        n1._p=null;
      }
      if (n2 != null) {
        n2._p=null;
      }
    }
    if (_p == null) {
      newTree=new QueryTreeNode(n2,t2,null,null,null).relateToChildren();
    }
 else {
      if (n2 == null) {
        newTree=_p.cloneTrunk(this,n2);
        if (newTree._t1 == null) {
          newTree._t1=t2;
        }
 else {
          newTree._t2=t2;
        }
      }
 else {
        newTree=_p.cloneTrunk(this,n2);
      }
    }
    subQueriesCandidates.add(newTree.root());
  }
  if (_n1 != null) {
    _n1.createSubs(subQueriesCandidates);
  }
  if (_n2 != null) {
    _n2.createSubs(subQueriesCandidates);
  }
  return this;
}

Fixed version (ground truth):
public QueryTreeNode createSubs(List<QueryTreeNode> subQueriesCandidates){
  if (LOG_OP.OR.equals(_op) && getBranchType() == BRANCH_TYPE.INDEXED) {
    QueryTreeNode n1;
    QueryTerm t1;
    if (_n1 != null) {
      n1=_n1.cloneBranch();
      t1=null;
    }
 else {
      n1=null;
      t1=_t1;
    }
    QueryTreeNode n2;
    QueryTerm t2;
    if (_n2 != null) {
      n2=_n2.cloneBranch();
      t2=null;
    }
 else {
      n2=null;
      t2=_t2;
    }
    QueryTreeNode newTree;
    if (_p != null) {
      if (_p._n1 == this) {
        _p._n1=n1;
        _p._t1=t1;
        _p.relateToChildren();
      }
 else       if (_p._n2 == this) {
        _p._n2=n1;
        _p._t2=t1;
        _p.relateToChildren();
      }
 else {
        throw new IllegalStateException();
      }
    }
 else {
      if (n1 != null) {
        n1._p=null;
      }
      if (n2 != null) {
        n2._p=null;
      }
    }
    if (_p == null) {
      newTree=new QueryTreeNode(n2,t2,null,null,null).relateToChildren();
    }
 else {
      newTree=_p.cloneTrunk(this,n2);
      if (n2 == null) {
        if (newTree._t1 == null) {
          newTree._t1=t2;
        }
 else {
          newTree._t2=t2;
        }
      }
    }
    subQueriesCandidates.add(newTree.root());
  }
  if (_n1 != null) {
    _n1.createSubs(subQueriesCandidates);
  }
  if (_n2 != null) {
    _n2.createSubs(subQueriesCandidates);
  }
  return this;
}
Program: 98229
Project: 98229
Buggy source:
private PageAccessFile_BB(FileChannel fc,int pageSize,FreeSpaceManager fsm){
  PAGE_SIZE=pageSize;
  MAX_POS=PAGE_SIZE - 4;
  this.fc=fc;
  this.fsm=fsm;
  isWriting=false;
  _buf=ByteBuffer.allocateDirect(PAGE_SIZE);
  _currentPage=0;
}

Fixed version (ground truth):
private PageAccessFile_BB(FileChannel fc,long pageSize,FreeSpaceManager fsm){
  PAGE_SIZE=pageSize;
  MAX_POS=(int)(PAGE_SIZE - 4);
  this.fc=fc;
  this.fsm=fsm;
  isWriting=false;
  _buf=ByteBuffer.allocateDirect((int)PAGE_SIZE);
  _currentPage=0;
}
Program: 98230
Project: 98230
Buggy source:
@Override public int getPageSize(){
  return PAGE_SIZE;
}

Fixed version (ground truth):
@Override public int getPageSize(){
  return (int)PAGE_SIZE;
}
Program: 98231
Project: 98231
Buggy source:
@Override public void seekPage(int pageId,int pageOffset,boolean autoPaging){
  isAutoPaging=autoPaging;
  try {
    if (pageId != _currentPage) {
      writeData();
      isWriting=false;
      _currentPage=pageId;
      _buf.clear();
      fc.read(_buf,pageId * PAGE_SIZE);
      _buf.limit(PAGE_SIZE);
    }
 else {
      _buf.rewind();
    }
    _buf.position(pageOffset);
  }
 catch (  IOException e) {
    throw new JDOFatalDataStoreException("String_Node_Str" + pageId,e);
  }
}

Fixed version (ground truth):
@Override public void seekPage(int pageId,int pageOffset,boolean autoPaging){
  isAutoPaging=autoPaging;
  try {
    if (pageId != _currentPage) {
      writeData();
      isWriting=false;
      _currentPage=pageId;
      _buf.clear();
      fc.read(_buf,pageId * PAGE_SIZE);
      _buf.limit((int)PAGE_SIZE);
    }
 else {
      _buf.rewind();
    }
    _buf.position(pageOffset);
  }
 catch (  IOException e) {
    throw new JDOFatalDataStoreException("String_Node_Str" + pageId,e);
  }
}
Program: 98232
Project: 98232
Buggy source:
private PageAccessFile_BBMappedPage(FileChannel fc,int pageSize,FreeSpaceManager fsm,File file){
  PAGE_SIZE=pageSize;
  MAX_POS=PAGE_SIZE - 4;
  this._fc=fc;
  this.fsm=fsm;
  this._file=file;
  try {
    isWriting=false;
    _buf=_fc.map(MapMode.READ_ONLY,0,PAGE_SIZE);
    _currentPage=0;
  }
 catch (  IOException e) {
    throw new JDOFatalDataStoreException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private PageAccessFile_BBMappedPage(FileChannel fc,long pageSize,FreeSpaceManager fsm,File file){
  PAGE_SIZE=pageSize;
  MAX_POS=(int)(PAGE_SIZE - 4);
  this._fc=fc;
  this.fsm=fsm;
  this._file=file;
  try {
    isWriting=false;
    _buf=_fc.map(MapMode.READ_ONLY,0,PAGE_SIZE);
    _currentPage=0;
  }
 catch (  IOException e) {
    throw new JDOFatalDataStoreException("String_Node_Str",e);
  }
}
Program: 98233
Project: 98233
Buggy source:
@Override public int getPageSize(){
  return PAGE_SIZE;
}

Fixed version (ground truth):
@Override public int getPageSize(){
  return (int)PAGE_SIZE;
}
Program: 98234
Project: 98234
Buggy source:
@Override public void makePersistent(PersistenceCapableImpl obj){
  long oid=getOidBuffer().allocateOid();
  _commonCache.markPersistent(obj,oid,this);
  obj.jdoReplaceStateManager(_commonCache.getStateManager());
  obj.jdoZooSetOid(oid);
}

Fixed version (ground truth):
@Override public void makePersistent(PersistenceCapableImpl obj){
  CachedSchema cs=_commonCache.getCachedSchema(obj.getClass(),this);
  if (cs == null || cs.isDeleted()) {
    throw new JDOUserException("String_Node_Str" + obj.getClass().getName(),obj);
  }
  long oid=getOidBuffer().allocateOid();
  _commonCache.markPersistent(obj,oid,this);
  obj.jdoReplaceStateManager(_commonCache.getStateManager());
  obj.jdoZooSetOid(oid);
}
Program: 98235
Project: 98235
Buggy source:
@Test public void testLargeSchema(){
  TestTools.removeDb(DB_NAME);
  TestTools.createDb(DB_NAME);
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  Schema.create(pm,JB0.class,DB_NAME);
  Schema.create(pm,JB1.class,DB_NAME);
  Schema.create(pm,JB2.class,DB_NAME);
  Schema.create(pm,JB3.class,DB_NAME);
  Schema.create(pm,JB4.class,DB_NAME);
  Schema.create(pm,TestSerializer.class,DB_NAME);
  pm.currentTransaction().commit();
  TestTools.closePM();
  pm=TestTools.openPM();
  pm.currentTransaction().begin();
  assertNotNull(Schema.locate(pm,JB0.class,DB_NAME));
  assertNotNull(Schema.locate(pm,JB1.class,DB_NAME));
  assertNotNull(Schema.locate(pm,JB2.class,DB_NAME));
  assertNotNull(Schema.locate(pm,JB3.class,DB_NAME));
  assertNotNull(Schema.locate(pm,JB4.class,DB_NAME));
  assertNotNull(Schema.locate(pm,TestSerializer.class,DB_NAME));
  JB4 jb4=new JB4();
  pm.makePersistent(jb4);
  JB0 jb0=new JB0();
  pm.makePersistent(jb0);
  pm.currentTransaction().commit();
  TestTools.closePM();
}

Fixed version (ground truth):
@Test public void testLargeSchema(){
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  Schema.create(pm,JB0.class,DB_NAME);
  Schema.create(pm,JB1.class,DB_NAME);
  Schema.create(pm,JB2.class,DB_NAME);
  Schema.create(pm,JB3.class,DB_NAME);
  Schema.create(pm,JB4.class,DB_NAME);
  Schema.create(pm,TestSerializer.class,DB_NAME);
  pm.currentTransaction().commit();
  TestTools.closePM();
  pm=TestTools.openPM();
  pm.currentTransaction().begin();
  assertNotNull(Schema.locate(pm,JB0.class,DB_NAME));
  assertNotNull(Schema.locate(pm,JB1.class,DB_NAME));
  assertNotNull(Schema.locate(pm,JB2.class,DB_NAME));
  assertNotNull(Schema.locate(pm,JB3.class,DB_NAME));
  assertNotNull(Schema.locate(pm,JB4.class,DB_NAME));
  assertNotNull(Schema.locate(pm,TestSerializer.class,DB_NAME));
  JB4 jb4=new JB4();
  pm.makePersistent(jb4);
  JB0 jb0=new JB0();
  pm.makePersistent(jb0);
  pm.currentTransaction().commit();
  TestTools.closePM();
}
Program: 98236
Project: 98236
Buggy source:
@Test public void testSchemaDeletion(){
  System.out.println("String_Node_Str");
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  Schema s01=Schema.locate(pm,TestClass.class.getName(),DB_NAME);
  if (s01 != null) {
    s01.remove();
    pm.currentTransaction().commit();
    pm.currentTransaction().begin();
  }
  Schema.create(pm,TestClass.class,DB_NAME);
  s01=Schema.locate(pm,TestClass.class.getName(),DB_NAME);
  assertNotNull(s01);
  s01.remove();
  assertNull(Schema.locate(pm,TestClass.class.getName(),DB_NAME));
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  assertNull(Schema.locate(pm,TestClass.class.getName(),DB_NAME));
  s01=Schema.create(pm,TestClass.class,DB_NAME);
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  s01.remove();
  try {
    s01.remove();
    fail();
  }
 catch (  JDOUserException e) {
  }
  assertNull(Schema.locate(pm,TestClass.class.getName(),DB_NAME));
  pm.currentTransaction().rollback();
  pm.currentTransaction().begin();
  s01=Schema.locate(pm,TestClass.class.getName(),DB_NAME);
  assertNotNull(s01);
  s01.remove();
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  assertNull(Schema.locate(pm,TestClass.class.getName(),DB_NAME));
  try {
    s01.remove();
    fail();
  }
 catch (  JDOUserException e) {
  }
  s01=Schema.create(pm,TestClass.class,DB_NAME);
  assertNotNull(Schema.locate(pm,TestClass.class.getName(),DB_NAME));
  pm.currentTransaction().commit();
  TestTools.closePM();
}

Fixed version (ground truth):
@Test public void testSchemaDeletion(){
  System.out.println("String_Node_Str");
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  Schema s01=Schema.create(pm,TestClass.class,DB_NAME);
  assertNotNull(s01);
  s01.remove();
  assertNull(Schema.locate(pm,TestClass.class.getName(),DB_NAME));
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  assertNull(Schema.locate(pm,TestClass.class.getName(),DB_NAME));
  s01=Schema.create(pm,TestClass.class,DB_NAME);
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  s01.remove();
  try {
    s01.remove();
    fail();
  }
 catch (  JDOUserException e) {
  }
  assertNull(Schema.locate(pm,TestClass.class.getName(),DB_NAME));
  pm.currentTransaction().rollback();
  pm.currentTransaction().begin();
  s01=Schema.locate(pm,TestClass.class.getName(),DB_NAME);
  assertNotNull(s01);
  s01.remove();
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  assertNull(Schema.locate(pm,TestClass.class.getName(),DB_NAME));
  try {
    s01.remove();
    fail();
  }
 catch (  JDOUserException e) {
  }
  s01=Schema.create(pm,TestClass.class,DB_NAME);
  assertNotNull(Schema.locate(pm,TestClass.class.getName(),DB_NAME));
  pm.currentTransaction().commit();
  TestTools.closePM();
}
Program: 98237
Project: 98237
Buggy source:
@Test public void testSchemaHierarchy(){
  TestTools.removeDb(DB_NAME);
  TestTools.createDb(DB_NAME);
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  Schema.create(pm,JB0.class,DB_NAME);
  Schema.create(pm,JB1.class,DB_NAME);
  Schema.create(pm,JB2.class,DB_NAME);
  Schema.create(pm,JB3.class,DB_NAME);
  Schema.create(pm,JB4.class,DB_NAME);
  pm.currentTransaction().commit();
  TestTools.closePM();
  pm=TestTools.openPM();
  pm.currentTransaction().begin();
  assertNotNull(Schema.locate(pm,JB0.class,DB_NAME));
  assertNotNull(Schema.locate(pm,JB1.class,DB_NAME));
  assertNotNull(Schema.locate(pm,JB2.class,DB_NAME));
  assertNotNull(Schema.locate(pm,JB3.class,DB_NAME));
  assertNotNull(Schema.locate(pm,JB4.class,DB_NAME));
  JB4 jb4=new JB4();
  pm.makePersistent(jb4);
  JB0 jb0=new JB0();
  pm.makePersistent(jb0);
  pm.currentTransaction().commit();
  TestTools.closePM();
}

Fixed version (ground truth):
@Test public void testSchemaHierarchy(){
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  Schema.create(pm,JB0.class,DB_NAME);
  Schema.create(pm,JB1.class,DB_NAME);
  Schema.create(pm,JB2.class,DB_NAME);
  Schema.create(pm,JB3.class,DB_NAME);
  Schema.create(pm,JB4.class,DB_NAME);
  pm.currentTransaction().commit();
  TestTools.closePM();
  pm=TestTools.openPM();
  pm.currentTransaction().begin();
  assertNotNull(Schema.locate(pm,JB0.class,DB_NAME));
  assertNotNull(Schema.locate(pm,JB1.class,DB_NAME));
  assertNotNull(Schema.locate(pm,JB2.class,DB_NAME));
  assertNotNull(Schema.locate(pm,JB3.class,DB_NAME));
  assertNotNull(Schema.locate(pm,JB4.class,DB_NAME));
  JB4 jb4=new JB4();
  pm.makePersistent(jb4);
  JB0 jb0=new JB0();
  pm.makePersistent(jb0);
  pm.currentTransaction().commit();
  TestTools.closePM();
}
Program: 98238
Project: 98238
Buggy source:
@Test public void testPageAllocation(){
  TestTools.removeDb(DB_NAME);
  TestTools.createDb(DB_NAME);
  String path=DataStoreManager.getDbPath(DB_NAME);
  File file=new File(path + File.separator + "String_Node_Str");
  assertTrue(file.exists());
  assertTrue(file.isFile());
  long len1=file.length();
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  Schema.create(pm,JdoPilot.class,DB_NAME);
  Schema.create(pm,JB0.class,DB_NAME);
  Schema.create(pm,JB1.class,DB_NAME);
  Schema.create(pm,JB2.class,DB_NAME);
  Schema.create(pm,JB3.class,DB_NAME);
  Schema.create(pm,JB4.class,DB_NAME);
  Schema.create(pm,JdoIndexedPilot.class,DB_NAME);
  pm.currentTransaction().commit();
  TestTools.closePM();
  long len2=file.length();
  int newPages=(int)((len2 - len1) / PAGE_SIZE);
  assertTrue("String_Node_Str" + newPages,newPages <= 3 * 7 + 3);
}

Fixed version (ground truth):
@Test public void testPageAllocation(){
  String path=DataStoreManager.getDbPath(DB_NAME);
  File file=new File(path + File.separator + "String_Node_Str");
  assertTrue(file.exists());
  assertTrue(file.isFile());
  long len1=file.length();
  PersistenceManager pm=TestTools.openPM();
  pm.currentTransaction().begin();
  Schema.create(pm,JdoPilot.class,DB_NAME);
  Schema.create(pm,JB0.class,DB_NAME);
  Schema.create(pm,JB1.class,DB_NAME);
  Schema.create(pm,JB2.class,DB_NAME);
  Schema.create(pm,JB3.class,DB_NAME);
  Schema.create(pm,JB4.class,DB_NAME);
  Schema.create(pm,JdoIndexedPilot.class,DB_NAME);
  pm.currentTransaction().commit();
  TestTools.closePM();
  long len2=file.length();
  int newPages=(int)((len2 - len1) / PAGE_SIZE);
  assertTrue("String_Node_Str" + newPages,newPages <= 3 * 7 + 3);
}
Program: 98239
Project: 98239
Buggy source:
@EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true) public void onBlockFromTo(BlockFromToEvent event){
  Block block=event.getToBlock();
  AutoRefMatch match=plugin.getMatch(block.getWorld());
  if (match != null && match.hasFlag(block.getLocation().add(0d,0d,0.5),AutoRefRegion.Flag.NO_FLOW)) {
    event.setCancelled(true);
  }
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true) public void onBlockFromTo(BlockFromToEvent event){
  Block block=event.getToBlock();
  AutoRefMatch match=plugin.getMatch(block.getWorld());
  if (match != null && match.hasFlag(block.getLocation().add(0.5,0d,0.5),AutoRefRegion.Flag.NO_FLOW)) {
    event.setCancelled(true);
  }
}
Program: 98240
Project: 98240
Buggy source:
@EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true) public void onBlockFromTo(BlockFromToEvent event){
  Block block=event.getToBlock();
  AutoRefMatch match=plugin.getMatch(block.getWorld());
  if (match == null)   return;
  Location location=block.getLocation();
switch (event.getFace()) {
case EAST:
    location=location.add(1d,0d,0d);
case SOUTH:
  location=location.add(0d,0d,1d);
default :
break;
}
if (match.hasFlag(location,AutoRefRegion.Flag.NO_FLOW)) {
event.setCancelled(true);
return;
}
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true) public void onBlockFromTo(BlockFromToEvent event){
  Block block=event.getToBlock();
  AutoRefMatch match=plugin.getMatch(block.getWorld());
  if (match != null && match.hasFlag(block.getLocation().add(0d,0d,0.5),AutoRefRegion.Flag.NO_FLOW)) {
    event.setCancelled(true);
  }
}
Program: 98241
Project: 98241
Buggy source:
/** 
 * Gets the team the player is expected to join. Matches setup by automated match configurations may designate certain players for certain teams.
 * @return player's team, null if no such team
 */
public AutoRefTeam getExpectedTeam(Player player){
  AutoRefTeam actualTeam=getTeam(player);
  if (actualTeam != null)   return actualTeam;
  for (  AutoRefMatch match : matches.values()) {
    for (    AutoRefTeam team : match.getTeams())     if (team.getExpectedPlayers().contains(player))     return team;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Gets the team the player is expected to join. Matches setup by automated match configurations may designate certain players for certain teams.
 * @return player's team, null if no such team
 */
public AutoRefTeam getExpectedTeam(Player player){
  AutoRefTeam actualTeam=getTeam(player);
  if (actualTeam != null)   return actualTeam;
  for (  AutoRefMatch match : matches.values()) {
    for (    AutoRefTeam team : match.getTeams())     if (team.getExpectedPlayers().contains(player.getName()))     return team;
  }
  return null;
}
Program: 98242
Project: 98242
Buggy source:
@AutoRefCommand(name={"String_Node_Str","String_Node_Str"},argmin=1,argmax=1,options="String_Node_Str",description="String_Node_Str",usage="String_Node_Str",opthelp={"String_Node_Str","String_Node_Str"}) @AutoRefPermission(console=false,nodes={"String_Node_Str"}) public boolean setupCore(CommandSender sender,AutoRefMatch match,String[] args,CommandLine options){
  if (match == null)   return false;
  Player player=(Player)sender;
  WorldEditPlugin worldEdit=AutoReferee.getWorldEdit();
  if (worldEdit == null) {
    sender.sendMessage("String_Node_Str");
    return true;
  }
  AutoRefTeam team=match.getTeam(args[0]);
  Selection sel=worldEdit.getSelection(player);
  AutoRefRegion reg=null;
  if ((sel instanceof CuboidSelection)) {
    CuboidSelection csel=(CuboidSelection)sel;
    reg=new CuboidRegion(csel.getMinimumPoint(),csel.getMaximumPoint());
  }
  CoreGoal core=new CoreGoal(team,reg);
  if (options.hasOption('r'))   try {
    core.setRange(Long.parseLong(options.getOptionValue('r')));
  }
 catch (  NumberFormatException e) {
    sender.sendMessage(ChatColor.RED + options.getOptionValue('r') + "String_Node_Str");
  }
  team.addGoal(core);
  sender.sendMessage(reg.toString() + "String_Node_Str" + team.getDisplayName()+ "String_Node_Str");
  sender.sendMessage(team.getDisplayName() + "String_Node_Str");
  return true;
}

Fixed version (ground truth):
@AutoRefCommand(name={"String_Node_Str","String_Node_Str"},argmin=1,argmax=1,options="String_Node_Str",description="String_Node_Str",usage="String_Node_Str",opthelp={"String_Node_Str","String_Node_Str"}) @AutoRefPermission(console=false,nodes={"String_Node_Str"}) public boolean setupCore(CommandSender sender,AutoRefMatch match,String[] args,CommandLine options){
  if (match == null)   return false;
  Player player=(Player)sender;
  WorldEditPlugin worldEdit=AutoReferee.getWorldEdit();
  if (worldEdit == null) {
    sender.sendMessage("String_Node_Str");
    return true;
  }
  AutoRefTeam team=match.getTeam(args[0]);
  Selection sel=worldEdit.getSelection(player);
  AutoRefRegion reg=null;
  if ((sel instanceof CuboidSelection)) {
    CuboidSelection csel=(CuboidSelection)sel;
    reg=new CuboidRegion(csel.getMinimumPoint(),csel.getMaximumPoint());
  }
 else {
    sender.sendMessage("String_Node_Str");
    return true;
  }
  CoreGoal core=new CoreGoal(team,reg);
  if (options.hasOption('r'))   try {
    core.setRange(Long.parseLong(options.getOptionValue('r')));
  }
 catch (  NumberFormatException e) {
    sender.sendMessage(ChatColor.RED + options.getOptionValue('r') + "String_Node_Str");
  }
  team.addGoal(core);
  sender.sendMessage(reg.toString() + "String_Node_Str" + team.getDisplayName()+ "String_Node_Str");
  sender.sendMessage(team.getDisplayName() + "String_Node_Str");
  return true;
}
Program: 98243
Project: 98243
Buggy source:
public static String syncQuery(String path,String method,String getParams,String postParams) throws IOException {
  OutputStreamWriter wr=null;
  InputStream rd=null;
  try {
    URL url=new URL(getParams == null ? path : String.format("String_Node_Str",path,getParams));
    HttpURLConnection conn=(HttpURLConnection)url.openConnection();
    conn.setDoOutput(true);
    AutoReferee instance=AutoReferee.getInstance();
    String pluginName=instance.getDescription().getFullName();
    conn.setRequestProperty("String_Node_Str",String.format("String_Node_Str",pluginName,instance.getCommit()));
    if (method != null) {
      conn.setRequestMethod(method);
      conn.addRequestProperty("String_Node_Str","String_Node_Str");
    }
    if (postParams != null) {
      wr=new OutputStreamWriter(conn.getOutputStream());
      wr.write(postParams);
      wr.flush();
    }
    StringWriter writer=new StringWriter();
    IOUtils.copy(rd=conn.getInputStream(),writer);
    return writer.toString();
  }
 catch (  IOException e) {
    throw e;
  }
 finally {
    try {
      if (wr != null)       wr.close();
      if (rd != null)       rd.close();
    }
 catch (    Exception e) {
    }
  }
}

Fixed version (ground truth):
public static String syncQuery(String path,String method,String getParams,String postParams) throws IOException {
  OutputStreamWriter wr=null;
  InputStream rd=null;
  try {
    URL url=new URL(getParams == null ? path : String.format("String_Node_Str",path,getParams));
    HttpURLConnection conn=(HttpURLConnection)url.openConnection();
    conn.setDoOutput(true);
    AutoReferee instance=AutoReferee.getInstance();
    String pluginName=instance.getDescription().getFullName();
    conn.setRequestProperty("String_Node_Str",String.format("String_Node_Str",pluginName,instance.getCommit()));
    if (method != null) {
      conn.setRequestMethod(method);
      conn.addRequestProperty("String_Node_Str","String_Node_Str");
    }
    if (postParams != null) {
      wr=new OutputStreamWriter(conn.getOutputStream());
      wr.write(postParams);
      wr.flush();
    }
    StringWriter writer=new StringWriter();
    IOUtils.copy(rd=conn.getInputStream(),writer);
    return writer.toString();
  }
 catch (  IOException e) {
    throw e;
  }
 finally {
    try {
      if (wr != null)       wr.close();
      if (rd != null)       rd.close();
    }
 catch (    Exception ignored) {
    }
  }
}
Program: 98244
Project: 98244
Buggy source:
/** 
 * Sets whether player collides with entities, including items and arrows. Uses last_username's collides-with-entities API from SportBukkit
 * @param collidesWithEntities Set whether player collides with entities
 * @see <a href="http://www.github.com/OvercastNetwork/SportBukkit">SportBukkit</a>
 */
public static void setCollidesWithEntities(Player player,boolean collidesWithEntities){
  if (mCollidesWithEntities != null)   try {
    mCollidesWithEntities.invoke(player,collidesWithEntities);
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
/** 
 * Sets whether player collides with entities, including items and arrows. Uses last_username's collides-with-entities API from SportBukkit
 * @param collidesWithEntities Set whether player collides with entities
 * @see <a href="http://www.github.com/OvercastNetwork/SportBukkit">SportBukkit</a>
 */
public static void setCollidesWithEntities(Player player,boolean collidesWithEntities){
  if (mCollidesWithEntities != null)   try {
    mCollidesWithEntities.invoke(player,collidesWithEntities);
  }
 catch (  Throwable ignored) {
  }
}
Program: 98245
Project: 98245
Buggy source:
/** 
 * Sets the overhead name, allowing for ChatColor characters. Uses anxuiz's set-overhead-name API from SportBukkit
 * @param overheadName New string to display above player's head
 * @see <a href="http://www.github.com/OvercastNetwork/SportBukkit">SportBukkit</a>
 * @deprecated use built-in scoreboards to change name colors
 */
@Deprecated public static void setOverheadName(Player player,String overheadName){
  if (mSetOverheadName != null)   try {
    mSetOverheadName.invoke(player,overheadName.trim().replaceAll(ChatColor.RESET.toString(),"String_Node_Str"));
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
/** 
 * Sets the overhead name, allowing for ChatColor characters. Uses anxuiz's set-overhead-name API from SportBukkit
 * @param overheadName New string to display above player's head
 * @see <a href="http://www.github.com/OvercastNetwork/SportBukkit">SportBukkit</a>
 * @deprecated use built-in scoreboards to change name colors
 */
@Deprecated public static void setOverheadName(Player player,String overheadName){
  if (mSetOverheadName != null)   try {
    mSetOverheadName.invoke(player,overheadName.trim().replaceAll(ChatColor.RESET.toString(),"String_Node_Str"));
  }
 catch (  Throwable ignored) {
  }
}
Program: 98246
Project: 98246
Buggy source:
/** 
 * Sets whether player affects spawning via natural spawn and mob spawners. Uses last_username's affects-spawning API from SportBukkit
 * @param affectsSpawning Set whether player affects spawning
 * @see <a href="http://www.github.com/OvercastNetwork/SportBukkit">SportBukkit</a>
 */
public static void setAffectsSpawning(Player player,boolean affectsSpawning){
  if (mAffectsSpawning != null)   try {
    mAffectsSpawning.invoke(player,affectsSpawning);
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
/** 
 * Sets whether player affects spawning via natural spawn and mob spawners. Uses last_username's affects-spawning API from SportBukkit
 * @param affectsSpawning Set whether player affects spawning
 * @see <a href="http://www.github.com/OvercastNetwork/SportBukkit">SportBukkit</a>
 */
public static void setAffectsSpawning(Player player,boolean affectsSpawning){
  if (mAffectsSpawning != null)   try {
    mAffectsSpawning.invoke(player,affectsSpawning);
  }
 catch (  Throwable ignored) {
  }
}
Program: 98247
Project: 98247
Buggy source:
@Test public void testNameLookup(){
  AutoRefTeam team=new AutoRefTeam();
  AutoRefPlayer p1=new AutoRefPlayer("String_Node_Str",null);
  AutoRefPlayer p2=new AutoRefPlayer("String_Node_Str",null);
  AutoRefPlayer p3=new AutoRefPlayer("String_Node_Str",null);
  AutoRefPlayer p4=new AutoRefPlayer("String_Node_Str",null);
  AutoRefPlayer pX=new AutoRefPlayer("String_Node_Str",null);
  team.addPlayer(p1);
  team.addPlayer(p2);
  Assert.assertNull(team.getPlayer("String_Node_Str"));
  Assert.assertNull(team.getPlayer("String_Node_Str"));
  team.addPlayer(p3);
  team.addPlayer(p4);
  Assert.assertEquals(p1,team.getPlayer("String_Node_Str"));
  Assert.assertEquals(p2,team.getPlayer("String_Node_Str"));
  Assert.assertEquals(p3,team.getPlayer("String_Node_Str"));
  Assert.assertNull(team.getPlayer("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testNameLookup(){
  AutoRefTeam team=new AutoRefTeam();
  AutoRefPlayer p1=new AutoRefPlayer("String_Node_Str",null);
  AutoRefPlayer p2=new AutoRefPlayer("String_Node_Str",null);
  AutoRefPlayer p3=new AutoRefPlayer("String_Node_Str",null);
  AutoRefPlayer p4=new AutoRefPlayer("String_Node_Str",null);
  team.addPlayer(p1);
  team.addPlayer(p2);
  Assert.assertNull(team.getPlayer("String_Node_Str"));
  Assert.assertNull(team.getPlayer("String_Node_Str"));
  team.addPlayer(p3);
  team.addPlayer(p4);
  Assert.assertEquals(p1,team.getPlayer("String_Node_Str"));
  Assert.assertEquals(p2,team.getPlayer("String_Node_Str"));
  Assert.assertEquals(p3,team.getPlayer("String_Node_Str"));
  Assert.assertNull(team.getPlayer("String_Node_Str"));
}
Program: 98248
Project: 98248
Buggy source:
private void updateCarrying(Inventory inv){
  if (getTeam() != null) {
    GoalsInventorySnapshot oldCarrying=carrying;
    carrying=null;
    carrying=getCarrying();
    MapDifference<BlockData,Integer> diff=oldCarrying.getDiff(carrying);
    if (!diff.areEqual()) {
      for (      BlockGoal goal : getTeam().getTeamGoals(BlockGoal.class))       if (goal.getItemStatus() == AutoRefGoal.ItemStatus.NONE && carrying.containsKey(goal.getItem())) {
        String m=String.format("String_Node_Str",getDisplayName(),goal.getItem().getDisplayName());
        getMatch().addEvent(new TranscriptEvent(getMatch(),TranscriptEvent.EventType.OBJECTIVE_FOUND,m,getLocation(),this,goal.getItem()));
        this.addPoints(AchievementPoints.OBJECTIVE_FOUND);
        getTeam().setLastObjectiveLocation(getLocation());
      }
      getTeam().updateCarrying(this,oldCarrying,carrying);
    }
  }
}

Fixed version (ground truth):
private void updateCarrying(Inventory inv){
  if (getTeam() != null) {
    GoalsInventorySnapshot oldCarrying=carrying;
    carrying=null;
    carrying=getCarrying();
    if (oldCarrying == null) {
      return;
    }
    MapDifference<BlockData,Integer> diff=oldCarrying.getDiff(carrying);
    if (!diff.areEqual()) {
      for (      BlockGoal goal : getTeam().getTeamGoals(BlockGoal.class))       if (goal.getItemStatus() == AutoRefGoal.ItemStatus.NONE && carrying.containsKey(goal.getItem())) {
        String m=String.format("String_Node_Str",getDisplayName(),goal.getItem().getDisplayName());
        getMatch().addEvent(new TranscriptEvent(getMatch(),TranscriptEvent.EventType.OBJECTIVE_FOUND,m,getLocation(),this,goal.getItem()));
        this.addPoints(AchievementPoints.OBJECTIVE_FOUND);
        getTeam().setLastObjectiveLocation(getLocation());
      }
      getTeam().updateCarrying(this,oldCarrying,carrying);
    }
  }
}
Program: 98249
Project: 98249
Buggy source:
private void download() throws IOException {
  this.zip=AutoRefMap.DOWNLOADING;
  File zip=new File(AutoRefMap.getMapLibrary(),filename);
  FileUtils.copyURLToFile(new URL(filename),zip);
  String md5comp=DigestUtils.md5Hex(new FileInputStream(zip));
  if (md5comp.equalsIgnoreCase(md5sum)) {
    this.zip=zip;
    return;
  }
  zip.delete();
  throw new IOException("String_Node_Str" + md5comp + "String_Node_Str"+ md5sum);
}

Fixed version (ground truth):
private void download() throws IOException {
  this.zip=AutoRefMap.DOWNLOADING;
  String bparts[]=filename.split("String_Node_Str"), basename=bparts[bparts.length - 1];
  File zip=new File(AutoRefMap.getMapLibrary(),basename);
  FileUtils.copyURLToFile(new URL(AutoRefMatch.getMapRepo() + filename),zip);
  String md5comp=DigestUtils.md5Hex(new FileInputStream(zip));
  if (md5comp.equalsIgnoreCase(md5sum)) {
    this.zip=zip;
    return;
  }
  zip.delete();
  throw new IOException("String_Node_Str" + md5comp + "String_Node_Str"+ md5sum);
}
Program: 98250
Project: 98250
Buggy source:
protected Element setRegionSettings(Element e){
  Set<Flag> fset=getFlags();
  if (!fset.isEmpty()) {
    Element eFlags;
    e.addContent(eFlags=new Element("String_Node_Str"));
    for (    Flag f : fset)     eFlags.addContent(new Element(f.name.toLowerCase()));
  }
  for (  AutoRefTeam team : getOwners())   e.addContent(new Element("String_Node_Str").setText(team.getName()));
  if (yaw != null)   e.setAttribute("String_Node_Str",Integer.toString(Math.round((float)yaw / ANGLE_RND) * ANGLE_RND));
  if (pitch != null)   e.setAttribute("String_Node_Str",Integer.toString(Math.round((float)pitch / ANGLE_RND) * ANGLE_RND));
  if (regionName != null)   e.setAttribute("String_Node_Str",this.getName());
  return e;
}

Fixed version (ground truth):
protected Element setRegionSettings(Element e){
  if (e == null)   return e;
  Set<Flag> fset=getFlags();
  if (!fset.isEmpty()) {
    Element eFlags;
    e.addContent(eFlags=new Element("String_Node_Str"));
    for (    Flag f : fset)     eFlags.addContent(new Element(f.name.toLowerCase()));
  }
  if (getOwners() != null)   for (  AutoRefTeam team : getOwners())   e.addContent(new Element("String_Node_Str").setText(team.getName()));
  if (yaw != null)   e.setAttribute("String_Node_Str",Integer.toString(Math.round((float)yaw / ANGLE_RND) * ANGLE_RND));
  if (pitch != null)   e.setAttribute("String_Node_Str",Integer.toString(Math.round((float)pitch / ANGLE_RND) * ANGLE_RND));
  if (regionName != null)   e.setAttribute("String_Node_Str",this.getName());
  return e;
}
Program: 98251
Project: 98251
Buggy source:
/** 
 * Teleports a player to a match they have been added to, joining the team inviting them.
 */
public void joinMatch(Player player){
  PlayerMatchJoinEvent event=new PlayerMatchJoinEvent(player,this);
  AutoReferee.fireEvent(event);
  if (!event.isCancelled())   return;
  if (this.isPlayer(player))   return;
  AutoRefTeam team=this.expectedTeam(player);
  if (team != null)   this.joinTeam(player,team,false);
 else   if (player.getWorld() != this.getWorld())   player.teleport(this.getPlayerSpawn(player));
  this.removeExpectedPlayer(player);
}

Fixed version (ground truth):
/** 
 * Teleports a player to a match they have been added to, joining the team inviting them.
 */
public void joinMatch(Player player){
  PlayerMatchJoinEvent event=new PlayerMatchJoinEvent(player,this);
  AutoReferee.fireEvent(event);
  if (event.isCancelled())   return;
  if (this.isPlayer(player))   return;
  AutoRefTeam team=this.expectedTeam(player);
  if (team != null)   this.joinTeam(player,team,false);
 else   if (player.getWorld() != this.getWorld())   player.teleport(this.getPlayerSpawn(player));
  this.removeExpectedPlayer(player);
}
Program: 98252
Project: 98252
Buggy source:
public Location getLocation(){
  Location loc=getRandomLocation(random);
  if (pitch != null)   loc.setPitch(pitch);
  if (yaw != null)   loc.setYaw(yaw);
  return loc.add(0.0,0.75,0.0);
}

Fixed version (ground truth):
public Location getLocation(){
  Location loc=getRandomLocation(random);
  if (pitch != null)   loc.setPitch(pitch);
  if (yaw != null)   loc.setYaw(yaw);
  return loc.add(0.0,0.5,0.0);
}
Program: 98254
Project: 98254
Buggy source:
public static String center(String text){
  int w=0;
  boolean isBold=false;
  for (int i=0; i < text.length(); ++i) {
    char c=text.charAt(i);
    if (c == ChatColor.COLOR_CHAR)     isBold=text.charAt(++i) == ChatColor.BOLD.getChar();
 else     w+=1 + getCharWidth(c,isBold);
  }
  int sw=charWidth.get(' ') + 1;
  return StringUtils.repeat(' ',(LINE_WIDTH - w) / (2 * sw)) + text;
}

Fixed version (ground truth):
public static String center(String text){
  int w=0;
  boolean isBold=false;
  for (int i=0; i < text.length(); ++i) {
    char c=text.charAt(i);
    if (c == ChatColor.COLOR_CHAR)     isBold=text.charAt(++i) == ChatColor.BOLD.getChar();
 else     w+=1 + getCharWidth(c,isBold);
  }
  int repeat=(LINE_WIDTH - w) / (2 * (charWidth.get(' ') + 1));
  return StringUtils.repeat(' ',repeat < 0 ? 0 : repeat) + text;
}
Program: 98255
Project: 98255
Buggy source:
@EventHandler public void endermanPickup(EntityChangeBlockEvent event){
  AutoRefMatch match=plugin.getMatch(event.getEntity().getWorld());
  if (match == null)   return;
  if (event.getEntityType() == EntityType.ENDERMAN)   event.setCancelled(true);
}

Fixed version (ground truth):
@EventHandler public void endermanPickup(EntityChangeBlockEvent event){
  AutoRefMatch match=plugin.getMatch(event.getBlock().getWorld());
  if (match == null)   return;
  if (event.getEntityType() == EntityType.ENDERMAN)   event.setCancelled(true);
}
Program: 98257
Project: 98257
Buggy source:
@EventHandler public void playerRespawn(PlayerRespawnEvent event){
  World world=event.getPlayer().getWorld();
  AutoRefMatch match=plugin.getMatch(world);
  if (match == null)   for (  AutoRefMatch m : plugin.getMatches())   if (m.isPlayer(event.getPlayer()))   match=m;
  if (match != null && match.isPlayer(event.getPlayer())) {
    if (event.getRespawnLocation().getWorld() != match.getWorld())     event.setRespawnLocation(match.getPlayerSpawn(event.getPlayer()));
    match.getPlayer(event.getPlayer()).respawn();
  }
}

Fixed version (ground truth):
@EventHandler public void playerRespawn(PlayerRespawnEvent event){
  World world=event.getPlayer().getWorld();
  AutoRefMatch match=plugin.getMatch(world);
  if (match == null)   for (  AutoRefMatch m : plugin.getMatches())   if (m.isPlayer(event.getPlayer()))   match=m;
  if (match != null && match.isPlayer(event.getPlayer())) {
    boolean hasBed=event.getPlayer().getBedSpawnLocation() != null;
    if (!hasBed || event.getRespawnLocation().getWorld() != match.getWorld())     event.setRespawnLocation(match.getPlayerSpawn(event.getPlayer()));
    match.getPlayer(event.getPlayer()).respawn();
  }
}
Program: 98258
Project: 98258
Buggy source:
@EventHandler public void playerRespawn(PlayerRespawnEvent event){
  World world=event.getPlayer().getWorld();
  AutoRefMatch match=plugin.getMatch(world);
  if (match == null)   for (  AutoRefMatch m : plugin.getMatches())   if (m.isPlayer(event.getPlayer()))   match=m;
  if (match != null && match.isPlayer(event.getPlayer()) && (event.getPlayer().getBedSpawnLocation() == null || event.getRespawnLocation().getWorld() != match.getWorld())) {
    Location spawn=match.getPlayerSpawn(event.getPlayer());
    event.setRespawnLocation(spawn == null ? match.getWorldSpawn() : spawn);
    match.getPlayer(event.getPlayer()).respawn();
  }
}

Fixed version (ground truth):
@EventHandler public void playerRespawn(PlayerRespawnEvent event){
  World world=event.getPlayer().getWorld();
  AutoRefMatch match=plugin.getMatch(world);
  if (match == null)   for (  AutoRefMatch m : plugin.getMatches())   if (m.isPlayer(event.getPlayer()))   match=m;
  if (match != null && match.isPlayer(event.getPlayer())) {
    if (event.getRespawnLocation().getWorld() != match.getWorld())     event.setRespawnLocation(match.getPlayerSpawn(event.getPlayer()));
    match.getPlayer(event.getPlayer()).respawn();
  }
}
Program: 98259
Project: 98259
Buggy source:
public void setDebug(CommandSender recp){
  if (recp.hasPermission("String_Node_Str"))   AutoReferee.getInstance().getLogger().info("String_Node_Str");
  debugRecipient=recp;
  debug(ChatColor.GREEN + "String_Node_Str" + (isDebugMode() ? "String_Node_Str" : "String_Node_Str"));
}

Fixed version (ground truth):
public void setDebug(CommandSender recp){
  if (recp != null && recp.hasPermission("String_Node_Str"))   AutoReferee.getInstance().getLogger().info("String_Node_Str");
  debugRecipient=recp;
  debug(ChatColor.GREEN + "String_Node_Str" + (isDebugMode() ? "String_Node_Str" : "String_Node_Str"));
}
Program: 98260
Project: 98260
Buggy source:
public void debug(String msg){
  debugRecipient.sendMessage(msg);
}

Fixed version (ground truth):
public void debug(String msg){
  if (debugRecipient != null)   debugRecipient.sendMessage(msg);
}
Program: 98261
Project: 98261
Buggy source:
public void updateObjectives(){
  int inexactRange=getMatch().getInexactRange();
  objloop:   for (  BlockData bd : getObjectives()) {
    for (    Map.Entry<Location,BlockData> e : winConditions.entrySet()) {
      if (getMatch().blockInRange(e.getValue(),e.getKey(),inexactRange) != null) {
        setObjectiveStatus(bd,GoalStatus.PLACED);
        continue objloop;
      }
    }
    for (    AutoRefPlayer apl : getPlayers()) {
      if (!apl.getCarrying().contains(bd))       continue;
      setObjectiveStatus(bd,GoalStatus.CARRYING);
      continue objloop;
    }
    if (objectiveStatus.get(bd) != GoalStatus.NONE) {
      setObjectiveStatus(bd,GoalStatus.SEEN);
      continue;
    }
  }
}

Fixed version (ground truth):
public void updateObjectives(){
  int inexactRange=getMatch().getInexactRange();
  objloop:   for (  BlockData bd : getObjectives()) {
    for (    Map.Entry<Location,BlockData> e : winConditions.entrySet())     if (bd.equals(e.getValue())) {
      if (getMatch().blockInRange(bd,e.getKey(),inexactRange) != null) {
        setObjectiveStatus(bd,GoalStatus.PLACED);
        continue objloop;
      }
    }
    for (    AutoRefPlayer apl : getPlayers()) {
      if (!apl.getCarrying().contains(bd))       continue;
      setObjectiveStatus(bd,GoalStatus.CARRYING);
      continue objloop;
    }
    if (objectiveStatus.get(bd) != GoalStatus.NONE) {
      setObjectiveStatus(bd,GoalStatus.SEEN);
      continue;
    }
  }
}