nus-yam/ex-repair huggingface dataset:
Program: 10646
Project: 10646
Buggy source:
protected void refreshDeploymentButtons(CloudFoundryApplicationModule appModule){
  if (topButtonRow == null || lowerButtonRow == null || lowerButtonRow.isDisposed() || topButtonRow.isDisposed()) {
    return;
  }
  int state=appModule.getState();
  if (skipButtonRefreshOnRestart) {
    skipButtonRefreshOnRestart=false;
    return;
  }
  if (state == IServer.STATE_STOPPED || state == IServer.STATE_UNKNOWN) {
    pushAppButton.setEnabled(true);
    stopAppButton.setEnabled(false);
    startAppButton.setText(Messages.ApplicationDetailsPart_TEXT_START);
    startAppButton.setImage(ImageResource.getImage(ImageResource.IMG_CLCL_START));
    startAppButton.setToolTipText(Messages.ApplicationDetailsPart_TEXT_START_TOOLTIP);
  }
 else {
    pushAppButton.setEnabled(false);
    stopAppButton.setEnabled(true);
    startAppButton.setText(Messages.ApplicationDetailsPart_TEXT_RESTART);
    startAppButton.setImage(CloudFoundryImages.getImage(CloudFoundryImages.RESTART));
    startAppButton.setToolTipText(Messages.ApplicationDetailsPart_TEXT_RESTART_TOOLTIP);
  }
  if (state == IServer.STATE_STOPPED || state == IServer.STATE_UNKNOWN || !CloudFoundryProperties.isModuleProjectAccessible.testProperty(new IModule[]{module},cloudServer)) {
    updateRestartAppButton.setEnabled(false);
  }
 else {
    updateRestartAppButton.setEnabled(true);
  }
  refreshDebugControls(appModule);
  topButtonRow.getParent().layout(true);
  lowerButtonRow.getParent().layout(true);
}

Fixed version (ground truth):
protected void refreshDeploymentButtons(CloudFoundryApplicationModule appModule){
  if (topButtonRow == null || lowerButtonRow == null || lowerButtonRow.isDisposed() || topButtonRow.isDisposed()) {
    return;
  }
  int state=appModule.getState();
  if (skipButtonRefreshOnRestart) {
    skipButtonRefreshOnRestart=false;
    return;
  }
  if (state == IServer.STATE_STOPPED || state == IServer.STATE_UNKNOWN) {
    stopAppButton.setEnabled(false);
    if (CloudFoundryProperties.isModuleProjectAccessible.testProperty(new IModule[]{module},cloudServer)) {
      pushAppButton.setEnabled(true);
    }
 else {
      pushAppButton.setEnabled(false);
    }
    startAppButton.setText(Messages.ApplicationDetailsPart_TEXT_START);
    startAppButton.setImage(ImageResource.getImage(ImageResource.IMG_CLCL_START));
    startAppButton.setToolTipText(Messages.ApplicationDetailsPart_TEXT_START_TOOLTIP);
  }
 else {
    pushAppButton.setEnabled(false);
    stopAppButton.setEnabled(true);
    startAppButton.setText(Messages.ApplicationDetailsPart_TEXT_RESTART);
    startAppButton.setImage(CloudFoundryImages.getImage(CloudFoundryImages.RESTART));
    startAppButton.setToolTipText(Messages.ApplicationDetailsPart_TEXT_RESTART_TOOLTIP);
  }
  if (state == IServer.STATE_STOPPED || state == IServer.STATE_UNKNOWN || !CloudFoundryProperties.isModuleProjectAccessible.testProperty(new IModule[]{module},cloudServer)) {
    updateRestartAppButton.setEnabled(false);
  }
 else {
    updateRestartAppButton.setEnabled(true);
  }
  refreshDebugControls(appModule);
  topButtonRow.getParent().layout(true);
  lowerButtonRow.getParent().layout(true);
}
Program: 10649
Project: 10649
Buggy source:
public IStatus isValid(String url){
  String errorMessage=null;
  if (ValueValidationUtil.isEmpty(url)) {
    errorMessage=EMPTY_URL_ERROR;
  }
 else   if (new URLNameValidation(url).hasInvalidCharacters()) {
    errorMessage=INVALID_CHARACTERS_ERROR;
  }
  IStatus status=errorMessage != null ? CloudFoundryPlugin.getErrorStatus(errorMessage) : Status.OK_STATUS;
  return status;
}

Fixed version (ground truth):
public IStatus isValid(String url){
  String errorMessage=null;
  if (ValueValidationUtil.isEmpty(url)) {
    errorMessage=Messages.EMPTY_URL_ERROR;
  }
 else   if (new URLNameValidation(url).hasInvalidCharacters()) {
    errorMessage=Messages.INVALID_CHARACTERS_ERROR;
  }
  IStatus status=errorMessage != null ? CloudFoundryPlugin.getErrorStatus(errorMessage) : Status.OK_STATUS;
  return status;
}
Program: 10650
Project: 10650
Buggy source:
@Override public boolean requiresURL(CloudFoundryApplicationModule appModule){
  IJavaProject project=CloudFoundryProjectUtil.getJavaProject(appModule);
  return JavaCloudFoundryArchiver.isBootProject(project);
}

Fixed version (ground truth):
public boolean requiresURL(){
  return false;
}
Program: 10651
Project: 10651
Buggy source:
public CloudFoundryDeploymentWizardPage(CloudFoundryServer server,CloudFoundryApplicationModule module,ApplicationWizardDescriptor descriptor,ApplicationUrlLookupService urlLookup,ApplicationWizardDelegate wizardDelegate){
  super("String_Node_Str",null,null);
  this.server=server;
  this.module=module;
  this.descriptor=descriptor;
  this.serverTypeId=module.getServerTypeId();
  urlPart=createUrlPart(urlLookup);
  urlPart.addPartChangeListener(this);
}

