nus-yam/ex-repair huggingface dataset:
Program: 29918
Project: 29918
Buggy source:
protected static void CheckPath(ArrayList<String> path,int depth,TableDefinition tableDefinition,boolean lastLink){
  TableDefinition tableDef=tableDefinition;
  if (tableDef == null)   return;
  for (int i=0; i < depth - 1; i++) {
    String name=path.get(i);
    if (tableDef.isLinkField(name)) {
      FieldDefinition fd=tableDef.getFieldDef(name);
      if (fd == null)       throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str");
      tableDef=tableDef.getLinkExtentTableDef(fd);
      if (tableDef == null)       throw new IllegalArgumentException("String_Node_Str" + name);
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str");
    }
  }
  String lname=path.get(depth);
  boolean lasttIsLink=tableDef.isLinkField(lname);
  if (lastLink) {
    if (!lasttIsLink)     throw new IllegalArgumentException("String_Node_Str" + lname + "String_Node_Str");
  }
 else {
    if (lasttIsLink)     throw new IllegalArgumentException("String_Node_Str" + lname + "String_Node_Str");
  }
}

Fixed version (ground truth):
protected static void CheckPath(ArrayList<String> path,int depth,TableDefinition tableDefinition,boolean lastLink){
  TableDefinition tableDef=tableDefinition;
  if (tableDef == null)   return;
  for (int i=0; i < depth - 1; i++) {
    String name=path.get(i);
    FieldDefinition fd=tableDef.getFieldDef(name);
    if (fd == null)     throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str");
    if (tableDef.isLinkField(name) || (fd.isXLinkField())) {
      tableDef=tableDef.getLinkExtentTableDef(fd);
      if (tableDef == null)       throw new IllegalArgumentException("String_Node_Str" + name);
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str");
    }
  }
  String lname=path.get(depth);
  FieldDefinition fd=tableDef.getFieldDef(lname);
  boolean lasttIsLink=tableDef.isLinkField(lname) || (fd != null && fd.isXLinkField());
  if (lastLink) {
    if (!lasttIsLink)     throw new IllegalArgumentException("String_Node_Str" + lname + "String_Node_Str");
  }
 else {
    if (lasttIsLink)     throw new IllegalArgumentException("String_Node_Str" + lname + "String_Node_Str");
  }
}
Program: 29919
Project: 29919
Buggy source:
protected static TableDefinition GetTableDefinition(ArrayList<String> path,int index,TableDefinition tableDefinition){
  if (tableDefinition == null)   return null;
  FieldDefinition fd=null;
  TableDefinition tableDef=tableDefinition;
  for (int i=0; i < index; i++) {
    if (tableDef == null)     return null;
    fd=tableDef.getFieldDef(path.get(i));
    if (tableDef.isLinkField(path.get(i))) {
      if (fd == null)       return null;
      tableDef=tableDef.getLinkExtentTableDef(fd);
    }
 else {
      if (fd != null) {
        if (fd.isGroupField()) {
          ArrayList<String> nested=GetNestedFields(fd);
          fd=tableDef.getFieldDef(nested.get(0));
          if (tableDef.isLinkField(nested.get(0)))           tableDef=tableDef.getLinkExtentTableDef(fd);
 else           return tableDef;
        }
      }
    }
  }
  return tableDef;
}

Fixed version (ground truth):
protected static TableDefinition GetTableDefinition(ArrayList<String> path,int index,TableDefinition tableDefinition){
  if (tableDefinition == null)   return null;
  FieldDefinition fd=null;
  TableDefinition tableDef=tableDefinition;
  for (int i=0; i < index; i++) {
    if (tableDef == null)     return null;
    fd=tableDef.getFieldDef(path.get(i));
    if (tableDef.isLinkField(path.get(i)) || (fd != null && fd.isXLinkField())) {
      if (fd == null)       return null;
      tableDef=tableDef.getLinkExtentTableDef(fd);
    }
 else {
      if (fd != null) {
        if (fd.isGroupField()) {
          ArrayList<String> nested=GetNestedFields(fd);
          fd=tableDef.getFieldDef(nested.get(0));
          if (tableDef.isLinkField(nested.get(0)) || (fd != null && fd.isXLinkField()))           tableDef=tableDef.getLinkExtentTableDef(fd);
 else           return tableDef;
        }
      }
    }
  }
  return tableDef;
}
Program: 29920
Project: 29920
Buggy source:
protected static FieldDefinition GetField(ArrayList<String> path,int index,TableDefinition tableDefinition){
  if (tableDefinition == null)   return null;
  FieldDefinition fd=null;
  TableDefinition tableDef=tableDefinition;
  int current=0;
  while (true) {
    if (tableDef == null)     return null;
    fd=tableDef.getFieldDef(path.get(current));
    if (tableDef.isLinkField(path.get(current)) || (fd != null && fd.isXLinkField())) {
      if (fd == null)       return null;
      tableDef=tableDef.getLinkExtentTableDef(fd);
    }
    if (current == index)     return fd;
    if (fd != null && fd.isGroupField()) {
      ArrayList<String> nested=GetNestedFields(fd);
      fd=tableDef.getFieldDef(nested.get(0));
      if (tableDef.isLinkField(nested.get(0)))       tableDef=tableDef.getLinkExtentTableDef(fd);
    }
    current++;
  }
}

Fixed version (ground truth):
protected static FieldDefinition GetField(ArrayList<String> path,int index,TableDefinition tableDefinition){
  if (tableDefinition == null)   return null;
  FieldDefinition fd=null;
  TableDefinition tableDef=tableDefinition;
  int current=0;
  while (true) {
    if (tableDef == null)     return null;
    fd=tableDef.getFieldDef(path.get(current));
    if (tableDef.isLinkField(path.get(current)) || (fd != null && fd.isXLinkField())) {
      if (fd == null)       return null;
      tableDef=tableDef.getLinkExtentTableDef(fd);
    }
    if (current == index)     return fd;
    if (fd != null && fd.isGroupField()) {
      ArrayList<String> nested=GetNestedFields(fd);
      fd=tableDef.getFieldDef(nested.get(0));
      if (tableDef.isLinkField(nested.get(0)) || (fd != null && fd.isXLinkField()))       tableDef=tableDef.getLinkExtentTableDef(fd);
    }
    current++;
  }
}
Program: 29921
Project: 29921
Buggy source:
public static TableDefinition GetTableContext(Query q,TableDefinition definition){
  TableDefinition tableDef=definition;
  ArrayList<String> path=QueryUtils.GetPath(q,tableDef);
  for (int i=0; i < path.size(); i++) {
    FieldDefinition fd=tableDef.getFieldDef(path.get(i));
    if (fd == null) {
      if (i != (path.size() - 1)) {
        throw new IllegalArgumentException("String_Node_Str" + path.get(i));
      }
    }
    if (tableDef.isLinkField(path.get(i))) {
      tableDef=tableDef.getLinkExtentTableDef(fd);
      if (tableDef == null) {
        throw new IllegalArgumentException("String_Node_Str" + path.get(i));
      }
    }
 else {
      if (fd != null && fd.getType() == FieldType.GROUP) {
        ArrayList<String> nestedLinks=QueryUtils.GetNestedFields(fd);
        if (nestedLinks.size() == 0) {
          throw new IllegalArgumentException("String_Node_Str" + fd.getName() + "String_Node_Str"+ QueryUtils.LinkName(path)+ "String_Node_Str");
        }
 else {
          fd=tableDef.getFieldDef(nestedLinks.get(0));
          if (fd != null)           tableDef=tableDef.getLinkExtentTableDef(fd);
        }
      }
    }
  }
  return tableDef;
}

