nus-yam/ex-repair huggingface dataset:
Program: 10733
Project: 10733
Buggy source:
public ApplicationOperation getStopAppOperation(IModule[] modules){
  return new ApplicationOperation(modules){
    @Override protected void performDeployment(    CloudFoundryApplicationModule appModule,    IProgressMonitor monitor) throws CoreException {
      Server server=(Server)getServer();
      boolean succeeded=false;
      try {
        server.setModuleState(modules,IServer.STATE_STOPPING);
        CloudFoundryServer cloudServer=getCloudFoundryServer();
        final CloudFoundryApplicationModule cloudModule=cloudServer.getExistingCloudModule(modules[0]);
        if (cloudModule == null) {
          throw CloudErrorUtil.toCoreException("String_Node_Str" + modules[0].getName());
        }
        new Request<Void>(){
          @Override protected Void doRun(          CloudFoundryOperations client,          SubMonitor progress) throws CoreException {
            client.stopApplication(cloudModule.getDeployedApplicationName());
            return null;
          }
        }
.run(monitor);
        server.setModuleState(modules,IServer.STATE_STOPPED);
        succeeded=true;
        CloudFoundryPlugin.getCallback().applicationStopped(cloudModule,cloudServer);
        if (TunnelBehaviour.isCaldecottApp(cloudModule.getDeployedApplicationName())) {
          TunnelBehaviour handler=new TunnelBehaviour(cloudServer);
          handler.stopAndDeleteAllTunnels(monitor);
        }
      }
  finally {
        if (!succeeded) {
          server.setModuleState(modules,IServer.STATE_UNKNOWN);
        }
      }
    }
  }
;
}

Fixed version (ground truth):
public ApplicationOperation getStopAppOperation(IModule[] modules){
  return new ApplicationOperation(modules){
    @Override protected void performDeployment(    CloudFoundryApplicationModule appModule,    IProgressMonitor monitor) throws CoreException {
      Server server=(Server)getServer();
      boolean succeeded=false;
      try {
        server.setModuleState(modules,IServer.STATE_STOPPING);
        CloudFoundryServer cloudServer=getCloudFoundryServer();
        final CloudFoundryApplicationModule cloudModule=cloudServer.getExistingCloudModule(modules[0]);
        if (cloudModule == null) {
          throw CloudErrorUtil.toCoreException("String_Node_Str" + modules[0].getName());
        }
        new Request<Void>(){
          @Override protected Void doRun(          CloudFoundryOperations client,          SubMonitor progress) throws CoreException {
            client.stopApplication(cloudModule.getDeployedApplicationName());
            return null;
          }
        }
.run(monitor);
        server.setModuleState(modules,IServer.STATE_STOPPED);
        succeeded=true;
        CloudFoundryPlugin.getCallback().stopApplicationConsole(cloudModule,cloudServer);
        if (TunnelBehaviour.isCaldecottApp(cloudModule.getDeployedApplicationName())) {
          TunnelBehaviour handler=new TunnelBehaviour(cloudServer);
          handler.stopAndDeleteAllTunnels(monitor);
        }
      }
  finally {
        if (!succeeded) {
          server.setModuleState(modules,IServer.STATE_UNKNOWN);
        }
      }
    }
  }
;
}
Program: 10734
Project: 10734
Buggy source:
@Override public void deleteApplication(CloudFoundryApplicationModule cloudModule,CloudFoundryServer cloudServer){
  applicationStopped(cloudModule,cloudServer);
}

Fixed version (ground truth):
@Override public void deleteApplication(CloudFoundryApplicationModule cloudModule,CloudFoundryServer cloudServer){
  stopApplicationConsole(cloudModule,cloudServer);
}
Program: 10735
Project: 10735
Buggy source:
public abstract void stopApplicationConsole(CloudFoundryApplicationModule cloudModule,CloudFoundryServer cloudServer);

Fixed version (ground truth):
/** 
 * Stops all consoles for the given application for all application instances.
 * @param cloudModule
 * @param cloudServer
 */
public abstract void stopApplicationConsole(CloudFoundryApplicationModule cloudModule,CloudFoundryServer cloudServer);
Program: 10736
Project: 10736
Buggy source:
/** 
 * This will restart an application in run mode. It does not restart an application in debug mode. Does not push application resources or create the application. The application must exist in the CloudFoundry server.
 * @param modules
 * @throws CoreException
 */
public ApplicationOperation getRestartOperation(IModule[] modules) throws CoreException {
  return new RestartOperation(modules);
}

Fixed version (ground truth):
/** 
 * This will restart an application in run mode. It does not restart an application in debug mode. Does not push application resources or create the application. The application must exist in the CloudFoundry server.
 * @param modules
 * @throws CoreException
 */
public BehaviourOperation getRestartOperation(IModule[] modules) throws CoreException {
  return new RestartOperation(modules);
}
Program: 10737
Project: 10737
Buggy source:
@Override public void startModule(IModule[] modules,IProgressMonitor monitor) throws CoreException {
  ApplicationOperation operation=getDeployStartApplicationOperation(modules,false);
  operation.run(monitor);
}

Fixed version (ground truth):
@Override public void startModule(IModule[] modules,IProgressMonitor monitor) throws CoreException {
  BehaviourOperation operation=getDeployStartApplicationOperation(modules,false);
  operation.run(monitor);
}
Program: 10738
Project: 10738
Buggy source:
public CloudFoundryApplicationModule startModuleWaitForDeployment(IModule[] modules,IProgressMonitor monitor) throws CoreException {
  ApplicationOperation operation=getDeployStartApplicationOperation(modules,true);
  operation.run(monitor);
  return operation.getApplicationModule();
}

