nus-yam/ex-repair huggingface dataset:
Program: 59588
Project: 59588
Buggy source:
@Override public void handleTileInfoPacket(Payload payload,NetHandler handler){
  int type=payload.getByte();
  if (type == PacketInfoID.CLEAR_GRID.ordinal()) {
    for (int i=0; i < 9; i++) {
      inventory[getMatrixOffset() + i]=null;
      if (handler.getPlayer().openContainer != null) {
        handler.getPlayer().openContainer.onCraftMatrixChanged(null);
      }
    }
  }
 else   if (type == PacketInfoID.SET_GRID.ordinal()) {
    for (int i=0; i < 9; i++) {
      inventory[getMatrixOffset() + i]=SchematicHelper.getSchematicSlot(getStackInSlot(getCurrentSchematicSlot()),i);
      if (handler.getPlayer().openContainer != null) {
        handler.getPlayer().openContainer.onCraftMatrixChanged(null);
      }
    }
  }
 else   if (type == PacketInfoID.NEI_SUP.ordinal()) {
    int slot;
    for (int i=0; i < 9; i++) {
      inventory[getMatrixOffset() + i]=null;
    }
    while ((slot=payload.getByte()) >= 0) {
      inventory[slot + getMatrixOffset()]=payload.getItemStack();
    }
    Container container=handler.getPlayer().openContainer;
    if (container != null) {
      ((ICrafting)handler.getPlayer()).sendContainerAndContentsToPlayer(container,container.getInventory());
      container.onCraftMatrixChanged(null);
    }
  }
}

Fixed version (ground truth):
@Override public void handleTileInfoPacket(CoFHPacket payload,boolean isServer,EntityPlayer thePlayer){
  int type=payload.getByte();
  if (type == PacketInfoID.CLEAR_GRID.ordinal()) {
    for (int i=0; i < 9; i++) {
      inventory[getMatrixOffset() + i]=null;
      if (thePlayer.openContainer != null) {
        thePlayer.openContainer.onCraftMatrixChanged(null);
      }
    }
  }
 else   if (type == PacketInfoID.SET_GRID.ordinal()) {
    for (int i=0; i < 9; i++) {
      inventory[getMatrixOffset() + i]=SchematicHelper.getSchematicSlot(getStackInSlot(getCurrentSchematicSlot()),i);
      if (thePlayer.openContainer != null) {
        thePlayer.openContainer.onCraftMatrixChanged(null);
      }
    }
  }
 else   if (type == PacketInfoID.NEI_SUP.ordinal()) {
    int slot;
    for (int i=0; i < 9; i++) {
      inventory[getMatrixOffset() + i]=null;
    }
    while ((slot=payload.getByte()) >= 0) {
      inventory[slot + getMatrixOffset()]=payload.getItemStack();
    }
    Container container=thePlayer.openContainer;
    if (container != null) {
      ((ICrafting)thePlayer).sendContainerAndContentsToPlayer(container,container.getInventory());
      container.onCraftMatrixChanged(null);
    }
  }
}
Program: 59589
Project: 59589
Buggy source:
public void setCraftingGrid(){
  for (int i=0; i < 9; i++) {
    inventory[getMatrixOffset() + i]=SchematicHelper.getSchematicSlot(getStackInSlot(getCurrentSchematicSlot()),i);
  }
  PacketUtils.sendToServer(Payload.getInfoPayload(this).addByte(PacketInfoID.SET_GRID.ordinal()).getPacket());
}

Fixed version (ground truth):
public void setCraftingGrid(){
  for (int i=0; i < 9; i++) {
    inventory[getMatrixOffset() + i]=SchematicHelper.getSchematicSlot(getStackInSlot(getCurrentSchematicSlot()),i);
  }
  PacketHandler.sendToServer(CoFHTileInfoPacket.getTileInfoPacket(this).addByte(PacketInfoID.SET_GRID.ordinal()));
}
Program: 59590
Project: 59590
Buggy source:
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + interfaceNumber;
  result=prime * result + ((manufacturer == null) ? 0 : manufacturer.hashCode());
  result=prime * result + ((path == null) ? 0 : path.hashCode());
  result=prime * result + ((product == null) ? 0 : product.hashCode());
  result=prime * result + productId;
  result=prime * result + releaseNumber;
  result=prime * result + ((serialNumber == null) ? 0 : serialNumber.hashCode());
  result=prime * result + usage;
  result=prime * result + usagePage;
  result=prime * result + vendorId;
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  return path.hashCode();
}
Program: 59591
Project: 59591
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  HidDevice other=(HidDevice)obj;
  if (interfaceNumber != other.interfaceNumber) {
    return false;
  }
  if (manufacturer == null) {
    if (other.manufacturer != null) {
      return false;
    }
  }
 else   if (!manufacturer.equals(other.manufacturer)) {
    return false;
  }
  if (path == null) {
    if (other.path != null) {
      return false;
    }
  }
 else   if (!path.equals(other.path)) {
    return false;
  }
  if (product == null) {
    if (other.product != null) {
      return false;
    }
  }
 else   if (!product.equals(other.product)) {
    return false;
  }
  if (productId != other.productId) {
    return false;
  }
  if (releaseNumber != other.releaseNumber) {
    return false;
  }
  if (serialNumber == null) {
    if (other.serialNumber != null) {
      return false;
    }
  }
 else   if (!serialNumber.equals(other.serialNumber)) {
    return false;
  }
  if (usage != other.usage) {
    return false;
  }
  if (usagePage != other.usagePage) {
    return false;
  }
  if (vendorId != other.vendorId) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  HidDevice hidDevice=(HidDevice)o;
  if (!path.equals(hidDevice.path))   return false;
  return true;
}
Program: 59592
Project: 59592
Buggy source:
/** 
 * Prepare a batch api request using list of individual reuests.
 * @param requests list of api requests that has to be executed in batch.
 */
protected void prepareRequest(List<BoxAPIRequest> requests){
  JsonObject body=new JsonObject();
  JsonArray requestsJSONArray=new JsonArray();
  for (  BoxAPIRequest request : requests) {
    JsonObject batchRequest=new JsonObject();
    batchRequest.add("String_Node_Str",request.getMethod());
    batchRequest.add("String_Node_Str",request.getUrl().toString().substring(this.api.getBaseURL().length() - 1));
    if (request instanceof BoxJSONRequest) {
      BoxJSONRequest jsonRequest=(BoxJSONRequest)request;
      batchRequest.add("String_Node_Str",jsonRequest.getBodyAsJsonObject());
    }
    if (request.getHeaders() != null) {
      JsonObject batchRequestHeaders=new JsonObject();
      for (      RequestHeader header : request.getHeaders()) {
        if (header.getKey() != null && !header.getKey().isEmpty() && HttpHeaders.AUTHORIZATION.equals(header.getKey())) {
          batchRequestHeaders.add(header.getKey(),header.getValue());
        }
      }
      batchRequest.add("String_Node_Str",batchRequestHeaders);
    }
    requestsJSONArray.add(batchRequest);
  }
  body.add("String_Node_Str",requestsJSONArray);
  super.setBody(body);
}