Fixed version (ground truth):
public CloudFoundryDeploymentWizardPage(CloudFoundryServer server,CloudFoundryApplicationModule module,ApplicationWizardDescriptor descriptor,ApplicationUrlLookupService urlLookup,ApplicationWizardDelegate wizardDelegate){
  super("String_Node_Str",null,null);
  this.server=server;
  this.module=module;
  this.descriptor=descriptor;
  this.serverTypeId=module.getServerTypeId();
  urlPart=createUrlPart(urlLookup);
  urlPart.addPartChangeListener(this);
  this.wizardDelegate=wizardDelegate;
}
Program: 10652
Project: 10652
Buggy source:
protected boolean requiresUrl(){
  return !(getWizard() instanceof CloudFoundryApplicationWizard) || ((CloudFoundryApplicationWizard)getWizard()).requiresUrl();
}

Fixed version (ground truth):
protected boolean requiresUrl(){
  return wizardDelegate == null || wizardDelegate.getApplicationDelegate() == null || wizardDelegate.getApplicationDelegate().requiresURL();
}
Program: 10653
Project: 10653
Buggy source:
protected void updateApplicationURLFromAppName(){
  if (requiresUrl()) {
    String appName=descriptor.getDeploymentInfo().getDeploymentName();
    urlPart.setSubdomain(appName);
  }
}

Fixed version (ground truth):
protected void updateApplicationURLFromAppName(){
  if (shouldSetDefaultUrl()) {
    String appName=descriptor.getDeploymentInfo().getDeploymentName();
    urlPart.setSubdomain(appName);
  }
}
Program: 10654
Project: 10654
Buggy source:
public boolean requiresURL(){
  IModule localModule=applicationModule.getLocalModule();
  if (localModule == null) {
    return true;
  }
  AbstractApplicationDelegate delegate=ApplicationRegistry.getApplicationDelegate(localModule);
  if (delegate == null) {
    return true;
  }
  return ApplicationRegistry.requiresURL(delegate,applicationModule);
}

