nus-yam/ex-repair huggingface dataset:
Program: 82109
Project: 82109
Buggy source:
public static List<String> terms(IndexReader reader,FieldTypeDefinition typeDef,String columnFamily,String columnName,String startWith,short size) throws IOException {
  if (startWith == null) {
    startWith="String_Node_Str";
  }
  Term term=getTerm(columnFamily,columnName,startWith);
  List<String> terms=new ArrayList<String>(size);
  AtomicReader areader=BlurUtil.getAtomicReader(reader);
  Terms termsAll=areader.terms(term.field());
  if (termsAll == null) {
    return terms;
  }
  TermsEnum termEnum=termsAll.iterator(null);
  SeekStatus status=termEnum.seekCeil(term.bytes());
  if (status == SeekStatus.END) {
    return terms;
  }
  BytesRef currentTermText=termEnum.term();
  do {
    terms.add(currentTermText.utf8ToString());
    String readTerm=typeDef.readTerm(currentTermText);
    if (readTerm != null)     terms.add(readTerm);
    if (terms.size() >= size) {
      return terms;
    }
  }
 while ((currentTermText=termEnum.next()) != null);
  return terms;
}

Fixed version (ground truth):
public static List<String> terms(IndexReader reader,FieldTypeDefinition typeDef,String columnFamily,String columnName,String startWith,short size) throws IOException {
  if (startWith == null) {
    startWith="String_Node_Str";
  }
  Term term=getTerm(columnFamily,columnName,startWith);
  List<String> terms=new ArrayList<String>(size);
  AtomicReader areader=BlurUtil.getAtomicReader(reader);
  Terms termsAll=areader.terms(term.field());
  if (termsAll == null) {
    return terms;
  }
  TermsEnum termEnum=termsAll.iterator(null);
  SeekStatus status=termEnum.seekCeil(term.bytes());
  if (status == SeekStatus.END) {
    return terms;
  }
  BytesRef currentTermText=termEnum.term();
  do {
    terms.add(convert(typeDef,currentTermText));
    if (terms.size() >= size) {
      return terms;
    }
  }
 while ((currentTermText=termEnum.next()) != null);
  return terms;
}
Program: 82110
Project: 82110
Buggy source:
public static BlurObject toBlurObject(Arguments arguments){
  if (arguments == null) {
    return null;
  }
  BlurObject blurObject=new BlurObject();
  Map<String,ValueObject> values=arguments.getValues();
  Set<Entry<String,ValueObject>> entrySet=values.entrySet();
  for (  Entry<String,ValueObject> e : entrySet) {
    blurObject.put(e.getKey(),toObject(e.getValue()));
  }
  return blurObject;
}

Fixed version (ground truth):
public static BlurObject toBlurObject(Arguments arguments){
  if (arguments == null) {
    return null;
  }
  BlurObject blurObject=new BlurObject();
  Map<String,ValueObject> values=arguments.getValues();
  Set<Entry<String,ValueObject>> entrySet=values.entrySet();
  for (  Entry<String,ValueObject> e : entrySet) {
    Object o=toObject(e.getValue());
    blurObject.put(e.getKey(),(Object)o);
  }
  return blurObject;
}
Program: 82111
Project: 82111
Buggy source:
public void initialize(BlurInputSplit blurInputSplit,Configuration configuration) throws IOException {
  if (_setup) {
    return;
  }
  _setup=true;
  _table=blurInputSplit.getTable();
  Path localCachePath=BlurInputFormat.getLocalCachePath(configuration);
  List<String> files=blurInputSplit.getDirectoryFiles();
  LOG.info("String_Node_Str",localCachePath);
  _directory=BlurInputFormat.getDirectory(configuration,_table.toString(),blurInputSplit.getDir(),files);
  SegmentInfos segmentInfos=new SegmentInfos();
  segmentInfos.read(_directory,blurInputSplit.getSegmentsName());
  SegmentInfoPerCommit commit=findSegmentInfoPerCommit(segmentInfos,blurInputSplit);
  SegmentInfo segmentInfo=commit.info;
  if (localCachePath != null) {
    _readingDirectory=copyFilesLocally(configuration,_directory,_table.toString(),blurInputSplit.getDir(),localCachePath,commit.files());
  }
 else {
    _readingDirectory=_directory;
  }
  Blur024Codec blur024Codec=new Blur024Codec();
  IOContext iocontext=IOContext.READ;
  String segmentName=segmentInfo.name;
  FieldInfos fieldInfos=blur024Codec.fieldInfosFormat().getFieldInfosReader().read(_readingDirectory,segmentName,iocontext);
  if (commit.getDelCount() > 0) {
    _liveDocs=blur024Codec.liveDocsFormat().readLiveDocs(_readingDirectory,commit,iocontext);
  }
  _fieldsReader=blur024Codec.storedFieldsFormat().fieldsReader(_readingDirectory,segmentInfo,fieldInfos,iocontext);
  _maxDoc=commit.info.getDocCount();
}

Fixed version (ground truth):
public void initialize(BlurInputSplit blurInputSplit,Configuration configuration) throws IOException {
  if (_setup) {
    return;
  }
  _setup=true;
  _table=blurInputSplit.getTable();
  Path localCachePath=BlurInputFormat.getLocalCachePath(configuration);
  List<String> files=blurInputSplit.getDirectoryFiles();
  LOG.info("String_Node_Str",localCachePath);
  _directory=BlurInputFormat.getDirectory(configuration,_table.toString(),blurInputSplit.getDir(),files);
  SegmentInfoPerCommit commit=segmentInfosRead(_directory,blurInputSplit.getSegmentsName(),blurInputSplit.getSegmentInfoName());
  SegmentInfo segmentInfo=commit.info;
  if (localCachePath != null) {
    _readingDirectory=copyFilesLocally(configuration,_directory,_table.toString(),blurInputSplit.getDir(),localCachePath,commit.files());
  }
 else {
    _readingDirectory=_directory;
  }
  Blur024Codec blur024Codec=new Blur024Codec();
  IOContext iocontext=IOContext.READ;
  String segmentName=segmentInfo.name;
  FieldInfos fieldInfos=blur024Codec.fieldInfosFormat().getFieldInfosReader().read(_readingDirectory,segmentName,iocontext);
  if (commit.getDelCount() > 0) {
    _liveDocs=blur024Codec.liveDocsFormat().readLiveDocs(_readingDirectory,commit,iocontext);
  }
  _fieldsReader=blur024Codec.storedFieldsFormat().fieldsReader(_readingDirectory,segmentInfo,fieldInfos,iocontext);
  _maxDoc=commit.info.getDocCount();
}
Program: 82112
Project: 82112
Buggy source:
public boolean isRequired(){
  return ((defaultVal != null) && (!defaultVal.isEmpty()));
}

