nus-yam/ex-repair huggingface dataset:
Program: 82444
Project: 82444
Buggy source:
public static boolean createPath(FileSystem fileSystem,Path path) throws IOException {
  if (!fileSystem.exists(path)) {
    LOG.info("String_Node_Str",path);
    fileSystem.mkdirs(path);
    return false;
  }
  return true;
}

Fixed version (ground truth):
public static boolean createPath(FileSystem fileSystem,Path path) throws IOException {
  if (!fileSystem.exists(path)) {
    LOG.info("String_Node_Str",path);
    if (!fileSystem.mkdirs(path)) {
      LOG.error("String_Node_Str",path);
      throw new IOException("String_Node_Str");
    }
    return false;
  }
  return true;
}
Program: 82445
Project: 82445
Buggy source:
public void deleteFile(String name) throws IOException {
  if (name.equals(IndexFileNames.SEGMENTS_GEN)) {
    deleteFile(name);
    return;
  }
  AtomicInteger counter=refCounters.get(name);
  if (counter != null && counter.get() > 0) {
    addToFileGC(name);
  }
 else {
    LOG.debug("String_Node_Str",name);
    directory.deleteFile(name);
  }
}

Fixed version (ground truth):
public void deleteFile(String name) throws IOException {
  LOG.debug("String_Node_Str",name);
  if (name.equals(IndexFileNames.SEGMENTS_GEN)) {
    directory.deleteFile(name);
    return;
  }
  AtomicInteger counter=refCounters.get(name);
  if (counter != null && counter.get() > 0) {
    addToFileGC(name);
  }
 else {
    LOG.debug("String_Node_Str",name);
    directory.deleteFile(name);
  }
}
Program: 82446
Project: 82446
Buggy source:
public static void main(String[] args) throws IOException {
  Main.setupCommands();
  Map<String,Command> commands=Main.commands;
  ByteArrayOutputStream outputStream1=new ByteArrayOutputStream();
  ByteArrayOutputStream outputStream2=new ByteArrayOutputStream();
  PrintWriter menu=new PrintWriter(outputStream1);
  PrintWriter body=new PrintWriter(outputStream2);
  printCommands("String_Node_Str",Main.tableCommands,commands,menu,body);
  printCommands("String_Node_Str",Main.dataCommands,commands,menu,body);
  printCommands("String_Node_Str",Main.clusterCommands,commands,menu,body);
  printCommands("String_Node_Str",Main.shellCommands,commands,menu,body);
  menu.close();
  body.close();
  String menuReplacementText=new String(outputStream1.toByteArray());
  String bodyReplacementText=new String(outputStream2.toByteArray());
  File source=new File(args[0]);
  File output=new File(args[1]);
  PrintWriter writer=new PrintWriter(output);
  BufferedReader reader=new BufferedReader(new InputStreamReader(new FileInputStream(source)));
  String line;
  while ((line=reader.readLine()) != null) {
    line=line.trim();
    if (line.equals("String_Node_Str")) {
      writer.println(menuReplacementText);
    }
 else     if (line.equals("String_Node_Str")) {
      writer.println(bodyReplacementText);
    }
 else {
      writer.println(line);
    }
  }
  writer.close();
  reader.close();
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  Main.setupCommands();
  Map<String,Command> commands=Main.commands;
  ByteArrayOutputStream outputStream1=new ByteArrayOutputStream();
  ByteArrayOutputStream outputStream2=new ByteArrayOutputStream();
  PrintWriter menu=new PrintWriter(outputStream1);
  PrintWriter body=new PrintWriter(outputStream2);
  printCommands("String_Node_Str",Main.tableCommands,commands,menu,body);
  printCommands("String_Node_Str",Main.dataCommands,commands,menu,body);
  printCommands("String_Node_Str",Main.clusterCommands,commands,menu,body);
  printCommands("String_Node_Str",Main.shellCommands,commands,menu,body);
  menu.close();
  body.close();
  String menuReplacementText=new String(outputStream1.toByteArray());
  String bodyReplacementText=new String(outputStream2.toByteArray());
  File source=new File(args[0]);
  File output=new File(args[1]);
  PrintWriter writer=new PrintWriter(output);
  BufferedReader reader=new BufferedReader(new InputStreamReader(new FileInputStream(source)));
  String line;
  while ((line=reader.readLine()) != null) {
    if (line.equals("String_Node_Str")) {
      writer.println(menuReplacementText);
    }
 else     if (line.equals("String_Node_Str")) {
      writer.println(bodyReplacementText);
    }
 else {
      writer.println(line);
    }
  }
  writer.close();
  reader.close();
}
Program: 82447
Project: 82447
Buggy source:
public Schema schema(String table) throws IOException {
  TableContext tableContext=getTableContext(table);
  FieldManager fieldManager=tableContext.getFieldManager();
  Schema schema=new Schema().setTable(table);
  schema.setFamilies(new HashMap<String,Map<String,ColumnDefinition>>());
  Map<String,BlurIndex> blurIndexes=_indexServer.getIndexes(table);
  for (  BlurIndex blurIndex : blurIndexes.values()) {
    IndexSearcherClosable searcher=blurIndex.getIndexReader();
    try {
      FieldInfos mergedFieldInfos=MultiFields.getMergedFieldInfos(searcher.getIndexReader());
      INNER:       for (      FieldInfo fieldInfo : mergedFieldInfos) {
        String fieldName=fieldInfo.name;
        FieldTypeDefinition fieldTypeDefinition=fieldManager.getFieldTypeDefinition(fieldName);
        if (fieldTypeDefinition == null) {
          continue INNER;
        }
        int index=fieldName.indexOf('.');
        if (index > 0) {
          String columnFamily=fieldName.substring(0,index);
          String column=fieldName.substring(index + 1);
          Map<String,ColumnDefinition> map=schema.getFamilies().get(columnFamily);
          if (map == null) {
            map=new HashMap<String,ColumnDefinition>();
            schema.putToFamilies(columnFamily,map);
          }
          map.put(column,getColumnDefinition(fieldTypeDefinition));
        }
      }
    }
  finally {
      searcher.close();
    }
  }
  return schema;
}