Fixed version (ground truth):
public static TableDefinition GetTableContext(Query q,TableDefinition definition){
  TableDefinition tableDef=definition;
  ArrayList<String> path=QueryUtils.GetPath(q,tableDef);
  for (int i=0; i < path.size(); i++) {
    FieldDefinition fd=tableDef.getFieldDef(path.get(i));
    if (fd == null) {
      if (i != (path.size() - 1)) {
        throw new IllegalArgumentException("String_Node_Str" + path.get(i));
      }
    }
    if (tableDef.isLinkField(path.get(i)) || (fd != null && fd.isXLinkField())) {
      tableDef=tableDef.getLinkExtentTableDef(fd);
      if (tableDef == null) {
        throw new IllegalArgumentException("String_Node_Str" + path.get(i));
      }
    }
 else {
      if (fd != null && fd.getType() == FieldType.GROUP) {
        ArrayList<String> nestedLinks=QueryUtils.GetNestedFields(fd);
        if (nestedLinks.size() == 0) {
          throw new IllegalArgumentException("String_Node_Str" + fd.getName() + "String_Node_Str"+ QueryUtils.LinkName(path)+ "String_Node_Str");
        }
 else {
          fd=tableDef.getFieldDef(nestedLinks.get(0));
          if (fd != null)           tableDef=tableDef.getLinkExtentTableDef(fd);
        }
      }
    }
  }
  return tableDef;
}
Program: 29922
Project: 29922
Buggy source:
public void next(){
  do {
    doNext();
  }
 while (doc != Integer.MAX_VALUE && num < 0);
}

Fixed version (ground truth):
public void next(){
  doNext();
}
Program: 29923
Project: 29923
Buggy source:
public PathEntry(List<AggregationGroupItem> path,int index,int groupIndex,boolean isGroupPath){
  AggregationGroupItem item=path.get(index);
  this.tableDef=item.tableDef;
  this.groupIndex=groupIndex;
  name=item.name;
  query=item.query;
  if (query != null) {
    queryText=item.query.toString();
    if (USEQUERYCACHE) {
      queryCache=new LRUCache<ObjectID,Boolean>(QUERYCACHECAPACITY);
    }
    QueryExecutor qe=new QueryExecutor(tableDef);
    filter=qe.filter(item.query);
    Set<String> filterFields=new HashSet<String>();
    filter.addFields(filterFields);
    if (filterFields.contains("String_Node_Str"))     fieldNames.add("String_Node_Str");
 else     fieldNames.addAll(filterFields);
  }
  nestedLinks=item.nestedLinks;
  isLink=item.isLink;
  if (index == path.size() - 1) {
    if (isLink) {
      PathEntry entry=new PathEntry(item.tableDef,groupIndex);
      entry.name=ANY;
      entry.isLink=false;
      add(entry,isGroupPath);
    }
 else     if (name != PathEntry.ANY) {
      fieldNames.add(name);
    }
  }
 else {
    add(new PathEntry(path,index + 1,groupIndex,isGroupPath),isGroupPath);
  }
}

Fixed version (ground truth):
public PathEntry(List<AggregationGroupItem> path,int index,int groupIndex,boolean isGroupPath){
  AggregationGroupItem item=path.get(index);
  this.tableDef=item.tableDef;
  this.groupIndex=groupIndex;
  name=item.name;
  nestedLinks=item.nestedLinks;
  isLink=item.isLink;
  PathEntry entry=null;
  if (index == path.size() - 1) {
    if (isLink) {
      entry=new PathEntry(item.tableDef,groupIndex);
      entry.name=ANY;
      entry.isLink=false;
      add(entry,isGroupPath);
    }
 else     if (name != PathEntry.ANY) {
      fieldNames.add(name);
    }
  }
 else {
    entry=new PathEntry(path,index + 1,groupIndex,isGroupPath);
    add(entry,isGroupPath);
  }
  if (item.query != null) {
    setQuery(item,isGroupPath ? this : entry);
  }
}
Program: 29924
Project: 29924
Buggy source:
private void process(Entity obj,PathEntry entry,GroupSetEntry groupSetEntry,Set<String>[] groupKeys){
  for (  int groupIndex : entry.groupIndexes) {
    groupKeys[groupIndex].clear();
  }
  collectGroupValues(obj,entry,groupSetEntry,groupKeys);
  for (  int groupIndex : entry.groupIndexes) {
    if (groupKeys[groupIndex].size() == 0)     return;
  }
  if (entry.isLink) {
    if (entry.query != null) {
      if (!entry.checkCondition(obj)) {
        boolean result=entry.checkCondition(obj);
        if (!result)         return;
      }
    }
    for (    Entity linkedObject : obj.getLinkedEntities(entry.name,entry.fieldNames)) {
      process(linkedObject,entry.branches.get(0),groupSetEntry,groupKeys);
    }
  }
 else {
    if (entry.name == PathEntry.ANY) {
      updateMetric(obj.id().toString(),groupSetEntry,groupKeys);
    }
 else {
      String value=obj.get(entry.name);
      String[] values=value == null ? new String[]{value} : value.split(CommonDefs.MV_SCALAR_SEP_CHAR);
      for (      String collectionValue : values) {
        for (        Integer groupIndex : entry.matchingGroupIndexes) {
          groupKeys[groupIndex].clear();
          groupSetEntry.m_groupPaths[groupIndex].addValueKeys(groupKeys[groupIndex],collectionValue);
        }
        updateMetric(collectionValue,groupSetEntry,groupKeys);
      }
    }
  }
}

Fixed version (ground truth):
private void process(Entity obj,PathEntry entry,GroupSetEntry groupSetEntry,Set<String>[] groupKeys){
  for (  int groupIndex : entry.groupIndexes) {
    groupKeys[groupIndex].clear();
  }
  collectGroupValues(obj,entry,groupSetEntry,groupKeys);
  for (  int groupIndex : entry.groupIndexes) {
    if (groupKeys[groupIndex].size() == 0)     return;
  }
  if (entry.query != null) {
    if (!entry.checkCondition(obj)) {
      return;
    }
  }
  if (entry.isLink) {
    for (    Entity linkedObject : obj.getLinkedEntities(entry.name,entry.fieldNames)) {
      process(linkedObject,entry.branches.get(0),groupSetEntry,groupKeys);
    }
  }
 else {
    if (entry.name == PathEntry.ANY) {
      updateMetric(obj.id().toString(),groupSetEntry,groupKeys);
    }
 else {
      String value=obj.get(entry.name);
      String[] values=value == null ? new String[]{value} : value.split(CommonDefs.MV_SCALAR_SEP_CHAR);
      for (      String collectionValue : values) {
        for (        Integer groupIndex : entry.matchingGroupIndexes) {
          groupKeys[groupIndex].clear();
          groupSetEntry.m_groupPaths[groupIndex].addValueKeys(groupKeys[groupIndex],collectionValue);
        }
        updateMetric(collectionValue,groupSetEntry,groupKeys);
      }
    }
  }
}
Program: 29925
Project: 29925
Buggy source:
public static void checkContainingPreservedColumns(Map<byte[],NavigableSet<byte[]>> familyMap) throws IOException {
  for (  Entry<byte[],NavigableSet<byte[]>> entry : familyMap.entrySet()) {
    byte[] family=entry.getKey();
    for (    byte[] qualifier : entry.getValue()) {
      checkContainingPreservedColumn(family,qualifier);
    }
  }
}