Fixed version (ground truth):
public boolean isRequired(){
  return required;
}
Program: 82113
Project: 82113
Buggy source:
public Map<String,List<BlurProp>> parse() throws IOException {
  InputStream inputStream=BlurPropertyParser.class.getResourceAsStream("String_Node_Str");
  BufferedReader reader=new BufferedReader(new InputStreamReader(inputStream));
  String line;
  String prevLine=null;
  String key="String_Node_Str";
  Map<String,List<BlurProp>> map=new HashMap<String,List<BlurProp>>();
  while ((line=reader.readLine()) != null) {
    line=line.trim();
    if (line.equals("String_Node_Str")) {
      key="String_Node_Str";
    }
 else     if (line.equals("String_Node_Str")) {
      key="String_Node_Str";
    }
    if (!line.startsWith("String_Node_Str") && !line.isEmpty()) {
      String desc=getDesc(prevLine);
      String name=getName(line);
      String value=getValue(line);
      String type=getType(value);
      List<BlurProp> props=map.get(key);
      if (props == null) {
        props=Lists.newArrayList();
        map.put(key,props);
      }
      BlurProp p=new BlurProp();
      p.setName(name);
      p.setDefaultVal(value);
      p.setDescription(desc);
      p.setType(type);
      props.add(p);
    }
    prevLine=line;
  }
  return map;
}