Fixed version (ground truth):
public CloudFoundryApplicationModule startModuleWaitForDeployment(IModule[] modules,IProgressMonitor monitor) throws CoreException {
  ApplicationOperation operation=internalGetDeployStartApplicationOperation(modules,true);
  operation.run(monitor);
  return operation.getApplicationModule();
}
Program: 10739
Project: 10739
Buggy source:
/** 
 * Update restart republishes redeploys the application with changes. This is not the same as restarting an application which simply restarts the application in its current server version without receiving any local changes. It will only update restart an application in regular run mode. It does not support debug mode.Publishing of changes is done incrementally.
 * @param modules
 * @param isIncrementalPublishing true if optimised incremental publishingshould be enabled. False otherwise
 * @throws CoreException
 */
public ApplicationOperation getUpdateRestartOperation(IModule[] modules,boolean isIncrementalPublishing) throws CoreException {
  return getDeployStartApplicationOperation(isIncrementalPublishing,modules,false);
}

Fixed version (ground truth):
/** 
 * Update restart republishes redeploys the application with changes. This is not the same as restarting an application which simply restarts the application in its current server version without receiving any local changes. It will only update restart an application in regular run mode. It does not support debug mode.Publishing of changes is done incrementally.
 * @param modules
 * @param isIncrementalPublishing true if optimised incremental publishingshould be enabled. False otherwise
 * @throws CoreException
 */
public BehaviourOperation getUpdateRestartOperation(IModule[] modules,boolean isIncrementalPublishing) throws CoreException {
  return getDeployStartApplicationOperation(isIncrementalPublishing,modules,false);
}
Program: 10740
Project: 10740
Buggy source:
@Override public void applicationStarted(final CloudFoundryServer server,final CloudFoundryApplicationModule cloudModule){
  for (int i=0; i < cloudModule.getApplication().getInstances(); i++) {
    boolean shouldClearConsole=false;
    ConsoleContents content=ConsoleContents.getStandardLogContent(server,cloudModule.getApplication(),i);
    ConsoleManager.getInstance().startConsole(server,content,cloudModule.getApplication(),i,i == 0,shouldClearConsole);
  }
}

Fixed version (ground truth):
@Override public void applicationStarted(final CloudFoundryServer server,final CloudFoundryApplicationModule cloudModule){
  startApplicationConsole(server,cloudModule,0);
}
Program: 10741
Project: 10741
Buggy source:
public ShowConsoleAction(CloudFoundryServer server,CloudApplication app,int instanceIndex){
  this.server=server;
  this.app=app;
  this.instanceIndex=instanceIndex;
  setText("String_Node_Str");
}

Fixed version (ground truth):
public ShowConsoleAction(CloudFoundryServer server,CloudFoundryApplicationModule appModule,int instanceIndex){
  this.server=server;
  this.appModule=appModule;
  this.instanceIndex=instanceIndex;
  setText("String_Node_Str");
}
Program: 10742
Project: 10742
Buggy source:
@Override public void run(){
  ConsoleContents content=ConsoleContents.getStandardLogContent(server,app,instanceIndex);
  ConsoleManager.getInstance().startConsole(server,content,app,instanceIndex,true,true);
}

Fixed version (ground truth):
@Override public void run(){
  if (CloudFoundryPlugin.getCallback() != null) {
    CloudFoundryPlugin.getCallback().stopApplicationConsole(appModule,server);
    CloudFoundryPlugin.getCallback().startApplicationConsole(server,appModule,instanceIndex);
  }
 else {
    CloudFoundryPlugin.logError("String_Node_Str");
  }
}
Program: 10744
Project: 10744
Buggy source:
private void fillInstancesContextMenu(IMenuManager manager){
  IStructuredSelection selection=(IStructuredSelection)instancesViewer.getSelection();
  if (selection.isEmpty()) {
    return;
  }
  Object instanceObject=selection.getFirstElement();
  if (instanceObject instanceof InstanceStatsAndInfo) {
    InstanceStats stats=((InstanceStatsAndInfo)instanceObject).getStats();
    if (stats != null) {
      try {
        CloudFoundryApplicationModule appModule=getExistingApplication();
        manager.add(new ShowConsoleAction(cloudServer,appModule.getApplication(),Integer.parseInt(stats.getId())));
      }
 catch (      CoreException ce) {
        logApplicationModuleFailureError("String_Node_Str");
      }
catch (      NumberFormatException e) {
      }
    }
  }
}

Fixed version (ground truth):
private void fillInstancesContextMenu(IMenuManager manager){
  IStructuredSelection selection=(IStructuredSelection)instancesViewer.getSelection();
  if (selection.isEmpty()) {
    return;
  }
  Object instanceObject=selection.getFirstElement();
  if (instanceObject instanceof InstanceStatsAndInfo) {
    InstanceStats stats=((InstanceStatsAndInfo)instanceObject).getStats();
    if (stats != null) {
      try {
        CloudFoundryApplicationModule appModule=getExistingApplication();
        manager.add(new ShowConsoleAction(cloudServer,appModule,Integer.parseInt(stats.getId())));
      }
 catch (      CoreException ce) {
        logApplicationModuleFailureError("String_Node_Str");
      }
catch (      NumberFormatException e) {
      }
    }
  }
}
Program: 10745
Project: 10745
Buggy source:
@Override public void enter(){
  initServer();
  credentialsPart.setServer(cloudServer);
  if (validator != null && wizardListener != null) {
    ValidationStatus lastStatus=validator.validate(false);
    wizardListener.handleChange(lastStatus.getStatus());
  }
}

Fixed version (ground truth):
@Override public void enter(){
  initServer();
  credentialsPart.setServer(cloudServer);
  if (validator != null && wizardListener != null) {
    ValidationStatus lastStatus=validator.getPreviousValidationStatus();
    if (lastStatus == null || lastStatus.getStatus().getSeverity() != IStatus.ERROR) {
      lastStatus=validator.validate(false);
    }
    wizardListener.handleChange(lastStatus.getStatus());
  }
}
Program: 10746
Project: 10746
Buggy source:
@Override public void performFinish(IProgressMonitor monitor) throws CoreException {
  if (!validator.isValid()) {
    final IStatus[] validationStatus={Status.OK_STATUS};
    Display.getDefault().syncExec(new Runnable(){
      public void run(){
        ValidationStatus status=validator.validate(true);
        validationStatus[0]=status.getStatus();
      }
    }
);
    if (!validationStatus[0].isOK()) {
      throw new CoreException(validationStatus[0]);
    }
  }
  ServerLifecycleAdapter listener=new ServerLifecycleAdapter(){
    @Override public void serverAdded(    IServer server){
      ServerCore.removeServerLifecycleListener(this);
      Job job=new ConnectJob(cloudServer,server);
      job.schedule(500L);
    }
  }
;
  ServerCore.addServerLifecycleListener(listener);
}