Fixed version (ground truth):
public static void checkContainingPreservedColumns(Map<byte[],NavigableSet<byte[]>> familyMap) throws IOException {
  for (  Entry<byte[],NavigableSet<byte[]>> entry : familyMap.entrySet()) {
    byte[] family=entry.getKey();
    if (entry.getValue() != null) {
      for (      byte[] qualifier : entry.getValue()) {
        checkContainingPreservedColumn(family,qualifier);
      }
    }
  }
}
Program: 29926
Project: 29926
Buggy source:
@Test public void testCheckContainingPreservedColumns(){
  Map<byte[],NavigableSet<byte[]>> familyMap=new HashMap<byte[],NavigableSet<byte[]>>();
  familyMap.put(FAMILY,new TreeSet<byte[]>(Bytes.BYTES_COMPARATOR));
  familyMap.get(FAMILY).add(QUALIFIER);
  try {
    ThemisRead.checkContainingPreservedColumns(familyMap);
  }
 catch (  IOException e) {
    Assert.fail();
  }
  familyMap.get(FAMILY).add(ColumnUtil.getPutColumn(new Column(FAMILY,QUALIFIER)).getQualifier());
  try {
    ThemisRead.checkContainingPreservedColumns(familyMap);
    Assert.fail();
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
@Test public void testCheckContainingPreservedColumns(){
  Map<byte[],NavigableSet<byte[]>> familyMap=new HashMap<byte[],NavigableSet<byte[]>>();
  familyMap.put(FAMILY,new TreeSet<byte[]>(Bytes.BYTES_COMPARATOR));
  familyMap.get(FAMILY).add(QUALIFIER);
  familyMap.put(ANOTHER_FAMILY,null);
  try {
    ThemisRead.checkContainingPreservedColumns(familyMap);
  }
 catch (  IOException e) {
    Assert.fail();
  }
  familyMap.get(FAMILY).add(ColumnUtil.getPutColumn(new Column(FAMILY,QUALIFIER)).getQualifier());
  try {
    ThemisRead.checkContainingPreservedColumns(familyMap);
    Assert.fail();
  }
 catch (  IOException e) {
  }
}
Program: 29927
Project: 29927
Buggy source:
protected static byte[] concatQualifierWithSuffix(byte[] qualifier,String suffix){
  String qualiferString=qualifier == null ? "String_Node_Str" : Bytes.toString(qualifier);
  return Bytes.toBytes(qualiferString + suffix);
}

Fixed version (ground truth):
protected static byte[] concatQualifierWithSuffix(byte[] qualifier,byte[] suffix){
  return qualifier == null ? qualifier : Bytes.add(qualifier,suffix);
}
Program: 29928
Project: 29928
Buggy source:
public static Column getPutColumn(Column dataColumn){
  return new Column(dataColumn.getFamily(),concatQualifierWithSuffix(dataColumn.getQualifier(),PUT_QUALIFIER_SUFFIX));
}

Fixed version (ground truth):
public static Column getPutColumn(Column dataColumn){
  return new Column(dataColumn.getFamily(),concatQualifierWithSuffix(dataColumn.getQualifier(),PUT_QUALIFIER_SUFFIX_BYTES));
}
Program: 29929
Project: 29929
Buggy source:
public static Column getDeleteColumn(Column dataColumn){
  return new Column(dataColumn.getFamily(),concatQualifierWithSuffix(dataColumn.getQualifier(),DELETE_QUALIFIER_SUFFIX));
}

Fixed version (ground truth):
public static Column getDeleteColumn(Column dataColumn){
  return new Column(dataColumn.getFamily(),concatQualifierWithSuffix(dataColumn.getQualifier(),DELETE_QUALIFIER_SUFFIX_BYTES));
}
Program: 29930
Project: 29930
Buggy source:
protected void prewriteRowWithLockClean(byte[] tableName,RowMutation mutation,boolean containPrimary) throws IOException {
  ThemisLock lock=prewriteRow(tableName,mutation,containPrimary);
  if (lock != null) {
    if (disableLockClean) {
      throw new LockConflictException("String_Node_Str" + lock.getColumn() + "String_Node_Str"+ lock);
    }
    if (!ColumnUtil.isDataColumn(lock.getColumn())) {
      throw new ThemisFatalException("String_Node_Str" + Bytes.toString(tableName) + "String_Node_Str"+ mutation+ "String_Node_Str"+ lock.getColumn());
    }
    lockCleaner.tryToCleanLock(lock);
    lock=prewriteRow(tableName,mutation,containPrimary);
    if (lock != null) {
      throw new LockConflictException("String_Node_Str" + lock.getColumn() + "String_Node_Str"+ lock);
    }
  }
}

Fixed version (ground truth):
protected void prewriteRowWithLockClean(byte[] tableName,RowMutation mutation,boolean containPrimary) throws IOException {
  ThemisLock lock=prewriteRow(tableName,mutation,containPrimary);
  if (lock != null) {
    if (disableLockClean) {
      throw new LockConflictException("String_Node_Str" + lock.getColumn() + "String_Node_Str"+ lock);
    }
    if (!ColumnUtil.isDataColumn(lock.getColumn())) {
      throw new ThemisFatalException("String_Node_Str" + Bytes.toString(tableName) + "String_Node_Str"+ mutation+ "String_Node_Str"+ lock.getColumn());
    }
    lockCleaner.checkLockExpiredAndTryToCleanLock(lock);
    lock=prewriteRow(tableName,mutation,containPrimary);
    if (lock != null) {
      throw new LockConflictException("String_Node_Str" + lock.getColumn() + "String_Node_Str"+ lock);
    }
  }
}
Program: 29931
Project: 29931
Buggy source:
public void tryToCleanLocks(byte[] tableName,List<KeyValue> lockColumns) throws IOException {
  List<ThemisLock> locks=constructLocks(tableName,lockColumns,cpClient);
  long startTs=lockColumns.get(0).getTimestamp();
  for (  ThemisLock lock : locks) {
    if (tryToCleanLock(lock)) {
      LOG.warn("String_Node_Str" + startTs + "String_Node_Str"+ lock+ "String_Node_Str"+ lock.getTimestamp());
    }
  }
}

Fixed version (ground truth):
public void tryToCleanLocks(byte[] tableName,List<KeyValue> lockColumns) throws IOException {
  List<ThemisLock> locks=constructLocks(tableName,lockColumns,cpClient,clientLockTTl);
  long startTs=lockColumns.get(0).getTimestamp();
  for (  ThemisLock lock : locks) {
    if (tryToCleanLock(lock)) {
      LOG.warn("String_Node_Str" + startTs + "String_Node_Str"+ lock+ "String_Node_Str"+ lock.getTimestamp());
    }
  }
}
Program: 29932
Project: 29932
Buggy source:
protected static void checkLockExpired(ThemisLock lock,ThemisCoprocessorClient cpClient,int clientLockTTL) throws IOException {
  if (clientLockTTL == 0) {
    lock.setLockExpired(cpClient.isLockExpired(lock.getColumn().getTableName(),lock.getColumn().getRow(),lock.getTimestamp()));
  }
 else {
    lock.setLockExpired(TransactionTTL.isLockExpired(lock.getTimestamp(),clientLockTTL));
    LOG.info("String_Node_Str" + lock + "String_Node_Str"+ clientLockTTL+ "String_Node_Str"+ TransactionTTL.timestampType);
  }
}

Fixed version (ground truth):
public static void checkLockExpired(ThemisLock lock,ThemisCoprocessorClient cpClient,int clientLockTTL) throws IOException {
  if (clientLockTTL == 0) {
    lock.setLockExpired(cpClient.isLockExpired(lock.getColumn().getTableName(),lock.getColumn().getRow(),lock.getTimestamp()));
  }
 else {
    lock.setLockExpired(TransactionTTL.isLockExpired(lock.getTimestamp(),clientLockTTL));
    LOG.info("String_Node_Str" + lock + "String_Node_Str"+ clientLockTTL+ "String_Node_Str"+ TransactionTTL.timestampType);
  }
}
Program: 29933
Project: 29933
Buggy source:
@Test public void testConstructLocks() throws IOException {
  ThemisLock expectLock=getPrimaryLock();
  List<KeyValue> kvs=new ArrayList<KeyValue>();
  kvs.add(getLockKv(KEYVALUE,ThemisLock.toByte(expectLock)));
  List<ThemisLock> locks=LockCleaner.constructLocks(TABLENAME,kvs,cpClient);
  Assert.assertEquals(1,locks.size());
  Assert.assertTrue(expectLock.equals(locks.get(0)));
  Assert.assertTrue(COLUMN.equals(locks.get(0).getColumn()));
  kvs.add(KEYVALUE);
  try {
    LockCleaner.constructLocks(TABLENAME,kvs,cpClient);
    Assert.fail();
  }
 catch (  ThemisFatalException e) {
  }
}

Fixed version (ground truth):
@Test public void testConstructLocks() throws IOException {
  ThemisLock expectLock=getPrimaryLock();
  List<KeyValue> kvs=new ArrayList<KeyValue>();
  kvs.add(getLockKv(KEYVALUE,ThemisLock.toByte(expectLock)));
  String rawClientLockTTL=conf.get(TransactionConstant.CLIENT_LOCK_TTL_KEY);
  int clientLockTTL=10;
  Threads.sleep(clientLockTTL);
  Assert.assertTrue(System.currentTimeMillis() - expectLock.getTimestamp() > clientLockTTL);
  List<ThemisLock> locks=LockCleaner.constructLocks(TABLENAME,kvs,cpClient,clientLockTTL);
  Assert.assertEquals(1,locks.size());
  Assert.assertTrue(expectLock.equals(locks.get(0)));
  Assert.assertTrue(COLUMN.equals(locks.get(0).getColumn()));
  Assert.assertTrue(locks.get(0).isLockExpired());
  conf.set(TransactionConstant.CLIENT_LOCK_TTL_KEY,rawClientLockTTL != null ? rawClientLockTTL : "String_Node_Str");
  kvs.add(KEYVALUE);
  try {
    LockCleaner.constructLocks(TABLENAME,kvs,cpClient,0);
    Assert.fail();
  }
 catch (  ThemisFatalException e) {
  }
}
Program: 29934
Project: 29934
Buggy source:
public void processConcreteFilter(Filter filter) throws IOException {
  Class<? extends Filter> filterCls=filter.getClass();
  if (ThemisCpUtil.DISALLOWD_FILTERS.contains(filterCls)) {
    throw new IOException("String_Node_Str" + filter + "String_Node_Str"+ ThemisCpUtil.getDisallowedFilterClassNameString());
  }
}

Fixed version (ground truth):
public void processConcreteFilter(Filter filter) throws IOException {
  Class<? extends Filter> filterCls=filter.getClass();
  if (ThemisCpUtil.DISALLOWD_FILTERS.contains(filterCls)) {
    throw new IOException("String_Node_Str" + filter.getClass().getName() + "String_Node_Str"+ ThemisCpUtil.getDisallowedFilterClassNameString());
  }
}
Program: 29935
Project: 29935
Buggy source:
public ThemisRead setFilter(Filter filter) throws IOException {
  ThemisCpUtil.processFilters(filter,new FilterCallable(){
    public void processConcreteFilter(    Filter filter) throws IOException {
      Class<? extends Filter> filterCls=filter.getClass();
      if (ThemisCpUtil.DISALLOWD_FILTERS.contains(filterCls)) {
        throw new IOException("String_Node_Str" + filter + "String_Node_Str"+ ThemisCpUtil.getDisallowedFilterClassNameString());
      }
    }
  }
);
  return setFilterWithoutCheck(filter);
}

Fixed version (ground truth):
public ThemisRead setFilter(Filter filter) throws IOException {
  ThemisCpUtil.processFilters(filter,new FilterCallable(){
    public void processConcreteFilter(    Filter filter) throws IOException {
      Class<? extends Filter> filterCls=filter.getClass();
      if (ThemisCpUtil.DISALLOWD_FILTERS.contains(filterCls)) {
        throw new IOException("String_Node_Str" + filter.getClass().getName() + "String_Node_Str"+ ThemisCpUtil.getDisallowedFilterClassNameString());
      }
    }
  }
);
  return setFilterWithoutCheck(filter);
}
Program: 29937
Project: 29937
Buggy source:
public static void addLockAndWriteColumnToScan(Column column,Scan scan){
  Column lockColumn=ColumnUtil.getLockColumn(column);
  scan.addColumn(lockColumn.getFamily(),lockColumn.getQualifier());
  Column writeColumn=ColumnUtil.getPutColumn(column);
  scan.addColumn(writeColumn.getFamily(),writeColumn.getQualifier());
  Column deleteColumn=ColumnUtil.getDeleteColumn(column);
  scan.addColumn(deleteColumn.getFamily(),deleteColumn.getQualifier());
}

Fixed version (ground truth):
public static void addLockAndWriteColumnToScan(Column column,Scan scan){
  if (!(scan.getFamilyMap().containsKey(ColumnUtil.LOCK_FAMILY_NAME) && scan.getFamilyMap().get(ColumnUtil.LOCK_FAMILY_NAME) == null)) {
    Column lockColumn=ColumnUtil.getLockColumn(column);
    scan.addColumn(lockColumn.getFamily(),lockColumn.getQualifier());
  }
  Column writeColumn=ColumnUtil.getPutColumn(column);
  scan.addColumn(writeColumn.getFamily(),writeColumn.getQualifier());
  Column deleteColumn=ColumnUtil.getDeleteColumn(column);
  scan.addColumn(deleteColumn.getFamily(),deleteColumn.getQualifier());
}
Program: 29938
Project: 29938
Buggy source:
public static Result removeNotRequiredLockColumns(Map<byte[],NavigableSet<byte[]>> familyMap,Result result){
  if (!result.isEmpty()) {
    List<KeyValue> kvs=new ArrayList<KeyValue>();
    for (    KeyValue kv : result.list()) {
      if (Bytes.equals(ColumnUtil.LOCK_FAMILY_NAME,kv.getFamily())) {
        Column dataColumn=ColumnUtil.getDataColumnFromLockColumn(new Column(kv.getFamily(),kv.getQualifier()));
        if (familyMap.containsKey(dataColumn.getFamily())) {
          kvs.add(kv);
        }
      }
 else {
        kvs.add(kv);
      }
    }
    if (kvs.size() != result.size()) {
      return new Result(kvs);
    }
  }
  return result;
}

Fixed version (ground truth):
public static Result removeNotRequiredLockColumns(Map<byte[],NavigableSet<byte[]>> familyMap,Result result){
  if (!result.isEmpty()) {
    List<KeyValue> kvs=new ArrayList<KeyValue>();
    for (    KeyValue kv : result.list()) {
      if (Bytes.equals(ColumnUtil.LOCK_FAMILY_NAME,kv.getFamily())) {
        Column dataColumn=ColumnUtil.getDataColumnFromLockColumn(new Column(kv.getFamily(),kv.getQualifier()));
        if (familyMap.containsKey(dataColumn.getFamily())) {
          Set<byte[]> qualifiers=familyMap.get(dataColumn.getFamily());
          if (qualifiers == null || qualifiers.size() == 0 || qualifiers.contains(dataColumn.getQualifier())) {
            kvs.add(kv);
          }
        }
      }
 else {
        kvs.add(kv);
      }
    }
    if (kvs.size() != result.size()) {
      return new Result(kvs);
    }
  }
  return result;
}
Program: 29939
Project: 29939
Buggy source:
protected static boolean next(HRegion region,final ThemisServerScanner s,List<Result> results,int limit) throws IOException {
  List<KeyValue> values=new ArrayList<KeyValue>();
  for (int i=0; i < limit; ) {
    try {
      boolean moreRows=s.next(values,SchemaMetrics.METRIC_NEXTSIZE);
      ThemisProtocolImpl.checkReadTTL(System.currentTimeMillis(),s.getStartTs(),currentRow(values));
      if (!values.isEmpty()) {
        Result result=ThemisCpUtil.removeNotRequiredLockColumns(s.getScan().getFamilyMap(),new Result(values));
        Pair<List<KeyValue>,List<KeyValue>> pResult=ThemisCpUtil.seperateLockAndWriteKvs(result.list());
        List<KeyValue> lockKvs=pResult.getFirst();
        if (lockKvs.size() == 0) {
          List<KeyValue> putKvs=ThemisCpUtil.getPutKvs(pResult.getSecond());
          if (putKvs.size() > 0) {
            Get dataGet=ThemisCpUtil.constructDataGetByPutKvs(putKvs,s.getDataColumnFilter());
            Result dataResult=region.get(dataGet,null);
            if (!dataResult.isEmpty()) {
              results.add(dataResult);
              ++i;
            }
          }
        }
 else {
          LOG.warn("String_Node_Str" + result.getRow());
          results.add(new Result(lockKvs));
          ++i;
        }
      }
      if (!moreRows) {
        return false;
      }
      values.clear();
    }
 catch (    Throwable e) {
      LOG.error("String_Node_Str" + values);
      throw new IOException(e);
    }
  }
  return true;
}

Fixed version (ground truth):
protected static boolean next(HRegion region,final ThemisServerScanner s,List<Result> results,int limit) throws IOException {
  List<KeyValue> values=new ArrayList<KeyValue>();
  for (int i=0; i < limit; ) {
    try {
      boolean moreRows=s.next(values,SchemaMetrics.METRIC_NEXTSIZE);
      ThemisProtocolImpl.checkReadTTL(System.currentTimeMillis(),s.getStartTs(),currentRow(values));
      if (!values.isEmpty()) {
        Result result=ThemisCpUtil.removeNotRequiredLockColumns(s.getDataScan().getFamilyMap(),new Result(values));
        Pair<List<KeyValue>,List<KeyValue>> pResult=ThemisCpUtil.seperateLockAndWriteKvs(result.list());
        List<KeyValue> lockKvs=pResult.getFirst();
        if (lockKvs.size() == 0) {
          List<KeyValue> putKvs=ThemisCpUtil.getPutKvs(pResult.getSecond());
          if (putKvs.size() > 0) {
            Get dataGet=ThemisCpUtil.constructDataGetByPutKvs(putKvs,s.getDataColumnFilter());
            Result dataResult=region.get(dataGet,null);
            if (!dataResult.isEmpty()) {
              results.add(dataResult);
              ++i;
            }
          }
        }
 else {
          LOG.warn("String_Node_Str" + result.getRow());
          results.add(new Result(lockKvs));
          ++i;
        }
      }
      if (!moreRows) {
        return false;
      }
      values.clear();
    }
 catch (    Throwable e) {
      LOG.error("String_Node_Str" + values);
      throw new IOException(e);
    }
  }
  return true;
}
Program: 29940
Project: 29940
Buggy source:
@Override public RegionScanner preScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> e,final Scan scan,final RegionScanner s) throws IOException {
  try {
    Long themisStartTs=getStartTsFromAttribute(scan);
    if (themisStartTs != null) {
      ThemisCpUtil.prepareScan(scan,e.getEnvironment().getRegion().getTableDesc().getFamilies());
      checkFamily(e.getEnvironment().getRegion(),scan);
      ThemisProtocolImpl.checkReadTTL(System.currentTimeMillis(),themisStartTs,PRE_SCANNER_OPEN_FEEK_ROW);
      Scan internalScan=ThemisCpUtil.constructLockAndWriteScan(scan,themisStartTs);
      ThemisServerScanner pScanner=new ThemisServerScanner(e.getEnvironment().getRegion().getScanner(internalScan),internalScan,themisStartTs,scan.getFilter());
      e.bypass();
      return pScanner;
    }
    return s;
  }
 catch (  Throwable ex) {
    throw new DoNotRetryIOException("String_Node_Str",ex);
  }
}

Fixed version (ground truth):
@Override public RegionScanner preScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> e,final Scan scan,final RegionScanner s) throws IOException {
  try {
    Long themisStartTs=getStartTsFromAttribute(scan);
    if (themisStartTs != null) {
      ThemisCpUtil.prepareScan(scan,e.getEnvironment().getRegion().getTableDesc().getFamilies());
      checkFamily(e.getEnvironment().getRegion(),scan);
      ThemisProtocolImpl.checkReadTTL(System.currentTimeMillis(),themisStartTs,PRE_SCANNER_OPEN_FEEK_ROW);
      Scan internalScan=ThemisCpUtil.constructLockAndWriteScan(scan,themisStartTs);
      ThemisServerScanner pScanner=new ThemisServerScanner(e.getEnvironment().getRegion().getScanner(internalScan),internalScan,themisStartTs,scan);
      e.bypass();
      return pScanner;
    }
    return s;
  }
 catch (  Throwable ex) {
    throw new DoNotRetryIOException("String_Node_Str",ex);
  }
}
Program: 29941
Project: 29941
Buggy source:
public ThemisServerScanner(RegionScanner scanner,Scan scan,long startTs,Filter dataColumnFilter){
  this.scan=scan;
  this.scanner=scanner;
  this.startTs=startTs;
  this.dataColumnFilter=dataColumnFilter;
}