Fixed version (ground truth):
public Map<String,List<BlurProp>> parse() throws IOException {
  InputStream inputStream=BlurPropertyParser.class.getResourceAsStream("String_Node_Str");
  BufferedReader reader=new BufferedReader(new InputStreamReader(inputStream));
  String line;
  String prevLine=null;
  String key="String_Node_Str";
  Set<String> requiredProperties=getRequiredProperties();
  Map<String,List<BlurProp>> map=new HashMap<String,List<BlurProp>>();
  while ((line=reader.readLine()) != null) {
    line=line.trim();
    if (line.equals("String_Node_Str")) {
      key="String_Node_Str";
    }
 else     if (line.equals("String_Node_Str")) {
      key="String_Node_Str";
    }
    if (!line.startsWith("String_Node_Str") && !line.isEmpty()) {
      String desc=getDesc(prevLine);
      String name=getName(line);
      String value=getValue(line);
      String type=getType(value);
      List<BlurProp> props=map.get(key);
      if (props == null) {
        props=Lists.newArrayList();
        map.put(key,props);
      }
      BlurProp p=new BlurProp();
      p.setName(name);
      p.setDefaultVal(value);
      p.setDescription(desc);
      p.setType(type);
      p.setRequired(requiredProperties.contains(name));
      props.add(p);
    }
    prevLine=line;
  }
  return map;
}
Program: 82114
Project: 82114
Buggy source:
@Override protected Query newWildcardQuery(Term t){
  if ("String_Node_Str".equals(t.text())) {
    String fieldName=t.field();
    if (SUPER.equals(fieldName)) {
      return new MatchAllDocsQuery();
    }
 else {
      return new TermQuery(new Term(BlurConstants.FIELDS,fieldName));
    }
  }
  String resolvedField=_fieldManager.resolveField(t.field());
  try {
    Boolean b=_fieldManager.checkSupportForWildcardQuery(resolvedField);
    if (!(b == null || b)) {
      throw new RuntimeException("String_Node_Str" + resolvedField + "String_Node_Str"+ _fieldManager.getFieldTypeDefinition(resolvedField)+ "String_Node_Str");
    }
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  customQueryCheck(resolvedField);
  return addField(super.newWildcardQuery(new Term(resolvedField,t.text())),resolvedField);
}

Fixed version (ground truth):
@Override protected Query newWildcardQuery(Term t){
  if ("String_Node_Str".equals(t.text())) {
    String fieldName=t.field();
    if (SUPER.equals(fieldName)) {
      return addField(new MatchAllDocsQuery(),fieldName);
    }
 else {
      String resolvedField=_fieldManager.resolveField(t.field());
      return addField(new TermQuery(new Term(BlurConstants.FIELDS,fieldName)),resolvedField);
    }
  }
  String resolvedField=_fieldManager.resolveField(t.field());
  try {
    Boolean b=_fieldManager.checkSupportForWildcardQuery(resolvedField);
    if (!(b == null || b)) {
      throw new RuntimeException("String_Node_Str" + resolvedField + "String_Node_Str"+ _fieldManager.getFieldTypeDefinition(resolvedField)+ "String_Node_Str");
    }
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  customQueryCheck(resolvedField);
  return addField(super.newWildcardQuery(new Term(resolvedField,t.text())),resolvedField);
}
Program: 82115
Project: 82115
Buggy source:
private boolean isSameGroupName(Query query,String groupName){
  if (query instanceof BooleanQuery) {
    BooleanQuery booleanQuery=(BooleanQuery)query;
    for (    BooleanClause clause : booleanQuery.clauses()) {
      if (!isSameGroupName(clause.getQuery(),groupName)) {
        return false;
      }
    }
    return true;
  }
 else {
    String fieldName=_fieldNames.get(query);
    String currentGroupName=getGroupName(fieldName);
    if (groupName.equals(currentGroupName)) {
      return true;
    }
    return false;
  }
}

Fixed version (ground truth):
private boolean isSameGroupName(Query query,String groupName){
  if (query instanceof BooleanQuery) {
    BooleanQuery booleanQuery=(BooleanQuery)query;
    for (    BooleanClause clause : booleanQuery.clauses()) {
      if (!isSameGroupName(clause.getQuery(),groupName)) {
        return false;
      }
    }
    return true;
  }
 else {
    String fieldName=_fieldNames.get(query);
    String currentGroupName=getGroupName(fieldName);
    if (groupName.equals(currentGroupName) || isSystemField(fieldName)) {
      return true;
    }
    return false;
  }
}
Program: 82117
Project: 82117
Buggy source:
@Override protected void reduce(IndexKey key,Iterable<IndexValue> values,Context context) throws IOException, InterruptedException {
  if (key.getType() != TYPE.NEW_DATA_MARKER) {
    return;
  }
 else {
    BlurRecord prevBlurRecord=null;
    String prevRecordId=null;
    for (    IndexValue value : values) {
      BlurRecord br=value.getBlurRecord();
      if (br == null) {
        continue;
      }
      BlurRecord blurRecord=new BlurRecord(br);
      String recordId=blurRecord.getRecordId();
      if (prevRecordId == null || prevRecordId.equals(recordId)) {
        prevBlurRecord=blurRecord;
        prevRecordId=recordId;
      }
 else {
        context.write(new Text(blurRecord.getRowId()),toMutate(blurRecord));
      }
    }
    if (prevBlurRecord != null) {
      context.write(new Text(prevBlurRecord.getRowId()),toMutate(prevBlurRecord));
    }
  }
}

Fixed version (ground truth):
@Override protected void reduce(IndexKey key,Iterable<IndexValue> values,Context context) throws IOException, InterruptedException {
  if (key.getType() != TYPE.NEW_DATA_MARKER) {
    handleNoNewData(key,values);
  }
 else {
    handleNewData(key,values,context);
  }
}
Program: 82118
Project: 82118
Buggy source:
@Override protected void setup(final Context context) throws IOException, InterruptedException {
  BlurOutputFormat.setProgressable(context);
  BlurOutputFormat.setGetCounter(new GetCounter(){
    @Override public Counter getCounter(    Enum<?> counterName){
      return context.getCounter(counterName);
    }
  }
);
}

Fixed version (ground truth):
@Override protected void setup(final Context context) throws IOException, InterruptedException {
  BlurOutputFormat.setProgressable(context);
  BlurOutputFormat.setGetCounter(new GetCounter(){
    @Override public Counter getCounter(    Enum<?> counterName){
      return context.getCounter(counterName);
    }
  }
);
  _newRecordsUpdate=context.getCounter(BLUR_UPDATE,NEW_RCORDS + SEP + UPDATE);
  _newRecordsNoUpdate=context.getCounter(BLUR_UPDATE,NEW_RCORDS + SEP + NO_UPDATE);
  _existingRecordsUpdate=context.getCounter(BLUR_UPDATE,EXISTING_RCORDS + SEP + UPDATE);
  _existingRecordsNoUpdate=context.getCounter(BLUR_UPDATE,EXISTING_RCORDS + SEP + NO_UPDATE);
  _ignoredExistingRows=context.getCounter(BLUR_UPDATE,IGNORED_EXISTING_ROWS);
  _debugRecordsWithSameRecordId=context.getCounter(BLUR_UPDATE_DEBUG,MULTIPLE_RECORD_W_SAME_RECORD_ID);
  _debugMarkerRecordsNoUpdate=context.getCounter(BLUR_UPDATE_DEBUG,MARKER_RECORDS + SEP + NO_UPDATE);
  _debugMarkerRecordsUpdate=context.getCounter(BLUR_UPDATE_DEBUG,MARKER_RECORDS + SEP + UPDATE);
  _debugIndexValues=context.getCounter(BLUR_UPDATE_DEBUG,INDEX_VALUES);
  _debugNullBlurRecords=context.getCounter(BLUR_UPDATE_DEBUG,NULL_BLUR_RECORDS);
}
Program: 82120
Project: 82120
Buggy source:
private String buffer(long number){
  String s=Long.toString(number);
  StringBuilder builder=new StringBuilder();
  for (int i=s.length(); i < 12; i++) {
    builder.append('0');
  }
  return builder.append(s).toString();
}

Fixed version (ground truth):
private static String buffer(long number){
  String s=Long.toString(number);
  StringBuilder builder=new StringBuilder();
  for (int i=s.length(); i < 12; i++) {
    builder.append('0');
  }
  return builder.append(s).toString();
}
Program: 82121
Project: 82121
Buggy source:
@Override public void close() throws IOException {
  if (!_isClosed) {
    _isClosed=true;
    if (_idleLogTimerTask != null) {
      _idleLogTimerTask.cancel();
    }
    if (_oldFileCleanerTimerTask != null) {
      _oldFileCleanerTimerTask.cancel();
    }
    if (_hdfsKeyValueTimer != null) {
      _hdfsKeyValueTimer.purge();
    }
    _writeLock.lock();
    try {
      if (isOpenForWriting()) {
        syncInternal();
        _output.close();
        _output=null;
      }
    }
  finally {
      _writeLock.unlock();
    }
  }
}

Fixed version (ground truth):
@Override public void close() throws IOException {
  if (!_isClosed) {
    _isClosed=true;
    if (_idleLogTimerTask != null) {
      _idleLogTimerTask.cancel();
    }
    if (_oldFileCleanerTimerTask != null) {
      _oldFileCleanerTimerTask.cancel();
    }
    if (_hdfsKeyValueTimer != null) {
      _hdfsKeyValueTimer.purge();
    }
    _writeLock.lock();
    try {
      if (isOpenForWriting()) {
        try {
          syncInternal();
        }
  finally {
          IOUtils.closeQuietly(_output);
          _output=null;
        }
      }
    }
  finally {
      _writeLock.unlock();
    }
  }
}
Program: 82122
Project: 82122
Buggy source:
private void openWriter() throws IOException {
  if (_readOnly) {
    throw new IOException("String_Node_Str");
  }
  long nextSegment=_currentFileCounter.incrementAndGet();
  String name=buffer(nextSegment);
  _outputPath=new Path(_path,name);
  LOG.info("String_Node_Str",_outputPath);
  _output=_fileSystem.create(_outputPath,false);
  _output.write(MAGIC);
  _output.writeInt(VERSION);
  syncInternal();
}

Fixed version (ground truth):
private void openWriter() throws IOException {
  if (_readOnly) {
    throw new IOException("String_Node_Str");
  }
  _outputPath=getSegmentPath(_currentFileCounter.incrementAndGet());
  LOG.info("String_Node_Str",_outputPath);
  _output=_fileSystem.create(_outputPath,false);
  _output.write(MAGIC);
  _output.writeInt(VERSION);
  syncInternal();
}
Program: 82123
Project: 82123
Buggy source:
private void syncInternal() throws IOException {
  _output.flush();
  _output.sync();
  _lastWrite.set(System.currentTimeMillis());
}

Fixed version (ground truth):
private void syncInternal() throws IOException {
  validateNextSegmentHasNotStarted();
  _output.flush();
  _output.sync();
  _lastWrite.set(System.currentTimeMillis());
}
Program: 82124
Project: 82124
Buggy source:
public void testTwoKeyStoreInstancesWritingAtTheSameTime() throws IOException {
  HdfsKeyValueStore store1=new HdfsKeyValueStore(false,_timer,_configuration,_path);
  listFiles();
  store1.put(new BytesRef("String_Node_Str"),new BytesRef(new byte[2000]));
  listFiles();
  HdfsKeyValueStore store2=new HdfsKeyValueStore(false,_timer,_configuration,_path);
  listFiles();
  store2.put(new BytesRef("String_Node_Str"),new BytesRef(new byte[1000]));
  listFiles();
  store1.put(new BytesRef("String_Node_Str"),new BytesRef(new byte[2000]));
  listFiles();
  store2.put(new BytesRef("String_Node_Str"),new BytesRef(new byte[1000]));
  listFiles();
  store1.put(new BytesRef("String_Node_Str"),new BytesRef(new byte[2000]));
  listFiles();
  store2.put(new BytesRef("String_Node_Str"),new BytesRef(new byte[1000]));
  listFiles();
  try {
    store1.sync();
    fail();
  }
 catch (  Exception e) {
  }
  store2.sync();
  store1.close();
  store2.close();
  HdfsKeyValueStore store3=new HdfsKeyValueStore(false,_timer,_configuration,_path);
  Iterable<Entry<BytesRef,BytesRef>> scan=store3.scan(null);
  for (  Entry<BytesRef,BytesRef> e : scan) {
    System.out.println(e.getValue().length);
  }
  store3.close();
}

Fixed version (ground truth):
@Test public void testTwoKeyStoreInstancesWritingAtTheSameTime() throws IOException {
  HdfsKeyValueStore store1=new HdfsKeyValueStore(false,_timer,_configuration,_path);
  listFiles();
  store1.put(new BytesRef("String_Node_Str"),new BytesRef(new byte[2000]));
  listFiles();
  HdfsKeyValueStore store2=new HdfsKeyValueStore(false,_timer,_configuration,_path);
  listFiles();
  store2.put(new BytesRef("String_Node_Str"),new BytesRef(new byte[1000]));
  listFiles();
  store1.put(new BytesRef("String_Node_Str"),new BytesRef(new byte[2000]));
  listFiles();
  store2.put(new BytesRef("String_Node_Str"),new BytesRef(new byte[1000]));
  listFiles();
  store1.put(new BytesRef("String_Node_Str"),new BytesRef(new byte[2000]));
  listFiles();
  store2.put(new BytesRef("String_Node_Str"),new BytesRef(new byte[1000]));
  listFiles();
  try {
    store1.sync();
    fail();
  }
 catch (  Exception e) {
  }
  store2.sync();
  try {
    store1.close();
    fail();
  }
 catch (  Exception e) {
  }
  store2.close();
  HdfsKeyValueStore store3=new HdfsKeyValueStore(false,_timer,_configuration,_path);
  Iterable<Entry<BytesRef,BytesRef>> scan=store3.scan(null);
  for (  Entry<BytesRef,BytesRef> e : scan) {
    System.out.println(e.getValue().length);
  }
  store3.close();
}
Program: 82125
Project: 82125
Buggy source:
private void assignMapReduceWorkingPath(TableDescriptor tableDescriptor) throws IOException {
  Map<String,String> tableProperties=tableDescriptor.getTableProperties();
  String mrIncWorkingPathStr=null;
  if (tableProperties != null) {
    mrIncWorkingPathStr=tableProperties.get(BlurConstants.BLUR_BULK_UPDATE_WORKING_PATH);
  }
  if (mrIncWorkingPathStr == null) {
    mrIncWorkingPathStr=_configuration.get(BlurConstants.BLUR_BULK_UPDATE_WORKING_PATH);
    if (mrIncWorkingPathStr == null) {
      LOG.info("String_Node_Str",tableDescriptor.getName());
      return;
    }
    mrIncWorkingPathStr=new Path(mrIncWorkingPathStr,tableDescriptor.getName()).toString();
    tableDescriptor.putToTableProperties(BlurConstants.BLUR_BULK_UPDATE_WORKING_PATH,mrIncWorkingPathStr);
  }
  Path mrIncWorkingPath=new Path(mrIncWorkingPathStr);
  Path newData=new Path(mrIncWorkingPath,NEW);
  Path tmpData=new Path(mrIncWorkingPath,TMP);
  Path inprogressData=new Path(mrIncWorkingPath,INPROGRESS);
  Path completeData=new Path(mrIncWorkingPath,COMPLETE);
  Path fileCache=new Path(mrIncWorkingPath,CACHE);
  FileSystem fileSystem=mrIncWorkingPath.getFileSystem(_config);
  fileSystem.mkdirs(newData);
  fileSystem.mkdirs(tmpData);
  fileSystem.mkdirs(inprogressData);
  fileSystem.mkdirs(completeData);
  fileSystem.mkdirs(fileCache);
}

Fixed version (ground truth):
private void assignMapReduceWorkingPath(TableDescriptor tableDescriptor) throws IOException {
  Map<String,String> tableProperties=tableDescriptor.getTableProperties();
  String mrIncWorkingPathStr=getProperty(tableProperties,BlurConstants.BLUR_BULK_UPDATE_WORKING_PATH);
  if (mrIncWorkingPathStr == null) {
    mrIncWorkingPathStr=_configuration.get(BlurConstants.BLUR_BULK_UPDATE_WORKING_PATH);
    if (mrIncWorkingPathStr == null) {
      LOG.info("String_Node_Str",tableDescriptor.getName());
      return;
    }
    mrIncWorkingPathStr=new Path(mrIncWorkingPathStr,tableDescriptor.getName()).toString();
    tableDescriptor.putToTableProperties(BlurConstants.BLUR_BULK_UPDATE_WORKING_PATH,mrIncWorkingPathStr);
  }
  Path mrIncWorkingPath=new Path(mrIncWorkingPathStr);
  FileSystem fileSystem=mrIncWorkingPath.getFileSystem(_config);
  Path newData=new Path(mrIncWorkingPath,NEW);
  Path tmpData=new Path(mrIncWorkingPath,TMP);
  Path inprogressData=new Path(mrIncWorkingPath,INPROGRESS);
  Path completeData=new Path(mrIncWorkingPath,COMPLETE);
  Path fileCache=new Path(mrIncWorkingPath,CACHE);
  String permission=getProperty(tableProperties,BlurConstants.BLUR_BULK_UPDATE_WORKING_PATH_PERMISSION);
  FsPermission fsPermission;
  if (permission == null || permission.isEmpty()) {
    fsPermission=FsPermission.getDirDefault();
  }
 else {
    fsPermission=new FsPermission(permission);
  }
  fileSystem.mkdirs(mrIncWorkingPath,fsPermission);
  fileSystem.mkdirs(newData,fsPermission);
  fileSystem.mkdirs(tmpData,fsPermission);
  fileSystem.mkdirs(inprogressData,fsPermission);
  fileSystem.mkdirs(completeData,fsPermission);
  fileSystem.mkdirs(fileCache,fsPermission);
}
Program: 82128
Project: 82128
Buggy source:
@Override public org.apache.hadoop.hive.ql.exec.FileSinkOperator.RecordWriter run() throws Exception {
  final Writer writer=new SequenceFile.Writer(fileSystem,configuration,new Path(loadPath,UUID.randomUUID().toString()),Text.class,BlurRecord.class);
  return new org.apache.hadoop.hive.ql.exec.FileSinkOperator.RecordWriter(){
    @Override public void write(    Writable w) throws IOException {
      BlurRecord blurRecord=(BlurRecord)w;
      String rowId=blurRecord.getRowId();
      writer.append(new Text(rowId),blurRecord);
    }
    @Override public void close(    boolean abort) throws IOException {
      writer.close();
    }
  }
;
}

Fixed version (ground truth):
@Override public org.apache.hadoop.hive.ql.exec.FileSinkOperator.RecordWriter run() throws Exception {
  String workingPathStr=configuration.get(BlurConstants.BLUR_BULK_UPDATE_WORKING_PATH);
  Path workingPath=new Path(workingPathStr);
  Path tmpDir=new Path(workingPath,"String_Node_Str");
  FileSystem fileSystem=tmpDir.getFileSystem(configuration);
  String loadId=configuration.get(BlurSerDe.BLUR_MR_LOAD_ID);
  Path loadPath=new Path(tmpDir,loadId);
  final Writer writer=new SequenceFile.Writer(fileSystem,configuration,new Path(loadPath,UUID.randomUUID().toString()),Text.class,BlurRecord.class);
  return new org.apache.hadoop.hive.ql.exec.FileSinkOperator.RecordWriter(){
    @Override public void write(    Writable w) throws IOException {
      BlurRecord blurRecord=(BlurRecord)w;
      String rowId=blurRecord.getRowId();
      writer.append(new Text(rowId),blurRecord);
    }
    @Override public void close(    boolean abort) throws IOException {
      writer.close();
    }
  }
;
}
Program: 82129
Project: 82129
Buggy source:
private static boolean isValid(HdfsDirectory localDir,Directory remoteDir,String name) throws IOException {
  LastModified lastModified=(LastModified)remoteDir;
  long fileModified=lastModified.getFileModified(name);
  long fileLength=remoteDir.fileLength(name);
  if (localDir.fileExists(name)) {
    LOG.info("String_Node_Str",name);
    if (localDir.fileLength(name) == fileLength) {
      LOG.info("String_Node_Str",name);
      if (localDir.fileExists(name + LASTMOD)) {
        LOG.info("String_Node_Str",name);
        IndexInput input=localDir.openInput(name + LASTMOD,IOContext.DEFAULT);
        long lastMod=input.readLong();
        if (lastMod == fileModified) {
          LOG.info("String_Node_Str",name);
          return true;
        }
 else {
          LOG.info("String_Node_Str",name);
        }
      }
 else {
        LOG.info("String_Node_Str",name);
      }
    }
 else {
      LOG.info("String_Node_Str",name);
    }
  }
 else {
    LOG.info("String_Node_Str",name);
  }
  return false;
}

Fixed version (ground truth):
private static boolean isValid(HdfsDirectory localDir,Directory remoteDir,String name) throws IOException {
  LastModified lastModified=(LastModified)remoteDir;
  long fileModified=lastModified.getFileModified(name);
  long fileLength=remoteDir.fileLength(name);
  if (localDir.fileExists(name)) {
    LOG.info("String_Node_Str",name);
    if (localDir.fileLength(name) == fileLength) {
      LOG.info("String_Node_Str",name);
      String lastModFile=name + LASTMOD;
      if (localDir.fileExists(lastModFile) && localDir.fileLength(lastModFile) != 8) {
        LOG.info("String_Node_Str",name);
        IndexInput input=localDir.openInput(lastModFile,IOContext.DEFAULT);
        long lastMod=input.readLong();
        if (lastMod == fileModified) {
          LOG.info("String_Node_Str",name);
          return true;
        }
 else {
          LOG.info("String_Node_Str",name);
        }
      }
 else {
        LOG.info("String_Node_Str",name);
      }
    }
 else {
      LOG.info("String_Node_Str",name);
    }
  }
 else {
    LOG.info("String_Node_Str",name);
  }
  return false;
}
Program: 82130
Project: 82130
Buggy source:
public void initialize(BlurInputSplit blurInputSplit,Configuration configuration) throws IOException {
  if (_setup) {
    return;
  }
  _setup=true;
  _table=blurInputSplit.getTable();
  Path localCachePath=BlurInputFormat.getLocalCachePath(configuration);
  LOG.info("String_Node_Str",localCachePath);
  _directory=BlurInputFormat.getDirectory(configuration,_table.toString(),blurInputSplit.getDir());
  SegmentInfos segmentInfos=new SegmentInfos();
  segmentInfos.read(_directory,blurInputSplit.getSegmentsName());
  SegmentInfoPerCommit commit=findSegmentInfoPerCommit(segmentInfos,blurInputSplit);
  SegmentInfo segmentInfo=commit.info;
  if (localCachePath != null) {
    _readingDirectory=copyFilesLocally(configuration,_directory,_table.toString(),blurInputSplit.getDir(),localCachePath,segmentInfo.files());
  }
 else {
    _readingDirectory=_directory;
  }
  Blur024Codec blur024Codec=new Blur024Codec();
  IOContext iocontext=IOContext.READ;
  String segmentName=segmentInfo.name;
  FieldInfos fieldInfos=blur024Codec.fieldInfosFormat().getFieldInfosReader().read(_readingDirectory,segmentName,iocontext);
  if (commit.getDelCount() > 0) {
    _liveDocs=blur024Codec.liveDocsFormat().readLiveDocs(_readingDirectory,commit,iocontext);
  }
  _fieldsReader=blur024Codec.storedFieldsFormat().fieldsReader(_readingDirectory,segmentInfo,fieldInfos,iocontext);
  _maxDoc=commit.info.getDocCount();
}

Fixed version (ground truth):
public void initialize(BlurInputSplit blurInputSplit,Configuration configuration) throws IOException {
  if (_setup) {
    return;
  }
  _setup=true;
  _table=blurInputSplit.getTable();
  Path localCachePath=BlurInputFormat.getLocalCachePath(configuration);
  LOG.info("String_Node_Str",localCachePath);
  _directory=BlurInputFormat.getDirectory(configuration,_table.toString(),blurInputSplit.getDir());
  SegmentInfos segmentInfos=new SegmentInfos();
  segmentInfos.read(_directory,blurInputSplit.getSegmentsName());
  SegmentInfoPerCommit commit=findSegmentInfoPerCommit(segmentInfos,blurInputSplit);
  SegmentInfo segmentInfo=commit.info;
  if (localCachePath != null) {
    _readingDirectory=copyFilesLocally(configuration,_directory,_table.toString(),blurInputSplit.getDir(),localCachePath,commit.files());
  }
 else {
    _readingDirectory=_directory;
  }
  Blur024Codec blur024Codec=new Blur024Codec();
  IOContext iocontext=IOContext.READ;
  String segmentName=segmentInfo.name;
  FieldInfos fieldInfos=blur024Codec.fieldInfosFormat().getFieldInfosReader().read(_readingDirectory,segmentName,iocontext);
  if (commit.getDelCount() > 0) {
    _liveDocs=blur024Codec.liveDocsFormat().readLiveDocs(_readingDirectory,commit,iocontext);
  }
  _fieldsReader=blur024Codec.storedFieldsFormat().fieldsReader(_readingDirectory,segmentInfo,fieldInfos,iocontext);
  _maxDoc=commit.info.getDocCount();
}
Program: 82131
Project: 82131
Buggy source:
private static Directory copyFilesLocally(Configuration configuration,Directory dir,String table,Path shardDir,Path localCachePath,Set<String> files) throws IOException {
  LOG.info("String_Node_Str",shardDir);
  Path localShardPath=new Path(new Path(localCachePath,table),shardDir.getName());
  HdfsDirectory localDir=new HdfsDirectory(configuration,localShardPath);
  for (  String name : files) {
    if (!isValidFileToCache(name)) {
      continue;
    }
    LOG.info("String_Node_Str",name);
    if (!isValid(localDir,dir,name)) {
      LastModified lastModified=(LastModified)dir;
      long fileModified=lastModified.getFileModified(name);
      IndexInput input=dir.openInput(name,IOContext.READONCE);
      IndexOutput output=localDir.createOutput(name,IOContext.READONCE);
      output.copyBytes(input,input.length());
      output.close();
      IndexOutput lastMod=localDir.createOutput(name + LASTMOD,IOContext.DEFAULT);
      lastMod.writeLong(fileModified);
      lastMod.close();
    }
  }
  return localDir;
}

Fixed version (ground truth):
private static Directory copyFilesLocally(Configuration configuration,Directory dir,String table,Path shardDir,Path localCachePath,Collection<String> files) throws IOException {
  LOG.info("String_Node_Str",shardDir);
  Path localShardPath=new Path(new Path(localCachePath,table),shardDir.getName());
  HdfsDirectory localDir=new HdfsDirectory(configuration,localShardPath);
  for (  String name : files) {
    if (!isValidFileToCache(name)) {
      continue;
    }
    LOG.info("String_Node_Str",name);
    if (!isValid(localDir,dir,name)) {
      LastModified lastModified=(LastModified)dir;
      long fileModified=lastModified.getFileModified(name);
      IndexInput input=dir.openInput(name,IOContext.READONCE);
      IndexOutput output=localDir.createOutput(name,IOContext.READONCE);
      output.copyBytes(input,input.length());
      output.close();
      IndexOutput lastMod=localDir.createOutput(name + LASTMOD,IOContext.DEFAULT);
      lastMod.writeLong(fileModified);
      lastMod.close();
    }
  }
  return localDir;
}
Program: 82132
Project: 82132
Buggy source:
protected long getRowCount(IndexSearcherCloseable searcher) throws IOException {
  TopDocs topDocs=searcher.search(new TermQuery(BlurUtil.PRIME_DOC_TERM),1);
  return topDocs.totalHits;
}

Fixed version (ground truth):
protected long getRowCount(IndexSearcherCloseable searcher) throws IOException {
  TopDocs topDocs=searcher.search(new SuperQuery(new MatchAllDocsQuery(),ScoreType.CONSTANT,_tableContext.getDefaultPrimeDocTerm()),1);
  return topDocs.totalHits;
}
Program: 82133
Project: 82133
Buggy source:
public void close() throws IOException {
  flush();
  _writer.close();
  if (_countersSetup) {
    _recordRateCounter.close();
    _rowRateCounter.close();
  }
  if (_indexLocally) {
    if (_optimizeInFlight) {
      copyAndOptimizeInFlightDir();
    }
 else {
      copyDir();
    }
  }
  if (_countersSetup) {
    _copyRateCounter.close();
  }
}

Fixed version (ground truth):
public void close() throws IOException {
  flush();
  _writer.close(false);
  if (_countersSetup) {
    _recordRateCounter.close();
    _rowRateCounter.close();
  }
  if (_indexLocally) {
    if (_optimizeInFlight) {
      copyAndOptimizeInFlightDir();
    }
 else {
      copyDir();
    }
  }
  if (_countersSetup) {
    _copyRateCounter.close();
  }
}
Program: 82134
Project: 82134
Buggy source:
@Override public void seek(long pos) throws IOException {
  ensureOpen();
  if (pos >= _fileLength) {
    _position=pos;
    return;
  }
  if (_position == pos) {
    return;
  }
  long oldBlockId=getBlockId();
  if (_blockPosition == _cacheBlockSize) {
    oldBlockId--;
  }
  _position=pos;
  long newBlockId=getBlockId(_position);
  if (newBlockId == oldBlockId) {
    _blockPosition=getBlockPosition();
  }
 else {
    releaseCache();
  }
}

Fixed version (ground truth):
@Override public void seek(long pos) throws IOException {
  ensureOpen();
  if (pos >= _fileLength) {
    _position=pos;
    releaseCache();
    return;
  }
  if (_position == pos) {
    return;
  }
  long oldBlockId=getBlockId();
  if (_blockPosition == _cacheBlockSize) {
    oldBlockId--;
  }
  _position=pos;
  long newBlockId=getBlockId(_position);
  if (newBlockId == oldBlockId) {
    _blockPosition=getBlockPosition();
  }
 else {
    releaseCache();
  }
}
Program: 82137
Project: 82137
Buggy source:
public static Value toValue(Object o) throws BlurException {
  Value value=new Value();
  if (o == null) {
    value.setNullValue(true);
    return value;
  }
  if (o instanceof Long) {
    value.setLongValue((Long)o);
    return value;
  }
 else   if (o instanceof String) {
    value.setStringValue((String)o);
    return value;
  }
 else   if (o instanceof Integer) {
    value.setIntValue((Integer)o);
    return value;
  }
 else   if (o instanceof Boolean) {
    value.setBooleanValue((Boolean)o);
    return value;
  }
 else   if (o instanceof Short) {
    value.setShortValue((Short)o);
    return value;
  }
 else   if (o instanceof byte[]) {
    value.setBinaryValue((byte[])o);
    return value;
  }
 else   if (o instanceof Double) {
    value.setDoubleValue((Double)o);
    return value;
  }
 else   if (o instanceof Float) {
    value.setFloatValue((Float)o);
    return value;
  }
  throw new BException("String_Node_Str",o);
}

Fixed version (ground truth):
public static Value toValue(Object o) throws BlurException {
  Value value=new Value();
  if (o == null) {
    value.setNullValue(true);
    return value;
  }
  if (o instanceof Long) {
    value.setLongValue((Long)o);
    return value;
  }
 else   if (o instanceof String) {
    value.setStringValue((String)o);
    return value;
  }
 else   if (o instanceof Integer) {
    value.setIntValue((Integer)o);
    return value;
  }
 else   if (o instanceof Boolean) {
    value.setBooleanValue((Boolean)o);
    return value;
  }
 else   if (o instanceof Short) {
    value.setShortValue((Short)o);
    return value;
  }
 else   if (o instanceof byte[]) {
    value.setBinaryValue((byte[])o);
    return value;
  }
 else   if (o instanceof ByteBuffer) {
    ByteBuffer buff=(ByteBuffer)o;
    byte[] temp=new byte[buff.remaining()];
    buff.get(temp);
    value.setBinaryValue(temp);
    return value;
  }
 else   if (o instanceof Double) {
    value.setDoubleValue((Double)o);
    return value;
  }
 else   if (o instanceof Float) {
    value.setFloatValue((Float)o);
    return value;
  }
  throw new BException("String_Node_Str",o);
}
Program: 82138
Project: 82138
Buggy source:
protected long[] runReport() throws IOException {
  long total=0;
  long local=0;
  Collection<FSDataInputRandomAccess> values=_inputMap.values();
  for (  FSDataInputRandomAccess inputRandomAccess : values) {
    Path path=inputRandomAccess.getPath();
    long length=inputRandomAccess.length();
    BlockLocation[] blockLocations=_fileSystem.getFileBlockLocations(path,0,length);
    for (    BlockLocation blockLocation : blockLocations) {
      if (isLocal(blockLocation)) {
        local++;
      }
      total++;
    }
  }
  return new long[]{total,local};
}

Fixed version (ground truth):
protected long[] runReport() throws IOException {
  long total=0;
  long local=0;
  Collection<FSDataInputRandomAccess> values=_inputMap.values();
  for (  FSDataInputRandomAccess inputRandomAccess : values) {
    Path path=inputRandomAccess.getPath();
    long length=inputRandomAccess.length();
    FileStatus fileStatus=_fileSystem.getFileStatus(path);
    BlockLocation[] blockLocations=_fileSystem.getFileBlockLocations(fileStatus,0L,length);
    for (    BlockLocation blockLocation : blockLocations) {
      if (isLocal(blockLocation)) {
        local++;
      }
      total++;
    }
  }
  return new long[]{total,local};
}
Program: 82139
Project: 82139
Buggy source:
@Test public void testIndexImporterWithBadIndex() throws IOException {
  _fileSystem.delete(_path,true);
  _fileSystem.mkdirs(_path);
  _indexImporter.run();
  assertFalse(_fileSystem.exists(_path));
  assertFalse(_fileSystem.exists(_badRowIdsPath));
  assertTrue(_fileSystem.exists(_badIndexPath));
  validateIndex();
}

Fixed version (ground truth):
@Test public void testIndexImporterWithBadIndex() throws IOException {
  _commitWriter.close();
  _fileSystem.delete(_path,true);
  _fileSystem.mkdirs(_path);
  _indexImporter.run();
  assertFalse(_fileSystem.exists(_path));
  assertFalse(_fileSystem.exists(_badRowIdsPath));
  assertTrue(_fileSystem.exists(_badIndexPath));
  validateIndex();
}
Program: 82140
Project: 82140
Buggy source:
@After public void tearDown() throws IOException {
  _timer.cancel();
  _timer.purge();
  IOUtils.closeQuietly(_commitWriter);
  IOUtils.closeQuietly(_mainWriter);
  IOUtils.closeQuietly(_indexImporter);
  _base.getFileSystem(_configuration).delete(_base,true);
}

Fixed version (ground truth):
@After public void tearDown() throws IOException {
  _timer.cancel();
  _timer.purge();
  IOUtils.closeQuietly(_mainWriter);
  IOUtils.closeQuietly(_indexImporter);
  _base.getFileSystem(_configuration).delete(_base,true);
}
Program: 82141
Project: 82141
Buggy source:
protected boolean isCopyFileAvailable(final String name) throws IOException {
  if (_useCache) {
    Boolean b=_copyFileMap.get(name);
    if (b != null) {
      return b;
    }
  }
  Tracer trace=Trace.trace("String_Node_Str",Trace.param("String_Node_Str",name));
  try {
    FileStatus[] listStatus;
    int retryCount=0;
    while (true) {
      try {
        listStatus=_fileSystem.listStatus(_path,new PathFilter(){
          @Override public boolean accept(          Path path){
            String fileName=path.getName();
            return fileName.startsWith(name) && fileName.endsWith(COPY);
          }
        }
);
        break;
      }
 catch (      FileNotFoundException e) {
        LOG.debug("String_Node_Str",e);
        try {
          Thread.sleep(100 * (retryCount + 1));
        }
 catch (        InterruptedException ex) {
          throw e;
        }
      }
    }
    boolean exists;
    if (listStatus == null || listStatus.length == 0) {
      exists=false;
    }
 else {
      exists=true;
    }
    if (_useCache) {
      _copyFileMap.put(name,exists);
    }
    return exists;
  }
  finally {
    trace.done();
  }
}

Fixed version (ground truth):
protected boolean isCopyFileAvailable(final String name) throws IOException {
  if (_useCache) {
    Boolean b=_copyFileMap.get(name);
    if (b != null) {
      return b;
    }
  }
  Tracer trace=Trace.trace("String_Node_Str",Trace.param("String_Node_Str",name));
  try {
    FileStatus[] listStatus;
    int retryCount=0;
    while (true) {
      try {
        listStatus=_fileSystem.listStatus(_path,new PathFilter(){
          @Override public boolean accept(          Path path){
            String fileName=path.getName();
            return fileName.startsWith(name) && fileName.endsWith(COPY);
          }
        }
);
        break;
      }
 catch (      FileNotFoundException e) {
        if (retryCount >= 5) {
          throw e;
        }
        LOG.debug("String_Node_Str",e);
        try {
          Thread.sleep(100 * (retryCount + 1));
        }
 catch (        InterruptedException ex) {
          throw e;
        }
        retryCount++;
      }
    }
    boolean exists;
    if (listStatus == null || listStatus.length == 0) {
      exists=false;
    }
 else {
      exists=true;
    }
    if (_useCache) {
      _copyFileMap.put(name,exists);
    }
    return exists;
  }
  finally {
    trace.done();
  }
}
Program: 82142
Project: 82142
Buggy source:
@BeforeClass public static void setupTest() throws Exception {
  GCWatcher.init(0.60);
  BlurOutputFormatTest.setupJavaHome();
  LocalFileSystem localFS=FileSystem.getLocal(new Configuration());
  File testDirectory=new File(TMPDIR,"String_Node_Str").getAbsoluteFile();
  testDirectory.mkdirs();
  Path directory=new Path(testDirectory.getPath());
  FsPermission dirPermissions=localFS.getFileStatus(directory).getPermission();
  FsAction userAction=dirPermissions.getUserAction();
  FsAction groupAction=dirPermissions.getGroupAction();
  FsAction otherAction=dirPermissions.getOtherAction();
  StringBuilder builder=new StringBuilder();
  builder.append(userAction.ordinal());
  builder.append(groupAction.ordinal());
  builder.append(otherAction.ordinal());
  String dirPermissionNum=builder.toString();
  System.setProperty("String_Node_Str",dirPermissionNum);
  testDirectory.delete();
  miniCluster=new MiniCluster();
  miniCluster.startBlurCluster(new File(testDirectory,"String_Node_Str").getAbsolutePath(),2,3,true,false);
  TEST_ROOT_DIR=new Path(miniCluster.getFileSystemUri().toString() + "String_Node_Str");
  System.setProperty("String_Node_Str","String_Node_Str");
  try {
    fileSystem=TEST_ROOT_DIR.getFileSystem(conf);
  }
 catch (  IOException io) {
    throw new RuntimeException("String_Node_Str",io);
  }
  FileSystem.setDefaultUri(conf,miniCluster.getFileSystemUri());
  miniCluster.startMrMiniCluster();
  conf=miniCluster.getMRConfiguration();
  BufferStore.initNewBuffer(128,128 * 128);
}

Fixed version (ground truth):
@BeforeClass public static void setupTest() throws Exception {
  GCWatcher.init(0.60);
  JavaHome.checkJavaHome();
  LocalFileSystem localFS=FileSystem.getLocal(new Configuration());
  File testDirectory=new File(TMPDIR,"String_Node_Str").getAbsoluteFile();
  testDirectory.mkdirs();
  Path directory=new Path(testDirectory.getPath());
  FsPermission dirPermissions=localFS.getFileStatus(directory).getPermission();
  FsAction userAction=dirPermissions.getUserAction();
  FsAction groupAction=dirPermissions.getGroupAction();
  FsAction otherAction=dirPermissions.getOtherAction();
  StringBuilder builder=new StringBuilder();
  builder.append(userAction.ordinal());
  builder.append(groupAction.ordinal());
  builder.append(otherAction.ordinal());
  String dirPermissionNum=builder.toString();
  System.setProperty("String_Node_Str",dirPermissionNum);
  testDirectory.delete();
  miniCluster=new MiniCluster();
  miniCluster.startBlurCluster(new File(testDirectory,"String_Node_Str").getAbsolutePath(),2,3,true,false);
  TEST_ROOT_DIR=new Path(miniCluster.getFileSystemUri().toString() + "String_Node_Str");
  System.setProperty("String_Node_Str","String_Node_Str");
  try {
    fileSystem=TEST_ROOT_DIR.getFileSystem(conf);
  }
 catch (  IOException io) {
    throw new RuntimeException("String_Node_Str",io);
  }
  FileSystem.setDefaultUri(conf,miniCluster.getFileSystemUri());
  miniCluster.startMrMiniCluster();
  conf=miniCluster.getMRConfiguration();
  BufferStore.initNewBuffer(128,128 * 128);
}
Program: 82143
Project: 82143
Buggy source:
private boolean addFieldTypeDefinition(String family,String columnName,String subColumnName,String fieldName,boolean fieldLessIndexed,String fieldType,boolean sortable,boolean multiValueField,Map<String,String> props) throws IOException {
  FieldTypeDefinition fieldTypeDefinition=getFieldTypeDefinition(fieldName);
  if (fieldTypeDefinition != null) {
    return false;
  }
  fieldTypeDefinition=newFieldTypeDefinition(fieldName,fieldLessIndexed,fieldType,sortable,multiValueField,props);
synchronized (_fieldNameToDefMap) {
    for (    String alternateFieldName : fieldTypeDefinition.getAlternateFieldNames()) {
      if (_fieldNameToDefMap.containsKey(alternateFieldName)) {
        throw new IllegalArgumentException("String_Node_Str" + alternateFieldName + "String_Node_Str"+ fieldTypeDefinition+ "String_Node_Str");
      }
    }
    setFields(fieldTypeDefinition,family,columnName,subColumnName,fieldLessIndexed,fieldType,props);
    if (!tryToStore(fieldTypeDefinition,fieldName)) {
      return false;
    }
    registerFieldTypeDefinition(fieldName,fieldTypeDefinition);
  }
  return true;
}

Fixed version (ground truth):
private boolean addFieldTypeDefinition(String family,String columnName,String subColumnName,String fieldName,boolean fieldLessIndexed,String fieldType,boolean sortable,boolean multiValueField,Map<String,String> props) throws IOException {
  FieldTypeDefinition fieldTypeDefinition=getFieldTypeDefinition(fieldName);
  if (fieldTypeDefinition != null) {
    return false;
  }
  fieldTypeDefinition=newFieldTypeDefinition(fieldName,fieldLessIndexed,fieldType,sortable,multiValueField,props);
synchronized (_fieldNameToDefMap) {
    boolean alternateFieldNamesSharedAcrossInstances=fieldTypeDefinition.isAlternateFieldNamesSharedAcrossInstances();
    for (    String alternateFieldName : fieldTypeDefinition.getAlternateFieldNames()) {
      if (alternateFieldNamesSharedAcrossInstances && _fieldNameToDefMap.containsKey(alternateFieldName)) {
        FieldTypeDefinition ftd=_fieldNameToDefMap.get(alternateFieldName);
        if (!ftd.getName().equals(fieldTypeDefinition.getName())) {
          throw new IllegalArgumentException("String_Node_Str" + alternateFieldName + "String_Node_Str"+ fieldTypeDefinition+ "String_Node_Str");
        }
      }
 else       if (_fieldNameToDefMap.containsKey(alternateFieldName)) {
        throw new IllegalArgumentException("String_Node_Str" + alternateFieldName + "String_Node_Str"+ fieldTypeDefinition+ "String_Node_Str");
      }
    }
    setFields(fieldTypeDefinition,family,columnName,subColumnName,fieldLessIndexed,fieldType,props);
    if (!tryToStore(fieldTypeDefinition,fieldName)) {
      return false;
    }
    registerFieldTypeDefinition(fieldName,fieldTypeDefinition);
  }
  return true;
}
Program: 82144
Project: 82144
Buggy source:
private void setupFieldManager(BaseFieldManager fieldManager) throws IOException {
  fieldManager.addColumnDefinition(FAM,"String_Node_Str",null,false,"String_Node_Str",false,false,null);
  fieldManager.addColumnDefinition(FAM,"String_Node_Str",null,false,"String_Node_Str",false,false,null);
}

Fixed version (ground truth):
private void setupFieldManager(BaseFieldManager fieldManager) throws IOException {
  fieldManager.addColumnDefinition(FAM,"String_Node_Str",null,false,"String_Node_Str",false,false,null);
  fieldManager.addColumnDefinition(FAM,"String_Node_Str",null,false,"String_Node_Str",false,false,null);
  fieldManager.addColumnDefinition(FAM2,"String_Node_Str",null,false,"String_Node_Str",false,false,null);
  fieldManager.addColumnDefinition(FAM2,"String_Node_Str",null,false,"String_Node_Str",false,false,null);
}
Program: 82145
Project: 82145
Buggy source:
private void setupFieldManager(BaseFieldManager fieldManager) throws IOException {
  fieldManager.addColumnDefinition(FAM,"String_Node_Str",null,false,"String_Node_Str",false,false,null);
  fieldManager.addColumnDefinition(FAM,"String_Node_Str",null,false,"String_Node_Str",false,false,null);
}

Fixed version (ground truth):
private void setupFieldManager(BaseFieldManager fieldManager) throws IOException {
  fieldManager.addColumnDefinition(FAM,"String_Node_Str",null,false,"String_Node_Str",false,false,null);
  fieldManager.addColumnDefinition(FAM,"String_Node_Str",null,false,"String_Node_Str",false,false,null);
  fieldManager.addColumnDefinition(FAM2,"String_Node_Str",null,false,"String_Node_Str",false,false,null);
  fieldManager.addColumnDefinition(FAM2,"String_Node_Str",null,false,"String_Node_Str",false,false,null);
}