Fixed version (ground truth):
/** 
 * Prepare a batch api request using list of individual reuests.
 * @param requests list of api requests that has to be executed in batch.
 */
protected void prepareRequest(List<BoxAPIRequest> requests){
  JsonObject body=new JsonObject();
  JsonArray requestsJSONArray=new JsonArray();
  for (  BoxAPIRequest request : requests) {
    JsonObject batchRequest=new JsonObject();
    batchRequest.add("String_Node_Str",request.getMethod());
    batchRequest.add("String_Node_Str",request.getUrl().toString().substring(this.api.getBaseURL().length() - 1));
    if (request instanceof BoxJSONRequest) {
      BoxJSONRequest jsonRequest=(BoxJSONRequest)request;
      batchRequest.add("String_Node_Str",jsonRequest.getBodyAsJsonValue());
    }
    if (request.getHeaders() != null) {
      JsonObject batchRequestHeaders=new JsonObject();
      for (      RequestHeader header : request.getHeaders()) {
        if (header.getKey() != null && !header.getKey().isEmpty() && HttpHeaders.AUTHORIZATION.equals(header.getKey())) {
          batchRequestHeaders.add(header.getKey(),header.getValue());
        }
      }
      batchRequest.add("String_Node_Str",batchRequestHeaders);
    }
    requestsJSONArray.add(batchRequest);
  }
  body.add("String_Node_Str",requestsJSONArray);
  super.setBody(body);
}
Program: 59593
Project: 59593
Buggy source:
/** 
 * Gets the body of this request as a JsonObject.
 * @return body represented as JsonObject.
 */
public JsonObject getBodyAsJsonObject(){
  return this.jsonObject;
}

Fixed version (ground truth):
/** 
 * Gets the body of this request as a JsonObject.
 * @return body represented as JsonObject.
 */
public JsonObject getBodyAsJsonObject(){
  if (this.jsonValue.isObject()) {
    return this.jsonValue.asObject();
  }
  return null;
}
Program: 59594
Project: 59594
Buggy source:
@Override protected String bodyToString(){
  return this.jsonObject.toString();
}

Fixed version (ground truth):
@Override protected String bodyToString(){
  return this.jsonValue.toString();
}
Program: 59595
Project: 59595
Buggy source:
/** 
 * Sets the body of this request to a given JsonObject.
 * @param body the JsonObject to use as the body.
 */
public void setBody(JsonObject body){
  super.setBody(body.toString());
  this.jsonObject=body;
}

Fixed version (ground truth):
/** 
 * Sets the body of this request to a given JsonObject.
 * @param body the JsonObject to use as the body.
 */
public void setBody(JsonObject body){
  super.setBody(body.toString());
  this.jsonValue=body;
}
Program: 59596
Project: 59596
Buggy source:
@Override public BoxAPIResponse onRequest(BoxAPIRequest request){
  Assert.assertEquals("String_Node_Str",request.getUrl().toString());
  return new BoxJSONResponse(){
    @Override public String getJSON(){
      return "String_Node_Str";
    }
  }
;
}

Fixed version (ground truth):
@Override public BoxAPIResponse onRequest(BoxAPIRequest request){
  Assert.assertEquals("String_Node_Str",request.getUrl().toString());
  return new BoxJSONResponse(){
    @Override public String getJSON(){
      return responseJSON;
    }
  }
;
}
Program: 59597
Project: 59597
Buggy source:
@Override public String getJSON(){
  return "String_Node_Str";
}

Fixed version (ground truth):
@Override public String getJSON(){
  return responseJSON;
}
Program: 59598
Project: 59598
Buggy source:
/** 
 * Renames this folder.
 * @param newName the new name of the folder.
 */
public void rename(String newName){
  URL url=FOLDER_INFO_URL_TEMPLATE.build(this.getAPI().getBaseURL(),this.getID());
  BoxJSONRequest request=new BoxJSONRequest(this.getAPI(),url,"String_Node_Str");
  JsonObject updateInfo=new JsonObject();
  updateInfo.add("String_Node_Str",newName);
  request.setBody(updateInfo.toString());
  BoxAPIResponse response=request.send();
  response.disconnect();
}

Fixed version (ground truth):
/** 
 * Renames this folder.
 * @param newName the new name of the folder.
 */
public void rename(String newName){
  URL url=FOLDER_INFO_URL_TEMPLATE.build(this.getAPI().getBaseURL(),this.getID());
  BoxJSONRequest request=new BoxJSONRequest(this.getAPI(),url,"String_Node_Str");
  JsonObject updateInfo=new JsonObject();
  updateInfo.add("String_Node_Str",newName);
  request.setBody(updateInfo.toString());
  BoxJSONResponse response=(BoxJSONResponse)request.send();
  response.getJSON();
}
Program: 59600
Project: 59600
Buggy source:
/** 
 * Updates the information about this collaboration with any info fields that have been modified locally.
 * @param info the updated info.
 */
public void updateInfo(Info info){
  BoxAPIConnection api=this.getAPI();
  URL url=COLLABORATION_URL_TEMPLATE.build(api.getBaseURL(),this.getID());
  BoxJSONRequest request=new BoxJSONRequest(api,url,"String_Node_Str");
  request.setBody(info.getPendingChanges());
  BoxJSONResponse response=(BoxJSONResponse)request.send();
  JsonObject jsonObject=JsonObject.readFrom(response.getJSON());
  info.update(jsonObject);
}

Fixed version (ground truth):
/** 
 * Updates the information about this collaboration with any info fields that have been modified locally.
 * @param info the updated info.
 */