Fixed version (ground truth):
@Override public void performFinish(IProgressMonitor monitor) throws CoreException {
  if (!validator.validate(false).getStatus().isOK()) {
    final IStatus[] validationStatus={Status.OK_STATUS};
    Display.getDefault().syncExec(new Runnable(){
      public void run(){
        ValidationStatus status=validator.validate(true);
        validationStatus[0]=status.getStatus();
      }
    }
);
    if (!validationStatus[0].isOK()) {
      throw new CoreException(validationStatus[0]);
    }
  }
  ServerLifecycleAdapter listener=new ServerLifecycleAdapter(){
    @Override public void serverAdded(    IServer server){
      ServerCore.removeServerLifecycleListener(this);
      Job job=new ConnectJob(cloudServer,server);
      job.schedule(500L);
    }
  }
;
  ServerCore.addServerLifecycleListener(listener);
}
Program: 10747
Project: 10747
Buggy source:
protected boolean hasManifest(){
  File file=getFile();
  return file != null && file.exists();
}

Fixed version (ground truth):
/** 
 * @return true if the application has an accessible manifest file thatexists. False otherwise, even if the application does have a manifest file. A false in this case would mean the file is not accessible.
 */
public boolean hasManifest(){
  File file=getFile();
  return file != null && file.exists();
}
Program: 10748
Project: 10748
Buggy source:
/** 
 * Schedules the refresh job after the given interval. If the job it will complete before scheduling the next refresh.
 * @param initialWait how long the job should wait before starting. Ifzero or less, interval will be used as the starting wait time.
 * @param interval how long to wait before the job runs again
 */
public void reschedule(long initialWait,long interval){
  this.interval=interval;
  if (interval > 0) {
    long initial=initialWait > 0 ? initialWait : interval;
    schedule(initial);
  }
}

Fixed version (ground truth):
/** 
 * Schedules the refresh job after the given interval. If the job it will complete before scheduling the next refresh.
 * @param initialWait how long the job should wait before starting. Ifzero or less, interval will be used as the starting wait time.
 * @param interval how long to wait before the job runs again
 */
public void reschedule(long initialWait,long interval){
synchronized (BehaviourRefreshJob.this) {
    this.interval=interval;
    if (interval > 0) {
      long initial=initialWait > 0 ? initialWait : interval;
      schedule(initial);
    }
  }
}
Program: 10749
Project: 10749
Buggy source:
public DeploymentConfiguration getDeploymentConfiguration(IProgressMonitor monitor) throws CoreException {
  return new Request<DeploymentConfiguration>("String_Node_Str"){
    @Override protected DeploymentConfiguration doRun(    CloudFoundryOperations client,    SubMonitor progress) throws CoreException {
      DeploymentConfiguration configuration=new DeploymentConfiguration(getApplicationMemoryChoices());
      client.getServices();
      return configuration;
    }
  }
.run(monitor);
}

Fixed version (ground truth):
public DeploymentConfiguration getDeploymentConfiguration(IProgressMonitor monitor) throws CoreException {
  return new Request<DeploymentConfiguration>("String_Node_Str"){
    @Override protected DeploymentConfiguration doRun(    CloudFoundryOperations client,    SubMonitor progress) throws CoreException {
      DeploymentConfiguration configuration=new DeploymentConfiguration(client.getApplicationMemoryChoices());
      client.getServices();
      return configuration;
    }
  }
.run(monitor);
}
Program: 10750
Project: 10750
Buggy source:
public int[] getApplicationMemoryChoices(){
  if (client != null) {
    return client.getApplicationMemoryChoices();
  }
  return new int[0];
}

Fixed version (ground truth):
public int[] getApplicationMemoryChoices(IProgressMonitor monitor) throws CoreException {
  return new Request<int[]>("String_Node_Str"){
    @Override protected int[] doRun(    CloudFoundryOperations client,    SubMonitor progress) throws CoreException {
      return client.getApplicationMemoryChoices();
    }
  }
.run(monitor);
}
Program: 10751
Project: 10751
Buggy source:
/** 
 * @return an updated cloud application module. If it did not previouslyexist, it will attempt to create it. Never null as requesting an app module during the lifecycle of the editor should always result in non-null app.
 * @throws CoreException if application does not exist
 */
protected CloudFoundryApplicationModule getUpdatedApplication() throws CoreException {
  CloudFoundryApplicationModule appModule=cloudServer.getCloudModule(module);
  if (appModule == null) {
    String errorMessage="String_Node_Str" + module.getId();
    throw CloudErrorUtil.toCoreException(errorMessage);
  }
  return appModule;
}

Fixed version (ground truth):
/** 
 * @return an updated cloud application module. If it did not previouslyexist, it will attempt to create it. Never null as requesting an app module during the lifecycle of the editor should always result in non-null app.
 * @throws CoreException if application does not exist
 */
protected CloudFoundryApplicationModule getUpdatedApplication() throws CoreException {
  CloudFoundryApplicationModule appModule=cloudServer.getCloudModule(module);
  if (appModule == null) {
    String errorMessage="String_Node_Str" + (module != null ? "String_Node_Str" + module.getId() : "String_Node_Str");
    throw CloudErrorUtil.toCoreException(errorMessage);
  }
  return appModule;
}
Program: 10754
Project: 10754
Buggy source:
/** 
 * @return an existing cloud application module. Should not be null duringthe lifecycle of the editor.
 * @throws CoreException if application module was not resolved.
 */
