nus-yam/ex-repair huggingface dataset:
Program: 37845
Project: 37845
Buggy source:
@Override protected void onHandleIntent(Intent intent){
  String action=intent.getAction();
  Bundle extras=intent.getExtras();
  if (ACTION_CREATE.equals(action)) {
    startForeground();
    String volumePath=extras.getString(EXTRA_VOLUME_PATH);
    int size=extras.getInt(EXTRA_SIZE);
    String pass1=extras.getString(EXTRA_PASS_1);
    String pass2=extras.getString(EXTRA_PASS_2);
    mStorage.create(volumePath,size,pass1,pass2);
  }
 else   if (ACTION_OPEN.equals(action)) {
    startForeground();
    String volumePath=extras.getString(EXTRA_VOLUME_PATH);
    String mountPath=extras.getString(EXTRA_MOUNT_PATH);
    String passwd=extras.getString(EXTRA_PASS_1);
    mStorage.open(volumePath,mountPath,passwd);
    restartTimeout();
  }
 else   if (ACTION_CLOSE.equals(action)) {
    String volumePath=extras.getString(EXTRA_VOLUME_PATH);
    mStorage.close(volumePath);
  }
 else   if (ACTION_DELETE.equals(action)) {
    String volumePath=extras.getString(EXTRA_VOLUME_PATH);
    mStorage.delete(volumePath);
  }
 else   if (ACTION_REBOOTED.equals(action)) {
    mRatchet.increase();
  }
 else   if (ACTION_TIMEOUT.equals(action)) {
    mRatchet.increase();
  }
 else   if (ACTION_PASSWORD_FAIL.equals(action)) {
    mRatchet.increase();
    clearTimeout();
  }
 else   if (ACTION_PASSWORD_SUCCESS.equals(action)) {
    mRatchet.reset();
    restartTimeout();
  }
}

