nus-yam/ex-repair huggingface dataset:
Program: 3768
Project: 3768
Buggy source:
public Model(){
  lib=new BuilderLibrary();
  parser=new DefParser(lib);
  ArrayList<File> files=getFiles(CONFIG_PATH);
  while (!files.isEmpty()) {
    ArrayList<File> toAdd=new ArrayList<>();
    for (    File f : files)     if (f.isFile())     parser.addFile(f);
 else     if (f.isDirectory())     toAdd.addAll(getFiles(f.getAbsolutePath()));
    files.clear();
    files.addAll(toAdd);
  }
  parser.readFile();
  this.map=MapFactory.getNew(128,128,lib);
  sunLight=new SunLight();
  parcelManager=new ParcelManager(map);
  lib.map=map;
  armyManager=new ArmyManager();
  lib.am=armyManager;
  commander=new Commander(armyManager,map);
  editor=new MapToolManager(map,parcelManager,lib);
}

Fixed version (ground truth):
public Model(){
  lib=new BuilderLibrary();
  parser=new DefParser(lib);
  ArrayList<File> files=getFiles(CONFIG_PATH);
  while (!files.isEmpty()) {
    ArrayList<File> toAdd=new ArrayList<>();
    for (    File f : files)     if (f.isFile())     parser.addFile(f);
 else     if (f.isDirectory())     toAdd.addAll(getFiles(f.getAbsolutePath()));
    files.clear();
    files.addAll(toAdd);
  }
  parser.readFile();
  MapFactory factory=new MapFactory(lib);
  this.map=factory.getNew(128,128);
  sunLight=new SunLight();
  parcelManager=new ParcelManager(map);
  lib.map=map;
  armyManager=new ArmyManager();
  lib.am=armyManager;
  commander=new Commander(armyManager,map);
  editor=new MapToolManager(map,parcelManager,lib);
}
Program: 3769
Project: 3769
Buggy source:
public static Map getNew(int width,int height,BuilderLibrary lib){
  Map res=new Map(width,height);
  for (int y=0; y < height; y++)   for (int x=0; x < width; x++)   res.tiles.add(new Tile(x,y,res));
  for (int x=0; x < width; x++)   for (int y=0; y < height; y++) {
    Tile t=res.getTile(x,y);
    if (x > 0)     t.w=res.getTile(x - 1,y);
    if (x < width - 1)     t.e=res.getTile(x + 1,y);
    if (y > 0)     t.s=res.getTile(x,y - 1);
    if (y < height - 1)     t.n=res.getTile(x,y + 1);
  }
  res.style=lib.getMapStyleBuilder("String_Node_Str").build();
  return res;
}

Fixed version (ground truth):
public Map getNew(int width,int height){
  Map res=new Map(width,height);
  for (int y=0; y < height; y++)   for (int x=0; x < width; x++)   res.tiles.add(new Tile(x,y,res));
  linkTiles(res);
  res.mapStyleID="String_Node_Str";
  res.style=lib.getMapStyleBuilder(res.mapStyleID).build();
  return res;
}
Program: 3770
Project: 3770
Buggy source:
public CliffTool(MapToolManager manager,Pencil selector,BuilderLibrary lib){
  super(manager,selector);
  builder1=lib.getCliffShapeBuilder("String_Node_Str");
  builder2=lib.getCliffShapeBuilder("String_Node_Str");
  actualBuilder=builder2;
}

Fixed version (ground truth):
public CliffTool(MapToolManager manager,Pencil selector,BuilderLibrary lib){
  super(manager,selector);
  actualBuilder=manager.map.style.cliffShapes.get(0);
}
Program: 3771
Project: 3771
Buggy source:
@Override public void toggleSet(){
  if (actualBuilder == builder1) {
    actualBuilder=builder2;
  }
 else {
    actualBuilder=builder1;
  }
  LogUtil.logger.info("String_Node_Str" + actualBuilder.getID() + "String_Node_Str");
}

Fixed version (ground truth):
@Override public void toggleSet(){
  ArrayList<CliffShapeBuilder> builders=manager.map.style.cliffShapes;
  int index=builders.indexOf(actualBuilder) + 1;
  if (index == builders.size())   index=0;
  actualBuilder=builders.get(index);
  LogUtil.logger.info("String_Node_Str" + actualBuilder.getID() + "String_Node_Str");
}
Program: 3772
Project: 3772
Buggy source:
@VisibleForTesting static double normalizeLongitude(double d){
  double sign=Math.signum(d);
  double x=Math.abs(d) / 360;
  double x2=(x - Math.floor(x)) * 360;
  if (x2 >= 180)   x2-=360;
  return x2 * sign;
}

Fixed version (ground truth):
@VisibleForTesting static double normalizeLongitude(double d){
  if (d == -180.0)   return -180.0;
 else {
    double sign=Math.signum(d);
    double x=Math.abs(d) / 360;
    double x2=(x - Math.floor(x)) * 360;
    if (x2 >= 180)     x2-=360;
    return x2 * sign;
  }
}
Program: 3773
Project: 3773
Buggy source:
private static <T extends HasGeometry>List<ListPair<T>> getPairs(int minSize,List<T> list){
  List<ListPair<T>> pairs=new ArrayList<ListPair<T>>(list.size() - 2 * minSize + 1);
  for (int i=minSize; i < list.size() - minSize; i++) {
    List<T> list1=list.subList(0,i);
    List<T> list2=list.subList(i,list.size());
    ListPair<T> pair=new ListPair<T>(list1,list2);
    pairs.add(pair);
  }
  return pairs;
}

Fixed version (ground truth):
@VisibleForTesting static <T extends HasGeometry>List<ListPair<T>> getPairs(int minSize,List<T> list){
  List<ListPair<T>> pairs=new ArrayList<ListPair<T>>(list.size() - 2 * minSize + 1);
  for (int i=minSize; i < list.size() - minSize + 1; i++) {
    List<T> list1=list.subList(0,i);
    List<T> list2=list.subList(i,list.size());
    ListPair<T> pair=new ListPair<T>(list1,list2);
    pairs.add(pair);
  }
  return pairs;
}
Program: 3774
Project: 3774
Buggy source:
@Override public NodeAndEntries<T> delete(Entry<T> entry){
  if (!entries.contains(entry)) {
    return new NodeAndEntries<T>(Optional.of(this),Collections.<Entry<T>>emptyList());
  }
 else {
    final List<Entry<T>> entries2=Util.remove(entries,entry);
    if (entries2.size() >= context.minChildren()) {
      Leaf<T> node=new Leaf<T>(entries2,context);
      return new NodeAndEntries<T>(of(node),Collections.<Entry<T>>emptyList());
    }
 else {
      return new NodeAndEntries<T>(Optional.<Node<T>>absent(),entries2);
    }
  }
}