Fixed version (ground truth):
public ThemisServerScanner(RegionScanner scanner,Scan scan,long startTs,Scan dataScan){
  this.scan=scan;
  this.scanner=scanner;
  this.startTs=startTs;
  this.dataScan=dataScan;
}
Program: 29942
Project: 29942
Buggy source:
public Filter getDataColumnFilter(){
  return dataColumnFilter;
}

Fixed version (ground truth):
public Filter getDataColumnFilter(){
  return dataScan.getFilter();
}
Program: 29944
Project: 29944
Buggy source:
@Test public void testRemoveNotRequiredLockColumns(){
  Get get=new Get(ROW);
  get.addFamily(FAMILY);
  List<KeyValue> sourceKvs=new ArrayList<KeyValue>();
  sourceKvs.add(KEYVALUE);
  Column lockColumn=ColumnUtil.getLockColumn(FAMILY,QUALIFIER);
  KeyValue lockKv=new KeyValue(ROW,lockColumn.getFamily(),lockColumn.getQualifier(),PREWRITE_TS,Type.Put,VALUE);
  sourceKvs.add(lockKv);
  lockColumn=ColumnUtil.getLockColumn(ANOTHER_FAMILY,QUALIFIER);
  sourceKvs.add(new KeyValue(ROW,lockColumn.getFamily(),lockColumn.getQualifier(),PREWRITE_TS,Type.Put,VALUE));
  Result result=ThemisCpUtil.removeNotRequiredLockColumns(get.getFamilyMap(),new Result(sourceKvs));
  Assert.assertEquals(2,result.size());
  Assert.assertTrue(KEYVALUE.equals(result.list().get(0)));
  Assert.assertTrue(lockKv.equals(result.list().get(1)));
}

