Program: 10635
Project: 10635
Buggy source:
/** 
 * Validates the server credentials and URL using a standalone disposable Java client (   {@link CloudFoundryOperations} ).
 * @param validateAgainstServer true if credentials should be validatedagainst a server. False if validation should be local (e.g. checking credential and URL syntax)
 * @param runnableContext
 * @return non-null validation status.
 */
protected ValidationStatus serverValidation(boolean validateAgainstServer,boolean validateSpace,IRunnableContext runnableContext){
  ValidationStatus validationStatus=validateLocally();
  String userName=cfServer.getUsername();
  String password=cfServer.getPassword();
  String url=cfServer.getUrl();
  IStatus eventStatus=null;
  if (validationStatus.getStatus().isOK()) {
    if (!cloudServerSpaceDelegate.matchesCurrentDescriptor(url,userName,password)) {
      cloudServerSpaceDelegate.clearDescriptor();
    }
    try {
      boolean acceptSelfSigned=cfServer.getSelfSignedCertificate();
      if (validateSpace) {
        cloudServerSpaceDelegate.resolveDescriptor(url,userName,password,acceptSelfSigned,runnableContext,validateAgainstServer);
      }
 else       if (validateAgainstServer) {
        boolean displayURL=true;
        CloudUiUtil.validateCredentials(userName,password,url,displayURL,acceptSelfSigned,runnableContext);
      }
    }
 catch (    CoreException e) {
      int eventType=ValidationEvents.VALIDATION;
      if (e.getCause() instanceof javax.net.ssl.SSLPeerUnverifiedException) {
        eventType=ValidationEvents.SELF_SIGNED;
      }
      eventStatus=e.getStatus();
      validationStatus=getValidationStatus(eventStatus,eventType);
    }
catch (    OperationCanceledException oce) {
      eventStatus=null;
      validationStatus=getValidationStatus(Status.OK_STATUS,ValidationEvents.EVENT_NONE);
    }
  }
  return validationStatus;
}

Fixed version (ground truth):
/** 
 * Validates the server credentials and URL using a standalone disposable Java client (   {@link CloudFoundryOperations} ).
 * @param validateAgainstServer true if credentials should be validatedagainst a server. False if validation should be local (e.g. checking credential and URL syntax)
 * @param runnableContext
 * @return non-null validation status.
 */
protected ValidationStatus serverValidation(boolean validateAgainstServer,boolean validateSpace,IRunnableContext runnableContext){
  ValidationStatus validationStatus=validateLocally();
  String userName=cfServer.getUsername();
  String password=cfServer.getPassword();
  String url=cfServer.getUrl();
  boolean acceptSelfSigned=cfServer.getSelfSignedCertificate();
  IStatus eventStatus=null;
  if (validationStatus.getStatus().isOK()) {
    if (!cloudServerSpaceDelegate.matchesCurrentDescriptor(url,userName,password,acceptSelfSigned)) {
      cloudServerSpaceDelegate.clearDescriptor();
    }
    try {
      if (validateSpace) {
        cloudServerSpaceDelegate.resolveDescriptor(url,userName,password,acceptSelfSigned,runnableContext,validateAgainstServer);
      }
 else       if (validateAgainstServer) {
        boolean displayURL=true;
        CloudUiUtil.validateCredentials(userName,password,url,displayURL,acceptSelfSigned,runnableContext);
      }
    }
 catch (    CoreException e) {
      int eventType=ValidationEvents.VALIDATION;
      if (e.getCause() instanceof javax.net.ssl.SSLPeerUnverifiedException) {
        eventType=ValidationEvents.SELF_SIGNED;
      }
      eventStatus=e.getStatus();
      validationStatus=getValidationStatus(eventStatus,eventType);
    }
catch (    OperationCanceledException oce) {
      eventStatus=null;
      validationStatus=getValidationStatus(Status.OK_STATUS,ValidationEvents.EVENT_NONE);
    }
  }
  return validationStatus;
}