Fixed version (ground truth):
public boolean requiresURL(){
  IModule localModule=applicationModule.getLocalModule();
  if (localModule == null) {
    return true;
  }
  AbstractApplicationDelegate delegate=ApplicationRegistry.getApplicationDelegate(localModule);
  return delegate == null || delegate.requiresURL();
}
Program: 10656
Project: 10656
Buggy source:
public static HttpProxyConfiguration getProxy(URL url){
  if (url == null || url.getProtocol() == null) {
    return null;
  }
  CloudFoundryPlugin plugin=CloudFoundryPlugin.getDefault();
  if (plugin != null) {
    IProxyService proxyService=plugin.getProxyService();
    if (proxyService != null && proxyService.isProxiesEnabled()) {
      IProxyData[] existingProxies=proxyService.getProxyData();
      if (existingProxies != null) {
        String normalisedURLProtocol=getNormalisedProtocol(url.getProtocol());
        String[] proxyDataTypes={IProxyData.HTTP_PROXY_TYPE,IProxyData.HTTPS_PROXY_TYPE,IProxyData.SOCKS_PROXY_TYPE};
        String matchedProxyData=null;
        for (        String proxyDataType : proxyDataTypes) {
          String normalised=getNormalisedProtocol(proxyDataType);
          if (normalised.equals(normalisedURLProtocol)) {
            matchedProxyData=proxyDataType;
            break;
          }
        }
        if (matchedProxyData != null) {
          for (          IProxyData data : existingProxies) {
            if (matchedProxyData.equals(data.getType())) {
              int proxyPort=data.getPort();
              String proxyHost=data.getHost();
              return proxyHost != null ? new HttpProxyConfiguration(proxyHost,proxyPort) : null;
            }
          }
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public static HttpProxyConfiguration getProxy(URL url){
  if (url == null || url.getProtocol() == null) {
    return null;
  }
  CloudFoundryPlugin plugin=CloudFoundryPlugin.getDefault();
  if (plugin != null) {
    IProxyService proxyService=plugin.getProxyService();
    if (proxyService != null && proxyService.isProxiesEnabled()) {
      IProxyData[] existingProxies=proxyService.getProxyData();
      if (existingProxies != null) {
        String normalisedURLProtocol=getNormalisedProtocol(url.getProtocol());
        String[] proxyDataTypes={IProxyData.HTTP_PROXY_TYPE,IProxyData.HTTPS_PROXY_TYPE,IProxyData.SOCKS_PROXY_TYPE};
        String matchedProxyData=null;
        for (        String proxyDataType : proxyDataTypes) {
          String normalised=getNormalisedProtocol(proxyDataType);
          if (normalised.equals(normalisedURLProtocol)) {
            matchedProxyData=proxyDataType;
            break;
          }
        }
        if (matchedProxyData != null) {
          for (          IProxyData data : existingProxies) {
            if (matchedProxyData.equals(data.getType())) {
              int proxyPort=data.getPort();
              String proxyHost=data.getHost();
              String user=data.getUserId();
              String password=data.getPassword();
              return proxyHost != null ? new HttpProxyConfiguration(proxyHost,proxyPort,data.isRequiresAuthentication(),user,password) : null;
            }
          }
        }
      }
    }
  }
  return null;
}
Program: 10657
Project: 10657
Buggy source:
public void addColumns(final TableViewer tableViewer){
  final Table table=tableViewer.getTable();
  table.setHeaderVisible(true);
  int columnIndex=0;
  List<String> columnProperties=new ArrayList<String>();
  TableColumn sortColumn=null;
  for (  RouteColumn clm : RouteColumn.values()) {
    TableColumn tableColumn=new TableColumn(table,SWT.NONE,columnIndex++);
    tableColumn.setText(clm.getName());
    tableColumn.setWidth(clm.getWidth());
    tableColumn.setData(clm);
    columnProperties.add(clm.getName());
    tableColumn.addSelectionListener(new ColumnSortListener(tableViewer));
    if (sortColumn == null) {
      sortColumn=tableColumn;
    }
  }
  if (sortColumn != null) {
    table.setSortColumn(sortColumn);
    table.setSortDirection(SWT.UP);
  }
  tableViewer.setColumnProperties(columnProperties.toArray(new String[0]));
}

Fixed version (ground truth):
public void addColumns(final TableViewer tableViewer){
  final Table table=tableViewer.getTable();
  table.setHeaderVisible(true);
  int columnIndex=0;
  List<String> columnProperties=new ArrayList<String>();
  TableColumn sortColumn=null;
  for (  RouteColumn clm : RouteColumn.values()) {
    TableColumn tableColumn=new TableColumn(table,SWT.NONE,columnIndex++);
    tableColumn.setText(clm.getName());
    tableColumn.setWidth(clm.getWidth());
    tableColumn.setData(clm);
    columnProperties.add(clm.getName());
    tableColumn.addSelectionListener(new ColumnSortListener(tableViewer){
      protected void refresh(){
        refreshAll();
      }
    }
);
    if (sortColumn == null) {
      sortColumn=tableColumn;
    }
  }
  if (sortColumn != null) {
    table.setSortColumn(sortColumn);
    table.setSortDirection(SWT.UP);
  }
  tableViewer.setColumnProperties(columnProperties.toArray(new String[0]));
}
Program: 10658
Project: 10658
Buggy source:
public void widgetSelected(SelectionEvent e){
  if (e.widget instanceof TableColumn) {
    TableColumn selected=(TableColumn)e.widget;
    Table table=viewer.getTable();
    TableColumn current=table.getSortColumn();
    int newDirection=SWT.UP;
    if (current == selected) {
      newDirection=table.getSortDirection() == SWT.UP ? SWT.DOWN : SWT.UP;
    }
 else {
      table.setSortColumn(selected);
    }
    table.setSortDirection(newDirection);
    viewer.refresh();
  }
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent e){
  if (e.widget instanceof TableColumn) {
    TableColumn selected=(TableColumn)e.widget;
    Table table=viewer.getTable();
    TableColumn current=table.getSortColumn();
    int newDirection=SWT.UP;
    if (current == selected) {
      newDirection=table.getSortDirection() == SWT.UP ? SWT.DOWN : SWT.UP;
    }
 else {
      table.setSortColumn(selected);
    }
    table.setSortDirection(newDirection);
    refresh();
  }
}
Program: 10659
Project: 10659
Buggy source:
public synchronized void writeApplicationLogs(List<ApplicationLog> logs){
  if (logs != null) {
    for (    ApplicationLog log : logs) {
      CloudLog cloudLog=ApplicationLogConsoleStream.getCloudlog(log);
      if (cloudLog != null) {
        writeToStream(cloudLog);
      }
    }
  }
}

Fixed version (ground truth):
public synchronized void writeApplicationLogs(List<ApplicationLog> logs,CloudFoundryApplicationModule appModule,CloudFoundryServer cloudServer){
  if (logs != null) {
    for (    ApplicationLog log : logs) {
      CloudLog cloudLog=ApplicationLogConsoleStream.getCloudlog(log,appModule,cloudServer);
      if (cloudLog != null) {
        writeToStream(cloudLog);
      }
    }
  }
}
Program: 10660
Project: 10660
Buggy source:
public void onMessage(ApplicationLog appLog){
  CloudLog log=getCloudlog(appLog);
  if (log != null) {
    ConsoleStream stream=getStream(log);
    if (stream != null && stream.isActive()) {
      try {
        stream.write(log);
      }
 catch (      CoreException e) {
        CloudFoundryPlugin.logError(e);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onMessage(ApplicationLog appLog){
  CloudLog log=getCloudlog(appLog,null,null);
  if (log != null) {
    try {
      write(log);
    }
 catch (    CoreException e) {
      CloudFoundryPlugin.logError(e);
    }
  }
}
Program: 10661
Project: 10661
Buggy source:
protected synchronized ConsoleStream getStream(CloudLog log){
  LogContentType type=log.getLogType();
  ConsoleStream stream=logStreams.get(type);
  if (stream == null) {
    int swtColour=-1;
    if (StandardLogContentType.STD_ERROR.equals(type)) {
      swtColour=SWT.COLOR_RED;
    }
 else     if (StandardLogContentType.STD_OUT.equals(type)) {
      swtColour=SWT.COLOR_DARK_GREEN;
    }
 else     if (StandardLogContentType.APPLICATION_LOG_UNKNOWN.equals(type)) {
      swtColour=SWT.COLOR_BLACK;
    }
    stream=swtColour > -1 ? new SingleConsoleStream(new UILogConfig(swtColour)) : null;
    if (stream != null) {
      try {
        stream.initialiseStream(console,appModule,cloudServer);
        logStreams.put(type,stream);
      }
 catch (      CoreException e) {
        CloudFoundryPlugin.logError(e);
      }
    }
  }
  return stream;
}

Fixed version (ground truth):
protected synchronized ConsoleStream getStream(CloudLog log){
  LogContentType type=log.getLogType();
  ConsoleStream stream=logStreams.get(type);
  if (stream == null) {
    int swtColour=-1;
    if (StandardLogContentType.APPLICATION_LOG_STS_ERROR.equals(type)) {
      swtColour=SWT.COLOR_RED;
    }
 else     if (StandardLogContentType.APPLICATION_LOG_STD_OUT.equals(type)) {
      swtColour=SWT.COLOR_DARK_GREEN;
    }
 else     if (StandardLogContentType.APPLICATION_LOG_UNKNOWN.equals(type)) {
      swtColour=SWT.COLOR_BLACK;
    }
    stream=swtColour > -1 ? new SingleConsoleStream(new UILogConfig(swtColour)) : null;
    if (stream != null) {
      try {
        stream.initialiseStream(console,appModule,cloudServer);
        logStreams.put(type,stream);
      }
 catch (      CoreException e) {
        CloudFoundryPlugin.logError(e);
      }
    }
  }
  return stream;
}
Program: 10662
Project: 10662
Buggy source:
public static CloudLog getCloudlog(ApplicationLog appLog){
  if (appLog == null) {
    return null;
  }
  org.cloudfoundry.client.lib.domain.ApplicationLog.MessageType type=appLog.getMessageType();
  LogContentType contentType=StandardLogContentType.APPLICATION_LOG_UNKNOWN;
  if (type != null) {
switch (type) {
case STDERR:
      contentType=StandardLogContentType.STD_OUT;
    break;
case STDOUT:
  contentType=StandardLogContentType.STD_OUT;
break;
}
}
return new CloudLog(format(appLog.getMessage()),contentType);
}

Fixed version (ground truth):
public static CloudLog getCloudlog(ApplicationLog appLog,CloudFoundryApplicationModule appModule,CloudFoundryServer server){
  if (appLog == null) {
    return null;
  }
  org.cloudfoundry.client.lib.domain.ApplicationLog.MessageType type=appLog.getMessageType();
  LogContentType contentType=StandardLogContentType.APPLICATION_LOG_UNKNOWN;
  if (type != null) {
switch (type) {
case STDERR:
      contentType=StandardLogContentType.APPLICATION_LOG_STS_ERROR;
    break;
case STDOUT:
  contentType=StandardLogContentType.APPLICATION_LOG_STD_OUT;
break;
}
}
return new CloudLog(format(appLog.getMessage()),contentType,server,appModule);
}
Program: 10663
Project: 10663
Buggy source:
@Override public ConsoleStream getStream(LogContentType type){
  if (StandardLogContentType.APPLICATION_LOG.equals(type)) {
    return new ApplicationLogConsoleStream();
  }
  return null;
}

Fixed version (ground truth):
@Override public ConsoleStream getStream(LogContentType type){
  for (  LogContentType tp : SUPPORTED) {
    if (tp.equals(type)) {
      return new ApplicationLogConsoleStream();
    }
  }
  return null;
}
Program: 10664
Project: 10664
Buggy source:
@Override public LogContentType[] getSupportedTypes(){
  return new LogContentType[]{StandardLogContentType.APPLICATION_LOG};
}

Fixed version (ground truth):
@Override public LogContentType[] getSupportedTypes(){
  return SUPPORTED;
}
Program: 10665
Project: 10665
Buggy source:
public void showCloudFoundryLogs(CloudFoundryServer server,CloudFoundryApplicationModule appModule,int instanceIndex,boolean clear){
  if (appModule == null || server == null) {
    return;
  }
  ApplicationLogConsole console=getApplicationLogConsole(server,appModule,instanceIndex);
  if (console != null) {
    if (clear) {
      console.getConsole().clearConsole();
    }
    CloudFoundryServerBehaviour behaviour=server.getBehaviour();
    List<ApplicationLog> logs=behaviour.getRecentApplicationLogs(appModule.getDeployedApplicationName());
    console.writeApplicationLogs(logs);
  }
}

Fixed version (ground truth):
public void showCloudFoundryLogs(CloudFoundryServer server,CloudFoundryApplicationModule appModule,int instanceIndex,boolean clear){
  if (appModule == null || server == null) {
    return;
  }
  ApplicationLogConsole console=getApplicationLogConsole(server,appModule,instanceIndex);
  if (console != null) {
    if (clear) {
      console.getConsole().clearConsole();
    }
    CloudFoundryServerBehaviour behaviour=server.getBehaviour();
    List<ApplicationLog> logs=behaviour.getRecentApplicationLogs(appModule.getDeployedApplicationName());
    console.writeApplicationLogs(logs,appModule,server);
  }
}
Program: 10666
Project: 10666
Buggy source:
/** 
 * Given space selection, determine if it is valid. For example, a user wishes to create a server instance to the selected cloudSpace, if the cloud space is valid, return  {@link org.eclipse.core.runtime.Status#OK_STATUS}.
 * @param selectionObj a potential space selection.
 * @return if valid, return{@link org.eclipse.core.runtime.Status#OK_STATUS}. Otherwise return appropriate error status. Must not be null.
 */
public IStatus validateSpaceSelection(CloudSpace selectedCloudSpace){
  String errorMessage=null;
  if (selectedCloudSpace == null) {
    errorMessage=Messages.ERROR_NO_CLOUD_SPACE_SELECTED;
  }
 else {
    List<CloudFoundryServer> cloudServers=CloudServerUtil.getCloudServers();
    if (cloudServers != null) {
      for (      CloudFoundryServer cloudServer : cloudServers) {
        if (matchesExisting(selectedCloudSpace,cloudServer.getCloudFoundrySpace())) {
          errorMessage=NLS.bind(Messages.ERROR_SERVER_INSTANCE_CLOUD_SPACE_EXISTS,cloudServer.getServer().getName(),selectedCloudSpace.getName());
          break;
        }
      }
    }
  }
  return (errorMessage != null) ? CloudFoundryPlugin.getErrorStatus(errorMessage) : Status.OK_STATUS;
}

Fixed version (ground truth):
/** 
 * Given space selection, determine if it is valid. For example, a user wishes to create a server instance to the selected cloudSpace, if the cloud space is valid, return  {@link org.eclipse.core.runtime.Status#OK_STATUS}.
 * @param selectionObj a potential space selection.
 * @return if valid, return{@link org.eclipse.core.runtime.Status#OK_STATUS}. Otherwise return appropriate error status. Must not be null.
 */
public IStatus validateSpaceSelection(CloudSpace selectedCloudSpace){
  return validateSpaceSelection(null,selectedCloudSpace);
}
Program: 10667
Project: 10667
Buggy source:
@Override public Object getAdapter(Class clazz){
  if (clazz.equals(CloudFoundryServer.class)) {
    return cloudServer;
  }
 else   if (clazz.equals(CloudFoundryApplicationModule.class)) {
    return appModule;
  }
  return null;
}

Fixed version (ground truth):
public Object getAdapter(Class clazz){
  if (clazz.equals(CloudFoundryServer.class)) {
    return cloudServer;
  }
 else   if (clazz.equals(CloudFoundryApplicationModule.class)) {
    return appModule;
  }
  return null;
}
Program: 10668
Project: 10668
Buggy source:
/** 
 * 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.
 */
@Override protected void initialize(IProgressMonitor monitor){
  super.initialize(monitor);
  getServer().addServerListener(serverListener,ServerEvent.SERVER_CHANGE);
  try {
    refreshHandler=new RefreshHandler(getCloudFoundryServer());
  }
 catch (  CoreException e) {
    CloudFoundryPlugin.logError(Messages.ERROR_INITIALISE_REFRESH_NO_SERVER);
  }
}

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.
 */
@Override protected void initialize(IProgressMonitor monitor){
  super.initialize(monitor);
  getServer().addServerListener(serverListener,ServerEvent.SERVER_CHANGE);
  try {
    refreshHandler=new RefreshHandler(getCloudFoundryServer());
    refreshModules(monitor);
  }
 catch (  CoreException e) {
    CloudFoundryPlugin.logError(Messages.ERROR_INITIALISE_REFRESH_NO_SERVER);
  }
}
Program: 10669
Project: 10669
Buggy source:
public void run(IProgressMonitor monitor) throws CoreException {
  behaviour.stopRefreshModules();
  performOperation(monitor);
  behaviour.refreshModules(monitor);
}

Fixed version (ground truth):
public void run(IProgressMonitor monitor) throws CoreException {
  performOperation(monitor);
  refresh(monitor);
}
Program: 10670
Project: 10670
Buggy source:
/** 
 * 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.
 */
@Override protected void initialize(IProgressMonitor monitor){
  super.initialize(monitor);
  getServer().addServerListener(serverListener,ServerEvent.SERVER_CHANGE);
  try {
    refreshHandler=new RefreshHandler(getCloudFoundryServer());
    refreshModules(monitor);
  }
 catch (  CoreException e) {
    CloudFoundryPlugin.logError(Messages.ERROR_INITIALISE_REFRESH_NO_SERVER);
  }
}

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.
 */
@Override protected void initialize(IProgressMonitor monitor){
  super.initialize(monitor);
  getServer().addServerListener(serverListener,ServerEvent.SERVER_CHANGE);
  try {
    refreshHandler=new RefreshHandler(getCloudFoundryServer());
    Job job=new Job(NLS.bind(Messages.REFRESHING_MODULES,getServer().getName())){
      @Override protected IStatus run(      IProgressMonitor monitor){
        refreshModules(monitor);
        return Status.OK_STATUS;
      }
    }
;
    job.setPriority(Job.INTERACTIVE);
    job.schedule();
  }
 catch (  CoreException e) {
    CloudFoundryPlugin.logError(Messages.ERROR_INITIALISE_REFRESH_NO_SERVER);
  }
}
Program: 10671
Project: 10671
Buggy source:
@Override protected IStatus run(IProgressMonitor monitor){
  closeCaldecottTunnels(monitor);
  return Status.OK_STATUS;
}

Fixed version (ground truth):
@Override protected IStatus run(IProgressMonitor monitor){
  refreshModules(monitor);
  return Status.OK_STATUS;
}
Program: 10672
Project: 10672
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.getSpaceWithNoServerInstance();
    }
    if (setSpaceSelection(selectedSpace)) {
      setSelectionInViewer(selectedSpace);
    }
    if (orgInput.isEmpty()) {
      notifyStatusChange(CloudFoundryPlugin.getStatus("String_Node_Str",IStatus.INFO));
    }
 else {
      notifyStatusChange(CloudFoundryPlugin.getStatus(DEFAULT_DESCRIPTION,IStatus.OK));
    }
  }
}

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.getSpaceWithNoServerInstance();
    }
    if (setSpaceSelection(selectedSpace)) {
      setSelectionInViewer(selectedSpace);
      notifyStatusChange(CloudFoundryPlugin.getStatus(DEFAULT_DESCRIPTION,IStatus.OK));
    }
 else {
      if (orgInput.isEmpty()) {
        notifyStatusChange(CloudFoundryPlugin.getErrorStatus(Messages.ERROR_CHECK_CONNECTION_NO_SPACES));
      }
 else       if (selectedSpace == null) {
        notifyStatusChange(CloudFoundryPlugin.getErrorStatus(Messages.ERROR_ALL_SPACES_ASSOCIATED_SERVER_INSTANCES));
      }
    }
  }
}
Program: 10673
Project: 10673
Buggy source:
public Control createPart(Composite parent){
  Composite tableArea=new Composite(parent,SWT.NONE);
  GridLayoutFactory.fillDefaults().numColumns(1).equalWidth(true).applyTo(tableArea);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(tableArea);
  Composite orgTableComposite=new Composite(tableArea,SWT.NONE);
  GridLayoutFactory.fillDefaults().numColumns(1).applyTo(orgTableComposite);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(orgTableComposite);
  Label orgLabel=new Label(orgTableComposite,SWT.NONE);
  GridDataFactory.fillDefaults().grab(false,false).applyTo(orgLabel);
  orgLabel.setText("String_Node_Str");
  Tree orgTable=new Tree(orgTableComposite,SWT.BORDER | SWT.SINGLE);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(orgTable);
  orgsSpacesViewer=new TreeViewer(orgTable);
  orgsSpacesViewer.setContentProvider(new TableContentProvider());
  orgsSpacesViewer.setLabelProvider(new SpacesLabelProvider());
  orgsSpacesViewer.setSorter(new SpacesSorter());
  orgsSpacesViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      refresh();
    }
  }
);
  setInput();
  return tableArea;
}