Fixed version (ground truth):
@Test public void testRemoveNotRequiredLockColumns(){
  Get get=new Get(ROW);
  get.addFamily(FAMILY);
  get.addColumn(ANOTHER_FAMILY,ANOTHER_QUALIFIER);
  List<KeyValue> sourceKvs=new ArrayList<KeyValue>();
  sourceKvs.add(KEYVALUE);
  Column lockColumn=ColumnUtil.getLockColumn(FAMILY,QUALIFIER);
  KeyValue lockKv=new KeyValue(ROW,lockColumn.getFamily(),lockColumn.getQualifier(),PREWRITE_TS,Type.Put,VALUE);
  sourceKvs.add(lockKv);
  lockColumn=ColumnUtil.getLockColumn(ANOTHER_FAMILY,QUALIFIER);
  sourceKvs.add(new KeyValue(ROW,lockColumn.getFamily(),lockColumn.getQualifier(),PREWRITE_TS,Type.Put,VALUE));
  Result result=ThemisCpUtil.removeNotRequiredLockColumns(get.getFamilyMap(),new Result(sourceKvs));
  Assert.assertEquals(2,result.size());
  Assert.assertTrue(KEYVALUE.equals(result.list().get(0)));
  Assert.assertTrue(lockKv.equals(result.list().get(1)));
}
Program: 29945
Project: 29945
Buggy source:
@Test public void testAddLockAndWriteColumnToScan(){
  Scan scan=new Scan();
  ThemisCpUtil.addLockAndWriteColumnToScan(COLUMN,scan);
  checkReadWithLockAndWriteColumns(scan.getFamilyMap(),COLUMN);
}

