nus-yam/ex-repair huggingface dataset:
Program: 149353
Project: 149353
Buggy source:
@Override public void onDeploying(AbstractBuild<?,?> build,String instanceId,ElasticBoxCloud cloud) throws IOException, InterruptedException {
  AbstractBuild<?,?> rootBuild=build;
  for (Cause.UpstreamCause upstreamCause=build.getCause(Cause.UpstreamCause.class); upstreamCause != null; upstreamCause=rootBuild.getCause(Cause.UpstreamCause.class)) {
    Run<?,?> run=upstreamCause.getUpstreamRun();
    if (run == null) {
      break;
    }
    rootBuild=(AbstractBuild<?,?>)run;
  }
  TriggerCause cause=rootBuild.getCause(TriggerCause.class);
  if (cause == null) {
    return;
  }
  ConcurrentHashMap<String,PullRequestData> prDataLookup=getInstance().projectPullRequestDataLookup.get(rootBuild.getProject());
  if (prDataLookup != null) {
    PullRequestData data=prDataLookup.get(cause.getPullRequest().getUrl().toString());
    if (data != null) {
      data.getInstances().add(new PullRequestInstance(instanceId,cloud.name));
      data.save();
    }
  }
}

Fixed version (ground truth):
@Override public void onDeploying(AbstractBuild<?,?> build,String instanceId,ElasticBoxCloud cloud) throws IOException, InterruptedException {
  AbstractBuild<?,?> rootBuild=build;
  for (Cause.UpstreamCause upstreamCause=build.getCause(Cause.UpstreamCause.class); upstreamCause != null; upstreamCause=rootBuild.getCause(Cause.UpstreamCause.class)) {
    Run<?,?> run=upstreamCause.getUpstreamRun();
    if (run == null) {
      break;
    }
    rootBuild=(AbstractBuild<?,?>)run;
  }
  TriggerCause cause=rootBuild.getCause(TriggerCause.class);
  if (cause == null) {
    return;
  }
  ConcurrentHashMap<String,PullRequestData> prDataLookup=getInstance().projectPullRequestDataLookup.get(rootBuild.getProject());
  if (prDataLookup != null) {
    PullRequestData data=prDataLookup.get(cause.getPullRequest().getUrl().toString());
    if (data == null) {
      data=getInstance().addPullRequestData(cause.getPullRequest(),rootBuild.getProject());
    }
    data.getInstances().add(new PullRequestInstance(instanceId,cloud.name));
    data.save();
  }
}
Program: 149354
Project: 149354
Buggy source:
@Initializer(before=InitMilestone.COMPLETED) public static void setSlaveConfigurationId() throws IOException {
  boolean saveNeeded=false;
  for (  Cloud cloud : Jenkins.getInstance().clouds) {
    if (cloud instanceof ElasticBoxCloud) {
      ElasticBoxCloud ebxCloud=(ElasticBoxCloud)cloud;
      for (      SlaveConfiguration slaveConfig : ebxCloud.getSlaveConfigurations()) {
        if (StringUtils.isBlank(slaveConfig.getId())) {
          slaveConfig.setId(UUID.randomUUID().toString());
          saveNeeded=true;
        }
      }
    }
  }
  if (saveNeeded) {
    Jenkins.getInstance().save();
  }
}

Fixed version (ground truth):
@Initializer(after=InitMilestone.JOB_LOADED) public static void setSlaveConfigurationId() throws IOException {
  LOGGER.finest("String_Node_Str");
  boolean saveNeeded=false;
  for (  Cloud cloud : Jenkins.getInstance().clouds) {
    if (cloud instanceof ElasticBoxCloud) {
      ElasticBoxCloud ebxCloud=(ElasticBoxCloud)cloud;
      for (      SlaveConfiguration slaveConfig : ebxCloud.getSlaveConfigurations()) {
        if (StringUtils.isBlank(slaveConfig.getId())) {
          slaveConfig.setId(UUID.randomUUID().toString());
          saveNeeded=true;
        }
      }
    }
  }
  if (saveNeeded) {
    Jenkins.getInstance().save();
  }
}
Program: 149355
Project: 149355
Buggy source:
@Initializer(before=InitMilestone.COMPLETED) public static void tagSlaveInstances() throws IOException {
  LOGGER.info("String_Node_Str");
  new Condition(){
    @Override public boolean satisfied(){
      return Jenkins.getInstance().getNodes() != null;
    }
  }
.waitUntilSatisfied(3000);
  ElasticBoxExecutor.threadPool.submit(new Runnable(){
    public void run(){
      try {
        SlaveInstanceManager manager=new SlaveInstanceManager();
        for (        JSONObject instance : manager.getInstances()) {
          ElasticBoxSlave slave=manager.getSlave(instance.getString("String_Node_Str"));
          ElasticBoxSlaveHandler.getInstance().tagSlaveInstance(instance,slave);
        }
      }
 catch (      IOException ex) {
        LOGGER.log(Level.SEVERE,"String_Node_Str",ex);
      }
    }
  }
);
}

Fixed version (ground truth):
@Initializer(after=InitMilestone.JOB_LOADED) public static void tagSlaveInstances() throws IOException {
  LOGGER.finest("String_Node_Str");
  new Condition(){
    @Override public boolean satisfied(){
      return Jenkins.getInstance().getNodes() != null;
    }
  }
.waitUntilSatisfied(3000);
  ElasticBoxExecutor.threadPool.submit(new Runnable(){
    public void run(){
      try {
        SlaveInstanceManager manager=new SlaveInstanceManager();
        for (        JSONObject instance : manager.getInstances()) {
          ElasticBoxSlave slave=manager.getSlave(instance.getString("String_Node_Str"));
          ElasticBoxSlaveHandler.getInstance().tagSlaveInstance(instance,slave);
        }
      }
 catch (      IOException ex) {
        LOGGER.log(Level.SEVERE,"String_Node_Str",ex);
      }
    }
  }
);
}
Program: 149356
Project: 149356
Buggy source:
@Override protected void onLoad(ProjectData projectData){
  PullRequestManager manager=PullRequestManager.getInstance();
  PullRequests pullRequests=projectData.get(PullRequests.class);
  if (pullRequests != null) {
    ConcurrentHashMap<String,PullRequestData> pullRequestDataLookup=new ConcurrentHashMap<String,PullRequestData>();
    for (    PullRequestData pullRequestData : pullRequests.getData()) {
      pullRequestDataLookup.put(pullRequestData.pullRequestUrl.toString(),pullRequestData);
    }
    manager.projectPullRequestDataLookup.put(projectData.getProject(),pullRequestDataLookup);
  }
}

