nus-yam/ex-repair huggingface dataset:
Program: 10694
Project: 10694
Buggy source:
@Override public IStatus run(IProgressMonitor monitor){
  if (CloudFoundryPlugin.getCallback() != null) {
    CloudFoundryPlugin.getCallback().stopApplicationConsole(appModule,server);
    CloudFoundryPlugin.getCallback().printToConsole(server,appModule,SHOWING_CONSOLE,true,false,monitor);
    CloudFoundryPlugin.getCallback().showCloudFoundryLogs(server,appModule,instanceIndex);
    return Status.OK_STATUS;
  }
 else {
    return CloudFoundryPlugin.getErrorStatus(NO_CALLBACK_UNABLE_TO_REFRESH_CONSOLE);
  }
}

Fixed version (ground truth):
@Override public IStatus run(IProgressMonitor monitor){
  if (CloudFoundryPlugin.getCallback() != null) {
    CloudFoundryPlugin.getCallback().stopApplicationConsole(appModule,server);
    CloudFoundryPlugin.getCallback().printToConsole(server,appModule,Messages.SHOWING_CONSOLE,true,false,monitor);
    CloudFoundryPlugin.getCallback().showCloudFoundryLogs(server,appModule,instanceIndex);
    return Status.OK_STATUS;
  }
 else {
    return CloudFoundryPlugin.getErrorStatus(Messages.ERROR_NO_CALLBACK_UNABLE_TO_REFRESH_CONSOLE);
  }
}
Program: 10695
Project: 10695
Buggy source:
/** 
 * Prepares an application to either be deployed, started or restarted. The main purpose to ensure that the application's deployment information is complete. If incomplete, it will prompt the user for missing information.
 * @param monitor
 * @return Cloud Foundry application mapped to the deployed WST{@link IModule}. Must not be null. If null, it indicates error, therefore throw   {@link CoreException} instead.
 * @throws CoreException if failure while preparing the application for deployment
 * @throws OperationCanceledException if the user cancelled deploying orstarting the application. The application's deployment information should not be modified in this case.
 */
public abstract void prepareForDeployment(CloudFoundryServer server,CloudFoundryApplicationModule module,IProgressMonitor monitor) throws CoreException, OperationCanceledException ;

Fixed version (ground truth):
/** 
 * Prepares an application to either be deployed, started or restarted. The main purpose to ensure that the application's deployment information is complete. If incomplete, it will prompt the user for missing information.
 * @param monitor
 * @return {@link DeploymentConfiguration} Defines local deploymentconfiguration of the application, for example which deployment mode should be used like starting an application, restarting, etc..May be null. If null, the framework will attempt to determine an appropriate deployment configuration.
 * @throws CoreException if failure while preparing the application fordeployment
 * @throws OperationCanceledException if the user cancelled deploying orstarting the application. The application's deployment information should not be modified in this case.
 */
public abstract DeploymentConfiguration prepareForDeployment(CloudFoundryServer server,CloudFoundryApplicationModule module,IProgressMonitor monitor) throws CoreException, OperationCanceledException ;
Program: 10696
Project: 10696
Buggy source:
/** 
 * Show deployed application's  Cloud Foundry log files locally.
 * @param cloudServer
 * @param cloudModule
 * @param showIndex if -1 shows the first app instance
 */
public void showCloudFoundryLogs(CloudFoundryServer cloudServer,CloudFoundryApplicationModule cloudModule,int showIndex){
}

Fixed version (ground truth):
/** 
 * Show deployed application's Cloud Foundry log files locally.
 * @param cloudServer
 * @param cloudModule
 * @param showIndex if -1 shows the first app instance
 */
public void showCloudFoundryLogs(CloudFoundryServer cloudServer,CloudFoundryApplicationModule cloudModule,int showIndex){
}
Program: 10697
Project: 10697
Buggy source:
@Override public void prepareForDeployment(CloudFoundryServer server,CloudFoundryApplicationModule module,IProgressMonitor monitor) throws CoreException {
  throw new OperationCanceledException();
}

Fixed version (ground truth):
@Override public DeploymentConfiguration prepareForDeployment(CloudFoundryServer server,CloudFoundryApplicationModule module,IProgressMonitor monitor) throws CoreException {
  throw new OperationCanceledException();
}
Program: 10698
Project: 10698
Buggy source:
public ApplicationDeploymentInfo getDefaultApplicationDeploymentInfo(CloudFoundryApplicationModule appModule,CloudFoundryServer cloudServer,IProgressMonitor monitor) throws CoreException {
  String appName=appModule.getDeployedApplicationName();
  ApplicationDeploymentInfo deploymentInfo=new ApplicationDeploymentInfo(appName);
  deploymentInfo.setMemory(CloudUtil.DEFAULT_MEMORY);
  deploymentInfo.setDeploymentMode(ApplicationAction.START);
  return deploymentInfo;
}

Fixed version (ground truth):
public ApplicationDeploymentInfo getDefaultApplicationDeploymentInfo(CloudFoundryApplicationModule appModule,CloudFoundryServer cloudServer,IProgressMonitor monitor) throws CoreException {
  String appName=appModule.getDeployedApplicationName();
  ApplicationDeploymentInfo deploymentInfo=new ApplicationDeploymentInfo(appName);
  deploymentInfo.setMemory(CloudUtil.DEFAULT_MEMORY);
  return deploymentInfo;
}
Program: 10700
Project: 10700
Buggy source:
/** 
 * Sets the values of the parameter info, if non-null, into this info. Any know mutable values (e.g. containers and arrays) are set as copies.
 */
public void setInfo(ApplicationDeploymentInfo info){
  if (info == null) {
    return;
  }
  setDeploymentMode(info.getDeploymentMode());
  setDeploymentName(info.getDeploymentName());
  setIncrementalPublish(info.isIncrementalPublish());
  setMemory(info.getMemory());
  setStaging(info.getStaging());
  setInstances(info.getInstances());
  setArchive(info.getArchive());
  if (info.getServices() != null) {
    setServices(new ArrayList<CloudService>(info.getServices()));
  }
 else {
    setServices(null);
  }
  if (info.getUris() != null) {
    setUris(new ArrayList<String>(info.getUris()));
  }
 else {
    setUris(null);
  }
  if (info.getEnvVariables() != null) {
    setEnvVariables(new ArrayList<EnvironmentVariable>(info.getEnvVariables()));
  }
 else {
    setEnvVariables(null);
  }
}

