nus-yam/ex-repair huggingface dataset:
Program: 39772
Project: 39772
Buggy source:
public Entity duplicate(Entity original){
  Entity dupe;
  Location dupeLoc;
  if (sm.pluginSupport.getMythicSupport() != null && sm.pluginSupport.getMythicSupport().isMythicMob(original)) {
    dupe=sm.pluginSupport.getMythicSupport().spawnMythicMob(original);
  }
 else   if (original.getType() == EntityType.PIG_ZOMBIE || original.getType() == EntityType.ZOMBIE_VILLAGER || original.getType() == EntityType.ZOMBIE) {
    dupeLoc=new Location(original.getWorld(),original.getLocation().getBlockX() + 0.5,original.getLocation().getY(),original.getLocation().getBlockZ() + 0.5);
    dupe=original.getWorld().spawnEntity(dupeLoc,original.getType());
  }
 else {
    dupe=original.getWorld().spawnEntity(original.getLocation(),original.getType());
  }
  return cloneTraits(original,dupe);
}

Fixed version (ground truth):
public Entity duplicate(Entity original){
  Entity dupe;
  Location dupeLoc;
  if (sm.pluginSupport.getMythicSupport() != null && sm.pluginSupport.getMythicSupport().isMythicMob(original)) {
    dupe=sm.pluginSupport.getMythicSupport().spawnMythicMob(original);
  }
 else   if (original instanceof Zombie) {
    dupeLoc=new Location(original.getWorld(),original.getLocation().getBlockX() + 0.5,original.getLocation().getY(),original.getLocation().getBlockZ() + 0.5);
    dupe=original.getWorld().spawnEntity(dupeLoc,original.getType());
  }
 else {
    dupe=original.getWorld().spawnEntity(original.getLocation(),original.getType());
  }
  return cloneTraits(original,dupe);
}
Program: 39775
Project: 39775
Buggy source:
private Optional<String> createIndex(){
  if (isEsIndexingIncludedInPipeline()) {
    Path path=Paths.get(options.getESSchemaPath());
    if (!path.isAbsolute()) {
      path=Optional.ofNullable(getClass().getClassLoader().getResource(options.getESSchemaPath())).map(x -> Paths.get(x.getPath())).orElseThrow(() -> new IllegalArgumentException("String_Node_Str" + options.getESSchemaPath()));
    }
    String index=EsHandler.createIndex(esConfig,options.getDatasetId(),options.getAttempt(),path);
    LOG.info("String_Node_Str",index);
    return Optional.of(index);
  }
  return Optional.empty();
}

Fixed version (ground truth):
private Optional<String> createIndex(){
  if (isEsIndexingIncludedInPipeline()) {
    Path path=Paths.get(options.getESSchemaPath());
    String index=EsHandler.createIndex(esConfig,options.getDatasetId(),options.getAttempt(),path);
    LOG.info("String_Node_Str",index);
    return Optional.of(index);
  }
  return Optional.empty();
}
Program: 39776
Project: 39776
Buggy source:
private GbifRecords2JsonConverter(SpecificRecordBase[] bases){
  setSpecificRecordBase(bases);
  setEscapeKeys(ESCAPE_KEYS);
  setReplaceKeys(REPLACE_KEYS);
  addSpecificConverter(ExtendedRecord.class,getExtendedRecordConverter());
  addSpecificConverter(LocationRecord.class,getLocationRecordConverter());
  addSpecificConverter(TaxonRecord.class,getTaxonomyRecordConverter());
}

Fixed version (ground truth):
private GbifRecords2JsonConverter(SpecificRecordBase[] bases){
  setSpecificRecordBase(bases);
  setEscapeKeys(ESCAPE_KEYS);
  setReplaceKeys(REPLACE_KEYS);
  setClearValues(CLEAR_VALUES);
  addSpecificConverter(ExtendedRecord.class,getExtendedRecordConverter());
  addSpecificConverter(LocationRecord.class,getLocationRecordConverter());
  addSpecificConverter(TaxonRecord.class,getTaxonomyRecordConverter());
}
Program: 39777
Project: 39777
Buggy source:
/** 
 * Convert - "key":"value" and check some incorrect symbols for json 
 */