protected CloudFoundryApplicationModule getExistingApplication() throws CoreException {
  CloudFoundryApplicationModule appModule=cloudServer.getExistingCloudModule(module);
  if (appModule == null) {
    String errorMessage="String_Node_Str" + module.getId();
    throw CloudErrorUtil.toCoreException(errorMessage);
  }
  return appModule;
}

Fixed version (ground truth):
/** 
 * @return an existing cloud application module. Should not be null duringthe lifecycle of the editor.
 * @throws CoreException if application module was not resolved.
 */
protected CloudFoundryApplicationModule getExistingApplication() throws CoreException {
  CloudFoundryApplicationModule appModule=cloudServer.getExistingCloudModule(module);
  if (appModule == null) {
    String errorMessage="String_Node_Str" + (module != null ? "String_Node_Str" + module.getId() : "String_Node_Str");
    throw CloudErrorUtil.toCoreException(errorMessage);
  }
  return appModule;
}
Program: 10755
Project: 10755
Buggy source:
private void refresh(final IServer server){
  UIJob job=new UIJob("String_Node_Str"){
    @Override public IStatus runInUIThread(    IProgressMonitor monitor){
      try {
        if (server != null) {
          CloudFoundryServer cloudServer=(CloudFoundryServer)server.loadAdapter(CloudFoundryServer.class,monitor);
          if (cloudServer != null) {
            setServices(cloudServer.getBehaviour().getServices(monitor));
            setApplicationMemoryChoices(cloudServer.getBehaviour().getApplicationMemoryChoices());
          }
        }
        if (mform != null && mform.getForm() != null && !mform.getForm().isDisposed()) {
          masterDetailsBlock.refreshUI(RefreshArea.ALL);
        }
      }
 catch (      CoreException e) {
        return e.getStatus();
      }
      return Status.OK_STATUS;
    }
  }
;
  job.schedule();
}

Fixed version (ground truth):
private void refresh(final IServer server){
  UIJob job=new UIJob("String_Node_Str"){
    @Override public IStatus runInUIThread(    IProgressMonitor monitor){
      try {
        if (server != null) {
          CloudFoundryServer cloudServer=(CloudFoundryServer)server.loadAdapter(CloudFoundryServer.class,monitor);
          if (cloudServer != null) {
            setServices(cloudServer.getBehaviour().getServices(monitor));
            setApplicationMemoryChoices(cloudServer.getBehaviour().getApplicationMemoryChoices(monitor));
          }
        }
        if (mform != null && mform.getForm() != null && !mform.getForm().isDisposed()) {
          masterDetailsBlock.refreshUI(RefreshArea.ALL);
        }
      }
 catch (      CoreException e) {
        return e.getStatus();
      }
      return Status.OK_STATUS;
    }
  }
;
  job.schedule();
}
Program: 10756
Project: 10756
Buggy source:
@Override public IStatus runInUIThread(IProgressMonitor monitor){
  try {
    if (server != null) {
      CloudFoundryServer cloudServer=(CloudFoundryServer)server.loadAdapter(CloudFoundryServer.class,monitor);
      if (cloudServer != null) {
        setServices(cloudServer.getBehaviour().getServices(monitor));
        setApplicationMemoryChoices(cloudServer.getBehaviour().getApplicationMemoryChoices());
      }
    }
    if (mform != null && mform.getForm() != null && !mform.getForm().isDisposed()) {
      masterDetailsBlock.refreshUI(RefreshArea.ALL);
    }
  }
 catch (  CoreException e) {
    return e.getStatus();
  }
  return Status.OK_STATUS;
}

Fixed version (ground truth):
@Override public IStatus runInUIThread(IProgressMonitor monitor){
  try {
    if (server != null) {
      CloudFoundryServer cloudServer=(CloudFoundryServer)server.loadAdapter(CloudFoundryServer.class,monitor);
      if (cloudServer != null) {
        setServices(cloudServer.getBehaviour().getServices(monitor));
        setApplicationMemoryChoices(cloudServer.getBehaviour().getApplicationMemoryChoices(monitor));
      }
    }
    if (mform != null && mform.getForm() != null && !mform.getForm().isDisposed()) {
      masterDetailsBlock.refreshUI(RefreshArea.ALL);
    }
  }
 catch (  CoreException e) {
    return e.getStatus();
  }
  return Status.OK_STATUS;
}
Program: 10758
Project: 10758
Buggy source:
@Override public void stopModule(IModule[] modules,IProgressMonitor monitor) throws CoreException {
  Server server=(Server)getServer();
  boolean succeeded=false;
  try {
    server.setModuleState(modules,IServer.STATE_STOPPING);
    CloudFoundryServer cloudServer=getCloudFoundryServer();
    final CloudFoundryApplicationModule cloudModule=cloudServer.getExistingCloudModule(modules[0]);
    new Request<Void>(){
      @Override protected Void doRun(      CloudFoundryOperations client,      SubMonitor progress) throws CoreException {
        client.stopApplication(cloudModule.getDeployedApplicationName());
        return null;
      }
    }
.run(monitor);
    server.setModuleState(modules,IServer.STATE_STOPPED);
    succeeded=true;
    CloudFoundryPlugin.getCallback().applicationStopped(cloudModule,cloudServer);
    if (TunnelBehaviour.isCaldecottApp(cloudModule.getDeployedApplicationName())) {
      TunnelBehaviour handler=new TunnelBehaviour(cloudServer);
      handler.stopAndDeleteAllTunnels(monitor);
    }
  }
  finally {
    if (!succeeded) {
      server.setModuleState(modules,IServer.STATE_UNKNOWN);
    }
  }
}