Fixed version (ground truth):
/** 
 * Sets the values of the parameter info, if non-null, into this info. Any know mutable values (e.g. containers and arrays) are set as copies.
 */
public void setInfo(ApplicationDeploymentInfo info){
  if (info == null) {
    return;
  }
  setDeploymentName(info.getDeploymentName());
  setMemory(info.getMemory());
  setStaging(info.getStaging());
  setInstances(info.getInstances());
  setArchive(info.getArchive());
  if (info.getServices() != null) {
    setServices(new ArrayList<CloudService>(info.getServices()));
  }
 else {
    setServices(null);
  }
  if (info.getUris() != null) {
    setUris(new ArrayList<String>(info.getUris()));
  }
 else {
    setUris(null);
  }
  if (info.getEnvVariables() != null) {
    setEnvVariables(new ArrayList<EnvironmentVariable>(info.getEnvVariables()));
  }
 else {
    setEnvVariables(null);
  }
}
Program: 10701
Project: 10701
Buggy source:
/** 
 * Copy the deployment info, with any known mutable values set as copies as well. Therefore, if an info property is a list of values (e.g. list of bound services), modifying the list in the copy will not affect the list of values in the original version.
 * @return non-null copy of this info.
 */
public ApplicationDeploymentInfo copy(){
  ApplicationDeploymentInfo info=new ApplicationDeploymentInfo(getDeploymentName());
  info.setDeploymentMode(getDeploymentMode());
  info.setIncrementalPublish(isIncrementalPublish());
  info.setMemory(getMemory());
  info.setStaging(getStaging());
  info.setInstances(getInstances());
  info.setArchive(getArchive());
  if (getServices() != null) {
    info.setServices(new ArrayList<CloudService>(getServices()));
  }
  if (getUris() != null) {
    info.setUris(new ArrayList<String>(getUris()));
  }
  if (getEnvVariables() != null) {
    info.setEnvVariables(new ArrayList<EnvironmentVariable>(getEnvVariables()));
  }
  return info;
}

Fixed version (ground truth):
/** 
 * Copy the deployment info, with any known mutable values set as copies as well. Therefore, if an info property is a list of values (e.g. list of bound services), modifying the list in the copy will not affect the list of values in the original version.
 * @return non-null copy of this info.
 */
public ApplicationDeploymentInfo copy(){
  ApplicationDeploymentInfo info=new ApplicationDeploymentInfo(getDeploymentName());
  info.setMemory(getMemory());
  info.setStaging(getStaging());
  info.setInstances(getInstances());
  info.setArchive(getArchive());
  if (getServices() != null) {
    info.setServices(new ArrayList<CloudService>(getServices()));
  }
  if (getUris() != null) {
    info.setUris(new ArrayList<String>(getUris()));
  }
  if (getEnvVariables() != null) {
    info.setEnvVariables(new ArrayList<EnvironmentVariable>(getEnvVariables()));
  }
  return info;
}
Program: 10702
Project: 10702
Buggy source:
/** 
 * Creates a general deployment info that should be applicable to any application type. It will have an app name as well as memory setting.
 * @return Non-null general deployment info with basic information forapplication deployment.
 */
protected ApplicationDeploymentInfo createGeneralDefaultInfo(){
  ApplicationDeploymentInfo info=new ApplicationDeploymentInfo(getDeployedApplicationName());
  info.setDeploymentMode(ApplicationAction.START);
  info.setMemory(CloudUtil.DEFAULT_MEMORY);
  return info;
}

Fixed version (ground truth):
/** 
 * Creates a general deployment info that should be applicable to any application type. It will have an app name as well as memory setting.
 * @return Non-null general deployment info with basic information forapplication deployment.
 */
protected ApplicationDeploymentInfo createGeneralDefaultInfo(){
  ApplicationDeploymentInfo info=new ApplicationDeploymentInfo(getDeployedApplicationName());
  info.setMemory(CloudUtil.DEFAULT_MEMORY);
  return info;
}
Program: 10703
Project: 10703
Buggy source:
/** 
 * Maps the application module to an actual deployed application in a CF server. It replaces any existing deployment info with one generated from the cloud application. The existing deployment descriptor remains unchanged if removing the cloud application mapping (i.e. setting to null)
 * @param cloudApplication the actual deployed application in a CF server.
 * @throws CoreException if failure occurred while setting a cloudapplication, or the deployment info is currently being modified by some other component.
 */
public synchronized void setCloudApplication(CloudApplication cloudApplication){
  this.application=cloudApplication;
  if (application != null) {
    ApplicationDeploymentInfo cloudApplicationInfo=resolveDeployedApplicationInformation();
    if (cloudApplicationInfo != null) {
      ApplicationDeploymentInfo currentInfo=getDeploymentInfo();
      if (currentInfo != null) {
        cloudApplicationInfo.setDeploymentMode(currentInfo.getDeploymentMode());
        cloudApplicationInfo.setIncrementalPublish(currentInfo.isIncrementalPublish());
      }
      internalSetDeploymentInfo(cloudApplicationInfo);
    }
  }
}

Fixed version (ground truth):
/** 
 * Maps the application module to an actual deployed application in a CF server. It replaces any existing deployment info with one generated from the cloud application. The existing deployment descriptor remains unchanged if removing the cloud application mapping (i.e. setting to null)
 * @param cloudApplication the actual deployed application in a CF server.
 * @throws CoreException if failure occurred while setting a cloudapplication, or the deployment info is currently being modified by some other component.
 */