Fixed version (ground truth):
public Schema schema(String table) throws IOException {
  TableContext tableContext=getTableContext(table);
  FieldManager fieldManager=tableContext.getFieldManager();
  Schema schema=new Schema().setTable(table);
  schema.setFamilies(new HashMap<String,Map<String,ColumnDefinition>>());
  Set<String> fieldNames=fieldManager.getFieldNames();
  INNER:   for (  String fieldName : fieldNames) {
    FieldTypeDefinition fieldTypeDefinition=fieldManager.getFieldTypeDefinition(fieldName);
    if (fieldTypeDefinition == null) {
      continue INNER;
    }
    String columnName=fieldTypeDefinition.getColumnName();
    String columnFamily=fieldTypeDefinition.getFamily();
    String subColumnName=fieldTypeDefinition.getSubColumnName();
    Map<String,ColumnDefinition> map=schema.getFamilies().get(columnFamily);
    if (map == null) {
      map=new HashMap<String,ColumnDefinition>();
      schema.putToFamilies(columnFamily,map);
    }
    if (subColumnName == null) {
      map.put(columnName,getColumnDefinition(fieldTypeDefinition));
    }
 else {
      map.put(columnName + "String_Node_Str" + subColumnName,getColumnDefinition(fieldTypeDefinition));
    }
  }
  return schema;
}
Program: 82449
Project: 82449
Buggy source:
public abstract void registerType(Class<? extends FieldTypeDefinition> c);

Fixed version (ground truth):
/** 
 * Register a   {@link FieldTypeDefinition} into this field manager.
 * @param c the class.
 */
public abstract void registerType(Class<? extends FieldTypeDefinition> c);
Program: 82450
Project: 82450
Buggy source:
protected BaseFieldManager newFieldManager(boolean create) throws IOException {
  return new BaseFieldManager(_fieldLessField,new KeywordAnalyzer()){
    @Override protected boolean tryToStore(    FieldTypeDefinition fieldTypeDefinition,    String fieldName){
      return true;
    }
    @Override protected void tryToLoad(    String field){
    }
  }
;
}

Fixed version (ground truth):
protected BaseFieldManager newFieldManager(boolean create) throws IOException {
  return new BaseFieldManager(_fieldLessField,new KeywordAnalyzer()){
    @Override protected boolean tryToStore(    FieldTypeDefinition fieldTypeDefinition,    String fieldName){
      return true;
    }
    @Override protected void tryToLoad(    String field){
    }
    @Override protected List<String> getFieldNamesToLoad() throws IOException {
      return new ArrayList<String>();
    }
  }
;
}
Program: 82451
Project: 82451
Buggy source:
private BaseFieldManager getFieldManager(Analyzer a) throws IOException {
  BaseFieldManager fieldManager=new BaseFieldManager(BlurConstants.SUPER,a){
    @Override protected boolean tryToStore(    FieldTypeDefinition fieldTypeDefinition,    String fieldName){
      return true;
    }
    @Override protected void tryToLoad(    String fieldName){
    }
  }
;
  fieldManager.addColumnDefinitionInt("String_Node_Str","String_Node_Str");
  fieldManager.addColumnDefinitionDouble("String_Node_Str","String_Node_Str");
  fieldManager.addColumnDefinitionFloat("String_Node_Str","String_Node_Str");
  fieldManager.addColumnDefinitionLong("String_Node_Str","String_Node_Str");
  fieldManager.addColumnDefinitionGisRecursivePrefixTree("String_Node_Str","String_Node_Str");
  return fieldManager;
}

Fixed version (ground truth):
private BaseFieldManager getFieldManager(Analyzer a) throws IOException {
  BaseFieldManager fieldManager=new BaseFieldManager(BlurConstants.SUPER,a){
    @Override protected boolean tryToStore(    FieldTypeDefinition fieldTypeDefinition,    String fieldName){
      return true;
    }
    @Override protected void tryToLoad(    String fieldName){
    }
    @Override protected List<String> getFieldNamesToLoad() throws IOException {
      return new ArrayList<String>();
    }
  }
;
  fieldManager.addColumnDefinitionInt("String_Node_Str","String_Node_Str");
  fieldManager.addColumnDefinitionDouble("String_Node_Str","String_Node_Str");
  fieldManager.addColumnDefinitionFloat("String_Node_Str","String_Node_Str");
  fieldManager.addColumnDefinitionLong("String_Node_Str","String_Node_Str");
  fieldManager.addColumnDefinitionGisRecursivePrefixTree("String_Node_Str","String_Node_Str");
  return fieldManager;
}
Program: 82452
Project: 82452
Buggy source:
@Override public void doit(PrintWriter out,Blur.Iface client,String[] args) throws CommandException, TException, BlurException {
  if (args.length < 5) {
    throw new CommandException("String_Node_Str" + help());
  }
  CommandLine cmd=parse(args,out);
  ColumnDefinition columnDefinition=new ColumnDefinition();
  columnDefinition.setFamily(args[2]);
  columnDefinition.setColumnName(args[3]);
  columnDefinition.setFieldType(args[4]);
  if (cmd.hasOption("String_Node_Str")) {
    columnDefinition.setColumnName(cmd.getOptionValue("String_Node_Str"));
  }
  if (cmd.hasOption("String_Node_Str")) {
    columnDefinition.setFieldLessIndexed(true);
  }
  if (cmd.hasOption("String_Node_Str")) {
    Option[] options=cmd.getOptions();
    for (    Option option : options) {
      if (option.getOpt().equals("String_Node_Str")) {
        String[] values=option.getValues();
        columnDefinition.putToProperties(values[0],values[1]);
      }
    }
  }
  client.addColumnDefinition(args[1],columnDefinition);
}

Fixed version (ground truth):
@Override public void doit(PrintWriter out,Blur.Iface client,String[] args) throws CommandException, TException, BlurException {
  if (args.length < 5) {
    throw new CommandException("String_Node_Str" + help());
  }
  CommandLine cmd=parse(args,out);
  ColumnDefinition columnDefinition=new ColumnDefinition();
  columnDefinition.setFamily(args[2]);
  columnDefinition.setColumnName(args[3]);
  columnDefinition.setFieldType(args[4]);
  if (cmd.hasOption("String_Node_Str")) {
    columnDefinition.setSubColumnName(cmd.getOptionValue("String_Node_Str"));
  }
  if (cmd.hasOption("String_Node_Str")) {
    columnDefinition.setFieldLessIndexed(true);
  }
  if (cmd.hasOption("String_Node_Str")) {
    Option[] options=cmd.getOptions();
    for (    Option option : options) {
      if (option.getOpt().equals("String_Node_Str")) {
        String[] values=option.getValues();
        columnDefinition.putToProperties(values[0],values[1]);
      }
    }
  }
  client.addColumnDefinition(args[1],columnDefinition);
}
Program: 82453
Project: 82453
Buggy source:
@Override public void doit(PrintWriter out,Blur.Iface client,String[] args) throws CommandException, TException, BlurException {
  if (args.length != 2) {
    throw new CommandException("String_Node_Str" + help());
  }
  String tablename=args[1];
  Schema schema=client.schema(tablename);
  out.println(schema.getTable());
  Map<String,Map<String,ColumnDefinition>> families=schema.getFamilies();
  for (  String cf : families.keySet()) {
    out.println("String_Node_Str" + cf);
    Map<String,ColumnDefinition> columns=families.get(cf);
    for (    String c : columns.keySet()) {
      ColumnDefinition columnDefinition=columns.get(c);
      out.println("String_Node_Str" + columnDefinition);
    }
  }
}