Fixed version (ground truth):
@Override public void stopModule(IModule[] modules,IProgressMonitor monitor) throws CoreException {
  Server server=(Server)getServer();
  boolean succeeded=false;
  try {
    server.setModuleState(modules,IServer.STATE_STOPPING);
    CloudFoundryServer cloudServer=getCloudFoundryServer();
    final CloudFoundryApplicationModule cloudModule=cloudServer.getExistingCloudModule(modules[0]);
    if (cloudModule == null) {
      throw CloudErrorUtil.toCoreException("String_Node_Str" + modules[0].getName());
    }
    new Request<Void>(){
      @Override protected Void doRun(      CloudFoundryOperations client,      SubMonitor progress) throws CoreException {
        client.stopApplication(cloudModule.getDeployedApplicationName());
        return null;
      }
    }
.run(monitor);
    server.setModuleState(modules,IServer.STATE_STOPPED);
    succeeded=true;
    CloudFoundryPlugin.getCallback().applicationStopped(cloudModule,cloudServer);
    if (TunnelBehaviour.isCaldecottApp(cloudModule.getDeployedApplicationName())) {
      TunnelBehaviour handler=new TunnelBehaviour(cloudServer);
      handler.stopAndDeleteAllTunnels(monitor);
    }
  }
  finally {
    if (!succeeded) {
      server.setModuleState(modules,IServer.STATE_UNKNOWN);
    }
  }
}
Program: 10760
Project: 10760
Buggy source:
/** 
 * Given a WTP module, the corresponding CF application module will have its app instance stats refreshed. As the application module also has a reference to the actual cloud application, an updated cloud application will be retrieved as well.
 * @param module whos application instances and stats should be refreshed
 * @param monitor
 * @throws CoreException
 */
public void refreshApplicationInstanceStats(IModule module,IProgressMonitor monitor) throws CoreException {
  if (module != null) {
    CloudFoundryApplicationModule appModule=getCloudFoundryServer().getExistingCloudModule(module);
    try {
      CloudApplication application=getApplication(appModule.getDeployedApplicationName(),monitor);
      appModule.setCloudApplication(application);
    }
 catch (    CoreException e) {
    }
    internalUpdateApplicationInstanceStats(appModule,monitor);
  }
}

Fixed version (ground truth):
/** 
 * Given a WTP module, the corresponding CF application module will have its app instance stats refreshed. As the application module also has a reference to the actual cloud application, an updated cloud application will be retrieved as well.
 * @param module whos application instances and stats should be refreshed
 * @param monitor
 * @throws CoreException
 */
public void refreshApplicationInstanceStats(IModule module,IProgressMonitor monitor) throws CoreException {
  if (module != null) {
    CloudFoundryApplicationModule appModule=getCloudFoundryServer().getExistingCloudModule(module);
    if (appModule != null) {
      try {
        CloudApplication application=getApplication(appModule.getDeployedApplicationName(),monitor);
        appModule.setCloudApplication(application);
      }
 catch (      CoreException e) {
      }
      internalUpdateApplicationInstanceStats(appModule,monitor);
    }
  }
}
Program: 10762
Project: 10762
Buggy source:
public void run(){
  CloudFoundryApplicationWizard wizard=new CloudFoundryApplicationWizard(server,appModule,finWorkingCopy,providerDelegate);
  WizardDialog dialog=new WizardDialog(PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(),wizard);
  int status=dialog.open();
  if (status == Dialog.OK) {
    final List<CloudService> addedServices=wizard.getCreatedCloudServices();
    writeToManifest[0]=wizard.persistManifestChanges();
    if (addedServices != null && !addedServices.isEmpty()) {
      IProgressMonitor subMonitor=new SubProgressMonitor(monitor,addedServices.size());
      try {
        server.getBehaviour().createService(addedServices.toArray(new CloudService[0]),subMonitor);
      }
 catch (      CoreException e) {
        CloudFoundryPlugin.log(e);
      }
 finally {
        subMonitor.done();
      }
    }
  }
 else {
    cancelled[0]=true;
  }
}

Fixed version (ground truth):
public void run(){
  CloudFoundryApplicationWizard wizard=new CloudFoundryApplicationWizard(server,appModule,finWorkingCopy,providerDelegate);
  try {
    WizardDialog dialog=new WizardDialog(PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(),wizard);
    int dialogueStatus=dialog.open();
    if (dialogueStatus == Dialog.OK) {
      final List<CloudService> addedServices=wizard.getCreatedCloudServices();
      writeToManifest[0]=wizard.persistManifestChanges();
      if (addedServices != null && !addedServices.isEmpty()) {
        IProgressMonitor subMonitor=new SubProgressMonitor(monitor,addedServices.size());
        try {
          server.getBehaviour().createService(addedServices.toArray(new CloudService[0]),subMonitor);
        }
 catch (        CoreException e) {
          CloudFoundryPlugin.log(e);
        }
 finally {
          subMonitor.done();
        }
      }
    }
 else {
      cancelled[0]=true;
    }
  }
 catch (  Throwable t) {
    cancelled[0]=true;
    status[0]=CloudFoundryPlugin.getErrorStatus(t);
  }
}
Program: 10767
Project: 10767
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();
    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);
  }
}

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);
    }
    try {
      internalUpdateApplicationInstanceStats(appModule,monitor);
    }
 catch (    CoreException e) {
      CloudFoundryPlugin.logError(e);
    }
  }
 catch (  OperationCanceledException e) {
    ((Server)getServer()).setModuleState(modules,IServer.STATE_UNKNOWN);
  }
}
Program: 10769
Project: 10769
Buggy source:
@Override protected IStatus run(IProgressMonitor monitor){
  try {
    serverBehaviour.refreshApplicationBoundServices(appModule,monitor);
    ManifestParser parser=new ManifestParser(appModule,cloudServer);
    parser.write(monitor);
  }
 catch (  CoreException ce) {
    errorStatus[0]=ce.getStatus();
    return errorStatus[0];
  }
  return Status.OK_STATUS;
}