Fixed version (ground truth):
@Test public void testAddLockAndWriteColumnToScan(){
  Scan scan=new Scan();
  ThemisCpUtil.addLockAndWriteColumnToScan(COLUMN,scan);
  checkReadWithLockAndWriteColumns(scan.getFamilyMap(),COLUMN);
  scan=new Scan();
  scan.addFamily(ColumnUtil.LOCK_FAMILY_NAME);
  ThemisCpUtil.addLockAndWriteColumnToScan(COLUMN,scan);
  Assert.assertTrue(scan.getFamilyMap().containsKey(ColumnUtil.LOCK_FAMILY_NAME) && scan.getFamilyMap().get(ColumnUtil.LOCK_FAMILY_NAME) == null);
  checkReadWithWriteColumns(scan.getFamilyMap(),COLUMN);
}
Program: 29948
Project: 29948
Buggy source:
@Test public void testScanWithDeletedRow() throws Exception {
  nextTransactionTs();
  writePutAndData(COLUMN,prewriteTs - 6,commitTs - 6);
  createTransactionWithMock();
  ThemisScanner scanner=prepareScanner(new ColumnCoordinate[]{COLUMN});
  checkReadColumnResultWithTs(scanner.next(),COLUMN,prewriteTs - 6);
  checkAndCloseScanner(scanner);
  writeDeleteColumn(COLUMN,prewriteTs - 3,commitTs - 3);
  scanner=prepareScanner(new ColumnCoordinate[]{COLUMN});
  checkAndCloseScanner(scanner);
  writeDeleteColumn(COLUMN_WITH_ANOTHER_ROW,prewriteTs - 2,commitTs - 2);
  writePutAndData(COLUMN,prewriteTs - 2,commitTs - 2);
  writePutAndData(COLUMN_WITH_ZZ_ROW,prewriteTs - 2,commitTs - 2);
  scanner=prepareScanner(new ColumnCoordinate[]{COLUMN_WITH_ANOTHER_ROW,COLUMN,COLUMN_WITH_ZZ_ROW});
  checkReadColumnResultWithTs(scanner.next(),COLUMN,prewriteTs - 2);
  checkReadColumnResultWithTs(scanner.next(),COLUMN_WITH_ZZ_ROW,prewriteTs - 2);
  checkAndCloseScanner(scanner);
  scanner.close();
}

Fixed version (ground truth):
@Test public void testScanWithDeletedRow() throws Exception {
  nextTransactionTs();
  writePutAndData(COLUMN,prewriteTs - 6,commitTs - 6);
  createTransactionWithMock();
  ThemisScanner scanner=prepareScanner(new ColumnCoordinate[]{COLUMN});
  checkReadColumnResultWithTs(scanner.next(),COLUMN,prewriteTs - 6);
  checkAndCloseScanner(scanner);
  writeDeleteColumn(COLUMN,prewriteTs - 3,commitTs - 3);
  scanner=prepareScanner(new ColumnCoordinate[]{COLUMN});
  checkAndCloseScanner(scanner);
  writeDeleteColumn(COLUMN_WITH_ANOTHER_ROW,prewriteTs - 2,commitTs - 2);
  writePutAndData(COLUMN,prewriteTs - 2,commitTs - 2);
  writePutAndData(COLUMN_WITH_ZZ_ROW,prewriteTs - 2,commitTs - 2);
  scanner=prepareScanner(new ColumnCoordinate[]{COLUMN_WITH_ANOTHER_ROW,COLUMN,COLUMN_WITH_ZZ_ROW});
  checkReadColumnResultWithTs(scanner.next(),COLUMN,prewriteTs - 2);
  checkReadColumnResultWithTs(scanner.next(),COLUMN_WITH_ZZ_ROW,prewriteTs - 2);
  checkAndCloseScanner(scanner);
}
Program: 29949
Project: 29949
Buggy source:
protected void writeDeleteColumn(ColumnCoordinate c,long prewriteTs,long commitTs) throws IOException {
  ColumnCoordinate deleteColumn=new ColumnCoordinate(c.getTableName(),c.getRow(),ColumnUtil.getPutColumn(c));
  writeWriteColumnInternal(deleteColumn,prewriteTs,commitTs);
}