Fixed version (ground truth):
public Control createPart(Composite parent){
  Composite tableArea=new Composite(parent,SWT.NONE);
  GridLayoutFactory.fillDefaults().numColumns(1).equalWidth(true).applyTo(tableArea);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(tableArea);
  Composite orgTableComposite=new Composite(tableArea,SWT.NONE);
  GridLayoutFactory.fillDefaults().numColumns(1).applyTo(orgTableComposite);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(orgTableComposite);
  Label orgLabel=new Label(orgTableComposite,SWT.NONE);
  GridDataFactory.fillDefaults().grab(false,false).applyTo(orgLabel);
  orgLabel.setText("String_Node_Str");
  Tree orgTable=new Tree(orgTableComposite,SWT.BORDER | SWT.SINGLE);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(orgTable);
  orgsSpacesViewer=new TreeViewer(orgTable);
  orgsSpacesViewer.setContentProvider(new TableContentProvider());
  orgsSpacesViewer.setLabelProvider(new SpacesLabelProvider());
  orgsSpacesViewer.setSorter(new SpacesSorter());
  orgsSpacesViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      refresh();
    }
  }
);
  return tableArea;
}
Program: 10674
Project: 10674
Buggy source:
public boolean isComplete(){
  if (validator == null) {
    return false;
  }
  ValidationStatus status=validator.getPreviousValidationStatus();
  return status != null && status.getStatus().getSeverity() != IStatus.ERROR && status.getValidationType() == ServerCredentialsValidationStatics.EVENT_SPACE_VALID;
}