Fixed version (ground truth):
@Override protected IStatus run(IProgressMonitor monitor){
  try {
    serverBehaviour.refreshApplicationBoundServices(appModule,monitor);
    ManifestParser parser=new ManifestParser(appModule,cloudServer);
    parser.write(monitor,null);
  }
 catch (  CoreException ce) {
    errorStatus[0]=ce.getStatus();
    return errorStatus[0];
  }
  return Status.OK_STATUS;
}
Program: 10770
Project: 10770
Buggy source:
protected void writeToManifest(){
  final IStatus[] errorStatus=new IStatus[1];
  try {
    final CloudFoundryApplicationModule appModule=getExistingApplication();
    if (appModule != null && saveManifest != null && !saveManifest.isDisposed()) {
      if (MessageDialog.openConfirm(saveManifest.getShell(),"String_Node_Str","String_Node_Str")) {
        Job job=new Job("String_Node_Str" + appModule.getDeployedApplicationName()){
          @Override protected IStatus run(          IProgressMonitor monitor){
            try {
              serverBehaviour.refreshApplicationBoundServices(appModule,monitor);
              ManifestParser parser=new ManifestParser(appModule,cloudServer);
              parser.write(monitor);
            }
 catch (            CoreException ce) {
              errorStatus[0]=ce.getStatus();
              return errorStatus[0];
            }
            return Status.OK_STATUS;
          }
        }
;
        job.schedule();
      }
    }
 else {
      errorStatus[0]=CloudFoundryPlugin.getErrorStatus("String_Node_Str");
    }
  }
 catch (  CoreException ce) {
    errorStatus[0]=ce.getStatus();
  }
  if (errorStatus[0] != null && !errorStatus[0].isOK()) {
    logError("String_Node_Str" + errorStatus[0].getMessage());
  }
}

Fixed version (ground truth):
protected void writeToManifest(){
  final IStatus[] errorStatus=new IStatus[1];
  try {
    final CloudFoundryApplicationModule appModule=getExistingApplication();
    if (appModule != null && saveManifest != null && !saveManifest.isDisposed()) {
      if (MessageDialog.openConfirm(saveManifest.getShell(),"String_Node_Str","String_Node_Str")) {
        Job job=new Job("String_Node_Str" + appModule.getDeployedApplicationName()){
          @Override protected IStatus run(          IProgressMonitor monitor){
            try {
              serverBehaviour.refreshApplicationBoundServices(appModule,monitor);
              ManifestParser parser=new ManifestParser(appModule,cloudServer);
              parser.write(monitor,null);
            }
 catch (            CoreException ce) {
              errorStatus[0]=ce.getStatus();
              return errorStatus[0];
            }
            return Status.OK_STATUS;
          }
        }
;
        job.schedule();
      }
    }
 else {
      errorStatus[0]=CloudFoundryPlugin.getErrorStatus("String_Node_Str");
    }
  }
 catch (  CoreException ce) {
    errorStatus[0]=ce.getStatus();
  }
  if (errorStatus[0] != null && !errorStatus[0].isOK()) {
    logError("String_Node_Str" + errorStatus[0].getMessage());
  }
}
Program: 10771
Project: 10771
Buggy source:
protected String getContent(IProgressMonitor monitor) throws CoreException {
  String content=null;
  CloudFoundryException cfe=null;
  CoreException error=null;
  try {
    content=server.getBehaviour().getFile(appName,instanceIndex,path,offset,monitor);
    if (content != null) {
      offset+=content.length();
    }
    errorCount=MAX_COUNT;
    return content;
  }
 catch (  CoreException e) {
    error=e;
    Throwable t=e.getCause();
    if (t instanceof CloudFoundryException) {
      cfe=(CloudFoundryException)t;
    }
  }
catch (  CloudFoundryException cfex) {
    error=new CoreException(CloudFoundryPlugin.getErrorStatus(cfe));
    cfe=cfex;
  }
  if (cfe != null && (HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE.equals(cfe.getStatusCode()) || CloudErrorUtil.isFileNotFoundForInstance(cfe))) {
    return null;
  }
  if (adjustCount()) {
    throw error;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
protected String getContent(IProgressMonitor monitor) throws CoreException {
  String content=null;
  CloudFoundryException cfe=null;
  CoreException error=null;
  try {
    content=server.getBehaviour().getFile(appName,instanceIndex,path,offset,monitor);
    if (content != null) {
      offset+=content.length();
    }
    errorCount=MAX_COUNT;
    return content;
  }
 catch (  CoreException e) {
    error=e;
    Throwable t=e.getCause();
    if (t instanceof CloudFoundryException) {
      cfe=(CloudFoundryException)t;
    }
  }
catch (  CloudFoundryException cfex) {
    error=new CoreException(CloudFoundryPlugin.getErrorStatus(cfe));
    cfe=cfex;
  }
  if (cfe != null && (HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE.equals(cfe.getStatusCode()) || CloudErrorUtil.isFileNotFoundForInstance(cfe))) {
    return null;
  }
  if (adjustErrorCount() && !shouldCloseStream()) {
    requestStreamClose(true);
    String actualError=error.getMessage() != null ? error.getMessage() : "String_Node_Str" + path;
    throw new CoreException(CloudFoundryPlugin.getErrorStatus("String_Node_Str" + path + "String_Node_Str"+ actualError,error));
  }
  return null;
}
Program: 10772
Project: 10772
Buggy source:
public void resetClient(){
  client=null;
}

Fixed version (ground truth):
public void resetClient(){
  client=null;
  domainFromOrgs=null;
}
Program: 10773
Project: 10773
Buggy source:
@Override protected void setUrlInDescriptor(String url){
  if (ValueValidationUtil.isEmpty(url)) {
    List<String> urls=new ArrayList<String>();
    descriptor.getDeploymentInfo().setUris(urls);
  }
}

Fixed version (ground truth):
@Override protected void setUrlInDescriptor(String url){
  if (ValueValidationUtil.isEmpty(url)) {
    List<String> urls=new ArrayList<String>();
    descriptor.getDeploymentInfo().setUris(urls);
    return;
  }
  super.setUrlInDescriptor(url);
}
Program: 10774
Project: 10774
Buggy source:
@Override public boolean isPageComplete(){
  boolean isComplete=super.isPageComplete();
  if (isComplete) {
    isComplete=status == null || status.isOK();
  }
  return isComplete;
}

Fixed version (ground truth):
@Override public boolean isPageComplete(){
  boolean isComplete=super.isPageComplete();
  if (isComplete) {
    isComplete=getSelectedCloudSpace() != null && (status == null || status.isOK());
  }
  return isComplete;
}
Program: 10775
Project: 10775
Buggy source:
private IStatus doDeleteModules(final Set<IModule> deletedModules){
  IServerWorkingCopy wc=getServer().createWorkingCopy();
  try {
    deleteServicesOnModuleRemove.set(Boolean.FALSE);
    wc.modifyModules(null,deletedModules.toArray(new IModule[deletedModules.size()]),null);
    wc.save(false,null);
  }
 catch (  CoreException e) {
    CloudFoundryPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,CloudFoundryPlugin.PLUGIN_ID,"String_Node_Str",e));
    return Status.CANCEL_STATUS;
  }
 finally {
    deleteServicesOnModuleRemove.set(Boolean.TRUE);
  }
  return Status.OK_STATUS;
}