Fixed version (ground truth):
@Override protected void onLoad(ProjectData projectData){
  LOGGER.finest(MessageFormat.format("String_Node_Str",projectData.getProject().getName()));
  PullRequestManager manager=PullRequestManager.getInstance();
  PullRequests pullRequests=projectData.get(PullRequests.class);
  if (pullRequests != null) {
    ConcurrentHashMap<String,PullRequestData> pullRequestDataLookup=new ConcurrentHashMap<String,PullRequestData>();
    for (    PullRequestData pullRequestData : pullRequests.getData()) {
      pullRequestDataLookup.put(pullRequestData.pullRequestUrl.toString(),pullRequestData);
    }
    manager.projectPullRequestDataLookup.put(projectData.getProject(),pullRequestDataLookup);
  }
}
Program: 149357
Project: 149357
Buggy source:
@Initializer(before=InitMilestone.COMPLETED) public static void loadAll(){
  List<ProjectDataListener> listeners=Jenkins.getInstance().getExtensionList(ProjectDataListener.class);
  for (  AbstractProject<?,?> job : Jenkins.getInstance().getAllItems(AbstractProject.class)) {
    ProjectData data=null;
    try {
      data=ProjectData.load(job);
    }
 catch (    IOException ex) {
      LOGGER.log(Level.SEVERE,ex.getMessage(),ex);
    }
    if (data != null) {
      projectDataLookup.put(job,data);
      for (      ProjectDataListener listener : listeners) {
        try {
          listener.onLoad(data);
        }
 catch (        Throwable ex) {
          LOGGER.log(Level.SEVERE,ex.getMessage(),ex);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Initializer(after=InitMilestone.JOB_LOADED) public static void loadAll(){
  LOGGER.info("String_Node_Str");
  List<ProjectDataListener> listeners=Jenkins.getInstance().getExtensionList(ProjectDataListener.class);
  for (  AbstractProject<?,?> job : Jenkins.getInstance().getAllItems(AbstractProject.class)) {
    ProjectData data=null;
    try {
      data=ProjectData.load(job);
    }
 catch (    IOException ex) {
      LOGGER.log(Level.SEVERE,ex.getMessage(),ex);
    }
    if (data != null) {
      projectDataLookup.put(job,data);
      for (      ProjectDataListener listener : listeners) {
        try {
          listener.onLoad(data);
        }
 catch (        Throwable ex) {
          LOGGER.log(Level.SEVERE,ex.getMessage(),ex);
        }
      }
    }
  }
}
Program: 149358
Project: 149358
Buggy source:
public void waitForDone(int timeout) throws IProgressMonitor.IncompleteException, IOException, InterruptedException {
  long startTime=System.currentTimeMillis();
  long remainingTime=timeout * 60000;
  do {
    if (isDone()) {
      return;
    }
synchronized (this) {
      wait(1000);
    }
    long currentTime=System.currentTimeMillis();
    remainingTime=remainingTime - (currentTime - startTime);
    startTime=currentTime;
  }
 while (timeout == 0 || remainingTime > 0);
  JSONObject resource=getResource();
  if (!isDone(resource)) {
    throw new IProgressMonitor.TimeoutException(MessageFormat.format("String_Node_Str",getResourceUrl(),timeout,getState(resource)));
  }
}

Fixed version (ground truth):
public void waitForDone(int timeout) throws IProgressMonitor.IncompleteException, IOException, InterruptedException {
  long startTime=System.currentTimeMillis();
  long remainingTime=timeout * 60000;
  do {
    if (isDone()) {
      return;
    }
synchronized (this) {
      wait(1000);
    }
    long currentTime=System.currentTimeMillis();
    remainingTime=remainingTime - (currentTime - startTime);
    startTime=currentTime;
  }
 while (timeout <= 0 || remainingTime > 0);
  JSONObject resource=getResource();
  if (!isDone(resource)) {
    throw new IProgressMonitor.TimeoutException(MessageFormat.format("String_Node_Str",getResourceUrl(),timeout,getState(resource)));
  }
}
Program: 149359
Project: 149359
Buggy source:
public ElasticBoxExecutor(){
  super("String_Node_Str");
}

Fixed version (ground truth):
public ElasticBoxExecutor(){
  super(ElasticBoxExecutor.class.getName());
}
Program: 149360
Project: 149360
Buggy source:
@Override public BuildWrapper newInstance(StaplerRequest req,JSONObject formData) throws FormException {
  InstanceCreator instanceCreator=(InstanceCreator)super.newInstance(req,formData);
  ProjectSlaveConfiguration.DescriptorImpl descriptor=(ProjectSlaveConfiguration.DescriptorImpl)instanceCreator.getSlaveConfiguration().getDescriptor();
  FormValidation result=descriptor.doCheckBoxVersion(instanceCreator.getSlaveConfiguration().getBoxVersion(),instanceCreator.getSlaveConfiguration().getCloud(),instanceCreator.getSlaveConfiguration().getBox());
  if (result.kind == FormValidation.Kind.ERROR) {
    throw new FormException(result.getMessage(),"String_Node_Str");
  }
  return instanceCreator;
}

Fixed version (ground truth):
@Override public BuildWrapper newInstance(StaplerRequest req,JSONObject formData) throws FormException {
  InstanceCreator instanceCreator=(InstanceCreator)super.newInstance(req,formData);
  ProjectSlaveConfiguration.DescriptorImpl descriptor=(ProjectSlaveConfiguration.DescriptorImpl)instanceCreator.getSlaveConfiguration().getDescriptor();
  FormValidation result=descriptor.doCheckBoxVersion(instanceCreator.getSlaveConfiguration().getBoxVersion(),instanceCreator.getSlaveConfiguration().getCloud(),instanceCreator.getSlaveConfiguration().getWorkspace(),instanceCreator.getSlaveConfiguration().getBox());
  if (result.kind == FormValidation.Kind.ERROR) {
    throw new FormException(result.getMessage(),"String_Node_Str");
  }
  return instanceCreator;
}
Program: 149361
Project: 149361
Buggy source:
private void wait(Callable<Boolean> condition,long timeout) throws Exception {
  long startTime=System.currentTimeMillis();
  long remainingTime=timeout;
  while (remainingTime > 0 && condition.call()) {
synchronized (waitLock) {
      try {
        waitLock.wait(remainingTime);
      }
 catch (      InterruptedException ex) {
      }
    }
    long currentTime=System.currentTimeMillis();
    remainingTime=remainingTime - (currentTime - startTime);
    startTime=currentTime;
  }
}

Fixed version (ground truth):
private void wait(Callable<Boolean> condition,long timeout) throws Exception {
  long startTime=System.currentTimeMillis();
  long remainingTime=timeout;
  while ((timeout <= 0 || remainingTime > 0) && condition.call()) {
synchronized (waitLock) {
      try {
        waitLock.wait(remainingTime);
      }
 catch (      InterruptedException ex) {
      }
    }
    long currentTime=System.currentTimeMillis();
    remainingTime=remainingTime - (currentTime - startTime);
    startTime=currentTime;
  }
}
Program: 149362
Project: 149362
Buggy source:
@Override public void waitForDone(int timeout) throws IncompleteException, IOException, InterruptedException {
  StopWatch stopWatch=new StopWatch();
  stopWatch.start();
  long timeoutMiliseconds=timeout * 60000;
  long remainingTime=timeoutMiliseconds;
  try {
    wait(new Callable<Boolean>(){
      @Override public Boolean call() throws Exception {
        return monitor == null;
      }
    }
,timeoutMiliseconds);
  }
 catch (  Exception ex) {
    LOGGER.log(Level.SEVERE,ex.getMessage(),ex);
  }
  if (monitor == IProgressMonitor.DONE_MONITOR) {
    return;
  }
  remainingTime=remainingTime - stopWatch.getTime();
  if (monitor != null && remainingTime > 0) {
    monitor.waitForDone(Math.round(remainingTime / 60000));
  }
  remainingTime=remainingTime - stopWatch.getTime();
  if (remainingTime > 0) {
    try {
      wait(new Callable<Boolean>(){
        @Override public Boolean call() throws Exception {
          SlaveComputer computer=slave.getComputer();
          return computer != null && computer.isOffline();
        }
      }
,remainingTime);
    }
 catch (    Exception ex) {
      LOGGER.log(Level.SEVERE,ex.getMessage(),ex);
    }
  }
}

Fixed version (ground truth):
@Override public void waitForDone(int timeout) throws IncompleteException, IOException, InterruptedException {
  StopWatch stopWatch=new StopWatch();
  stopWatch.start();
  long timeoutMiliseconds=timeout * 60000;
  long remainingTime=timeoutMiliseconds;
  try {
    wait(new Callable<Boolean>(){
      @Override public Boolean call() throws Exception {
        return monitor == null;
      }
    }
,timeoutMiliseconds);
  }
 catch (  Exception ex) {
    LOGGER.log(Level.SEVERE,ex.getMessage(),ex);
  }
  if (monitor == IProgressMonitor.DONE_MONITOR) {
    return;
  }
  remainingTime=remainingTime - stopWatch.getTime();
  if (monitor != null && remainingTime > 0) {
    monitor.waitForDone((int)Math.ceil(remainingTime / 60000));
  }
  remainingTime=remainingTime - stopWatch.getTime();
  if (remainingTime > 0) {
    try {
      wait(new Callable<Boolean>(){
        @Override public Boolean call() throws Exception {
          SlaveComputer computer=slave.getComputer();
          return computer != null && computer.isOffline();
        }
      }
,remainingTime);
    }
 catch (    Exception ex) {
      LOGGER.log(Level.SEVERE,ex.getMessage(),ex);
    }
  }
}
Program: 149363
Project: 149363
Buggy source:
public FormValidation doCheckBoxVersion(@QueryParameter String value,@QueryParameter String cloud,@QueryParameter String box){
  return DescriptorHelper.checkSlaveBox(ClientCache.getClient(cloud),StringUtils.isBlank(value) ? box : value);
}

Fixed version (ground truth):
public FormValidation doCheckBoxVersion(@QueryParameter String value,@QueryParameter String cloud,@QueryParameter String workspace,@QueryParameter String box){
  return checkBoxVersion(value,box,workspace,ClientCache.getClient(cloud));
}
Program: 149364
Project: 149364
Buggy source:
public FormValidation doCheckBoxVersion(@QueryParameter String value,@RelativePath("String_Node_Str") @QueryParameter String endpointUrl,@RelativePath("String_Node_Str") @QueryParameter String username,@RelativePath("String_Node_Str") @QueryParameter String password,@RelativePath("String_Node_Str") @QueryParameter String token,@QueryParameter String workspace,@QueryParameter String box){
  Client client=createClient(endpointUrl,username,password,token);
  String boxVersion=StringUtils.isBlank(value) ? box : value;
  if (DescriptorHelper.LATEST_BOX_VERSION.equals(boxVersion)) {
    try {
      boxVersion=client.getLatestBoxVersion(workspace,box);
    }
 catch (    IOException ex) {
      LOGGER.log(Level.SEVERE,ex.getMessage(),ex);
      return FormValidation.error(MessageFormat.format("String_Node_Str",box));
    }
  }
  return DescriptorHelper.checkSlaveBox(client,boxVersion);
}

Fixed version (ground truth):
public FormValidation doCheckBoxVersion(@QueryParameter String value,@RelativePath("String_Node_Str") @QueryParameter String endpointUrl,@RelativePath("String_Node_Str") @QueryParameter String username,@RelativePath("String_Node_Str") @QueryParameter String password,@RelativePath("String_Node_Str") @QueryParameter String token,@QueryParameter String workspace,@QueryParameter String box){
  Client client=createClient(endpointUrl,username,password,token);
  return checkBoxVersion(value,box,workspace,client);
}
Program: 149365
Project: 149365
Buggy source:
private void deleteInstances(GHPullRequest pullRequest) throws IOException {
  PullRequestManager pullRequestManager=PullRequestManager.getInstance();
  Collection<PullRequestInstance> prInstances=new ArrayList<PullRequestInstance>();
  Authentication old=SecurityContextHolder.getContext().getAuthentication();
  SecurityContextHolder.getContext().setAuthentication(ACL.SYSTEM);
  try {
    for (    AbstractProject<?,?> aProject : Jenkins.getInstance().getAllItems(AbstractProject.class)) {
      PullRequestData data=pullRequestManager.removePullRequestData(pullRequest.getUrl().toString(),aProject);
      if (data != null) {
        prInstances.addAll(data.getInstances());
      }
    }
  }
  finally {
    SecurityContextHolder.getContext().setAuthentication(old);
  }
  List<String> terminatingInstanceURLs=new ArrayList<String>();
  for (  PullRequestInstance instance : prInstances) {
    Client client=ClientCache.getClient(instance.cloud);
    if (client != null) {
      String instanceId=Client.getResourceId(instance.id);
      IProgressMonitor monitor=null;
      try {
        monitor=client.terminate(instanceId);
      }
 catch (      ClientException ex) {
        if (ex.getStatusCode() == HttpStatus.SC_CONFLICT) {
          try {
            monitor=client.forceTerminate(instanceId);
          }
 catch (          IOException ex1) {
            LOGGER.log(Level.SEVERE,MessageFormat.format("String_Node_Str",instance.id),ex1);
          }
        }
      }
catch (      IOException ex) {
        LOGGER.log(Level.SEVERE,MessageFormat.format("String_Node_Str",instance.id),ex);
      }
      if (monitor != null) {
        Jenkins.getInstance().getExtensionList(ElasticBoxExecutor.Workload.class).get(DeleteInstancesWorkload.class).add(instance);
        terminatingInstanceURLs.add(monitor.getResourceUrl());
      }
    }
  }
  if (!terminatingInstanceURLs.isEmpty()) {
    try {
      pullRequest.comment(MessageFormat.format("String_Node_Str",StringUtils.join(terminatingInstanceURLs,"String_Node_Str")));
    }
 catch (    IOException ex) {
      LOGGER.log(Level.SEVERE,MessageFormat.format("String_Node_Str",pullRequest.getUrl(),ex));
    }
  }
}

Fixed version (ground truth):
private void deleteInstances(GHPullRequest pullRequest) throws IOException {
  PullRequestManager pullRequestManager=PullRequestManager.getInstance();
  List<PullRequestData> pullRequestDataList=new ArrayList<PullRequestData>();
  Authentication old=SecurityContextHolder.getContext().getAuthentication();
  SecurityContextHolder.getContext().setAuthentication(ACL.SYSTEM);
  try {
    for (    AbstractProject<?,?> aProject : Jenkins.getInstance().getAllItems(AbstractProject.class)) {
      PullRequestData data=pullRequestManager.removePullRequestData(pullRequest.getUrl().toString(),aProject);
      if (data != null) {
        pullRequestDataList.add(data);
      }
    }
  }
  finally {
    SecurityContextHolder.getContext().setAuthentication(old);
  }
  PullRequestCleanup.deleteInstances(pullRequestDataList,pullRequest);
}
Program: 149366
Project: 149366
Buggy source:
public void waitForDone(int timeout) throws IProgressMonitor.IncompleteException, IOException, InterruptedException {
  long startTime=System.currentTimeMillis();
  long remainingTime=timeout * 60000;
  do {
    if (isDone()) {
      return;
    }
synchronized (waitLock) {
      waitLock.wait(1000);
    }
    long currentTime=System.currentTimeMillis();
    remainingTime=remainingTime - (currentTime - startTime);
    startTime=currentTime;
  }
 while (timeout == 0 || remainingTime > 0);
  JSONObject resource=getResource();
  if (!isDone(resource)) {
    throw new IProgressMonitor.TimeoutException(MessageFormat.format("String_Node_Str",getResourceUrl(),timeout,getState(resource)));
  }
}

Fixed version (ground truth):
public void waitForDone(int timeout) throws IProgressMonitor.IncompleteException, IOException, InterruptedException {
  long startTime=System.currentTimeMillis();
  long remainingTime=timeout * 60000;
  do {
    if (isDone()) {
      return;
    }
synchronized (this) {
      wait(1000);
    }
    long currentTime=System.currentTimeMillis();
    remainingTime=remainingTime - (currentTime - startTime);
    startTime=currentTime;
  }
 while (timeout == 0 || remainingTime > 0);
  JSONObject resource=getResource();
  if (!isDone(resource)) {
    throw new IProgressMonitor.TimeoutException(MessageFormat.format("String_Node_Str",getResourceUrl(),timeout,getState(resource)));
  }
}
Program: 149367
Project: 149367
Buggy source:
public void waitForDone(int timeout) throws IProgressMonitor.IncompleteException, IOException, InterruptedException {
  long startTime=System.currentTimeMillis();
  long remainingTime=timeout * 60000;
  do {
    if (isDone()) {
      return;
    }
synchronized (waitLock) {
      waitLock.wait(1000);
    }
    long currentTime=System.currentTimeMillis();
    remainingTime=remainingTime - (currentTime - startTime);
    startTime=currentTime;
  }
 while (timeout == 0 || remainingTime > 0);
  JSONObject resource=getResource();
  if (!isDone(resource)) {
    throw new IProgressMonitor.TimeoutException(MessageFormat.format("String_Node_Str",getResourceUrl(),timeout,getState(resource)));
  }
}

Fixed version (ground truth):
public void waitForDone(int timeout) throws IProgressMonitor.IncompleteException, IOException, InterruptedException {
  long startTime=System.currentTimeMillis();
  long remainingTime=timeout * 60000;
  do {
    if (isDone()) {
      return;
    }
synchronized (this) {
      wait(1000);
    }
    long currentTime=System.currentTimeMillis();
    remainingTime=remainingTime - (currentTime - startTime);
    startTime=currentTime;
  }
 while (timeout == 0 || remainingTime > 0);
  JSONObject resource=getResource();
  if (!isDone(resource)) {
    throw new IProgressMonitor.TimeoutException(MessageFormat.format("String_Node_Str",getResourceUrl(),timeout,getState(resource)));
  }
}
Program: 149368
Project: 149368
Buggy source:
private static void notifyTerminating(AbstractBuild<?,?> build,String instanceId,ElasticBoxCloud cloud) throws InterruptedException {
  for (  BuilderListener listener : Jenkins.getInstance().getExtensionList(BuilderListener.class)) {
    try {
      listener.onDeploying(build,instanceId,cloud);
    }
 catch (    IOException ex) {
      Logger.getLogger(TerminateOperation.class.getName()).log(Level.SEVERE,ex.getMessage(),ex);
    }
  }
}

Fixed version (ground truth):
private static void notifyTerminating(AbstractBuild<?,?> build,String instanceId,ElasticBoxCloud cloud) throws InterruptedException {
  for (  BuilderListener listener : Jenkins.getInstance().getExtensionList(BuilderListener.class)) {
    try {
      listener.onTerminating(build,instanceId,cloud);
    }
 catch (    IOException ex) {
      Logger.getLogger(TerminateOperation.class.getName()).log(Level.SEVERE,ex.getMessage(),ex);
    }
  }
}
Program: 149369
Project: 149369
Buggy source:
public String getWebHookUrl(){
  String jenkinsUrl=Jenkins.getInstance().getRootUrl();
  if (jenkinsUrl == null) {
    return null;
  }
  if (!jenkinsUrl.endsWith("String_Node_Str")) {
    jenkinsUrl+='/';
  }
  return jenkinsUrl + Jenkins.getInstance().getExtensionList(RootAction.class).get(WebHook.class).getUrlName() + '/';
}

Fixed version (ground truth):
public String getWebHookUrl(){
  String jenkinsUrl=Jenkins.getInstance().getRootUrl();
  if (jenkinsUrl == null) {
    LOGGER.severe("String_Node_Str");
    return null;
  }
  if (!jenkinsUrl.endsWith("String_Node_Str")) {
    jenkinsUrl+='/';
  }
  return jenkinsUrl + Jenkins.getInstance().getExtensionList(RootAction.class).get(WebHook.class).getUrlName() + '/';
}
Program: 149370
Project: 149370
Buggy source:
public void save() throws IOException {
  PullRequests pullRequests=projectData.get(PullRequests.class);
  if (pullRequests == null) {
    projectData.add(new PullRequests());
    pullRequests=projectData.get(PullRequests.class);
  }
  List<PullRequestData> dataList=pullRequests.getData();
  if (dataList == null) {
    projectData.add(new PullRequests());
  }
  if (!dataList.contains(this)) {
    dataList.add(this);
  }
  projectData.save();
}

Fixed version (ground truth):
public synchronized void save() throws IOException {
  PullRequests pullRequests=projectData.get(PullRequests.class);
  if (pullRequests == null) {
    projectData.add(new PullRequests());
    pullRequests=projectData.get(PullRequests.class);
  }
  List<PullRequestData> dataList=pullRequests.getData();
  if (dataList == null) {
    projectData.add(new PullRequests());
  }
  if (!dataList.contains(this)) {
    dataList.add(this);
  }
  projectData.save();
}
Program: 149371
Project: 149371
Buggy source:
private void handlePullRequestEvent(String payload) throws IOException {
  GitHub gitHub=createGitHub(payload);
  if (gitHub == null) {
    return;
  }
  GHEventPayload.PullRequest pullRequest=gitHub.parseEventPayload(new StringReader(payload),GHEventPayload.PullRequest.class);
  if (PullRequestAction.CLOSED.equals(pullRequest.getAction())) {
    deleteInstances(pullRequest);
  }
 else   if (TRIGGER_EVENTS.contains(pullRequest.getAction())) {
    Authentication old=SecurityContextHolder.getContext().getAuthentication();
    SecurityContextHolder.getContext().setAuthentication(ACL.SYSTEM);
    try {
      for (      AbstractProject<?,?> job : Jenkins.getInstance().getAllItems(AbstractProject.class)) {
        PullRequestBuildTrigger trigger=job.getTrigger(PullRequestBuildTrigger.class);
        if (trigger != null && trigger.getBuildHandler() instanceof PullRequestBuildHandler) {
          ((PullRequestBuildHandler)trigger.getBuildHandler()).handle(pullRequest,gitHub);
        }
      }
    }
  finally {
      SecurityContextHolder.getContext().setAuthentication(old);
    }
  }
 else {
    LOGGER.warning(MessageFormat.format("String_Node_Str",pullRequest.getAction()));
  }
}

Fixed version (ground truth):
private void handlePullRequestEvent(String payload) throws IOException {
  GitHub gitHub=createGitHub(payload);
  if (gitHub == null) {
    return;
  }
  GHEventPayload.PullRequest pullRequest=gitHub.parseEventPayload(new StringReader(payload),GHEventPayload.PullRequest.class);
  if (SUPPORTED_EVENTS.contains(pullRequest.getAction())) {
    Authentication old=SecurityContextHolder.getContext().getAuthentication();
    SecurityContextHolder.getContext().setAuthentication(ACL.SYSTEM);
    try {
      for (      AbstractProject<?,?> job : Jenkins.getInstance().getAllItems(AbstractProject.class)) {
        PullRequestBuildTrigger trigger=job.getTrigger(PullRequestBuildTrigger.class);
        if (trigger != null && trigger.getBuildHandler() instanceof PullRequestBuildHandler) {
          ((PullRequestBuildHandler)trigger.getBuildHandler()).handle(pullRequest,gitHub);
        }
      }
    }
  finally {
      SecurityContextHolder.getContext().setAuthentication(old);
    }
  }
 else {
    LOGGER.warning(MessageFormat.format("String_Node_Str",pullRequest.getAction()));
  }
}
Program: 149372
Project: 149372
Buggy source:
@Override public BuildWrapper newInstance(StaplerRequest req,JSONObject formData) throws FormException {
  InstanceCreator instanceCreator=(InstanceCreator)super.newInstance(req,formData);
  ProjectSlaveConfiguration.DescriptorImpl descriptor=(ProjectSlaveConfiguration.DescriptorImpl)instanceCreator.getSlaveConfiguration().getDescriptor();
  FormValidation result=descriptor.doCheckBoxVersion(instanceCreator.getSlaveConfiguration().getBoxVersion(),instanceCreator.getSlaveConfiguration().getCloud(),instanceCreator.getSlaveConfiguration().getBox());
  if (result.kind == FormValidation.Kind.ERROR) {
    throw new FormException(result.getMessage(),"String_Node_Str");
  }
  return instanceCreator;
}

Fixed version (ground truth):
@Override public BuildWrapper newInstance(StaplerRequest req,JSONObject formData) throws FormException {
  InstanceCreator instanceCreator=(InstanceCreator)super.newInstance(req,formData);
  ProjectSlaveConfiguration.DescriptorImpl descriptor=(ProjectSlaveConfiguration.DescriptorImpl)instanceCreator.getSlaveConfiguration().getDescriptor();
  FormValidation result=descriptor.doCheckBoxVersion(instanceCreator.getSlaveConfiguration().getBoxVersion(),instanceCreator.getSlaveConfiguration().getCloud(),instanceCreator.getSlaveConfiguration().getWorkspace(),instanceCreator.getSlaveConfiguration().getBox());
  if (result.kind == FormValidation.Kind.ERROR) {
    throw new FormException(result.getMessage(),"String_Node_Str");
  }
  return instanceCreator;
}
Program: 149373
Project: 149373
Buggy source:
public FormValidation doCheckBoxVersion(@QueryParameter String value,@QueryParameter String cloud,@QueryParameter String box){
  return DescriptorHelper.checkSlaveBox(ClientCache.getClient(cloud),StringUtils.isBlank(value) ? box : value);
}

Fixed version (ground truth):
public FormValidation doCheckBoxVersion(@QueryParameter String value,@QueryParameter String cloud,@QueryParameter String workspace,@QueryParameter String box){
  return checkBoxVersion(value,box,workspace,ClientCache.getClient(cloud));
}
Program: 149374
Project: 149374
Buggy source:
public FormValidation doCheckBoxVersion(@QueryParameter String value,@RelativePath("String_Node_Str") @QueryParameter String endpointUrl,@RelativePath("String_Node_Str") @QueryParameter String username,@RelativePath("String_Node_Str") @QueryParameter String password,@RelativePath("String_Node_Str") @QueryParameter String token,@QueryParameter String workspace,@QueryParameter String box){
  Client client=createClient(endpointUrl,username,password,token);
  String boxVersion=StringUtils.isBlank(value) ? box : value;
  if (DescriptorHelper.LATEST_BOX_VERSION.equals(boxVersion)) {
    try {
      boxVersion=client.getLatestBoxVersion(workspace,box);
    }
 catch (    IOException ex) {
      LOGGER.log(Level.SEVERE,ex.getMessage(),ex);
      return FormValidation.error(MessageFormat.format("String_Node_Str",box));
    }
  }
  return DescriptorHelper.checkSlaveBox(client,boxVersion);
}

Fixed version (ground truth):
public FormValidation doCheckBoxVersion(@QueryParameter String value,@RelativePath("String_Node_Str") @QueryParameter String endpointUrl,@RelativePath("String_Node_Str") @QueryParameter String username,@RelativePath("String_Node_Str") @QueryParameter String password,@RelativePath("String_Node_Str") @QueryParameter String token,@QueryParameter String workspace,@QueryParameter String box){
  Client client=createClient(endpointUrl,username,password,token);
  return checkBoxVersion(value,box,workspace,client);
}
Program: 149375
Project: 149375
Buggy source:
@Initializer(after=InitMilestone.COMPLETED) public static void setSlaveConfigurationId() throws IOException {
  boolean saveNeeded=false;
  for (  Cloud cloud : Jenkins.getInstance().clouds) {
    if (cloud instanceof ElasticBoxCloud) {
      ElasticBoxCloud ebxCloud=(ElasticBoxCloud)cloud;
      for (      SlaveConfiguration slaveConfig : ebxCloud.getSlaveConfigurations()) {
        if (StringUtils.isBlank(slaveConfig.getId())) {
          slaveConfig.setId(UUID.randomUUID().toString());
          saveNeeded=true;
        }
      }
    }
  }
  if (saveNeeded) {
    Jenkins.getInstance().save();
  }
}

Fixed version (ground truth):
@Initializer(before=InitMilestone.COMPLETED) public static void setSlaveConfigurationId() throws IOException {
  boolean saveNeeded=false;
  for (  Cloud cloud : Jenkins.getInstance().clouds) {
    if (cloud instanceof ElasticBoxCloud) {
      ElasticBoxCloud ebxCloud=(ElasticBoxCloud)cloud;
      for (      SlaveConfiguration slaveConfig : ebxCloud.getSlaveConfigurations()) {
        if (StringUtils.isBlank(slaveConfig.getId())) {
          slaveConfig.setId(UUID.randomUUID().toString());
          saveNeeded=true;
        }
      }
    }
  }
  if (saveNeeded) {
    Jenkins.getInstance().save();
  }
}
Program: 149376
Project: 149376
Buggy source:
@Initializer(after=InitMilestone.COMPLETED) public static void tagSlaveInstances() throws IOException {
  LOGGER.info("String_Node_Str");
  SlaveInstanceManager manager=new SlaveInstanceManager();
  for (  JSONObject instance : manager.getInstances()) {
    ElasticBoxSlave slave=manager.getSlave(instance.getString("String_Node_Str"));
    ElasticBoxSlaveHandler.getInstance().tagSlaveInstance(instance,slave);
  }
}

Fixed version (ground truth):
@Initializer(before=InitMilestone.COMPLETED) public static void tagSlaveInstances() throws IOException {
  LOGGER.info("String_Node_Str");
  new Condition(){
    @Override public boolean satisfied(){
      return Jenkins.getInstance().getNodes() != null;
    }
  }
.waitUntilSatisfied(3000);
  ElasticBoxExecutor.threadPool.submit(new Runnable(){
    public void run(){
      try {
        SlaveInstanceManager manager=new SlaveInstanceManager();
        for (        JSONObject instance : manager.getInstances()) {
          ElasticBoxSlave slave=manager.getSlave(instance.getString("String_Node_Str"));
          ElasticBoxSlaveHandler.getInstance().tagSlaveInstance(instance,slave);
        }
      }
 catch (      IOException ex) {
        LOGGER.log(Level.SEVERE,"String_Node_Str",ex);
      }
    }
  }
);
}
Program: 149377
Project: 149377
Buggy source:
private static ProjectData load(AbstractProject<?,?> project) throws IOException {
  XmlFile xmlFile=getXmlFile(project);
  if (xmlFile.exists()) {
    ProjectData projectData=(ProjectData)xmlFile.read();
    if (projectData.data != null) {
      for (      Datum datum : projectData.data) {
        datum.setProjectData(projectData);
      }
    }
    return projectData;
  }
  return null;
}

Fixed version (ground truth):
private static ProjectData load(AbstractProject<?,?> project) throws IOException {
  XmlFile xmlFile=getXmlFile(project);
  if (xmlFile.exists()) {
    ProjectData projectData=(ProjectData)xmlFile.read();
    if (projectData.data != null) {
      for (      Datum datum : projectData.data) {
        datum.setProjectData(projectData);
      }
    }
    projectData.project=project;
    return projectData;
  }
  return null;
}
Program: 149378
Project: 149378
Buggy source:
@Initializer(after=InitMilestone.COMPLETED) public static void loadAll(){
  List<ProjectDataListener> listeners=Jenkins.getInstance().getExtensionList(ProjectDataListener.class);
  for (  AbstractProject<?,?> job : Jenkins.getInstance().getAllItems(AbstractProject.class)) {
    ProjectData data=null;
    try {
      data=ProjectData.load(job);
    }
 catch (    IOException ex) {
      LOGGER.log(Level.SEVERE,ex.getMessage(),ex);
    }
    if (data != null) {
      projectDataLookup.put(job,data);
      for (      ProjectDataListener listener : listeners) {
        try {
          listener.onLoad(data);
        }
 catch (        Throwable ex) {
          LOGGER.log(Level.SEVERE,ex.getMessage(),ex);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Initializer(before=InitMilestone.COMPLETED) public static void loadAll(){
  List<ProjectDataListener> listeners=Jenkins.getInstance().getExtensionList(ProjectDataListener.class);
  for (  AbstractProject<?,?> job : Jenkins.getInstance().getAllItems(AbstractProject.class)) {
    ProjectData data=null;
    try {
      data=ProjectData.load(job);
    }
 catch (    IOException ex) {
      LOGGER.log(Level.SEVERE,ex.getMessage(),ex);
    }
    if (data != null) {
      projectDataLookup.put(job,data);
      for (      ProjectDataListener listener : listeners) {
        try {
          listener.onLoad(data);
        }
 catch (        Throwable ex) {
          LOGGER.log(Level.SEVERE,ex.getMessage(),ex);
        }
      }
    }
  }
}
Program: 149379
Project: 149379
Buggy source:
private AbstractBuild waitForNextBuild(long timeoutSeconds){
  final AbstractBuild build=project.getLastBuild();
  TestUtils.waitUntil(new TestUtils.Condition(){
    public boolean satisfied(){
      return build.getNextBuild() != null;
    }
  }
,timeoutSeconds);
  return build.getNextBuild();
}

Fixed version (ground truth):
private AbstractBuild waitForNextBuild(long timeoutSeconds){
  final AbstractBuild build=project.getLastBuild();
  new Condition(){
    public boolean satisfied(){
      return build.getNextBuild() != null;
    }
  }
.waitUntilSatisfied(timeoutSeconds);
  return build.getNextBuild();
}
Program: 149380
Project: 149380
Buggy source:
private void waitForCompletion(long timeoutSeconds){
  final AbstractBuild build=project.getLastBuild();
  TestUtils.waitUntil(new TestUtils.Condition(){
    public boolean satisfied(){
      return !build.isBuilding();
    }
  }
,timeoutSeconds);
}

Fixed version (ground truth):
private void waitForCompletion(long timeoutSeconds){
  final AbstractBuild build=project.getLastBuild();
  new Condition(){
    public boolean satisfied(){
      return !build.isBuilding();
    }
  }
.waitUntilSatisfied(timeoutSeconds);
}
Program: 149381
Project: 149381
Buggy source:
private void waitForDeletion(final List<JSONObject> instances,long timeoutSeconds){
  TestUtils.waitUntil(new TestUtils.Condition(){
    public boolean satisfied(){
      try {
        Client client=cloud.getClient();
        for (Iterator<JSONObject> iter=instances.iterator(); iter.hasNext(); ) {
          JSONObject instance=iter.next();
          try {
            client.getInstance(instance.getString("String_Node_Str"));
          }
 catch (          ClientException ex) {
            if (ex.getStatusCode() == HttpStatus.SC_NOT_FOUND) {
              iter.remove();
              objectsToDelete.remove(instance);
            }
 else {
              throw ex;
            }
          }
        }
        return instances.isEmpty();
      }
 catch (      IOException ex) {
        LOGGER.log(Level.SEVERE,ex.getMessage(),ex);
        return false;
      }
    }
  }
,TimeUnit.MINUTES.toSeconds(timeoutSeconds));
}

Fixed version (ground truth):
private void waitForDeletion(final List<JSONObject> instances,long timeoutSeconds){
  new Condition(){
    public boolean satisfied(){
      try {
        Client client=cloud.getClient();
        for (Iterator<JSONObject> iter=instances.iterator(); iter.hasNext(); ) {
          JSONObject instance=iter.next();
          try {
            client.getInstance(instance.getString("String_Node_Str"));
          }
 catch (          ClientException ex) {
            if (ex.getStatusCode() == HttpStatus.SC_NOT_FOUND) {
              iter.remove();
              objectsToDelete.remove(instance);
            }
 else {
              throw ex;
            }
          }
        }
        return instances.isEmpty();
      }
 catch (      IOException ex) {
        LOGGER.log(Level.SEVERE,ex.getMessage(),ex);
        return false;
      }
    }
  }
.waitUntilSatisfied(TimeUnit.MINUTES.toSeconds(timeoutSeconds));
}
Program: 149386
Project: 149386
Buggy source:
public String getResourceUrl(){
  return instanceUrl;
}

Fixed version (ground truth):
@Override public String getResourceUrl(){
  return instanceUrl;
}
Program: 149387
Project: 149387
Buggy source:
private JSONObject doOperation(JSONObject instance,String operation,JSONArray variables) throws IOException {
  String instanceId=instance.getString("String_Node_Str");
  String instanceUrl=getInstanceUrl(instanceId);
  if (variables != null && !variables.isEmpty()) {
    instance=updateInstance(instance,variables);
  }
  HttpPut put=new HttpPut(MessageFormat.format("String_Node_Str",instanceUrl,operation));
  try {
    execute(put);
    return getInstance(instanceId);
  }
  finally {
    put.reset();
  }
}

Fixed version (ground truth):
private JSONObject doOperation(JSONObject instance,String operation,JSONArray variables) throws IOException {
  String instanceId=instance.getString("String_Node_Str");
  String instanceUrl=getInstanceUrl(instanceId);
  if (variables != null && !variables.isEmpty()) {
    updateInstance(instance,variables);
  }
  HttpPut put=new HttpPut(MessageFormat.format("String_Node_Str",instanceUrl,operation));
  try {
    execute(put);
    return getInstance(instanceId);
  }
  finally {
    put.reset();
  }
}
Program: 149388
Project: 149388
Buggy source:
public JSONObject getProfile(String profileId) throws IOException {
  if (StringUtils.isBlank(profileId)) {
    throw new IOException("String_Node_Str");
  }
  ;
  return (JSONObject)doGet(MessageFormat.format("String_Node_Str",endpointUrl,profileId),false);
}

Fixed version (ground truth):
public JSONObject getProfile(String profileId) throws IOException {
  if (StringUtils.isBlank(profileId)) {
    throw new IOException("String_Node_Str");
  }
  return (JSONObject)doGet(MessageFormat.format("String_Node_Str",endpointUrl,profileId),false);
}
Program: 149389
Project: 149389
Buggy source:
public boolean isDone(JSONObject instance) throws IncompleteException, IOException {
  String updated=instance.getString("String_Node_Str");
  String state=instance.getString("String_Node_Str");
  String operation=instance.getString("String_Node_Str");
  if (lastModified.equals(updated) || !FINISH_STATES.contains(state)) {
    return false;
  }
  if (state.equals(InstanceState.UNAVAILABLE)) {
    throw new IncompleteException(MessageFormat.format("String_Node_Str",instanceUrl));
  }
  if (operations != null && !operations.contains(operation)) {
    throw new IncompleteException(MessageFormat.format("String_Node_Str",operation,instanceUrl));
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean isDone(JSONObject instance) throws IncompleteException, IOException {
  String updated=instance.getString("String_Node_Str");
  String state=instance.getString("String_Node_Str");
  String operation=instance.getString("String_Node_Str");
  if (lastModified.equals(updated) || !FINISH_STATES.contains(state)) {
    return false;
  }
  if (state.equals(InstanceState.UNAVAILABLE)) {
    throw new IncompleteException(MessageFormat.format("String_Node_Str",getPageUrl(endpointUrl,instance)));
  }
  if (operations != null && !operations.contains(operation)) {
    throw new IncompleteException(MessageFormat.format("String_Node_Str",operation,getPageUrl(endpointUrl,instance)));
  }
  return true;
}
Program: 149390
Project: 149390
Buggy source:
public void waitForDone(int timeout) throws IncompleteException, IOException {
  long startTime=System.currentTimeMillis();
  long remainingTime=timeout * 60000;
  do {
    if (isDone()) {
      return;
    }
synchronized (waitLock) {
      try {
        waitLock.wait(1000);
      }
 catch (      InterruptedException ex) {
      }
    }
    long currentTime=System.currentTimeMillis();
    remainingTime=remainingTime - (currentTime - startTime);
    startTime=currentTime;
  }
 while (timeout == 0 || remainingTime > 0);
  JSONObject instance=getInstance();
  if (!isDone(instance)) {
    throw new TimeoutException(MessageFormat.format("String_Node_Str",instanceUrl,timeout,instance.getString("String_Node_Str")));
  }
}

Fixed version (ground truth):
@Override public void waitForDone(int timeout) throws IncompleteException, IOException {
  long startTime=System.currentTimeMillis();
  long remainingTime=timeout * 60000;
  do {
    if (isDone()) {
      return;
    }
synchronized (waitLock) {
      try {
        waitLock.wait(1000);
      }
 catch (      InterruptedException ex) {
      }
    }
    long currentTime=System.currentTimeMillis();
    remainingTime=remainingTime - (currentTime - startTime);
    startTime=currentTime;
  }
 while (timeout == 0 || remainingTime > 0);
  JSONObject instance=getInstance();
  if (!isDone(instance)) {
    throw new TimeoutException(MessageFormat.format("String_Node_Str",instanceUrl,timeout,instance.getString("String_Node_Str")));
  }
}
Program: 149391
Project: 149391
Buggy source:
public long getCreationTime(){
  return this.creationTime;
}

Fixed version (ground truth):
@Override public long getCreationTime(){
  return this.creationTime;
}
Program: 149392
Project: 149392
Buggy source:
public JSONArray getProfiles(String workspaceId,String boxId) throws IOException {
  if (StringUtils.isBlank(workspaceId)) {
    throw new IOException("String_Node_Str");
  }
  ;
  JSONArray profiles=(JSONArray)doGet(MessageFormat.format("String_Node_Str",endpointUrl,URLEncoder.encode(workspaceId,UTF_8),boxId),true);
  if (!canChange(workspaceId,boxId)) {
    JSONArray versions=getBoxVersions(boxId);
    if (!versions.isEmpty()) {
      Set<String> versionIDs=new HashSet<String>();
      for (      Object version : versions) {
        versionIDs.add(((JSONObject)version).getString("String_Node_Str"));
      }
      JSONArray allProfiles=(JSONArray)doGet(MessageFormat.format("String_Node_Str",endpointUrl,URLEncoder.encode(workspaceId,UTF_8),boxId),true);
      for (      Object json : allProfiles) {
        JSONObject profile=(JSONObject)json;
        if (versionIDs.contains(profile.getJSONObject("String_Node_Str").getString("String_Node_Str"))) {
          profiles.add(profile);
        }
      }
    }
  }
  return profiles;
}

Fixed version (ground truth):
public JSONArray getProfiles(String workspaceId,String boxId) throws IOException {
  if (StringUtils.isBlank(workspaceId)) {
    throw new IOException("String_Node_Str");
  }
  JSONArray profiles=(JSONArray)doGet(MessageFormat.format("String_Node_Str",endpointUrl,URLEncoder.encode(workspaceId,UTF_8),boxId),true);
  if (!canChange(workspaceId,boxId)) {
    JSONArray versions=getBoxVersions(boxId);
    if (!versions.isEmpty()) {
      Set<String> versionIDs=new HashSet<String>();
      for (      Object version : versions) {
        versionIDs.add(((JSONObject)version).getString("String_Node_Str"));
      }
      JSONArray allProfiles=(JSONArray)doGet(MessageFormat.format("String_Node_Str",endpointUrl,URLEncoder.encode(workspaceId,UTF_8),boxId),true);
      for (      Object json : allProfiles) {
        JSONObject profile=(JSONObject)json;
        if (versionIDs.contains(profile.getJSONObject("String_Node_Str").getString("String_Node_Str"))) {
          profiles.add(profile);
        }
      }
    }
  }
  return profiles;
}
Program: 149393
Project: 149393
Buggy source:
public Node call() throws Exception {
  slave.setInUse(true);
  Jenkins.getInstance().addNode(slave);
  IProgressMonitor monitor=ElasticBoxSlaveHandler.submit(slave);
  monitor.waitForDone(slave.getLaunchTimeout());
  if (slave.getComputer() != null && slave.getComputer().isOnline()) {
    return slave;
  }
 else {
    throw new Exception(MessageFormat.format("String_Node_Str",slave.getDisplayName()));
  }
}

Fixed version (ground truth):
public Node call() throws Exception {
  Jenkins.getInstance().addNode(slave);
  IProgressMonitor monitor=ElasticBoxSlaveHandler.submit(slave);
  monitor.waitForDone(slave.getLaunchTimeout());
  if (slave.getComputer() != null && slave.getComputer().isOnline()) {
    return slave;
  }
 else {
    throw new Exception(MessageFormat.format("String_Node_Str",slave.getDisplayName()));
  }
}