Fixed version (ground truth):
public boolean isComplete(){
  if (validator == null) {
    return false;
  }
  ValidationStatus status=validator.getPreviousValidationStatus();
  return status != null && status.getStatus().isOK();
}
Program: 10675
Project: 10675
Buggy source:
/** 
 * Force notify that the spaces descriptor has changed. Since the descriptor is assumed to be changed, a new default space obtained from that descriptor will be set in the server
 */
protected void internalDescriptorChanged(){
  if (spacesDescriptor != null) {
    CloudSpace defaultCloudSpace=spacesDescriptor.getOrgsAndSpaces().getDefaultCloudSpace();
    setSelectedSpace(defaultCloudSpace);
  }
 else {
    setSelectedSpace(null);
  }
}

Fixed version (ground truth):
/** 
 * Invoked if the descriptor containing list of orgs and spaces has changed. If available, a default space will be set in the server
 */
protected void internalDescriptorChanged(){
  if (spacesDescriptor != null) {
    CloudSpace defaultCloudSpace=getSpaceWithNoServerInstance();
    setSelectedSpace(defaultCloudSpace);
  }
 else {
    setSelectedSpace(null);
  }
}
Program: 10676
Project: 10676
Buggy source:
protected void refresh(){
  if (orgsSpacesViewer != null) {
    Tree tree=orgsSpacesViewer.getTree();
    TreeItem[] selectedItems=tree.getSelection();
    if (selectedItems != null && selectedItems.length > 0) {
      Object selectedObj=selectedItems[0].getData();
      if (selectedObj instanceof CloudSpace) {
        setSpaceSelection((CloudSpace)selectedObj);
      }
 else       if (selectedObj instanceof CloudOrganization) {
        setSpaceSelection(null);
      }
    }
  }
}