Fixed version (ground truth):
private IStatus doDeleteModules(final Set<IModule> deletedModules){
  IServerWorkingCopy wc=getServer().createWorkingCopy();
  try {
    deleteServicesOnModuleRemove.set(Boolean.FALSE);
    wc.modifyModules(null,deletedModules.toArray(new IModule[deletedModules.size()]),null);
    wc.save(true,null);
  }
 catch (  CoreException e) {
    CloudFoundryPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,CloudFoundryPlugin.PLUGIN_ID,"String_Node_Str",e));
    return Status.CANCEL_STATUS;
  }
 finally {
    deleteServicesOnModuleRemove.set(Boolean.TRUE);
  }
  return Status.OK_STATUS;
}
Program: 10776
Project: 10776
Buggy source:
public List<IWizardPage> getWizardPages(ApplicationWizardDescriptor descriptor,CloudFoundryServer cloudServer,CloudFoundryApplicationModule applicationModule){
  List<IWizardPage> defaultPages=new ArrayList<IWizardPage>();
  StandaloneDeploymentWizardPage deploymentPage=new StandaloneDeploymentWizardPage(cloudServer,applicationModule,descriptor,getApplicationUrlLookup());
  CloudFoundryApplicationWizardPage applicationNamePage=new CloudFoundryApplicationWizardPage(cloudServer,deploymentPage,applicationModule,descriptor);
  defaultPages.add(applicationNamePage);
  defaultPages.add(deploymentPage);
  CloudFoundryApplicationServicesWizardPage servicesPage=new CloudFoundryApplicationServicesWizardPage(cloudServer,applicationModule,descriptor);
  defaultPages.add(servicesPage);
  return defaultPages;
}

Fixed version (ground truth):
public List<IWizardPage> getWizardPages(ApplicationWizardDescriptor descriptor,CloudFoundryServer cloudServer,CloudFoundryApplicationModule applicationModule){
  List<IWizardPage> defaultPages=new ArrayList<IWizardPage>();
  StandaloneDeploymentWizardPage deploymentPage=new StandaloneDeploymentWizardPage(cloudServer,applicationModule,descriptor,getApplicationUrlLookup(),this);
  CloudFoundryApplicationWizardPage applicationNamePage=new CloudFoundryApplicationWizardPage(cloudServer,deploymentPage,applicationModule,descriptor);
  defaultPages.add(applicationNamePage);
  defaultPages.add(deploymentPage);
  CloudFoundryApplicationServicesWizardPage servicesPage=new CloudFoundryApplicationServicesWizardPage(cloudServer,applicationModule,descriptor);
  defaultPages.add(servicesPage);
  return defaultPages;
}
Program: 10777
Project: 10777
Buggy source:
public StandaloneDeploymentWizardPage(CloudFoundryServer server,CloudFoundryApplicationModule module,ApplicationWizardDescriptor descriptor,CloudApplicationUrlLookup urlLookup){
  super(server,module,descriptor,urlLookup);
}

Fixed version (ground truth):
public StandaloneDeploymentWizardPage(CloudFoundryServer server,CloudFoundryApplicationModule module,ApplicationWizardDescriptor descriptor,CloudApplicationUrlLookup urlLookup,ApplicationWizardDelegate delegate){
  super(server,module,descriptor,urlLookup,delegate);
}
Program: 10778
Project: 10778
Buggy source:
public PartChangeEvent(Object data,IStatus status,UIPart source){
  this.data=data;
  this.status=status;
  this.source=source;
}

Fixed version (ground truth):
public PartChangeEvent(Object data,IStatus status,UIPart source,int type){
  this.data=data;
  this.status=status;
  this.source=source;
  this.type=type;
}
Program: 10779
Project: 10779
Buggy source:
protected void notifyChange(PartChangeEvent changeEvent){
  if (listener != null) {
    listener.handleChange(changeEvent);
  }
}

Fixed version (ground truth):
protected void notifyChange(PartChangeEvent changeEvent){
  for (  IPartChangeListener listener : listeners) {
    listener.handleChange(changeEvent);
  }
}
Program: 10780
Project: 10780
Buggy source:
public void addPartChangeListener(IPartChangeListener listener){
  this.listener=listener;
}

