nus-yam/ex-repair huggingface dataset:
Program: 49176
Project: 49176
Buggy source:
public Long startNode(String clusterName,String nodeGroupName,String nodeName) throws Exception {
  logger.info("String_Node_Str" + ClusterCmdUtil.getFullNodeName(clusterName,nodeGroupName,nodeName));
  ClusterEntity cluster;
  NodeGroupEntity group;
  if ((cluster=ClusterEntity.findClusterEntityByName(clusterName)) == null) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  if ((group=NodeGroupEntity.findNodeGroupEntityByName(cluster,nodeGroupName)) == null) {
    logger.error("String_Node_Str" + nodeGroupName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",nodeGroupName);
  }
  if (HadoopNodeEntity.findByName(group,nodeGroupName) == null) {
    logger.error("String_Node_Str" + nodeName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",nodeName);
  }
  StartClusterListener listener=new StartClusterListener(clusterName,nodeGroupName,nodeName);
  return createClusterMgmtTaskWithErrorSetting(cluster,listener,null);
}

Fixed version (ground truth):
public Long startNode(String clusterName,String nodeGroupName,String nodeName) throws Exception {
  logger.info("String_Node_Str" + ClusterCmdUtil.getFullNodeName(clusterName,nodeGroupName,nodeName));
  ClusterEntity cluster;
  NodeGroupEntity group;
  if ((cluster=ClusterEntity.findClusterEntityByName(clusterName)) == null) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  if ((group=NodeGroupEntity.findNodeGroupEntityByName(cluster,nodeGroupName)) == null) {
    logger.error("String_Node_Str" + nodeGroupName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",nodeGroupName);
  }
  if (HadoopNodeEntity.findByName(group,nodeName) == null) {
    logger.error("String_Node_Str" + nodeName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",nodeName);
  }
  StartClusterListener listener=new StartClusterListener(clusterName,nodeGroupName,nodeName);
  return createClusterMgmtTaskWithErrorSetting(cluster,listener,null);
}
Program: 49177
Project: 49177
Buggy source:
public Long stopNode(String clusterName,String nodeGroupName,String nodeName) throws Exception {
  logger.info("String_Node_Str" + ClusterCmdUtil.getFullNodeName(clusterName,nodeGroupName,nodeName));
  ClusterEntity cluster;
  NodeGroupEntity group;
  if ((cluster=ClusterEntity.findClusterEntityByName(clusterName)) == null) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  if ((group=NodeGroupEntity.findNodeGroupEntityByName(cluster,nodeGroupName)) == null) {
    logger.error("String_Node_Str" + nodeGroupName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",nodeGroupName);
  }
  if (HadoopNodeEntity.findByName(group,nodeGroupName) == null) {
    logger.error("String_Node_Str" + nodeName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",nodeName);
  }
  StopClusterListener listener=new StopClusterListener(clusterName,nodeGroupName,nodeName);
  return createClusterMgmtTaskWithErrorSetting(cluster,listener,null);
}

Fixed version (ground truth):
public Long stopNode(String clusterName,String nodeGroupName,String nodeName) throws Exception {
  logger.info("String_Node_Str" + ClusterCmdUtil.getFullNodeName(clusterName,nodeGroupName,nodeName));
  ClusterEntity cluster;
  NodeGroupEntity group;
  if ((cluster=ClusterEntity.findClusterEntityByName(clusterName)) == null) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  if ((group=NodeGroupEntity.findNodeGroupEntityByName(cluster,nodeGroupName)) == null) {
    logger.error("String_Node_Str" + nodeGroupName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",nodeGroupName);
  }
  if (HadoopNodeEntity.findByName(group,nodeName) == null) {
    logger.error("String_Node_Str" + nodeName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",nodeName);
  }
  StopClusterListener listener=new StopClusterListener(clusterName,nodeGroupName,nodeName);
  return createClusterMgmtTaskWithErrorSetting(cluster,listener,null);
}
Program: 49178
Project: 49178
Buggy source:
public static String getFullNodeName(String cluster,String group,String node){
  AuAssert.check(cluster != null && !cluster.isEmpty());
  AuAssert.check(group == null || !group.isEmpty());
  AuAssert.check(node == null || !node.isEmpty());
  AuAssert.check(!(node != null && group == null));
  StringBuilder fullName=new StringBuilder();
  fullName.append(cluster).append("String_Node_Str");
  if (group != null) {
    fullName.append(group).append("String_Node_Str");
    if (node != null) {
      fullName.append(node);
    }
  }
  return fullName.toString();
}

Fixed version (ground truth):
public static String getFullNodeName(String cluster,String group,String node){
  AuAssert.check(cluster != null && !cluster.isEmpty());
  AuAssert.check(group == null || !group.isEmpty());
  AuAssert.check(node == null || !node.isEmpty());
  AuAssert.check(!(node != null && group == null));
  StringBuilder fullName=new StringBuilder();
  fullName.append(cluster);
  if (group != null) {
    fullName.append("String_Node_Str").append(group);
    if (node != null) {
      fullName.append("String_Node_Str").append(node);
    }
  }
  return fullName.toString();
}
Program: 49179
Project: 49179
Buggy source:
public CliRestException(String errorMsg){
  super(errorMsg);
}

Fixed version (ground truth):
public CliRestException(HttpStatus status,String errorMsg){
  super(errorMsg);
  this.status=status;
}
Program: 49180
Project: 49180
Buggy source:
public void handleError(ClientHttpResponse response) throws IOException {
  throw new CliRestException(delegate.extractData(response).getMessage());
}

Fixed version (ground truth):
public void handleError(ClientHttpResponse response) throws IOException {
  MediaType contentType=response.getHeaders().getContentType();
  if (contentType == MediaType.APPLICATION_JSON) {
    throw new CliRestException(delegate.extractData(response).getMessage());
  }
 else {
    HttpStatus statusCode=response.getStatusCode();
    throw new CliRestException(statusCode,statusCode.getReasonPhrase());
  }
}
Program: 49182
Project: 49182
Buggy source:
private boolean showWarningMsg(String clusterName,List<String> warningMsgList){
  if (warningMsgList != null && !warningMsgList.isEmpty()) {
    for (    String message : warningMsgList) {
      System.out.println(message);
    }
    if (!isContinue(clusterName,Constants.OUTPUT_OP_CREATE,Constants.PARAM_PROMPT_CONTINUE_NEW_MESSAGE)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean showWarningMsg(String clusterName,List<String> warningMsgList){
  if (warningMsgList != null && !warningMsgList.isEmpty()) {
    for (    String message : warningMsgList) {
      System.out.println(message);
    }
    if (!isContinue(clusterName,Constants.OUTPUT_OP_CREATE,Constants.PARAM_PROMPT_CONTINUE_MESSAGE)) {
      return false;
    }
  }
  return true;
}
Program: 49183
Project: 49183
Buggy source:
public Long configCluster(String clusterName,ClusterCreate createSpec) throws Exception {
  logger.info("String_Node_Str" + clusterName);
  ClusterEntity cluster;
  if ((cluster=ClusterEntity.findClusterEntityByName(clusterName)) == null) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  if (!ClusterStatus.RUNNING.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str"+ cluster.getStatus());
    throw ClusterManagerException.UPDATE_NOT_ALLOWED_ERROR(clusterName,"String_Node_Str");
  }
  clusterConfigMgr.updateAppConfig(clusterName,createSpec);
  ConfigureClusterListener listener=new ConfigureClusterListener(clusterName);
  return createClusterMgmtTaskWithErrorSetting(cluster,listener,ClusterStatus.CONFIGURING);
}

Fixed version (ground truth):
public Long configCluster(String clusterName,ClusterCreate createSpec) throws Exception {
  logger.info("String_Node_Str" + clusterName);
  ClusterEntity cluster;
  if ((cluster=ClusterEntity.findClusterEntityByName(clusterName)) == null) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  if (!ClusterStatus.RUNNING.equals(cluster.getStatus()) && !ClusterStatus.CONFIGURE_ERROR.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str"+ cluster.getStatus());
    throw ClusterManagerException.UPDATE_NOT_ALLOWED_ERROR(clusterName,"String_Node_Str");
  }
  clusterConfigMgr.updateAppConfig(clusterName,createSpec);
  ConfigureClusterListener listener=new ConfigureClusterListener(clusterName);
  return createClusterMgmtTaskWithErrorSetting(cluster,listener,ClusterStatus.CONFIGURING);
}
Program: 49184
Project: 49184
Buggy source:
public Long deleteClusterByName(String clusterName) throws Exception {
  logger.info("String_Node_Str" + clusterName);
  ClusterEntity cluster;
  if ((cluster=ClusterEntity.findClusterEntityByName(clusterName)) == null) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  if (!ClusterStatus.RUNNING.equals(cluster.getStatus()) && !ClusterStatus.STOPPED.equals(cluster.getStatus()) && !ClusterStatus.ERROR.equals(cluster.getStatus())&& !ClusterStatus.PROVISION_ERROR.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str"+ cluster.getStatus()+ "String_Node_Str");
    throw ClusterManagerException.DELETION_NOT_ALLOWED_ERROR(clusterName,"String_Node_Str");
  }
  DeleteClusterListener listener=new DeleteClusterListener(clusterName,networkManager);
  return createClusterMgmtTaskWithErrorSetting(cluster,listener,ClusterStatus.DELETING);
}

Fixed version (ground truth):
public Long deleteClusterByName(String clusterName) throws Exception {
  logger.info("String_Node_Str" + clusterName);
  ClusterEntity cluster;
  if ((cluster=ClusterEntity.findClusterEntityByName(clusterName)) == null) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",clusterName);
  }
  if (!ClusterStatus.RUNNING.equals(cluster.getStatus()) && !ClusterStatus.STOPPED.equals(cluster.getStatus()) && !ClusterStatus.ERROR.equals(cluster.getStatus())&& !ClusterStatus.PROVISION_ERROR.equals(cluster.getStatus())&& !ClusterStatus.CONFIGURE_ERROR.equals(cluster.getStatus())) {
    logger.error("String_Node_Str" + clusterName + "String_Node_Str"+ cluster.getStatus()+ "String_Node_Str");
    throw ClusterManagerException.DELETION_NOT_ALLOWED_ERROR(clusterName,"String_Node_Str");
  }
  DeleteClusterListener listener=new DeleteClusterListener(clusterName,networkManager);
  return createClusterMgmtTaskWithErrorSetting(cluster,listener,ClusterStatus.DELETING);
}
Program: 49185
Project: 49185
Buggy source:
@Override public void onFailure(){
  logger.debug("String_Node_Str");
  ClusterEntity cluster=ClusterEntity.findClusterEntityByName(clusterName);
  AuAssert.check(cluster != null);
  cluster.setStatus(ClusterStatus.ERROR);
  DAL.inTransactionUpdate(cluster);
  logger.error("String_Node_Str" + clusterName + "String_Node_Str");
}

Fixed version (ground truth):
@Override public void onFailure(){
  logger.debug("String_Node_Str");
  ClusterEntity cluster=ClusterEntity.findClusterEntityByName(clusterName);
  AuAssert.check(cluster != null);
  cluster.setStatus(ClusterStatus.CONFIGURE_ERROR);
  DAL.inTransactionUpdate(cluster);
  logger.error("String_Node_Str" + clusterName + "String_Node_Str");
}
Program: 49187
Project: 49187
Buggy source:
private boolean validateConfiguration(String levelName,Map<String,Object> configuration){
  ValidateResult validateResult=null;
  for (  ValidationType validationType : ValidationType.values()) {
    validateResult=AppConfigValidationUtils.validateConfig(validationType,configuration);
    if (validateResult.getType() != ValidateResult.Type.VALID) {
      String warningMsg="String_Node_Str";
      if (validateResult.getType() == ValidateResult.Type.NAME_IN_BLACK_LIST) {
        warningMsg=getValidateWarningMsg(levelName,validateResult.getFailureNames(),Constants.PARAM_CLUSTER_IN_BLACK_LIST_WARNING);
        System.out.println(warningMsg);
      }
 else       if (validateResult.getType() == ValidateResult.Type.WHITE_LIST_INVALID_NAME) {
        warningMsg=getValidateWarningMsg(levelName,validateResult.getFailureNames(),Constants.PARAM_CLUSTER_NOT_IN_WHITE_LIST_WARNING + Constants.PARAM_CLUSTER_NOT_IN_WHITE_LIST_WARNING_CONTINUE);
        if (!isContinue(levelName,Constants.OUTPUT_OP_CREATE,warningMsg)) {
          return false;
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
private ValidateResult validateConfiguration(ClusterCreate cluster,ValidationType validationType){
  ValidateResult validateResult=new ValidateResult();
  ValidateResult vr=null;
  if (cluster.getConfiguration() != null && !cluster.getConfiguration().isEmpty()) {
    vr=AppConfigValidationUtils.validateConfig(validationType,cluster.getConfiguration());
    if (vr.getType() != ValidateResult.Type.VALID) {
      validateResult.setType(vr.getType());
      validateResult.setFailureNames(vr.getFailureNames());
    }
  }
  for (  NodeGroupCreate nodeGroup : cluster.getNodeGroups()) {
    if (nodeGroup.getConfiguration() != null && !nodeGroup.getConfiguration().isEmpty()) {
      vr=AppConfigValidationUtils.validateConfig(validationType,nodeGroup.getConfiguration());
      if (vr.getType() != ValidateResult.Type.VALID) {
        validateResult.setType(vr.getType());
        List<String> failureNames=new LinkedList<String>();
        failureNames.addAll(validateResult.getFailureNames());
        for (        String name : vr.getFailureNames()) {
          if (!failureNames.contains(name)) {
            failureNames.add(name);
          }
        }
        validateResult.setFailureNames(vr.getFailureNames());
      }
    }
  }
  return validateResult;
}
Program: 49188
Project: 49188
Buggy source:
private String getValidateWarningMsg(String levelName,List<String> failureNames,String warningMsg){
  StringBuilder warningMsgBuff=new StringBuilder();
  if (failureNames != null && !failureNames.isEmpty()) {
    warningMsgBuff.append("String_Node_Str");
    for (    String failureName : failureNames) {
      warningMsgBuff.append(failureName).append("String_Node_Str");
    }
    warningMsgBuff.delete(warningMsgBuff.length() - 2,warningMsgBuff.length());
    if (failureNames.size() > 1) {
      warningMsgBuff.append("String_Node_Str");
    }
 else {
      warningMsgBuff.append("String_Node_Str");
    }
    warningMsgBuff.append(warningMsg);
  }
  return warningMsgBuff.toString();
}

Fixed version (ground truth):
private String getValidateWarningMsg(List<String> failureNames,String warningMsg){
  StringBuilder warningMsgBuff=new StringBuilder();
  if (failureNames != null && !failureNames.isEmpty()) {
    warningMsgBuff.append("String_Node_Str");
    for (    String failureName : failureNames) {
      warningMsgBuff.append(failureName).append("String_Node_Str");
    }
    warningMsgBuff.delete(warningMsgBuff.length() - 2,warningMsgBuff.length());
    if (failureNames.size() > 1) {
      warningMsgBuff.append("String_Node_Str");
    }
 else {
      warningMsgBuff.append("String_Node_Str");
    }
    warningMsgBuff.append(warningMsg);
  }
  return warningMsgBuff.toString();
}
Program: 49192
Project: 49192
Buggy source:
@Inject public EventSource(ObjectMapper mapper){
  this.mapper=mapper;
  try {
    factory=createSessionFactory();
    session=factory.createSession(true,true,0);
    session.start();
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Inject public EventSource(ObjectMapper mapper){
  this.mapper=mapper;
  try {
    factory=createSessionFactory();
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}
Program: 49193
Project: 49193
Buggy source:
protected void shutDown(){
  try {
    session.stop();
    session.close();
    factory.close();
  }
 catch (  ActiveMQException e) {
    log.warn("String_Node_Str",e);
  }
}

Fixed version (ground truth):
protected void shutDown(){
  closeEventReceivers();
  factory.close();
}
Program: 49194
Project: 49194
Buggy source:
void registerListener(EventListener listener){
  String queueName=QUEUE_ADDRESS + "String_Node_Str" + listener.getClass().getCanonicalName();
  log.debug("String_Node_Str",queueName);
  try {
    try {
      session.createQueue(QUEUE_ADDRESS,queueName,true);
      log.debug("String_Node_Str" + queueName);
    }
 catch (    ActiveMQException e) {
      if (e.getType() != ActiveMQExceptionType.QUEUE_EXISTS) {
        throw e;
      }
    }
    ClientConsumer consumer=session.createConsumer(queueName);
    consumer.setMessageHandler(new ListenerWrapper(listener,mapper));
  }
 catch (  ActiveMQException e) {
    log.error("String_Node_Str" + listener,e);
  }
}

Fixed version (ground truth):
void registerListener(EventListener listener) throws Exception {
  this.eventReceivers.add(new EventReceiver(listener,factory,mapper));
}
Program: 49195
Project: 49195
Buggy source:
public ListenerWrapper(EventListener listener,ObjectMapper mapper){
  this.listener=listener;
  this.mapper=mapper;
}

Fixed version (ground truth):
public ListenerWrapper(EventListener listener,ObjectMapper mapper,ClientSession session){
  this.listener=listener;
  this.mapper=mapper;
  this.session=session;
}
Program: 49196
Project: 49196
Buggy source:
@Override public void onMessage(ClientMessage msg){
  String body=msg.getBodyBuffer().readString();
  log.debug("String_Node_Str",body);
  try {
    Event event=mapper.readValue(body,Event.class);
    listener.onEvent(event);
  }
 catch (  JsonMappingException e) {
    log.error("String_Node_Str" + body,e);
    throw new RuntimeException("String_Node_Str",e);
  }
catch (  JsonParseException e) {
    log.error("String_Node_Str" + body,e);
    throw new RuntimeException("String_Node_Str",e);
  }
catch (  IOException e) {
    log.error("String_Node_Str" + body,e);
    throw new RuntimeException("String_Node_Str",e);
  }
  try {
    msg.acknowledge();
    log.debug("String_Node_Str" + listener);
  }
 catch (  ActiveMQException e) {
    log.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void onMessage(ClientMessage msg){
  String body="String_Node_Str";
  try {
    msg.acknowledge();
    log.debug("String_Node_Str",msg.getMessageID(),listener);
    body=msg.getBodyBuffer().readString();
    log.debug("String_Node_Str",body);
    Event event=mapper.readValue(body,Event.class);
    listener.onEvent(event);
    session.commit();
  }
 catch (  Exception e) {
    String messageId=(msg == null) ? "String_Node_Str" : Long.toString(msg.getMessageID());
    String reason=(e.getCause() == null) ? e.getMessage() : e.getCause().getMessage();
    log.error("String_Node_Str",messageId,reason);
    log.debug("String_Node_Str",body,e);
    try {
      session.rollback();
    }
 catch (    ActiveMQException amqe) {
      log.error("String_Node_Str",amqe);
    }
  }
}
Program: 49197
Project: 49197
Buggy source:
/** 
 * Returns the true value of the autobindDisabled setting.
 * @return True if autobind is disabled for this owner, False or null otherwise.A value of null means that it is unset, and considered in code as False.
 */
@JsonProperty("String_Node_Str") public boolean isAutobindDisabled(){
  return autobindDisabled;
}

Fixed version (ground truth):
/** 
 * Checks if autobind is disabled for consumers of this owner/organization.
 * @return true if autobind is disabled for this owner/organization; false otherwise
 */
@JsonProperty("String_Node_Str") public boolean isAutobindDisabled(){
  return this.autobindDisabled != null ? this.autobindDisabled.booleanValue() : false;
}
Program: 49198
Project: 49198
Buggy source:
@Override public List<Pool> createPools(List<Pool> pools){
  if (CollectionUtils.isNotEmpty(pools)) {
    poolCurator.saveOrUpdateAll(pools,false,false);
    for (    Pool pool : pools) {
      log.debug("String_Node_Str",pool);
      if (pool != null) {
        sink.emitPoolCreated(pool);
      }
    }
  }
  return pools;
}

Fixed version (ground truth):
@Override public List<Pool> createPools(List<Pool> pools){
  if (CollectionUtils.isNotEmpty(pools)) {
    Set<String> updatedPoolIds=new HashSet<String>();
    for (    Pool pool : pools) {
      if (pool.getId() != null) {
        updatedPoolIds.add(pool.getId());
      }
    }
    poolCurator.saveOrUpdateAll(pools,false,false);
    for (    Pool pool : pools) {
      if (pool != null && !updatedPoolIds.contains(pool.getId())) {
        log.debug("String_Node_Str",pool);
        sink.emitPoolCreated(pool);
      }
 else {
        log.debug("String_Node_Str",pool);
      }
    }
  }
  return pools;
}
Program: 49199
Project: 49199
Buggy source:
@Override public Pool createPool(Pool pool){
  Pool created=poolCurator.create(pool);
  log.debug("String_Node_Str",pool);
  if (created != null) {
    sink.emitPoolCreated(created);
  }
  return created;
}

Fixed version (ground truth):
@Override public Pool createPool(Pool pool){
  if (pool != null) {
    if (pool.getId() == null) {
      pool=this.poolCurator.create(pool);
      log.debug("String_Node_Str",pool);
      if (pool != null) {
        sink.emitPoolCreated(pool);
      }
    }
 else {
      pool=this.poolCurator.merge(pool);
      log.debug("String_Node_Str",pool);
    }
  }
  return pool;
}
Program: 49200
Project: 49200
Buggy source:
@Override public void updateMasterPool(Pool pool){
  if (pool == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (pool.getEndDate() != null && pool.getEndDate().before(new Date())) {
    List<String> subscriptions=new ArrayList<String>();
    subscriptions.add(pool.getSubscriptionId());
    this.deletePoolsForSubscriptions(subscriptions);
  }
 else {
    this.refreshPoolsForMasterPool(pool,false,true,Collections.<String,Product>emptyMap());
  }
}

Fixed version (ground truth):
@Override public void updateMasterPool(Pool pool){
  if (pool == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (pool.getEndDate() != null && pool.getEndDate().before(new Date())) {
    this.deletePoolsForSubscriptions(Collections.<String>singletonList(pool.getSubscriptionId()));
  }
 else {
    this.refreshPoolsForMasterPool(pool,false,true,Collections.<String,Product>emptyMap());
  }
}
Program: 49201
Project: 49201
Buggy source:
@Transactional void refreshPoolsForMasterPool(Pool pool,boolean updateStackDerived,boolean lazy,Map<String,Product> changedProducts){
  List<Pool> subscriptionPools=poolCurator.getPoolsBySubscriptionId(pool.getSubscriptionId()).list();
  log.debug("String_Node_Str",subscriptionPools.size(),pool.getSubscriptionId());
  if (log.isDebugEnabled()) {
    for (    Pool p : subscriptionPools) {
      log.debug("String_Node_Str",p.getOwner().getKey(),p);
    }
  }
  for (  Pool subPool : subscriptionPools) {
    Product product=subPool.getProduct();
    if (product != null) {
      Product update=changedProducts.get(product.getId());
      if (update != null) {
        subPool.setProduct(update);
      }
    }
    product=subPool.getDerivedProduct();
    if (product != null) {
      Product update=changedProducts.get(product.getId());
      if (update != null) {
        subPool.setDerivedProduct(update);
      }
    }
  }
  removeAndDeletePoolsOnOtherOwners(subscriptionPools,pool);
  Long originalQuantity=pool.getQuantity();
  createAndEnrichPools(pool,subscriptionPools);
  Set<String> updatedMasterPools=updatePoolsForMasterPool(subscriptionPools,pool,originalQuantity,updateStackDerived,changedProducts);
  regenerateCertificatesByEntIds(updatedMasterPools,lazy);
}

Fixed version (ground truth):
@Transactional void refreshPoolsForMasterPool(Pool pool,boolean updateStackDerived,boolean lazy,Map<String,Product> changedProducts){
  List<Pool> subscriptionPools;
  if (pool.getSubscriptionId() != null) {
    subscriptionPools=this.poolCurator.getPoolsBySubscriptionId(pool.getSubscriptionId()).list();
  }
 else {
    subscriptionPools=pool.getId() != null ? Collections.<Pool>singletonList(this.poolCurator.find(pool.getId())) : Collections.<Pool>singletonList(pool);
  }
  log.debug("String_Node_Str",subscriptionPools.size(),pool.getSubscriptionId());
  if (log.isDebugEnabled()) {
    for (    Pool p : subscriptionPools) {
      log.debug("String_Node_Str",p.getOwner().getKey(),p);
    }
  }
  for (  Pool subPool : subscriptionPools) {
    Product product=subPool.getProduct();
    if (product != null) {
      Product update=changedProducts.get(product.getId());
      if (update != null) {
        subPool.setProduct(update);
      }
    }
    product=subPool.getDerivedProduct();
    if (product != null) {
      Product update=changedProducts.get(product.getId());
      if (update != null) {
        subPool.setDerivedProduct(update);
      }
    }
  }
  removeAndDeletePoolsOnOtherOwners(subscriptionPools,pool);
  Long originalQuantity=pool.getQuantity();
  createAndEnrichPools(pool,subscriptionPools);
  Set<String> updatedMasterPools=updatePoolsForMasterPool(subscriptionPools,pool,originalQuantity,updateStackDerived,changedProducts);
  regenerateCertificatesByEntIds(updatedMasterPools,lazy);
}
Program: 49206
Project: 49206
Buggy source:
protected String readPassphrase(String passphraseProperty) throws ConfigurationException {
  if (!containsKey(passphraseProperty)) {
    log.info("String_Node_Str");
    return null;
  }
  String secretFile=getString(passphraseProperty);
  if (StringUtils.isEmpty(secretFile)) {
    log.warn("String_Node_Str",passphraseProperty);
    return null;
  }
  log.debug("String_Node_Str",secretFile);
  try {
    InputStream bs=new FileInputStream(secretFile);
    return IOUtils.toString(bs,Charset.defaultCharset().name());
  }
 catch (  Exception e) {
    String msg=String.format("String_Node_Str",secretFile);
    log.error(msg);
    throw new ConfigurationException(msg,e);
  }
}

Fixed version (ground truth):
protected String readPassphrase(String passphraseProperty) throws ConfigurationException {
  if (!containsKey(passphraseProperty)) {
    log.info("String_Node_Str");
    return null;
  }
  String secretFile=getString(passphraseProperty);
  if (StringUtils.isEmpty(secretFile)) {
    log.warn("String_Node_Str",passphraseProperty);
    return null;
  }
  log.debug("String_Node_Str",secretFile);
  try (InputStream bs=new FileInputStream(secretFile)){
    return IOUtils.toString(bs,Charset.defaultCharset().name());
  }
 catch (  Exception e) {
    String msg=String.format("String_Node_Str",secretFile);
    log.error(msg);
    throw new ConfigurationException(msg,e);
  }
}
Program: 49207
Project: 49207
Buggy source:
@Override public Map<String,String> headers(){
  HashMap<String,String> negHeaders=new HashMap<String,String>();
  negHeaders.put("String_Node_Str","String_Node_Str");
  negHeaders.put("String_Node_Str","String_Node_Str");
  return negHeaders;
}

Fixed version (ground truth):
@Override public Map<String,String> headers(){
  HashMap<String,String> negHeaders=new HashMap<String,String>();
  negHeaders.put("String_Node_Str","String_Node_Str");
  return negHeaders;
}
Program: 49208
Project: 49208
Buggy source:
@Override public String interpolate(String messageTemplate,Context context,Locale locale){
  Map<String,Object> attrs=context.getConstraintDescriptor().getAttributes();
  ValidationMessage validationMessage=MESSAGES.get(messageTemplate);
  List<Object> paramList=new ArrayList<Object>();
  for (  String param : validationMessage.getParamNames()) {
    if (attrs.containsKey(param)) {
      paramList.add(attrs.get(param));
    }
 else {
      paramList.add(param);
    }
  }
  return i18nProvider.get().tr(validationMessage.getMessage(),paramList.toArray());
}

Fixed version (ground truth):
@Override public String interpolate(String messageTemplate,Context context,Locale locale){
  Map<String,Object> attrs=context.getConstraintDescriptor().getAttributes();
  ValidationMessage validationMessage=MESSAGES.get(messageTemplate);
  List<Object> paramList=new ArrayList<Object>();
  for (  String param : validationMessage.getParamNames()) {
    paramList.add(attrs.containsKey(param) ? attrs.get(param) : param);
  }
  return i18nProvider.get().tr(validationMessage.getMessage(),paramList.toArray());
}
Program: 49209
Project: 49209
Buggy source:
void registerListener(EventListener listener){
  String queueName=QUEUE_ADDRESS + "String_Node_Str" + listener.getClass().getCanonicalName();
  log.debug("String_Node_Str" + queueName);
  try {
    try {
      session.createQueue(QUEUE_ADDRESS,queueName,true);
      log.debug("String_Node_Str" + queueName);
    }
 catch (    ActiveMQException e) {
      if (e.getType() != ActiveMQExceptionType.QUEUE_EXISTS) {
        throw e;
      }
    }
    ClientConsumer consumer=session.createConsumer(queueName);
    consumer.setMessageHandler(new ListenerWrapper(listener,mapper));
  }
 catch (  ActiveMQException e) {
    log.error("String_Node_Str" + listener,e);
  }
}

Fixed version (ground truth):
void registerListener(EventListener listener){
  String queueName=QUEUE_ADDRESS + "String_Node_Str" + listener.getClass().getCanonicalName();
  log.debug("String_Node_Str",queueName);
  try {
    try {
      session.createQueue(QUEUE_ADDRESS,queueName,true);
      log.debug("String_Node_Str" + queueName);
    }
 catch (    ActiveMQException e) {
      if (e.getType() != ActiveMQExceptionType.QUEUE_EXISTS) {
        throw e;
      }
    }
    ClientConsumer consumer=session.createConsumer(queueName);
    consumer.setMessageHandler(new ListenerWrapper(listener,mapper));
  }
 catch (  ActiveMQException e) {
    log.error("String_Node_Str" + listener,e);
  }
}
Program: 49211
Project: 49211
Buggy source:
/** 
 * Return all pools referencing the given entitlements as their source entitlements. Works recursively. The method always takes the result and return all source entitlements of the pools. This method finds all the pools that have been created as direct consequence of creating some of ents. So for example bonus pools created as consequence of creating ents.
 * @param ents Entitlements for which we search the pools
 * @return Pools created as a result of creation of one of the ents.
 */
public List<Pool> listBySourceEntitlements(List<Entitlement> ents){
  if (ents.size() == 0) {
    return new ArrayList<Pool>();
  }
  List<Pool> results=createSecureCriteria().add(CPRestrictions.in("String_Node_Str",ents)).setFetchMode("String_Node_Str",FetchMode.JOIN).list();
  if (results == null) {
    results=new LinkedList<Pool>();
  }
  if (results.size() > 0) {
    List<Pool> pools=listBySourceEntitlements(convertPoolsToEntitlements(results));
    results.addAll(pools);
  }
  return results;
}

Fixed version (ground truth):
/** 
 * Return all pools referencing the given entitlements as their source entitlements. Works recursively. The method always takes the result and return all source entitlements of the pools. This method finds all the pools that have been created as direct consequence of creating some of ents. So for example bonus pools created as consequence of creating ents.
 * @param ents Entitlements for which we search the pools
 * @return Pools created as a result of creation of one of the ents.
 */
public Set<Pool> listBySourceEntitlements(Iterable<Entitlement> ents){
  if (ents == null || !ents.iterator().hasNext()) {
    return new HashSet<Pool>();
  }
  Set<Pool> output=new HashSet<Pool>();
  for (  List<Entitlement> block : this.partition(ents)) {
    List<Pool> pools=createSecureCriteria().add(CPRestrictions.in("String_Node_Str",block)).setFetchMode("String_Node_Str",FetchMode.JOIN).list();
    if (pools != null) {
      output.addAll(pools);
    }
  }
  if (output.size() > 0) {
    Set<Pool> pools=this.listBySourceEntitlements(convertPoolsToEntitlements(output));
    output.addAll(pools);
  }
  return output;
}
Program: 49212
Project: 49212
Buggy source:
private List<Entitlement> convertPoolsToEntitlements(List<Pool> pools){
  List<Entitlement> result=new ArrayList<Entitlement>();
  for (  Pool p : pools) {
    result.addAll(p.getEntitlements());
  }
  return result;
}

Fixed version (ground truth):
private Set<Entitlement> convertPoolsToEntitlements(Collection<Pool> pools){
  Set<Entitlement> output=new HashSet<Entitlement>();
  for (  Pool p : pools) {
    output.addAll(p.getEntitlements());
  }
  return output;
}
Program: 49213
Project: 49213
Buggy source:
@Test public void testBatchRevokeCleansUpCorrectPoolsWithSourceEnt() throws Exception {
  Consumer c=TestUtil.createConsumer(owner);
  Pool pool2=TestUtil.createPool(owner,product);
  Entitlement e=new Entitlement(pool,c,1);
  Entitlement e2=new Entitlement(pool2,c,1);
  Entitlement e3=new Entitlement(pool2,c,1);
  List<Entitlement> entsToDelete=Util.newList();
  entsToDelete.add(e);
  entsToDelete.add(e2);
  List<Pool> poolsWithSource=createPoolsWithSourceEntitlement(e,product);
  poolsWithSource.get(0).getEntitlements().add(e3);
  when(mockPoolCurator.listBySourceEntitlements(entsToDelete)).thenReturn(poolsWithSource);
  PreUnbindHelper preHelper=mock(PreUnbindHelper.class);
  ValidationResult result=new ValidationResult();
  when(preHelper.getResult()).thenReturn(result);
  when(mockConfig.getBoolean(ConfigProperties.STANDALONE)).thenReturn(true);
  when(mockPoolCurator.lockAndLoad(eq(pool))).thenReturn(pool);
  when(mockPoolCurator.lockAndLoad(eq(pool2))).thenReturn(pool2);
  manager.revokeEntitlements(entsToDelete);
  entsToDelete.add(e3);
  verify(entitlementCurator).batchDelete(eq(entsToDelete));
  verify(mockPoolCurator).batchDelete(eq(poolsWithSource),anySetOf(String.class));
}

Fixed version (ground truth):
@Test public void testBatchRevokeCleansUpCorrectPoolsWithSourceEnt() throws Exception {
  Consumer c=TestUtil.createConsumer(owner);
  Pool pool2=TestUtil.createPool(owner,product);
  Entitlement e=new Entitlement(pool,c,1);
  Entitlement e2=new Entitlement(pool2,c,1);
  Entitlement e3=new Entitlement(pool2,c,1);
  List<Entitlement> entsToDelete=Util.newList();
  entsToDelete.add(e);
  entsToDelete.add(e2);
  List<Pool> poolsWithSource=createPoolsWithSourceEntitlement(e,product);
  poolsWithSource.get(0).getEntitlements().add(e3);
  Set<Pool> poolsWithSourceAsSet=new HashSet<Pool>(poolsWithSource);
  when(mockPoolCurator.listBySourceEntitlements(entsToDelete)).thenReturn(poolsWithSourceAsSet);
  PreUnbindHelper preHelper=mock(PreUnbindHelper.class);
  ValidationResult result=new ValidationResult();
  when(preHelper.getResult()).thenReturn(result);
  when(mockConfig.getBoolean(ConfigProperties.STANDALONE)).thenReturn(true);
  when(mockPoolCurator.lockAndLoad(eq(pool))).thenReturn(pool);
  when(mockPoolCurator.lockAndLoad(eq(pool2))).thenReturn(pool2);
  manager.revokeEntitlements(entsToDelete);
  entsToDelete.add(e3);
  verify(entitlementCurator).batchDelete(eq(entsToDelete));
  verify(mockPoolCurator).batchDelete(eq(poolsWithSourceAsSet),anySetOf(String.class));
}
Program: 49214
Project: 49214
Buggy source:
@Test public void testListBySourceEntitlements(){
  Pool sourcePool=TestUtil.createPool(owner,product);
  Pool sourcePool2=TestUtil.createPool(owner,product);
  Pool sourcePool3=TestUtil.createPool(owner,product);
  poolCurator.create(sourcePool);
  poolCurator.create(sourcePool2);
  poolCurator.create(sourcePool3);
  Entitlement e=new Entitlement(sourcePool,consumer,1);
  e.setId(Util.generateDbUUID());
  Entitlement e2=new Entitlement(sourcePool2,consumer,1);
  e2.setId(Util.generateDbUUID());
  Entitlement e3=new Entitlement(sourcePool3,consumer,1);
  e3.setId(Util.generateDbUUID());
  entitlementCurator.create(e);
  entitlementCurator.create(e2);
  entitlementCurator.create(e3);
  Pool pool2=TestUtil.createPool(owner,product);
  pool2.setSourceEntitlement(e);
  Pool pool3=TestUtil.createPool(owner,product);
  pool3.setSourceEntitlement(e);
  Pool pool4=TestUtil.createPool(owner,product);
  pool4.setSourceEntitlement(e2);
  Pool pool5=TestUtil.createPool(owner,product);
  pool5.setSourceEntitlement(e3);
  poolCurator.create(pool2);
  poolCurator.create(pool3);
  poolCurator.create(pool4);
  poolCurator.create(pool5);
  List<Pool> pools=poolCurator.listBySourceEntitlements(Arrays.asList(e,e2));
  assertEquals(3,pools.size());
}

Fixed version (ground truth):
@Test public void testListBySourceEntitlements(){
  Pool sourcePool=TestUtil.createPool(owner,product);
  Pool sourcePool2=TestUtil.createPool(owner,product);
  Pool sourcePool3=TestUtil.createPool(owner,product);
  poolCurator.create(sourcePool);
  poolCurator.create(sourcePool2);
  poolCurator.create(sourcePool3);
  Entitlement e=new Entitlement(sourcePool,consumer,1);
  e.setId(Util.generateDbUUID());
  Entitlement e2=new Entitlement(sourcePool2,consumer,1);
  e2.setId(Util.generateDbUUID());
  Entitlement e3=new Entitlement(sourcePool3,consumer,1);
  e3.setId(Util.generateDbUUID());
  entitlementCurator.create(e);
  entitlementCurator.create(e2);
  entitlementCurator.create(e3);
  Pool pool2=TestUtil.createPool(owner,product);
  pool2.setSourceEntitlement(e);
  Pool pool3=TestUtil.createPool(owner,product);
  pool3.setSourceEntitlement(e);
  Pool pool4=TestUtil.createPool(owner,product);
  pool4.setSourceEntitlement(e2);
  Pool pool5=TestUtil.createPool(owner,product);
  pool5.setSourceEntitlement(e3);
  poolCurator.create(pool2);
  poolCurator.create(pool3);
  poolCurator.create(pool4);
  poolCurator.create(pool5);
  Set<Pool> pools=poolCurator.listBySourceEntitlements(Arrays.asList(e,e2));
  assertEquals(3,pools.size());
}
Program: 49215
Project: 49215
Buggy source:
/** 
 * Updates the pools using the information stored in the given pool. Because the input subscription is used to lookup pools, the ID field must be set for this method to operate properly.
 * @param pool The pool to use for updating the associated pools
 */
void updateMasterPool(Pool pool);

Fixed version (ground truth):
/** 
 * Applies changes to the given pool to itself and any of its derived pools. This may result in a deletion of the pool if it has been expired as a result of the changes.
 * @param pool The pool to update
 */
void updateMasterPool(Pool pool);
Program: 49216
Project: 49216
Buggy source:
/** 
 * Create any pools that need to be created for the given pool. In some scenarios, due to attribute changes, pools may need to be created even though pools already exist for the subscription. A list of pre-existing pools for the given sub are provided to help this method determine if something needs to be done or not. For a genuine new pool, the existing pools list will be empty.
 * @param masterPool
 * @param existingPools
 * @return a list of pools created for the given pool
 */
public List<Pool> createAndEnrichPools(Pool masterPool,List<Pool> existingPools){
  List<Pool> pools=new LinkedList<Pool>();
  masterPool.setQuantity(calculateQuantity(masterPool.getQuantity(),masterPool.getProduct(),masterPool.getUpstreamPoolId()));
  String virtOnly=masterPool.getProductAttributeValue(Product.Attributes.VIRT_ONLY);
  if (virtOnly != null && !virtOnly.isEmpty()) {
    masterPool.setAttribute(Pool.Attributes.VIRT_ONLY,virtOnly);
  }
  log.info("String_Node_Str",masterPool);
  if (!hasMasterPool(existingPools)) {
    if (masterPool.getSourceSubscription() != null && masterPool.getSourceSubscription().getSubscriptionSubKey().contentEquals("String_Node_Str")) {
      throw new IllegalStateException("String_Node_Str");
    }
    pools.add(masterPool);
    log.info("String_Node_Str",masterPool);
  }
  Pool bonusPool=createBonusPool(masterPool,existingPools);
  if (bonusPool != null) {
    pools.add(bonusPool);
  }
  return pools;
}

Fixed version (ground truth):
/** 
 * Create any pools that need to be created for the given pool. In some scenarios, due to attribute changes, pools may need to be created even though pools already exist for the subscription. A list of pre-existing pools for the given sub are provided to help this method determine if something needs to be done or not. For a genuine new pool, the existing pools list will be empty.
 * @param masterPool
 * @param existingPools
 * @return a list of pools created for the given pool
 */
public List<Pool> createAndEnrichPools(Pool masterPool,List<Pool> existingPools){
  List<Pool> pools=new LinkedList<Pool>();
  masterPool.setQuantity(calculateQuantity(masterPool.getQuantity(),masterPool.getProduct(),masterPool.getUpstreamPoolId()));
  String virtOnly=masterPool.getProductAttributeValue(Product.Attributes.VIRT_ONLY);
  if (virtOnly != null && !virtOnly.isEmpty()) {
    masterPool.setAttribute(Pool.Attributes.VIRT_ONLY,virtOnly);
  }
 else {
    masterPool.removeAttribute(Pool.Attributes.VIRT_ONLY);
  }
  log.info("String_Node_Str",masterPool);
  if (!hasMasterPool(existingPools)) {
    if (masterPool.getSourceSubscription() != null && masterPool.getSourceSubscription().getSubscriptionSubKey().contentEquals("String_Node_Str")) {
      throw new IllegalStateException("String_Node_Str");
    }
    pools.add(masterPool);
    log.info("String_Node_Str",masterPool);
  }
  Pool bonusPool=createBonusPool(masterPool,existingPools);
  if (bonusPool != null) {
    pools.add(bonusPool);
  }
  return pools;
}
Program: 49218
Project: 49218
Buggy source:
@Transactional public List<Pool> listSharedPoolsOf(Pool pool){
  return listByCriteria(currentSession().createCriteria(Pool.class).createAlias("String_Node_Str","String_Node_Str").createAlias("String_Node_Str","String_Node_Str").add(Restrictions.and(Restrictions.eq("String_Node_Str",Boolean.TRUE))).add(Restrictions.and(Restrictions.eq("String_Node_Str",pool))).addOrder(Order.desc("String_Node_Str")));
}

Fixed version (ground truth):
@Transactional public List<Pool> listSharedPoolsOf(Pool pool){
  return listByCriteria(currentSession().createCriteria(Pool.class).createAlias("String_Node_Str","String_Node_Str").createAlias("String_Node_Str","String_Node_Str").add(Restrictions.eq("String_Node_Str",Boolean.TRUE)).add(Restrictions.eq("String_Node_Str",pool)).addOrder(Order.desc("String_Node_Str")));
}
Program: 49219
Project: 49219
Buggy source:
@Test public void testFetchSharedPoolsOf(){
  consumer=TestUtil.createConsumer(owner);
  ConsumerType share=new ConsumerType("String_Node_Str");
  consumer.setType(share);
  consumerTypeCurator.create(share);
  consumerCurator.create(consumer);
  Pool pool=createPool(owner,product,1L,TestUtil.createDate(2011,3,2),TestUtil.createDate(2055,3,2));
  poolCurator.create(pool);
  Pool pool2=createPool(owner,product,1L,TestUtil.createDate(2011,3,2),TestUtil.createDate(2055,3,2));
  poolCurator.create(pool2);
  Entitlement sourceEnt=new Entitlement(pool,consumer,1);
  sourceEnt.setId(Util.generateDbUUID());
  entitlementCurator.create(sourceEnt);
  pool.getEntitlements().add(sourceEnt);
  poolCurator.merge(pool);
  Pool sharedPool=createPool(owner,product,1L,TestUtil.createDate(2011,3,2),TestUtil.createDate(2055,3,2));
  sharedPool.setAttribute(Pool.Attributes.SHARE,"String_Node_Str");
  sharedPool.setAttribute(Pool.Attributes.DERIVED_POOL,"String_Node_Str");
  sharedPool.setSourceEntitlement(sourceEnt);
  poolCurator.create(sharedPool);
  Pool result=poolCurator.listSharedPoolsOf(pool).get(0);
  assertEquals(sharedPool,result);
}

Fixed version (ground truth):
@Test public void testFetchSharedPoolsOf(){
  consumer=TestUtil.createConsumer(owner);
  ConsumerType share=new ConsumerType("String_Node_Str");
  consumer.setType(share);
  consumerTypeCurator.create(share);
  consumerCurator.create(consumer);
  Pool pool=createPool(owner,product,1L,TestUtil.createDate(2011,3,2),TestUtil.createDate(2055,3,2));
  poolCurator.create(pool);
  Pool pool2=createPool(owner,product,1L,TestUtil.createDate(2011,3,2),TestUtil.createDate(2055,3,2));
  poolCurator.create(pool2);
  Entitlement sourceEnt=new Entitlement(pool,consumer,1);
  sourceEnt.setId(Util.generateDbUUID());
  entitlementCurator.create(sourceEnt);
  Set<Entitlement> entitlements=new HashSet<Entitlement>();
  entitlements.add(sourceEnt);
  pool.setEntitlements(entitlements);
  poolCurator.merge(pool);
  Pool sharedPool=createPool(owner,product,1L,TestUtil.createDate(2011,3,2),TestUtil.createDate(2055,3,2));
  sharedPool.setCreatedByShare(true);
  sharedPool.setAttribute(Pool.Attributes.DERIVED_POOL,"String_Node_Str");
  sharedPool.setSourceEntitlement(sourceEnt);
  poolCurator.create(sharedPool);
  List<Pool> sharedPools=poolCurator.listSharedPoolsOf(pool);
  assertNotNull(sharedPools);
  assertTrue(sharedPools.size() > 0);
  Pool result=sharedPools.get(0);
  assertEquals(sharedPool,result);
}
Program: 49220
Project: 49220
Buggy source:
public long findNumRunningByClassAndTarget(String target,Class<? extends KingpinJob> jobClass){
  return (Long)this.currentSession().createCriteria(JobStatus.class).add(Restrictions.ge("String_Node_Str",getBlockingCutoff())).add(Restrictions.eq("String_Node_Str",JobState.RUNNING)).add(Restrictions.eq("String_Node_Str",target)).add(Restrictions.eq("String_Node_Str",jobClass)).setProjection(Projections.count("String_Node_Str")).uniqueResult();
}

Fixed version (ground truth):
public long findNumRunningByClassAndTarget(String target,Class<? extends KingpinJob> jobClass){
  if (jobClass == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return (Long)this.currentSession().createCriteria(JobStatus.class).add(Restrictions.ge("String_Node_Str",getBlockingCutoff())).add(Restrictions.eq("String_Node_Str",JobState.RUNNING)).add(Restrictions.eq("String_Node_Str",target)).add(Restrictions.eq("String_Node_Str",jobClass.getCanonicalName())).setProjection(Projections.count("String_Node_Str")).uniqueResult();
}
Program: 49221
Project: 49221
Buggy source:
public JobStatus getByClassAndTarget(String target,Class<? extends KingpinJob> jobClass){
  return (JobStatus)this.currentSession().createCriteria(JobStatus.class).addOrder(Order.desc("String_Node_Str")).add(Restrictions.ge("String_Node_Str",getBlockingCutoff())).add(Restrictions.ne("String_Node_Str",JobState.FINISHED)).add(Restrictions.ne("String_Node_Str",JobState.FAILED)).add(Restrictions.ne("String_Node_Str",JobState.CANCELED)).add(Restrictions.eq("String_Node_Str",target)).add(Restrictions.eq("String_Node_Str",jobClass)).setMaxResults(1).uniqueResult();
}

Fixed version (ground truth):
public JobStatus getByClassAndTarget(String target,Class<? extends KingpinJob> jobClass){
  if (jobClass == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return (JobStatus)this.currentSession().createCriteria(JobStatus.class).addOrder(Order.desc("String_Node_Str")).add(Restrictions.ge("String_Node_Str",getBlockingCutoff())).add(Restrictions.ne("String_Node_Str",JobState.FINISHED)).add(Restrictions.ne("String_Node_Str",JobState.FAILED)).add(Restrictions.ne("String_Node_Str",JobState.CANCELED)).add(Restrictions.eq("String_Node_Str",target)).add(Restrictions.eq("String_Node_Str",jobClass.getCanonicalName())).setMaxResults(1).uniqueResult();
}
Program: 49222
Project: 49222
Buggy source:
@XmlTransient public Class<? extends KingpinJob> getJobClass(){
  return jobClass;
}

Fixed version (ground truth):
@XmlTransient public String getJobClass(){
  return jobClass;
}
Program: 49223
Project: 49223
Buggy source:
public String toString(){
  return String.format("String_Node_Str",this.id,this.jobClass != null ? this.jobClass.getSimpleName() : null,this.ownerId,this.targetId,this.targetType,this.state);
}

Fixed version (ground truth):
public String toString(){
  return String.format("String_Node_Str",this.id,this.jobClass != null ? this.jobClass : null,this.ownerId,this.targetId,this.targetType,this.state);
}