Fixed version (ground truth):
@Override public NodeAndEntries<T> delete(Entry<T> entry,boolean all){
  if (!entries.contains(entry)) {
    return new NodeAndEntries<T>(Optional.of(this),Collections.<Entry<T>>emptyList(),0);
  }
 else {
    final List<Entry<T>> entries2=new ArrayList<Entry<T>>(entries);
    entries2.remove(entry);
    int numDeleted=1;
    while (all && entries2.remove(entry))     numDeleted+=1;
    if (entries2.size() >= context.minChildren()) {
      Leaf<T> node=new Leaf<T>(entries2,context);
      return new NodeAndEntries<T>(of(node),Collections.<Entry<T>>emptyList(),numDeleted);
    }
 else {
      return new NodeAndEntries<T>(Optional.<Node<T>>absent(),entries2,numDeleted);
    }
  }
}
Program: 3775
Project: 3775
Buggy source:
NodeAndEntries<T> delete(Entry<T> entry);

Fixed version (ground truth):
NodeAndEntries<T> delete(Entry<T> entry,boolean all);
Program: 3776
Project: 3776
Buggy source:
public NodeAndEntries(Optional<? extends Node<T>> node,List<Entry<T>> entries){
  this.node=node;
  this.entries=entries;
}

Fixed version (ground truth):
public NodeAndEntries(Optional<? extends Node<T>> node,List<Entry<T>> entries,int countDeleted){
  this.node=node;
  this.entries=entries;
  this.count=countDeleted;
}
Program: 3777
Project: 3777
Buggy source:
@Override public NodeAndEntries<T> delete(Entry<T> entry){
  List<Entry<T>> addTheseEntries=new ArrayList<Entry<T>>();
  List<Node<T>> removeTheseNodes=new ArrayList<Node<T>>();
  List<Node<T>> addTheseNodes=new ArrayList<Node<T>>();
  for (  final Node<T> child : children) {
    if (entry.geometry().intersects(child.geometry().mbr())) {
      final NodeAndEntries<T> result=child.delete(entry);
      if (result.node().isPresent())       addTheseNodes.add(result.node().get());
      removeTheseNodes.add(child);
      addTheseEntries.addAll(result.entries());
    }
  }
  if (removeTheseNodes.isEmpty())   return new NodeAndEntries<T>(of(this),Collections.<Entry<T>>emptyList());
 else {
    List<Node<T>> nodes=Util.remove(children,removeTheseNodes);
    nodes.addAll(addTheseNodes);
    if (nodes.size() == 0)     return new NodeAndEntries<T>(Optional.<Node<T>>absent(),addTheseEntries);
 else {
      NonLeaf<T> node=new NonLeaf<T>(nodes,context);
      return new NodeAndEntries<T>(of(node),addTheseEntries);
    }
  }
}

Fixed version (ground truth):
@Override public NodeAndEntries<T> delete(Entry<T> entry,boolean all){
  List<Entry<T>> addTheseEntries=new ArrayList<Entry<T>>();
  List<Node<T>> removeTheseNodes=new ArrayList<Node<T>>();
  List<Node<T>> addTheseNodes=new ArrayList<Node<T>>();
  int countDeleted=0;
  for (  final Node<T> child : children) {
    if (entry.geometry().intersects(child.geometry().mbr())) {
      final NodeAndEntries<T> result=child.delete(entry,all);
      if (result.node().isPresent()) {
        if (result.node().get() != child) {
          addTheseNodes.add(result.node().get());
          removeTheseNodes.add(child);
          addTheseEntries.addAll(result.entriesToAdd());
          countDeleted+=result.countDeleted();
          if (!all)           break;
        }
      }
 else {
        removeTheseNodes.add(child);
        addTheseEntries.addAll(result.entriesToAdd());
        countDeleted+=result.countDeleted();
      }
    }
  }
  if (removeTheseNodes.isEmpty())   return new NodeAndEntries<T>(of(this),Collections.<Entry<T>>emptyList(),0);
 else {
    List<Node<T>> nodes=Util.remove(children,removeTheseNodes);
    nodes.addAll(addTheseNodes);
    if (nodes.size() == 0)     return new NodeAndEntries<T>(Optional.<Node<T>>absent(),addTheseEntries,countDeleted);
 else {
      NonLeaf<T> node=new NonLeaf<T>(nodes,context);
      return new NodeAndEntries<T>(of(node),addTheseEntries,countDeleted);
    }
  }
}
Program: 3778
Project: 3778
Buggy source:
/** 
 * Delete one entry if it exists. If multiple copies of the entry are in the R-tree only one will be deleted. The entry must match on both value and geometry to be deleted.
 * @param entry the  {@link Entry} to be deleted
 * @return a new immutable R-tree without one instance of the specifiedentry
 */
public RTree<R> delete(Entry<R> entry){
  if (root.isPresent()) {
    NodeAndEntries<R> nodeAndEntries=root.get().delete(entry);
    if (nodeAndEntries.node().isPresent() && nodeAndEntries.node().get() == root.get())     return this;
 else     return new RTree<R>(nodeAndEntries.node(),size - 1 - nodeAndEntries.entries().size(),context).add(nodeAndEntries.entries());
  }
 else   return this;
}

Fixed version (ground truth):
public RTree<R> delete(Entry<R> entry){
  return delete(entry,false);
}
Program: 3779
Project: 3779
Buggy source:
@VisibleForTesting static <T extends HasGeometry>Pair<T> worstCombination(List<T> items){
  Optional<T> e1=absent();
  Optional<T> e2=absent();
{
    Optional<Double> maxArea=absent();
    for (    final T entry1 : items) {
      for (      final T entry2 : items) {
        if (entry1 != entry2) {
          final double area=entry1.geometry().mbr().add(entry2.geometry().mbr()).area();
          if (!maxArea.isPresent() || area > maxArea.get()) {
            e1=of(entry1);
            e2=of(entry2);
            maxArea=of(area);
          }
        }
      }
    }
  }
  return new Pair<T>(e1.get(),e2.get());
}