Fixed version (ground truth):
protected void writeDeleteColumn(ColumnCoordinate c,long prewriteTs,long commitTs) throws IOException {
  ColumnCoordinate deleteColumn=new ColumnCoordinate(c.getTableName(),c.getRow(),ColumnUtil.getDeleteColumn(c));
  writeWriteColumnInternal(deleteColumn,prewriteTs,commitTs);
}
Program: 29950
Project: 29950
Buggy source:
@Test public void testScanWithNoRowkeyFilter() throws Exception {
  prepareScanData(TRANSACTION_COLUMNS);
  ValueFilter valueFilter=new ValueFilter(CompareOp.EQUAL,new BinaryComparator(ANOTHER_VALUE));
  ThemisScanner scanner=prepareScanner(TRANSACTION_COLUMNS,valueFilter);
  checkAndCloseScanner(scanner);
  SingleColumnValueFilter singleColumnFilter=new SingleColumnValueFilter(ANOTHER_FAMILY,QUALIFIER,CompareOp.EQUAL,VALUE);
  singleColumnFilter.setFilterIfMissing(true);
  scanner=prepareScanner(TRANSACTION_COLUMNS,singleColumnFilter);
  checkResultForROW(scanner.next());
  checkAndCloseScanner(scanner);
  valueFilter=new ValueFilter(CompareOp.EQUAL,new BinaryComparator(VALUE));
  singleColumnFilter=new SingleColumnValueFilter(QUALIFIER,QUALIFIER,CompareOp.EQUAL,ANOTHER_VALUE);
  FilterList filterList=new FilterList();
  filterList.addFilter(valueFilter);
  filterList.addFilter(singleColumnFilter);
  scanner=prepareScanner(TRANSACTION_COLUMNS,filterList);
  checkAndCloseScanner(scanner);
  filterList=new FilterList(Operator.MUST_PASS_ONE);
  filterList.addFilter(valueFilter);
  filterList.addFilter(singleColumnFilter);
  scanner=prepareScanner(TRANSACTION_COLUMNS,filterList);
  checkScanRow(new ColumnCoordinate[]{COLUMN_WITH_ANOTHER_ROW},scanner.next());
  checkResultForROW(scanner.next());
  checkAndCloseScanner(scanner);
}

Fixed version (ground truth):
@Test public void testScanWithNoRowkeyFilter() throws Exception {
  prepareScanData(TRANSACTION_COLUMNS);
  ValueFilter valueFilter=new ValueFilter(CompareOp.EQUAL,new BinaryComparator(ANOTHER_VALUE));
  ThemisScanner scanner=prepareScanner(TRANSACTION_COLUMNS,valueFilter);
  checkAndCloseScanner(scanner);
  SingleColumnValueFilter singleColumnFilter=new SingleColumnValueFilter(ANOTHER_FAMILY,QUALIFIER,CompareOp.EQUAL,VALUE);
  singleColumnFilter.setFilterIfMissing(true);
  scanner=prepareScanner(TRANSACTION_COLUMNS,singleColumnFilter);
  checkResultForROW(scanner.next());
  checkAndCloseScanner(scanner);
  valueFilter=new ValueFilter(CompareOp.EQUAL,new BinaryComparator(VALUE));
  singleColumnFilter=new SingleColumnValueFilter(QUALIFIER,QUALIFIER,CompareOp.EQUAL,ANOTHER_VALUE);
  singleColumnFilter.setFilterIfMissing(true);
  FilterList filterList=new FilterList();
  filterList.addFilter(valueFilter);
  filterList.addFilter(singleColumnFilter);
  scanner=prepareScanner(TRANSACTION_COLUMNS,filterList);
  checkAndCloseScanner(scanner);
  filterList=new FilterList(Operator.MUST_PASS_ONE);
  filterList.addFilter(valueFilter);
  filterList.addFilter(singleColumnFilter);
  scanner=prepareScanner(TRANSACTION_COLUMNS,filterList);
  checkScanRow(new ColumnCoordinate[]{COLUMN_WITH_ANOTHER_ROW},scanner.next());
  checkResultForROW(scanner.next());
  checkAndCloseScanner(scanner);
}
Program: 29951
Project: 29951
Buggy source:
@Test public void testScanWithFilter() throws IOException {
  prepareScanData(TRANSACTION_COLUMNS);
  writeData(COLUMN,lastTs(prewriteTs),ANOTHER_VALUE);
  ValueFilter valueFilter=new ValueFilter(CompareOp.EQUAL,new BinaryComparator(ANOTHER_VALUE));
  PrefixFilter prefixFilter=new PrefixFilter(ANOTHER_ROW);
  FilterList filterList=new FilterList();
  filterList.addFilter(valueFilter);
  filterList.addFilter(prefixFilter);
  ThemisScanner scanner=prepareScanner(TRANSACTION_COLUMNS,filterList);
  checkAndCloseScanner(scanner);
  filterList=new FilterList(Operator.MUST_PASS_ONE);
  filterList.addFilter(valueFilter);
  filterList.addFilter(prefixFilter);
  scanner=prepareScanner(TRANSACTION_COLUMNS,filterList);
  checkScanRow(new ColumnCoordinate[]{COLUMN_WITH_ANOTHER_ROW},scanner.next());
  Assert.assertEquals(3,scanner.next().size());
  checkAndCloseScanner(scanner);
}

Fixed version (ground truth):
@Test public void testScanWithFilter() throws IOException {
  prepareScanData(TRANSACTION_COLUMNS);
  writeData(COLUMN,lastTs(prewriteTs),ANOTHER_VALUE);
  ValueFilter valueFilter=new ValueFilter(CompareOp.EQUAL,new BinaryComparator(ANOTHER_VALUE));
  PrefixFilter prefixFilter=new PrefixFilter(ANOTHER_ROW);
  FilterList filterList=new FilterList();
  filterList.addFilter(valueFilter);
  filterList.addFilter(prefixFilter);
  ThemisScanner scanner=prepareScanner(TRANSACTION_COLUMNS,filterList);
  checkAndCloseScanner(scanner);
  filterList=new FilterList(Operator.MUST_PASS_ONE);
  filterList.addFilter(valueFilter);
  filterList.addFilter(prefixFilter);
  scanner=prepareScanner(TRANSACTION_COLUMNS,filterList);
  checkScanRow(new ColumnCoordinate[]{COLUMN_WITH_ANOTHER_ROW},scanner.next());
  Assert.assertEquals(1,scanner.next().size());
  checkAndCloseScanner(scanner);
}
Program: 29952
Project: 29952
Buggy source:
public static Scan constructLockAndWriteScan(Scan userScan,long startTs) throws IOException {
  Scan internalScan=new Scan(userScan);
  internalScan.setFamilyMap(new TreeMap<byte[],NavigableSet<byte[]>>(Bytes.BYTES_COMPARATOR));
  for (  Entry<byte[],NavigableSet<byte[]>> entry : userScan.getFamilyMap().entrySet()) {
    for (    byte[] qualifier : entry.getValue()) {
      Column dataColumn=new Column(entry.getKey(),qualifier);
      addLockAndWriteColumnToScan(dataColumn,internalScan);
    }
  }
  internalScan.setTimeRange(0,startTs);
  moveRowkeyFiltersForWriteScan(userScan,internalScan);
  return internalScan;
}