public void updateInfo(Info info){
  BoxAPIConnection api=this.getAPI();
  URL url=COLLABORATION_URL_TEMPLATE.build(api.getBaseURL(),this.getID());
  BoxJSONRequest request=new BoxJSONRequest(api,url,"String_Node_Str");
  request.setBody(info.getPendingChanges());
  BoxAPIResponse boxAPIResponse=request.send();
  if (boxAPIResponse instanceof BoxJSONResponse) {
    BoxJSONResponse response=(BoxJSONResponse)boxAPIResponse;
    JsonObject jsonObject=JsonObject.readFrom(response.getJSON());
    info.update(jsonObject);
  }
}
Program: 59601
Project: 59601
Buggy source:
@Override public BoxResource getResource(){
  return BoxTask.this;
}

Fixed version (ground truth):
@Override public BoxTask getResource(){
  return BoxTask.this;
}
Program: 59602
Project: 59602
Buggy source:
@Test @Category(IntegrationTest.class) public void updateInfoSucceeds(){
  BoxAPIConnection api=new BoxAPIConnection(TestConfig.getAccessToken());
  BoxFolder rootFolder=BoxFolder.getRootFolder(api);
  String fileName="String_Node_Str";
  byte[] fileBytes="String_Node_Str".getBytes(StandardCharsets.UTF_8);
  String originalMessage="String_Node_Str";
  String changedMessage="String_Node_Str";
  InputStream uploadStream=new ByteArrayInputStream(fileBytes);
  BoxFile uploadedFile=rootFolder.uploadFile(uploadStream,fileName).getResource();
  Date dueAt=new Date();
  BoxTask.Info taskInfo=uploadedFile.addTask("String_Node_Str",originalMessage,dueAt);
  BoxTask task=taskInfo.getResource();
  taskInfo.setMessage(changedMessage);
  taskInfo.setDueAt(dueAt);
  task.updateInfo(taskInfo);
  assertThat(taskInfo.getMessage(),is(equalTo(changedMessage)));
  assertThat(taskInfo.getDueAt(),is(equalTo(dueAt)));
  uploadedFile.delete();
}

Fixed version (ground truth):
@Test @Category(IntegrationTest.class) public void updateInfoSucceeds(){
  BoxAPIConnection api=new BoxAPIConnection(TestConfig.getAccessToken());
  BoxFolder rootFolder=BoxFolder.getRootFolder(api);
  String fileName="String_Node_Str";
  byte[] fileBytes="String_Node_Str".getBytes(StandardCharsets.UTF_8);
  String originalMessage="String_Node_Str";
  String changedMessage="String_Node_Str";
  InputStream uploadStream=new ByteArrayInputStream(fileBytes);
  BoxFile uploadedFile=rootFolder.uploadFile(uploadStream,fileName).getResource();
  Date dueAt=new Date();
  BoxTask.Info taskInfo=uploadedFile.addTask(BoxTask.Action.REVIEW,originalMessage,dueAt);
  BoxTask task=taskInfo.getResource();
  taskInfo.setMessage(changedMessage);
  taskInfo.setDueAt(dueAt);
  task.updateInfo(taskInfo);
  assertThat(taskInfo.getMessage(),is(equalTo(changedMessage)));
  assertThat(taskInfo.getDueAt(),is(equalTo(dueAt)));
  uploadedFile.delete();
}
Program: 59603
Project: 59603
Buggy source:
private JsonObject loadNextJsonObject(){
  if (this.currentPage == null) {
    this.loadNextPage();
  }
  while (this.currentPage.hasNext() || this.hasMorePages) {
    while (this.currentPage.hasNext()) {
      JsonObject jsonObject=this.currentPage.next().asObject();
      if (this.filter.shouldInclude(jsonObject)) {
        return jsonObject;
      }
    }
    if (this.hasMorePages) {
      this.loadNextPage();
    }
  }
  return null;
}

Fixed version (ground truth):
private JsonObject loadNextJsonObject(){
  if (this.currentPage == null) {
    this.loadNextPage();
  }
  while (this.currentPage.hasNext() || this.hasMorePages) {
    while (this.currentPage.hasNext()) {
      JsonObject jsonObject=this.currentPage.next().asObject();
      if (this.filter == null || this.filter.shouldInclude(jsonObject)) {
        return jsonObject;
      }
    }
    if (this.hasMorePages) {
      this.loadNextPage();
    }
  }
  return null;
}
Program: 59604
Project: 59604
Buggy source:
/** 
 * Sets the request body to the contents of a String. <p>If the contents of the body are large, then it may be more efficient to use an   {@link InputStream} instead ofa String. Using a String requires that the entire body be in memory before sending the request.</p>
 * @param body a String containing the contents of the body.
 */
public void setBody(String body){
  this.bodyLength=body.length();
  this.body=new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8));
}

Fixed version (ground truth):
/** 
 * Sets the request body to the contents of a String. <p>If the contents of the body are large, then it may be more efficient to use an   {@link InputStream} instead ofa String. Using a String requires that the entire body be in memory before sending the request.</p>
 * @param body a String containing the contents of the body.
 */
public void setBody(String body){
  byte[] bytes=body.getBytes(StandardCharsets.UTF_8);
  this.bodyLength=bytes.length;
  this.body=new ByteArrayInputStream(bytes);
}
Program: 59605
Project: 59605
Buggy source:
boolean add(E item){
  boolean newItem=!this.linkedHashSet.remove(item);
  if (newItem) {
    this.linkedHashSet.add(item);
  }
  if (this.linkedHashSet.size() >= MAX_SIZE) {
    Iterator<E> it=this.linkedHashSet.iterator();
    it.next();
    it.remove();
  }
  return newItem;
}

Fixed version (ground truth):
boolean add(E item){
  boolean newItem=!this.linkedHashSet.remove(item);
  this.linkedHashSet.add(item);
  if (this.linkedHashSet.size() >= MAX_SIZE) {
    Iterator<E> it=this.linkedHashSet.iterator();
    it.next();
    it.remove();
  }
  return newItem;
}
Program: 59606
Project: 59606
Buggy source:
/** 
 * Indicates whether or not an event ID is a duplicate. <p>This method can be overridden by a subclass in order to provide custom de-duping logic.</p>
 * @param eventID the event ID.
 * @return         true if the event is a duplicate; otherwise false.
 */
protected boolean isDuplicate(String eventID){
  if (this.receivedEvents == null) {
    this.receivedEvents=new LinkedHashSet<String>(LRU_SIZE);
  }
  boolean newEvent=this.receivedEvents.add(eventID);
  if (newEvent && this.receivedEvents.size() > LRU_SIZE) {
    this.receivedEvents.iterator().remove();
  }
  return !newEvent;
}

Fixed version (ground truth):
/** 
 * Indicates whether or not an event ID is a duplicate. <p>This method can be overridden by a subclass in order to provide custom de-duping logic.</p>
 * @param eventID the event ID.
 * @return         true if the event is a duplicate; otherwise false.
 */
