nus-yam/ex-repair huggingface dataset:
Program: 155893
Project: 155893
Buggy source:
@Test(expectedExceptions=UnsupportedOperationException.class) public void shouldThrowOnGetSubtableDefinitionFromSubtable(){
  Table persons=new Table();
  persons.addColumn(ColumnType.STRING,"String_Node_Str");
  persons.addColumn(ColumnType.STRING,"String_Node_Str");
  persons.addColumn(ColumnType.TABLE,"String_Node_Str");
  TableDefinition addresses=persons.getSubTableDefinition(2);
  addresses.addColumn(ColumnType.STRING,"String_Node_Str");
  addresses.addColumn(ColumnType.INTEGER,"String_Node_Str");
  addresses.addColumn(ColumnType.TABLE,"String_Node_Str");
  TableDefinition phone_numbers=addresses.getSubTableDefinition(2);
  phone_numbers.addColumn(ColumnType.INTEGER,"String_Node_Str");
  persons.add(new Object[]{"String_Node_Str","String_Node_Str",new Object[][]{{"String_Node_Str",1234,new Object[][]{{12345678}}}}});
  persons.getSubTable(2,0).getSubTableDefinition(2);
}

Fixed version (ground truth):
@Test(expectedExceptions=UnsupportedOperationException.class) public void shouldThrowOnGetSubtableDefinitionFromSubtable(){
  Table persons=new Table();
  persons.addColumn(ColumnType.ColumnTypeString,"String_Node_Str");
  persons.addColumn(ColumnType.ColumnTypeString,"String_Node_Str");
  persons.addColumn(ColumnType.ColumnTypeTable,"String_Node_Str");
  TableDefinition addresses=persons.getSubTableDefinition(2);
  addresses.addColumn(ColumnType.ColumnTypeString,"String_Node_Str");
  addresses.addColumn(ColumnType.ColumnTypeInt,"String_Node_Str");
  addresses.addColumn(ColumnType.ColumnTypeTable,"String_Node_Str");
  TableDefinition phone_numbers=addresses.getSubTableDefinition(2);
  phone_numbers.addColumn(ColumnType.ColumnTypeInt,"String_Node_Str");
  persons.add(new Object[]{"String_Node_Str","String_Node_Str",new Object[][]{{"String_Node_Str",1234,new Object[][]{{12345678}}}}});
  persons.getSubTable(2,0).getSubTableDefinition(2);
}
Program: 155894
Project: 155894
Buggy source:
@Test(expectedExceptions=UnsupportedOperationException.class) public void shouldThrowOnAddColumnFromSubtable(){
  Table persons=new Table();
  persons.addColumn(ColumnType.STRING,"String_Node_Str");
  persons.addColumn(ColumnType.STRING,"String_Node_Str");
  persons.addColumn(ColumnType.TABLE,"String_Node_Str");
  TableDefinition addresses=persons.getSubTableDefinition(2);
  addresses.addColumn(ColumnType.STRING,"String_Node_Str");
  addresses.addColumn(ColumnType.INTEGER,"String_Node_Str");
  addresses.addColumn(ColumnType.TABLE,"String_Node_Str");
  TableDefinition phone_numbers=addresses.getSubTableDefinition(2);
  phone_numbers.addColumn(ColumnType.INTEGER,"String_Node_Str");
  persons.add(new Object[]{"String_Node_Str","String_Node_Str",new Object[][]{{"String_Node_Str",1234,new Object[][]{{12345678}}}}});
  persons.getSubTable(2,0).addColumn(ColumnType.INTEGER,"String_Node_Str");
}

Fixed version (ground truth):
@Test(expectedExceptions=UnsupportedOperationException.class) public void shouldThrowOnAddColumnFromSubtable(){
  Table persons=new Table();
  persons.addColumn(ColumnType.ColumnTypeString,"String_Node_Str");
  persons.addColumn(ColumnType.ColumnTypeString,"String_Node_Str");
  persons.addColumn(ColumnType.ColumnTypeTable,"String_Node_Str");
  TableDefinition addresses=persons.getSubTableDefinition(2);
  addresses.addColumn(ColumnType.ColumnTypeString,"String_Node_Str");
  addresses.addColumn(ColumnType.ColumnTypeInt,"String_Node_Str");
  addresses.addColumn(ColumnType.ColumnTypeTable,"String_Node_Str");
  TableDefinition phone_numbers=addresses.getSubTableDefinition(2);
  phone_numbers.addColumn(ColumnType.ColumnTypeInt,"String_Node_Str");
  persons.add(new Object[]{"String_Node_Str","String_Node_Str",new Object[][]{{"String_Node_Str",1234,new Object[][]{{12345678}}}}});
  persons.getSubTable(2,0).addColumn(ColumnType.ColumnTypeInt,"String_Node_Str");
}
Program: 155895
Project: 155895
Buggy source:
@Test public void removeColumnFromSubtable(){
  Table persons=new Table();
  persons.addColumn(ColumnType.STRING,"String_Node_Str");
  persons.addColumn(ColumnType.STRING,"String_Node_Str");
  persons.addColumn(ColumnType.TABLE,"String_Node_Str");
  TableDefinition addresses=persons.getSubTableDefinition(2);
  addresses.addColumn(ColumnType.STRING,"String_Node_Str");
  addresses.addColumn(ColumnType.INTEGER,"String_Node_Str");
  addresses.addColumn(ColumnType.TABLE,"String_Node_Str");
  TableDefinition phone_numbers=addresses.getSubTableDefinition(2);
  phone_numbers.addColumn(ColumnType.INTEGER,"String_Node_Str");
  persons.add(new Object[]{"String_Node_Str","String_Node_Str",new Object[][]{{"String_Node_Str",1234,new Object[][]{{12345678}}}}});
  assertEquals(persons.getSubTable(2,0).getColumnCount(),3);
  addresses.removeColumn(1);
  assertEquals(persons.getSubTable(2,0).getColumnCount(),2);
}

