nus-yam/ex-repair huggingface dataset:
Program: 40326
Project: 40326
Buggy source:
public synchronized byte[] waitForResponse(){
  while (this.rsp == null) {
    try {
      this.wait();
    }
 catch (    InterruptedException e) {
      LOG.error(e.getMessage(),e);
    }
  }
  return this.rsp;
}

Fixed version (ground truth):
public synchronized byte[] waitForResponse(){
  while (this.rsp == null) {
    try {
      this.wait();
    }
 catch (    InterruptedException e) {
      LOG.error(e.getMessage(),e);
    }
  }
  byte[] result=rsp;
  this.rsp=null;
  return result;
}
Program: 40327
Project: 40327
Buggy source:
private int readMessageLength(SelectionKey key,UnixSocketChannel channel) throws IOException {
  lengthBuffer.clear();
  int length;
  try {
    int numread=channel.read(lengthBuffer);
    if (numread == 4) {
      length=new BigInteger(lengthBuffer.array()).intValue();
    }
 else {
      length=-1;
    }
  }
 catch (  IOException e) {
    key.cancel();
    channel.close();
    return -1;
  }
  return length;
}

Fixed version (ground truth):
private int readMessageLength(SelectionKey key,UnixSocketChannel channel) throws IOException {
  lengthBuffer.clear();
  int length;
  try {
    int numread=channel.read(lengthBuffer);
    if (numread == 4) {
      length=new BigInteger(lengthBuffer.array()).intValue();
    }
 else {
      length=-1;
    }
  }
 catch (  IOException e) {
    key.cancel();
    channel.close();
    return -1;
  }
  LOG.debug("String_Node_Str" + length);
  return length;
}
Program: 40328
Project: 40328
Buggy source:
@Override public TransformationDecision requestTranformations(ServiceNode lastServiceNode){
  TransformationDecision result=new TransformationDecision();
  String query=this.createTransformationQuery(lastServiceNode);
  LOG.info("String_Node_Str" + query);
  try {
    List<SolveInfo> solveInfo=this.engine.query(query,false);
    if (solveInfo.isEmpty()) {
      return result;
    }
    List<Var> vars=solveInfo.get(0).getBindingVars();
    Set<String> labelsToRemove=vars.stream().filter(v -> "String_Node_Str".equals(v.getName())).map(var -> var.getTerm().toString()).collect(Collectors.toSet());
    Set<String> labelsToAdd=vars.stream().filter(v -> "String_Node_Str".equals(v.getName())).map(var -> var.getTerm().toString()).collect(Collectors.toSet());
    result.getLabelsToRemove().addAll(labelsToRemove);
    result.getLabelsToAdd().addAll(labelsToAdd);
  }
 catch (  NoMoreSolutionException|MalformedGoalException|NoSolutionException e) {
    LOG.error(e.getMessage(),e);
  }
  return result;
}