Fixed version (ground truth):
@Override protected void onHandleIntent(Intent intent){
  String action=intent.getAction();
  Bundle extras=intent.getExtras();
  if (ACTION_CREATE.equals(action)) {
    startForeground();
    String volumePath=extras.getString(EXTRA_VOLUME_PATH);
    int size1=extras.getInt(EXTRA_SIZE1);
    int size2=extras.getInt(EXTRA_SIZE2);
    String pass1=extras.getString(EXTRA_PASS_1);
    String pass2=extras.getString(EXTRA_PASS_2);
    mStorage.create(this,volumePath,size1,size2,pass1,pass2);
  }
 else   if (ACTION_OPEN.equals(action)) {
    startForeground();
    String volumePath=extras.getString(EXTRA_VOLUME_PATH);
    String mountPath=extras.getString(EXTRA_MOUNT_PATH);
    String passwd=extras.getString(EXTRA_PASS);
    mStorage.open(this,volumePath,mountPath,passwd);
    restartTimeout();
  }
 else   if (ACTION_CLOSE.equals(action)) {
    String volumePath=extras.getString(EXTRA_VOLUME_PATH);
    mStorage.close(volumePath);
  }
 else   if (ACTION_DELETE.equals(action)) {
    String volumePath=extras.getString(EXTRA_VOLUME_PATH);
    mStorage.delete(this,volumePath);
  }
 else   if (ACTION_REBOOTED.equals(action)) {
    mRatchet.increase();
  }
 else   if (ACTION_TIMEOUT.equals(action)) {
    mRatchet.increase();
  }
 else   if (ACTION_PASSWORD_FAIL.equals(action)) {
    mRatchet.increase();
    clearTimeout();
  }
 else   if (ACTION_PASSWORD_SUCCESS.equals(action)) {
    mRatchet.reset();
    restartTimeout();
  }
}
Program: 37846
Project: 37846
Buggy source:
public void create(String volumePath,int size,String pass1,String pass2){
  proc=runProcess("String_Node_Str",volumePath,mountPath);
  proc.write("String_Node_Str",pass1);
  proc.write("String_Node_Str",pass2);
  if (proc.exit_value() != 0) {
    alert_user("String_Node_Str",volumePath);
  }
  SystemClock.sleep(5000);
  List<String> result=Shell.SH.run("String_Node_Str");
  result=Shell.SU.run("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param context
 * @param volumePath full path from root
 * @param mountPath
 * @param size in megabytes
 * @param pass1
 * @param pass2
 */
public void create(Context context,String volumePath,int size1,int size2,String pass1,String pass2){
  List<String> result=suRun("String_Node_Str",volumePath,size1,size2,pass1,pass2);
  SystemClock.sleep(2000);
  if (result == null) {
    Application.toast(context,String.format("String_Node_Str",volumePath));
  }
}
Program: 37847
Project: 37847
Buggy source:
public void close(String volumePath){
  Shell.SH.run("String_Node_Str",volumePath);
}

Fixed version (ground truth):
public void close(String volumePath){
  List<String> result=suRun("String_Node_Str",volumePath);
}
Program: 37848
Project: 37848
Buggy source:
public void delete(String volumePath){
  Shell.SH.run("String_Node_Str",volumePath);
}

Fixed version (ground truth):
public void delete(Context context,String volumePath){
  List<String> result=suRun("String_Node_Str",volumePath);
  if (result == null) {
    Application.toast(context,String.format("String_Node_Str",volumePath));
  }
}
Program: 37849
Project: 37849
Buggy source:
public void open(String volumePath,String mountPath,string passwd){
  proc=runProcess("String_Node_Str",volumePath,mountPath);
  proc.write("String_Node_Str",string);
  if (proc.exit_value() != 0) {
    alert_user("String_Node_Str",volumePath);
  }
  SystemClock.sleep(5000);
}

Fixed version (ground truth):
public void open(Context context,String volumePath,String mountPath,String passwd){
  List<String> result=suRun("String_Node_Str",volumePath,mountPath,passwd);
  SystemClock.sleep(2000);
  if (result == null) {
    Application.toast(context,String.format("String_Node_Str",volumePath));
  }
}
Program: 37850
Project: 37850
Buggy source:
@Cacheable @CacheInvalidate({"String_Node_Str","String_Node_Str","String_Node_Str"}) @SQLSetter(table=Cluster.class,name="String_Node_Str",since=@SQLVersion({1,0,0})) public abstract void setCluster(Cluster cluster);

Fixed version (ground truth):
@Cacheable @CacheInvalidate({"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}) @SQLSetter(table=Cluster.class,name="String_Node_Str",since=@SQLVersion({1,0,0})) public abstract void setCluster(Cluster cluster);
Program: 37851
Project: 37851
Buggy source:
@Title("String_Node_Str") @Desc({"String_Node_Str"}) @Any("String_Node_Str") @JSON(notFoundIfNull=true) @WithDataAdapter(BergamotDB.class) public AlertMO falsePositiveAlert(BergamotDB db,@IsaObjectId() UUID id,@Param("String_Node_Str") @CheckStringLength(min=1,max=80,mandatory=true) String summary,@Param("String_Node_Str") @CheckStringLength(min=0,max=4096,mandatory=false) String comment){
  Alert alert=notNull(db.getAlert(id));
  require(permission("String_Node_Str",alert.getCheckId()));
  if ((!alert.isFalsePositive()) && alert.isAcknowledged()) {
    Contact contact=currentPrincipal();
    Comment ackCom=new Comment().author(contact).falsePositive(alert).summary(summary).message(comment);
    db.execute(() -> {
      db.setComment(ackCom);
      alert.setFalsePositive(true);
      alert.setFalsePositiveAt(new Timestamp(System.currentTimeMillis()));
      alert.setFalsePositiveById(contact.getId());
      alert.setFalsePositiveReasonId(ackCom.getId());
      db.setAlert(alert);
    }
);
    this.updateProducer.publish(new UpdateKey(UpdateType.ALERT,alert.getSiteId(),alert.getId()),new AlertUpdate(alert.toMO(currentPrincipal())));
  }
  return alert.toMO(currentPrincipal());
}

Fixed version (ground truth):
@Title("String_Node_Str") @Desc({"String_Node_Str"}) @Any("String_Node_Str") @JSON(notFoundIfNull=true) @WithDataAdapter(BergamotDB.class) public AlertMO falsePositiveAlert(BergamotDB db,@IsaObjectId() UUID id,@Param("String_Node_Str") @CheckStringLength(min=1,max=80,mandatory=true) String summary,@Param("String_Node_Str") @CheckStringLength(min=0,max=4096,mandatory=false) String comment){
  Alert alert=notNull(db.getAlert(id));
  require(permission("String_Node_Str",alert.getCheckId()));
  if ((!alert.isFalsePositive()) && (alert.isAcknowledged() || alert.isRecovered())) {
    Contact contact=currentPrincipal();
    Comment ackCom=new Comment().author(contact).falsePositive(alert).summary(summary).message(comment);
    db.execute(() -> {
      db.setComment(ackCom);
      alert.setFalsePositive(true);
      alert.setFalsePositiveAt(new Timestamp(System.currentTimeMillis()));
      alert.setFalsePositiveById(contact.getId());
      alert.setFalsePositiveReasonId(ackCom.getId());
      db.setAlert(alert);
    }
);
    this.updateProducer.publish(new UpdateKey(UpdateType.ALERT,alert.getSiteId(),alert.getId()),new AlertUpdate(alert.toMO(currentPrincipal())));
  }
  return alert.toMO(currentPrincipal());
}
Program: 37852
Project: 37852
Buggy source:
/** 
 * Construct a generic notification based of this alert. TODO: rebase the notification messages on this alert object
 * @param now when the alert is raise (ie: now)
 * @param type the notification type: alert, recovery, acknowledge
 * @param ctor the constructor for the notification type
 * @return the notification
 */
public <T extends CheckNotification>T createNotification(Calendar now,NotificationType type,Supplier<T> ctor,List<ContactMO> to){
  Check<?,?> check=this.getCheck();
  CheckState state=check.getState();
  if (!check.getNotifications().isEnabledAt(type,state.getStatus(),now))   return null;
  T notification=ctor.get();
  notification.setSite(check.getSite().toMOUnsafe());
  notification.setRaised(now.getTimeInMillis());
  notification.setAlertId(this.getId());
  notification.setCheck(check.toMOUnsafe());
  notification.setTo(to);
  return notification;
}

Fixed version (ground truth):
/** 
 * Construct a generic notification based of this alert. TODO: rebase the notification messages on this alert object
 * @param now when the alert is raise (ie: now)
 * @param type the notification type: alert, recovery, acknowledge
 * @param ctor the constructor for the notification type
 * @return the notification
 */
public <T extends AlertNotification>T createNotification(Calendar now,NotificationType type,Supplier<T> ctor,List<ContactMO> to){
  Check<?,?> check=this.getCheck();
  CheckState state=check.getState();
  if (!check.getNotifications().isEnabledAt(type,state.getStatus(),now))   return null;
  T notification=ctor.get();
  notification.setSite(check.getSite().toMOUnsafe());
  notification.setRaised(now.getTimeInMillis());
  notification.setAlertId(this.getId());
  notification.setCheck(check.toMOUnsafe());
  notification.setTo(to);
  return notification;
}
Program: 37854
Project: 37854
Buggy source:
protected Message buildGenericMessage(GenericNotification notification) throws Exception {
  Message message=new MimeMessage(this.session);
  message.setFrom(new InternetAddress(this.fromAddress));
  for (  ContactMO contact : notification.getTo()) {
    if ((!Util.isEmpty(contact.getEmail())) && contact.hasEngine(this.getName())) {
      message.addRecipient(RecipientType.TO,new InternetAddress(contact.getEmail()));
    }
  }
  message.setHeader("String_Node_Str",notification.getId().toString());
  message.setSentDate(new Date(notification.getRaised()));
  this.buildGenericMessageContent(message,notification);
  return message;
}

Fixed version (ground truth):
protected Message buildGenericMessage(GenericNotification notification) throws Exception {
  Message message=new MimeMessage(this.session);
  message.setFrom(new InternetAddress(this.fromAddress));
  for (  ContactMO contact : notification.getTo()) {
    if ((!Util.isEmpty(contact.getEmail())) && contact.hasEngine(this.getName())) {
      message.addRecipient(RecipientType.TO,new InternetAddress(contact.getEmail()));
    }
  }
  message.setHeader("String_Node_Str",this.messageId(notification.getId(),notification.getNotificationType()));
  message.setHeader("String_Node_Str",notification.getId().toString());
  message.setSentDate(new Date(notification.getRaised()));
  this.buildGenericMessageContent(message,notification);
  return message;
}
Program: 37856
Project: 37856
Buggy source:
public void run(){
  try {
    AgentMessage response=processAgentMessage(ctx,request);
    if (response != null) {
      ctx.channel().writeAndFlush(new TextWebSocketFrame(transcoder.encodeAsString(response)));
    }
  }
 catch (  Exception e) {
    ctx.channel().writeAndFlush(new TextWebSocketFrame(transcoder.encodeAsString(new GeneralError("String_Node_Str"))));
  }
}

Fixed version (ground truth):
public void run(){
  try {
    AgentMessage response=processAgentMessage(ctx,request);
    if (response != null) {
      ctx.channel().writeAndFlush(new TextWebSocketFrame(transcoder.encodeAsString(response)));
    }
  }
 catch (  Exception e) {
    ctx.channel().writeAndFlush(new TextWebSocketFrame(transcoder.encodeAsString(new GeneralError("String_Node_Str" + e.getMessage()))));
  }
}
Program: 37858
Project: 37858
Buggy source:
@Override public AgentMessage handle(AgentMessage request){
  CheckMetrics metrics=(CheckMetrics)request;
  MetricsStat stat=new MetricsStat(request);
  Parcel readings=new Parcel();
  StatsDProcessor processor=this.getAgent().getStatsDProcessor();
  if (processor != null) {
    Pattern filter=Pattern.compile(metrics.getMetricsNameFilter().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str"));
    for (    Entry<String,Metric> metric : processor.getMetrics().getMetrics().entrySet()) {
      String key=metric.getKey();
      key=metrics.isStripSourceFromMetricName() ? key.substring(key.indexOf("String_Node_Str") + 1) : key;
      if (filter.matcher(key).matches()) {
        readings.addMetric(key,metric.getValue());
      }
    }
  }
  stat.setReadings(readings.getReadings());
  return stat;
}

Fixed version (ground truth):
@Override public AgentMessage handle(AgentMessage request){
  CheckMetrics metrics=(CheckMetrics)request;
  MetricsStat stat=new MetricsStat(request);
  Parcel readings=new Parcel();
  StatsDProcessor processor=this.getAgent().getStatsDProcessor();
  if (processor != null) {
    Pattern filter=Pattern.compile(metrics.getMetricsNameFilter());
    for (    Entry<String,Metric> metric : processor.getMetrics().getMetrics().entrySet()) {
      String key=metric.getKey();
      key=metrics.isStripSourceFromMetricName() ? key.substring(key.indexOf("String_Node_Str") + 1) : key;
      if (filter.matcher(key).matches()) {
        readings.addMetric(key,metric.getValue());
      }
    }
  }
  stat.setReadings(readings.getReadings());
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str" + stat.getReadings().size() + "String_Node_Str");
  return stat;
}
Program: 37859
Project: 37859
Buggy source:
/** 
 * Decode a StatsD message pull out all the metrics
 */
protected void decodeMetrics(SocketAddress from,ByteBuffer buffer){
  try {
    byte[] array=buffer.array();
    int startOfLine=buffer.arrayOffset();
    int endOfMetricName=0;
    int endOfValue=0;
    int startOfSample=0;
    int limit=startOfLine + buffer.limit();
    for (int i=startOfLine; i < limit; i++) {
switch (array[i]) {
case 0x3A:
        endOfMetricName=i;
      break;
case 0x7C:
    if (endOfValue == 0)     endOfValue=i;
  break;
case 0x40:
startOfSample=i;
break;
case 0xD:
break;
case 0xA:
this.parseMetric(from,array,startOfLine,endOfMetricName,endOfValue,startOfSample,i);
startOfLine=i + 1;
endOfMetricName=0;
endOfValue=0;
startOfSample=0;
}
}
if (startOfLine < limit) this.parseMetric(from,array,startOfLine,endOfMetricName,endOfValue,startOfSample,limit);
}
 catch (Exception e) {
logger.warn("String_Node_Str",e);
}
}

Fixed version (ground truth):
/** 
 * Decode a StatsD message pull out all the metrics
 */
protected void decodeMetrics(SocketAddress from,ByteBuffer buffer){
  if (logger.isTraceEnabled())   logger.trace(new String(buffer.array(),buffer.arrayOffset(),buffer.remaining()));
  try {
    byte[] array=buffer.array();
    int startOfLine=buffer.arrayOffset();
    int endOfMetricName=0;
    int endOfValue=0;
    int startOfSample=0;
    int limit=startOfLine + buffer.limit();
    for (int i=startOfLine; i < limit; i++) {
switch (array[i]) {
case 0x3A:
        endOfMetricName=i;
      break;
case 0x7C:
    if (endOfValue == 0)     endOfValue=i;
  break;
case 0x40:
startOfSample=i;
break;
case 0xD:
break;
case 0xA:
this.parseMetric(from,array,startOfLine,endOfMetricName,endOfValue,startOfSample,i);
startOfLine=i + 1;
endOfMetricName=0;
endOfValue=0;
startOfSample=0;
}
}
if (startOfLine < limit) this.parseMetric(from,array,startOfLine,endOfMetricName,endOfValue,startOfSample,limit);
}
 catch (Exception e) {
logger.warn("String_Node_Str",e);
}
}
Program: 37860
Project: 37860
Buggy source:
public void run(){
  try {
    this.channel.socket().bind(new InetSocketAddress(this.port));
    logger.info("String_Node_Str" + this.port);
    ByteBuffer buffer=ByteBuffer.allocate(8192);
    while (this.run) {
      try {
        buffer.rewind();
        SocketAddress from=this.channel.receive(buffer);
        buffer.flip();
        this.decodeMetrics(from,buffer);
      }
 catch (      Exception e) {
        if (this.run)         logger.warn("String_Node_Str",e);
      }
    }
    this.channel.close();
  }
 catch (  Exception e) {
    if (this.run)     logger.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void run(){
  try {
    this.channel.socket().bind(new InetSocketAddress(this.port));
    logger.info("String_Node_Str" + this.port);
    ByteBuffer buffer=ByteBuffer.allocate(8192);
    while (this.run) {
      try {
        buffer.clear();
        SocketAddress from=this.channel.receive(buffer);
        buffer.flip();
        this.decodeMetrics(from,buffer);
      }
 catch (      Exception e) {
        if (this.run)         logger.warn("String_Node_Str",e);
      }
    }
    this.channel.close();
  }
 catch (  Exception e) {
    if (this.run)     logger.error("String_Node_Str",e);
  }
}
Program: 37861
Project: 37861
Buggy source:
/** 
 * Find the resolved value of a check parameter
 * @return the check parameter
 */
public String resolveCheckParameter(String name){
  String value=this.getParameter(name);
  if (value == null) {
    Command command=this.getCommand();
    if (command != null) {
      value=command.getParameter(name);
    }
  }
  return value;
}

Fixed version (ground truth):
public String resolveCheckParameter(Command command,String name){
  String value=this.getParameter(name);
  if (value == null) {
    if (command != null) {
      value=command.getParameter(name);
    }
  }
  return value;
}
Program: 37862
Project: 37862
Buggy source:
/** 
 * Resolve the parameters between the command and this check definition
 * @return the check parameters
 */
public LinkedHashMap<String,Parameter> resolveCheckParameters(){
  LinkedHashMap<String,Parameter> r=new LinkedHashMap<String,Parameter>();
  Command command=this.getCommand();
  if (this.getParameters() != null) {
    r.putAll(this.getParameters());
  }
  if (command != null && command.getParameters() != null) {
    r.putAll(this.getParameters());
  }
  return r;
}

Fixed version (ground truth):
public LinkedHashMap<String,Parameter> resolveCheckParameters(Command command){
  LinkedHashMap<String,Parameter> r=new LinkedHashMap<String,Parameter>();
  if (command != null && command.getParameters() != null) {
    r.putAll(command.getParameters());
  }
  if (this.getParameters() != null) {
    r.putAll(this.getParameters());
  }
  return r;
}
Program: 37863
Project: 37863
Buggy source:
public <T extends TemplatedObjectCfg<T>>T lookup(Class<T> type,String name){
  try (Timer.Context tctx=lookupTimer.time()){
    T inherited=this.locator.lookup(type,name);
    logger.debug("String_Node_Str" + type.getSimpleName() + "String_Node_Str"+ name+ "String_Node_Str"+ inherited);
    return inherited;
  }
 }

Fixed version (ground truth):
public <T extends TemplatedObjectCfg<T>>T lookup(Class<T> type,String name){
  try (Timer.Context tctx=lookupTimer.time()){
    name=this.stipSmartMergePrefix(name);
    T inherited=this.locator.lookup(type,name);
    logger.debug("String_Node_Str" + type.getSimpleName() + "String_Node_Str"+ name+ "String_Node_Str"+ inherited);
    return inherited;
  }
 }
Program: 37864
Project: 37864
Buggy source:
private void checkGroupExists(String name,NamedObjectCfg<?> user,BergamotValidationReport report){
  if (name != null && name.length() > 0) {
    if (name.startsWith("String_Node_Str") || name.startsWith("String_Node_Str")) {
      name=name.substring(1);
    }
  }
  GroupCfg group=this.lookup(GroupCfg.class,name);
  if (group == null) {
    report.logError("String_Node_Str" + name + "String_Node_Str"+ user);
  }
}

Fixed version (ground truth):
private void checkGroupExists(String name,NamedObjectCfg<?> user,BergamotValidationReport report){
  GroupCfg group=this.lookup(GroupCfg.class,name);
  if (group == null) {
    report.logError("String_Node_Str" + name + "String_Node_Str"+ user);
  }
}
Program: 37866
Project: 37866
Buggy source:
public static void main(String[] args) throws Exception {
  JMXChecker checker=new JMXChecker();
  ScriptEngineManager factory=new RestrictedScriptEngineManager();
  ScriptEngine script=factory.getEngineByName("String_Node_Str");
  SimpleBindings bindings=new SimpleBindings();
  bindings.put("String_Node_Str",checker.createContext((t) -> {
    t.printStackTrace();
  }
));
  script.setBindings(bindings,ScriptContext.ENGINE_SCOPE);
  script.eval("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  JMXChecker checker=new JMXChecker();
  ScriptEngineManager factory=new RestrictedScriptEngineManager();
  ScriptEngine script=factory.getEngineByName("String_Node_Str");
  SimpleBindings bindings=new SimpleBindings();
  bindings.put("String_Node_Str",checker.createContext((t) -> {
    t.printStackTrace();
  }
));
  script.setBindings(bindings,ScriptContext.ENGINE_SCOPE);
  script.eval("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 37867
Project: 37867
Buggy source:
public Certificate signServer(String commonName,PublicKey key){
  if (this.keyStore.hasServer(commonName)) {
    CertificatePair current=this.keyStore.loadServer(commonName);
    SerialNum currentSerial=SerialNum.fromBigInt(current.getCertificate().getSerialNumber());
    CertificatePair root=this.keyStore.loadRootCA();
    try {
      logger.info("String_Node_Str" + commonName + "String_Node_Str"+ this.buildDN(commonName));
      CertificatePair server=RSAUtil.generateCertificate(this.buildDN(commonName),currentSerial.revision(),365 * 5,2048,KeyType.SERVER,key,root);
      this.keyStore.storeServer(commonName,server);
      return server.getCertificate();
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str",e);
    }
  }
 else {
    CertificatePair root=this.keyStore.loadRootCA();
    try {
      logger.info("String_Node_Str" + commonName + "String_Node_Str"+ this.buildDN(commonName));
      CertificatePair server=RSAUtil.generateCertificate(this.buildDN(commonName),SerialNum.randomSerialNum(),365 * 5,2048,KeyType.SERVER,key,root);
      this.keyStore.storeServer(commonName,server);
      return server.getCertificate();
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
public Certificate signServer(String commonName,PublicKey key){
  if (this.keyStore.hasServer(commonName)) {
    CertificatePair current=this.keyStore.loadServer(commonName);
    SerialNum currentSerial=SerialNum.fromBigInt(current.getCertificate().getSerialNumber());
    CertificatePair root=this.keyStore.loadRootCA();
    try {
      logger.info("String_Node_Str" + commonName + "String_Node_Str"+ this.buildDN(commonName));
      CertificatePair server=RSAUtil.generateCertificate(this.buildDN(commonName),currentSerial.revision(),365 * 5,2048,KeyType.SERVER,key,root);
      this.keyStore.storeServer(commonName,server);
      return server.getCertificate();
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str",e);
    }
  }
 else {
    CertificatePair root=this.keyStore.loadRootCA();
    try {
      logger.info("String_Node_Str" + commonName + "String_Node_Str"+ this.buildDN(commonName));
      CertificatePair server=RSAUtil.generateCertificate(this.buildDN(commonName),SerialNum.fromName(commonName),365 * 5,2048,KeyType.SERVER,key,root);
      this.keyStore.storeServer(commonName,server);
      return server.getCertificate();
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str",e);
    }
  }
}
Program: 37868
Project: 37868
Buggy source:
@Override public void storeAgent(UUID siteId,UUID agentId,CertificatePair pair){
synchronized (this) {
    try {
      SerialNum serial=SerialNum.fromBigInt(pair.getCertificate().getSerialNumber());
      File crtFile=this.agentCrtFile(siteId,serial);
      crtFile.getParentFile().mkdirs();
      pair.saveCertificate(crtFile);
      Path crtLink=this.agentCrtFile(siteId,agentId).toPath();
      Files.delete(crtLink);
      Files.createSymbolicLink(crtLink,crtFile.toPath());
      if (pair.getKey() != null) {
        File keyFile=this.agentKeyFile(siteId,serial);
        keyFile.getParentFile().mkdirs();
        pair.saveKey(keyFile);
        Path keyLink=this.agentKeyFile(siteId,agentId).toPath();
        Files.delete(keyLink);
        Files.createSymbolicLink(keyLink,keyFile.toPath());
      }
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str" + siteId + "String_Node_Str"+ agentId,e);
    }
  }
}

Fixed version (ground truth):
@Override public void storeAgent(UUID siteId,UUID agentId,CertificatePair pair){
synchronized (this) {
    try {
      SerialNum serial=SerialNum.fromBigInt(pair.getCertificate().getSerialNumber());
      File crtFile=this.agentCrtFile(siteId,serial);
      crtFile.getParentFile().mkdirs();
      pair.saveCertificate(crtFile);
      Path crtLink=this.agentCrtFile(siteId,agentId).toPath();
      try {
        Files.delete(crtLink);
      }
 catch (      NoSuchFileException e) {
      }
      Files.createSymbolicLink(crtLink,crtFile.toPath());
      if (pair.getKey() != null) {
        File keyFile=this.agentKeyFile(siteId,serial);
        keyFile.getParentFile().mkdirs();
        pair.saveKey(keyFile);
        Path keyLink=this.agentKeyFile(siteId,agentId).toPath();
        try {
          Files.delete(keyLink);
        }
 catch (        NoSuchFileException e) {
        }
        Files.createSymbolicLink(keyLink,keyFile.toPath());
      }
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str" + siteId + "String_Node_Str"+ agentId,e);
    }
  }
}
Program: 37869
Project: 37869
Buggy source:
@Override public void storeServer(String commonName,CertificatePair pair){
synchronized (this) {
    try {
      SerialNum serial=SerialNum.fromBigInt(pair.getCertificate().getSerialNumber());
      File crtFile=this.serverCrtFile(serial);
      crtFile.getParentFile().mkdirs();
      pair.saveCertificate(crtFile);
      Path crtLink=this.serverCrtFile(commonName).toPath();
      Files.delete(crtLink);
      Files.createSymbolicLink(crtLink,crtFile.toPath());
      if (pair.getKey() != null) {
        File keyFile=this.serverKeyFile(serial);
        keyFile.getParentFile().mkdirs();
        pair.saveKey(keyFile);
        Path keyLink=this.serverKeyFile(commonName).toPath();
        Files.delete(keyLink);
        Files.createSymbolicLink(keyLink,keyFile.toPath());
      }
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str" + commonName,e);
    }
  }
}

Fixed version (ground truth):
@Override public void storeServer(String commonName,CertificatePair pair){
synchronized (this) {
    try {
      SerialNum serial=SerialNum.fromBigInt(pair.getCertificate().getSerialNumber());
      File crtFile=this.serverCrtFile(serial);
      crtFile.getParentFile().mkdirs();
      pair.saveCertificate(crtFile);
      Path crtLink=this.serverCrtFile(commonName).toPath();
      try {
        Files.delete(crtLink);
      }
 catch (      NoSuchFileException e) {
      }
      Files.createSymbolicLink(crtLink,crtFile.toPath());
      if (pair.getKey() != null) {
        File keyFile=this.serverKeyFile(serial);
        keyFile.getParentFile().mkdirs();
        pair.saveKey(keyFile);
        Path keyLink=this.serverKeyFile(commonName).toPath();
        try {
          Files.delete(keyLink);
        }
 catch (        NoSuchFileException e) {
        }
        Files.createSymbolicLink(keyLink,keyFile.toPath());
      }
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str" + commonName,e);
    }
  }
}
Program: 37870
Project: 37870
Buggy source:
@Override public CertificatePair loadAgent(UUID siteId,UUID agentId){
  try {
    if (this.agentKeyFile(siteId,agentId).exists()) {
      return new CertificatePair(this.agentCrtFile(siteId,agentId),this.agentKeyFile(siteId,agentId));
    }
 else {
      return new CertificatePair(this.agentCrtFile(siteId,agentId),null);
    }
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str" + siteId + "String_Node_Str"+ agentId,e);
  }
}

Fixed version (ground truth):
@Override public CertificatePair loadAgent(UUID siteId,UUID agentId){
  try {
    if (this.agentKeyFile(siteId,agentId).exists()) {
      return new CertificatePair(this.agentCrtFile(siteId,agentId),this.agentKeyFile(siteId,agentId));
    }
 else {
      return new CertificatePair(this.agentCrtFile(siteId,agentId));
    }
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str" + siteId + "String_Node_Str"+ agentId,e);
  }
}
Program: 37871
Project: 37871
Buggy source:
@Override public CertificatePair loadServer(String commonName){
  try {
    if (this.serverKeyFile(commonName).exists()) {
      return new CertificatePair(this.serverCrtFile(commonName),this.serverKeyFile(commonName));
    }
 else {
      return new CertificatePair(this.serverCrtFile(commonName),null);
    }
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str" + commonName,e);
  }
}

Fixed version (ground truth):
@Override public CertificatePair loadServer(String commonName){
  try {
    if (this.serverKeyFile(commonName).exists()) {
      return new CertificatePair(this.serverCrtFile(commonName),this.serverKeyFile(commonName));
    }
 else {
      return new CertificatePair(this.serverCrtFile(commonName));
    }
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str" + commonName,e);
  }
}
Program: 37875
Project: 37875
Buggy source:
@SQLPatch(name="String_Node_Str",index=1,type=ScriptType.BOTH,version=@SQLVersion({1,5,0})) protected static SQLScript createHelperFunctions(){
  return new SQLScript("String_Node_Str","String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@SQLPatch(name="String_Node_Str",index=1,type=ScriptType.BOTH,version=@SQLVersion({1,0,0})) protected static SQLScript createHelperFunctions(){
  return new SQLScript("String_Node_Str","String_Node_Str","String_Node_Str");
}
Program: 37876
Project: 37876
Buggy source:
@SQLPatch(name="String_Node_Str",index=1000,type=ScriptType.BOTH,version=@SQLVersion({1,5,0})) protected static SQLScript setFunctionOWner(){
  return new SQLScript("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@SQLPatch(name="String_Node_Str",index=1000,type=ScriptType.BOTH,version=@SQLVersion({1,0,0})) protected static SQLScript setFunctionOWner(){
  return new SQLScript("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
}
Program: 37877
Project: 37877
Buggy source:
/** 
 * Compute the permissions model for the given site
 * @param siteId
 * @return the number of permissions computed
 */
public int buildPermissions(UUID siteId){
  int changed=this.useTimed(build_permissions,(with) -> {
    try (PreparedStatement stmt=with.prepareStatement("String_Node_Str")){
      stmt.setObject(1,siteId);
      try (ResultSet rs=stmt.executeQuery()){
        if (rs.next())         return rs.getInt(1);
      }
     }
     return null;
  }
);
  this.getAdapterCache().removePrefix("String_Node_Str" + siteId);
  this.getAdapterCache().removePrefix("String_Node_Str" + siteId);
  this.getAdapterCache().removePrefix("String_Node_Str" + siteId);
  return changed;
}

Fixed version (ground truth):
/** 
 * Compute the permissions model for the given site
 * @param siteId
 * @return the number of permissions computed
 */
public int buildPermissions(UUID siteId){
  int changed=this.useTimed(build_permissions,(with) -> {
    try (PreparedStatement stmt=with.prepareStatement("String_Node_Str")){
      stmt.setObject(1,siteId);
      try (ResultSet rs=stmt.executeQuery()){
        if (rs.next())         return rs.getInt(1);
      }
     }
     return null;
  }
);
  this.invalidatePermissionsCache(siteId);
  return changed;
}
Program: 37878
Project: 37878
Buggy source:
protected void linkSecurityDomains(SecuredObjectCfg<?> resolvedConfiguration,SecuredObject<?,?> object,BergamotDB db){
  db.removeSecurityDomainMembershipForCheck(object.getId());
  for (  String securityDomainName : resolvedConfiguration.getSecurityDomains()) {
    SecurityDomain domain=db.getSecurityDomainByName(this.site.getId(),securityDomainName);
    if (domain != null)     db.addCheckToSecurityDomain(domain.getId(),object.getId());
  }
}

Fixed version (ground truth):
protected void linkSecurityDomains(SecuredObjectCfg<?> resolvedConfiguration,SecuredObject<?,?> object,BergamotDB db){
  db.removeSecurityDomainMembershipForCheck(object.getId());
  for (  String securityDomainName : resolvedConfiguration.getSecurityDomains()) {
    SecurityDomain domain=db.getSecurityDomainByName(this.site.getId(),securityDomainName);
    if (domain != null)     db.addCheckToSecurityDomain(domain.getId(),object.getId());
  }
  this.clearPermissionsCache=true;
}
Program: 37880
Project: 37880
Buggy source:
/** 
 * Does the given contact have the given permission for the given security domain
 * @param contactId the contact
 * @param securityDomainId the security domain
 * @param permission the permission
 * @return true if the contact has permission
 */
public boolean hasPermissionForSecurityDomain(UUID contactId,UUID securityDomainId,String permission){
  return this.useTimedCached(has_permission_for_domain,cache_miss_has_permission_for_domain,"String_Node_Str" + this.getSiteId(contactId) + "String_Node_Str"+ contactId+ "String_Node_Str"+ permission,null,(with) -> {
    try (PreparedStatement stmt=with.prepareStatement("String_Node_Str")){
      stmt.setObject(1,contactId);
      stmt.setObject(2,securityDomainId);
      stmt.setString(3,permission);
      try (ResultSet rs=stmt.executeQuery()){
        if (rs.next())         return rs.getBoolean(1);
      }
     }
     return false;
  }
);
}

Fixed version (ground truth):
/** 
 * Does the given contact have the given permission for the given security domain
 * @param contactId the contact
 * @param securityDomainId the security domain
 * @param permission the permission
 * @return true if the contact has permission
 */
public boolean hasPermissionForSecurityDomain(UUID contactId,UUID securityDomainId,String permission){
  return this.useTimedCached(has_permission_for_domain,cache_miss_has_permission_for_domain,"String_Node_Str" + this.getSiteId(contactId) + "String_Node_Str"+ contactId+ "String_Node_Str"+ securityDomainId+ "String_Node_Str"+ permission,null,(with) -> {
    try (PreparedStatement stmt=with.prepareStatement("String_Node_Str")){
      stmt.setObject(1,contactId);
      stmt.setObject(2,securityDomainId);
      stmt.setString(3,permission);
      try (ResultSet rs=stmt.executeQuery()){
        if (rs.next())         return rs.getBoolean(1);
      }
     }
     return false;
  }
);
}
Program: 37881
Project: 37881
Buggy source:
/** 
 * Does the given contact have the given permission for the given object
 * @param contactId the contact
 * @param objectId the object
 * @param permission the permission
 * @return true if the contact has permission
 */
public boolean hasPermissionForObject(UUID contactId,UUID objectId,String permission){
  return this.useTimedCached(has_permission_for_object,cache_miss_has_permission_for_object,"String_Node_Str" + this.getSiteId(contactId) + "String_Node_Str"+ contactId+ "String_Node_Str"+ permission,null,(with) -> {
    try (PreparedStatement stmt=with.prepareStatement("String_Node_Str")){
      stmt.setObject(1,contactId);
      stmt.setObject(2,objectId);
      stmt.setString(3,permission);
      try (ResultSet rs=stmt.executeQuery()){
        if (rs.next())         return rs.getBoolean(1);
      }
     }
     return false;
  }
);
}

Fixed version (ground truth):
/** 
 * Does the given contact have the given permission for the given object
 * @param contactId the contact
 * @param objectId the object
 * @param permission the permission
 * @return true if the contact has permission
 */
public boolean hasPermissionForObject(UUID contactId,UUID objectId,String permission){
  return this.useTimedCached(has_permission_for_object,cache_miss_has_permission_for_object,"String_Node_Str" + this.getSiteId(contactId) + "String_Node_Str"+ contactId+ "String_Node_Str"+ objectId+ "String_Node_Str"+ permission,null,(with) -> {
    try (PreparedStatement stmt=with.prepareStatement("String_Node_Str")){
      stmt.setObject(1,contactId);
      stmt.setObject(2,objectId);
      stmt.setString(3,permission);
      try (ResultSet rs=stmt.executeQuery()){
        if (rs.next())         return rs.getBoolean(1);
      }
     }
     return false;
  }
);
}
Program: 37882
Project: 37882
Buggy source:
@Override public int execute(BergamotCLI cli,List<String> args) throws Exception {
  if (args.size() != 1)   throw new BergamotCLIException("String_Node_Str");
  File confDir=new File(args.get(0));
  if (!confDir.isDirectory())   throw new BergamotCLIException("String_Node_Str" + confDir.getAbsolutePath() + "String_Node_Str");
  Collection<ValidatedBergamotConfiguration> bcfgs=new BergamotConfigReader().includeDir(new File("String_Node_Str")).build();
  for (  ValidatedBergamotConfiguration vbcfg : bcfgs) {
    System.out.println(vbcfg.getReport().toString());
  }
  return 0;
}

Fixed version (ground truth):
@Override public int execute(BergamotCLI cli,List<String> args) throws Exception {
  if (args.size() != 1)   throw new BergamotCLIException("String_Node_Str");
  File confDir=new File(args.get(0));
  if (!confDir.isDirectory())   throw new BergamotCLIException("String_Node_Str" + confDir.getAbsolutePath() + "String_Node_Str");
  Collection<ValidatedBergamotConfiguration> bcfgs=new BergamotConfigReader().includeDir(confDir).build();
  for (  ValidatedBergamotConfiguration vbcfg : bcfgs) {
    System.out.println(vbcfg.getReport().toString());
  }
  return 0;
}
Program: 37883
Project: 37883
Buggy source:
@Cacheable @CacheInvalidate({"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}) @SQLSetter(table=Alert.class,name="String_Node_Str",since=@SQLVersion({1,0,0})) public abstract void setAlert(Alert alert);

Fixed version (ground truth):
@Cacheable @CacheInvalidate({"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}) @SQLSetter(table=Alert.class,name="String_Node_Str",since=@SQLVersion({1,0,0})) public abstract void setAlert(Alert alert);
Program: 37884
Project: 37884
Buggy source:
public StoredDoubleGaugeReading(){
  super();
}

Fixed version (ground truth):
public StoredDoubleGaugeReading(UUID siteId,UUID readingId,Timestamp collectedAt,double value,double warning,double critical,double min,double max){
  super();
  this.siteId=siteId;
  this.readingId=readingId;
  this.collectedAt=collectedAt;
  this.value=value;
  this.warning=warning;
  this.critical=critical;
  this.min=min;
  this.max=max;
}
Program: 37885
Project: 37885
Buggy source:
public static String readValue(CharBuffer buffer) throws IOException {
  StringBuilder value=new StringBuilder();
  char c;
  while ((!Character.isWhitespace((c=buffer.get()))) && buffer.hasRemaining()) {
    value.append(c);
  }
  return value.toString();
}

Fixed version (ground truth):
public static String readValue(CharBuffer buffer) throws IOException {
  StringBuilder value=new StringBuilder();
  char c;
  while (buffer.hasRemaining()) {
    c=buffer.get();
    if (Character.isWhitespace(c))     break;
    value.append(c);
  }
  return value.toString();
}
Program: 37886
Project: 37886
Buggy source:
public static List<NagiosPerfData> parsePerfData(String perfData) throws IOException {
  List<NagiosPerfData> perfs=new LinkedList<NagiosPerfData>();
  CharBuffer buffer=CharBuffer.wrap(perfData.toCharArray());
  while (buffer.hasRemaining()) {
    skipWhitespace(buffer);
    String label=readLabel(buffer);
    String valueString=readValue(buffer);
    String[] values=valueString.split("String_Node_Str");
    String valueUOM=values.length > 1 ? values[0] : null;
    String warn=values.length > 2 ? values[1] : null;
    String crit=values.length > 3 ? values[2] : null;
    String min=values.length > 4 ? values[3] : null;
    String max=values.length > 5 ? values[4] : null;
    Matcher matcher=VALUE_UOM_PATTERN.matcher(valueUOM);
    if (matcher.matches()) {
      String value=matcher.group(1);
      String unit=matcher.group(2);
      perfs.add(new NagiosPerfData(label,value,unit,warn,crit,min,max));
    }
 else {
      throw new IOException("String_Node_Str" + valueUOM);
    }
  }
  return perfs;
}

Fixed version (ground truth):
public static List<NagiosPerfData> parsePerfData(String perfData) throws IOException {
  List<NagiosPerfData> perfs=new LinkedList<NagiosPerfData>();
  CharBuffer buffer=CharBuffer.wrap(perfData.toCharArray());
  while (buffer.hasRemaining()) {
    skipWhitespace(buffer);
    String label=readLabel(buffer);
    String valueString=readValue(buffer);
    String[] values=valueString.split("String_Node_Str");
    String valueUOM=values.length > 0 ? values[0] : null;
    String warn=values.length > 1 ? values[1] : null;
    String crit=values.length > 2 ? values[2] : null;
    String min=values.length > 3 ? values[3] : null;
    String max=values.length > 4 ? values[4] : null;
    Matcher matcher=VALUE_UOM_PATTERN.matcher(valueUOM);
    if (matcher.matches()) {
      String value=matcher.group(1);
      String unit=matcher.group(2);
      perfs.add(new NagiosPerfData(label,value,unit,warn,crit,min,max));
    }
 else {
      throw new IOException("String_Node_Str" + valueUOM);
    }
  }
  return perfs;
}
Program: 37887
Project: 37887
Buggy source:
/** 
 * Apply a warning / critical threshold to determine the result state, this will  result in either a ok, warning or critical state depending on the values and  thresholds. This applies a threshold check to a collection of values, with the worst status  being the status of this result.
 * @param values the values to check
 * @param warning the warning threshold
 * @param critical the critical threshold
 * @param message the check output
 */
@JsonIgnore public ResultMO applyThreshold(Iterable<Double> values,double warning,double critical,String message){
  int state=0;
  for (  double value : values) {
    if (value > critical) {
      state=Math.max(state,2);
    }
 else     if (value > warning) {
      state=Math.max(state,1);
    }
 else {
      state=Math.max(state,0);
    }
  }
switch (state) {
case 0:
    this.ok(message);
  break;
case 1:
this.warning(message);
case 2:
this.critical(message);
}
return this;
}

Fixed version (ground truth):
/** 
 * Apply a warning / critical threshold to determine the result state, this will  result in either a ok, warning or critical state depending on the values and  thresholds. This applies a threshold check to a collection of values, with the worst status  being the status of this result.
 * @param values the values to check
 * @param warning the warning threshold
 * @param critical the critical threshold
 * @param message the check output
 */
@JsonIgnore public ResultMO applyThreshold(Iterable<Double> values,double warning,double critical,String message){
  int state=0;
  for (  double value : values) {
    if (value > critical) {
      state=Math.max(state,2);
    }
 else     if (value > warning) {
      state=Math.max(state,1);
    }
 else {
      state=Math.max(state,0);
    }
  }
switch (state) {
case 0:
    this.ok(message);
  break;
case 1:
this.warning(message);
break;
case 2:
this.critical(message);
break;
}
return this;
}
Program: 37888
Project: 37888
Buggy source:
/** 
 * Apply a warning / critical threshold to determine the result state, this will  result in either a ok, warning or critical state depending on the values and  thresholds. This applies a threshold check to a collection of values, with the worst status  being the status of this result.
 * @param values the values to check
 * @param warning the warning threshold
 * @param critical the critical threshold
 * @param message the check output
 */
@JsonIgnore public ResultMO applyLessThanThreshold(Iterable<Double> values,double warning,double critical,String message){
  int state=0;
  for (  double value : values) {
    if (value < critical) {
      state=Math.max(state,2);
    }
 else     if (value < warning) {
      state=Math.max(state,1);
    }
 else {
      state=Math.max(state,0);
    }
  }
switch (state) {
case 0:
    this.ok(message);
  break;
case 1:
this.warning(message);
case 2:
this.critical(message);
}
return this;
}

Fixed version (ground truth):
/** 
 * Apply a warning / critical threshold to determine the result state, this will  result in either a ok, warning or critical state depending on the values and  thresholds. This applies a threshold check to a collection of values, with the worst status  being the status of this result.
 * @param values the values to check
 * @param warning the warning threshold
 * @param critical the critical threshold
 * @param message the check output
 */
@JsonIgnore public ResultMO applyLessThanThreshold(Iterable<Double> values,double warning,double critical,String message){
  int state=0;
  for (  double value : values) {
    if (value < critical) {
      state=Math.max(state,2);
    }
 else     if (value < warning) {
      state=Math.max(state,1);
    }
 else {
      state=Math.max(state,0);
    }
  }
switch (state) {
case 0:
    this.ok(message);
  break;
case 1:
this.warning(message);
break;
case 2:
this.critical(message);
break;
}
return this;
}
Program: 37889
Project: 37889
Buggy source:
public void unregisterAgent(BergamotAgentServerHandler agent){
  logger.debug("String_Node_Str");
  AgentHello hello=agent.getHello();
  this.agents.remove(hello.getHostId());
}

Fixed version (ground truth):
public void unregisterAgent(BergamotAgentServerHandler agent){
  logger.debug("String_Node_Str");
  this.agents.remove(agent.getHello().getHostId());
  if (this.onAgentUnregister != null)   this.onAgentUnregister.accept(agent);
}