Fixed version (ground truth):
@Test public void removeColumnFromSubtable(){
  Table persons=new Table();
  persons.addColumn(ColumnType.ColumnTypeString,"String_Node_Str");
  persons.addColumn(ColumnType.ColumnTypeString,"String_Node_Str");
  persons.addColumn(ColumnType.ColumnTypeTable,"String_Node_Str");
  TableDefinition addresses=persons.getSubTableDefinition(2);
  addresses.addColumn(ColumnType.ColumnTypeString,"String_Node_Str");
  addresses.addColumn(ColumnType.ColumnTypeInt,"String_Node_Str");
  addresses.addColumn(ColumnType.ColumnTypeTable,"String_Node_Str");
  TableDefinition phone_numbers=addresses.getSubTableDefinition(2);
  phone_numbers.addColumn(ColumnType.ColumnTypeInt,"String_Node_Str");
  persons.add(new Object[]{"String_Node_Str","String_Node_Str",new Object[][]{{"String_Node_Str",1234,new Object[][]{{12345678}}}}});
  assertEquals(persons.getSubTable(2,0).getColumnCount(),3);
  addresses.removeColumn(1);
  assertEquals(persons.getSubTable(2,0).getColumnCount(),2);
}
Program: 155896
Project: 155896
Buggy source:
@Test public void renameColumnInSubtable(){
  Table persons=new Table();
  persons.addColumn(ColumnType.STRING,"String_Node_Str");
  persons.addColumn(ColumnType.STRING,"String_Node_Str");
  persons.addColumn(ColumnType.TABLE,"String_Node_Str");
  TableDefinition addresses=persons.getSubTableDefinition(2);
  addresses.addColumn(ColumnType.STRING,"String_Node_Str");
  addresses.addColumn(ColumnType.INTEGER,"String_Node_Str");
  addresses.addColumn(ColumnType.TABLE,"String_Node_Str");
  TableDefinition phone_numbers=addresses.getSubTableDefinition(2);
  phone_numbers.addColumn(ColumnType.INTEGER,"String_Node_Str");
  persons.add(new Object[]{"String_Node_Str","String_Node_Str",new Object[][]{{"String_Node_Str",1234,new Object[][]{{12345678}}}}});
  assertEquals("String_Node_Str",persons.getSubTable(2,0).getColumnName(1));
  addresses.renameColumn(1,"String_Node_Str");
  assertEquals("String_Node_Str",persons.getSubTable(2,0).getColumnName(1));
}

Fixed version (ground truth):
@Test public void renameColumnInSubtable(){
  Table persons=new Table();
  persons.addColumn(ColumnType.ColumnTypeString,"String_Node_Str");
  persons.addColumn(ColumnType.ColumnTypeString,"String_Node_Str");
  persons.addColumn(ColumnType.ColumnTypeTable,"String_Node_Str");
  TableDefinition addresses=persons.getSubTableDefinition(2);
  addresses.addColumn(ColumnType.ColumnTypeString,"String_Node_Str");
  addresses.addColumn(ColumnType.ColumnTypeInt,"String_Node_Str");
  addresses.addColumn(ColumnType.ColumnTypeTable,"String_Node_Str");
  TableDefinition phone_numbers=addresses.getSubTableDefinition(2);
  phone_numbers.addColumn(ColumnType.ColumnTypeInt,"String_Node_Str");
  persons.add(new Object[]{"String_Node_Str","String_Node_Str",new Object[][]{{"String_Node_Str",1234,new Object[][]{{12345678}}}}});
  assertEquals("String_Node_Str",persons.getSubTable(2,0).getColumnName(1));
  addresses.renameColumn(1,"String_Node_Str");
  assertEquals("String_Node_Str",persons.getSubTable(2,0).getColumnName(1));
}
Program: 155897
Project: 155897
Buggy source:
@Test public void addColumnsToSubtables(){
  Table persons=new Table();
  persons.addColumn(ColumnType.STRING,"String_Node_Str");
  persons.addColumn(ColumnType.STRING,"String_Node_Str");
  persons.addColumn(ColumnType.TABLE,"String_Node_Str");
  TableDefinition addresses=persons.getSubTableDefinition(2);
  addresses.addColumn(ColumnType.STRING,"String_Node_Str");
  addresses.addColumn(ColumnType.INTEGER,"String_Node_Str");
  addresses.addColumn(ColumnType.TABLE,"String_Node_Str");
  TableDefinition phone_numbers=addresses.getSubTableDefinition(2);
  phone_numbers.addColumn(ColumnType.INTEGER,"String_Node_Str");
  persons.add(new Object[]{"String_Node_Str","String_Node_Str",new Object[][]{{"String_Node_Str",1234,new Object[][]{{12345678}}}}});
  assertEquals(persons.getColumnName(2),"String_Node_Str");
  assertEquals(persons.getSubTable(2,0).getColumnName(2),"String_Node_Str");
  assertEquals(persons.getSubTable(2,0).getSubTable(2,0).getColumnName(0),"String_Node_Str");
  assertEquals(persons.getString(1,0),"String_Node_Str");
  assertEquals(persons.getSubTable(2,0).getString(0,0),"String_Node_Str");
  assertEquals(persons.getSubTable(2,0).getSubTable(2,0).getLong(0,0),12345678);
}

Fixed version (ground truth):
@Test public void addColumnsToSubtables(){
  Table persons=new Table();
  persons.addColumn(ColumnType.ColumnTypeString,"String_Node_Str");
  persons.addColumn(ColumnType.ColumnTypeString,"String_Node_Str");
  persons.addColumn(ColumnType.ColumnTypeTable,"String_Node_Str");
  TableDefinition addresses=persons.getSubTableDefinition(2);
  addresses.addColumn(ColumnType.ColumnTypeString,"String_Node_Str");
  addresses.addColumn(ColumnType.ColumnTypeInt,"String_Node_Str");
  addresses.addColumn(ColumnType.ColumnTypeTable,"String_Node_Str");
  TableDefinition phone_numbers=addresses.getSubTableDefinition(2);
  phone_numbers.addColumn(ColumnType.ColumnTypeInt,"String_Node_Str");
  persons.add(new Object[]{"String_Node_Str","String_Node_Str",new Object[][]{{"String_Node_Str",1234,new Object[][]{{12345678}}}}});
  assertEquals(persons.getColumnName(2),"String_Node_Str");
  assertEquals(persons.getSubTable(2,0).getColumnName(2),"String_Node_Str");
  assertEquals(persons.getSubTable(2,0).getSubTable(2,0).getColumnName(0),"String_Node_Str");
  assertEquals(persons.getString(1,0),"String_Node_Str");
  assertEquals(persons.getSubTable(2,0).getString(0,0),"String_Node_Str");
  assertEquals(persons.getSubTable(2,0).getSubTable(2,0).getLong(0,0),12345678);
}
Program: 155898
Project: 155898
Buggy source:
public static boolean versionCompatible(){
  return (nativeGetVersion() == REQUIRED_JNI_VERSION);
}

Fixed version (ground truth):
public static boolean versionCompatible(){
  boolean compatible=(nativeGetVersion() == REQUIRED_JNI_VERSION);
  if (!compatible)   System.err.println("String_Node_Str" + nativeGetVersion() + "String_Node_Str"+ REQUIRED_JNI_VERSION+ "String_Node_Str");
  return compatible;
}
Program: 155899
Project: 155899
Buggy source:
public T next(){
  if (hasNext() == false) {
    throw new NoSuchElementException();
  }
  return (T)tableOrView.at(index++);
}