Fixed version (ground truth):
public void addPartChangeListener(IPartChangeListener listener){
  if (listener != null && !listeners.contains(listener)) {
    listeners.add(listener);
  }
}
Program: 10781
Project: 10781
Buggy source:
public void initialiseWizardDescriptor(ApplicationWizardDescriptor applicationDescriptor,CloudFoundryServer cloudServer,CloudFoundryApplicationModule module){
  urlLookup=CloudApplicationUrlLookup.getCurrentLookup(cloudServer);
  DeploymentInfo deploymentInfo=new DeploymentInfo();
  applicationDescriptor.setDeploymentInfo(deploymentInfo);
  DeploymentInfo lastDeploymentInfo=(module != null) ? module.getLastDeploymentInfo() : null;
  String deploymentName=null;
  if (lastDeploymentInfo != null && lastDeploymentInfo.getDeploymentName() != null) {
    deploymentName=lastDeploymentInfo.getDeploymentName();
  }
 else   if (module != null) {
    deploymentName=module.getDeploymentName();
  }
  deploymentInfo.setDeploymentName(deploymentName);
  deploymentInfo.setMemory(CloudUtil.DEFAULT_MEMORY);
  String appName=null;
  ApplicationInfo lastApplicationInfo=null;
  if (module != null) {
    lastApplicationInfo=module.getLastApplicationInfo();
  }
  if (lastApplicationInfo != null && lastApplicationInfo.getAppName() != null) {
    appName=lastApplicationInfo.getAppName();
  }
 else   if (module != null) {
    appName=module.getDeploymentName();
  }
  if (appName != null) {
    ApplicationInfo appInfo=new ApplicationInfo(appName);
    applicationDescriptor.setApplicationInfo(appInfo);
  }
  applicationDescriptor.setStartDeploymentMode(ApplicationAction.START);
  if (getApplicationDelegate() == null || getApplicationDelegate().requiresURL()) {
    String url=getDefaultURL(lastDeploymentInfo,deploymentName);
    if (url != null) {
      List<String> urls=new ArrayList<String>();
      urls.add(url);
      applicationDescriptor.getDeploymentInfo().setUris(urls);
    }
  }
}

Fixed version (ground truth):
public void initialiseWizardDescriptor(ApplicationWizardDescriptor applicationDescriptor,CloudFoundryServer cloudServer,CloudFoundryApplicationModule module){
  urlLookup=CloudApplicationUrlLookup.getCurrentLookup(cloudServer);
  DeploymentInfo deploymentInfo=new DeploymentInfo();
  applicationDescriptor.setDeploymentInfo(deploymentInfo);
  DeploymentInfo lastDeploymentInfo=(module != null) ? module.getLastDeploymentInfo() : null;
  String deploymentName=null;
  if (lastDeploymentInfo != null && lastDeploymentInfo.getDeploymentName() != null) {
    deploymentName=lastDeploymentInfo.getDeploymentName();
  }
 else   if (module != null) {
    deploymentName=module.getDeploymentName();
  }
  deploymentInfo.setDeploymentName(deploymentName);
  deploymentInfo.setMemory(CloudUtil.DEFAULT_MEMORY);
  String appName=null;
  ApplicationInfo lastApplicationInfo=null;
  if (module != null) {
    lastApplicationInfo=module.getLastApplicationInfo();
  }
  if (lastApplicationInfo != null && lastApplicationInfo.getAppName() != null) {
    appName=lastApplicationInfo.getAppName();
  }
 else   if (module != null) {
    appName=module.getDeploymentName();
  }
  if (appName != null) {
    ApplicationInfo appInfo=new ApplicationInfo(appName);
    applicationDescriptor.setApplicationInfo(appInfo);
  }
  applicationDescriptor.setStartDeploymentMode(ApplicationAction.START);
}
Program: 10782
Project: 10782
Buggy source:
public void setApplicationInfo(ApplicationInfo applicationInfo){
  this.applicationInfo=applicationInfo;
  notifyChanged(applicationInfo,DescriptorProperty.ApplicationInfo);
}

Fixed version (ground truth):
public void setApplicationInfo(ApplicationInfo applicationInfo){
  this.applicationInfo=applicationInfo;
}
Program: 10783
Project: 10783
Buggy source:
public CloudFoundryConsole(CloudApplication app,MessageConsole console){
  super(getConsoleName(app));
  this.console=console;
  setSystem(true);
}

Fixed version (ground truth):
public CloudFoundryConsole(CloudApplication app,MessageConsole console){
  this.app=app;
  this.console=console;
}
Program: 10784
Project: 10784
Buggy source:
@Override protected synchronized IStatus run(IProgressMonitor monitor){
  if (this.tailing) {
    if (activeStreams != null && !activeStreams.isEmpty()) {
      Map<ICloudFoundryConsoleOutputStream,Integer> copy=new HashMap<ICloudFoundryConsoleOutputStream,Integer>(activeStreams);
      for (      Entry<ICloudFoundryConsoleOutputStream,Integer> entry : copy.entrySet()) {
        int count=entry.getValue();
        ICloudFoundryConsoleOutputStream stream=entry.getKey();
        boolean forceClose=false;
        if (!stream.shouldCloseStream()) {
          try {
            stream.write(monitor);
          }
 catch (          CoreException e) {
            Throwable t=e.getCause();
            if (t instanceof IOException) {
              forceClose=true;
            }
            count++;
          }
        }
 else {
          forceClose=true;
        }
        activeStreams.remove(stream);
        if (forceClose || count > 5) {
          try {
            stream.close();
          }
 catch (          IOException ioe) {
          }
        }
 else {
          activeStreams.put(stream,count);
        }
      }
    }
    if (activeStreams != null && !activeStreams.isEmpty()) {
      schedule(sampleInterval);
    }
 else {
      stopTailing();
    }
  }
  return Status.OK_STATUS;
}

Fixed version (ground truth):
@Override protected synchronized IStatus run(IProgressMonitor monitor){
  if (tailing) {
    remove=stream.shouldCloseStream();
    if (!remove) {
      try {
        stream.write(monitor);
      }
 catch (      CoreException e) {
        remove=true;
        CloudFoundryPlugin.logError(e);
      }
    }
    if (remove) {
      tailing(false);
      try {
        stream.close();
      }
 catch (      IOException io) {
        CloudFoundryPlugin.logWarning("String_Node_Str" + name);
      }
    }
 else {
      schedule(sampleInterval);
    }
  }
  return Status.OK_STATUS;
}