Fixed version (ground truth):
@Override public TransformationDecision requestTranformations(ServiceNode lastServiceNode){
  TransformationDecision result=new TransformationDecision();
  String query=this.createTransformationQuery(lastServiceNode);
  LOG.info("String_Node_Str" + query);
  try {
    List<SolveInfo> solveInfo=this.engine.query(query,false);
    if (solveInfo.isEmpty()) {
      return result;
    }
    List<Var> vars=solveInfo.get(0).getBindingVars();
    Set<String> labelsToRemove=new HashSet<>();
    for (    Var var : vars) {
      if ("String_Node_Str".equals(var.getName()) && var.getLink() instanceof Struct) {
        Struct labelStruct=((Struct)var.getLink());
        int labelCount=labelStruct.getArity();
        for (int i=0; i < labelCount; i++) {
          Term label=labelStruct.getTerm(i);
          if (!label.isEmptyList()) {
            labelsToRemove.add(label.toString());
          }
        }
      }
    }
    Set<String> labelsToAdd=new HashSet<>();
    for (    Var var : vars) {
      if ("String_Node_Str".equals(var.getName()) && var.getLink() instanceof Struct) {
        Struct labelStruct=((Struct)var.getLink());
        int labelCount=labelStruct.getArity();
        for (int i=0; i < labelCount; i++) {
          Term label=labelStruct.getTerm(i);
          if (!label.isEmptyList()) {
            labelsToAdd.add(label.toString());
          }
        }
      }
    }
    result.getLabelsToRemove().addAll(labelsToRemove);
    result.getLabelsToAdd().addAll(labelsToAdd);
  }
 catch (  NoMoreSolutionException|MalformedGoalException|NoSolutionException e) {
    LOG.error(e.getMessage(),e);
  }
  return result;
}
Program: 40329
Project: 40329
Buggy source:
@Test public void testTransformationsMatch() throws IOException {
  PolicyDecisionPoint pdp=new PolicyDecisionPoint();
  pdp.activate(null);
  pdp.loadPolicy(new ByteArrayInputStream(EXAMPLE_POLICY.getBytes()));
  ServiceNode node=new ServiceNode("String_Node_Str",null,null);
  TransformationDecision trans=pdp.requestTranformations(node);
  assertNotNull(trans);
  assertNotNull(trans.getLabelsToAdd());
  assertNotNull(trans.getLabelsToRemove());
  assertEquals(1,trans.getLabelsToAdd().size());
  assertEquals(1,trans.getLabelsToRemove().size());
  assertTrue(trans.getLabelsToAdd().contains("String_Node_Str"));
  assertTrue(trans.getLabelsToRemove().contains("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testTransformationsMatch() throws IOException {
  PolicyDecisionPoint pdp=new PolicyDecisionPoint();
  pdp.activate(null);
  pdp.loadPolicy(new ByteArrayInputStream(EXAMPLE_POLICY.getBytes()));
  ServiceNode node=new ServiceNode("String_Node_Str",null,null);
  TransformationDecision trans=pdp.requestTranformations(node);
  assertNotNull(trans);
  assertNotNull(trans.getLabelsToAdd());
  assertNotNull(trans.getLabelsToRemove());
  assertEquals(2,trans.getLabelsToAdd().size());
  assertEquals(1,trans.getLabelsToRemove().size());
  assertTrue(trans.getLabelsToAdd().contains("String_Node_Str"));
  assertTrue(trans.getLabelsToRemove().contains("String_Node_Str"));
}
Program: 40330
Project: 40330
Buggy source:
@Override protected AsyncHttpClient createClient(AsyncHttpClientConfig config){
  AsyncHttpClient client;
  if (config == null) {
    config=new DefaultAsyncHttpClientConfig.Builder().setEnabledProtocols(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"}).build();
    client=new DefaultAsyncHttpClient(config);
  }
 else {
    client=new DefaultAsyncHttpClient();
  }
  return client;
}

Fixed version (ground truth):
@Override protected AsyncHttpClient createClient(AsyncHttpClientConfig config){
  AsyncHttpClient client;
  if (config == null) {
    config=new DefaultAsyncHttpClientConfig.Builder().setEnabledProtocols(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"}).build();
    client=new DefaultAsyncHttpClient(config);
  }
 else {
    client=new DefaultAsyncHttpClient(config);
  }
  return client;
}
Program: 40331
Project: 40331
Buggy source:
/** 
 * Stop a route based on an id.
 */
@GET @Path("String_Node_Str") public String stopRoute(@PathParam("String_Node_Str") String id){
  List<CamelContext> camelO=WebConsoleComponent.getCamelContexts();
  for (  CamelContext cCtx : camelO) {
    Route rt=cCtx.getRoute(id);
    if (rt != null) {
      try {
        cCtx.stopRoute(id);
      }
 catch (      Exception e) {
        return "String_Node_Str";
      }
    }
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Stop a route based on an id.
 */
@GET @Path("String_Node_Str") public String stopRoute(@PathParam("String_Node_Str") String id){
  List<CamelContext> camelO=WebConsoleComponent.getCamelContexts();
  for (  CamelContext cCtx : camelO) {
    Route rt=cCtx.getRoute(id);
    if (rt != null) {
      try {
        cCtx.suspendRoute(id);
      }
 catch (      Exception e) {
        return "String_Node_Str";
      }
    }
  }
  return "String_Node_Str";
}
Program: 40332
Project: 40332
Buggy source:
/** 
 * Returns map from camel context to list of camel routes. Example: {"camel-1":["Route(demo-route)[[From[timer://simpleTimer?period\u003d10000]] -\u003e [SetBody[simple{This is a demo body!}], Log[The message contains ${body}]]]"]}
 * @return
 */
@GET @Path("String_Node_Str") @Produces("String_Node_Str") public String list(){
  List<HashMap<String,String>> result=new ArrayList<>();
  List<CamelContext> camelO=WebConsoleComponent.getCamelContexts();
  for (  CamelContext cCtx : camelO) {
    for (    RouteDefinition rd : cCtx.getRouteDefinitions()) {
      HashMap<String,String> route=new HashMap<>();
      route.put("String_Node_Str",rd.getId());
      route.put("String_Node_Str",(rd.getDescriptionText() != null) ? rd.getDescriptionText() : "String_Node_Str");
      route.put("String_Node_Str",routeToDot(rd));
      route.put("String_Node_Str",rd.getShortName());
      route.put("String_Node_Str",cCtx.getName());
      route.put("String_Node_Str",String.valueOf(cCtx.getUptimeMillis()));
      route.put("String_Node_Str",cCtx.getStatus().toString());
      result.add(route);
    }
  }
  return new GsonBuilder().create().toJson(result);
}

Fixed version (ground truth):
/** 
 * Returns map from camel context to list of camel routes. Example: {"camel-1":["Route(demo-route)[[From[timer://simpleTimer?period\u003d10000]] -\u003e [SetBody[simple{This is a demo body!}], Log[The message contains ${body}]]]"]}
 * @return
 */
@GET @Path("String_Node_Str") @Produces("String_Node_Str") public String list(){
  List<HashMap<String,String>> result=new ArrayList<>();
  List<CamelContext> camelO=WebConsoleComponent.getCamelContexts();
  for (  CamelContext cCtx : camelO) {
    for (    RouteDefinition rd : cCtx.getRouteDefinitions()) {
      HashMap<String,String> route=new HashMap<>();
      route.put("String_Node_Str",rd.getId());
      route.put("String_Node_Str",(rd.getDescriptionText() != null) ? rd.getDescriptionText() : "String_Node_Str");
      route.put("String_Node_Str",routeToDot(rd));
      route.put("String_Node_Str",rd.getShortName());
      route.put("String_Node_Str",cCtx.getName());
      route.put("String_Node_Str",String.valueOf(cCtx.getUptimeMillis()));
      route.put("String_Node_Str",String.valueOf(cCtx.getUptimeMillis()));
      route.put("String_Node_Str",cCtx.getRouteStatus(rd.getId()).toString());
      result.add(route);
    }
  }
  return new GsonBuilder().create().toJson(result);
}
Program: 40334
Project: 40334
Buggy source:
@Override public void fromBytes(byte[] source,int offset){
  ByteArrayReadWriter brw=new ByteArrayReadWriter(source,offset);
  this.sigAlg=new TPMI_ALG_SIG_SCHEME();
  brw.readStruct(this.sigAlg);
  LOG.debug("String_Node_Str" + ByteArrayUtil.toHexString(this.sigAlg.getAlgId().Id()));
switch (this.sigAlg.getAlgId().getAlgId()) {
case TPM_ALG_RSASSA:
    break;
case TPM_ALG_RSAPSS:
  this.signature=new TPMS_SIGNATURE_RSAPSS();
brw.readStruct(this.signature);
break;
case TPM_ALG_ECDSA:
case TPM_ALG_SM2:
case TPM_ALG_ECDAA:
break;
case TPM_ALG_ECSCHNORR:
this.signature=new TPMS_SIGNATURE_ECDSA();
brw.readStruct(this.signature);
break;
default :
LOG.debug("String_Node_Str" + this.sigAlg.getAlgId().getAlgId().toString() + "String_Node_Str"+ this.sigAlg.getAlgId().getAlgId().name()+ "String_Node_Str");
break;
}
}

Fixed version (ground truth):
@Override public void fromBytes(byte[] source,int offset){
  ByteArrayReadWriter brw=new ByteArrayReadWriter(source,offset);
  this.sigAlg=new TPMI_ALG_SIG_SCHEME();
  brw.readStruct(this.sigAlg);
  LOG.debug("String_Node_Str" + ByteArrayUtil.toHexString(this.sigAlg.getAlgId().Id()));
switch (this.sigAlg.getAlgId().getAlgId()) {
case TPM_ALG_RSASSA:
    this.signature=new TPMS_SIGNATURE_RSAPSS();
  brw.readStruct(this.signature);
break;
case TPM_ALG_RSAPSS:
break;
case TPM_ALG_ECDSA:
case TPM_ALG_SM2:
case TPM_ALG_ECDAA:
break;
case TPM_ALG_ECSCHNORR:
this.signature=new TPMS_SIGNATURE_ECDSA();
brw.readStruct(this.signature);
break;
default :
LOG.debug("String_Node_Str" + this.sigAlg.getAlgId().getAlgId().toString() + "String_Node_Str"+ this.sigAlg.getAlgId().getAlgId().name()+ "String_Node_Str");
break;
}
}
Program: 40335
Project: 40335
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + exception.getMessage() + "String_Node_Str"+ pos.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + exception.getMessage();
}
Program: 40336
Project: 40336
Buggy source:
@FXML private void handleMenuPlay(ActionEvent event){
  log.setText("String_Node_Str");
  val input=editor.getText();
  val context=new Context();
  BundleLoader.load(context,Arrays.asList(CompositionBundle.class,NodesBundle.class));
  val parser=new HotaruParser(HotaruLexer.tokenize(input));
  val program=parser.parse();
  if (parser.getParseErrors().hasErrors()) {
    val sb=new StringBuilder();
    for (    ParseError parseError : parser.getParseErrors()) {
      sb.append(parseError);
    }
    log.setText(sb.toString());
    logPane.setExpanded(true);
    return;
  }
  program.accept(new InterpreterVisitor(),context);
  val stage=new Stage();
  val composition=context.composition();
  stage.setScene(composition.produceAnimationScene());
  composition.getTimeline().getFxTimeline().play();
  stage.show();
}

Fixed version (ground truth):
@FXML private void handleMenuPlay(ActionEvent event){
  log.setText("String_Node_Str");
  val input=editor.getText();
  val context=new Context();
  BundleLoader.load(context,Arrays.asList(CompositionBundle.class,NodesBundle.class));
  val parser=new HotaruParser(HotaruLexer.tokenize(input));
  val program=parser.parse();
  if (parser.getParseErrors().hasErrors()) {
    log.setText(parser.getParseErrors().toString());
    logPane.setExpanded(true);
    return;
  }
  program.accept(new InterpreterVisitor(),context);
  val stage=new Stage();
  val composition=context.composition();
  stage.setScene(composition.produceAnimationScene());
  composition.getTimeline().getFxTimeline().play();
  stage.show();
}
Program: 40337
Project: 40337
Buggy source:
private OrderSpecifier<?> toOrderSpecifier(Sorting sorting){
  if (sorting == null) {
    sorting=Sorting.of(Sorting.By.ASN,Sorting.Direction.ASC);
  }
  Expression<? extends Comparable> column;
switch (sorting.getBy()) {
case PREFIX:
    column=roaPrefixAssertion.prefix;
  break;
case COMMENT:
column=roaPrefixAssertion.comment;
break;
case ASN:
default :
column=roaPrefixAssertion.asn;
break;
}
Order order=sorting.getDirection() == Sorting.Direction.DESC ? Order.DESC : Order.ASC;
return new OrderSpecifier<>(order,column);
}

Fixed version (ground truth):
private OrderSpecifier<?> toOrderSpecifier(Sorting sorting){
  if (sorting == null) {
    sorting=Sorting.of(Sorting.By.ASN,Sorting.Direction.ASC);
  }
  Expression<? extends Comparable> column;
switch (sorting.getBy()) {
case PREFIX:
    column=roaPrefixAssertion.prefix;
  break;
case COMMENT:
column=roaPrefixAssertion.comment;
break;
case MAXIMUMLENGTH:
column=roaPrefixAssertion.maximumLength;
break;
case ASN:
default :
column=roaPrefixAssertion.asn;
break;
}
Order order=sorting.getDirection() == Sorting.Direction.DESC ? Order.DESC : Order.ASC;
return new OrderSpecifier<>(order,column);
}
Program: 40338
Project: 40338
Buggy source:
@GetMapping public ResponseEntity<ApiResponse<Stream<IgnoreFilter>>> list(@RequestParam(name="String_Node_Str",defaultValue="String_Node_Str") int startFrom,@RequestParam(name="String_Node_Str",defaultValue="String_Node_Str") int pageSize,@RequestParam(name="String_Node_Str",defaultValue="String_Node_Str",required=false) String searchString,@RequestParam(name="String_Node_Str",defaultValue="String_Node_Str") String sortBy,@RequestParam(name="String_Node_Str",defaultValue="String_Node_Str") String sortDirection){
  final SearchTerm searchTerm=StringUtils.isNotBlank(searchString) ? new SearchTerm(searchString) : null;
  final Sorting sorting=Sorting.parse(sortBy,sortDirection);
  final Paging paging=Paging.of(startFrom,pageSize);
  final List<net.ripe.rpki.validator3.domain.IgnoreFilter> all=ignoreFilters.all().collect(Collectors.toList());
  int totalSize=all.size();
  final Links links=Paging.links(startFrom,pageSize,totalSize,(sf,ps) -> methodOn(IgnoreFiltersController.class).list(sf,ps,searchString,sortBy,sortDirection));
  return ResponseEntity.ok(ApiResponse.<Stream<IgnoreFilter>>builder().links(links).metadata(Metadata.of(totalSize)).data(all.stream().map(f -> toIgnoreFilter(f))).build());
}

Fixed version (ground truth):
@GetMapping public ResponseEntity<ApiResponse<Stream<IgnoreFilter>>> list(@RequestParam(name="String_Node_Str",defaultValue="String_Node_Str") int startFrom,@RequestParam(name="String_Node_Str",defaultValue="String_Node_Str") int pageSize,@RequestParam(name="String_Node_Str",defaultValue="String_Node_Str",required=false) String searchString,@RequestParam(name="String_Node_Str",defaultValue="String_Node_Str") String sortBy,@RequestParam(name="String_Node_Str",defaultValue="String_Node_Str") String sortDirection){
  final SearchTerm searchTerm=StringUtils.isNotBlank(searchString) ? new SearchTerm(searchString) : null;
  final Sorting sorting=Sorting.parse(sortBy,sortDirection);
  final Paging paging=Paging.of(startFrom,pageSize);
  final List<net.ripe.rpki.validator3.domain.IgnoreFilter> matching=ignoreFilters.find(searchTerm,sorting,paging).collect(Collectors.toList());
  int totalSize=(int)ignoreFilters.count(searchTerm);
  final Links links=Paging.links(startFrom,pageSize,totalSize,(sf,ps) -> methodOn(IgnoreFiltersController.class).list(sf,ps,searchString,sortBy,sortDirection));
  return ResponseEntity.ok(ApiResponse.<Stream<IgnoreFilter>>builder().links(links).metadata(Metadata.of(totalSize)).data(matching.stream().map(this::toIgnoreFilter)).build());
}
Program: 40340
Project: 40340
Buggy source:
private static Validity validateBgpRisEntry(IntervalMap<IpRange,List<RoaPrefix>> roaPrefixes,BgpPreviewEntry bgpRisEntry){
  List<RoaPrefix> matchingRoaPrefixes=roaPrefixes.findExactAndAllLessSpecific(bgpRisEntry.getPrefix()).stream().flatMap(Collection::stream).collect(Collectors.toList());
  List<RoaPrefix> matchingAsnRoas=matchingRoaPrefixes.stream().filter(roaPrefix -> roaPrefix.getAsn().equals(bgpRisEntry.getOrigin())).collect(Collectors.toList());
  Validity validity;
  if (matchingRoaPrefixes.isEmpty()) {
    validity=Validity.UNKNOWN;
  }
 else   if (matchingAsnRoas.isEmpty()) {
    validity=Validity.INVALID_ASN;
  }
 else   if (matchingAsnRoas.stream().noneMatch(roaPrefix -> roaPrefix.getEffectiveLength() >= bgpRisEntry.getPrefix().getPrefixLength())) {
    validity=Validity.INVALID_LENGTH;
  }
 else {
    validity=Validity.VALID;
  }
  return validity;
}

Fixed version (ground truth):
private static Validity validateBgpRisEntry(List<RoaPrefix> matchingRoaPrefixes,BgpPreviewEntry bgpRisEntry){
  List<RoaPrefix> matchingAsnRoas=matchingRoaPrefixes.stream().filter(roaPrefix -> roaPrefix.getAsn().equals(bgpRisEntry.getOrigin())).collect(Collectors.toList());
  final Validity validity;
  if (matchingRoaPrefixes.isEmpty()) {
    validity=Validity.UNKNOWN;
  }
 else   if (matchingAsnRoas.isEmpty()) {
    validity=Validity.INVALID_ASN;
  }
 else   if (matchingAsnRoas.stream().noneMatch(roaPrefix -> roaPrefix.getEffectiveLength() >= bgpRisEntry.getPrefix().getPrefixLength())) {
    validity=Validity.INVALID_LENGTH;
  }
 else {
    validity=Validity.VALID;
  }
  return validity;
}
Program: 40341
Project: 40341
Buggy source:
public BgpValidityResource validity(final Asn origin,final IpRange prefix){
  final List<Pair<RoaPrefix,Validity>> roaPrefixes=this.roaPrefixes.findExactAndAllLessSpecific(prefix).stream().flatMap(x -> x.stream()).map(r -> {
    final BgpPreviewEntry bgpPreviewEntry=BgpPreviewEntry.of(origin,prefix,Validity.UNKNOWN);
    final Validity validity=validateBgpRisEntry(this.roaPrefixes,bgpPreviewEntry);
    return Pair.of(r,validity);
  }
).sorted(Comparator.comparingInt(p -> {
switch (p.getRight()) {
case VALID:
      return 0;
case INVALID_LENGTH:
    return 1;
case INVALID_ASN:
  return 2;
}
return 10;
}
)).collect(Collectors.toList());
final Validity validity=roaPrefixes.stream().findFirst().map(p -> p.getRight()).orElse(Validity.UNKNOWN);
final List<ValidatingRoa> validatingRoaStream=roaPrefixes.stream().flatMap(p -> {
final RoaPrefix r=p.getLeft();
if (r.getTrustAnchor() != null) {
return r.getLocations().stream().map(loc -> ValidatingRoa.of(r.getAsn().toString(),r.getPrefix().toString(),p.getRight().toString(),r.getMaximumLength(),r.getTrustAnchor() == null ? null : r.getTrustAnchor().getName(),loc,null,null));
}
 else if (r.getRoaPrefixAssertionId() != null) {
return Stream.of(ValidatingRoa.of(r.getAsn().toString(),r.getPrefix().toString(),p.getRight().toString(),r.getMaximumLength(),null,null,r.getRoaPrefixAssertionId(),r.getComment()));
}
 else {
return Stream.empty();
}
}
).distinct().collect(Collectors.toList());
return BgpValidityResource.of(origin.toString(),prefix.toString(),validity.toString(),validatingRoaStream);
}

Fixed version (ground truth):
public BgpValidityResource validity(final Asn origin,final IpRange prefix){
  final List<Pair<RoaPrefix,Validity>> roaPrefixes=this.roaPrefixes.findExactAndAllLessSpecific(prefix).stream().flatMap(x -> x.stream()).map(r -> {
    final BgpPreviewEntry bgpPreviewEntry=BgpPreviewEntry.of(origin,prefix,Validity.UNKNOWN);
    final Validity validity=validateBgpRisEntry(Collections.singletonList(r),bgpPreviewEntry);
    return Pair.of(r,validity);
  }
).sorted(Comparator.comparingInt(p -> {
switch (p.getRight()) {
case VALID:
      return 0;
case INVALID_LENGTH:
    return 1;
case INVALID_ASN:
  return 2;
}
return 10;
}
)).collect(Collectors.toList());
final Validity validity=roaPrefixes.stream().findFirst().map(p -> p.getRight()).orElse(Validity.UNKNOWN);
final List<ValidatingRoa> validatingRoaStream=roaPrefixes.stream().flatMap(p -> {
final RoaPrefix r=p.getLeft();
if (r.getTrustAnchor() != null) {
return r.getLocations().stream().map(loc -> ValidatingRoa.of(r.getAsn().toString(),r.getPrefix().toString(),p.getRight().toString(),r.getMaximumLength(),r.getTrustAnchor() == null ? null : r.getTrustAnchor().getName(),loc,null,null));
}
 else if (r.getRoaPrefixAssertionId() != null) {
return Stream.of(ValidatingRoa.of(r.getAsn().toString(),r.getPrefix().toString(),p.getRight().toString(),r.getMaximumLength(),null,null,r.getRoaPrefixAssertionId(),r.getComment()));
}
 else {
return Stream.empty();
}
}
).distinct().collect(Collectors.toList());
return BgpValidityResource.of(origin.toString(),prefix.toString(),validity.toString(),validatingRoaStream);
}
Program: 40342
Project: 40342
Buggy source:
public List<BgpRisEntry> parse(final InputStream is){
  final BufferedReader reader=new BufferedReader(new InputStreamReader(is));
  String line=null;
  final List<BgpRisEntry> entries=new ArrayList<>();
  final IdentityMap id=new IdentityMap();
  do {
    try {
      line=reader.readLine();
      final BgpRisEntry e=parseLine(line,id::unique);
      if (e != null) {
        entries.add(e);
      }
    }
 catch (    Exception e) {
      log.error("String_Node_Str" + line);
    }
  }
 while (line != null);
  return entries;
}

Fixed version (ground truth):
public List<BgpRisEntry> parse(final InputStream is){
  final BufferedReader reader=new BufferedReader(new InputStreamReader(is));
  String line=null;
  final List<BgpRisEntry> entries=new ArrayList<>();
  final IdentityMap id=new IdentityMap();
  while (true) {
    try {
      line=reader.readLine();
      if (line == null) {
        return entries;
      }
      final BgpRisEntry e=parseLine(line,id::unique);
      if (e != null) {
        entries.add(e);
      }
    }
 catch (    Exception e) {
      log.error("String_Node_Str" + line);
      return entries;
    }
  }
}
Program: 40343
Project: 40343
Buggy source:
@Test public void parse1() throws UnsupportedEncodingException {
  String line="String_Node_Str";
  List<BgpRisEntry> parsed=parse(line);
  assertEquals(1,parsed.size());
  assertEquals(new Asn(4200003018L),parsed.get(0).origin);
  assertEquals(IpRange.parse("String_Node_Str"),parsed.get(0).prefix);
  assertEquals(3,parsed.get(0).visibility);
}

Fixed version (ground truth):
@Test public void parse1() throws UnsupportedEncodingException {
  final String line="String_Node_Str";
  List<BgpRisEntry> parsed=parse(line);
  assertEquals(1,parsed.size());
  assertEquals(new Asn(4200003018L),parsed.get(0).origin);
  assertEquals(IpRange.parse("String_Node_Str"),parsed.get(0).prefix);
  assertEquals(3,parsed.get(0).visibility);
}
Program: 40345
Project: 40345
Buggy source:
@Override public int length(){
  return 8;
}

Fixed version (ground truth):
@Override public int length(){
  return PDU_LENGTH;
}
Program: 40346
Project: 40346
Buggy source:
@Override public int length(){
switch (protocolVersion) {
case V0:
    return 12;
case V1:
  return 24;
}
throw new IllegalStateException("String_Node_Str" + protocolVersion);
}

Fixed version (ground truth):
@Override public int length(){
switch (protocolVersion) {
case V0:
    return PDU_LENGTH_V0;
case V1:
  return PDU_LENGTH_V1;
}
throw new IllegalStateException("String_Node_Str" + protocolVersion);
}
Program: 40347
Project: 40347
Buggy source:
@Override public void write(ByteBuf out){
  out.writeByte(protocolVersion.getValue()).writeByte(PDU_TYPE).writeShort(sessionId).writeInt(length());
switch (protocolVersion) {
case V0:
    return;
case V1:
  out.writeInt(serialNumber.getValue()).writeInt(refreshInterval).writeInt(retryInterval).writeInt(expireInterval);
return;
}
throw new IllegalStateException("String_Node_Str" + protocolVersion);
}

Fixed version (ground truth):
@Override public void write(ByteBuf out){
  out.writeByte(protocolVersion.getValue()).writeByte(PDU_TYPE).writeShort(sessionId).writeInt(length()).writeInt(serialNumber.getValue());
switch (protocolVersion) {
case V0:
    return;
case V1:
  out.writeInt(refreshInterval).writeInt(retryInterval).writeInt(expireInterval);
return;
}
throw new IllegalStateException("String_Node_Str" + protocolVersion);
}
Program: 40348
Project: 40348
Buggy source:
public void write(ByteBuf out){
  final byte[] errorTextBytes=errorTextBytes();
  out.writeByte(protocolVersion.getValue()).writeByte(PDU_TYPE).writeShort(0).writeInt(length()).writeBytes(causingPdu).writeInt(errorTextBytes.length).writeBytes(errorTextBytes);
}

Fixed version (ground truth):
public void write(ByteBuf out){
  final byte[] errorTextBytes=errorTextBytes();
  out.writeByte(protocolVersion.getValue()).writeByte(PDU_TYPE).writeShort(errorCode.getCode()).writeInt(length()).writeInt(causingPdu.length).writeBytes(causingPdu).writeInt(errorTextBytes.length).writeBytes(errorTextBytes);
}
Program: 40349
Project: 40349
Buggy source:
@Override public int length(){
  return 20;
}

Fixed version (ground truth):
@Override public int length(){
  return PDU_LENGTH;
}
Program: 40350
Project: 40350
Buggy source:
@Override public int length(){
  return 32;
}

Fixed version (ground truth):
@Override public int length(){
  return PDU_LENGTH;
}
Program: 40351
Project: 40351
Buggy source:
@Override public int length(){
  return 12;
}

Fixed version (ground truth):
@Override public int length(){
  return PDU_LENGTH;
}
Program: 40352
Project: 40352
Buggy source:
public void addRpkiObject(RpkiObject rpkiObject){
  rpkiObjects.add(rpkiObject);
}

Fixed version (ground truth):
public void addRpkiObject(RpkiObject rpkiObject){
  if (rpkiObjects.add(rpkiObject)) {
    objectAdded();
  }
}
Program: 40353
Project: 40353
Buggy source:
public void addRpkiObject(RpkiObject rpkiObject){
  rpkiObjects.add(rpkiObject);
}

Fixed version (ground truth):
public void addRpkiObject(RpkiObject rpkiObject){
  if (rpkiObjects.add(rpkiObject)) {
    objectAdded();
  }
}
Program: 40354
Project: 40354
Buggy source:
private void verifyDeltaSerials(final List<Delta> orderedDeltas,final Notification notification,RpkiRepository rpkiRepository){
  if (orderedDeltas.isEmpty()) {
    throw new RrdpException("String_Node_Str" + rpkiRepository.getRrdpSerial() + "String_Node_Str"+ notification.serial+ "String_Node_Str");
  }
  final BigInteger lastDeltaSerial=orderedDeltas.get(orderedDeltas.size() - 1).getSerial();
  if (!notification.serial.equals(lastDeltaSerial)) {
    throw new RrdpException("String_Node_Str" + lastDeltaSerial + "String_Node_Str"+ notification.serial);
  }
  final BigInteger[] previous={null};
  orderedDeltas.forEach(d -> {
    if (previous[0] == null) {
      previous[0]=d.getSerial();
    }
 else {
      if (!d.getSerial().equals(previous[0].add(BigInteger.ONE))) {
        throw new RrdpException(String.format("String_Node_Str",previous[0],d.getSerial()));
      }
    }
  }
);
}

Fixed version (ground truth):
private void verifyDeltaSerials(final List<Delta> orderedDeltas,final Notification notification,RpkiRepository rpkiRepository){
  if (orderedDeltas.isEmpty()) {
    if (!rpkiRepository.getRrdpSerial().equals(notification.serial)) {
      throw new RrdpException("String_Node_Str" + rpkiRepository.getRrdpSerial() + "String_Node_Str"+ notification.serial+ "String_Node_Str");
    }
  }
 else {
    final BigInteger lastDeltaSerial=orderedDeltas.get(orderedDeltas.size() - 1).getSerial();
    if (!notification.serial.equals(lastDeltaSerial)) {
      throw new RrdpException("String_Node_Str" + lastDeltaSerial + "String_Node_Str"+ notification.serial);
    }
    final BigInteger[] previous={null};
    orderedDeltas.forEach(d -> {
      if (previous[0] == null) {
        previous[0]=d.getSerial();
      }
 else {
        if (!d.getSerial().equals(previous[0].add(BigInteger.ONE))) {
          throw new RrdpException(String.format("String_Node_Str",previous[0],d.getSerial()));
        }
      }
    }
);
  }
}
Program: 40355
Project: 40355
Buggy source:
public static Session fromBootstrap(io.microprofile.showcase.bootstrap.Session bootstrapModel){
  Session session=new Session(bootstrapModel.getId(),bootstrapModel.getUnderlying());
  session.setSpeakers(bootstrapModel.getSpeakers());
  session.setSchedule(bootstrapModel.getSchedule());
  return session;
}

Fixed version (ground truth):
public static Session fromBootstrap(io.microprofile.showcase.bootstrap.Session bootstrapModel){
  Session session=new Session(Integer.valueOf(bootstrapModel.getId()),bootstrapModel.getUnderlying());
  session.setSpeakers(mapStringToIntCollection(bootstrapModel.getSpeakers()));
  session.setSchedule(Integer.valueOf(bootstrapModel.getSchedule()));
  return session;
}
Program: 40356
Project: 40356
Buggy source:
@PostConstruct private void initStore(){
  Logger.getLogger(SessionStore.class.getName()).log(Level.INFO,"String_Node_Str");
  bootstrapData.getSessions().forEach(bootstrap -> storage.put(bootstrap.getId(),SessionFactory.fromBootstrap(bootstrap)));
}

Fixed version (ground truth):
@PostConstruct private void initStore(){
  Logger.getLogger(SessionStore.class.getName()).log(Level.INFO,"String_Node_Str");
  bootstrapData.getSessions().forEach(bootstrap -> storage.put(Integer.valueOf(bootstrap.getId()),SessionFactory.fromBootstrap(bootstrap)));
}
Program: 40357
Project: 40357
Buggy source:
@PostConstruct private void initStore(){
  Logger.getLogger(SpeakerDAO.class.getName()).log(Level.INFO,"String_Node_Str");
  final Set<Speaker> featured=new HashSet<>(0);
  for (  final Venue venue : this.venues) {
    featured.addAll(venue.getSpeakers());
  }
  final AtomicInteger idc=new AtomicInteger(0);
  this.bootstrapData.getSpeaker().forEach(bootstrap -> {
    final int intId=bootstrap.getId();
    if (intId > idc.get()) {
      idc.set(intId);
    }
    final String id=String.valueOf(intId);
    final String[] names=bootstrap.getFullName().split("String_Node_Str");
    final Speaker sp=new Speaker();
    sp.setId(id);
    sp.setNameFirst(names[0].trim());
    sp.setNameLast(names[1].trim());
    sp.setOrganization(bootstrap.getCompany());
    sp.setBiography(bootstrap.getJobTitle());
    sp.setPicture("String_Node_Str");
    appendFeatured(featured,sp);
    this.speakers.put(id,sp);
  }
);
  for (  final Speaker fs : featured) {
    boolean found=false;
    for (    final Speaker sp : this.speakers.values()) {
      if (fs.getNameFirst().toLowerCase().equals(sp.getNameFirst().toLowerCase()) && fs.getNameLast().toLowerCase().equals(sp.getNameLast().toLowerCase())) {
        found=true;
        break;
      }
    }
    if (!found) {
      fs.setId(String.valueOf(idc.incrementAndGet()));
      this.speakers.put(fs.getId(),fs);
    }
  }
}

Fixed version (ground truth):
@PostConstruct private void initStore(){
  Logger.getLogger(SpeakerDAO.class.getName()).log(Level.INFO,"String_Node_Str");
  final Set<Speaker> featured=new HashSet<>(0);
  for (  final Venue venue : this.venues) {
    featured.addAll(venue.getSpeakers());
  }
  final AtomicInteger idc=new AtomicInteger(0);
  this.bootstrapData.getSpeaker().forEach(bootstrap -> {
    final int intId=Integer.valueOf(bootstrap.getId());
    if (intId > idc.get()) {
      idc.set(intId);
    }
    final String id=String.valueOf(intId);
    final String[] names=bootstrap.getFullName().split("String_Node_Str");
    final Speaker sp=new Speaker();
    sp.setId(id);
    sp.setNameFirst(names[0].trim());
    sp.setNameLast(names[1].trim());
    sp.setOrganization(bootstrap.getCompany());
    sp.setBiography(bootstrap.getJobTitle());
    sp.setPicture("String_Node_Str");
    appendFeatured(featured,sp);
    this.speakers.put(id,sp);
  }
);
  for (  final Speaker fs : featured) {
    boolean found=false;
    for (    final Speaker sp : this.speakers.values()) {
      if (fs.getNameFirst().toLowerCase().equals(sp.getNameFirst().toLowerCase()) && fs.getNameLast().toLowerCase().equals(sp.getNameLast().toLowerCase())) {
        found=true;
        break;
      }
    }
    if (!found) {
      fs.setId(String.valueOf(idc.incrementAndGet()));
      this.speakers.put(fs.getId(),fs);
    }
  }
}
Program: 40358
Project: 40358
Buggy source:
public ImageApiProfile addFeature(Feature first,Feature... rest){
  this.features.addAll(Lists.asList(first,rest));
  return this;
}

Fixed version (ground truth):
public ImageApiProfile addFeature(Feature first,Feature... rest){
  if (this.features == null) {
    this.features=new LinkedHashSet<>();
  }
  this.features.addAll(Lists.asList(first,rest));
  return this;
}
Program: 40359
Project: 40359
Buggy source:
public ImageApiProfile addFormat(Format first,Format... rest){
  this.formats.addAll(Lists.asList(first,rest));
  return this;
}

Fixed version (ground truth):
public ImageApiProfile addFormat(Format first,Format... rest){
  if (this.formats == null) {
    this.formats=new LinkedHashSet<>();
  }
  this.formats.addAll(Lists.asList(first,rest));
  return this;
}
Program: 40360
Project: 40360
Buggy source:
public ImageApiProfile addQuality(Quality first,Quality... rest){
  this.qualities.addAll(Lists.asList(first,rest));
  return this;
}

Fixed version (ground truth):
public ImageApiProfile addQuality(Quality first,Quality... rest){
  if (this.qualities == null) {
    this.qualities=new LinkedHashSet<>();
  }
  this.qualities.addAll(Lists.asList(first,rest));
  return this;
}
Program: 40361
Project: 40361
Buggy source:
/** 
 * Merge two profiles. 
 */
public ImageApiProfile merge(ImageApiProfile other){
  ImageApiProfile merged=new ImageApiProfile();
  merged.features.addAll(this.features);
  merged.features.addAll(other.features);
  merged.formats.addAll(this.formats);
  merged.formats.addAll(other.formats);
  merged.qualities.addAll(this.qualities);
  merged.qualities.addAll(other.qualities);
  other.getFeatures().forEach(merged::addFeature);
  if (this.maxWidth != null && other.maxWidth == null) {
    merged.maxWidth=this.maxWidth;
  }
 else   if (this.maxWidth == null && other.maxWidth != null) {
    merged.maxWidth=other.maxWidth;
  }
 else   if (this.maxWidth != null) {
    merged.maxWidth=Math.min(this.maxWidth,other.maxWidth);
  }
  if (this.maxHeight != null && other.maxHeight == null) {
    merged.maxHeight=this.maxHeight;
  }
 else   if (this.maxHeight == null && other.maxHeight != null) {
    merged.maxHeight=other.maxHeight;
  }
 else   if (this.maxHeight != null) {
    merged.maxHeight=Math.min(this.maxHeight,other.maxHeight);
  }
  if (this.maxArea != null && other.maxArea == null) {
    merged.maxArea=this.maxArea;
  }
 else   if (this.maxArea == null && other.maxArea != null) {
    merged.maxArea=other.maxArea;
  }
 else   if (this.maxArea != null) {
    merged.maxArea=Math.min(this.maxArea,other.maxArea);
  }
  return merged;
}

Fixed version (ground truth):
/** 
 * Merge two profiles. 
 */
public ImageApiProfile merge(ImageApiProfile other){
  ImageApiProfile merged=new ImageApiProfile();
  streamNotNull(this.features).forEach(merged::addFeature);
  streamNotNull(other.features).forEach(merged::addFeature);
  streamNotNull(this.formats).forEach(merged::addFormat);
  streamNotNull(other.formats).forEach(merged::addFormat);
  streamNotNull(this.qualities).forEach(merged::addQuality);
  streamNotNull(other.qualities).forEach(merged::addQuality);
  if (this.maxWidth != null && other.maxWidth == null) {
    merged.maxWidth=this.maxWidth;
  }
 else   if (this.maxWidth == null && other.maxWidth != null) {
    merged.maxWidth=other.maxWidth;
  }
 else   if (this.maxWidth != null) {
    merged.maxWidth=Math.min(this.maxWidth,other.maxWidth);
  }
  if (this.maxHeight != null && other.maxHeight == null) {
    merged.maxHeight=this.maxHeight;
  }
 else   if (this.maxHeight == null && other.maxHeight != null) {
    merged.maxHeight=other.maxHeight;
  }
 else   if (this.maxHeight != null) {
    merged.maxHeight=Math.min(this.maxHeight,other.maxHeight);
  }
  if (this.maxArea != null && other.maxArea == null) {
    merged.maxArea=this.maxArea;
  }
 else   if (this.maxArea == null && other.maxArea != null) {
    merged.maxArea=other.maxArea;
  }
 else   if (this.maxArea != null) {
    merged.maxArea=Math.min(this.maxArea,other.maxArea);
  }
  return merged;
}
Program: 40362
Project: 40362
Buggy source:
/** 
 * Create the canonical of the Image API request. See http://iiif.io/api/image/2.1/#canonical-uri-syntax
 * @param nativeSize      Native size of the image the selector is applied to
 * @param profile         Image API profile used
 * @param defaultQuality  The native/default quality of the image the selector is applied to
 * @return The canonical form of the Image API request
 */
public String getCanonicalForm(Dimension nativeSize,ImageApiProfile profile,Quality defaultQuality){
  return String.format("String_Node_Str",identifier != null ? urlEncode(identifier) + "String_Node_Str" : "String_Node_Str",region.getCanonicalForm(nativeSize),size.getCanonicalForm(nativeSize,profile),rotation.toString(),quality.equals(defaultQuality) ? "String_Node_Str" : quality.toString(),format.toString());
}

Fixed version (ground truth):
/** 
 * Create the canonical of the Image API request. See http://iiif.io/api/image/2.1/#canonical-uri-syntax
 * @param nativeSize      Native size of the image the selector is applied to
 * @param profile         Image API profile used
 * @param defaultQuality  The native/default quality of the image the selector is applied to
 * @return The canonical form of the Image API request
 */
public String getCanonicalForm(Dimension nativeSize,ImageApiProfile profile,Quality defaultQuality){
  Dimension scaleReference=nativeSize;
  Rectangle2D canonicalRegion=RegionRequest.fromString(region.getCanonicalForm(nativeSize)).getRegion();
  if (canonicalRegion != null) {
    scaleReference=new Dimension((int)canonicalRegion.getWidth(),(int)canonicalRegion.getHeight());
  }
  return String.format("String_Node_Str",identifier != null ? urlEncode(identifier) + "String_Node_Str" : "String_Node_Str",region.getCanonicalForm(nativeSize),size.getCanonicalForm(scaleReference,profile),rotation.toString(),quality.equals(defaultQuality) ? "String_Node_Str" : quality.toString(),format.toString());
}
Program: 40363
Project: 40363
Buggy source:
/** 
 * Get the canonical form of this request.
 * @See http://iiif.io/api/image/2.1/#canonical-uri-syntax
 */
public String getCanonicalForm(Dimension nativeSize,ImageApiProfile profile){
  Dimension resolved=this.resolve(nativeSize,profile);
  double nativeRatio=nativeSize.getWidth() / nativeSize.getHeight();
  double resolvedRatio=resolved.getWidth() / resolved.getHeight();
  if (resolved.equals(nativeSize)) {
    return "String_Node_Str";
  }
 else   if (this.width != null && this.height == null) {
    return this.toString();
  }
 else   if (Math.round(resolvedRatio * nativeSize.getHeight()) == nativeSize.getWidth()) {
    return String.format("String_Node_Str",resolved.width);
  }
 else {
    return String.format("String_Node_Str",resolved.width,resolved.height);
  }
}

Fixed version (ground truth):
/** 
 * Get the canonical form of this request.
 * @See http://iiif.io/api/image/2.1/#canonical-uri-syntax
 */
public String getCanonicalForm(Dimension nativeSize,ImageApiProfile profile){
  Dimension resolved=this.resolve(nativeSize,profile);
  double nativeRatio=nativeSize.getWidth() / nativeSize.getHeight();
  double resolvedRatio=resolved.getWidth() / resolved.getHeight();
  if (resolved.equals(nativeSize)) {
    return "String_Node_Str";
  }
 else   if (this.width != null && this.height == null) {
    return this.toString();
  }
 else   if (Math.floor(resolvedRatio * nativeSize.getHeight()) == nativeSize.getWidth() || Math.ceil(resolvedRatio * nativeSize.getHeight()) == nativeSize.getWidth()) {
    return String.format("String_Node_Str",resolved.width);
  }
 else {
    return String.format("String_Node_Str",resolved.width,resolved.height);
  }
}
Program: 40364
Project: 40364
Buggy source:
public GeoService(String identifier,org.geojson.Feature feature){
  this();
  this.setIdentifier(URI.create(identifier));
  if (!isFeatureEmpty(feature)) {
    this.feature=feature;
  }
}

Fixed version (ground truth):
public GeoService(String identifier,org.geojson.Feature feature){
  this(identifier);
  if (!isFeatureEmpty(feature)) {
    this.feature=feature;
  }
}
Program: 40365
Project: 40365
Buggy source:
@Override public Service deserialize(JsonParser p,DeserializationContext ctxt) throws IOException, JsonProcessingException {
  ObjectMapper mapper=(ObjectMapper)p.getCodec();
  ObjectNode obj=mapper.readTree(p);
  if (isImageService(obj)) {
    return mapper.treeToValue(obj,ImageService.class);
  }
  String context=obj.get("String_Node_Str").asText();
  String profile=obj.get("String_Node_Str").asText();
  if (Objects.equals(context,ContentSearchService.CONTEXT)) {
    if (Objects.equals(profile,AutocompleteService.PROFILE)) {
      return mapper.treeToValue(obj,AutocompleteService.class);
    }
 else {
      return mapper.treeToValue(obj,ContentSearchService.class);
    }
  }
 else   if (Objects.equals(context,GeoService.CONTEXT)) {
    return mapper.treeToValue(obj,GeoService.class);
  }
 else   if (Objects.equals(context,PhysicalDimensionsService.CONTEXT)) {
    return mapper.treeToValue(obj,PhysicalDimensionsService.class);
  }
 else {
    return mapper.treeToValue(obj,GenericService.class);
  }
}

Fixed version (ground truth):
@Override public Service deserialize(JsonParser p,DeserializationContext ctxt) throws IOException, JsonProcessingException {
  ObjectMapper mapper=(ObjectMapper)p.getCodec();
  ObjectNode obj=mapper.readTree(p);
  if (isImageService(obj)) {
    return mapper.treeToValue(obj,ImageService.class);
  }
  String context=obj.get("String_Node_Str").asText();
  JsonNode profileNode=obj.get("String_Node_Str");
  String profile=null;
  if (profileNode != null) {
    profile=profileNode.asText();
  }
  if (Objects.equals(context,ContentSearchService.CONTEXT)) {
    if (Objects.equals(profile,AutocompleteService.PROFILE)) {
      return mapper.treeToValue(obj,AutocompleteService.class);
    }
 else {
      return mapper.treeToValue(obj,ContentSearchService.class);
    }
  }
 else   if (Objects.equals(context,GeoService.CONTEXT)) {
    return mapper.treeToValue(obj,GeoService.class);
  }
 else   if (Objects.equals(context,PhysicalDimensionsService.CONTEXT)) {
    return mapper.treeToValue(obj,PhysicalDimensionsService.class);
  }
 else {
    return mapper.treeToValue(obj,GenericService.class);
  }
}
Program: 40366
Project: 40366
Buggy source:
public boolean isImageService(ObjectNode node){
  JsonNode ctxNode=node.get("String_Node_Str");
  if (ctxNode != null && ImageService.CONTEXT.equals(ctxNode.textValue())) {
    return true;
  }
 else {
    return ImmutableSet.of(ImageApiProfile.LEVEL_ONE.getIdentifier().toString(),ImageApiProfile.LEVEL_TWO.getIdentifier().toString(),ImageApiProfile.LEVEL_ZERO.getIdentifier().toString()).contains(node.get("String_Node_Str").asText());
  }
}

Fixed version (ground truth):
public boolean isImageService(ObjectNode node){
  JsonNode ctxNode=node.get("String_Node_Str");
  JsonNode profileNode=node.get("String_Node_Str");
  if (ctxNode != null && ImageService.CONTEXT.equals(ctxNode.textValue())) {
    return true;
  }
 else   if (profileNode != null) {
    return ImmutableSet.of(ImageApiProfile.LEVEL_ONE.getIdentifier().toString(),ImageApiProfile.LEVEL_TWO.getIdentifier().toString(),ImageApiProfile.LEVEL_ZERO.getIdentifier().toString()).contains(profileNode.asText());
  }
 else {
    return false;
  }
}
Program: 40369
Project: 40369
Buggy source:
@Override protected void onPostExecute(StorjNode receivedStorjNode){
  super.onPostExecute(receivedStorjNode);
}

Fixed version (ground truth):
@Override protected void onPostExecute(StorjNode receivedStorjNode){
  super.onPostExecute(receivedStorjNode);
  if (mRetrigger) {
    pullStorjNodesStats(mContext);
    mRetrigger=false;
  }
}
Program: 40371
Project: 40371
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.action_settings:
    Intent i=new Intent(this,PreferencesActivity.class);
  startActivity(i);
return true;
case R.id.action_sort:
switchSortOrder();
return true;
case R.id.action_refresh:
pullSotrjNodeStats(mContext);
return true;
case R.id.action_help:
Intent browserIntent=new Intent(Intent.ACTION_VIEW,Uri.parse(Parameters.HELP_URL));
startActivity(browserIntent);
default :
return super.onOptionsItemSelected(item);
}
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.action_settings:
    Intent i=new Intent(this,PreferencesActivity.class);
  startActivity(i);
return true;
case R.id.action_sort:
switchSortOrder();
return true;
case R.id.action_refresh:
pullStorjNodeStats(mContext);
return true;
case R.id.action_help:
Intent browserIntent=new Intent(Intent.ACTION_VIEW,Uri.parse(Parameters.HELP_URL));
startActivity(browserIntent);
default :
return super.onOptionsItemSelected(item);
}
}
Program: 40376
Project: 40376
Buggy source:
public void showLoadingBar(int position,final boolean visible){
  final View parentView=mListView.getChildAt(position);
  if (parentView != null) {
    runOnUiThread(new Runnable(){
      @Override public void run(){
        if (visible) {
          parentView.findViewById(R.id.progressBar).setVisibility(View.VISIBLE);
          parentView.findViewById(R.id.responseTimeView).setVisibility(View.GONE);
        }
 else {
          parentView.findViewById(R.id.progressBar).setVisibility(View.GONE);
          parentView.findViewById(R.id.responseTimeView).setVisibility(View.VISIBLE);
        }
      }
    }
);
  }
}

Fixed version (ground truth):
public void showLoadingBar(final String nodeID,final boolean visible){
  final View nodeView=getNodeView(nodeID);
  if (nodeView != null) {
    runOnUiThread(new Runnable(){
      @Override public void run(){
        if (visible) {
          mCurrentLoadingNode=nodeID;
          nodeView.findViewById(R.id.progressBar).setVisibility(View.VISIBLE);
          nodeView.findViewById(R.id.responseTimeView).setVisibility(View.GONE);
        }
 else {
          mCurrentLoadingNode=null;
          nodeView.findViewById(R.id.progressBar).setVisibility(View.GONE);
          nodeView.findViewById(R.id.responseTimeView).setVisibility(View.VISIBLE);
        }
      }
    }
);
  }
}
Program: 40377
Project: 40377
Buggy source:
@Override public void run(){
  if (visible) {
    parentView.findViewById(R.id.progressBar).setVisibility(View.VISIBLE);
    parentView.findViewById(R.id.responseTimeView).setVisibility(View.GONE);
  }
 else {
    parentView.findViewById(R.id.progressBar).setVisibility(View.GONE);
    parentView.findViewById(R.id.responseTimeView).setVisibility(View.VISIBLE);
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (visible) {
    mCurrentLoadingNode=nodeID;
    nodeView.findViewById(R.id.progressBar).setVisibility(View.VISIBLE);
    nodeView.findViewById(R.id.responseTimeView).setVisibility(View.GONE);
  }
 else {
    mCurrentLoadingNode=null;
    nodeView.findViewById(R.id.progressBar).setVisibility(View.GONE);
    nodeView.findViewById(R.id.responseTimeView).setVisibility(View.VISIBLE);
  }
}