Fixed version (ground truth):
public T next(){
  if (hasNext() == false) {
    throw new NoSuchElementException();
  }
  return tableOrView.at(index++);
}
Program: 155900
Project: 155900
Buggy source:
public static void addNativeLibraryPath(String path){
  try {
    System.setProperty(JAVA_LIBRARY_PATH,System.getProperty(JAVA_LIBRARY_PATH) + System.getProperty("String_Node_Str") + path+ System.getProperty("String_Node_Str"));
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public static void addNativeLibraryPath(String path){
  try {
    String libraryPath=System.getProperty(JAVA_LIBRARY_PATH) + PATH_SEP + path+ PATH_SEP;
    System.setProperty(JAVA_LIBRARY_PATH,libraryPath);
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 155901
Project: 155901
Buggy source:
/** 
 * Checks whether this table is empty or not.
 * @return true if empty, otherwise false.
 */
public boolean isEmpty(){
  return nativeSize(nativePtr) != 0;
}

Fixed version (ground truth):
/** 
 * Checks whether this table is empty or not.
 * @return true if empty, otherwise false.
 */
public boolean isEmpty(){
  return size() == 0;
}
Program: 155903
Project: 155903
Buggy source:
private String calculatePackageName(TypeElement model){
  Element parent=model.getEnclosingElement();
  while (parent != null && !(parent instanceof PackageElement)) {
    parent=parent.getEnclosingElement();
  }
  if (parent instanceof PackageElement) {
    PackageElement pkg=(PackageElement)parent;
    String pkgName=pkg.getQualifiedName().toString();
    return pkgName.isEmpty() ? "String_Node_Str" : pkgName + "String_Node_Str";
  }
 else {
    logger.error("String_Node_Str" + DEFAULT_PACKAGE);
    return DEFAULT_PACKAGE;
  }
}

Fixed version (ground truth):
private String calculatePackageName(TypeElement model){
  Element parent=model.getEnclosingElement();
  while (parent != null && !(parent instanceof PackageElement)) {
    parent=parent.getEnclosingElement();
  }
  if (parent instanceof PackageElement) {
    PackageElement pkg=(PackageElement)parent;
    String pkgName=pkg.getQualifiedName().toString();
    return pkgName.isEmpty() ? "String_Node_Str" : pkgName;
  }
 else {
    logger.error("String_Node_Str" + DEFAULT_PACKAGE);
    return DEFAULT_PACKAGE;
  }
}
Program: 155904
Project: 155904
Buggy source:
protected void writeToSourceFile(String pkg,String filename,String content,Element... originatingElements){
  Writer writer=null;
  try {
    String name=pkg + "String_Node_Str" + filename;
    logger.info("String_Node_Str" + name);
    FileObject fileRes=filer.createSourceFile(name,originatingElements);
    writer=fileRes.openWriter();
    writer.write(content);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + filename);
    throw new RuntimeException("String_Node_Str" + filename,e);
  }
 finally {
    if (writer != null) {
      try {
        writer.close();
      }
 catch (      IOException e) {
        logger.error("String_Node_Str" + filename);
        throw new RuntimeException("String_Node_Str" + filename,e);
      }
    }
  }
}

Fixed version (ground truth):
protected void writeToSourceFile(String pkg,String filename,String content,Element... originatingElements){
  Writer writer=null;
  try {
    String name=!pkg.isEmpty() ? pkg + "String_Node_Str" + filename : filename;
    logger.info("String_Node_Str" + name);
    FileObject fileRes=filer.createSourceFile(name,originatingElements);
    writer=fileRes.openWriter();
    writer.write(content);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + filename);
    throw new RuntimeException("String_Node_Str" + filename,e);
  }
 finally {
    if (writer != null) {
      try {
        writer.close();
      }
 catch (      IOException e) {
        logger.error("String_Node_Str" + filename);
        throw new RuntimeException("String_Node_Str" + filename,e);
      }
    }
  }
}
Program: 155905
Project: 155905
Buggy source:
private String calculatePackageName(TypeElement model){
  Element parent=model.getEnclosingElement();
  while (parent != null && !(parent instanceof PackageElement)) {
    parent=parent.getEnclosingElement();
  }
  if (parent instanceof PackageElement) {
    PackageElement pkg=(PackageElement)parent;
    return pkg.getQualifiedName() + "String_Node_Str";
  }
 else {
    logger.error("String_Node_Str" + DEFAULT_PACKAGE);
    return DEFAULT_PACKAGE;
  }
}

Fixed version (ground truth):
private String calculatePackageName(TypeElement model){
  Element parent=model.getEnclosingElement();
  while (parent != null && !(parent instanceof PackageElement)) {
    parent=parent.getEnclosingElement();
  }
  if (parent instanceof PackageElement) {
    PackageElement pkg=(PackageElement)parent;
    String pkgName=pkg.getQualifiedName().toString();
    return pkgName.isEmpty() ? "String_Node_Str" : pkgName + "String_Node_Str";
  }
 else {
    logger.error("String_Node_Str" + DEFAULT_PACKAGE);
    return DEFAULT_PACKAGE;
  }
}
Program: 155907
Project: 155907
Buggy source:
public String getSpecFields(TypeElement model,File sourcePath){
  String modelName=model.toString();
  File sourceFile=findSourceFile(sourcePath,modelName);
  if (sourceFile == null) {
    logger.error("String_Node_Str");
    return null;
  }
  logger.info("String_Node_Str" + sourceFile);
  String source;
  try {
    source=FileUtils.readFileToString(sourceFile);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + sourceFile);
    return null;
  }
  Matcher m=Pattern.compile("String_Node_Str" + model.getSimpleName() + "String_Node_Str").matcher(source);
  if (m.find()) {
    String specSource=m.group(1).trim();
    return specSource;
  }
 else {
    logger.error("String_Node_Str" + model.getSimpleName());
    return null;
  }
}

Fixed version (ground truth):
public String getSpecFields(TypeElement model,File sourcePath){
  String modelName=model.toString();
  File sourceFile=findSourceFile(sourcePath,modelName);
  if (sourceFile == null) {
    logger.error("String_Node_Str");
    return null;
  }
  logger.info("String_Node_Str" + sourceFile);
  String source;
  try {
    source=FileUtils.readFileToString(sourceFile);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + sourceFile);
    return null;
  }
  String spec=specMatcher.matchSpec(model.getSimpleName().toString(),source);
  if (spec == null) {
    logger.error("String_Node_Str" + modelName);
  }
  return spec;
}
Program: 155908
Project: 155908
Buggy source:
private File findSourceFile(File sourcePath,String modelName){
  String[] modelNameParts=modelName.split("String_Node_Str");
  for (  String part : modelNameParts) {
    File path=new File(sourcePath.getAbsolutePath() + File.separator + part);
    if (path.isDirectory()) {
      sourcePath=path;
    }
 else {
      File sourceFile=new File(path.getAbsolutePath() + "String_Node_Str");
      if (sourceFile.exists() && sourceFile.isFile()) {
        return sourceFile;
      }
 else {
        logger.error("String_Node_Str" + sourceFile);
        return null;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private File findSourceFile(File sourcePath,String modelName){
  String[] modelNameParts=modelName.split("String_Node_Str");
  for (  String part : modelNameParts) {
    File path=new File(sourcePath.getAbsolutePath() + File.separator + part);
    if (path.isDirectory()) {
      sourcePath=path;
    }
 else {
      File sourceFile=new File(path.getAbsolutePath() + "String_Node_Str");
      if (sourceFile.exists() && sourceFile.isFile()) {
        return sourceFile;
      }
 else {
        logger.warn("String_Node_Str" + sourceFile);
        return scanSourcePath(sourcePath,modelNameParts[modelNameParts.length - 1]);
      }
    }
  }
  return null;
}
Program: 155909
Project: 155909
Buggy source:
public TableSpecReader(AnnotationProcessingLogger logger){
  this.logger=logger;
}

Fixed version (ground truth):
public TableSpecReader(AnnotationProcessingLogger logger){
  this.logger=logger;
  this.specMatcher=new SpecMatcher(logger);
}
Program: 155910
Project: 155910
Buggy source:
private List<VariableElement> getFields(Element element){
  List<VariableElement> fields=new ArrayList<VariableElement>();
  List<? extends Element> dd=elementUtils.getAllMembers((TypeElement)element);
  for (  Element e : dd) {
    info("String_Node_Str" + e.getSimpleName());
  }
  for (  Element enclosedElement : element.getEnclosedElements()) {
    if (enclosedElement.getKind().equals(ElementKind.FIELD)) {
      info("String_Node_Str" + enclosedElement.getSimpleName());
      if (enclosedElement instanceof VariableElement) {
        VariableElement field=(VariableElement)enclosedElement;
        fields.add(field);
      }
    }
  }
  return fields;
}

Fixed version (ground truth):
private List<VariableElement> getFields(Element element){
  List<VariableElement> fields=new ArrayList<VariableElement>();
  for (  Element enclosedElement : element.getEnclosedElements()) {
    if (enclosedElement.getKind().equals(ElementKind.FIELD)) {
      if (enclosedElement instanceof VariableElement) {
        VariableElement field=(VariableElement)enclosedElement;
        fields.add(field);
      }
    }
  }
  return fields;
}
Program: 155911
Project: 155911
Buggy source:
@Override public void processAnnotations(Set<? extends TypeElement> annotations,RoundEnvironment env) throws Exception {
  for (  TypeElement annotation : annotations) {
    String annotationName=annotation.getQualifiedName().toString();
    if (annotationName.equals(Table.class.getCanonicalName())) {
      Set<? extends Element> elements=env.getElementsAnnotatedWith(annotation);
      processAnnotatedElements(elements);
    }
 else {
      warn("String_Node_Str" + annotationName);
    }
  }
}

Fixed version (ground truth):
@Override public void processAnnotations(Set<? extends TypeElement> annotations,RoundEnvironment env) throws Exception {
  fieldSorter=new FieldSorter(logger);
  for (  TypeElement annotation : annotations) {
    String annotationName=annotation.getQualifiedName().toString();
    if (annotationName.equals(Table.class.getCanonicalName())) {
      Set<? extends Element> elements=env.getElementsAnnotatedWith(annotation);
      processAnnotatedElements(elements);
    }
 else {
      logger.warn("String_Node_Str" + annotationName);
    }
  }
}
Program: 155913
Project: 155913
Buggy source:
private String getAdjustedFieldType(VariableElement field){
  String type=fieldType(field);
  if (NUM_TYPES.contains(type)) {
    type="String_Node_Str";
  }
 else   if (type.equals("String_Node_Str")) {
    type="String_Node_Str";
  }
  return type;
}

Fixed version (ground truth):
private String getAdjustedFieldType(VariableElement field){
  String type=fieldType(field);
  if (NUM_TYPES.contains(type)) {
    type="String_Node_Str";
  }
 else   if (type.equals("String_Node_Str")) {
    type="String_Node_Str";
  }
 else   if (type.equals("String_Node_Str")) {
    type="String_Node_Str";
  }
  return type;
}
Program: 155914
Project: 155914
Buggy source:
private void prepareTables(Set<? extends Element> elements){
  for (  Element element : elements) {
    if (element instanceof TypeElement) {
      TypeElement model=(TypeElement)element;
      String name=model.getQualifiedName().toString();
      if (isReferencedBy(model,elements)) {
        info("String_Node_Str" + name);
        subtables.put(name,model);
      }
 else {
        info("String_Node_Str" + name);
        tables.put(name,model);
      }
    }
  }
}

Fixed version (ground truth):
private void prepareTables(Set<? extends Element> elements){
  for (  Element element : elements) {
    if (element instanceof TypeElement) {
      TypeElement model=(TypeElement)element;
      String name=model.getQualifiedName().toString();
      if (isReferencedBy(model,elements)) {
        logger.info("String_Node_Str" + name);
        subtables.put(name,model);
      }
 else {
        logger.info("String_Node_Str" + name);
        tables.put(name,model);
      }
    }
  }
}
Program: 155916
Project: 155916
Buggy source:
@Test(dataProvider="String_Node_Str") public void shouldStoreValuesOfMixedType(MixedData value1,MixedData value2,MixedData value3) throws Exception {
  TableBase table=new TableBase();
  TableSpec tableSpec=new TableSpec();
  tableSpec.addColumn(ColumnType.ColumnTypeMixed,"String_Node_Str");
  table.updateFromSpec(tableSpec);
  table.insertMixed(0,0,Mixed.mixedValue(value1.value));
  table.insertDone();
  checkMixedCell(table,0,0,value1.type,value1.value);
  table.setMixed(0,0,Mixed.mixedValue(value2.value));
  checkMixedCell(table,0,0,value2.type,value2.value);
  table.setMixed(0,0,Mixed.mixedValue(value3.value));
  checkMixedCell(table,0,0,value3.type,value3.value);
}

Fixed version (ground truth):
@Test(dataProvider="String_Node_Str") public void shouldStoreValuesOfMixedType(MixedData value1,MixedData value2,MixedData value3) throws Exception {
  TableBase table=new TableBase();
  TableSpec tableSpec=new TableSpec();
  tableSpec.addColumn(ColumnType.ColumnTypeMixed,"String_Node_Str");
  table.updateFromSpec(tableSpec);
  table.insertMixed(0,0,Mixed.mixedValue(value1.value));
  table.insertDone();
  checkMixedCell(table,0,0,value1.type,value1.value);
  table.setMixed(0,0,Mixed.mixedValue(value2.value));
  checkMixedCell(table,0,0,value2.type,value2.value);
  table.setMixed(0,0,Mixed.mixedValue(value3.value));
  checkMixedCell(table,0,0,value3.type,value3.value);
  table.close();
}
Program: 155917
Project: 155917
Buggy source:
public static TestResult TestPerformance(IPerformance test,int rows){
  TestResult result=new TestResult();
  Timer timer=new Timer();
  int testNo=0;
  long memBefore=Util.getUsedMemory();
  memBefore=Util.getUsedMemory();
  test.buildTable(rows);
  result.javaDBMemUsed=Math.max(Util.getUsedMemory() - memBefore,1);
  result.nativeDBMemUsed=test.usedNativeMemory();
{
    test.begin_findSmallInt(SMALL_TEST_VAL + 1);
    timer.Start();
    for (int i=0; i < REPEAT_SEARCH; ++i) {
      if (test.findSmallInt(SMALL_TEST_VAL + 1)) {
        System.out.println("String_Node_Str");
        break;
      }
    }
    result.testTime[testNo++]=timer.GetTimeInMs();
    test.end_findSmallInt();
    System.out.printf("String_Node_Str");
  }
{
    test.begin_findByteInt(BYTE_TEST_VAL + 1);
    timer.Start();
    for (int i=0; i < REPEAT_SEARCH; ++i) {
      if (test.findByteInt(BYTE_TEST_VAL + 1)) {
        System.out.printf("String_Node_Str");
        break;
      }
    }
    result.testTime[testNo++]=timer.GetTimeInMs();
    test.end_findByteInt();
    System.out.printf("String_Node_Str");
  }
{
    test.begin_findString("String_Node_Str");
    timer.Start();
    for (int i=0; i < REPEAT_SEARCH; ++i) {
      if (test.findString("String_Node_Str")) {
        System.out.printf("String_Node_Str");
        break;
      }
    }
    result.testTime[testNo++]=timer.GetTimeInMs();
    test.end_findString();
    System.out.printf("String_Node_Str");
  }
  test.closeTable();
  return result;
}

Fixed version (ground truth):
public static TestResult TestPerformance(IPerformance test,int rows){
  TestResult result=new TestResult();
  Timer timer=new Timer();
  int testNo=0;
  if (pause)   util.waitForEnter();
  long memBefore=Util.getUsedMemory();
  memBefore=Util.getUsedMemory();
  test.buildTable(rows);
  result.javaDBMemUsed=Math.max(Util.getUsedMemory() - memBefore,1);
  result.nativeDBMemUsed=test.usedNativeMemory();
{
    test.begin_findSmallInt(SMALL_TEST_VAL + 1);
    timer.Start();
    for (int i=0; i < REPEAT_SEARCH; ++i) {
      if (test.findSmallInt(SMALL_TEST_VAL + 1)) {
        System.out.println("String_Node_Str");
        break;
      }
    }
    result.testTime[testNo++]=timer.GetTimeInMs();
    test.end_findSmallInt();
    System.out.printf("String_Node_Str");
  }
{
    test.begin_findByteInt(BYTE_TEST_VAL + 1);
    timer.Start();
    for (int i=0; i < REPEAT_SEARCH; ++i) {
      if (test.findByteInt(BYTE_TEST_VAL + 1)) {
        System.out.printf("String_Node_Str");
        break;
      }
    }
    result.testTime[testNo++]=timer.GetTimeInMs();
    test.end_findByteInt();
    System.out.printf("String_Node_Str");
  }
{
    test.begin_findString("String_Node_Str");
    timer.Start();
    for (int i=0; i < REPEAT_SEARCH; ++i) {
      if (test.findString("String_Node_Str")) {
        System.out.printf("String_Node_Str");
        break;
      }
    }
    result.testTime[testNo++]=timer.GetTimeInMs();
    test.end_findString();
    System.out.printf("String_Node_Str");
  }
  if (pause)   util.waitForEnter();
  test.closeTable();
  return result;
}
Program: 155919
Project: 155919
Buggy source:
private synchronized void close(){
  if (nativePtr != 0) {
    nativeClose(nativePtr);
    nativePtr=0;
  }
}

Fixed version (ground truth):
public synchronized void close(){
  if (nativePtr != 0) {
    nativeClose(nativePtr);
    nativePtr=0;
  }
}
Program: 155920
Project: 155920
Buggy source:
public static void main(String[] args){
  Group group=new Group();
  group.close();
  group.commit();
  TableBase a=group.getTable("String_Node_Str");
  int tableCount=group.getTableCount();
  String firstTableName=group.getTableName(0);
  if (group.hasTable("String_Node_Str")) {
  }
  if (group.isValid()) {
  }
  ByteBuffer buffer=group.writeToByteBuffer();
  File file=new File("String_Node_Str");
  try {
    group.writeToFile(file);
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  try {
    group.writeToFile("String_Node_Str");
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  byte[] mem=group.writeToMem();
}

Fixed version (ground truth):
public static void main(String[] args){
  Group group=new Group();
  group.close();
  group.commit();
  TableBase a=group.getTable("String_Node_Str");
  long tableCount=group.getTableCount();
  String firstTableName=group.getTableName(0);
  if (group.hasTable("String_Node_Str")) {
  }
  if (group.isValid()) {
  }
  ByteBuffer buffer=group.writeToByteBuffer();
  File file=new File("String_Node_Str");
  try {
    group.writeToFile(file);
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  try {
    group.writeToFile("String_Node_Str");
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  byte[] mem=group.writeToMem();
}
Program: 155921
Project: 155921
Buggy source:
public int removeObsoleteGeneratedCode(ProcessingContext context,long beforeTimestamp){
  File directory=new File(context.getOutputPath());
  IOFileFilter fileFilter=new AndFileFilter(new SuffixFileFilter("String_Node_Str"),new ObsoleteGeneratedCodeFilter());
  IOFileFilter dirFilter=TrueFileFilter.TRUE;
  Collection<File> files=FileUtils.listFiles(directory,fileFilter,dirFilter);
  int removedFilesCount=0;
  for (  File file : files) {
    if (file.lastModified() < beforeTimestamp) {
      context.getLogger().info("String_Node_Str",file);
      removedFilesCount++;
      file.deleteOnExit();
    }
  }
  return removedFilesCount;
}

Fixed version (ground truth):
public int removeObsoleteGeneratedCode(ProcessingContext context,long beforeTimestamp){
  File directory=new File(context.getOutputPath());
  if (!directory.exists() && context.getProfile() != null) {
    context.getLogger().info("String_Node_Str");
    directory=new File(context.getProfile());
  }
  context.getLogger().info("String_Node_Str",directory);
  IOFileFilter fileFilter=new AndFileFilter(new SuffixFileFilter("String_Node_Str"),new ObsoleteGeneratedCodeFilter());
  IOFileFilter dirFilter=TrueFileFilter.TRUE;
  Collection<File> files=FileUtils.listFiles(directory,fileFilter,dirFilter);
  int removedFilesCount=0;
  for (  File file : files) {
    if (file.lastModified() < beforeTimestamp) {
      context.getLogger().info("String_Node_Str",file);
      removedFilesCount++;
      try {
        if (!file.delete()) {
          context.getLogger().warn("String_Node_Str",file);
          file.deleteOnExit();
        }
      }
 catch (      Exception e) {
        context.getLogger().warn("String_Node_Str",file);
        file.deleteOnExit();
      }
    }
  }
  return removedFilesCount;
}
Program: 155922
Project: 155922
Buggy source:
@Test(enabled=true) public void shouldSynchronizeNestedTables(){
  Group group=new Group();
  TableBase table=group.getTable("String_Node_Str");
  TableSpec tableSpec=new TableSpec();
  tableSpec.addColumn(ColumnType.ColumnTypeString,"String_Node_Str");
  TableSpec subspec=tableSpec.addSubtableColumn("String_Node_Str");
  subspec.addColumn(ColumnType.ColumnTypeInt,"String_Node_Str");
  table.updateFromSpec(tableSpec);
  table.insertString(0,0,"String_Node_Str");
  table.insertSubTable(1,0);
  assertEquals(1,table.size());
  TableBase subtable1=table.getSubTable(1,0);
  subtable1.insertLong(0,0,123);
  subtable1.insertDone();
  subtable1.close();
  assertEquals(1,subtable1.size());
  TableBase subtable2=table.getSubTable(1,0);
  assertEquals(1,subtable2.size());
  assertEquals(123,subtable2.getLong(0,0));
  table.clear();
}

Fixed version (ground truth):
@Test(enabled=true) public void shouldSynchronizeNestedTables(){
  Group group=new Group();
  TableBase table=group.getTable("String_Node_Str");
  TableSpec tableSpec=new TableSpec();
  tableSpec.addColumn(ColumnType.ColumnTypeString,"String_Node_Str");
  TableSpec subspec=tableSpec.addSubtableColumn("String_Node_Str");
  subspec.addColumn(ColumnType.ColumnTypeInt,"String_Node_Str");
  table.updateFromSpec(tableSpec);
  table.insertString(0,0,"String_Node_Str");
  table.insertSubTable(1,0);
  table.insertDone();
  assertEquals(1,table.size());
  TableBase subtable1=table.getSubTable(1,0);
  subtable1.insertLong(0,0,123);
  subtable1.insertDone();
  assertEquals(1,subtable1.size());
  subtable1.close();
  TableBase subtable2=table.getSubTable(1,0);
  assertEquals(1,subtable2.size());
  assertEquals(123,subtable2.getLong(0,0));
  table.clear();
}
Program: 155923
Project: 155923
Buggy source:
@BeforeMethod public void init(){
  employees=new EmployeeTable();
  employees.add(FIRST_NAMES[0],LAST_NAMES[0],SALARIES[0],DRIVERS[0],PHOTOS[0],BIRTHDATES[0],EXTRAS[0]);
  employees.add(FIRST_NAMES[2],LAST_NAMES[2],SALARIES[2],DRIVERS[2],PHOTOS[2],BIRTHDATES[2],EXTRAS[2]);
  employees.insert(1,FIRST_NAMES[1],LAST_NAMES[1],SALARIES[1],DRIVERS[1],PHOTOS[1],BIRTHDATES[1],EXTRAS[1]);
}

Fixed version (ground truth):
@BeforeMethod public void init(){
  employees=new EmployeeTable();
  addEmployee(employees,EMPLOYEE0);
  addEmployee(employees,EMPLOYEE2);
  insertEmployee(employees,1,EMPLOYEE1);
}
Program: 155924
Project: 155924
Buggy source:
@BeforeMethod public void init(){
  EmployeeTable employeesTable=new EmployeeTable();
  employeesTable.add(NAME0,"String_Node_Str",10000,true,new byte[]{1,2,3},new Date(),"String_Node_Str");
  employeesTable.add(NAME2,"String_Node_Str",10000,true,new byte[]{1,2,3},new Date(),true);
  employeesTable.insert(1,NAME1,"String_Node_Str",30000,false,new byte[]{4,5},new Date(),1234);
  employees=employeesTable.where().findAll();
}

Fixed version (ground truth):
@BeforeMethod public void init(){
  EmployeeTable employeesTable=new EmployeeTable();
  addEmployee(employeesTable,EMPLOYEE0);
  addEmployee(employeesTable,EMPLOYEE2);
  insertEmployee(employeesTable,1,EMPLOYEE1);
  employees=employeesTable.where().findAll();
}
Program: 155925
Project: 155925
Buggy source:
@Test public void shouldFindFirstRecordByColumnValue() throws IllegalAccessException {
  Employee record1=employees.firstName.findFirst(EmployeesFixture.FIRST_NAMES[1]);
  assertEquals(1,record1.getPosition());
  Employee record2=employees.salary.findFirst(10000);
  assertEquals(0,record2.getPosition());
  Employee record3=employees.salary.findFirst(12345);
  assertNull(record3);
}

Fixed version (ground truth):
@Test public void shouldFindFirstRecordByColumnValue() throws IllegalAccessException {
  Employee record1=employees.firstName.findFirst(EmployeesFixture.EMPLOYEE1.firstName);
  assertEquals(1,record1.getPosition());
  Employee record2=employees.salary.findFirst(10000);
  assertEquals(0,record2.getPosition());
  Employee record3=employees.salary.findFirst(12345);
  assertNull(record3);
}
Program: 155926
Project: 155926
Buggy source:
@Test public void shouldFindAllRecordsByColumnValue() throws IllegalAccessException {
  EmployeeView view1=employees.firstName.findAll(EmployeesFixture.FIRST_NAMES[1]);
  assertEquals(1,view1.size());
  EmployeeView view2=employees.salary.findAll(10000);
  assertEquals(2,view2.size());
  EmployeeView view3=employees.salary.findAll(12345);
  assertEquals(0,view3.size());
}

Fixed version (ground truth):
@Test public void shouldFindAllRecordsByColumnValue() throws IllegalAccessException {
  EmployeeView view1=employees.firstName.findAll(EmployeesFixture.EMPLOYEE1.firstName);
  assertEquals(1,view1.size());
  EmployeeView view2=employees.salary.findAll(10000);
  assertEquals(2,view2.size());
  EmployeeView view3=employees.salary.findAll(12345);
  assertEquals(0,view3.size());
}
Program: 155927
Project: 155927
Buggy source:
protected AbstractTable(EntityTypes<?,View,Cursor,Query> types,TableBase table){
  super(types,table);
  this.table=table;
  defineTableStructure();
}

Fixed version (ground truth):
protected AbstractTable(EntityTypes<?,View,Cursor,Query> types,TableBase table){
  super(types,table);
  this.table=table;
  if (table != null && table.getTableSpec().getColumnCount() <= 0) {
    final TableSpec spec=new TableSpec();
    specifyStructure(spec);
    table.updateFromSpec(spec);
  }
}
Program: 155928
Project: 155928
Buggy source:
private void defineTableStructure(){
  if (table != null) {
    final TableSpec spec=new TableSpec();
    specifyStructure(spec);
    table.updateFromSpec(spec);
  }
}

Fixed version (ground truth):
private void defineTableStructure(){
  if (table != null && table.getTableSpec().getColumnCount() <= 0) {
    final TableSpec spec=new TableSpec();
    specifyStructure(spec);
    table.updateFromSpec(spec);
  }
}
Program: 155929
Project: 155929
Buggy source:
/** 
 * Sets a value for a (string) cell. Note that if we call this method on the table for a particular column marked by the columnIndex, that column has to be an String based column which means the type of the column must be ColumnType.ColumnTypeString.
 * @param columnIndex column index of the cell
 * @param rowIndex row index of the cell
 * @param value
 */
public void setString(long columnIndex,long rowIndex,String value){
  nativeSetString(nativePtr,columnIndex,rowIndex,value);
}

Fixed version (ground truth):
/** 
 * Sets a value for a (string) cell.  Note that if we call this method on the table for a particular column  marked by the columnIndex, that column has to be an String based column which means the type of the column must be ColumnType.ColumnTypeString.
 * @param columnIndex column index of the cell
 * @param rowIndex row index of the cell
 * @param value
 */
public void setString(long columnIndex,long rowIndex,String value){
  nativeSetString(nativePtr,columnIndex,rowIndex,value);
}
Program: 155930
Project: 155930
Buggy source:
public TableBase getSubTable(long columnIndex,long rowIndex){
  return new TableBase(nativeGetSubTable(nativePtr,columnIndex,rowIndex));
}

Fixed version (ground truth):
/** 
 * Note: The subtable returned will have to be closed again after use. You can let javas garbage collector handle that or better yet call close() after use.
 * @param columnIndex column index of the cell
 * @param rowIndex row index of the cell
 * @return TableBase the subtable at the requested cell
 */
public TableBase getSubTable(long columnIndex,long rowIndex){
  return new TableBase(nativeGetSubTable(nativePtr,columnIndex,rowIndex));
}
Program: 155931
Project: 155931
Buggy source:
public AbstractSubtable(EntityTypes<?,View,Cursor,Query> types,TableBase subtable){
  super(types);
  this.subtable=subtable;
}

Fixed version (ground truth):
public AbstractSubtable(EntityTypes<?,View,Cursor,Query> types,TableBase subtable){
  super(types,subtable);
}
Program: 155932
Project: 155932
Buggy source:
private void defineTableStructure(){
  final TableSpec spec=new TableSpec();
  specifyStructure(spec);
  table.updateFromSpec(spec);
}

Fixed version (ground truth):
private void defineTableStructure(){
  if (table != null) {
    final TableSpec spec=new TableSpec();
    specifyStructure(spec);
    table.updateFromSpec(spec);
  }
}
Program: 155933
Project: 155933
Buggy source:
private AbstractTable(EntityTypes<?,View,Cursor,Query> types,TableBase table){
  super(types,table);
  this.table=table;
  defineTableStructure();
}

Fixed version (ground truth):
protected AbstractTable(EntityTypes<?,View,Cursor,Query> types,TableBase table){
  super(types,table);
  this.table=table;
  defineTableStructure();
}
Program: 155934
Project: 155934
Buggy source:
/** 
 * Returns a table with the specified name.
 * @param name The name of the table.
 * @return The table if it exists, otherwise null.
 */
public TableBase getTable(String name){
  if (hasTable(name)) {
    return new TableBase(nativeGetTableNativePtr(nativePtr,name));
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns a table with the specified name.
 * @param name The name of the table.
 * @return The table if it exists, otherwise null.
 */
public TableBase getTable(String name){
  return new TableBase(nativeGetTableNativePtr(nativePtr,name));
}
Program: 155935
Project: 155935
Buggy source:
@Test public void shouldCreateTablesInGroup(){
  Group group=new Group();
  EmployeeTable employees=new EmployeeTable(group);
  employees.add(NAME0,"String_Node_Str",10000,true,new byte[]{1,2,3},new Date(),"String_Node_Str");
  employees.add(NAME2,"String_Node_Str",20000,true,new byte[]{1,2,3},new Date(),true);
  employees.insert(1,NAME1,"String_Node_Str",30000,false,new byte[]{4,5},new Date(),1234);
  assertEquals(NAME0,employees.at(0).getFirstName());
  assertEquals(NAME1,employees.at(1).getFirstName());
  assertEquals(NAME2,employees.at(2).getFirstName());
}

Fixed version (ground truth):
@Test public void shouldCreateTablesInGroup(){
  Group group=new Group();
  EmployeeTable employees=new EmployeeTable(group);
  employees.add(NAME0,"String_Node_Str",10000,true,new byte[]{1,2,3},new Date(),"String_Node_Str");
  employees.add(NAME2,"String_Node_Str",20000,true,new byte[]{1,2,3},new Date(),true);
  employees.insert(1,NAME1,"String_Node_Str",30000,false,new byte[]{4,5},new Date(),1234);
  EmployeeTable employees2=new EmployeeTable(group);
  assertEquals(NAME0,employees2.at(0).getFirstName());
  assertEquals(NAME1,employees2.at(1).getFirstName());
  assertEquals(NAME2,employees2.at(2).getFirstName());
}
Program: 155936
Project: 155936
Buggy source:
public long maximum(){
  return getView().maximum(columnIndex);
}

Fixed version (ground truth):
public long maximum(){
  return rowset.maximum(columnIndex);
}
Program: 155937
Project: 155937
Buggy source:
public long sum(){
  return getView().sum(columnIndex);
}

Fixed version (ground truth):
public long sum(){
  return rowset.sum(columnIndex);
}
Program: 155938
Project: 155938
Buggy source:
public long minimum(){
  return getView().minimum(columnIndex);
}

Fixed version (ground truth):
public long minimum(){
  return rowset.minimum(columnIndex);
}
Program: 155939
Project: 155939
Buggy source:
public String formatToCSV(){
  try {
    StringWriter sw=new StringWriter();
    CSVWriter writer=new CSVWriter(sw,',','"','"',"String_Node_Str");
    for (    String[] rows : rows) {
      writer.writeNext(rows);
    }
    writer.close();
    return sw.toString();
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public String formatToCSV(){
  try {
    StringWriter sw=new StringWriter();
    CSVWriter writer=new CSVWriter(sw,',','"','"',"String_Node_Str");
    for (    String[] row : rows) {
      writer.writeNext(row);
    }
    writer.close();
    return sw.toString();
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 155941
Project: 155941
Buggy source:
static HprofByteBuffer createHprofByteBuffer(File dumpFile) throws IOException {
  long fileLen=dumpFile.length();
  if (fileLen < MINIMAL_SIZE) {
    String errText=ResourceBundle.getBundle("String_Node_Str").getString("String_Node_Str");
    throw new IOException(errText);
  }
  try {
    if (fileLen < Integer.MAX_VALUE) {
      return new HprofMappedByteBuffer(dumpFile);
    }
 else {
      return new HprofLongMappedByteBuffer(dumpFile);
    }
  }
 catch (  IOException ex) {
    if (ex.getCause() instanceof OutOfMemoryError) {
      return new HprofFileBuffer(dumpFile);
    }
    throw ex;
  }
}

Fixed version (ground truth):
static HprofByteBuffer createHprofByteBuffer(File dumpFile) throws IOException {
  long fileLen=dumpFile.length();
  if (fileLen < MINIMAL_SIZE) {
    String errText="String_Node_Str";
    throw new IOException(errText);
  }
  try {
    if (fileLen < Integer.MAX_VALUE) {
      return new HprofMappedByteBuffer(dumpFile);
    }
 else {
      return new HprofLongMappedByteBuffer(dumpFile);
    }
  }
 catch (  IOException ex) {
    if (ex.getCause() instanceof OutOfMemoryError) {
      return new HprofFileBuffer(dumpFile);
    }
    throw ex;
  }
}
Program: 155942
Project: 155942
Buggy source:
@Override protected Object decode(Channel channel,SocketAddress remoteAddress,Object msg) throws Exception {
  ByteBuf buf=(ByteBuf)msg;
  if (buf.getUnsignedShort(buf.readerIndex()) == 0xfe02) {
    if (channel != null) {
      channel.writeAndFlush(new NetworkMessage(buf,remoteAddress));
    }
    return null;
  }
 else   if (buf.getByte(buf.readerIndex()) == '$') {
    return decodeInfo(channel,remoteAddress,buf.toString(StandardCharsets.US_ASCII).trim());
  }
 else   if (buf.getByte(buf.readerIndex() + 2) == ',') {
    return decodeText(channel,remoteAddress,buf.toString(StandardCharsets.US_ASCII).trim());
  }
 else {
    return decodeBinary(channel,remoteAddress,buf);
  }
}

Fixed version (ground truth):
@Override protected Object decode(Channel channel,SocketAddress remoteAddress,Object msg) throws Exception {
  ByteBuf buf=(ByteBuf)msg;
  if (buf.getUnsignedShort(buf.readerIndex()) == 0xfe02) {
    if (channel != null) {
      channel.writeAndFlush(new NetworkMessage(buf.retain(),remoteAddress));
    }
    return null;
  }
 else   if (buf.getByte(buf.readerIndex()) == '$') {
    return decodeInfo(channel,remoteAddress,buf.toString(StandardCharsets.US_ASCII).trim());
  }
 else   if (buf.getByte(buf.readerIndex() + 2) == ',') {
    return decodeText(channel,remoteAddress,buf.toString(StandardCharsets.US_ASCII).trim());
  }
 else {
    return decodeBinary(channel,remoteAddress,buf);
  }
}
Program: 155943
Project: 155943
Buggy source:
@Override protected void addProtocolHandlers(PipelineBuilder pipeline){
  pipeline.addLast("String_Node_Str",new CharacterDelimiterFrameDecoder('\0'));
  pipeline.addLast("String_Node_Str",new TlvProtocolDecoder(TlvProtocol.this));
}

Fixed version (ground truth):
@Override protected void addProtocolHandlers(PipelineBuilder pipeline){
  pipeline.addLast("String_Node_Str",new CharacterDelimiterFrameDecoder(1024,'\0'));
  pipeline.addLast("String_Node_Str",new TlvProtocolDecoder(TlvProtocol.this));
}
Program: 155944
Project: 155944
Buggy source:
@Override public void initTrackerServers(List<TrackerServer> serverList){
  serverList.add(new TrackerServer(false,getName()){
    @Override protected void addProtocolHandlers(    PipelineBuilder pipeline){
      pipeline.addLast("String_Node_Str",new CharacterDelimiterFrameDecoder('\0'));
      pipeline.addLast("String_Node_Str",new TlvProtocolDecoder(TlvProtocol.this));
    }
  }
);
}

Fixed version (ground truth):
@Override public void initTrackerServers(List<TrackerServer> serverList){
  serverList.add(new TrackerServer(false,getName()){
    @Override protected void addProtocolHandlers(    PipelineBuilder pipeline){
      pipeline.addLast("String_Node_Str",new CharacterDelimiterFrameDecoder(1024,'\0'));
      pipeline.addLast("String_Node_Str",new TlvProtocolDecoder(TlvProtocol.this));
    }
  }
);
}
Program: 155945
Project: 155945
Buggy source:
@Override public void run(Timeout timeout) throws Exception {
  if (!timeout.isCancelled()) {
    updateDevice(deviceId,Device.STATUS_UNKNOWN,null);
    activeDevices.remove(deviceId);
  }
}

Fixed version (ground truth):
@Override public void run(Timeout timeout){
  if (!timeout.isCancelled()) {
    updateDevice(deviceId,Device.STATUS_UNKNOWN,null);
  }
}