Fixed version (ground truth):
protected void refresh(){
  if (orgsSpacesViewer != null) {
    Tree tree=orgsSpacesViewer.getTree();
    TreeItem[] selectedItems=tree.getSelection();
    if (selectedItems != null && selectedItems.length > 0) {
      Object selectedObj=selectedItems[0].getData();
      CloudSpace selectedSpace=selectedObj instanceof CloudSpace ? (CloudSpace)selectedObj : null;
      setSpaceSelection(selectedSpace);
    }
  }
}
Program: 10677
Project: 10677
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.getStatus("String_Node_Str",IStatus.INFO));
    }
 else {
      notifyStatusChange(CloudFoundryPlugin.getStatus(DEFAULT_DESCRIPTION,IStatus.OK));
    }
  }
}

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.getSpaceWithNoServerInstance();
    }
    if (setSpaceSelection(selectedSpace)) {
      setSelectionInViewer(selectedSpace);
    }
    if (orgInput.isEmpty()) {
      notifyStatusChange(CloudFoundryPlugin.getStatus("String_Node_Str",IStatus.INFO));
    }
 else {
      notifyStatusChange(CloudFoundryPlugin.getStatus(DEFAULT_DESCRIPTION,IStatus.OK));
    }
  }
}
Program: 10678
Project: 10678
Buggy source:
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);
  }
}

Fixed version (ground truth):
/** 
 * @param selectedSpace
 * @return true if the specified space was set. False otherwise.
 */
protected boolean setSpaceSelection(CloudSpace selectedSpace){
  boolean set=false;
  if (cloudSpaceServerDelegate != null) {
    IStatus status=cloudSpaceServerDelegate.validateSpaceSelection(selectedSpace);
    if (status.isOK()) {
      cloudSpaceServerDelegate.setSelectedSpace(selectedSpace);
      set=true;
    }
 else {
      cloudSpaceServerDelegate.setSelectedSpace(null);
    }
    notifyStatusChange(selectedSpace,status,ServerCredentialsValidationStatics.EVENT_SPACE_CHANGED);
  }
  return set;
}
Program: 10679
Project: 10679
Buggy source:
public int getValidationType(){
  return validationType;
}

Fixed version (ground truth):
/** 
 * @return one of the following:{@link ServerCredentialsValidationStatics#EVENT_CREDENTIALS_FILLED},  {@link ServerCredentialsValidationStatics#EVENT_NONE},  {@link ServerCredentialsValidationStatics#EVENT_SELF_SIGNED_ERROR},  {@link ServerCredentialsValidationStatics#EVENT_SPACE_CHANGED},  {@link ServerCredentialsValidationStatics#EVENT_SPACE_VALID}
 */
public int getValidationType(){
  return validationType;
}
Program: 10680
Project: 10680
Buggy source:
public void doRun(final CloudFoundryServer cloudServer,CloudFoundryApplicationModule appModule,IAction action){
  final Shell shell=activePart != null && activePart.getSite() != null ? activePart.getSite().getShell() : CloudUiUtil.getShell();
  if (shell != null) {
    UIJob job=new UIJob(getJobName()){
      public IStatus runInUIThread(      IProgressMonitor monitor){
        OrgsAndSpacesWizard wizard=new OrgsAndSpacesWizard(cloudServer);
        WizardDialog dialog=new WizardDialog(shell,wizard);
        dialog.open();
        return Status.OK_STATUS;
      }
    }
;
    job.schedule();
  }
 else {
    CloudFoundryPlugin.logError("String_Node_Str");
  }
}