public synchronized void setCloudApplication(CloudApplication cloudApplication){
  this.application=cloudApplication;
  if (application != null) {
    ApplicationDeploymentInfo cloudApplicationInfo=resolveDeployedApplicationInformation();
    if (cloudApplicationInfo != null) {
      internalSetDeploymentInfo(cloudApplicationInfo);
    }
  }
}
Program: 10704
Project: 10704
Buggy source:
public void modifyText(ModifyEvent e){
  if (canUpdate) {
    try {
      CloudFoundryApplicationModule appModule=getExistingApplication();
      new UpdateInstanceCountAction(editorPage,instanceSpinner,appModule).run();
    }
 catch (    CoreException ce) {
      logApplicationModuleFailureError("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void modifyText(ModifyEvent e){
  try {
    Integer.parseInt(memoryText.getText());
    logError(null);
  }
 catch (  NumberFormatException nfe) {
    logError(Messages.ERROR_INVALID_MEMORY);
  }
}
Program: 10706
Project: 10706
Buggy source:
@Override public Control createPart(Composite parent){
  Label label=new Label(parent,SWT.NONE);
  label.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,false,false));
  label.setText("String_Node_Str");
  memory=new Text(parent,SWT.BORDER);
  memory.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,false));
  memory.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      setMemory(memory.getText());
    }
  }
);
  return parent;
}