Fixed version (ground truth):
@Override public void doit(PrintWriter out,Blur.Iface client,String[] args) throws CommandException, TException, BlurException {
  if (args.length != 2) {
    throw new CommandException("String_Node_Str" + help());
  }
  String tablename=args[1];
  Schema schema=client.schema(tablename);
  out.println(schema);
  out.println(schema.getTable());
  Map<String,Map<String,ColumnDefinition>> families=schema.getFamilies();
  Set<String> familyNames=new TreeSet<String>(families.keySet());
  for (  String cf : familyNames) {
    out.println("String_Node_Str" + cf);
    Map<String,ColumnDefinition> columns=families.get(cf);
    Set<String> columnNames=new TreeSet<String>(columns.keySet());
    for (    String c : columnNames) {
      ColumnDefinition columnDefinition=columns.get(c);
      out.println("String_Node_Str" + columnDefinition.getColumnName());
      String fieldType=columnDefinition.getFieldType();
      Map<String,String> properties=columnDefinition.getProperties();
      String subColumnName=columnDefinition.getSubColumnName();
      if (subColumnName != null) {
        out.println("String_Node_Str" + subColumnName);
        out.println("String_Node_Str" + fieldType);
        Map<String,String> props=new TreeMap<String,String>(properties);
        for (        Entry<String,String> e : props.entrySet()) {
          out.println("String_Node_Str" + e);
        }
      }
 else {
        out.println("String_Node_Str" + fieldType);
        Map<String,String> props=new TreeMap<String,String>(properties);
        for (        Entry<String,String> e : props.entrySet()) {
          out.println("String_Node_Str" + e);
        }
      }
    }
  }
}
Program: 82455
Project: 82455
Buggy source:
private void assertInputsEquals(String name,Directory fsDir,Directory hdfs) throws IOException {
  int reads=random.nextInt(MAX_NUMBER_OF_READS);
  IndexInput fsInput=fsDir.openInput(name,IOContext.DEFAULT);
  IndexInput hdfsInput=hdfs.openInput(name,IOContext.DEFAULT);
  assertEquals(fsInput.length(),hdfsInput.length());
  int fileLength=(int)fsInput.length();
  for (int i=0; i < reads; i++) {
    byte[] fsBuf=new byte[random.nextInt(Math.min(MAX_BUFFER_SIZE - MIN_BUFFER_SIZE,fileLength)) + MIN_BUFFER_SIZE];
    byte[] hdfsBuf=new byte[fsBuf.length];
    int offset=random.nextInt(fsBuf.length);
    int length=random.nextInt(fsBuf.length - offset);
    int pos=random.nextInt(fileLength - length);
    fsInput.seek(pos);
    fsInput.readBytes(fsBuf,offset,length);
    hdfsInput.seek(pos);
    hdfsInput.readBytes(hdfsBuf,offset,length);
    for (int f=offset; f < length; f++) {
      if (fsBuf[f] != hdfsBuf[f]) {
        fail(Long.toString(seed) + "String_Node_Str" + i+ "String_Node_Str");
      }
    }
  }
  fsInput.close();
  hdfsInput.close();
}

Fixed version (ground truth):
private void assertInputsEquals(String name,Directory fsDir,Directory hdfs) throws IOException {
  int reads=random.nextInt(MAX_NUMBER_OF_READS);
  IndexInput fsInput=fsDir.openInput(name,IOContext.DEFAULT);
  IndexInput hdfsInput=hdfs.openInput(name,IOContext.DEFAULT);
  assertEquals(fsInput.length(),hdfsInput.length());
  int fileLength=(int)fsInput.length();
  if (fileLength != 0) {
    for (int i=0; i < reads; i++) {
      byte[] fsBuf=new byte[random.nextInt(Math.min(MAX_BUFFER_SIZE - MIN_BUFFER_SIZE,fileLength)) + MIN_BUFFER_SIZE];
      byte[] hdfsBuf=new byte[fsBuf.length];
      int offset=random.nextInt(fsBuf.length);
      int length=random.nextInt(fsBuf.length - offset);
      int pos=random.nextInt(fileLength - length);
      fsInput.seek(pos);
      fsInput.readBytes(fsBuf,offset,length);
      hdfsInput.seek(pos);
      hdfsInput.readBytes(hdfsBuf,offset,length);
      for (int f=offset; f < length; f++) {
        if (fsBuf[f] != hdfsBuf[f]) {
          fail(Long.toString(seed) + "String_Node_Str" + i+ "String_Node_Str");
        }
      }
    }
  }
  fsInput.close();
  hdfsInput.close();
}
Program: 82456
Project: 82456
Buggy source:
@Override public BlurAnalyzer getAnalyzer(String table){
  return new BlurAnalyzer(new StandardAnalyzer(LUCENE_VERSION,new CharArraySet(LUCENE_VERSION,new HashSet<String>(),false)));
}

Fixed version (ground truth):
@Override public BlurAnalyzer getAnalyzer(String table){
  return _tableContext.getAnalyzer();
}
Program: 82458
Project: 82458
Buggy source:
public BlurAnalyzer(){
  this(new NoStopWordStandardAnalyzer());
}

Fixed version (ground truth):
public BlurAnalyzer(){
  this(new AnalyzerDefinition());
}
Program: 82459
Project: 82459
Buggy source:
@Override public void warmBlurIndex(final TableDescriptor table,final String shard,IndexReader reader,AtomicBoolean isClosed,ReleaseReader releaseReader) throws IOException {
  LOG.info("String_Node_Str",reader);
  try {
    int maxSampleSize=1000;
    IndexWarmup indexWarmup=new IndexWarmup(isClosed,maxSampleSize);
    String context=table.getName() + "String_Node_Str" + shard;
    Map<String,List<IndexTracerResult>> sampleIndex=indexWarmup.sampleIndex(reader,context);
    ColumnPreCache columnPreCache=table.getColumnPreCache();
    if (columnPreCache != null) {
      warm(reader,columnPreCache.preCacheCols,indexWarmup,sampleIndex,context,isClosed);
    }
 else {
      warm(reader,getFields(reader),indexWarmup,sampleIndex,context,isClosed);
    }
  }
  finally {
    releaseReader.release();
  }
}