Fixed version (ground truth):
public void doRun(final CloudFoundryServer cloudServer,CloudFoundryApplicationModule appModule,IAction action){
  final Shell shell=activePart != null && activePart.getSite() != null ? activePart.getSite().getShell() : CloudUiUtil.getShell();
  if (shell != null) {
    UIJob job=new UIJob(getJobName()){
      public IStatus runInUIThread(      IProgressMonitor monitor){
        OrgsAndSpacesWizard wizard=new OrgsAndSpacesWizard(cloudServer);
        WizardDialog dialog=new WizardDialog(shell,wizard);
        dialog.open();
        return Status.OK_STATUS;
      }
    }
;
    job.setSystem(true);
    job.schedule();
  }
 else {
    CloudFoundryPlugin.logError("String_Node_Str");
  }
}
Program: 10681
Project: 10681
Buggy source:
@Override public Composite createComposite(Composite parent,IWizardHandle wizardHandle){
  this.wizardHandle=wizardHandle;
  Composite composite=new Composite(parent,SWT.NONE);
  composite.setLayout(new GridLayout());
  composite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
  listener=new WizardFragmentChangeListener(wizardHandle);
  spacesPart=new CloudSpacesSelectionPart(validator.getSpaceDelegate(),listener,cloudServer,wizardHandle);
  spacesPart.createPart(composite);
  return composite;
}

Fixed version (ground truth):
@Override public Composite createComposite(Composite parent,IWizardHandle wizardHandle){
  this.wizardHandle=wizardHandle;
  Composite composite=new Composite(parent,SWT.NONE);
  composite.setLayout(new GridLayout());
  composite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
  listener=new WizardFragmentChangeListener(wizardHandle){
    @Override public void handleChange(    PartChangeEvent event){
      if (validator != null && event.getType() == ServerCredentialsValidationStatics.EVENT_SPACE_CHANGED) {
        validator.localValidation();
      }
      super.handleChange(event);
    }
  }
;
  spacesPart=new CloudSpacesSelectionPart(validator.getSpaceDelegate(),listener,cloudServer,wizardHandle);
  spacesPart.createPart(composite);
  return composite;
}
Program: 10682
Project: 10682
Buggy source:
public boolean isComplete(){
  return validator != null && validator.areCredentialsFilled();
}

Fixed version (ground truth):
public boolean isComplete(){
  if (validator == null) {
    return false;
  }
  ValidationStatus status=validator.getPreviousValidationStatus();
  return status != null && status.getStatus().getSeverity() != IStatus.ERROR && status.getValidationType() == ServerCredentialsValidationStatics.EVENT_SPACE_VALID;
}
Program: 10683
Project: 10683
Buggy source:
@Override public void setVisible(boolean visible){
  super.setVisible(visible);
  if (visible) {
    UIJob job=new UIJob("String_Node_Str"){
      @Override public IStatus runInUIThread(      IProgressMonitor monitor){
        updateSpacesDescriptor();
        refreshListOfSpaces();
        CloudSpace defaultSpace=cloudServerSpaceDelegate.getCurrentSpacesDescriptor() != null ? cloudServerSpaceDelegate.getCurrentSpacesDescriptor().getOrgsAndSpaces().getDefaultCloudSpace() : null;
        if (defaultSpace != null) {
          setServerNameInUI(defaultSpace.getName());
        }
        return Status.OK_STATUS;
      }
    }
;
    job.setSystem(true);
    job.schedule();
  }
}

Fixed version (ground truth):
@Override public void setVisible(boolean visible){
  super.setVisible(visible);
  if (visible) {
    UIJob job=new UIJob("String_Node_Str"){
      @Override public IStatus runInUIThread(      IProgressMonitor monitor){
        updateSpacesDescriptor();
        refreshListOfSpaces();
        return Status.OK_STATUS;
      }
    }
;
    job.setSystem(true);
    job.schedule();
  }
}
Program: 10684
Project: 10684
Buggy source:
@Override public IStatus runInUIThread(IProgressMonitor monitor){
  updateSpacesDescriptor();
  refreshListOfSpaces();
  CloudSpace defaultSpace=cloudServerSpaceDelegate.getCurrentSpacesDescriptor() != null ? cloudServerSpaceDelegate.getCurrentSpacesDescriptor().getOrgsAndSpaces().getDefaultCloudSpace() : null;
  if (defaultSpace != null) {
    setServerNameInUI(defaultSpace.getName());
  }
  return Status.OK_STATUS;
}

Fixed version (ground truth):
@Override public IStatus runInUIThread(IProgressMonitor monitor){
  updateSpacesDescriptor();
  refreshListOfSpaces();
  return Status.OK_STATUS;
}
Program: 10685
Project: 10685
Buggy source:
public void setSelfSignedCertificate(boolean isSelfSigned){
  try {
    this.isSelfSigned=isSelfSigned;
    new SelfSignedStore(getUrl()).setSelfSignedCert(isSelfSigned);
  }
 catch (  CoreException e) {
    CloudFoundryPlugin.logError(e);
  }
}

Fixed version (ground truth):
/** 
 * Convinience method to set signed certificate for server URLs that do not yet have a server instance (e.g. when managing server URLs)
 * @param isSelfSigned true if server uses self-signed certificate
 * @param cloudServerURL non-null Cloud Foundry server URL
 */
public static void setSelfSignedCertificate(boolean isSelfSigned,String cloudServerURL){
  try {
    new SelfSignedStore(cloudServerURL).setSelfSignedCert(isSelfSigned);
  }
 catch (  CoreException e) {
    CloudFoundryPlugin.logError(e);
  }
}
Program: 10686
Project: 10686
Buggy source:
/** 
 * @return true if server uses self-signed certificates. False otherwise,including if server preference can't be resolved.
 */