Fixed version (ground truth):
@VisibleForTesting static <T extends HasGeometry>Pair<T> worstCombination(List<T> items){
  Optional<T> e1=absent();
  Optional<T> e2=absent();
{
    Optional<Double> maxArea=absent();
    for (    final T entry1 : items) {
      for (      final T entry2 : items) {
        if (entry1 != entry2) {
          final double area=entry1.geometry().mbr().add(entry2.geometry().mbr()).area();
          if (!maxArea.isPresent() || area > maxArea.get()) {
            e1=of(entry1);
            e2=of(entry2);
            maxArea=of(area);
          }
        }
      }
    }
  }
  if (e1.isPresent())   return new Pair<T>(e1.get(),e2.get());
 else   return new Pair<T>(items.get(0),items.get(1));
}
Program: 3780
Project: 3780
Buggy source:
@Override public ImmutableStack<NodePosition<T>> search(Func1<? super Geometry,Boolean> condition,Subscriber<? super Entry<T>> subscriber,ImmutableStack<NodePosition<T>> stack,long request){
  Preconditions.checkArgument(!stack.isEmpty());
  NodePosition<T> np=stack.peek();
  Preconditions.checkArgument(this == np.node());
  Preconditions.checkArgument(np.position() <= children.size());
  if (request == 0)   return stack;
  if (np.position() == children.size()) {
    ImmutableStack<NodePosition<T>> stack2=stack.pop();
    if (stack2.isEmpty())     return stack2;
 else {
      NodePosition<T> previous=stack2.peek();
      return previous.node().search(condition,subscriber,stack2.pop().push(previous.nextPosition()),request);
    }
  }
 else {
    Node<T> child=children.get(np.position());
    return child.search(condition,subscriber,stack.push(new NodePosition<T>(child,0)),request);
  }
}

Fixed version (ground truth):
@Override public ImmutableStack<NodePosition<T>> search(Func1<? super Geometry,Boolean> condition,Subscriber<? super Entry<T>> subscriber,ImmutableStack<NodePosition<T>> stack,long request){
  Preconditions.checkArgument(!stack.isEmpty());
  NodePosition<T> np=stack.peek();
  Preconditions.checkArgument(this == np.node());
  Preconditions.checkArgument(np.position() <= children.size());
  if (request == 0)   return stack;
  if (np.position() == children.size()) {
    ImmutableStack<NodePosition<T>> stack2=stack.pop();
    if (stack2.isEmpty())     return stack2;
 else {
      NodePosition<T> previous=stack2.peek();
      return previous.node().search(condition,subscriber,stack2.pop().push(previous.nextPosition()),request);
    }
  }
 else {
    Node<T> child=children.get(np.position());
    if (condition.call(child.geometry()))     return child.search(condition,subscriber,stack.push(new NodePosition<T>(child,0)),request);
 else     return search(condition,subscriber,stack.pop().push(np.nextPosition()),request);
  }
}
Program: 3781
Project: 3781
Buggy source:
public void requestSome(long n){
  long previousCount=requested.getAndAdd(n);
  if (previousCount == 0) {
    while (true) {
      long r=requested.get();
      long numToEmit=r;
      stack=stack.peek().node().search(condition,subscriber,stack,numToEmit);
      if (stack.isEmpty() && !subscriber.isUnsubscribed()) {
        subscriber.onCompleted();
      }
 else       if (requested.addAndGet(-r) == 0)       return;
    }
  }
}

Fixed version (ground truth):
public void requestSome(long n){
  long previousCount=requested.getAndAdd(n);
  if (previousCount == 0) {
    while (true) {
      long r=requested.get();
      long numToEmit=r;
      stack=stack.peek().node().search(condition,subscriber,stack,numToEmit);
      if (stack.isEmpty()) {
        if (!subscriber.isUnsubscribed())         subscriber.onCompleted();
      }
 else       if (requested.addAndGet(-r) == 0)       return;
    }
  }
}
Program: 3782
Project: 3782
Buggy source:
public void test(){
  String serviceName="String_Node_Str";
  final String id1=discovery1.registerWithTTL(serviceName,7000,30).getId();
  final String id2=discovery2.registerWithTTL(serviceName,8000,30).getId();
  final String id3=discovery3.registerWithTTL(serviceName,9000,30).getId();
  for (int index=0; index < 10; index++) {
    Sys.sleep(100);
    discovery1.checkIn(id1,HealthStatus.PASS);
    discovery2.checkIn(id2,HealthStatus.PASS);
    discovery3.checkIn(id3,HealthStatus.PASS);
  }
  Sys.sleep(100);
  List<EndpointDefinition> endpointDefinitions=discovery1.loadServices(serviceName);
  assertEquals(3,endpointDefinitions.size());
  for (int index=0; index < 10; index++) {
    Sys.sleep(100);
    discovery1.checkIn(id1,HealthStatus.PASS);
    discovery2.checkIn(id2,HealthStatus.FAIL);
    discovery3.checkIn(id3,HealthStatus.PASS);
  }
  Sys.sleep(1000);
  endpointDefinitions=discovery1.loadServices(serviceName);
  assertEquals(2,endpointDefinitions.size());
}

Fixed version (ground truth):
public void test(){
  String serviceName="String_Node_Str";
  final String id1=discovery1.registerWithTTL(serviceName,"String_Node_Str",7000,30).getId();
  final String id2=discovery2.registerWithTTL(serviceName,"String_Node_Str",8000,30).getId();
  final String id3=discovery3.registerWithTTL(serviceName,"String_Node_Str",9000,30).getId();
  for (int index=0; index < 10; index++) {
    Sys.sleep(100);
    discovery1.checkIn(id1,HealthStatus.PASS);
    discovery2.checkIn(id2,HealthStatus.PASS);
    discovery3.checkIn(id3,HealthStatus.PASS);
  }
  Sys.sleep(100);
  List<EndpointDefinition> endpointDefinitions=discovery1.loadServices(serviceName);
  assertEquals(3,endpointDefinitions.size());
  for (int index=0; index < 10; index++) {
    Sys.sleep(100);
    discovery1.checkIn(id1,HealthStatus.PASS);
    discovery2.checkIn(id2,HealthStatus.FAIL);
    discovery3.checkIn(id3,HealthStatus.PASS);
  }
  Sys.sleep(1000);
  endpointDefinitions=discovery1.loadServices(serviceName);
  assertEquals(2,endpointDefinitions.size());
}
Program: 3783
Project: 3783
Buggy source:
/** 
 * Register with the service discovery system and specify a TTL so that if the service does not send a checkIn that it is marked down. TTL is time to live.
 * @param serviceName       service name
 * @param host              host
 * @param port              port
 * @param timeToLiveSeconds ttl
 * @return EndpointDefinition
 */
default EndpointDefinition registerWithTTL(final String serviceName,final String host,final int port,final int timeToLiveSeconds){
  return new EndpointDefinition(HealthStatus.PASS,serviceName + "String_Node_Str" + uniqueString(port),serviceName,null,port,timeToLiveSeconds);
}

Fixed version (ground truth):
/** 
 * Register with the service discovery system and specify a TTL so that if the service does not send a checkIn that it is marked down. TTL is time to live.
 * @param serviceName       service name
 * @param host              host
 * @param port              port
 * @param timeToLiveSeconds ttl
 * @return EndpointDefinition
 */