Records2JsonConverter addJsonFieldNoCheck(String key,Object value){
  for (  String rule : replaceKeys) {
    key=key.replaceAll(rule,"String_Node_Str");
  }
  sb.append("String_Node_Str").append(key).append("String_Node_Str");
  if (Objects.isNull(value)) {
    return append("String_Node_Str");
  }
  if (value instanceof String) {
    String r1=PATTERN1.matcher(((String)value)).replaceAll("String_Node_Str");
    value=PATTERN2.matcher(r1).replaceAll("String_Node_Str");
  }
  return append("String_Node_Str").append(value).append("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Convert - "key":"value" and check some incorrect symbols for json 
 */
Records2JsonConverter addJsonFieldNoCheck(String key,Object value){
  for (  String rule : replaceKeys) {
    key=key.replaceAll(rule,"String_Node_Str");
  }
  sb.append("String_Node_Str").append(key).append("String_Node_Str");
  if (Objects.isNull(value)) {
    return append("String_Node_Str");
  }
  if (value instanceof String) {
    String result=((String)value);
    if (clearValues.contains(key)) {
      String r12=PATTERN12.matcher(result).replaceAll("String_Node_Str");
      result=PATTERN13.matcher(r12).replaceAll("String_Node_Str");
    }
    String r1=PATTERN1.matcher(result).replaceAll("String_Node_Str");
    value=PATTERN2.matcher(r1).replaceAll("String_Node_Str");
  }
  return append("String_Node_Str").append(value).append("String_Node_Str");
}
Program: 39778
Project: 39778
Buggy source:
@Override protected void convert(Path inputPath,DataFileWriter<ExtendedRecord> dataFileWriter) throws IOException {
  DwCAReader reader=new DwCAReader(inputPath.toString());
  reader.init();
  LOG.info("String_Node_Str");
  while (reader.advance()) {
    dataFileWriter.append(reader.getCurrent());
  }
}

Fixed version (ground truth):
@Override protected void convert(Path inputPath,DataFileWriter<ExtendedRecord> dataFileWriter) throws IOException {
  DwCAReader reader=new DwCAReader(inputPath.toString());
  reader.init();
  LOG.info("String_Node_Str");
  dataFileWriter.append(reader.getCurrent());
  while (reader.advance()) {
    dataFileWriter.append(reader.getCurrent());
  }
}
Program: 39779
Project: 39779
Buggy source:
/** 
 * String converter for   {@link TaxonRecord}, convert an object to specific string view <pre>  {@code Result example: "gbifKingdom": "Animalia", //.....more fields}"usage":  "key": 2442896, "name": "Actinemys marmorata (Baird & Girard, 1852)", "rank": "SPECIES" }, "classification": [ { "key": 1, "name": "Animalia", "rank": "KINGDOM" }, //.....more objects ], "acceptedUsage": null, //.....more fields }</pre>
 */
private Consumer<SpecificRecordBase> getTaxonomyRecordConverter(){
  return record -> {
    TaxonRecord taxon=(TaxonRecord)record;
    List<RankedName> classifications=taxon.getClassification();
    if (Objects.nonNull(classifications) && !classifications.isEmpty()) {
      Map<Rank,String> map=classifications.stream().collect(Collectors.toMap(RankedName::getRank,RankedName::getName));
      addJsonField("String_Node_Str",map.get(Rank.KINGDOM));
      addJsonField("String_Node_Str",map.get(Rank.PHYLUM));
      addJsonField("String_Node_Str",map.get(Rank.CLASS));
      addJsonField("String_Node_Str",map.get(Rank.ORDER));
      addJsonField("String_Node_Str",map.get(Rank.FAMILY));
      addJsonField("String_Node_Str",map.get(Rank.GENUS));
      addJsonField("String_Node_Str",map.get(Rank.SUBGENUS));
    }
    RankedName usage=taxon.getUsage();
    if (Objects.nonNull(usage)) {
      addJsonField("String_Node_Str",usage.getKey());
      addJsonField("String_Node_Str",usage.getName());
    }
    addCommonFields(record);
  }
;
}

Fixed version (ground truth):
/** 
 * String converter for   {@link TaxonRecord}, convert an object to specific string view <pre>  {@code Result example: "gbifKingdom": "Animalia", //.....more fields}"usage":  "key": 2442896, "name": "Actinemys marmorata (Baird & Girard, 1852)", "rank": "SPECIES" }, "classification": [ { "key": 1, "name": "Animalia", "rank": "KINGDOM" }, //.....more objects ], "acceptedUsage": null, //.....more fields }</pre>
 */
private Consumer<SpecificRecordBase> getTaxonomyRecordConverter(){
  return record -> {
    TaxonRecord taxon=(TaxonRecord)record;
    List<RankedName> classifications=taxon.getClassification();
    if (classifications != null && !classifications.isEmpty()) {
      Map<Rank,String> map=classifications.stream().collect(Collectors.toMap(RankedName::getRank,RankedName::getName));
      this.addJsonField("String_Node_Str",map.get(Rank.KINGDOM)).addJsonField("String_Node_Str",map.get(Rank.PHYLUM)).addJsonField("String_Node_Str",map.get(Rank.CLASS)).addJsonField("String_Node_Str",map.get(Rank.ORDER)).addJsonField("String_Node_Str",map.get(Rank.FAMILY)).addJsonField("String_Node_Str",map.get(Rank.GENUS)).addJsonField("String_Node_Str",map.get(Rank.SUBGENUS));
    }
    RankedName usage=taxon.getUsage();
    if (usage != null) {
      this.addJsonField("String_Node_Str",usage.getKey().toString()).addJsonField("String_Node_Str",usage.getName());
    }
    this.addCommonFields(record);
  }
;
}
Program: 39780
Project: 39780
Buggy source:
/** 
 * String converter for   {@link ExtendedRecord}, convert an object to specific string view <pre>  {@code Result example:}"verbatim":  "continent": "North America", //.....more fields }, "basisOfRecord": null, //.....more fields }</pre>
 */
private Consumer<SpecificRecordBase> getExtendedRecordConverter(){
  return record -> {
    Map<String,String> terms=((ExtendedRecord)record).getCoreTerms();
    addJsonFieldNoCheck("String_Node_Str",record.get(0)).addJsonObject("String_Node_Str",terms);
  }
;
}

Fixed version (ground truth):
/** 
 * String converter for   {@link ExtendedRecord}, convert an object to specific string view <pre>  {@code Result example:}"verbatim":  "continent": "North America", //.....more fields }, "basisOfRecord": null, //.....more fields }</pre>
 */
private Consumer<SpecificRecordBase> getExtendedRecordConverter(){
  return record -> {
    Map<String,String> terms=((ExtendedRecord)record).getCoreTerms();
    this.addJsonFieldNoCheck("String_Node_Str",record.get(0).toString()).addJsonObject("String_Node_Str",terms);
  }
;
}
Program: 39781
Project: 39781
Buggy source:
/** 
 * String converter for   {@link LocationRecord}, convert an object to specific string view <pre>  {@code Result example:}"location":  "lon": 10, "lat": 10}, "continent": "NORTH_AMERICA", "waterBody": null, //.....more fields }</pre>
 */
private Consumer<SpecificRecordBase> getLocationRecordConverter(){
  return record -> {
    LocationRecord location=(LocationRecord)record;
    if (Objects.isNull(location.getDecimalLongitude()) || Objects.isNull(location.getDecimalLatitude())) {
      addJsonObject("String_Node_Str");
    }
 else {
      addJsonObject("String_Node_Str",JsonFiled.create("String_Node_Str",location.getDecimalLongitude().toString()),JsonFiled.create("String_Node_Str",location.getDecimalLatitude().toString()));
    }
    addCommonFields(record);
  }
;
}

Fixed version (ground truth):
/** 
 * String converter for   {@link LocationRecord}, convert an object to specific string view <pre>  {@code Result example:}"location":  "lon": 10, "lat": 10}, "continent": "NORTH_AMERICA", "waterBody": null, //.....more fields }</pre>
 */
private Consumer<SpecificRecordBase> getLocationRecordConverter(){
  return record -> {
    LocationRecord location=(LocationRecord)record;
    if (location.getDecimalLongitude() == null || location.getDecimalLatitude() == null) {
      this.addJsonObject("String_Node_Str");
    }
 else {
      ObjectNode node=mapper.createObjectNode();
      node.put("String_Node_Str",location.getDecimalLongitude().toString());
      node.put("String_Node_Str",location.getDecimalLatitude().toString());
      this.addJsonObject("String_Node_Str",node);
    }
    this.addCommonFields(record);
  }
;
}
Program: 39782
Project: 39782
Buggy source:
private GbifRecords2JsonConverter(SpecificRecordBase[] bases){
  setSpecificRecordBase(bases);
  setEscapeKeys(ESCAPE_KEYS);
  setReplaceKeys(REPLACE_KEYS);
  setClearValues(CLEAR_VALUES);
  addSpecificConverter(ExtendedRecord.class,getExtendedRecordConverter());
  addSpecificConverter(LocationRecord.class,getLocationRecordConverter());
  addSpecificConverter(TaxonRecord.class,getTaxonomyRecordConverter());
}

Fixed version (ground truth):
private GbifRecords2JsonConverter(SpecificRecordBase[] bases){
  this.setSpecificRecordBase(bases).setSkipKeys(SKIP_KEYS).setReplaceKeys(REPLACE_KEYS).addSpecificConverter(ExtendedRecord.class,getExtendedRecordConverter()).addSpecificConverter(LocationRecord.class,getLocationRecordConverter()).addSpecificConverter(TaxonRecord.class,getTaxonomyRecordConverter());
}
Program: 39783
Project: 39783
Buggy source:
/** 
 * Convert - "key":"value" and check some incorrect symbols for json 
 */
Records2JsonConverter addJsonFieldNoCheck(String key,Object value){
  for (  String rule : replaceKeys) {
    key=key.replaceAll(rule,"String_Node_Str");
  }
  sb.append("String_Node_Str").append(key).append("String_Node_Str");
  if (Objects.isNull(value)) {
    return append("String_Node_Str");
  }
  if (value instanceof String) {
    String result=((String)value);
    if (clearValues.contains(key)) {
      String r12=PATTERN12.matcher(result).replaceAll("String_Node_Str");
      result=PATTERN13.matcher(r12).replaceAll("String_Node_Str");
    }
    String r1=PATTERN1.matcher(result).replaceAll("String_Node_Str");
    value=PATTERN2.matcher(r1).replaceAll("String_Node_Str");
  }
  return append("String_Node_Str").append(value).append("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Convert - "key":"value" and check some incorrect symbols for json 
 */
Records2JsonConverter addJsonFieldNoCheck(String key,String value){
  return addJsonFieldNoCheck(mainNode,key,value);
}
Program: 39784
Project: 39784
Buggy source:
/** 
 * You want to use another way how to process a specific class, you can use your appender for this object <pre>  {@code Example:}BiConsumer<SpecificRecordBase, StringBuilder> funct = (record, sb) ->  Map<String, String> terms = ((ExtendedRecord) record).getCoreTerms(); String example = map.get("Example"); sb.append("\"exampleKey\":\"").append(example).append("\","); }; }</pre>
 */
public Records2JsonConverter addSpecificConverter(Class<? extends SpecificRecordBase> type,Consumer<SpecificRecordBase> consumer){
  this.customConvertersMap.put(type,consumer);
  return this;
}

Fixed version (ground truth):
/** 
 * You want to use another way how to process a specific class, you can use your appender for this object <pre>  {@code Example:}BiConsumer<SpecificRecordBase, StringBuilder> funct = (record, sb) ->  Map<String, String> terms = ((ExtendedRecord) record).getCoreTerms(); String example = map.get("Example"); sb.append("\"exampleKey\":\"").append(example).append("\","); }; }</pre>
 */
public Records2JsonConverter addSpecificConverter(Class<? extends SpecificRecordBase> type,Consumer<SpecificRecordBase> consumer){
  customConvertersMap.put(type,consumer);
  return this;
}
Program: 39785
Project: 39785
Buggy source:
Records2JsonConverter addJsonObject(String key,Map<String,String> fields){
  append("String_Node_Str").append(key).append("String_Node_Str");
  if (!fields.isEmpty()) {
    append("String_Node_Str");
    fields.forEach(this::addJsonField);
    append("String_Node_Str");
  }
 else {
    append("String_Node_Str");
  }
  return this;
}

Fixed version (ground truth):
Records2JsonConverter addJsonObject(String key,Map<String,String> fields){
  ObjectNode node=mapper.createObjectNode();
  fields.forEach((k,v) -> addJsonField(node,k,v));
  mainNode.set(key,node);
  return this;
}
Program: 39786
Project: 39786
Buggy source:
/** 
 * Check field in escapeKeys and convert - "key":"value" 
 */
Records2JsonConverter addJsonField(String key,Object value){
  if (escapeKeys.contains(key)) {
    return this;
  }
  return addJsonFieldNoCheck(key,value);
}

Fixed version (ground truth):
/** 
 * Check field in skipKeys and convert - "key":"value" 
 */
Records2JsonConverter addJsonField(String key,String value){
  return addJsonField(mainNode,key,value);
}
Program: 39787
Project: 39787
Buggy source:
public String buildJson(){
  Arrays.stream(bases).forEach(record -> {
    Consumer<SpecificRecordBase> consumer=this.customConvertersMap.get(record.getClass());
    if (Objects.nonNull(consumer)) {
      consumer.accept(record);
    }
 else {
      addCommonFields(record);
    }
  }
);
  return filterAndConvert();
}

Fixed version (ground truth):
public String buildJson(){
  Arrays.stream(bases).forEach(record -> {
    Consumer<SpecificRecordBase> consumer=customConvertersMap.get(record.getClass());
    if (consumer != null) {
      consumer.accept(record);
    }
 else {
      addCommonFields(record);
    }
  }
);
  return mainNode.toString();
}
Program: 39788
Project: 39788
Buggy source:
public static JsonFiled create(String key,String value){
  return new JsonFiled(key,value);
}

Fixed version (ground truth):
public static Records2JsonConverter create(SpecificRecordBase... bases){
  return new Records2JsonConverter().setSpecificRecordBase(bases);
}
Program: 39789
Project: 39789
Buggy source:
/** 
 * Common way how to convert   {@link SpecificRecordBase} to json string 
 */
Records2JsonConverter addCommonFields(SpecificRecordBase base){
  base.getSchema().getFields().forEach(field -> addJsonField(field.name(),base.get(field.pos())));
  return this;
}

Fixed version (ground truth):
/** 
 * Common way how to convert   {@link SpecificRecordBase} to json string 
 */
Records2JsonConverter addCommonFields(SpecificRecordBase base){
  base.getSchema().getFields().forEach(field -> Optional.ofNullable(base.get(field.pos())).map(Object::toString).ifPresent(r -> addJsonField(field.name(),r)));
  return this;
}
Program: 39791
Project: 39791
Buggy source:
void run(){
  createIndex().ifPresent(options::setESIndexName);
  Pipeline pipeline=DwcaPipelineBuilder.buildPipeline(options);
  pipeline.run().waitUntilFinish();
  swapIndex();
  Runtime.getRuntime().addShutdownHook(new Thread(() -> {
    LOG.debug("String_Node_Str");
    File tmp=Paths.get(DwcaPipelineBuilder.OutputWriter.getTempDir(options)).toFile();
    if (tmp.delete()) {
      LOG.info("String_Node_Str",tmp.getPath());
    }
 else {
      LOG.warn("String_Node_Str",tmp.getPath());
    }
  }
));
}

Fixed version (ground truth):
void run(){
  createIndex().ifPresent(options::setESIndexName);
  Pipeline pipeline=DwcaPipelineBuilder.buildPipeline(options);
  pipeline.run().waitUntilFinish();
  swapIndex();
  Runtime.getRuntime().addShutdownHook(new Thread(() -> {
    LOG.debug("String_Node_Str");
    File tmp=Paths.get(DwcaPipelineBuilder.OutputWriter.getTempDir(options)).toFile();
    if (tmp.exists()) {
      try {
        FileUtils.deleteDirectory(tmp);
        LOG.info("String_Node_Str",tmp.getPath());
      }
 catch (      IOException e) {
        LOG.warn("String_Node_Str",tmp.getPath());
      }
    }
  }
));
}
Program: 39793
Project: 39793
Buggy source:
/** 
 * Compare dates, FROM cannot be greater than TO 
 */
private static boolean isValidRange(Temporal from,Temporal to){
  if (Objects.isNull(from) || Objects.isNull(to)) {
    return false;
  }
  TemporalUnit unit=null;
  if (from instanceof Year) {
    unit=ChronoUnit.YEARS;
  }
 else   if (from instanceof YearMonth) {
    unit=ChronoUnit.MONTHS;
  }
 else   if (from instanceof LocalDate) {
    unit=ChronoUnit.DAYS;
  }
 else   if (from instanceof LocalDateTime) {
    unit=ChronoUnit.SECONDS;
  }
  return from.until(to,unit) < 0;
}

Fixed version (ground truth):
/** 
 * Compare dates, FROM cannot be greater than TO 
 */
private static boolean isValidRange(Temporal from,Temporal to){
  if (Objects.isNull(from) || Objects.isNull(to)) {
    return true;
  }
  TemporalUnit unit=null;
  if (from instanceof Year) {
    unit=ChronoUnit.YEARS;
  }
 else   if (from instanceof YearMonth) {
    unit=ChronoUnit.MONTHS;
  }
 else   if (from instanceof LocalDate) {
    unit=ChronoUnit.DAYS;
  }
 else   if (from instanceof LocalDateTime) {
    unit=ChronoUnit.SECONDS;
  }
  return from.until(to,unit) >= 0;
}
Program: 39794
Project: 39794
Buggy source:
/** 
 * Asserts that the swap operation was done as expected in the embedded ES instance.
 */
protected static void assertSwapResults(String idxAdded,String idxPattern,String alias,Set<String> idxRemoved){
  Response response=null;
  try {
    response=restClient.performRequest(HttpGet.METHOD_NAME,"String_Node_Str" + idxPattern + "String_Node_Str"+ alias);
  }
 catch (  IOException e) {
    Assert.fail(e.getMessage());
  }
  Set<String> indexesFound=ResponseParser.parseIndexesInAliasResponse(response.getEntity());
  assertEquals(1,indexesFound.size());
  assertTrue(indexesFound.contains(idxAdded));
  for (  String removed : idxRemoved) {
    try {
      response=restClient.performRequest(HttpGet.METHOD_NAME,"String_Node_Str" + removed);
    }
 catch (    ResponseException e) {
      assertEquals(HttpStatus.SC_NOT_FOUND,e.getResponse().getStatusLine().getStatusCode());
    }
catch (    IOException e) {
      Assert.fail(e.getMessage());
    }
  }
}

Fixed version (ground truth):
/** 
 * Asserts that the swap operation was done as expected in the embedded ES instance.
 */
protected static void assertSwapResults(String idxAdded,String idxPattern,String alias,Set<String> idxRemoved){
  Response response=null;
  try {
    response=restClient.performRequest(HttpGet.METHOD_NAME,"String_Node_Str" + idxPattern + "String_Node_Str"+ alias);
  }
 catch (  IOException e) {
    Assert.fail(e.getMessage());
  }
  Set<String> indexesFound=ResponseParser.parseIndexesInAliasResponse(response.getEntity());
  assertEquals(1,indexesFound.size());
  assertTrue(indexesFound.contains(idxAdded));
  for (  String removed : idxRemoved) {
    try {
      response=restClient.performRequest(HttpGet.METHOD_NAME,"String_Node_Str" + removed);
    }
 catch (    ResponseException e) {
      assertEquals(HttpStatus.SC_NOT_FOUND,e.getResponse().getStatusLine().getStatusCode());
    }
catch (    IOException e) {
      throw new AssertionError(e);
    }
  }
}
Program: 39795
Project: 39795
Buggy source:
/** 
 * Utility method to add an index to an alias.
 */
protected static void addIndexToAlias(String alias,Set<String> idxToAdd){
  HttpEntity entityBody=EntityBuilder.entityIndexAliasActions(alias,idxToAdd,Collections.emptySet());
  try {
    restClient.performRequest(HttpPost.METHOD_NAME,"String_Node_Str",Collections.emptyMap(),entityBody);
  }
 catch (  IOException e) {
    Assert.fail("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Utility method to add an index to an alias.
 */
protected static void addIndexToAlias(String alias,Set<String> idxToAdd){
  HttpEntity entityBody=EntityBuilder.entityIndexAliasActions(alias,idxToAdd,Collections.emptySet());
  try {
    restClient.performRequest(HttpPost.METHOD_NAME,"String_Node_Str",Collections.emptyMap(),entityBody);
  }
 catch (  IOException e) {
    throw new AssertionError("String_Node_Str",e);
  }
}
Program: 39796
Project: 39796
Buggy source:
@Test public void swapEmptyAliasTest(){
  String idx1=EsService.createIndexWithSettings(getEsClient(),"String_Node_Str",INDEXING);
  EsService.swapIndexes(getEsClient(),ALIAS_TEST,Collections.singleton(idx1),Collections.emptySet());
  assertSwapResults(idx1,"String_Node_Str",ALIAS_TEST,Collections.EMPTY_SET);
}

Fixed version (ground truth):
@Test public void swapEmptyAliasTest(){
  String idx1=EsService.createIndexWithSettings(getEsClient(),"String_Node_Str",INDEXING);
  EsService.swapIndexes(getEsClient(),ALIAS_TEST,Collections.singleton(idx1),Collections.emptySet());
  assertSwapResults(idx1,"String_Node_Str",ALIAS_TEST,Collections.emptySet());
}
Program: 39797
Project: 39797
Buggy source:
@Test(expected=NullPointerException.class) public void testMatchNullTaxonRecord(){
  TaxonomyInterpreter.taxonomyInterpreter(null,null).apply(null);
}

Fixed version (ground truth):
@Test(expected=NullPointerException.class) public void testMatchNullTaxonRecord(){
  Interpretation<ExtendedRecord> interpretation=TaxonomyInterpreter.taxonomyInterpreter(null,null).apply(null);
}
Program: 39798
Project: 39798
Buggy source:
@Test public void testCeratiaceae() throws IOException {
  ExtendedRecord record=ExtendedRecordCustomBuilder.create().kingdom("String_Node_Str").phylum("String_Node_Str").clazz("String_Node_Str").order("String_Node_Str").family("String_Node_Str").genus("String_Node_Str").name("String_Node_Str").rank(Rank.SPECIES.name()).id(TEST_RECORD_ID).build();
  enqueueResponse(CERATIACEAE_RESPONSE);
  TaxonRecord taxonRecord=new TaxonRecord();
  TaxonomyInterpreter.taxonomyInterpreter(taxonRecord,WS_PROPERTIES_PATH).apply(record);
  Map<Rank,RankedName> ranksResponse=taxonRecord.getClassification().stream().collect(Collectors.toMap(RankedName::getRank,rankedName -> rankedName));
  Assert.assertEquals(7598904,taxonRecord.getUsage().getKey().intValue());
  Assert.assertEquals(7479242,ranksResponse.get(Rank.FAMILY).getKey().intValue());
  Assert.assertEquals("String_Node_Str",taxonRecord.getUsage().getName());
}

Fixed version (ground truth):
@Test public void testCeratiaceae() throws IOException {
  ExtendedRecord record=ExtendedRecordCustomBuilder.create().kingdom("String_Node_Str").phylum("String_Node_Str").clazz("String_Node_Str").order("String_Node_Str").family("String_Node_Str").genus("String_Node_Str").name("String_Node_Str").rank(Rank.SPECIES.name()).id(TEST_RECORD_ID).build();
  enqueueResponse(CERATIACEAE_RESPONSE);
  TaxonRecord taxonRecord=new TaxonRecord();
  Interpretation<ExtendedRecord> interpretation=TaxonomyInterpreter.taxonomyInterpreter(taxonRecord,WS_PROPERTIES_PATH).apply(record);
  Map<Rank,RankedName> ranksResponse=taxonRecord.getClassification().stream().collect(Collectors.toMap(RankedName::getRank,rankedName -> rankedName));
  Assert.assertNotNull(interpretation);
  Assert.assertEquals(7598904,taxonRecord.getUsage().getKey().intValue());
  Assert.assertEquals(7479242,ranksResponse.get(Rank.FAMILY).getKey().intValue());
  Assert.assertEquals("String_Node_Str",taxonRecord.getUsage().getName());
}
Program: 39799
Project: 39799
Buggy source:
@Test(expected=NullPointerException.class) public void testMatchNullArgs(){
  TaxonRecord taxonRecord=new TaxonRecord();
  TaxonomyInterpreter.taxonomyInterpreter(taxonRecord,WS_PROPERTIES_PATH).apply(null);
}

Fixed version (ground truth):
@Test(expected=NullPointerException.class) public void testMatchNullArgs(){
  TaxonRecord taxonRecord=new TaxonRecord();
  Interpretation<ExtendedRecord> interpretation=TaxonomyInterpreter.taxonomyInterpreter(taxonRecord,WS_PROPERTIES_PATH).apply(null);
  Assert.fail("String_Node_Str");
}
Program: 39801
Project: 39801
Buggy source:
@Test public void testAcceptedUsage() throws IOException {
  ExtendedRecord record=ExtendedRecordCustomBuilder.create().name("String_Node_Str").id(TEST_RECORD_ID).build();
  enqueueResponse(AGALLISUS_LEPTUROIDES_RESPONSE);
  TaxonRecord taxonRecord=new TaxonRecord();
  TaxonomyInterpreter.taxonomyInterpreter(taxonRecord,WS_PROPERTIES_PATH).apply(record);
  Assert.assertEquals(1118030,taxonRecord.getUsage().getKey().intValue());
  Assert.assertEquals(1118026,taxonRecord.getAcceptedUsage().getKey().intValue());
  Assert.assertEquals("String_Node_Str",taxonRecord.getUsage().getName());
  Assert.assertEquals("String_Node_Str",taxonRecord.getAcceptedUsage().getName());
}

Fixed version (ground truth):
@Test public void testAcceptedUsage() throws IOException {
  ExtendedRecord record=ExtendedRecordCustomBuilder.create().name("String_Node_Str").id(TEST_RECORD_ID).build();
  enqueueResponse(AGALLISUS_LEPTUROIDES_RESPONSE);
  TaxonRecord taxonRecord=new TaxonRecord();
  Interpretation<ExtendedRecord> interpretation=TaxonomyInterpreter.taxonomyInterpreter(taxonRecord,WS_PROPERTIES_PATH).apply(record);
  Assert.assertNotNull(interpretation);
  Assert.assertEquals(1118030,taxonRecord.getUsage().getKey().intValue());
  Assert.assertEquals(1118026,taxonRecord.getAcceptedUsage().getKey().intValue());
  Assert.assertEquals("String_Node_Str",taxonRecord.getUsage().getName());
  Assert.assertEquals("String_Node_Str",taxonRecord.getAcceptedUsage().getName());
}
Program: 39802
Project: 39802
Buggy source:
@Test public void testOtu() throws IOException {
  ExtendedRecord record=ExtendedRecordCustomBuilder.create().kingdom("String_Node_Str").phylum("String_Node_Str").family("String_Node_Str").name("String_Node_Str").rank(Rank.SPECIES.name()).id(TEST_RECORD_ID).build();
  enqueueResponse(ANNELIDA_RESPONSE);
  TaxonRecord taxonRecord=new TaxonRecord();
  TaxonomyInterpreter.taxonomyInterpreter(taxonRecord,WS_PROPERTIES_PATH).apply(record);
  Assert.assertEquals("String_Node_Str",taxonRecord.getUsage().getName());
}

Fixed version (ground truth):
@Test public void testOtu() throws IOException {
  ExtendedRecord record=ExtendedRecordCustomBuilder.create().kingdom("String_Node_Str").phylum("String_Node_Str").family("String_Node_Str").name("String_Node_Str").rank(Rank.SPECIES.name()).id(TEST_RECORD_ID).build();
  enqueueResponse(ANNELIDA_RESPONSE);
  TaxonRecord taxonRecord=new TaxonRecord();
  Interpretation<ExtendedRecord> interpretation=TaxonomyInterpreter.taxonomyInterpreter(taxonRecord,WS_PROPERTIES_PATH).apply(record);
  Assert.assertNotNull(interpretation);
  Assert.assertEquals("String_Node_Str",taxonRecord.getUsage().getName());
}
Program: 39803
Project: 39803
Buggy source:
@Test public void testNubLookupGood() throws IOException {
  ExtendedRecord record=ExtendedRecordCustomBuilder.create().kingdom("String_Node_Str").genus("String_Node_Str").name("String_Node_Str").rank(Rank.SPECIES.name()).id(TEST_RECORD_ID).build();
  enqueueResponse(PUMA_CONCOLOR_RESPONSE);
  TaxonRecord taxonRecord=new TaxonRecord();
  TaxonomyInterpreter.taxonomyInterpreter(taxonRecord,WS_PROPERTIES_PATH).apply(record);
  Map<Rank,RankedName> ranksResponse=taxonRecord.getClassification().stream().collect(Collectors.toMap(RankedName::getRank,rankedName -> rankedName));
  Assert.assertEquals(2435099,taxonRecord.getUsage().getKey().intValue());
  Assert.assertEquals(1,ranksResponse.get(Rank.KINGDOM).getKey().intValue());
  Assert.assertEquals("String_Node_Str",ranksResponse.get(Rank.PHYLUM).getName());
}

Fixed version (ground truth):
@Test public void testNubLookupGood() throws IOException {
  ExtendedRecord record=ExtendedRecordCustomBuilder.create().kingdom("String_Node_Str").genus("String_Node_Str").name("String_Node_Str").rank(Rank.SPECIES.name()).id(TEST_RECORD_ID).build();
  enqueueResponse(PUMA_CONCOLOR_RESPONSE);
  TaxonRecord taxonRecord=new TaxonRecord();
  Interpretation<ExtendedRecord> interpretation=TaxonomyInterpreter.taxonomyInterpreter(taxonRecord,WS_PROPERTIES_PATH).apply(record);
  Map<Rank,RankedName> ranksResponse=taxonRecord.getClassification().stream().collect(Collectors.toMap(RankedName::getRank,rankedName -> rankedName));
  Assert.assertNotNull(interpretation);
  Assert.assertEquals(2435099,taxonRecord.getUsage().getKey().intValue());
  Assert.assertEquals(1,ranksResponse.get(Rank.KINGDOM).getKey().intValue());
  Assert.assertEquals("String_Node_Str",ranksResponse.get(Rank.PHYLUM).getName());
}
Program: 39805
Project: 39805
Buggy source:
@Test(expected=IllegalArgumentException.class) public void testMatchEmptyArgs(){
  ExtendedRecord record=new ExtendedRecord();
  record.setCoreTerms(new HashMap<>());
  TaxonRecord taxonRecord=new TaxonRecord();
  TaxonomyInterpreter.taxonomyInterpreter(taxonRecord,WS_PROPERTIES_PATH).apply(record);
}

Fixed version (ground truth):
@Test(expected=IllegalArgumentException.class) public void testMatchEmptyArgs(){
  ExtendedRecord record=new ExtendedRecord();
  record.setCoreTerms(new HashMap<>());
  TaxonRecord taxonRecord=new TaxonRecord();
  Interpretation<ExtendedRecord> interpretation=TaxonomyInterpreter.taxonomyInterpreter(taxonRecord,WS_PROPERTIES_PATH).apply(record);
  Assert.fail("String_Node_Str");
}
Program: 39806
Project: 39806
Buggy source:
/** 
 * Interprets the   {@link DwcTerm#country},   {@link DwcTerm#countryCode},   {@link DwcTerm#decimalLatitude} and the{@link DwcTerm#decimalLongitude} terms.
 */
static LocationInterpreter interpretCountryAndCoordinates(Location locationRecord,String wsPropertiesPath){
  return (  ExtendedRecord extendedRecord) -> {
    ParsedField<ParsedLocation> parsedResult=LocationParser.parseCountryAndCoordinates(extendedRecord,wsPropertiesPath);
    ParsedLocation parsedLocation=parsedResult.getResult();
    if (parsedLocation.getCountry() != null) {
      locationRecord.setCountry(parsedLocation.getCountry().getTitle());
      locationRecord.setCountryCode(parsedLocation.getCountry().getIso2LetterCode());
    }
    if (parsedLocation.getLatLng() != null) {
      locationRecord.setDecimalLatitude(parsedLocation.getLatLng().getLat());
      locationRecord.setDecimalLongitude(parsedLocation.getLatLng().getLng());
    }
    Interpretation<ExtendedRecord> interpretation=Interpretation.of(extendedRecord);
    parsedResult.getIssues().forEach(issue -> {
      Trace<IssueType> trace;
      if (Objects.nonNull(issue.getTerms()) && !issue.getTerms().isEmpty() && Objects.nonNull(issue.getTerms().get(0))) {
        trace=Trace.of(issue.getTerms().get(0).simpleName(),issue.getIssueType());
      }
 else {
        trace=Trace.of(issue.getIssueType());
      }
      interpretation.withValidation(trace);
    }
);
    return interpretation;
  }
;
}

Fixed version (ground truth):
/** 
 * Interprets the   {@link DwcTerm#country},   {@link DwcTerm#countryCode},   {@link DwcTerm#decimalLatitude} and the{@link DwcTerm#decimalLongitude} terms.
 */
static LocationInterpreter interpretCountryAndCoordinates(Location locationRecord,String wsPropertiesPath){
  return (  ExtendedRecord extendedRecord) -> {
    ParsedField<ParsedLocation> parsedResult=LocationParser.parseCountryAndCoordinates(extendedRecord,wsPropertiesPath);
    ParsedLocation parsedLocation=parsedResult.getResult();
    if (Objects.nonNull(parsedLocation.getCountry())) {
      locationRecord.setCountry(parsedLocation.getCountry().getTitle());
      locationRecord.setCountryCode(parsedLocation.getCountry().getIso2LetterCode());
    }
    if (Objects.nonNull(parsedLocation.getLatLng())) {
      locationRecord.setDecimalLatitude(parsedLocation.getLatLng().getLat());
      locationRecord.setDecimalLongitude(parsedLocation.getLatLng().getLng());
    }
    Interpretation<ExtendedRecord> interpretation=Interpretation.of(extendedRecord);
    parsedResult.getIssues().forEach(issue -> {
      Trace<IssueType> trace;
      if (Objects.nonNull(issue.getTerms()) && !issue.getTerms().isEmpty() && Objects.nonNull(issue.getTerms().get(0))) {
        trace=Trace.of(issue.getTerms().get(0).simpleName(),issue.getIssueType());
      }
 else {
        trace=Trace.of(issue.getIssueType());
      }
      interpretation.withValidation(trace);
    }
);
    return interpretation;
  }
;
}
Program: 39807
Project: 39807
Buggy source:
/** 
 * Creates a   {@link OkHttpClient} with {@link Cache} from a specific {@link Config}.
 */
private static OkHttpClient createClientWithCache(Config config){
  File httpCacheDirectory;
  try {
    httpCacheDirectory=Files.createTempFile(config.getCacheConfig().getName(),"String_Node_Str").toFile();
    httpCacheDirectory.deleteOnExit();
  }
 catch (  IOException e) {
    throw new IllegalStateException("String_Node_Str",e);
  }
  Cache cache=new Cache(httpCacheDirectory,config.getCacheConfig().getSize());
  return new OkHttpClient.Builder().connectTimeout(config.getTimeout(),TimeUnit.SECONDS).readTimeout(config.getTimeout(),TimeUnit.SECONDS).cache(cache).build();
}

Fixed version (ground truth):
/** 
 * Creates a   {@link OkHttpClient} with {@link Cache} from a specific {@link Config}.
 */
private static OkHttpClient createClientWithCache(Config config){
  File httpCacheDirectory;
  try {
    httpCacheDirectory=Files.createTempDirectory(config.getCacheConfig().getName()).toFile();
    LOG.info("String_Node_Str",httpCacheDirectory.getAbsolutePath());
  }
 catch (  IOException e) {
    throw new IllegalStateException("String_Node_Str",e);
  }
  Cache cache=new Cache(httpCacheDirectory,config.getCacheConfig().getSize());
  return new OkHttpClient.Builder().connectTimeout(config.getTimeout(),TimeUnit.SECONDS).readTimeout(config.getTimeout(),TimeUnit.SECONDS).cache(cache).build();
}
Program: 39808
Project: 39808
Buggy source:
private static Config createConfigInternal(Service service,Path propertiesPath){
  Properties props=loadProperties(propertiesPath).orElseThrow(() -> new IllegalArgumentException("String_Node_Str" + propertiesPath));
  String basePath=Optional.ofNullable(props.getProperty(generatePropertyName(service,WS_BASE_PATH_PROP))).filter(prop -> !prop.isEmpty()).orElseThrow(() -> new IllegalArgumentException("String_Node_Str"));
  Config config=new Config();
  config.setBasePath(basePath);
  config.setTimeout(Long.parseLong(props.getProperty(generatePropertyName(service,WS_TIMEOUT_PROP),DEFAULT_TIMEOUT)));
  String cacheName=service.name().toLowerCase().concat(DEFAULT_CACHE_NAME_SUFFIX);
  Long cacheSize=Long.parseLong(props.getProperty(generatePropertyName(service,CACHE_SIZE_PROP),DEFAULT_CACHE_SIZE)) * 1024 * 1024;
  Config.CacheConfig cacheConfig=new Config.CacheConfig();
  cacheConfig.setName(cacheName);
  cacheConfig.setSize(cacheSize);
  config.setCacheConfig(cacheConfig);
  return config;
}

Fixed version (ground truth):
private static Config createConfigInternal(Service service,Path propertiesPath){
  Properties props=loadProperties(propertiesPath).orElseThrow(() -> new IllegalArgumentException("String_Node_Str" + propertiesPath));
  String basePath=Optional.ofNullable(props.getProperty(generatePropertyName(service,WS_BASE_PATH_PROP))).filter(prop -> !prop.isEmpty()).orElseThrow(() -> new IllegalArgumentException("String_Node_Str"));
  Config config=new Config();
  config.setBasePath(basePath);
  config.setTimeout(Long.parseLong(props.getProperty(generatePropertyName(service,WS_TIMEOUT_PROP),DEFAULT_TIMEOUT)));
  String cacheName=service.name().toLowerCase().concat(DEFAULT_CACHE_NAME_SUFFIX);
  long configSize=Long.parseLong(props.getProperty(generatePropertyName(service,CACHE_SIZE_PROP),DEFAULT_CACHE_SIZE));
  Long cacheSize=configSize * 1024L * 1024L;
  Config.CacheConfig cacheConfig=new Config.CacheConfig();
  cacheConfig.setName(cacheName);
  cacheConfig.setSize(cacheSize);
  config.setCacheConfig(cacheConfig);
  return config;
}
Program: 39809
Project: 39809
Buggy source:
private GeocodeServiceClient(String wsPropertiesPath){
  geocodeServiceRest=GeocodeServiceRest.getInstance(HttpConfigFactory.createConfig(Service.GEO_CODE,Paths.get(wsPropertiesPath)));
}

Fixed version (ground truth):
private GeocodeServiceClient(String wsPropertiesPath){
  Config config=HttpConfigFactory.createConfig(Service.GEO_CODE,Paths.get(wsPropertiesPath));
  geocodeServiceRest=GeocodeServiceRest.getInstance(config);
}
Program: 39810
Project: 39810
Buggy source:
private static Map<String,String> createParamsMap(LatLng latLng){
  Map<String,String> params=new HashMap<>();
  params.put("String_Node_Str",String.valueOf(latLng.getLat()));
  params.put("String_Node_Str",String.valueOf(latLng.getLat()));
  return params;
}

Fixed version (ground truth):
private static Map<String,String> createParamsMap(LatLng latLng){
  Map<String,String> params=new HashMap<>();
  params.put("String_Node_Str",String.valueOf(latLng.getLat()));
  params.put("String_Node_Str",String.valueOf(latLng.getLng()));
  return params;
}
Program: 39811
Project: 39811
Buggy source:
@Override protected List<Country> parseResponse(Collection<GeocodeResponse> response){
  if (response != null && !response.isEmpty()) {
    return response.stream().filter(resp -> resp.getIsoCountryCode2Digit() != null).map(resp -> Country.fromIsoCode(resp.getIsoCountryCode2Digit())).collect(Collectors.toList());
  }
  return Collections.emptyList();
}

Fixed version (ground truth):
@Override protected List<Country> parseResponse(Collection<GeocodeResponse> response){
  if (Objects.nonNull(response) && !response.isEmpty()) {
    return response.stream().filter(resp -> Objects.nonNull(resp.getIsoCountryCode2Digit())).map(resp -> Country.fromIsoCode(resp.getIsoCountryCode2Digit())).collect(Collectors.toList());
  }
  return Collections.emptyList();
}
Program: 39812
Project: 39812
Buggy source:
public Builder withGenus(String genus){
  this.genus=Strings.emptyToNull(genus);
  return this;
}

Fixed version (ground truth):
Builder withGenus(String genus){
  this.genus=Strings.emptyToNull(genus);
  return this;
}
Program: 39813
Project: 39813
Buggy source:
private static Optional<Rank> interpretRank(final Map<String,String> terms,AtomizedFields atomizedFields){
  Optional<Rank> interpretedRank=rankParser().map(terms,Function.identity()).map(rankParseResult -> rankParseResult.isSuccessful() ? rankParseResult.getPayload() : verbatimTaxonRankParser().map(terms,ParseResult::getPayload).get());
  if (!interpretedRank.isPresent()) {
    return fromAtomizedFields(atomizedFields);
  }
  return interpretedRank;
}

Fixed version (ground truth):
private static Optional<Rank> interpretRank(final Map<String,String> terms,AtomizedFields atomizedFields){
  Optional<Rank> interpretedRank=rankParser().map(terms,Function.identity()).map(rankParseResult -> rankParseResult.isSuccessful() ? rankParseResult.getPayload() : verbatimTaxonRankParser().map(terms,ParseResult::getPayload).orElse(null));
  if (!interpretedRank.isPresent()) {
    return fromAtomizedFields(atomizedFields);
  }
  return interpretedRank;
}
Program: 39814
Project: 39814
Buggy source:
public Builder withInfraspecificEpithet(String infraspecificEpithet){
  this.infraspecificEpithet=Strings.emptyToNull(infraspecificEpithet);
  return this;
}

Fixed version (ground truth):
Builder withInfraspecificEpithet(String infraspecificEpithet){
  this.infraspecificEpithet=Strings.emptyToNull(infraspecificEpithet);
  return this;
}
Program: 39815
Project: 39815
Buggy source:
public Builder withSpecificEpithet(String specificEpithet){
  this.specificEpithet=Strings.emptyToNull(specificEpithet);
  return this;
}

Fixed version (ground truth):
Builder withSpecificEpithet(String specificEpithet){
  this.specificEpithet=Strings.emptyToNull(specificEpithet);
  return this;
}
Program: 39816
Project: 39816
Buggy source:
/** 
 * Creates a   {@link OkHttpClient} with {@link Cache} from a specific {@link Config}.
 */
private static OkHttpClient createClientWithCache(Config config){
  File httpCacheDirectory;
  try {
    httpCacheDirectory=Files.createTempDirectory(config.getCacheConfig().getName()).toFile();
  }
 catch (  IOException e) {
    throw new IllegalStateException("String_Node_Str",e);
  }
  Cache cache=new Cache(httpCacheDirectory,config.getCacheConfig().getSize());
  return new OkHttpClient.Builder().connectTimeout(config.getTimeout(),TimeUnit.SECONDS).readTimeout(config.getTimeout(),TimeUnit.SECONDS).cache(cache).build();
}

Fixed version (ground truth):
/** 
 * Creates a   {@link OkHttpClient} with {@link Cache} from a specific {@link Config}.
 */
private static OkHttpClient createClientWithCache(Config config){
  File httpCacheDirectory;
  try {
    httpCacheDirectory=Files.createTempFile(config.getCacheConfig().getName(),"String_Node_Str").toFile();
    httpCacheDirectory.deleteOnExit();
  }
 catch (  IOException e) {
    throw new IllegalStateException("String_Node_Str",e);
  }
  Cache cache=new Cache(httpCacheDirectory,config.getCacheConfig().getSize());
  return new OkHttpClient.Builder().connectTimeout(config.getTimeout(),TimeUnit.SECONDS).readTimeout(config.getTimeout(),TimeUnit.SECONDS).cache(cache).build();
}
Program: 39817
Project: 39817
Buggy source:
protected HttpResponse<R> performCall(Map<String,String> params){
  Call<T> call=getCall(params);
  try {
    Response<T> response=call.execute();
    if (!response.isSuccessful()) {
      String errorMessage=getErrorMessage() + response.message();
      return HttpResponse.<R>fail(response.code(),errorMessage,HttpResponse.ErrorCode.CALL_FAILED);
    }
    return HttpResponse.<R>success(parseResponse(response.body()));
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
    String errorMessage="String_Node_Str";
    return HttpResponse.<R>fail(errorMessage,HttpResponse.ErrorCode.UNEXPECTED_ERROR);
  }
}

Fixed version (ground truth):
protected HttpResponse<R> performCall(Map<String,String> params){
  Call<T> call=getCall(params);
  try {
    Response<T> response=call.execute();
    if (!response.isSuccessful()) {
      String errorMessage=getErrorMessage() + "String_Node_Str" + response.message();
      LOG.error(errorMessage);
      return HttpResponse.<R>fail(response.code(),errorMessage,HttpResponse.ErrorCode.CALL_FAILED);
    }
    return HttpResponse.<R>success(parseResponse(response.body()));
  }
 catch (  IOException e) {
    LOG.error(getErrorMessage(),e);
    return HttpResponse.<R>fail(getErrorMessage(),HttpResponse.ErrorCode.UNEXPECTED_ERROR);
  }
}
Program: 39818
Project: 39818
Buggy source:
/** 
 * Matches a   {@link ExtendedRecord} to an existing specie using the species match 2 WS.
 * @param extendedRecord avro file with the taxonomic data
 * @return {@link NameUsageMatch2} with the match received from the WS.
 */
public HttpResponse<NameUsageMatch2> getMatch(ExtendedRecord extendedRecord){
  HttpResponse<NameUsageMatch2> response=tryNameMatch(extendedRecord.getCoreTerms());
  if (isSuccessfulMatch(response) || !hasIdentifications(extendedRecord)) {
    return response;
  }
  LOG.info("String_Node_Str");
  List<Map<String,String>> identifications=extendedRecord.getExtensions().get(DwcTerm.Identification.qualifiedName());
  identifications.sort(Comparator.comparing((  Map<String,String> map) -> LocalDateTime.parse(map.get(DwcTerm.dateIdentified.qualifiedName()))).reversed());
  for (  Map<String,String> record : identifications) {
    response=tryNameMatch(record);
    if (isSuccessfulMatch(response)) {
      LOG.info("String_Node_Str",record.get(DwcTerm.identificationID.name()));
      return response;
    }
  }
  return response;
}

Fixed version (ground truth):
/** 
 * Matches a   {@link ExtendedRecord} to an existing specie using the species match 2 WS.
 * @param extendedRecord avro file with the taxonomic data
 * @return {@link NameUsageMatch2} with the match received from the WS.
 */
public HttpResponse<NameUsageMatch2> getMatch(ExtendedRecord extendedRecord){
  HttpResponse<NameUsageMatch2> response=tryNameMatch(extendedRecord.getCoreTerms());
  if (isSuccessfulMatch(response) || !hasIdentifications(extendedRecord)) {
    return response;
  }
  LOG.info("String_Node_Str");
  List<Map<String,String>> identifications=extendedRecord.getExtensions().get(DwcTerm.Identification.qualifiedName());
  identifications.sort(Comparator.comparing((  Map<String,String> map) -> {
    if (!map.containsKey(DwcTerm.dateIdentified.qualifiedName()) || Objects.isNull(map.get(DwcTerm.dateIdentified.qualifiedName()))) {
      return LocalDateTime.MIN;
    }
    return LocalDateTime.parse(map.get(DwcTerm.dateIdentified.qualifiedName()));
  }
).reversed());
  for (  Map<String,String> record : identifications) {
    response=tryNameMatch(record);
    if (isSuccessfulMatch(response)) {
      LOG.info("String_Node_Str",record.get(DwcTerm.identificationID.name()));
      return response;
    }
  }
  return response;
}
Program: 39819
Project: 39819
Buggy source:
private static void createAndRunPipeline(String[] args){
  Pipeline pipeline=InterpretationPipelineFactory.from(args).createPipeline();
  LOG.info("String_Node_Str",args);
  PipelineResult.State state=pipeline.run().waitUntilFinish();
  LOG.info("String_Node_Str",state,args);
}

Fixed version (ground truth):
private static void createAndRunPipeline(String[] args){
  Pipeline pipeline=InterpretationPipelineFactory.from(args).createPipeline();
  LOG.info("String_Node_Str",Arrays.asList(args));
  PipelineResult.State state=pipeline.run().waitUntilFinish();
  LOG.info("String_Node_Str",state,args);
}