public boolean getSelfSignedCertificate(){
  try {
    if (isSelfSigned == null) {
      isSelfSigned=new SelfSignedStore(getUrl()).isSelfSignedCert();
    }
    return isSelfSigned;
  }
 catch (  CoreException e) {
    CloudFoundryPlugin.logError(e);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @return true if server uses self-signed certificates. False otherwise,including if server preference can't be resolved.
 */
public boolean getSelfSignedCertificate(){
  try {
    return new SelfSignedStore(getUrl()).isSelfSignedCert();
  }
 catch (  CoreException e) {
    CloudFoundryPlugin.logError(e);
  }
  return false;
}
Program: 10687
Project: 10687
Buggy source:
/** 
 * @return True if server uses self-signed certificates. False otherwise.
 * @throws CoreException if error occurred while dep
 */
public boolean isSelfSignedCert() throws CoreException {
  SelfSignedServers servers=getStoredServers();
  return servers != null && servers.getServers().containsKey(serverURL) && servers.getServers().get(serverURL);
}

Fixed version (ground truth):
/** 
 * @return True if server uses self-signed certificates. False otherwise.
 * @throws CoreException if error occurred
 */
public boolean isSelfSignedCert() throws CoreException {
  SelfSignedServers servers=getStoredServers();
  return servers != null && servers.getServers().get(serverURL) != null && servers.getServers().get(serverURL);
}
Program: 10688
Project: 10688
Buggy source:
/** 
 * @param selfSigned stores the self-signed certificate preference for thegiven server URL.
 * @throws CoreException if failed to store value.
 */
public void setSelfSignedCert(boolean selfSigned) throws CoreException {
  SelfSignedServers servers=getStoredServers();
  if (servers == null) {
    servers=new SelfSignedServers();
  }
  servers.getServers().put(serverURL,selfSigned);
  String asString=null;
  if (mapper.canSerialize(servers.getClass())) {
    try {
      asString=mapper.writeValueAsString(servers);
    }
 catch (    IOException e) {
      throw CloudErrorUtil.toCoreException(NLS.bind(Messages.ERROR_FAILED_STORE_SELF_SIGNED_PREFS,serverURL),e);
    }
  }
 else {
    throw CloudErrorUtil.toCoreException(NLS.bind(Messages.ERROR_FAILED_STORE_SELF_SIGNED_PREFS,serverURL));
  }
  if (asString != null) {
    IEclipsePreferences prefs=CloudFoundryPlugin.getDefault().getPreferences();
    prefs.put(SELF_SIGNED_PREF,asString);
    try {
      prefs.flush();
    }
 catch (    BackingStoreException e) {
      throw CloudErrorUtil.toCoreException(NLS.bind(Messages.ERROR_FAILED_STORE_SELF_SIGNED_PREFS,serverURL),e);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param selfSigned stores the self-signed certificate preference for thegiven server URL.
 * @throws CoreException if failed to store value.
 */
public void setSelfSignedCert(boolean selfSigned) throws CoreException {
  SelfSignedServers servers=getStoredServers();
  if (servers == null) {
    servers=new SelfSignedServers();
  }
  if (selfSigned) {
    servers.getServers().put(serverURL,selfSigned);
  }
 else {
    servers.getServers().remove(serverURL);
  }
  String asString=null;
  if (mapper.canSerialize(servers.getClass())) {
    try {
      asString=mapper.writeValueAsString(servers);
    }
 catch (    IOException e) {
      throw CloudErrorUtil.toCoreException(NLS.bind(Messages.ERROR_FAILED_STORE_SELF_SIGNED_PREFS,serverURL),e);
    }
  }
 else {
    throw CloudErrorUtil.toCoreException(NLS.bind(Messages.ERROR_FAILED_STORE_SELF_SIGNED_PREFS,serverURL));
  }
  if (asString != null) {
    IEclipsePreferences prefs=CloudFoundryPlugin.getDefault().getPreferences();
    prefs.put(SELF_SIGNED_PREF,asString);
    try {
      prefs.flush();
    }
 catch (    BackingStoreException e) {
      throw CloudErrorUtil.toCoreException(NLS.bind(Messages.ERROR_FAILED_STORE_SELF_SIGNED_PREFS,serverURL),e);
    }
  }
}
Program: 10689
Project: 10689
Buggy source:
public String getDefaultWebAppName(String appPrefix){
  return appPrefix + '_' + getDefaultWebAppProjectName();
}

Fixed version (ground truth):
public String getDefaultWebAppName(String appPrefix){
  return appPrefix + '_' + randomPrefix+ '_'+ getDefaultWebAppProjectName();
}
Program: 10690
Project: 10690
Buggy source:
public void setup() throws CoreException {
  StsTestUtil.cleanUpProjects();
  if (server != null) {
    CloudFoundryServerBehaviour serverBehavior=getBehaviour();
    serverBehavior.deleteAllApplications(null);
    deleteAllServices();
    clearTestDomainAndRoutes();
  }
}

Fixed version (ground truth):
public void setup() throws CoreException {
  Random random=new Random(100);
  randomPrefix=Math.abs(random.nextInt());
  StsTestUtil.cleanUpProjects();
  if (server != null) {
    CloudFoundryServerBehaviour serverBehavior=getBehaviour();
    serverBehavior.deleteAllApplications(null);
    deleteAllServices();
    clearTestDomainAndRoutes();
  }
}
Program: 10692
Project: 10692
Buggy source:
public void run(IProgressMonitor monitor) throws CoreException {
  behaviour.stopRefreshModules();
  try {
    performOperation(monitor);
  }
  finally {
    behaviour.refreshModules(monitor);
  }
}

Fixed version (ground truth):
public void run(IProgressMonitor monitor) throws CoreException {
  behaviour.stopRefreshModules();
  performOperation(monitor);
  behaviour.refreshModules(monitor);
}