Program: 60781
Project: 60781
Buggy source:
/** 
 * Execute a propagation task.
 * @param task to execute
 * @return TaskExecution
 */
public TaskExec execute(final PropagationTask task){
  final Date startDate=new Date();
  TaskExec execution=new TaskExec();
  execution.setStatus(PropagationTaskExecStatus.CREATED.name());
  String taskExecutionMessage=null;
  Set<String> propagationAttempted=new HashSet<String>();
  try {
    final ConnInstance connInstance=task.getResource().getConnector();
    final ConnectorFacadeProxy connector=connLoader.getConnector(task.getResource());
    if (connector == null) {
      final String msg=String.format("String_Node_Str" + "String_Node_Str",task.getResource(),connInstance);
      throw new NoSuchBeanDefinitionException(msg);
    }
    ConnectorObject remoteObject=null;
    try {
      remoteObject=connector.getObject(task.getPropagationMode(),task.getPropagationOperation(),ObjectClass.ACCOUNT,new Uid(task.getOldAccountId() == null ? task.getAccountId() : task.getOldAccountId()),null);
    }
 catch (    RuntimeException ignore) {
      LOG.debug("String_Node_Str" + "String_Node_Str",ignore);
    }
switch (task.getPropagationOperation()) {
case CREATE:
case UPDATE:
      final Set<Attribute> attributes=new HashSet<Attribute>(task.getAttributes());
    if (remoteObject != null) {
      final Name newName=(Name)AttributeUtil.find(Name.NAME,attributes);
      LOG.debug("String_Node_Str",newName);
      if (newName != null && newName.equals(remoteObject.getName())) {
        LOG.debug("String_Node_Str");
        attributes.remove(newName);
      }
      LOG.debug("String_Node_Str",attributes);
      connector.update(task.getPropagationMode(),ObjectClass.ACCOUNT,remoteObject.getUid(),attributes,null,propagationAttempted);
    }
 else {
      final String accountId=task.getAccountId();
      final Name name=(Name)AttributeUtil.find(Name.NAME,attributes);
      if (StringUtils.hasText(accountId) && (name == null || !accountId.equals(name.getNameValue()))) {
        final Uid uid=(Uid)AttributeUtil.find(Uid.NAME,attributes);
        if (uid == null) {
          attributes.add(AttributeBuilder.build(Uid.NAME,Collections.singleton(accountId)));
        }
      }
      connector.create(task.getPropagationMode(),ObjectClass.ACCOUNT,attributes,null,propagationAttempted);
    }
  break;
case DELETE:
if (remoteObject == null) {
  LOG.debug("String_Node_Str" + "String_Node_Str",task.getAccountId());
}
 else {
  connector.delete(task.getPropagationMode(),ObjectClass.ACCOUNT,remoteObject.getUid(),null,propagationAttempted);
}
break;
default :
}
execution.setStatus(task.getPropagationMode() == PropagationMode.SYNC ? PropagationTaskExecStatus.SUCCESS.name() : PropagationTaskExecStatus.SUBMITTED.name());
LOG.debug("String_Node_Str",task.getResource());
}
 catch (Throwable t) {
LOG.error("String_Node_Str" + task.getResource().getName(),t);
if (t instanceof ConnectorException && t.getCause() != null) {
taskExecutionMessage=t.getCause().getMessage();
}
 else {
StringWriter exceptionWriter=new StringWriter();
exceptionWriter.write(t.getMessage() + "String_Node_Str");
t.printStackTrace(new PrintWriter(exceptionWriter));
taskExecutionMessage=exceptionWriter.toString();
}
try {
execution.setStatus(task.getPropagationMode() == PropagationMode.SYNC ? PropagationTaskExecStatus.FAILURE.name() : PropagationTaskExecStatus.UNSUBMITTED.name());
}
 catch (Throwable wft) {
LOG.error("String_Node_Str",execution,wft);
}
propagationAttempted.add(task.getPropagationOperation().name().toLowerCase());
}
 finally {
LOG.debug("String_Node_Str",task);
if (hasToBeregistered(task,execution)) {
PropagationTask savedTask=taskDAO.save(task);
execution.setStartDate(startDate);
execution.setMessage(taskExecutionMessage);
execution.setEndDate(new Date());
execution.setTask(savedTask);
if (!propagationAttempted.isEmpty()) {
execution=taskExecDAO.save(execution);
LOG.debug("String_Node_Str",execution);
}
 else {
LOG.debug("String_Node_Str",execution);
}
}
}
return execution;
}