protected boolean isDuplicate(String eventID){
  if (this.receivedEvents == null) {
    this.receivedEvents=new LRUCache<String>();
  }
  return !this.receivedEvents.add(eventID);
}
Program: 59607
Project: 59607
Buggy source:
/** 
 * Sets the refresh token to use when refreshing an access token.
 * @param refreshToken a valid refresh token.
 */
public void setRefreshToken(String refreshToken){
  this.refreshToken=refreshToken;
  this.lastRefresh=System.currentTimeMillis();
}

Fixed version (ground truth):
/** 
 * Sets the refresh token to use when refreshing an access token.
 * @param refreshToken a valid refresh token.
 */
public void setRefreshToken(String refreshToken){
  this.refreshToken=refreshToken;
}
Program: 59608
Project: 59608
Buggy source:
private void loadNextPage(){
  QueryStringBuilder builder=new QueryStringBuilder();
  builder.addParam("String_Node_Str",this.limit);
  builder.addParam("String_Node_Str",this.offset);
  URL url;
  try {
    url=new URL(this.url,builder.toString());
  }
 catch (  MalformedURLException e) {
    throw new BoxAPIException("String_Node_Str");
  }
  BoxAPIRequest request=new BoxAPIRequest(this.api,url,"String_Node_Str");
  BoxJSONResponse response=(BoxJSONResponse)request.send();
  String json=response.getJSON();
  JsonObject jsonObject=JsonObject.readFrom(json);
  String totalCountString=jsonObject.get("String_Node_Str").toString();
  this.totalCount=Double.valueOf(totalCountString).longValue();
  String offsetString=jsonObject.get("String_Node_Str").toString();
  this.offset=Double.valueOf(offsetString).longValue();
  this.hasMorePages=(this.offset + this.limit) < this.totalCount;
  JsonArray jsonArray=jsonObject.get("String_Node_Str").asArray();
  this.currentPage=jsonArray.iterator();
}

Fixed version (ground truth):
private void loadNextPage(){
  QueryStringBuilder builder=new QueryStringBuilder();
  builder.addParam("String_Node_Str",this.limit);
  builder.addParam("String_Node_Str",this.offset);
  URL url;
  try {
    url=new URL(this.url,builder.toString());
  }
 catch (  MalformedURLException e) {
    throw new BoxAPIException("String_Node_Str");
  }
  BoxAPIRequest request=new BoxAPIRequest(this.api,url,"String_Node_Str");
  BoxJSONResponse response=(BoxJSONResponse)request.send();
  String json=response.getJSON();
  JsonObject jsonObject=JsonObject.readFrom(json);
  String totalCountString=jsonObject.get("String_Node_Str").toString();
  this.totalCount=Double.valueOf(totalCountString).longValue();
  String offsetString=jsonObject.get("String_Node_Str").toString();
  this.hasMorePages=(this.offset + this.limit) < this.totalCount;
  this.offset=Double.valueOf(offsetString).longValue() + this.limit;
  JsonArray jsonArray=jsonObject.get("String_Node_Str").asArray();
  this.currentPage=jsonArray.iterator();
}
Program: 59609
Project: 59609
Buggy source:
/** 
 * Adds all the given entries to the classpath suffix.
 * @param entries
 */
void addAllToSuffix(final String... entries){
  for (  final String classPathEntry : entries) {
    this.addToPrefix(classPathEntry);
  }
}

Fixed version (ground truth):
/** 
 * Adds all the given entries to the classpath suffix.
 * @param entries
 */
void addAllToSuffix(final String... entries){
  for (  final String classPathEntry : entries) {
    this.addToSuffix(classPathEntry);
  }
}
Program: 59610
Project: 59610
Buggy source:
/** 
 * Wait for all client alarms to finish executing and gracefully shutdown the clock.
 */