Fixed version (ground truth):
@Override public Control createPart(Composite parent){
  Label label=new Label(parent,SWT.NONE);
  label.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,false,false));
  label.setText(org.cloudfoundry.ide.eclipse.internal.server.ui.Messages.LABEL_MEMORY_LIMIT);
  memory=new Text(parent,SWT.BORDER);
  memory.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,false));
  memory.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      setMemory(memory.getText());
    }
  }
);
  return parent;
}
Program: 10707
Project: 10707
Buggy source:
public void setInput(){
  if (spaceChangeHandler != null && orgsSpacesViewer != null && !orgsSpacesViewer.getTree().isDisposed()) {
    List<CloudOrganization> orgInput=spaceChangeHandler.getCurrentSpacesDescriptor() != null ? spaceChangeHandler.getCurrentSpacesDescriptor().getOrgsAndSpaces().getOrgs() : null;
    if (orgInput == null) {
      orgInput=new ArrayList<CloudOrganization>();
    }
    CloudOrganization[] organizationInput=orgInput.toArray(new CloudOrganization[orgInput.size()]);
    orgsSpacesViewer.setInput(organizationInput);
    orgsSpacesViewer.setExpandedElements(organizationInput);
    CloudSpace selectedSpace=spaceChangeHandler.getCurrentCloudSpace();
    if (selectedSpace == null) {
      selectedSpace=spaceChangeHandler.getCurrentSpacesDescriptor() != null ? spaceChangeHandler.getCurrentSpacesDescriptor().getOrgsAndSpaces().getDefaultCloudSpace() : null;
    }
    if (selectedSpace != null) {
      setSpaceSelection(selectedSpace);
      Tree tree=orgsSpacesViewer.getTree();
      TreeItem[] orgItems=tree.getItems();
      if (orgItems != null) {
        TreeItem orgItem=null;
        for (        TreeItem item : orgItems) {
          Object treeObj=item.getData();
          if (treeObj instanceof CloudOrganization && ((CloudOrganization)treeObj).getName().equals(selectedSpace.getOrganization().getName())) {
            orgItem=item;
            break;
          }
        }
        if (orgItem != null) {
          TreeItem[] children=orgItem.getItems();
          if (children != null) {
            for (            TreeItem childItem : children) {
              Object treeObj=childItem.getData();
              if (treeObj instanceof CloudSpace && ((CloudSpace)treeObj).getName().equals(selectedSpace.getName())) {
                tree.select(childItem);
                break;
              }
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void setInput(){
  if (cloudSpaceServerDelegate != null && orgsSpacesViewer != null && !orgsSpacesViewer.getTree().isDisposed()) {
    List<CloudOrganization> orgInput=cloudSpaceServerDelegate.getCurrentSpacesDescriptor() != null ? cloudSpaceServerDelegate.getCurrentSpacesDescriptor().getOrgsAndSpaces().getOrgs() : null;
    if (orgInput == null) {
      orgInput=new ArrayList<CloudOrganization>();
    }
    CloudOrganization[] organizationInput=orgInput.toArray(new CloudOrganization[orgInput.size()]);
    orgsSpacesViewer.setInput(organizationInput);
    orgsSpacesViewer.setExpandedElements(organizationInput);
    CloudSpace selectedSpace=cloudSpaceServerDelegate.getCurrentCloudSpace();
    if (selectedSpace == null) {
      selectedSpace=cloudSpaceServerDelegate.getCurrentSpacesDescriptor() != null ? cloudSpaceServerDelegate.getCurrentSpacesDescriptor().getOrgsAndSpaces().getDefaultCloudSpace() : null;
    }
    if (selectedSpace != null) {
      setSpaceSelection(selectedSpace);
      setSelectionInViewer(selectedSpace);
    }
    if (orgInput.isEmpty()) {
      notifyStatusChange(CloudFoundryPlugin.getErrorStatus("String_Node_Str"));
    }
  }
}
Program: 10708
Project: 10708
Buggy source:
protected void setSpaceSelection(CloudSpace selectedSpace){
  if (spaceChangeHandler != null) {
    spaceChangeHandler.setSelectedSpace(selectedSpace);
    String errorMessage=selectedSpace == null ? "String_Node_Str" : null;
    IStatus status=errorMessage != null ? CloudFoundryPlugin.getErrorStatus(errorMessage) : Status.OK_STATUS;
    notifyStatusChange(selectedSpace,status);
  }
}

Fixed version (ground truth):
protected void setSpaceSelection(CloudSpace selectedSpace){
  if (cloudSpaceServerDelegate != null) {
    cloudSpaceServerDelegate.setSelectedSpace(selectedSpace);
    String errorMessage=selectedSpace == null ? "String_Node_Str" : null;
    IStatus status=errorMessage != null ? CloudFoundryPlugin.getErrorStatus(errorMessage) : Status.OK_STATUS;
    notifyStatusChange(selectedSpace,status);
  }
}
Program: 10709
Project: 10709
Buggy source:
public Object[] getChildren(Object parentElement){
  if (parentElement instanceof CloudOrganization && spaceChangeHandler != null) {
    CloudSpacesDescriptor spaceDescriptor=spaceChangeHandler.getCurrentSpacesDescriptor();
    if (spaceDescriptor != null) {
      List<CloudSpace> spaces=spaceDescriptor.getOrgsAndSpaces().getOrgSpaces(((CloudOrganization)parentElement).getName());
      if (spaces != null) {
        return spaces.toArray(new CloudSpace[spaces.size()]);
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public Object[] getChildren(Object parentElement){
  if (parentElement instanceof CloudOrganization && cloudSpaceServerDelegate != null) {
    CloudSpacesDescriptor spaceDescriptor=cloudSpaceServerDelegate.getCurrentSpacesDescriptor();
    if (spaceDescriptor != null) {
      List<CloudSpace> spaces=spaceDescriptor.getOrgsAndSpaces().getOrgSpaces(((CloudOrganization)parentElement).getName());
      if (spaces != null) {
        return spaces.toArray(new CloudSpace[spaces.size()]);
      }
    }
  }
  return null;
}
Program: 10710
Project: 10710
Buggy source:
public CloudSpacesSelectionPart(CloudSpaceHandler spaceChangeHandler,IPartChangeListener listener,CloudFoundryServer cloudServer,IWizardHandle wizardHandle){
  this.spaceChangeHandler=spaceChangeHandler;
  if (listener != null) {
    addPartChangeListener(listener);
  }
  String serverTypeId=cloudServer.getServer().getServerType().getId();
  wizardHandle.setTitle("String_Node_Str");
  wizardHandle.setDescription(DEFAULT_DESCRIPTION);
  ImageDescriptor banner=CloudFoundryImages.getWizardBanner(serverTypeId);
  if (banner != null) {
    wizardHandle.setImageDescriptor(banner);
  }
}

Fixed version (ground truth):
public CloudSpacesSelectionPart(CloudServerSpaceDelegate cloudSpaceServerDelegate,IPartChangeListener listener,CloudFoundryServer cloudServer,IWizardHandle wizardHandle){
  this.cloudSpaceServerDelegate=cloudSpaceServerDelegate;
  if (listener != null) {
    addPartChangeListener(listener);
  }
  String serverTypeId=cloudServer.getServer().getServerType().getId();
  wizardHandle.setTitle("String_Node_Str");
  wizardHandle.setDescription(DEFAULT_DESCRIPTION);
  ImageDescriptor banner=CloudFoundryImages.getWizardBanner(serverTypeId);
  if (banner != null) {
    wizardHandle.setImageDescriptor(banner);
  }
}
Program: 10711
Project: 10711
Buggy source:
/** 
 * @param validateCredentials true if credentials should be validated, whichwould require a network I/O request sent to the server. False if only local validation should be performed (e.g. check for malformed URL)
 */
public void updateUI(boolean validateAgainstServer){
  String url=cfServer.getUrl();
  PartChangeEvent validationEvent=validateAndGetEvent(validateAgainstServer);
  boolean valuesFilled=validationEvent.getType() == ServerCredentialsValidationStatics.EVENT_INVALID_SPACE_FILLED_CREDENTIALS || validationEvent.getType() == ServerCredentialsValidationStatics.EVENT_SPACE_VALID;
  if (CloudFoundryURLNavigation.canEnableCloudFoundryNavigation(url)) {
    cfSignupButton.setVisible(true);
  }
 else {
    cfSignupButton.setVisible(false);
  }
  validateButton.setEnabled(valuesFilled);
  registerAccountButton.setEnabled(CloudFoundryBrandingExtensionPoint.supportsRegistration(serverTypeId,url));
  notifyChange(validationEvent);
}

Fixed version (ground truth):
/** 
 * @param validateCredentials true if credentials should be validated, whichwould require a network I/O request sent to the server. False if only local validation should be performed (e.g. check for malformed URL)
 */
public void updateUI(boolean validateAgainstServer){
  String url=cfServer.getUrl();
  PartChangeEvent validationEvent=validateAndGetEvent(validateAgainstServer);
  boolean valuesFilled=validationEvent.getType() == ServerCredentialsValidationStatics.EVENT_CREDENTIALS_FILLED || validationEvent.getType() == ServerCredentialsValidationStatics.EVENT_SPACE_VALID;
  if (CloudFoundryURLNavigation.canEnableCloudFoundryNavigation(url)) {
    cfSignupButton.setVisible(true);
  }
 else {
    cfSignupButton.setVisible(false);
  }
  validateButton.setEnabled(valuesFilled);
  registerAccountButton.setEnabled(CloudFoundryBrandingExtensionPoint.supportsRegistration(serverTypeId,url));
  notifyChange(validationEvent);
}
Program: 10712
Project: 10712
Buggy source:
/** 
 * Handling error has two options: <p/> 1. Retry on error. If a message should be displayed due to the error, that message is returned to be streamed to the console. <p/> 2. Maximum errors reached. Exception is thrown. <p/> If the error is encountered when the stream is no longer active, nothing happens and null is returned.
 * @return a message to be streamed to the console based on the current.error. Or null if no message should be streamed.
 */
protected String handleErrorCount(CoreException ce) throws CoreException {
  if (!isActive()) {
    return null;
  }
  String message=null;
  boolean maxReached=adjustErrorCount();
  if (maxReached) {
    message=reachedMaximumErrors(ce);
    if (message != null) {
      throw new CoreException(CloudFoundryPlugin.getErrorStatus(message,ce));
    }
  }
  if (message == null) {
    message=getMessageOnRetry(ce,attemptsRemaining);
  }
  if (maxReached && message == null) {
    throw ce;
  }
  return message;
}

Fixed version (ground truth):
/** 
 * Handling error has two options: <p/> 1. Retry on error. If a message should be displayed due to the error, that message is returned to be streamed to the console. <p/> 2. Maximum errors reached. Exception is thrown if there is a message associated with the last error that needs to be displayed to the user. Otherwise, the stream deactives itself after maximum errors are reached. <p/> If the error is encountered when the stream is no longer active, nothing happens and null is returned.
 * @return a message to be streamed to the console based on the current.error. Or null if no message should be streamed.
 */
protected String handleErrorCount(CoreException ce) throws CoreException {
  if (!isActive()) {
    return null;
  }
  if (isFatalError(ce)) {
    attemptsRemaining=0;
    throw ce;
  }
  String message=null;
  if (adjustErrorCount()) {
    message=reachedMaximumErrors(ce);
    if (message != null) {
      throw new CoreException(CloudFoundryPlugin.getErrorStatus(message,ce));
    }
  }
  if (message == null) {
    message=getMessageOnRetry(ce,attemptsRemaining);
  }
  return message;
}
Program: 10713
Project: 10713
Buggy source:
/** 
 * Gets invoked when maximum errors have been reached. Return an error message that gets displayed in the console.
 * @param ce
 * @return error message that gets displayed in the console when maximumerrors are reached.
 */
protected String reachedMaximumErrors(CoreException ce){
  return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Gets invoked when maximum errors have been reached. Return an error message that gets displayed in the console.
 * @param ce
 * @return error message that gets displayed in the console when maximumerrors are reached. return Null if nothing should be displayed if maximum errors are reached @
 */
protected String reachedMaximumErrors(CoreException ce){
  return "String_Node_Str";
}
Program: 10714
Project: 10714
Buggy source:
protected void bootRepackage(final IPackageFragmentRoot[] roots,File packagedFile) throws CoreException {
  Repackager bootRepackager=new Repackager(packagedFile);
  try {
    bootRepackager.repackage(new Libraries(){
      @Override public void doWithLibraries(      LibraryCallback callBack) throws IOException {
        for (        IPackageFragmentRoot root : roots) {
          if (root.isArchive()) {
            File rootFile=new File(root.getPath().toOSString());
            if (rootFile.exists()) {
              callBack.library(rootFile,LibraryScope.COMPILE);
            }
          }
        }
      }
    }
);
  }
 catch (  IOException e) {
    handleApplicationDeploymentFailure("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
protected void bootRepackage(final IPackageFragmentRoot[] roots,File packagedFile) throws CoreException {
  Repackager bootRepackager=new Repackager(packagedFile);
  try {
    bootRepackager.repackage(new Libraries(){
      public void doWithLibraries(      LibraryCallback callBack) throws IOException {
        for (        IPackageFragmentRoot root : roots) {
          if (root.isArchive()) {
            File rootFile=new File(root.getPath().toOSString());
            if (rootFile.exists()) {
              callBack.library(rootFile,LibraryScope.COMPILE);
            }
          }
        }
      }
    }
);
  }
 catch (  IOException e) {
    handleApplicationDeploymentFailure("String_Node_Str" + e.getMessage());
  }
}
Program: 10715
Project: 10715
Buggy source:
@Override public void doWithLibraries(LibraryCallback callBack) throws IOException {
  for (  IPackageFragmentRoot root : roots) {
    if (root.isArchive()) {
      File rootFile=new File(root.getPath().toOSString());
      if (rootFile.exists()) {
        callBack.library(rootFile,LibraryScope.COMPILE);
      }
    }
  }
}

Fixed version (ground truth):
public void doWithLibraries(LibraryCallback callBack) throws IOException {
  for (  IPackageFragmentRoot root : roots) {
    if (root.isArchive()) {
      File rootFile=new File(root.getPath().toOSString());
      if (rootFile.exists()) {
        callBack.library(rootFile,LibraryScope.COMPILE);
      }
    }
  }
}
Program: 10716
Project: 10716
Buggy source:
private void updateSections(){
  if (provideServices) {
    List<CloudService> services=editorPage.getServices();
    servicesViewer.setInput((services != null) ? services.toArray() : null);
    if (servicesSection != null && !userExpanded) {
      servicesSection.setExpanded((services == null ? 0 : services.size()) > 0);
      GridDataFactory.fillDefaults().grab(true,servicesSection.isExpanded()).hint(SWT.DEFAULT,servicesSection.isExpanded() ? SWT.DEFAULT : 0).applyTo(servicesSection);
      GridDataFactory.fillDefaults().grab(true,servicesSection.isExpanded()).hint(SWT.DEFAULT,servicesSection.isExpanded() ? SWT.DEFAULT : 0).applyTo(servicesViewer.getControl());
      servicesSection.getParent().layout();
    }
  }
}

Fixed version (ground truth):
private void updateSections(){
  if (provideServices) {
    List<CloudService> services=editorPage.getServices();
    servicesViewer.setInput((services != null) ? services.toArray() : null);
    if (servicesSection != null && !servicesSection.isExpanded()) {
      servicesSection.setExpanded(true);
    }
  }
}
Program: 10718
Project: 10718
Buggy source:
public void setInput(){
  if (cloudSpaceServerDelegate != null && orgsSpacesViewer != null && !orgsSpacesViewer.getTree().isDisposed()) {
    List<CloudOrganization> orgInput=cloudSpaceServerDelegate.getCurrentSpacesDescriptor() != null ? cloudSpaceServerDelegate.getCurrentSpacesDescriptor().getOrgsAndSpaces().getOrgs() : null;
    if (orgInput == null) {
      orgInput=new ArrayList<CloudOrganization>();
    }
    CloudOrganization[] organizationInput=orgInput.toArray(new CloudOrganization[orgInput.size()]);
    orgsSpacesViewer.setInput(organizationInput);
    orgsSpacesViewer.setExpandedElements(organizationInput);
    CloudSpace selectedSpace=cloudSpaceServerDelegate.getCurrentCloudSpace();
    if (selectedSpace == null) {
      selectedSpace=cloudSpaceServerDelegate.getCurrentSpacesDescriptor() != null ? cloudSpaceServerDelegate.getCurrentSpacesDescriptor().getOrgsAndSpaces().getDefaultCloudSpace() : null;
    }
    if (selectedSpace != null) {
      setSpaceSelection(selectedSpace);
      setSelectionInViewer(selectedSpace);
    }
    if (orgInput.isEmpty()) {
      notifyStatusChange(CloudFoundryPlugin.getErrorStatus("String_Node_Str"));
    }
  }
}

Fixed version (ground truth):
public void setInput(){
  if (cloudSpaceServerDelegate != null && orgsSpacesViewer != null && !orgsSpacesViewer.getTree().isDisposed()) {
    List<CloudOrganization> orgInput=cloudSpaceServerDelegate.getCurrentSpacesDescriptor() != null ? cloudSpaceServerDelegate.getCurrentSpacesDescriptor().getOrgsAndSpaces().getOrgs() : null;
    if (orgInput == null) {
      orgInput=new ArrayList<CloudOrganization>();
    }
    CloudOrganization[] organizationInput=orgInput.toArray(new CloudOrganization[orgInput.size()]);
    orgsSpacesViewer.setInput(organizationInput);
    orgsSpacesViewer.setExpandedElements(organizationInput);
    CloudSpace selectedSpace=cloudSpaceServerDelegate.getCurrentCloudSpace();
    if (selectedSpace == null) {
      selectedSpace=cloudSpaceServerDelegate.getCurrentSpacesDescriptor() != null ? cloudSpaceServerDelegate.getCurrentSpacesDescriptor().getOrgsAndSpaces().getDefaultCloudSpace() : null;
    }
    if (selectedSpace != null) {
      setSpaceSelection(selectedSpace);
      setSelectionInViewer(selectedSpace);
    }
    if (orgInput.isEmpty()) {
      notifyStatusChange(CloudFoundryPlugin.getStatus("String_Node_Str",IStatus.INFO));
    }
 else {
      notifyStatusChange(CloudFoundryPlugin.getStatus(DEFAULT_DESCRIPTION,IStatus.OK));
    }
  }
}
Program: 10722
Project: 10722
Buggy source:
/** 
 * Refresh the application modules and reschedules the app module refresh job to execute at certain intervals. This will synch all local application modules with the actual deployed applications. This may be a long running operation.
 * @param monitor
 * @throws CoreException
 */
public void refreshModules(IProgressMonitor monitor) throws CoreException {
synchronized (REFRESH_MODULES) {
    REFRESH_MODULES[0]=true;
  }
  internalRefreshAndFireEvent(monitor);
  restartRefreshJob();
}

Fixed version (ground truth):
/** 
 * Refresh the application modules and reschedules the app module refresh job to execute at certain intervals. This will synch all local application modules with the actual deployed applications. This may be a long running operation.
 * @param monitor
 */
public void refreshModules(IProgressMonitor monitor){
synchronized (REFRESH_MODULES) {
    REFRESH_MODULES[0]=true;
  }
  internalRefreshAndFireEvent(monitor);
  restartRefreshJob();
}
Program: 10723
Project: 10723
Buggy source:
@Override protected IStatus run(IProgressMonitor monitor){
  if (interval > 0) {
    try {
      internalRefreshAndFireEvent(monitor);
      if (getServer().getServerState() == IServer.STATE_STARTED) {
synchronized (BehaviourRefreshJob.this) {
          if (interval > 0) {
            schedule(interval);
          }
        }
      }
    }
 catch (    CoreException e) {
      CloudFoundryPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,CloudFoundryPlugin.PLUGIN_ID,"String_Node_Str" + e.getMessage(),e));
    }
  }
  return Status.OK_STATUS;
}

Fixed version (ground truth):
@Override protected IStatus run(IProgressMonitor monitor){
  if (interval > 0) {
    internalRefreshAndFireEvent(monitor);
    if (getServer().getServerState() == IServer.STATE_STARTED) {
synchronized (BehaviourRefreshJob.this) {
        if (interval > 0) {
          schedule(interval);
        }
      }
    }
  }
  return Status.OK_STATUS;
}
Program: 10724
Project: 10724
Buggy source:
/** 
 * Will fetch the latest list of cloud applications from the server, and update the local module mappings accordingly.
 * @param cloudServer
 * @param monitor
 * @throws CoreException
 * @return true if refresh was performed. False otherwise.
 */
protected boolean internalRefreshModule(IProgressMonitor monitor) throws CoreException {
synchronized (REFRESH_MODULES) {
    if (REFRESH_MODULES[0]) {
      final CloudFoundryServer cloudServer=getCloudFoundryServer();
      List<CloudApplication> applications=getApplications(monitor);
      Map<String,CloudApplication> deployedApplicationsByName=new LinkedHashMap<String,CloudApplication>();
      for (      CloudApplication application : applications) {
        deployedApplicationsByName.put(application.getName(),application);
      }
      cloudServer.updateModules(deployedApplicationsByName);
    }
    return REFRESH_MODULES[0];
  }
}

Fixed version (ground truth):
/** 
 * Will fetch the latest list of cloud applications from the server, and update the local module mappings accordingly.
 * @param cloudServer
 * @param monitor
 * @return true if refresh was performed. False otherwise.
 */
protected boolean internalRefreshModule(IProgressMonitor monitor){
synchronized (REFRESH_MODULES) {
    if (REFRESH_MODULES[0]) {
      try {
        final CloudFoundryServer cloudServer=getCloudFoundryServer();
        List<CloudApplication> applications=getApplications(monitor);
        Map<String,CloudApplication> deployedApplicationsByName=new LinkedHashMap<String,CloudApplication>();
        for (        CloudApplication application : applications) {
          deployedApplicationsByName.put(application.getName(),application);
        }
        cloudServer.updateModules(deployedApplicationsByName);
        return true;
      }
 catch (      Throwable t) {
        CloudFoundryPlugin.logError("String_Node_Str" + t.getMessage(),t);
      }
    }
    return false;
  }
}
Program: 10725
Project: 10725
Buggy source:
/** 
 * Will fetch the latest list of cloud applications from the server, and update local module mappings accordingly. Fires event after refresh operation is complete
 * @param monitor
 * @throws CoreException
 */
protected void internalRefreshAndFireEvent(IProgressMonitor monitor) throws CoreException {
  if (internalRefreshModule(monitor)) {
    ServerEventHandler.getDefault().fireServerRefreshed(getCloudFoundryServer());
  }
}

Fixed version (ground truth):
/** 
 * Will fetch the latest list of cloud applications from the server, and update local module mappings accordingly. Fires event after refresh operation is complete
 * @param monitor
 */
protected void internalRefreshAndFireEvent(IProgressMonitor monitor){
  if (internalRefreshModule(monitor)) {
    try {
      ServerEventHandler.getDefault().fireServerRefreshed(getCloudFoundryServer());
    }
 catch (    CoreException ce) {
      CloudFoundryPlugin.logError("String_Node_Str" + ce.getMessage(),ce);
    }
  }
}
Program: 10726
Project: 10726
Buggy source:
private void update(){
  if (cfServer == null) {
    return;
  }
  Display.getDefault().asyncExec(new Runnable(){
    public void run(){
      nameLabel.setText(cfServer.getServer().getName() + "String_Node_Str");
      int s=cfServer.getServer().getServerState();
      String statusString="String_Node_Str";
      if (s == IServer.STATE_STARTED) {
        statusString="String_Node_Str";
      }
      statusLabel.setText(statusString);
      connectButton.setEnabled(s != IServer.STATE_STARTED);
      disconnectButton.setEnabled(s == IServer.STATE_STARTED);
      composite.layout(true);
    }
  }
);
}

Fixed version (ground truth):
private void update(){
  if (cfServer == null) {
    return;
  }
  Display.getDefault().asyncExec(new Runnable(){
    public void run(){
      if (composite != null && !composite.isDisposed()) {
        nameLabel.setText(cfServer.getServer().getName() + "String_Node_Str");
        int s=cfServer.getServer().getServerState();
        String statusString="String_Node_Str";
        if (s == IServer.STATE_STARTED) {
          statusString="String_Node_Str";
        }
        statusLabel.setText(statusString);
        connectButton.setEnabled(s != IServer.STATE_STARTED);
        disconnectButton.setEnabled(s == IServer.STATE_STARTED);
        composite.layout(true);
      }
    }
  }
);
}
Program: 10727
Project: 10727
Buggy source:
public void run(){
  nameLabel.setText(cfServer.getServer().getName() + "String_Node_Str");
  int s=cfServer.getServer().getServerState();
  String statusString="String_Node_Str";
  if (s == IServer.STATE_STARTED) {
    statusString="String_Node_Str";
  }
  statusLabel.setText(statusString);
  connectButton.setEnabled(s != IServer.STATE_STARTED);
  disconnectButton.setEnabled(s == IServer.STATE_STARTED);
  composite.layout(true);
}

Fixed version (ground truth):
public void run(){
  if (composite != null && !composite.isDisposed()) {
    nameLabel.setText(cfServer.getServer().getName() + "String_Node_Str");
    int s=cfServer.getServer().getServerState();
    String statusString="String_Node_Str";
    if (s == IServer.STATE_STARTED) {
      statusString="String_Node_Str";
    }
    statusLabel.setText(statusString);
    connectButton.setEnabled(s != IServer.STATE_STARTED);
    disconnectButton.setEnabled(s == IServer.STATE_STARTED);
    composite.layout(true);
  }
}
Program: 10728
Project: 10728
Buggy source:
public <T>void handle(BehaviourEvent<T> event){
  if (event == null || event.getType() == null || event.getServer() == null) {
    String message=null;
    if (event == null) {
      message="String_Node_Str";
    }
 else     if (event.getType() == null) {
      message="String_Node_Str";
    }
 else     if (event.getServer() == null) {
      message="String_Node_Str";
    }
    CloudFoundryPlugin.logError("String_Node_Str" + message);
    return;
  }
  CloudFoundryApplicationModule cloudModule=event.getApplicationModule();
  CloudFoundryServer server=event.getServer();
  T resultObj=event.getResult();
switch (event.getType()) {
case APP_PRE_START:
    applicationAboutToStart(server,cloudModule);
  break;
case APP_STARTING:
applicationStarting(server,cloudModule);
break;
case APP_STARTED:
applicationStarted(server,cloudModule);
break;
case APP_STOPPED:
applicationStopped(cloudModule,server);
break;
case APP_DELETE:
deleteApplication(cloudModule,server);
break;
case DISCONNECT:
disconnecting(server);
break;
case PROMPT_CREDENTIALS:
getCredentials(server);
break;
case REFRESH_TUNNEL_CONNECTIONS:
if (resultObj instanceof List<?>) {
displayCaldecottTunnelConnections(server,(List<CaldecottTunnelDescriptor>)resultObj);
}
break;
case SERVICES_DELETED:
if (resultObj instanceof List<?>) {
deleteServices((List<String>)resultObj,server);
}
break;
}
}

Fixed version (ground truth):
public <T>void handle(BehaviourEvent<T> event){
  if (event == null || event.getType() == null || event.getServer() == null) {
    String message=null;
    if (event == null) {
      message="String_Node_Str";
    }
 else     if (event.getType() == null) {
      message="String_Node_Str";
    }
 else     if (event.getServer() == null) {
      message="String_Node_Str";
    }
    CloudFoundryPlugin.logError("String_Node_Str" + message);
    return;
  }
  CloudFoundryApplicationModule cloudModule=event.getApplicationModule();
  CloudFoundryServer server=event.getServer();
  T resultObj=event.getResult();
switch (event.getType()) {
case APP_PRE_START:
    applicationAboutToStart(server,cloudModule);
  break;
case APP_STARTING:
applicationStarting(server,cloudModule);
break;
case APP_STARTED:
applicationStarted(server,cloudModule);
break;
case APP_STOPPED:
stopApplicationConsole(cloudModule,server);
break;
case APP_DELETE:
deleteApplication(cloudModule,server);
break;
case DISCONNECT:
disconnecting(server);
break;
case PROMPT_CREDENTIALS:
getCredentials(server);
break;
case REFRESH_TUNNEL_CONNECTIONS:
if (resultObj instanceof List<?>) {
displayCaldecottTunnelConnections(server,(List<CaldecottTunnelDescriptor>)resultObj);
}
break;
case SERVICES_DELETED:
if (resultObj instanceof List<?>) {
deleteServices((List<String>)resultObj,server);
}
break;
}
}
Program: 10729
Project: 10729
Buggy source:
public Collection<CloudFoundryApplicationModule> getExistingCloudModules(){
  return getData() != null ? getData().getExistingCloudModules() : new ArrayList<CloudFoundryApplicationModule>(0);
}

Fixed version (ground truth):
/** 
 * Does not refresh the list of application modules. Returns the cached list, which may be empty.
 * @return never null. May be empty
 */
public Collection<CloudFoundryApplicationModule> getExistingCloudModules(){
  return getData() != null ? getData().getExistingCloudModules() : new ArrayList<CloudFoundryApplicationModule>(0);
}
Program: 10730
Project: 10730
Buggy source:
public synchronized Collection<CloudFoundryApplicationModule> getExistingCloudModules(){
  return new ArrayList<CloudFoundryApplicationModule>(cloudModules);
}

Fixed version (ground truth):
/** 
 * @return never null. May be empty
 */
public synchronized Collection<CloudFoundryApplicationModule> getExistingCloudModules(){
  return new ArrayList<CloudFoundryApplicationModule>(cloudModules);
}
Program: 10731
Project: 10731
Buggy source:
public void disconnect(IProgressMonitor monitor) throws CoreException {
  CloudFoundryPlugin.getCallback().disconnecting(getCloudFoundryServer());
  Server server=(Server)getServer();
  server.setServerState(IServer.STATE_STOPPING);
  stopRefreshModules();
  CloudFoundryServer cloudServer=getCloudFoundryServer();
  Set<CloudFoundryApplicationModule> deletedModules=new HashSet<CloudFoundryApplicationModule>(cloudServer.getExistingCloudModules());
  cloudServer.clearApplications();
  server.setExternalModules(new IModule[0]);
  for (  CloudFoundryApplicationModule module : deletedModules) {
    server.setModuleState(new IModule[]{module.getLocalModule()},IServer.STATE_UNKNOWN);
  }
  server.setServerState(IServer.STATE_STOPPED);
  server.setServerPublishState(IServer.PUBLISH_STATE_NONE);
  closeCaldecottTunnels(monitor);
}

Fixed version (ground truth):
public void disconnect(IProgressMonitor monitor) throws CoreException {
  CloudFoundryPlugin.getCallback().disconnecting(getCloudFoundryServer());
  Server server=(Server)getServer();
  server.setServerState(IServer.STATE_STOPPING);
  stopRefreshModules();
  CloudFoundryServer cloudServer=getCloudFoundryServer();
  Collection<CloudFoundryApplicationModule> cloudModules=cloudServer.getExistingCloudModules();
  for (  CloudFoundryApplicationModule appModule : cloudModules) {
    CloudFoundryPlugin.getCallback().stopApplicationConsole(appModule,cloudServer);
  }
  Set<CloudFoundryApplicationModule> deletedModules=new HashSet<CloudFoundryApplicationModule>(cloudModules);
  cloudServer.clearApplications();
  server.setExternalModules(new IModule[0]);
  for (  CloudFoundryApplicationModule module : deletedModules) {
    server.setModuleState(new IModule[]{module.getLocalModule()},IServer.STATE_UNKNOWN);
  }
  server.setServerState(IServer.STATE_STOPPED);
  server.setServerPublishState(IServer.PUBLISH_STATE_NONE);
  closeCaldecottTunnels(monitor);
}
Program: 10732
Project: 10732
Buggy source:
protected void performOperation(IProgressMonitor monitor) throws CoreException {
  appModule=prepareForDeployment(monitor);
  IStatus validationStatus=appModule.validateDeploymentInfo();
  if (!validationStatus.isOK()) {
    throw CloudErrorUtil.toCoreException("String_Node_Str" + appModule.getDeployedApplicationName() + ERROR_RESULT_MESSAGE+ "String_Node_Str"+ validationStatus.getMessage());
  }
  try {
    CloudFoundryServer cloudServer=getCloudFoundryServer();
    boolean debug=appModule.getDeploymentInfo().getDeploymentMode() == ApplicationAction.DEBUG;
    performDeployment(appModule,monitor);
    if (debug) {
      new DebugCommandBuilder(modules,cloudServer).getDebugCommand(ApplicationAction.CONNECT_TO_DEBUGGER,null).run(monitor);
    }
    if (TunnelBehaviour.isCaldecottApp(appModule.getDeployedApplicationName())) {
      new TunnelBehaviour(cloudServer).stopAndDeleteAllTunnels(monitor);
    }
    internalUpdateApplicationInstanceStats(appModule,monitor);
  }
 catch (  OperationCanceledException e) {
    ((Server)getServer()).setModuleState(modules,IServer.STATE_UNKNOWN);
  }
}

Fixed version (ground truth):
protected void performOperation(IProgressMonitor monitor) throws CoreException {
  appModule=prepareForDeployment(monitor);
  IStatus validationStatus=appModule.validateDeploymentInfo();
  if (!validationStatus.isOK()) {
    throw CloudErrorUtil.toCoreException("String_Node_Str" + appModule.getDeployedApplicationName() + ERROR_RESULT_MESSAGE+ "String_Node_Str"+ validationStatus.getMessage());
  }
  try {
    CloudFoundryServer cloudServer=getCloudFoundryServer();
    CloudFoundryPlugin.getCallback().stopApplicationConsole(appModule,cloudServer);
    boolean debug=appModule.getDeploymentInfo().getDeploymentMode() == ApplicationAction.DEBUG;
    performDeployment(appModule,monitor);
    if (debug) {
      new DebugCommandBuilder(modules,cloudServer).getDebugCommand(ApplicationAction.CONNECT_TO_DEBUGGER,null).run(monitor);
    }
    if (TunnelBehaviour.isCaldecottApp(appModule.getDeployedApplicationName())) {
      new TunnelBehaviour(cloudServer).stopAndDeleteAllTunnels(monitor);
    }
    internalUpdateApplicationInstanceStats(appModule,monitor);
  }
 catch (  OperationCanceledException e) {
    ((Server)getServer()).setModuleState(modules,IServer.STATE_UNKNOWN);
  }
}