Program: 10629
Project: 10629
Buggy source:
BaseClientRequest<List<CloudService>> getDeleteServicesRequest(final List<String> services){
  return new BehaviourRequest<List<CloudService>>(Messages.CloudFoundryServerBehaviour_DELETE_SERVICES){
    @Override protected List<CloudService> doRun(    CloudFoundryOperations client,    SubMonitor progress) throws CoreException {
      SubMonitor serviceProgress=SubMonitor.convert(progress,services.size());
      List<String> boundServices=new ArrayList<String>();
      for (      String service : services) {
        serviceProgress.subTask(NLS.bind(Messages.CloudFoundryServerBehaviour_DELETING_SERVICE,service));
        boolean shouldDelete=true;
        try {
          CloudServiceInstance instance=client.getServiceInstance(service);
          List<CloudServiceBinding> bindings=(instance != null) ? instance.getBindings() : null;
          shouldDelete=bindings == null || bindings.isEmpty();
        }
 catch (        CloudFoundryException cfe) {
          List<CloudApplication> apps=client.getApplications();
          if (apps != null) {
            for (int i=0; shouldDelete && i < apps.size(); i++) {
              CloudApplication app=apps.get(i);
              if (app != null) {
                List<String> appServices=app.getServices();
                if (appServices != null) {
                  for (                  String appServ : appServices) {
                    if (service.equals(appServ)) {
                      shouldDelete=false;
                      break;
                    }
                  }
                }
              }
            }
          }
        }
        if (shouldDelete) {
          client.deleteService(service);
        }
 else {
          boundServices.add(service);
        }
        serviceProgress.worked(1);
      }
      if (!boundServices.isEmpty()) {
        StringWriter writer=new StringWriter();
        int size=boundServices.size();
        for (int i=0; i < size; i++) {
          writer.append(boundServices.get(i));
          if (i < size - 1) {
            writer.append(',');
            writer.append(' ');
          }
        }
        String boundServs=writer.toString();
        CloudFoundryPlugin.getCallback().handleError(CloudFoundryPlugin.getErrorStatus(NLS.bind(Messages.CloudFoundryServerBehaviour_ERROR_DELETE_SERVICES_BOUND,boundServs)));
      }
      return client.getServices();
    }
  }
;
}

Fixed version (ground truth):
BaseClientRequest<List<CloudService>> getDeleteServicesRequest(final List<String> services){
  return new BehaviourRequest<List<CloudService>>(Messages.CloudFoundryServerBehaviour_DELETE_SERVICES){
    @Override protected List<CloudService> doRun(    CloudFoundryOperations client,    SubMonitor progress) throws CoreException {
      SubMonitor serviceProgress=SubMonitor.convert(progress,services.size());
      List<String> boundServices=new ArrayList<String>();
      for (      String service : services) {
        serviceProgress.subTask(NLS.bind(Messages.CloudFoundryServerBehaviour_DELETING_SERVICE,service));
        boolean shouldDelete=true;
        try {
          CloudServiceInstance instance=client.getServiceInstance(service);
          List<CloudServiceBinding> bindings=(instance != null) ? instance.getBindings() : null;
          shouldDelete=bindings == null || bindings.isEmpty();
        }
 catch (        Throwable t) {
          List<CloudApplication> apps=client.getApplications();
          if (apps != null) {
            for (int i=0; shouldDelete && i < apps.size(); i++) {
              CloudApplication app=apps.get(i);
              if (app != null) {
                List<String> appServices=app.getServices();
                if (appServices != null) {
                  for (                  String appServ : appServices) {
                    if (service.equals(appServ)) {
                      shouldDelete=false;
                      break;
                    }
                  }
                }
              }
            }
          }
        }
        if (shouldDelete) {
          client.deleteService(service);
        }
 else {
          boundServices.add(service);
        }
        serviceProgress.worked(1);
      }
      if (!boundServices.isEmpty()) {
        StringWriter writer=new StringWriter();
        int size=boundServices.size();
        for (int i=0; i < size; i++) {
          writer.append(boundServices.get(i));
          if (i < size - 1) {
            writer.append(',');
            writer.append(' ');
          }
        }
        String boundServs=writer.toString();
        CloudFoundryPlugin.getCallback().handleError(CloudFoundryPlugin.getErrorStatus(NLS.bind(Messages.CloudFoundryServerBehaviour_ERROR_DELETE_SERVICES_BOUND,boundServs)));
      }
      return client.getServices();
    }
  }
;
}