Fixed version (ground truth):
@Override public void warmBlurIndex(final TableDescriptor table,final String shard,IndexReader reader,AtomicBoolean isClosed,ReleaseReader releaseReader) throws IOException {
  LOG.info("String_Node_Str",reader);
  try {
    if (reader instanceof FilterDirectoryReader) {
      reader=getBase((FilterDirectoryReader)reader);
    }
    int maxSampleSize=1000;
    IndexWarmup indexWarmup=new IndexWarmup(isClosed,maxSampleSize);
    String context=table.getName() + "String_Node_Str" + shard;
    Map<String,List<IndexTracerResult>> sampleIndex=indexWarmup.sampleIndex(reader,context);
    ColumnPreCache columnPreCache=table.getColumnPreCache();
    if (columnPreCache != null) {
      warm(reader,columnPreCache.preCacheCols,indexWarmup,sampleIndex,context,isClosed);
    }
 else {
      warm(reader,getFields(reader),indexWarmup,sampleIndex,context,isClosed);
    }
  }
  finally {
    releaseReader.release();
  }
}
Program: 82460
Project: 82460
Buggy source:
public static boolean addColumns(Document document,BlurAnalyzer analyzer,String columnFamily,Iterable<Column> set){
  if (set == null) {
    return false;
  }
  OUTER:   for (  Column column : set) {
    String name=column.getName();
    String value=column.value;
    if (value == null || name == null) {
      continue OUTER;
    }
    String fieldName=getFieldName(columnFamily,name);
    FieldType fieldType=analyzer.getFieldType(fieldName);
    Field field=analyzer.getField(fieldName,value,fieldType);
    document.add(field);
    if (analyzer.isFullTextField(fieldName)) {
      document.add(new Field(SUPER,value,TextField.TYPE_NOT_STORED));
    }
    Set<String> subFieldNames=analyzer.getSubIndexNames(fieldName);
    if (subFieldNames != null) {
      for (      String subFieldName : subFieldNames) {
        FieldType subFieldType=analyzer.getFieldType(subFieldName);
        document.add(analyzer.getField(subFieldName,value,subFieldType));
      }
    }
  }
  return true;
}

Fixed version (ground truth):
public static boolean addColumns(Document document,BlurAnalyzer analyzer,String columnFamily,Iterable<Column> set){
  if (set == null) {
    return false;
  }
  OUTER:   for (  Column column : set) {
    String name=column.getName();
    String value=column.value;
    if (value == null || name == null) {
      continue OUTER;
    }
    String fieldName=getFieldName(columnFamily,name);
    FieldType fieldType=analyzer.getFieldType(fieldName);
    Field field=analyzer.getField(fieldName,value,fieldType);
    document.add(field);
    if (analyzer.isFullTextField(fieldName)) {
      document.add(new Field(SUPER,value,SUPER_FIELD_TYPE));
    }
    Set<String> subFieldNames=analyzer.getSubIndexNames(fieldName);
    if (subFieldNames != null) {
      for (      String subFieldName : subFieldNames) {
        FieldType subFieldType=analyzer.getFieldType(subFieldName);
        document.add(analyzer.getField(subFieldName,value,subFieldType));
      }
    }
  }
  return true;
}
Program: 82461
Project: 82461
Buggy source:
/** 
 * This method decides on the field type for the given field by name. Sub fields will also be passed in the fieldName such as fam1.col.sub1.
 * @param fieldName
 * @return the {@link FieldType}
 */
public FieldType getFieldType(String field){
  FieldType fieldType=_fieldTypes.get(field);
  if (fieldType == null) {
    fieldType=new FieldType(TextField.TYPE_STORED);
    fieldType.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
  }
  if (isSubFieldName(field)) {
    fieldType.setStored(false);
  }
  return fieldType;
}

Fixed version (ground truth):
/** 
 * This method decides on the field type for the given field by name. Sub fields will also be passed in the fieldName such as fam1.col.sub1.
 * @param fieldName
 * @return the {@link FieldType}
 */
public FieldType getFieldType(String field){
  FieldType fieldType=_fieldTypes.get(field);
  if (fieldType == null) {
    fieldType=new FieldType(TextField.TYPE_STORED);
    fieldType.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
    fieldType.setOmitNorms(true);
  }
  if (isSubFieldName(field)) {
    fieldType.setStored(false);
  }
  return fieldType;
}
Program: 82462
Project: 82462
Buggy source:
private static TYPE getType(String typeStr,String fieldName,Map<String,FieldType> fieldTypes){
  if (typeStr == null) {
    return null;
  }
  String[] types=typeStr.split("String_Node_Str");
  String type=types[0];
  String typeUpper=type.toUpperCase();
  TYPE t=null;
  if (!typeNameCache.contains(typeUpper)) {
    t=TYPE.TEXT;
  }
 else {
    t=TYPE.valueOf(typeUpper);
  }
  FieldType fieldType;
switch (t) {
case STORED:
    fieldType=StoredField.TYPE;
  break;
case STRING:
fieldType=new FieldType(StringField.TYPE_STORED);
break;
case LONG:
fieldType=new FieldType(LongField.TYPE_STORED);
if (types.length > 1) {
fieldType.setNumericPrecisionStep(Integer.parseInt(types[1]));
}
break;
case INTEGER:
fieldType=new FieldType(IntField.TYPE_STORED);
if (types.length > 1) {
fieldType.setNumericPrecisionStep(Integer.parseInt(types[1]));
}
break;
case FLOAT:
fieldType=new FieldType(FloatField.TYPE_STORED);
if (types.length > 1) {
fieldType.setNumericPrecisionStep(Integer.parseInt(types[1]));
}
break;
case DOUBLE:
fieldType=new FieldType(DoubleField.TYPE_STORED);
if (types.length > 1) {
fieldType.setNumericPrecisionStep(Integer.parseInt(types[1]));
}
break;
default :
fieldType=new FieldType(TextField.TYPE_STORED);
fieldType.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
break;
}
fieldTypes.put(fieldName,fieldType);
return t;
}