@Override public void close(){
  LOG.entering(CLASS_NAME,"String_Node_Str");
synchronized (this.schedule) {
    if (this.isClosed) {
      LOG.log(Level.FINEST,"String_Node_Str");
      return;
    }
    this.isClosed=true;
    final Time stopEvent=new StopTime(Math.max(this.timer.getCurrent(),this.lastClientAlarm + 1));
    LOG.log(Level.FINE,"String_Node_Str",stopEvent);
    this.schedule.add(stopEvent);
    this.schedule.notify();
  }
  LOG.exiting(CLASS_NAME,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Wait for all client alarms to finish executing and gracefully shutdown the clock.
 */
@Override public void close(){
  LOG.entering(CLASS_NAME,"String_Node_Str");
synchronized (this.schedule) {
    if (this.isClosed) {
      LOG.log(Level.FINEST,"String_Node_Str");
      return;
    }
    this.isClosed=true;
    final Time stopEvent=new StopTime(Math.max(this.timer.getCurrent(),this.lastClientAlarm + 1));
    LOG.log(Level.FINE,"String_Node_Str",new Object[]{stopEvent,this.numClientAlarms});
    this.schedule.add(stopEvent);
    this.schedule.notify();
  }
  LOG.exiting(CLASS_NAME,"String_Node_Str");
}
Program: 59611
Project: 59611
Buggy source:
/** 
 * Start Hello REEF job with Driver and Client sharing the same process.
 * @param args command line parameters - not used.
 * @throws InjectionException configuration error.
 */
public static void main(final String[] args) throws InjectionException {
  try (final REEFEnvironment reef=REEFEnvironment.fromConfiguration(LOCAL_DRIVER_MODULE,DRIVER_CONFIG)){
    reef.run();
    final ReefServiceProtos.JobStatusProto status=reef.getLastStatus();
    LOG.log(Level.INFO,"String_Node_Str",status);
  }
 }

Fixed version (ground truth):
/** 
 * Start Hello REEF job with Driver and Client sharing the same process.
 * @param args command line parameters - not used.
 * @throws InjectionException configuration error.
 */
public static void main(final String[] args) throws InjectionException {
  try (final REEFEnvironment reef=REEFEnvironment.fromConfiguration(LOCAL_DRIVER_MODULE,DRIVER_CONFIG,ENVIRONMENT_CONFIG)){
    reef.run();
    final ReefServiceProtos.JobStatusProto status=reef.getLastStatus();
    LOG.log(Level.INFO,"String_Node_Str",status);
  }
 }
Program: 59612
Project: 59612
Buggy source:
/** 
 * Run REEF in-process using specified runtime and fail (raise an exception) in a specified class.
 * @param failMsgClass A class that should fail during the test.
 * @param runtimeConfig REEF runtime configuration. Can be e.g. Local or YARN.
 * @param timeOut REEF application timeout - not used yet.
 * @return Final job status. Final status for tests is usually somethingwith state = FAILED and exception like SimulatedDriverFailure.
 * @throws InjectionException configuration error.
 */
public static ReefServiceProtos.JobStatusProto runInProcess(final Class<?> failMsgClass,final Configuration runtimeConfig,final int timeOut) throws InjectionException {
  try (final REEFEnvironment reef=REEFEnvironment.fromConfiguration(runtimeConfig,buildDriverConfig(failMsgClass))){
    reef.run();
    return reef.getLastStatus();
  }
 }

Fixed version (ground truth):
/** 
 * Run REEF in-process using specified runtime and fail (raise an exception) in a specified class.
 * @param failMsgClass A class that should fail during the test.
 * @param runtimeConfig REEF runtime configuration. Can be e.g. Local or YARN.
 * @param timeOut REEF application timeout - not used yet.
 * @return Final job status. Final status for tests is usually somethingwith state = FAILED and exception like SimulatedDriverFailure.
 * @throws InjectionException configuration error.
 */
public static ReefServiceProtos.JobStatusProto runInProcess(final Class<?> failMsgClass,final Configuration runtimeConfig,final int timeOut) throws InjectionException {
  final Configuration driverConfig=TANG.newConfigurationBuilder(buildDriverConfig(failMsgClass)).bindNamedParameter(RemoteConfiguration.ManagerName.class,"String_Node_Str").bindNamedParameter(RemoteConfiguration.MessageCodec.class,REEFMessageCodec.class).build();
  try (final REEFEnvironment reef=REEFEnvironment.fromConfiguration(runtimeConfig,driverConfig)){
    reef.run();
    return reef.getLastStatus();
  }
 }
Program: 59614
Project: 59614
Buggy source:
public void testFailDriverTaskMessage() throws BindException, InjectionException {
  failOn(TaskMessage.class);
}

Fixed version (ground truth):
@Test public void testFailDriverTaskMessage() throws BindException, InjectionException {
  failOn(TaskMessage.class);
}
Program: 59615
Project: 59615
Buggy source:
public void testDriverCompleted() throws BindException, InjectionException {
  final ReefServiceProtos.JobStatusProto status=FailClient.runInProcess(REEFEnvironmentFailDriverTest.class,LOCAL_DRIVER_MODULE,0);
  Assert.assertNotNull("String_Node_Str",status);
  Assert.assertTrue("String_Node_Str",status.hasState());
  Assert.assertEquals("String_Node_Str",ReefServiceProtos.State.DONE,status.getState());
}

Fixed version (ground truth):
@Test public void testDriverCompleted() throws BindException, InjectionException {
  final ReefServiceProtos.JobStatusProto status=FailClient.runInProcess(REEFEnvironmentFailDriverTest.class,LOCAL_DRIVER_MODULE,0);
  Assert.assertNotNull("String_Node_Str",status);
  Assert.assertTrue("String_Node_Str",status.hasState());
  Assert.assertEquals("String_Node_Str",ReefServiceProtos.State.DONE,status.getState());
}
Program: 59616
Project: 59616
Buggy source:
public void testFailDriverStop() throws BindException, InjectionException {
  failOn(StopTime.class);
}

Fixed version (ground truth):
@Test public void testFailDriverStop() throws BindException, InjectionException {
  failOn(StopTime.class);
}
Program: 59617
Project: 59617
Buggy source:
public void testFailDriverCompletedTask() throws BindException, InjectionException {
  failOn(CompletedTask.class);
}

Fixed version (ground truth):
@Test public void testFailDriverCompletedTask() throws BindException, InjectionException {
  failOn(CompletedTask.class);
}
Program: 59618
Project: 59618
Buggy source:
public void testFailDriverActiveContext() throws BindException, InjectionException {
  failOn(ActiveContext.class);
}

Fixed version (ground truth):
@Test public void testFailDriverActiveContext() throws BindException, InjectionException {
  failOn(ActiveContext.class);
}
Program: 59619
Project: 59619
Buggy source:
public void testFailDriverAlarm() throws BindException, InjectionException {
  failOn(Alarm.class);
}

Fixed version (ground truth):
@Test public void testFailDriverAlarm() throws BindException, InjectionException {
  failOn(Alarm.class);
}
Program: 59620
Project: 59620
Buggy source:
public void testFailDriverCompletedEvaluator() throws BindException, InjectionException {
  failOn(CompletedEvaluator.class);
}

Fixed version (ground truth):
@Test public void testFailDriverCompletedEvaluator() throws BindException, InjectionException {
  failOn(CompletedEvaluator.class);
}
Program: 59621
Project: 59621
Buggy source:
public void testFailDriverRunningTask() throws BindException, InjectionException {
  failOn(RunningTask.class);
}

Fixed version (ground truth):
@Test public void testFailDriverRunningTask() throws BindException, InjectionException {
  failOn(RunningTask.class);
}
Program: 59622
Project: 59622
Buggy source:
public void testFailDriverSuspendedTask() throws BindException, InjectionException {
  failOn(SuspendedTask.class);
}

Fixed version (ground truth):
@Test public void testFailDriverSuspendedTask() throws BindException, InjectionException {
  failOn(SuspendedTask.class);
}
Program: 59623
Project: 59623
Buggy source:
/** 
 * Sets the state to RUNNING after the handlers for TaskStart have been called.
 */
void setRunning(){
  this.setState(State.RUNNING);
}

Fixed version (ground truth):
/** 
 * Sets the state to RUNNING after the handlers for TaskStart have been called.
 */
void setRunning(){
  this.setState(State.RUNNING);
  this.heartbeat();
}
Program: 59624
Project: 59624
Buggy source:
/** 
 * Run a job with a waiting timeout after which it will be killed, if it did not complete yet.
 * @param driverConfig the configuration for the driver. See DriverConfiguration for details.
 * @param timeOut      timeout on the job.
 * @return the state of the job after execution.
 */
public LauncherStatus run(final Configuration driverConfig,final long timeOut){
  final long endTime=System.currentTimeMillis() + timeOut;
  this.reef.submit(driverConfig);
synchronized (this) {
    while (!this.status.isDone()) {
      try {
        final long waitTime=endTime - System.currentTimeMillis();
        if (waitTime <= 0) {
          break;
        }
        LOG.log(Level.FINE,"String_Node_Str",waitTime);
        this.wait(waitTime);
      }
 catch (      final InterruptedException ex) {
        LOG.log(Level.FINE,"String_Node_Str",ex);
      }
    }
    if (System.currentTimeMillis() >= endTime) {
      LOG.log(Level.WARNING,"String_Node_Str");
      this.status=LauncherStatus.FORCE_CLOSED;
    }
  }
  this.reef.close();
  return this.status;
}

Fixed version (ground truth):
/** 
 * Run a job with a waiting timeout after which it will be killed, if it did not complete yet.
 * @param driverConfig the configuration for the driver. See DriverConfiguration for details.
 * @param timeOut      timeout on the job.
 * @return the state of the job after execution.
 */
public LauncherStatus run(final Configuration driverConfig,final long timeOut){
  final long endTime=System.currentTimeMillis() + timeOut;
  this.reef.submit(driverConfig);
synchronized (this) {
    while (!this.status.isDone()) {
      try {
        final long waitTime=endTime - System.currentTimeMillis();
        if (waitTime <= 0) {
          break;
        }
        LOG.log(Level.FINE,"String_Node_Str",waitTime);
        this.wait(waitTime);
      }
 catch (      final InterruptedException ex) {
        LOG.log(Level.FINE,"String_Node_Str",ex);
      }
    }
    if (System.currentTimeMillis() >= endTime) {
      LOG.log(Level.WARNING,"String_Node_Str");
      this.status=LauncherStatus.FORCE_CLOSED;
    }
  }
  this.reef.close();
synchronized (this) {
    return this.status;
  }
}
Program: 59625
Project: 59625
Buggy source:
/** 
 * @return the current status of the job.
 */
public LauncherStatus getStatus(){
  return this.status;
}

Fixed version (ground truth):
/** 
 * @return the current status of the job.
 */
public LauncherStatus getStatus(){
synchronized (this) {
    return this.status;
  }
}
Program: 59626
Project: 59626
Buggy source:
@Inject ConfigurableDirectoryTempFileCreator(@Parameter(TempFileRootFolder.class) final String rootFolder) throws IOException {
  this.tempFolderAsFile=new File(rootFolder);
  this.tempFolderAsFile.mkdirs();
  this.tempFolderAsPath=this.tempFolderAsFile.toPath();
  LOG.log(Level.FINE,"String_Node_Str",this.tempFolderAsFile.getAbsolutePath());
}

Fixed version (ground truth):
@Inject ConfigurableDirectoryTempFileCreator(@Parameter(TempFileRootFolder.class) final String rootFolder) throws IOException {
  this.tempFolderAsFile=new File(rootFolder);
  if (!this.tempFolderAsFile.exists() && !this.tempFolderAsFile.mkdirs()) {
    LOG.log(Level.WARNING,"String_Node_Str",this.tempFolderAsFile.getAbsolutePath());
  }
  this.tempFolderAsPath=this.tempFolderAsFile.toPath();
  LOG.log(Level.FINE,"String_Node_Str",this.tempFolderAsFile.getAbsolutePath());
}
Program: 59627
Project: 59627
Buggy source:
@Inject WorkingDirectoryTempFileCreator() throws IOException {
  this.tempFolderAsFile=new File("String_Node_Str");
  this.tempFolderAsFile.mkdirs();
  this.tempFolderAsPath=this.tempFolderAsFile.toPath();
  LOG.log(Level.FINE,"String_Node_Str",this.tempFolderAsFile.getAbsolutePath());
}

Fixed version (ground truth):
@Inject WorkingDirectoryTempFileCreator() throws IOException {
  this.tempFolderAsFile=new File("String_Node_Str");
  if (!this.tempFolderAsFile.exists() && !this.tempFolderAsFile.mkdirs()) {
    LOG.log(Level.WARNING,"String_Node_Str",this.tempFolderAsFile.getAbsolutePath());
  }
  this.tempFolderAsPath=this.tempFolderAsFile.toPath();
  LOG.log(Level.FINE,"String_Node_Str",this.tempFolderAsFile.getAbsolutePath());
}
Program: 59628
Project: 59628
Buggy source:
public File createJobSubmissionJAR(final JobSubmissionEvent jobSubmissionEvent,final Configuration driverConfiguration) throws IOException {
  final File jobSubmissionFolder=makejobSubmissionFolder();
  LOG.log(Level.FINE,"String_Node_Str",jobSubmissionFolder);
  final File localFolder=new File(jobSubmissionFolder,this.fileNames.getLocalFolderName());
  final File globalFolder=new File(jobSubmissionFolder,this.fileNames.getGlobalFolderName());
  this.copy(jobSubmissionEvent.getGlobalFileSet(),globalFolder);
  this.copy(jobSubmissionEvent.getLocalFileSet(),localFolder);
  this.configurationSerializer.toFile(driverConfiguration,new File(localFolder,this.fileNames.getDriverConfigurationName()));
  final File jarFile=File.createTempFile(this.fileNames.getJobFolderPrefix(),this.fileNames.getJarFileSuffix());
  LOG.log(Level.FINE,"String_Node_Str",jarFile);
  new JARFileMaker(jarFile).addChildren(jobSubmissionFolder).close();
  if (this.deleteTempFilesOnExit) {
    LOG.log(Level.FINE,"String_Node_Str",new Object[]{jobSubmissionFolder.getAbsolutePath(),jarFile.getAbsolutePath()});
    jobSubmissionFolder.delete();
    jarFile.deleteOnExit();
  }
 else {
    LOG.log(Level.FINE,"String_Node_Str",new Object[]{jobSubmissionFolder.getAbsolutePath(),jarFile.getAbsolutePath()});
  }
  return jarFile;
}

Fixed version (ground truth):
public File createJobSubmissionJAR(final JobSubmissionEvent jobSubmissionEvent,final Configuration driverConfiguration) throws IOException {
  final File jobSubmissionFolder=makejobSubmissionFolder();
  LOG.log(Level.FINE,"String_Node_Str",jobSubmissionFolder);
  final File localFolder=new File(jobSubmissionFolder,this.fileNames.getLocalFolderName());
  final File globalFolder=new File(jobSubmissionFolder,this.fileNames.getGlobalFolderName());
  copy(jobSubmissionEvent.getGlobalFileSet(),globalFolder);
  copy(jobSubmissionEvent.getLocalFileSet(),localFolder);
  this.configurationSerializer.toFile(driverConfiguration,new File(localFolder,this.fileNames.getDriverConfigurationName()));
  final File jarFile=File.createTempFile(this.fileNames.getJobFolderPrefix(),this.fileNames.getJarFileSuffix());
  LOG.log(Level.FINE,"String_Node_Str",jarFile);
  new JARFileMaker(jarFile).addChildren(jobSubmissionFolder).close();
  if (this.deleteTempFilesOnExit) {
    LOG.log(Level.FINE,"String_Node_Str",new Object[]{jobSubmissionFolder.getAbsolutePath(),jarFile.getAbsolutePath()});
    if (!jobSubmissionFolder.delete()) {
      LOG.log(Level.WARNING,"String_Node_Str",jobSubmissionFolder.getAbsolutePath());
    }
    jarFile.deleteOnExit();
  }
 else {
    LOG.log(Level.FINE,"String_Node_Str",new Object[]{jobSubmissionFolder.getAbsolutePath(),jarFile.getAbsolutePath()});
  }
  return jarFile;
}
Program: 59629
Project: 59629
Buggy source:
public static void copy(final Iterable<FileResource> files,final File destinationFolder){
  if (!destinationFolder.exists()) {
    destinationFolder.mkdirs();
  }
  for (  final FileResource fileProto : files) {
    final File sourceFile=toFile(fileProto);
    final File destinationFile=new File(destinationFolder,fileProto.getName());
    if (destinationFile.exists()) {
      LOG.log(Level.FINEST,"String_Node_Str",sourceFile.getAbsolutePath());
    }
 else {
      try {
        Files.copy(sourceFile.toPath(),destinationFile.toPath());
      }
 catch (      final IOException e) {
        final String message=new StringBuilder("String_Node_Str").append(sourceFile.getAbsolutePath()).append("String_Node_Str").append(destinationFile.getAbsolutePath()).append("String_Node_Str").toString();
        throw new RuntimeException(message,e);
      }
    }
  }
}

Fixed version (ground truth):
public static void copy(final Iterable<FileResource> files,final File destinationFolder){
  if (!destinationFolder.exists() && !destinationFolder.mkdirs()) {
    LOG.log(Level.WARNING,"String_Node_Str",destinationFolder.getAbsolutePath());
  }
  for (  final FileResource fileProto : files) {
    final File sourceFile=toFile(fileProto);
    final File destinationFile=new File(destinationFolder,fileProto.getName());
    if (destinationFile.exists()) {
      LOG.log(Level.FINEST,"String_Node_Str",sourceFile.getAbsolutePath());
    }
 else {
      try {
        Files.copy(sourceFile.toPath(),destinationFile.toPath());
      }
 catch (      final IOException e) {
        final String message=new StringBuilder("String_Node_Str").append(sourceFile.getAbsolutePath()).append("String_Node_Str").append(destinationFile.getAbsolutePath()).append("String_Node_Str").toString();
        throw new RuntimeException(message,e);
      }
    }
  }
}
Program: 59630
Project: 59630
Buggy source:
/** 
 * Adds a file to the JAR. If inputFile is a folder, it will be added recursively.
 * @param inputFile
 * @throws IOException
 */
public JARFileMaker add(final File inputFile) throws IOException {
  final String fileNameInJAR=makeRelative(inputFile);
  if (inputFile.isDirectory()) {
    final JarEntry entry=new JarEntry(fileNameInJAR);
    entry.setTime(inputFile.lastModified());
    this.jarOutputStream.putNextEntry(entry);
    this.jarOutputStream.closeEntry();
    for (    final File nestedFile : inputFile.listFiles()) {
      add(nestedFile);
    }
    return this;
  }
  final JarEntry entry=new JarEntry(fileNameInJAR);
  entry.setTime(inputFile.lastModified());
  this.jarOutputStream.putNextEntry(entry);
  try (final BufferedInputStream in=new BufferedInputStream(new FileInputStream(inputFile))){
    IOUtils.copy(in,this.jarOutputStream);
    this.jarOutputStream.closeEntry();
  }
 catch (  final FileNotFoundException ex) {
    LOG.log(Level.WARNING,"String_Node_Str" + inputFile,ex);
  }
  return this;
}

Fixed version (ground truth):
/** 
 * Adds a file to the JAR. If inputFile is a folder, it will be added recursively.
 * @param inputFile
 * @throws IOException
 */
public JARFileMaker add(final File inputFile) throws IOException {
  final String fileNameInJAR=makeRelative(inputFile);
  if (inputFile.isDirectory()) {
    final JarEntry entry=new JarEntry(fileNameInJAR);
    entry.setTime(inputFile.lastModified());
    this.jarOutputStream.putNextEntry(entry);
    this.jarOutputStream.closeEntry();
    final File[] files=inputFile.listFiles();
    if (files != null) {
      for (      final File nestedFile : files) {
        add(nestedFile);
      }
    }
    return this;
  }
  final JarEntry entry=new JarEntry(fileNameInJAR);
  entry.setTime(inputFile.lastModified());
  this.jarOutputStream.putNextEntry(entry);
  try (final BufferedInputStream in=new BufferedInputStream(new FileInputStream(inputFile))){
    IOUtils.copy(in,this.jarOutputStream);
    this.jarOutputStream.closeEntry();
  }
 catch (  final FileNotFoundException ex) {
    LOG.log(Level.WARNING,"String_Node_Str" + inputFile,ex);
  }
  return this;
}
Program: 59631
Project: 59631
Buggy source:
public JARFileMaker addChildren(final File folder) throws IOException {
  this.relativeStartCanonicalPath=folder.getCanonicalPath();
  for (  final File f : folder.listFiles()) {
    this.add(f);
  }
  this.relativeStartCanonicalPath=null;
  return this;
}

Fixed version (ground truth):
public JARFileMaker addChildren(final File folder) throws IOException {
  this.relativeStartCanonicalPath=folder.getCanonicalPath();
  final File[] files=folder.listFiles();
  if (files != null) {
    for (    final File f : files) {
      this.add(f);
    }
  }
  this.relativeStartCanonicalPath=null;
  return this;
}
Program: 59632
Project: 59632
Buggy source:
/** 
 * @return the process ID of the JVM, if running on Linux/Windows. This returns -1 for other OSs.
 */
public static long getPID(){
  if (isUnix()) {
    try {
      final Process process=new ProcessBuilder().command("String_Node_Str","String_Node_Str","String_Node_Str").start();
      final byte[] returnBytes=new byte[128];
      process.getInputStream().read(returnBytes);
      final Long result=Long.valueOf(new String(returnBytes,StandardCharsets.UTF_8).trim());
      process.destroy();
      return result;
    }
 catch (    final Exception e) {
      LOG.log(Level.SEVERE,"String_Node_Str",e);
      return -1;
    }
  }
 else   if (isWindows()) {
    try {
      final Process process=new ProcessBuilder().command("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str").start();
      final byte[] returnBytes=new byte[128];
      process.getInputStream().read(returnBytes);
      final Long result=Long.valueOf(new String(returnBytes,StandardCharsets.UTF_8).split("String_Node_Str")[1].trim());
      process.destroy();
      return result;
    }
 catch (    final Exception e) {
      LOG.log(Level.SEVERE,"String_Node_Str",e);
      return -1;
    }
  }
 else {
    return -1;
  }
}

Fixed version (ground truth):
/** 
 * @return the process ID of the JVM, if running on Linux/Windows. This returns -1 for other OSs.
 */
public static long getPID(){
  if (isUnix()) {
    try {
      final Process process=new ProcessBuilder().command("String_Node_Str","String_Node_Str","String_Node_Str").start();
      final byte[] returnBytes=new byte[128];
      if (process.getInputStream().read(returnBytes) == -1) {
        LOG.log(Level.FINE,"String_Node_Str");
      }
      final Long result=Long.valueOf(new String(returnBytes,StandardCharsets.UTF_8).trim());
      process.destroy();
      return result;
    }
 catch (    final Exception e) {
      LOG.log(Level.SEVERE,"String_Node_Str",e);
      return -1;
    }
  }
 else   if (isWindows()) {
    try {
      final Process process=new ProcessBuilder().command("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str").start();
      final byte[] returnBytes=new byte[128];
      if (process.getInputStream().read(returnBytes) == -1) {
        LOG.log(Level.FINE,"String_Node_Str");
      }
      final Long result=Long.valueOf(new String(returnBytes,StandardCharsets.UTF_8).split("String_Node_Str")[1].trim());
      process.destroy();
      return result;
    }
 catch (    final Exception e) {
      LOG.log(Level.SEVERE,"String_Node_Str",e);
      return -1;
    }
  }
 else {
    return -1;
  }
}
Program: 59634
Project: 59634
Buggy source:
/** 
 * @param args command line parameters.
 * @throws BindException      configuration error.
 * @throws InjectionException configuration error.
 */
@Test public void testMultipleInstances() throws BindException, InjectionException {
  final Configuration runtimeConfiguration=LocalRuntimeConfiguration.CONF.set(LocalRuntimeConfiguration.MAX_NUMBER_OF_EVALUATORS,2).build();
  final LauncherStatus status=runReefJob(runtimeConfiguration,JOB_TIMEOUT);
  Assert.assertTrue("String_Node_Str" + status,status.isSuccess());
}

Fixed version (ground truth):
/** 
 * @throws BindException      configuration error.
 * @throws InjectionException configuration error.
 */
@Test public void testMultipleInstances() throws BindException, InjectionException {
  final Configuration runtimeConfiguration=LocalRuntimeConfiguration.CONF.set(LocalRuntimeConfiguration.MAX_NUMBER_OF_EVALUATORS,2).build();
  final LauncherStatus status=runReefJob(runtimeConfiguration,JOB_TIMEOUT);
  Assert.assertTrue("String_Node_Str" + status,status.isSuccess());
}
Program: 59635
Project: 59635
Buggy source:
/** 
 * Wait a certain period of time for the result of the task.
 */
@Override public TOutput get(final long timeout,final TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
  if (!countDownLatch.await(timeout,unit)) {
    throw new TimeoutException();
  }
  if (userResult != null) {
    return userResult;
  }
 else {
    assert(userException != null);
    throw new ExecutionException(userException);
  }
}

Fixed version (ground truth):
/** 
 * Wait a certain period of time for the result of the task.
 */
@Override public TOutput get(final long timeout,final TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
}
Program: 59636
Project: 59636
Buggy source:
/** 
 * Concurrency: Called by multiple threads. Parameter: Same arguments can come in multiple times. (e.g. preemption message coming before tasklet completion message multiple times)
 */
void completeTasklet(final String workerId,final int taskletId,final Serializable result){
  lock.lock();
  try {
    if (!terminated) {
      if (runningWorkers.containsKey(workerId)) {
        final VortexWorkerManager worker=this.runningWorkers.get(workerId);
        final Tasklet tasklet=worker.taskletCompleted(taskletId,result);
        this.schedulingPolicy.taskletCompleted(worker,tasklet);
        noWorkerOrResource.signal();
      }
    }
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
/** 
 * Concurrency: Called by multiple threads. Parameter: Same arguments can come in multiple times. (e.g. preemption message coming before tasklet completion message multiple times)
 */
void completeTasklet(final String workerId,final int taskletId,final Serializable result){
  lock.lock();
  try {
    if (!terminated && runningWorkers.containsKey(workerId)) {
      final VortexWorkerManager worker=this.runningWorkers.get(workerId);
      final Tasklet tasklet=worker.taskletCompleted(taskletId,result);
      this.schedulingPolicy.taskletCompleted(worker,tasklet);
      noWorkerOrResource.signal();
    }
  }
  finally {
    lock.unlock();
  }
}
Program: 59637
Project: 59637
Buggy source:
/** 
 * Concurrency: Called by multiple threads. Parameter: Same arguments can come in multiple times. (e.g. preemption message coming before tasklet error message multiple times)
 */
void errorTasklet(final String workerId,final int taskletId,final Exception exception){
  lock.lock();
  try {
    if (!terminated) {
      if (runningWorkers.containsKey(workerId)) {
        final VortexWorkerManager worker=this.runningWorkers.get(workerId);
        final Tasklet tasklet=worker.taskletThrewException(taskletId,exception);
        this.schedulingPolicy.taskletFailed(worker,tasklet);
        noWorkerOrResource.signal();
      }
    }
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
/** 
 * Concurrency: Called by multiple threads. Parameter: Same arguments can come in multiple times. (e.g. preemption message coming before tasklet error message multiple times)
 */
void errorTasklet(final String workerId,final int taskletId,final Exception exception){
  lock.lock();
  try {
    if (!terminated && runningWorkers.containsKey(workerId)) {
      final VortexWorkerManager worker=this.runningWorkers.get(workerId);
      final Tasklet tasklet=worker.taskletThrewException(taskletId,exception);
      this.schedulingPolicy.taskletFailed(worker,tasklet);
      noWorkerOrResource.signal();
    }
  }
  finally {
    lock.unlock();
  }
}