default EndpointDefinition registerWithTTL(final String serviceName,final String host,final int port,final int timeToLiveSeconds){
  return new EndpointDefinition(HealthStatus.PASS,serviceName + "String_Node_Str" + uniqueString(port),serviceName,host,port,timeToLiveSeconds);
}
Program: 3784
Project: 3784
Buggy source:
public EndpointDefinition registerWithIdAndTimeToLive(final String serviceName,final String serviceId,final int port,final int timeToLiveSeconds){
  if (trace) {
    logger.trace("String_Node_Str" + serviceName + "String_Node_Str"+ port);
  }
  watch(serviceName);
  EndpointDefinition endpointDefinition=new EndpointDefinition(HealthStatus.PASS,serviceId,serviceName,null,port,timeToLiveSeconds);
  return doRegister(endpointDefinition);
}

Fixed version (ground truth):
@Override public EndpointDefinition registerWithIdAndTimeToLive(final String serviceName,final String serviceId,String host,final int port,final int timeToLiveSeconds){
  if (trace) {
    logger.trace("String_Node_Str" + serviceName + "String_Node_Str"+ port);
  }
  watch(serviceName);
  EndpointDefinition endpointDefinition=new EndpointDefinition(HealthStatus.PASS,serviceId,serviceName,host,port,timeToLiveSeconds);
  return doRegister(endpointDefinition);
}
Program: 3785
Project: 3785
Buggy source:
public EndpointDefinition registerWithTTL(final String serviceName,final int port,final int timeToLiveSeconds){
  if (trace) {
    logger.trace("String_Node_Str" + serviceName + "String_Node_Str"+ port);
  }
  watch(serviceName);
  EndpointDefinition endpointDefinition=new EndpointDefinition(HealthStatus.PASS,serviceName + "String_Node_Str" + ServiceDiscovery.uniqueString(port),serviceName,null,port,timeToLiveSeconds);
  return doRegister(endpointDefinition);
}

Fixed version (ground truth):
@Override public EndpointDefinition registerWithTTL(final String serviceName,final String host,final int port,final int timeToLiveSeconds){
  if (trace) {
    logger.trace("String_Node_Str" + serviceName + "String_Node_Str"+ port);
  }
  watch(serviceName);
  EndpointDefinition endpointDefinition=new EndpointDefinition(HealthStatus.PASS,serviceName + "String_Node_Str" + ServiceDiscovery.uniqueString(port),serviceName,host,port,timeToLiveSeconds);
  return doRegister(endpointDefinition);
}
Program: 3786
Project: 3786
Buggy source:
private void handleIncomingMessage(final String address,final Message<String> message){
  final Map<String,Object> map=jsonMapper.fromJson(message.body(),Map.class);
  final Object method=map.get("String_Node_Str");
  final ValueContainer args=(ValueContainer)map.get("String_Node_Str");
  final Object body=args.toValue();
  final CallbackBuilder callbackBuilder=CallbackBuilder.callbackBuilder();
  callbackBuilder.setOnError(throwable -> {
    logger.error("String_Node_Str" + address,throwable);
    message.fail(500,throwable.getMessage());
  }
);
  callbackBuilder.setCallback(returnedValue -> {
    message.reply(jsonMapper.toJson(returnedValue));
  }
);
  callbackBuilder.setOnTimeout(() -> {
    logger.error("String_Node_Str" + address + "String_Node_Str"+ method);
    message.fail(408,"String_Node_Str" + address + "String_Node_Str"+ method);
  }
);
  final MethodCall<Object> methodCall=MethodCallBuilder.methodCallBuilder().setAddress(address).setBody(body).setTimestamp(this.timer.time()).setName(method.toString()).setId(messageId++).setCallback(callbackBuilder.build()).build();
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str",methodCall.name(),message.body());
  }
  if (methodCallPredicate.test(methodCall)) {
    this.methodCallSendQueue.send(methodCall);
  }
}