Fixed version (ground truth):
private static TYPE getType(String typeStr,String fieldName,Map<String,FieldType> fieldTypes){
  if (typeStr == null) {
    return null;
  }
  String[] types=typeStr.split("String_Node_Str");
  String type=types[0];
  String typeUpper=type.toUpperCase();
  TYPE t=null;
  if (!typeNameCache.contains(typeUpper)) {
    t=TYPE.TEXT;
  }
 else {
    t=TYPE.valueOf(typeUpper);
  }
  FieldType fieldType;
switch (t) {
case STORED:
    fieldType=StoredField.TYPE;
  break;
case STRING:
fieldType=new FieldType(StringField.TYPE_STORED);
break;
case LONG:
fieldType=new FieldType(LongField.TYPE_STORED);
if (types.length > 1) {
fieldType.setNumericPrecisionStep(Integer.parseInt(types[1]));
}
break;
case INTEGER:
fieldType=new FieldType(IntField.TYPE_STORED);
if (types.length > 1) {
fieldType.setNumericPrecisionStep(Integer.parseInt(types[1]));
}
break;
case FLOAT:
fieldType=new FieldType(FloatField.TYPE_STORED);
if (types.length > 1) {
fieldType.setNumericPrecisionStep(Integer.parseInt(types[1]));
}
break;
case DOUBLE:
fieldType=new FieldType(DoubleField.TYPE_STORED);
if (types.length > 1) {
fieldType.setNumericPrecisionStep(Integer.parseInt(types[1]));
}
break;
default :
fieldType=new FieldType(TextField.TYPE_STORED);
fieldType.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
fieldType.setOmitNorms(true);
break;
}
fieldTypes.put(fieldName,fieldType);
return t;
}
Program: 82463
Project: 82463
Buggy source:
@Override public void doit(PrintWriter out,Blur.Iface client,String[] args) throws CommandException, TException, BlurException {
  if (args.length != 2) {
    throw new CommandException("String_Node_Str" + help());
  }
  String tablename=args[1];
  List<String> tableList=client.tableList();
  if (tableList.contains(tablename)) {
    out.println("String_Node_Str");
    return;
  }
  TableDescriptor tableDescriptor=client.describe(tablename);
  if (tableDescriptor.isIsEnabled()) {
    out.println("String_Node_Str");
    out.flush();
    client.disableTable(tablename);
  }
  out.println("String_Node_Str");
  out.flush();
  client.removeTable(tablename,true);
  out.println("String_Node_Str");
  out.flush();
  client.createTable(tableDescriptor);
}

Fixed version (ground truth):
@Override public void doit(PrintWriter out,Blur.Iface client,String[] args) throws CommandException, TException, BlurException {
  if (args.length != 2) {
    throw new CommandException("String_Node_Str" + help());
  }
  String tablename=args[1];
  List<String> tableList=client.tableList();
  if (!tableList.contains(tablename)) {
    out.println("String_Node_Str");
    return;
  }
  TableDescriptor tableDescriptor=client.describe(tablename);
  if (tableDescriptor.isIsEnabled()) {
    out.println("String_Node_Str");
    out.flush();
    client.disableTable(tablename);
  }
  out.println("String_Node_Str");
  out.flush();
  client.removeTable(tablename,true);
  out.println("String_Node_Str");
  out.flush();
  client.createTable(tableDescriptor);
}
Program: 82465
Project: 82465
Buggy source:
@Override public Map<String,Map<String,ShardState>> shardServerLayoutState(String table) throws BlurException, TException {
  checkTable(_cluster,table);
  resetSearchers();
  try {
    Map<String,Map<String,ShardState>> result=new TreeMap<String,Map<String,ShardState>>();
    String nodeName=_indexServer.getNodeName();
    Map<String,ShardState> stateMap=_indexServer.getShardState(table);
    for (    Entry<String,ShardState> entry : stateMap.entrySet()) {
      result.put(entry.getKey(),newMap(nodeName,entry.getValue()));
    }
    return result;
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str" + table + "String_Node_Str",e);
    if (e instanceof BlurException) {
      throw (BlurException)e;
    }
    throw new BException(e.getMessage(),e);
  }
}

Fixed version (ground truth):
@Override public Map<String,Map<String,ShardState>> shardServerLayoutState(String table) throws BlurException, TException {
  resetSearchers();
  try {
    Map<String,Map<String,ShardState>> result=new TreeMap<String,Map<String,ShardState>>();
    String nodeName=_indexServer.getNodeName();
    Map<String,ShardState> stateMap=_indexServer.getShardState(table);
    for (    Entry<String,ShardState> entry : stateMap.entrySet()) {
      result.put(entry.getKey(),newMap(nodeName,entry.getValue()));
    }
    return result;
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str" + table + "String_Node_Str",e);
    if (e instanceof BlurException) {
      throw (BlurException)e;
    }
    throw new BException(e.getMessage(),e);
  }
}
Program: 82466
Project: 82466
Buggy source:
/** 
 * The work loop. Handles selecting (read/write IO), dispatching, and managing the selection preferences of all existing connections.
 */
public void run(){
  try {
    while (!stopped_) {
      select();
      processAcceptedConnections();
      processInterestChanges();
    }
    for (    SelectionKey selectionKey : selector.keys()) {
      cleanupSelectionKey(selectionKey);
    }
  }
 catch (  Throwable t) {
    LOGGER.error("String_Node_Str",t);
  }
 finally {
    TThreadedSelectorServer.this.stop();
  }
}

Fixed version (ground truth):
/** 
 * The work loop. Handles selecting (read/write IO), dispatching, and managing the selection preferences of all existing connections.
 */
public void run(){
  try {
    Thread thread=Thread.currentThread();
    if (thread.getName().startsWith("String_Node_Str")) {
      thread.setName("String_Node_Str" + selectorThreadCount++);
    }
    while (!stopped_) {
      select();
      processAcceptedConnections();
      processInterestChanges();
    }
    for (    SelectionKey selectionKey : selector.keys()) {
      cleanupSelectionKey(selectionKey);
    }
  }
 catch (  Throwable t) {
    LOGGER.error("String_Node_Str",t);
  }
 finally {
    TThreadedSelectorServer.this.stop();
  }
}
Program: 82467
Project: 82467
Buggy source:
public ZooKeeperClient(String connectString,int sessionTimeout,Watcher watcher,long sessionId,byte[] sessionPasswd) throws IOException {
  super(connectString,sessionTimeout,watcher,sessionId,sessionPasswd);
}

Fixed version (ground truth):
public ZooKeeperClient(String connectString,int sessionTimeout,Watcher watcher,long sessionId,byte[] sessionPasswd) throws IOException {
  super(connectString,sessionTimeout,watcher,sessionId,sessionPasswd);
  internalSessionTimeout=sessionTimeout;
}
Program: 82468
Project: 82468
Buggy source:
@Override public void abortTask(TaskAttemptContext context) throws IOException {
  setup(context);
  FileSystem fileSystem=_newIndex.getFileSystem(_configuration);
  fileSystem.delete(_indexPath,true);
}