Fixed version (ground truth):
/** 
 * Execute a propagation task.
 * @param task to execute
 * @return TaskExecution
 */
public TaskExec execute(final PropagationTask task){
  final Date startDate=new Date();
  TaskExec execution=new TaskExec();
  execution.setStatus(PropagationTaskExecStatus.CREATED.name());
  String taskExecutionMessage=null;
  Set<String> propagationAttempted=new HashSet<String>();
  try {
    final ConnInstance connInstance=task.getResource().getConnector();
    final ConnectorFacadeProxy connector=connLoader.getConnector(task.getResource());
    if (connector == null) {
      final String msg=String.format("String_Node_Str" + "String_Node_Str",task.getResource(),connInstance);
      throw new NoSuchBeanDefinitionException(msg);
    }
    ConnectorObject remoteObject=null;
    try {
      remoteObject=connector.getObject(task.getPropagationMode(),task.getPropagationOperation(),ObjectClass.ACCOUNT,new Uid(task.getOldAccountId() == null ? task.getAccountId() : task.getOldAccountId()),null);
    }
 catch (    RuntimeException ignore) {
      LOG.debug("String_Node_Str" + "String_Node_Str",ignore);
    }
switch (task.getPropagationOperation()) {
case CREATE:
case UPDATE:
      final Set<Attribute> attributes=new HashSet<Attribute>(task.getAttributes());
    if (remoteObject != null) {
      final Name newName=(Name)AttributeUtil.find(Name.NAME,attributes);
      LOG.debug("String_Node_Str",newName);
      if (newName != null && newName.equals(remoteObject.getName())) {
        LOG.debug("String_Node_Str");
        attributes.remove(newName);
      }
      LOG.debug("String_Node_Str",attributes);
      connector.update(task.getPropagationMode(),ObjectClass.ACCOUNT,remoteObject.getUid(),attributes,null,propagationAttempted);
    }
 else {
      final String accountId=task.getAccountId();
      final Name name=(Name)AttributeUtil.find(Name.NAME,attributes);
      if (StringUtils.hasText(accountId) && (name == null || !accountId.equals(name.getNameValue()))) {
        final Uid uid=(Uid)AttributeUtil.find(Uid.NAME,attributes);
        if (uid == null) {
          attributes.add(AttributeBuilder.build(Uid.NAME,Collections.singleton(accountId)));
        }
      }
      connector.create(task.getPropagationMode(),ObjectClass.ACCOUNT,attributes,null,propagationAttempted);
    }
  break;
case DELETE:
if (remoteObject == null) {
  LOG.debug("String_Node_Str" + "String_Node_Str",task.getAccountId());
}
 else {
  connector.delete(task.getPropagationMode(),ObjectClass.ACCOUNT,remoteObject.getUid(),null,propagationAttempted);
}
break;
default :
}
execution.setStatus(task.getPropagationMode() == PropagationMode.ONE_PHASE ? PropagationTaskExecStatus.SUCCESS.name() : PropagationTaskExecStatus.SUBMITTED.name());
LOG.debug("String_Node_Str",task.getResource());
}
 catch (Throwable t) {
LOG.error("String_Node_Str" + task.getResource().getName(),t);
if (t instanceof ConnectorException && t.getCause() != null) {
taskExecutionMessage=t.getCause().getMessage();
}
 else {
StringWriter exceptionWriter=new StringWriter();
exceptionWriter.write(t.getMessage() + "String_Node_Str");
t.printStackTrace(new PrintWriter(exceptionWriter));
taskExecutionMessage=exceptionWriter.toString();
}
try {
execution.setStatus(task.getPropagationMode() == PropagationMode.ONE_PHASE ? PropagationTaskExecStatus.FAILURE.name() : PropagationTaskExecStatus.UNSUBMITTED.name());
}
 catch (Throwable wft) {
LOG.error("String_Node_Str",execution,wft);
}
propagationAttempted.add(task.getPropagationOperation().name().toLowerCase());
}
 finally {
LOG.debug("String_Node_Str",task);
if (hasToBeregistered(task,execution)) {
PropagationTask savedTask=taskDAO.save(task);
execution.setStartDate(startDate);
execution.setMessage(taskExecutionMessage);
execution.setEndDate(new Date());
execution.setTask(savedTask);
if (!propagationAttempted.isEmpty()) {
execution=taskExecDAO.save(execution);
LOG.debug("String_Node_Str",execution);
}
 else {
LOG.debug("String_Node_Str",execution);
}
}
}
return execution;
}