Fixed version (ground truth):
private void handleIncomingMessage(final String address,final Message<String> message){
  final Map map=jsonMapper.fromJson(message.body(),Map.class);
  final Object method=map.get("String_Node_Str");
  final ValueContainer args=(ValueContainer)map.get("String_Node_Str");
  final Object body=args != null ? args.toValue() : Collections.emptyList();
  final CallbackBuilder callbackBuilder=CallbackBuilder.callbackBuilder();
  callbackBuilder.setOnError(throwable -> {
    logger.error("String_Node_Str" + address,throwable);
    message.fail(500,throwable.getMessage());
  }
);
  callbackBuilder.setCallback(returnedValue -> message.reply(jsonMapper.toJson(returnedValue)));
  callbackBuilder.setOnTimeout(() -> {
    logger.error("String_Node_Str" + address + "String_Node_Str"+ method);
    message.fail(408,"String_Node_Str" + address + "String_Node_Str"+ method);
  }
);
  final MethodCall<Object> methodCall=MethodCallBuilder.methodCallBuilder().setAddress(address).setBody(body).setTimestamp(this.timer.time()).setName(method.toString()).setId(messageId++).setCallback(callbackBuilder.build()).build();
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str",methodCall.name(),message.body());
  }
  if (methodCallPredicate.test(methodCall)) {
    this.methodCallSendQueue.send(methodCall);
  }
}
Program: 3787
Project: 3787
Buggy source:
protected final boolean sendLocalQueue(){
  if (index > 0) {
    boolean ableToSend;
    if (index == queueLocal.length) {
      ableToSend=sendArray(queueLocal);
    }
 else {
      final Object[] copy=fastObjectArraySlice(queueLocal,0,index);
      ableToSend=sendArray(copy);
    }
    index=0;
    queueLocal=new Object[batchSize];
    return ableToSend;
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
protected final boolean sendLocalQueue(){
  if (index > 0) {
    boolean ableToSend;
    final Object[] copy=fastObjectArraySlice(queueLocal,0,index);
    ableToSend=sendArray(copy);
    System.arraycopy(blankLocal,0,queueLocal,0,index);
    index=0;
    return ableToSend;
  }
 else {
    return true;
  }
}
Program: 3788
Project: 3788
Buggy source:
public AbstractBasicSendQueue(final BlockingQueue<Object> queue,Queue<T> owner,final int batchSize,final String name,final Logger logger){
  this.queue=queue;
  this.owner=owner;
  this.batchSize=batchSize;
  this.name=name;
  this.queueLocal=new Object[batchSize];
  this.logger=logger;
}

Fixed version (ground truth):
public AbstractBasicSendQueue(final BlockingQueue<Object> queue,Queue<T> owner,final int batchSize,final String name,final Logger logger){
  this.queue=queue;
  this.owner=owner;
  this.batchSize=batchSize;
  this.name=name;
  this.queueLocal=new Object[batchSize];
  this.blankLocal=new Object[batchSize];
  this.logger=logger;
}
Program: 3789
Project: 3789
Buggy source:
@Test public void callingActualServiceWithReturnDifferentInterfaces(){
@RequestMapping("String_Node_Str") class MyServiceClass implements SomeInterface {
    @Override public void method1(){
    }
    @Override public void method2(    String hi,    int amount){
    }
    @Override public String method3(    String hi,    int amount){
      return "String_Node_Str" + hi + "String_Node_Str"+ amount;
    }
  }
  SomeInterface myService=new MyServiceClass();
  final ServiceBundle bundle=new ServiceBundleBuilder().setAddress("String_Node_Str").buildAndStart();
  bundle.addService(myService);
  bundle.startReturnHandlerProcessor();
  final MyServiceInterfaceForClient myServiceProxy=bundle.createLocalProxy(MyServiceInterfaceForClient.class,"String_Node_Str");
  ok=false;
  Callback<String> returnHandler=new Callback<String>(){
    @Override public void accept(    String returnValue){
      puts("String_Node_Str",returnValue);
      ok="String_Node_Str".equals(returnValue);
    }
  }
;
  myServiceProxy.method3(returnHandler,"String_Node_Str",5);
  bundle.flush();
  Sys.sleep(1000);
  ok=ok || die();
}

Fixed version (ground truth):
@Test public void callingActualServiceWithReturnDifferentInterfaces(){
@RequestMapping("String_Node_Str") class MyServiceClass implements SomeInterface {
    @Override public void method1(){
    }
    @Override public void method2(    String hi,    int amount){
    }
    @Override public String method3(    String hi,    int amount){
      return "String_Node_Str" + hi + "String_Node_Str"+ amount;
    }
  }
  SomeInterface myService=new MyServiceClass();
  final ServiceBundle bundle=new ServiceBundleBuilder().setAddress("String_Node_Str").buildAndStart();
  bundle.addService(myService);
  bundle.startReturnHandlerProcessor();
  final MyServiceInterfaceForClient myServiceProxy=bundle.createLocalProxy(MyServiceInterfaceForClient.class,"String_Node_Str");
  AtomicBoolean called=new AtomicBoolean();
  Callback<String> returnHandler=returnValue -> {
    puts("String_Node_Str",returnValue);
    called.set("String_Node_Str".equals(returnValue));
  }
;
  myServiceProxy.method3(returnHandler,"String_Node_Str",5);
  ServiceProxyUtils.flushServiceProxy(myServiceProxy);
  Sys.sleep(1000);
  assertTrue(called.get());
}
Program: 3791
Project: 3791
Buggy source:
@Override public boolean decorateTextResponse(HttpTextResponse[] responseHolder,String requestPath,int code,String contentType,String payload,MultiMap<String,String> responseHeaders,MultiMap<String,String> requestHeaders,MultiMap<String,String> requestParams){
  final HttpResponseBuilder responseBuilder=HttpResponseBuilder.httpResponseBuilder().setCode(code).setContentType(contentType).setBody(payload);
  if (responseHeaders != null && !responseHeaders.isEmpty()) {
    responseBuilder.setHeaders(responseHeaders);
  }
  responseBuilder.addHeader("String_Node_Str","String_Node_Str").addHeader("String_Node_Str","String_Node_Str").addHeader("String_Node_Str","String_Node_Str").addHeader("String_Node_Str","String_Node_Str");
  responseHolder[0]=(HttpTextResponse)responseBuilder.build();
  return true;
}

Fixed version (ground truth):
@Override public boolean decorateTextResponse(HttpTextResponseHolder responseHolder,String requestPath,int code,String contentType,String payload,MultiMap<String,String> responseHeaders,MultiMap<String,String> requestHeaders,MultiMap<String,String> requestParams){
  final HttpResponseBuilder responseBuilder=HttpResponseBuilder.httpResponseBuilder().setCode(code).setContentType(contentType).setBody(payload);
  if (responseHeaders != null && !responseHeaders.isEmpty()) {
    responseBuilder.setHeaders(responseHeaders);
  }
  responseBuilder.addHeader("String_Node_Str","String_Node_Str").addHeader("String_Node_Str","String_Node_Str").addHeader("String_Node_Str","String_Node_Str").addHeader("String_Node_Str","String_Node_Str");
  responseHolder.setHttpTextResponse((HttpTextResponse)responseBuilder.build());
  return true;
}
Program: 3792
Project: 3792
Buggy source:
@Override public boolean decorateBinaryResponse(HttpBinaryResponse[] responseHolder,String requestPath,int code,String contentType,byte[] payload,MultiMap<String,String> responseHeaders,MultiMap<String,String> requestHeaders,MultiMap<String,String> requestParams){
  final HttpResponseBuilder responseBuilder=HttpResponseBuilder.httpResponseBuilder().setCode(code).setContentType(contentType).setBody(payload);
  if (responseHeaders != null && !responseHeaders.isEmpty()) {
    responseBuilder.setHeaders(responseHeaders);
  }
  responseBuilder.addHeader("String_Node_Str","String_Node_Str").addHeader("String_Node_Str","String_Node_Str").addHeader("String_Node_Str","String_Node_Str").addHeader("String_Node_Str","String_Node_Str");
  responseHolder[0]=(HttpBinaryResponse)responseBuilder.build();
  return true;
}

Fixed version (ground truth):
@Override public boolean decorateBinaryResponse(HttpBinaryResponseHolder responseHolder,String requestPath,int code,String contentType,byte[] payload,MultiMap<String,String> responseHeaders,MultiMap<String,String> requestHeaders,MultiMap<String,String> requestParams){
  final HttpResponseBuilder responseBuilder=HttpResponseBuilder.httpResponseBuilder().setCode(code).setContentType(contentType).setBody(payload);
  if (responseHeaders != null && !responseHeaders.isEmpty()) {
    responseBuilder.setHeaders(responseHeaders);
  }
  responseBuilder.addHeader("String_Node_Str","String_Node_Str").addHeader("String_Node_Str","String_Node_Str").addHeader("String_Node_Str","String_Node_Str").addHeader("String_Node_Str","String_Node_Str");
  responseHolder.setHttpBinaryResponse((HttpBinaryResponse)responseBuilder.build());
  return true;
}
Program: 3793
Project: 3793
Buggy source:
private Response<Object> invokeByName(MethodCall<Object> methodCall){
  final MethodAccess method=classMeta.method(methodCall.name());
  if (method != null) {
    return mapArgsAsyncHandlersAndInvoke(methodCall,method);
  }
 else {
    if (methodCall.name().equals("String_Node_Str")) {
      puts("String_Node_Str",methodCall.objectName(),methodCall.name(),methodCall.address());
      return ResponseImpl.response(methodCall.id(),methodCall.timestamp(),methodCall.address(),methodCall.returnAddress(),sputs("String_Node_Str",methodCall.objectName(),methodCall.name(),methodCall.address()),methodCall,false);
    }
 else {
      return ResponseImpl.response(methodCall.id(),methodCall.timestamp(),methodCall.address(),methodCall.returnAddress(),new Exception("String_Node_Str"),methodCall,true);
    }
  }
}

Fixed version (ground truth):
private Response<Object> invokeByName(MethodCall<Object> methodCall){
  final MethodAccess method=classMeta.method(methodCall.name());
  if (method != null) {
    return mapArgsAsyncHandlersAndInvoke(methodCall,method);
  }
 else {
    if (methodCall.name().equals("String_Node_Str")) {
      puts("String_Node_Str",methodCall.objectName(),methodCall.name(),methodCall.address());
      return ResponseImpl.response(methodCall.id(),methodCall.timestamp(),methodCall.address(),methodCall.returnAddress(),sputs("String_Node_Str",methodCall.objectName(),methodCall.name(),methodCall.address()),methodCall,false);
    }
 else {
      return ResponseImpl.response(methodCall.id(),methodCall.timestamp(),methodCall.address(),methodCall.returnAddress(),new Exception("String_Node_Str" + methodCall.name()),methodCall,true);
    }
  }
}
Program: 3794
Project: 3794
Buggy source:
/** 
 * Builds a service.
 * @return new service queue
 */
public ServiceQueue build(){
  if (debug)   logger.debug("String_Node_Str");
  ServiceQueueSizer serviceQueueSizer=null;
  if (statsConfig != null) {
    serviceQueueSizer=new ServiceQueueSizer();
    this.addQueueCallbackHandler(new ServiceStatsListener(statsConfig.serviceName,statsConfig.statsCollector,getTimer(),statsConfig.flushTimeSeconds,TimeUnit.SECONDS,statsConfig.sampleEvery,serviceQueueSizer));
  }
  ServiceQueue serviceQueue=new ServiceQueueImpl(this.getRootAddress(),this.getServiceAddress(),this.getServiceObject(),this.getRequestQueueBuilder(),this.getResponseQueueBuilder(),this.getServiceMethodHandler(),this.getResponseQueue(),this.isAsyncResponse(),this.isHandleCallbacks(),this.getSystemManager(),this.getBeforeMethodCall(),this.getBeforeMethodCallAfterTransform(),this.getAfterMethodCall(),this.getAfterMethodCallAfterTransform(),buildQueueCallBackHandler(),getCallbackManager(),getBeforeMethodSent(),getEventManager());
  if (serviceQueueSizer != null) {
    serviceQueueSizer.setServiceQueue(serviceQueue);
  }
  if (qBitSystemManager != null) {
    qBitSystemManager.registerService(serviceQueue);
  }
  return serviceQueue;
}

Fixed version (ground truth):
/** 
 * Builds a service.
 * @return new service queue
 */
public ServiceQueue build(){
  if (debug)   logger.debug("String_Node_Str");
  ServiceQueueSizer serviceQueueSizer=null;
  if (statsConfig != null) {
    serviceQueueSizer=new ServiceQueueSizer();
    this.addQueueCallbackHandler(new ServiceStatsListener(statsConfig.serviceName,statsConfig.statsCollector,getTimer(),statsConfig.flushTimeSeconds,TimeUnit.SECONDS,statsConfig.sampleEvery,serviceQueueSizer));
  }
  ServiceQueue serviceQueue=new ServiceQueueImpl(this.getRootAddress(),this.getServiceAddress(),this.getServiceObject(),this.getRequestQueueBuilder(),this.getResponseQueueBuilder(),this.getServiceMethodHandler(),this.getResponseQueue(),this.isAsyncResponse(),this.isHandleCallbacks(),this.getSystemManager(),this.getBeforeMethodCall(),this.getBeforeMethodCallAfterTransform(),this.getAfterMethodCall(),this.getAfterMethodCallAfterTransform(),buildQueueCallBackHandler(),getCallbackManager(),getBeforeMethodSent(),getEventManager(),isJoinEventManager());
  if (serviceQueueSizer != null) {
    serviceQueueSizer.setServiceQueue(serviceQueue);
  }
  if (qBitSystemManager != null) {
    qBitSystemManager.registerService(serviceQueue);
  }
  return serviceQueue;
}
Program: 3795
Project: 3795
Buggy source:
@Override public void stop(){
  started.set(false);
  try {
    if (requestQueue != null)     requestQueue.stop();
  }
 catch (  Exception ex) {
    if (debug)     logger.debug("String_Node_Str",ex);
  }
  try {
    if (responseQueue != null)     responseQueue.stop();
  }
 catch (  Exception ex) {
    if (debug)     logger.debug("String_Node_Str",ex);
  }
  if (systemManager != null)   this.systemManager.serviceShutDown();
  eventManager.ifPresent(em -> em.leaveEventBus(BaseServiceQueueImpl.this));
}

Fixed version (ground truth):
@Override public void stop(){
  started.set(false);
  try {
    if (requestQueue != null)     requestQueue.stop();
  }
 catch (  Exception ex) {
    if (debug)     logger.debug("String_Node_Str",ex);
  }
  try {
    if (responseQueue != null)     responseQueue.stop();
  }
 catch (  Exception ex) {
    if (debug)     logger.debug("String_Node_Str",ex);
  }
  if (systemManager != null) {
    this.systemManager.serviceShutDown();
    this.systemManager.unregisterService(this);
  }
  eventManager.ifPresent(em -> em.leaveEventBus(BaseServiceQueueImpl.this));
}
Program: 3797
Project: 3797
Buggy source:
/** 
 * This method is where all of the action is.
 * @param methodCall           methodCall
 * @param serviceMethodHandler handler
 */
private boolean doHandleMethodCall(MethodCall<Object> methodCall,final ServiceMethodHandler serviceMethodHandler){
  if (debug) {
    logger.debug("String_Node_Str" + methodCall);
  }
  if (callbackManager != null) {
    callbackManager.registerCallbacks(methodCall);
  }
  final boolean continueFlag[]=new boolean[1];
  methodCall=beforeMethodProcessing(methodCall,continueFlag);
  if (continueFlag[0]) {
    if (debug)     logger.debug("String_Node_Str");
    return false;
  }
  Response<Object> response=serviceMethodHandler.receiveMethodCall(methodCall);
  if (response != ServiceConstants.VOID) {
    if (!afterMethodCall.after(methodCall,response)) {
      return false;
    }
    response=responseObjectTransformer.transform(response);
    if (!afterMethodCallAfterTransform.after(methodCall,response)) {
      return false;
    }
    if (!responseSendQueue.send(response)) {
      logger.error("String_Node_Str",response,methodCall.name(),methodCall.objectName());
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * This method is where all of the action is.
 * @param methodCall           methodCall
 * @param serviceMethodHandler handler
 */
private boolean doHandleMethodCall(MethodCall<Object> methodCall,final ServiceMethodHandler serviceMethodHandler){
  if (debug) {
    logger.debug("String_Node_Str" + methodCall);
  }
  if (callbackManager != null) {
    callbackManager.registerCallbacks(methodCall);
  }
  final boolean continueFlag[]=new boolean[1];
  methodCall=beforeMethodProcessing(methodCall,continueFlag);
  if (continueFlag[0]) {
    if (debug)     logger.debug("String_Node_Str");
    return false;
  }
  Response<Object> response=serviceMethodHandler.receiveMethodCall(methodCall);
  if (response != ServiceConstants.VOID) {
    if (!afterMethodCall.after(methodCall,response)) {
      return false;
    }
    response=responseObjectTransformer.transform(response);
    if (!afterMethodCallAfterTransform.after(methodCall,response)) {
      return false;
    }
    if (true) {
      if (response.body() instanceof Throwable) {
        logger.error("String_Node_Str",((Throwable)response.body()));
      }
    }
    if (!responseSendQueue.send(response)) {
      logger.error("String_Node_Str",response,methodCall.name(),methodCall.objectName());
    }
  }
  return false;
}
Program: 3798
Project: 3798
Buggy source:
public ServiceQueue startServiceQueue(){
  start(serviceMethodHandler,true);
  return this;
}

Fixed version (ground truth):
public ServiceQueue startServiceQueue(){
  start(serviceMethodHandler,joinEventManager);
  return this;
}
Program: 3799
Project: 3799
Buggy source:
public ServiceQueueImpl(final String rootAddress,final String serviceAddress,final Object service,final QueueBuilder requestQueueBuilder,final QueueBuilder responseQueueBuilder,final ServiceMethodHandler serviceMethodHandler,final Queue<Response<Object>> responseQueue,final boolean async,final boolean handleCallbacks,final QBitSystemManager systemManager,final BeforeMethodCall beforeMethodCall,final BeforeMethodCall beforeMethodCallAfterTransform,final AfterMethodCall afterMethodCall,final AfterMethodCall afterMethodCallAfterTransform,final QueueCallBackHandler handler,final CallbackManager callbackManager,final BeforeMethodSent beforeMethodSent,final EventManager eventManager){
  super(rootAddress,serviceAddress,service,requestQueueBuilder,responseQueueBuilder,serviceMethodHandler,responseQueue,async,handleCallbacks,systemManager,beforeMethodCall,beforeMethodCallAfterTransform,afterMethodCall,afterMethodCallAfterTransform,handler,callbackManager,beforeMethodSent,eventManager);
}

Fixed version (ground truth):
public ServiceQueueImpl(final String rootAddress,final String serviceAddress,final Object service,final QueueBuilder requestQueueBuilder,final QueueBuilder responseQueueBuilder,final ServiceMethodHandler serviceMethodHandler,final Queue<Response<Object>> responseQueue,final boolean async,final boolean handleCallbacks,final QBitSystemManager systemManager,final BeforeMethodCall beforeMethodCall,final BeforeMethodCall beforeMethodCallAfterTransform,final AfterMethodCall afterMethodCall,final AfterMethodCall afterMethodCallAfterTransform,final QueueCallBackHandler handler,final CallbackManager callbackManager,final BeforeMethodSent beforeMethodSent,final EventManager eventManager,final boolean joinEventManager){
  super(rootAddress,serviceAddress,service,requestQueueBuilder,responseQueueBuilder,serviceMethodHandler,responseQueue,async,handleCallbacks,systemManager,beforeMethodCall,beforeMethodCallAfterTransform,afterMethodCall,afterMethodCallAfterTransform,handler,callbackManager,beforeMethodSent,eventManager,joinEventManager);
}
Program: 3800
Project: 3800
Buggy source:
@Before public void setup(){
  systemManager=new QBitSystemManager();
  eventManager=EventManagerBuilder.eventManagerBuilder().setName("String_Node_Str").build();
  serviceBuilder=ServiceBuilder.serviceBuilder().setEventManager(eventManager).setSystemManager(systemManager);
  eventServiceQueue=serviceBuilder.setServiceObject(eventManager).buildAndStartAll();
  serviceB=new ServiceB();
  serviceBuilder.setServiceObject(serviceB).buildAndStartAll();
  serviceA=new ServiceA(eventServiceQueue.createProxy(EventManager.class));
  final ServiceQueue serviceAQueue=serviceBuilder.setServiceObject(serviceA).buildAndStartAll();
  serviceAQueueProxy=serviceAQueue.createProxy(ServiceAInterface.class);
}

Fixed version (ground truth):
@Before public void setup(){
  systemManager=new QBitSystemManager();
  eventManager=EventManagerBuilder.eventManagerBuilder().setName("String_Node_Str").build();
  eventServiceQueue=ServiceBuilder.serviceBuilder().setServiceObject(eventManager).buildAndStartAll();
  serviceB=new ServiceB();
  serviceA=new ServiceA(eventServiceQueue.createProxy(EventManager.class));
  serviceBuilder=ServiceBuilder.serviceBuilder().setServiceObject(serviceA).setJoinEventManager(false).setEventManager(eventManager).setSystemManager(systemManager);
  final ServiceQueue serviceAQueue=serviceBuilder.buildAndStartAll();
  ServiceBuilder.serviceBuilder().setServiceObject(serviceB).setJoinEventManager(false).setEventManager(eventManager).setSystemManager(systemManager).buildAndStartAll();
  serviceAQueueProxy=serviceAQueue.createProxy(ServiceAInterface.class);
}
Program: 3801
Project: 3801
Buggy source:
@Before public void setup(){
  systemManager=new QBitSystemManager();
  eventManager=EventManagerBuilder.eventManagerBuilder().setName("String_Node_Str").build();
  serviceBuilder=ServiceBuilder.serviceBuilder().setSystemManager(systemManager);
  eventServiceQueue=serviceBuilder.setServiceObject(eventManager).buildAndStartAll();
  serviceBuilder.setEventManager(eventManager);
  serviceB=new ServiceB();
  serviceBuilder.setServiceObject(serviceB).buildAndStartAll();
  serviceA=new ServiceA(eventServiceQueue.createProxyWithAutoFlush(EventManager.class,Duration.SECOND),QBit.factory().eventBusProxyCreator());
  final ServiceQueue serviceAQueue=serviceBuilder.setServiceObject(serviceA).buildAndStartAll();
  serviceAQueueProxy=serviceAQueue.createProxy(ServiceAInterface.class);
}

Fixed version (ground truth):
@Before public void setup(){
  systemManager=new QBitSystemManager();
  eventManager=EventManagerBuilder.eventManagerBuilder().setName("String_Node_Str").build();
  serviceBuilder=ServiceBuilder.serviceBuilder().setSystemManager(systemManager);
  eventServiceQueue=serviceBuilder.setServiceObject(eventManager).build().startServiceQueue();
  serviceBuilder=ServiceBuilder.serviceBuilder().setSystemManager(systemManager).setEventManager(eventManager);
  serviceB=new ServiceB();
  serviceBuilder.setServiceObject(serviceB).buildAndStartAll();
  serviceBuilder=ServiceBuilder.serviceBuilder().setSystemManager(systemManager).setEventManager(eventManager);
  serviceA=new ServiceA(eventServiceQueue.createProxyWithAutoFlush(EventManager.class,Duration.SECOND),QBit.factory().eventBusProxyCreator());
  final ServiceQueue serviceAQueue=serviceBuilder.setServiceObject(serviceA).buildAndStartAll();
  serviceAQueueProxy=serviceAQueue.createProxy(ServiceAInterface.class);
}
Program: 3802
Project: 3802
Buggy source:
private RequestMetaData doGet(final String path){
  RequestMetaData requestMetaData=metaDataMap.get(path);
  if (requestMetaData == null) {
    Map.Entry<String,NavigableMap<Integer,RequestMetaData>> uriParamNumMapEntry=treeMap.lowerEntry(path);
    if (uriParamNumMapEntry == null) {
      return null;
    }
    final String requestURI=StringScanner.substringAfter(path,rootURI);
    int count=Str.split(requestURI,'/').length - 1;
    NavigableMap<Integer,RequestMetaData> uriParamMap=uriParamNumMapEntry.getValue();
    requestMetaData=uriParamMap.get(count);
    if (requestMetaData != null && path.startsWith(requestMetaData.getPath())) {
      return requestMetaData;
    }
 else {
      return null;
    }
  }
 else {
    return requestMetaData;
  }
}

Fixed version (ground truth):
private RequestMetaData doGet(final String path){
  RequestMetaData requestMetaData=metaDataMap.get(path);
  if (requestMetaData == null) {
    Map.Entry<String,NavigableMap<Integer,RequestMetaData>> uriParamNumMapEntry=treeMap.lowerEntry(path);
    if (uriParamNumMapEntry == null) {
      return null;
    }
    final String requestURI=Str.isEmpty(rootURI) ? path : StringScanner.substringAfter(path,rootURI);
    int count=Str.split(requestURI,'/').length - 1;
    NavigableMap<Integer,RequestMetaData> uriParamMap=uriParamNumMapEntry.getValue();
    requestMetaData=uriParamMap.get(count);
    if (requestMetaData != null && path.startsWith(requestMetaData.getPath())) {
      return requestMetaData;
    }
 else {
      return null;
    }
  }
 else {
    return requestMetaData;
  }
}
Program: 3803
Project: 3803
Buggy source:
@Test public void test(){
  final HttpClient client=HttpClientBuilder.httpClientBuilder().setHost("String_Node_Str").setPort(port).buildAndStart();
  Sys.sleep(1000);
  final HttpTextResponse response=client.postJson("String_Node_Str","String_Node_Str");
  assertEquals(202,response.code());
  assertEquals("String_Node_Str",response.body());
  final HttpTextResponse response2=client.postJson("String_Node_Str","String_Node_Str");
  assertEquals(200,response2.code());
  assertEquals("String_Node_Str",response2.body());
}

Fixed version (ground truth):
@Test public void test(){
  final HttpClient client=HttpClientBuilder.httpClientBuilder().setHost("String_Node_Str").setPort(port).buildAndStart();
  Sys.sleep(1000);
  final HttpTextResponse response=client.postJson("String_Node_Str","String_Node_Str");
  assertEquals(202,response.code());
  assertEquals("String_Node_Str",response.body());
  final HttpTextResponse response2=client.postJson("String_Node_Str","String_Node_Str");
  assertEquals(200,response2.code());
  assertEquals("String_Node_Str",response2.body());
  final HttpTextResponse response3=client.get("String_Node_Str");
  assertEquals(200,response3.code());
  assertEquals("String_Node_Str",response3.body());
}
Program: 3804
Project: 3804
Buggy source:
private T getItemFromLocalQueue(){
  if (lastQueue.length == 0) {
    return null;
  }
  @SuppressWarnings("String_Node_Str") T item=(T)lastQueue[lastQueueIndex];
  lastQueueIndex++;
  if (lastQueueIndex == lastQueue.length) {
    lastQueueIndex=0;
    lastQueue=null;
  }
  return item;
}

Fixed version (ground truth):
private T getItemFromLocalQueue(){
  if (lastQueue.length == 0) {
    lastQueue=null;
    return null;
  }
  @SuppressWarnings("String_Node_Str") T item=(T)lastQueue[lastQueueIndex];
  lastQueueIndex++;
  if (lastQueueIndex == lastQueue.length) {
    lastQueueIndex=0;
    lastQueue=null;
  }
  return item;
}
Program: 3805
Project: 3805
Buggy source:
protected final boolean sendLocalQueue(){
  final Object[] copy=fastObjectArraySlice(queueLocal,0,index);
  boolean ableToSend=sendArray(copy);
  index=0;
  return ableToSend;
}

Fixed version (ground truth):
protected final boolean sendLocalQueue(){
  if (index > 0) {
    final Object[] copy=fastObjectArraySlice(queueLocal,0,index);
    boolean ableToSend=sendArray(copy);
    index=0;
    return ableToSend;
  }
 else {
    return false;
  }
}
Program: 3806
Project: 3806
Buggy source:
@Override public final void flushSends(){
  if (index > 0) {
    sendLocalQueue();
  }
}

Fixed version (ground truth):
@Override public final void flushSends(){
  sendLocalQueue();
}
Program: 3807
Project: 3807
Buggy source:
public CallbackBuilder setTimeoutDuration(@SuppressWarnings("String_Node_Str") long timeoutDuration){
  this.timeoutDuration=timeoutDuration;
  return this;
}

Fixed version (ground truth):
/** 
 * Deprecated. use withTimeoutInstead
 * @param timeoutDuration
 * @return
 */
@Deprecated public CallbackBuilder setTimeoutDuration(@SuppressWarnings("String_Node_Str") long timeoutDuration){
  this.timeoutDuration=timeoutDuration;
  return this;
}
Program: 3808
Project: 3808
Buggy source:
public <T>CallbackBuilder setCallback(Class<T> returnType,Callback<T> callback){
  this.callback=callback;
  return this;
}

Fixed version (ground truth):
/** 
 * Builder method to add a callback handler.  This is depricated.  Use withCallback instead.
 * @param returnType returnType
 * @param callback callback
 * @param < T > T
 * @return this
 */
@Deprecated public <T>CallbackBuilder setCallback(Class<T> returnType,Callback<T> callback){
  return withCallback(returnType,callback);
}