Fixed version (ground truth):
@Override public void abortTask(TaskAttemptContext context) throws IOException {
  setup(context);
  FileSystem fileSystem=_newIndex.getFileSystem(_configuration);
  LOG.info("String_Node_Str",_newIndex);
  fileSystem.delete(_newIndex,true);
}
Program: 82469
Project: 82469
Buggy source:
private void setup(TaskAttemptContext context) throws IOException {
  _configuration=context.getConfiguration();
  TableDescriptor tableDescriptor=BlurOutputFormat.getTableDescriptor(_configuration);
  int shardCount=tableDescriptor.getShardCount();
  int attemptId=context.getTaskAttemptID().getTaskID().getId();
  int shardId=attemptId % shardCount;
  _taskAttemptID=context.getTaskAttemptID();
  Path tableOutput=BlurOutputFormat.getOutputPath(_configuration);
  String shardName=BlurUtil.getShardName(BlurConstants.SHARD_PREFIX,shardId);
  _indexPath=new Path(tableOutput,shardName);
  _newIndex=new Path(_indexPath,_taskAttemptID.toString() + "String_Node_Str");
}

Fixed version (ground truth):
private void setup(TaskAttemptContext context) throws IOException {
  _configuration=context.getConfiguration();
  _tableDescriptor=BlurOutputFormat.getTableDescriptor(_configuration);
  int shardCount=_tableDescriptor.getShardCount();
  int attemptId=context.getTaskAttemptID().getTaskID().getId();
  int shardId=attemptId % shardCount;
  _taskAttemptID=context.getTaskAttemptID();
  Path tableOutput=BlurOutputFormat.getOutputPath(_configuration);
  String shardName=BlurUtil.getShardName(BlurConstants.SHARD_PREFIX,shardId);
  _indexPath=new Path(tableOutput,shardName);
  _newIndex=new Path(_indexPath,_taskAttemptID.toString() + "String_Node_Str");
}
Program: 82470
Project: 82470
Buggy source:
@Override public void commitTask(TaskAttemptContext context) throws IOException {
  setup(context);
  FileSystem fileSystem=_newIndex.getFileSystem(_configuration);
  if (fileSystem.exists(_newIndex) && !fileSystem.isFile(_newIndex)) {
    fileSystem.rename(_newIndex,new Path(_indexPath,_taskAttemptID.toString() + "String_Node_Str"));
  }
 else {
    throw new IOException("String_Node_Str" + _newIndex + "String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void commitTask(TaskAttemptContext context) throws IOException {
  setup(context);
  FileSystem fileSystem=_newIndex.getFileSystem(_configuration);
  if (fileSystem.exists(_newIndex) && !fileSystem.isFile(_newIndex)) {
    Path dst=new Path(_indexPath,_taskAttemptID.toString() + "String_Node_Str");
    LOG.info("String_Node_Str",_newIndex,dst);
    fileSystem.rename(_newIndex,dst);
  }
 else {
    throw new IOException("String_Node_Str" + _newIndex + "String_Node_Str");
  }
}
Program: 82471
Project: 82471
Buggy source:
private void copyDir() throws IOException {
  CopyRateDirectory copyRateDirectory=new CopyRateDirectory(_finalDir,_copyRateCounter);
  String[] fileNames=_localDir.listAll();
  for (  String fileName : fileNames) {
    LOG.info("String_Node_Str",fileName);
    _localDir.copy(copyRateDirectory,fileName,fileName,IOContext.DEFAULT);
  }
  rm(_localPath);
}

Fixed version (ground truth):
private void copyDir() throws IOException {
  CopyRateDirectory copyRateDirectory=new CopyRateDirectory(_finalDir,_copyRateCounter);
  String[] fileNames=_localDir.listAll();
  for (  String fileName : fileNames) {
    LOG.info("String_Node_Str",fileName,_newIndex);
    _localDir.copy(copyRateDirectory,fileName,fileName,IOContext.DEFAULT);
  }
  rm(_localPath);
}
Program: 82472
Project: 82472
Buggy source:
public BlurRecordWriter(Configuration configuration,BlurAnalyzer blurAnalyzer,int attemptId,String tmpDirName) throws IOException {
  TableDescriptor tableDescriptor=BlurOutputFormat.getTableDescriptor(configuration);
  int shardCount=tableDescriptor.getShardCount();
  int shardId=attemptId % shardCount;
  _maxDocumentBufferSize=BlurOutputFormat.getMaxDocumentBufferSize(configuration);
  Path tableOutput=BlurOutputFormat.getOutputPath(configuration);
  String shardName=BlurUtil.getShardName(BlurConstants.SHARD_PREFIX,shardId);
  Path indexPath=new Path(tableOutput,shardName);
  Path newIndex=new Path(indexPath,tmpDirName);
  _finalDir=new ProgressableDirectory(new HdfsDirectory(configuration,newIndex),BlurOutputFormat.getProgressable());
  _finalDir.setLockFactory(NoLockFactory.getNoLockFactory());
  _analyzer=new BlurAnalyzer(tableDescriptor.getAnalyzerDefinition());
  _conf=new IndexWriterConfig(LuceneVersionConstant.LUCENE_VERSION,_analyzer);
  TieredMergePolicy mergePolicy=(TieredMergePolicy)_conf.getMergePolicy();
  mergePolicy.setUseCompoundFile(false);
  String localDirPath=System.getProperty(JAVA_IO_TMPDIR);
  _localPath=new File(localDirPath,UUID.randomUUID().toString() + "String_Node_Str");
  _localDir=new ProgressableDirectory(FSDirectory.open(_localPath),BlurOutputFormat.getProgressable());
  _writer=new IndexWriter(_localDir,_conf.clone());
}

Fixed version (ground truth):
public BlurRecordWriter(Configuration configuration,BlurAnalyzer blurAnalyzer,int attemptId,String tmpDirName) throws IOException {
  TableDescriptor tableDescriptor=BlurOutputFormat.getTableDescriptor(configuration);
  int shardCount=tableDescriptor.getShardCount();
  int shardId=attemptId % shardCount;
  _maxDocumentBufferSize=BlurOutputFormat.getMaxDocumentBufferSize(configuration);
  Path tableOutput=BlurOutputFormat.getOutputPath(configuration);
  String shardName=BlurUtil.getShardName(BlurConstants.SHARD_PREFIX,shardId);
  Path indexPath=new Path(tableOutput,shardName);
  _newIndex=new Path(indexPath,tmpDirName);
  _finalDir=new ProgressableDirectory(new HdfsDirectory(configuration,_newIndex),BlurOutputFormat.getProgressable());
  _finalDir.setLockFactory(NoLockFactory.getNoLockFactory());
  _analyzer=new BlurAnalyzer(tableDescriptor.getAnalyzerDefinition());
  _conf=new IndexWriterConfig(LuceneVersionConstant.LUCENE_VERSION,_analyzer);
  TieredMergePolicy mergePolicy=(TieredMergePolicy)_conf.getMergePolicy();
  mergePolicy.setUseCompoundFile(false);
  String localDirPath=System.getProperty(JAVA_IO_TMPDIR);
  _localPath=new File(localDirPath,UUID.randomUUID().toString() + "String_Node_Str");
  _localDir=new ProgressableDirectory(FSDirectory.open(_localPath),BlurOutputFormat.getProgressable());
  _writer=new IndexWriter(_localDir,_conf.clone());
}
Program: 82474
Project: 82474
Buggy source:
public void testBlurIndexWriterFaster() throws IOException, InterruptedException {
  setupWriter(configuration,100);
  IndexSearcherClosable searcher1=writer.getIndexReader();
  IndexReader reader1=searcher1.getIndexReader();
  assertEquals(0,reader1.numDocs());
  searcher1.close();
  long s=System.nanoTime();
  int total=0;
  for (int i=0; i < TEST_NUMBER; i++) {
    if (i == TEST_NUMBER - 1) {
      writer.replaceRow(true,true,genRow());
    }
 else {
      writer.replaceRow(false,true,genRow());
    }
    total++;
  }
  long e=System.nanoTime();
  double seconds=(e - s) / 1000000000.0;
  double rate=total / seconds;
  System.out.println("String_Node_Str" + rate);
  writer.refresh();
  IndexSearcherClosable searcher2=writer.getIndexReader();
  IndexReader reader2=searcher2.getIndexReader();
  assertEquals(TEST_NUMBER,reader2.numDocs());
  searcher2.close();
}

Fixed version (ground truth):
@Test public void testBlurIndexWriterFaster() throws IOException, InterruptedException {
  setupWriter(configuration,100);
  IndexSearcherClosable searcher1=writer.getIndexReader();
  IndexReader reader1=searcher1.getIndexReader();
  assertEquals(0,reader1.numDocs());
  searcher1.close();
  long s=System.nanoTime();
  int total=0;
  for (int i=0; i < TEST_NUMBER; i++) {
    if (i == TEST_NUMBER - 1) {
      writer.replaceRow(true,true,genRow());
    }
 else {
      writer.replaceRow(false,true,genRow());
    }
    total++;
  }
  long e=System.nanoTime();
  double seconds=(e - s) / 1000000000.0;
  double rate=total / seconds;
  System.out.println("String_Node_Str" + rate);
  writer.refresh();
  IndexSearcherClosable searcher2=writer.getIndexReader();
  IndexReader reader2=searcher2.getIndexReader();
  assertEquals(TEST_NUMBER,reader2.numDocs());
  searcher2.close();
}
Program: 82475
Project: 82475
Buggy source:
private void setupWriter(Configuration configuration,long refresh) throws IOException {
  TableDescriptor tableDescriptor=new TableDescriptor();
  tableDescriptor.setName("String_Node_Str");
  tableDescriptor.setTableUri(new File(base,"String_Node_Str" + UUID.randomUUID().toString()).toURI().toString());
  tableDescriptor.setAnalyzerDefinition(new AnalyzerDefinition());
  tableDescriptor.putToTableProperties("String_Node_Str",Long.toString(refresh));
  TableContext tableContext=TableContext.create(tableDescriptor);
  FSDirectory directory=FSDirectory.open(new File(base,"String_Node_Str" + UUID.randomUUID().toString()));
  ShardContext shardContext=ShardContext.create(tableContext,"String_Node_Str");
  writer=new BlurNRTIndex(shardContext,mergeScheduler,closer,directory,gc,service);
}

Fixed version (ground truth):
private void setupWriter(Configuration configuration,long refresh) throws IOException {
  TableDescriptor tableDescriptor=new TableDescriptor();
  tableDescriptor.setName("String_Node_Str");
  String uuid=UUID.randomUUID().toString();
  tableDescriptor.setTableUri(new File(base,"String_Node_Str" + uuid).toURI().toString());
  tableDescriptor.setAnalyzerDefinition(new AnalyzerDefinition());
  tableDescriptor.putToTableProperties("String_Node_Str",Long.toString(refresh));
  TableContext tableContext=TableContext.create(tableDescriptor);
  File path=new File(base,"String_Node_Str" + uuid);
  path.mkdirs();
  FSDirectory directory=FSDirectory.open(path);
  ShardContext shardContext=ShardContext.create(tableContext,"String_Node_Str" + uuid);
  writer=new BlurNRTIndex(shardContext,mergeScheduler,closer,directory,gc,service);
}
Program: 82476
Project: 82476
Buggy source:
@Override public void action(List<String> onlineShards){
  List<String> oldOnlineShards=_prevOnlineShards;
  _prevOnlineShards=onlineShards;
  _layoutManagers.clear();
  _layoutCache.clear();
  LOG.info("String_Node_Str");
  LOG.info("String_Node_Str");
  if (oldOnlineShards == null) {
    oldOnlineShards=new ArrayList<String>();
  }
  for (  String oldOnlineShard : oldOnlineShards) {
    if (!onlineShards.contains(oldOnlineShard)) {
      LOG.info("String_Node_Str",oldOnlineShard);
    }
  }
  for (  String onlineShard : onlineShards) {
    if (!oldOnlineShards.contains(onlineShard)) {
      LOG.info("String_Node_Str",onlineShard);
    }
  }
}

Fixed version (ground truth):
@Override public void action(List<String> onlineShards){
  List<String> oldOnlineShards=_prevOnlineShards;
  _prevOnlineShards=onlineShards;
  _layoutManagers.clear();
  _layoutCache.clear();
  LOG.info("String_Node_Str");
  if (oldOnlineShards == null) {
    oldOnlineShards=new ArrayList<String>();
  }
  for (  String oldOnlineShard : oldOnlineShards) {
    if (!onlineShards.contains(oldOnlineShard)) {
      LOG.info("String_Node_Str",oldOnlineShard);
    }
  }
  for (  String onlineShard : onlineShards) {
    if (!oldOnlineShards.contains(onlineShard)) {
      LOG.info("String_Node_Str",onlineShard);
    }
  }
}
Program: 82477
Project: 82477
Buggy source:
private void watchForShardServerChanges(){
  ZookeeperPathConstants.getOnlineShardsPath(_cluster);
  _watchOnlineShards=new WatchChildren(_zookeeper,ZookeeperPathConstants.getOnlineShardsPath(_cluster)).watch(new OnChange(){
    private List<String> _prevOnlineShards=new ArrayList<String>();
    @Override public void action(    List<String> onlineShards){
      List<String> oldOnlineShards=_prevOnlineShards;
      _prevOnlineShards=onlineShards;
      _layoutManagers.clear();
      _layoutCache.clear();
      LOG.info("String_Node_Str");
      LOG.info("String_Node_Str");
      if (oldOnlineShards == null) {
        oldOnlineShards=new ArrayList<String>();
      }
      for (      String oldOnlineShard : oldOnlineShards) {
        if (!onlineShards.contains(oldOnlineShard)) {
          LOG.info("String_Node_Str",oldOnlineShard);
        }
      }
      for (      String onlineShard : onlineShards) {
        if (!oldOnlineShards.contains(onlineShard)) {
          LOG.info("String_Node_Str",onlineShard);
        }
      }
    }
  }
);
}

Fixed version (ground truth):
private void watchForShardServerChanges(){
  ZookeeperPathConstants.getOnlineShardsPath(_cluster);
  _watchOnlineShards=new WatchChildren(_zookeeper,ZookeeperPathConstants.getOnlineShardsPath(_cluster)).watch(new OnChange(){
    private List<String> _prevOnlineShards=new ArrayList<String>();
    @Override public void action(    List<String> onlineShards){
      List<String> oldOnlineShards=_prevOnlineShards;
      _prevOnlineShards=onlineShards;
      _layoutManagers.clear();
      _layoutCache.clear();
      LOG.info("String_Node_Str");
      if (oldOnlineShards == null) {
        oldOnlineShards=new ArrayList<String>();
      }
      for (      String oldOnlineShard : oldOnlineShards) {
        if (!onlineShards.contains(oldOnlineShard)) {
          LOG.info("String_Node_Str",oldOnlineShard);
        }
      }
      for (      String onlineShard : onlineShards) {
        if (!oldOnlineShards.contains(onlineShard)) {
          LOG.info("String_Node_Str",onlineShard);
        }
      }
    }
  }
);
}
Program: 82479
Project: 82479
Buggy source:
public WatchNodeData watch(final OnChange onChange){
  _watchThread=new Thread(new Runnable(){
    @Override public void run(){
      startDoubleCheckThread();
      while (_running.get()) {
synchronized (_lock) {
          try {
            Stat stat=_zooKeeper.exists(_path,false);
            if (stat == null) {
              LOG.debug("String_Node_Str",_path);
              return;
            }
            Watcher watcher=new Watcher(){
              @Override public void process(              WatchedEvent event){
synchronized (_lock) {
                  _lock.notify();
                }
              }
            }
;
            _data=_zooKeeper.getData(_path,watcher,stat);
            onChange.action(_data);
            _lock.wait();
          }
 catch (          KeeperException e) {
            if (!_running.get()) {
              LOG.info("String_Node_Str",e.getMessage());
              return;
            }
            LOG.error("String_Node_Str",e);
            throw new RuntimeException(e);
          }
catch (          InterruptedException e) {
            return;
          }
        }
      }
    }
  }
);
  _watchThread.setName("String_Node_Str" + _path + "String_Node_Str"+ instance+ "String_Node_Str");
  _watchThread.setDaemon(true);
  _watchThread.start();
  return this;
}

Fixed version (ground truth):
public WatchNodeData watch(final OnChange onChange){
  _watchThread=new Thread(new Runnable(){
    @Override public void run(){
      Watcher watcher=new Watcher(){
        @Override public void process(        WatchedEvent event){
synchronized (_lock) {
            _lock.notify();
          }
        }
      }
;
      startDoubleCheckThread();
      while (_running.get()) {
synchronized (_lock) {
          try {
            Stat stat=_zooKeeper.exists(_path,false);
            if (stat == null) {
              LOG.debug("String_Node_Str",_path);
              return;
            }
            _data=_zooKeeper.getData(_path,watcher,stat);
            onChange.action(_data);
            _lock.wait();
          }
 catch (          KeeperException e) {
            if (!_running.get()) {
              LOG.info("String_Node_Str",e.getMessage());
              return;
            }
            LOG.error("String_Node_Str",e);
            throw new RuntimeException(e);
          }
catch (          InterruptedException e) {
            return;
          }
        }
      }
    }
  }
);
  _watchThread.setName("String_Node_Str" + _path + "String_Node_Str"+ instance+ "String_Node_Str");
  _watchThread.setDaemon(true);
  _watchThread.start();
  return this;
}
Program: 82480
Project: 82480
Buggy source:
public WatchNodeExistance watch(final OnChange onChange){
  _watchThread=new Thread(new Runnable(){
    @Override public void run(){
      startDoubleCheckThread();
      while (_running.get()) {
synchronized (_lock) {
          try {
            Watcher watcher=new Watcher(){
              @Override public void process(              WatchedEvent event){
synchronized (_lock) {
                  _lock.notify();
                }
              }
            }
;
            _stat=_zooKeeper.exists(_path,watcher);
            onChange.action(_stat);
            _lock.wait();
          }
 catch (          KeeperException e) {
            if (!_running.get()) {
              LOG.info("String_Node_Str",e.getMessage());
              return;
            }
            LOG.error("String_Node_Str",e);
            throw new RuntimeException(e);
          }
catch (          InterruptedException e) {
            return;
          }
        }
      }
    }
  }
);
  _watchThread.setName("String_Node_Str" + _path + "String_Node_Str"+ instance+ "String_Node_Str");
  _watchThread.setDaemon(true);
  _watchThread.start();
  return this;
}

Fixed version (ground truth):
public WatchNodeExistance watch(final OnChange onChange){
  _watchThread=new Thread(new Runnable(){
    @Override public void run(){
      Watcher watcher=new Watcher(){
        @Override public void process(        WatchedEvent event){
synchronized (_lock) {
            _lock.notify();
          }
        }
      }
;
      startDoubleCheckThread();
      while (_running.get()) {
synchronized (_lock) {
          try {
            _stat=_zooKeeper.exists(_path,watcher);
            onChange.action(_stat);
            _lock.wait();
          }
 catch (          KeeperException e) {
            if (!_running.get()) {
              LOG.info("String_Node_Str",e.getMessage());
              return;
            }
            LOG.error("String_Node_Str",e);
            throw new RuntimeException(e);
          }
catch (          InterruptedException e) {
            return;
          }
        }
      }
    }
  }
);
  _watchThread.setName("String_Node_Str" + _path + "String_Node_Str"+ instance+ "String_Node_Str");
  _watchThread.setDaemon(true);
  _watchThread.start();
  return this;
}