Fixed version (ground truth):
public static Scan constructLockAndWriteScan(Scan userScan,long startTs) throws IOException {
  Scan internalScan=new Scan(userScan);
  internalScan.setFilter(null);
  internalScan.setFamilyMap(new TreeMap<byte[],NavigableSet<byte[]>>(Bytes.BYTES_COMPARATOR));
  for (  Entry<byte[],NavigableSet<byte[]>> entry : userScan.getFamilyMap().entrySet()) {
    for (    byte[] qualifier : entry.getValue()) {
      Column dataColumn=new Column(entry.getKey(),qualifier);
      addLockAndWriteColumnToScan(dataColumn,internalScan);
    }
  }
  internalScan.setTimeRange(0,startTs);
  moveRowkeyFiltersForWriteScan(userScan,internalScan);
  return internalScan;
}
Program: 29955
Project: 29955
Buggy source:
public static void main(final String[] args){
  WB_Point[] basepoints=new WB_Point[24];
  for (int i=0; i < 24; i++) {
    basepoints[i]=new WB_Point(0,50 + (250 * (i % 2)),0);
    if (i > 0) {
      basepoints[i].rotateAbout2PointAxisSelf((Math.PI / 12.0) * i,0,0,0,0,0,1);
    }
  }
  WB_Polygon polygon=WB_GeometryFactory.instance().createSimplePolygon(basepoints);
  HEC_Polygon creator=new HEC_Polygon();
  creator.setPolygon(polygon);
  creator.setThickness(50);
  HE_Mesh mesh=new HE_Mesh(creator);
  mesh.modify(new HEM_SliceSurface().setPlane(0,50.0,0,0,-1,0));
}

Fixed version (ground truth):
public static void main(final String[] args){
  HEC_Cylinder creator=new HEC_Cylinder();
  creator.setFacets(32).setSteps(16).setRadius(50).setHeight(400).setCenter(0,0,0);
  HE_Mesh mesh=new HE_Mesh(creator);
  HEM_Slice modifier=new HEM_Slice();
  modifier.setPlane(new WB_Plane(0,0,0,1,1,1));
  mesh.modify(modifier);
}
Program: 29957
Project: 29957
Buggy source:
/** 
 * @param mesh 
 */
public static void stats(final HE_Mesh mesh){
  System.out.println("String_Node_Str" + mesh.getNumberOfFaces());
  System.out.println("String_Node_Str" + mesh.getNumberOfVertices());
  System.out.println("String_Node_Str" + mesh.getNumberOfEdges());
  System.out.println("String_Node_Str" + mesh.getNumberOfHalfedges());
}

Fixed version (ground truth):
/** 
 * @param mesh
 */
public static void stats(final HE_Mesh mesh){
  System.out.println("String_Node_Str" + mesh.getNumberOfFaces());
  System.out.println("String_Node_Str" + mesh.getNumberOfVertices());
  System.out.println("String_Node_Str" + mesh.getNumberOfEdges());
  System.out.println("String_Node_Str" + mesh.getNumberOfHalfedges());
}
Program: 29958
Project: 29958
Buggy source:
/** 
 * @param he1
 * @param he2
 */
public void setPair(final HE_Halfedge he1,final HE_Halfedge he2){
  if (he1.getPair() == null) {
    unpairedHalfedges.remove(he1);
  }
 else {
    if (he1.isEdge()) {
      edges.remove(he1);
    }
 else {
      halfedges.remove(he1);
    }
  }
  if (he2.getPair() == null) {
    unpairedHalfedges.remove(he2);
  }
 else {
    if (he2.isEdge()) {
      edges.remove(he2);
    }
 else {
      halfedges.remove(he2);
    }
  }
  he1._setPair(he2);
  he2._setPair(he1);
  if (he1.isEdge()) {
    edges.add(he1);
    halfedges.add(he2);
  }
 else   if (he2.isEdge()) {
    edges.add(he2);
    halfedges.add(he1);
  }
}

Fixed version (ground truth):
/** 
 * @param he1
 * @param he2
 */
public void setPair(final HE_Halfedge he1,final HE_Halfedge he2){
  remove(he1);
  remove(he2);
  he1._setPair(he2);
  he2._setPair(he1);
  add(he1);
  add(he2);
}
Program: 29959
Project: 29959
Buggy source:
/** 
 * @param label
 * @return
 */
public static HE_Selection selectFacesWithInternalLabel(final HE_Mesh mesh,final int label){
  final HE_Selection _selection=new HE_Selection(mesh);
  HE_Face f;
  final Iterator<HE_Face> fItr=mesh.fItr();
  while (fItr.hasNext()) {
    f=fItr.next();
    if (f.getTemporaryLabel() == label) {
      _selection.add(f);
    }
  }
  return _selection;
}

Fixed version (ground truth):
/** 
 * @param label
 * @return
 * @deprecated Use {@link #selectFacesWithTemporaryLabel(HE_Mesh,int)} instead
 */
public static HE_Selection selectFacesWithInternalLabel(final HE_Mesh mesh,final int label){
  return selectFacesWithTemporaryLabel(mesh,label);
}
Program: 29960
Project: 29960
Buggy source:
/** 
 * @param label
 * @return
 */
public static HE_Selection selectFacesWithOtherInternalLabel(final HE_Mesh mesh,final int label){
  final HE_Selection _selection=new HE_Selection(mesh);
  HE_Face f;
  final Iterator<HE_Face> fItr=mesh.fItr();
  while (fItr.hasNext()) {
    f=fItr.next();
    if (f.getTemporaryLabel() != label) {
      _selection.add(f);
    }
  }
  return _selection;
}

Fixed version (ground truth):
/** 
 * @param label
 * @return
 * @deprecated Use {@link #selectFacesWithOtherTemporaryLabel(HE_Mesh,int)} instead
 */
public static HE_Selection selectFacesWithOtherInternalLabel(final HE_Mesh mesh,final int label){
  return selectFacesWithOtherTemporaryLabel(mesh,label);
}
Program: 29961
Project: 29961
Buggy source:
/** 
 * Collect vertices belonging to selection elements.
 */
public void collectVertices(){
  List<HE_Vertex> tmpVertices=new FastTable<HE_Vertex>();
  HE_FaceIterator fItr=fItr();
  HE_Face f;
  while (fItr.hasNext()) {
    f=fItr.next();
    tmpVertices=f.getFaceVertices();
    addVertices(tmpVertices);
  }
  HE_HalfedgeIterator heItr=heItr();
  while (heItr.hasNext()) {
    add(heItr.next().getVertex());
  }
}

Fixed version (ground truth):
/** 
 * Collect vertices belonging to selection elements.
 */
public void collectVertices(){
  List<HE_Vertex> tmpVertices=new FastTable<HE_Vertex>();
  HE_FaceIterator fItr=fItr();
  HE_Face f;
  while (fItr.hasNext()) {
    f=fItr.next();
    tmpVertices=f.getUniqueFaceVertices();
    addVertices(tmpVertices);
  }
  HE_HalfedgeIterator heItr=heItr();
  while (heItr.hasNext()) {
    add(heItr.next().getVertex());
  }
}