Program: 60932
Project: 60932
Buggy source:
/** 
 * Execute a propagation task.
 * @param task to execute
 * @param startDate timestamp for beginning task excecution
 * @return TaskExecution
 */
public TaskExec execute(final PropagationTask task,final Date startDate){
  TaskExec execution=new TaskExec();
  execution.setStatus(PropagationTaskExecStatus.CREATED.toString());
  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);
    }
switch (task.getResourceOperationType()) {
case CREATE:
case UPDATE:
      ConnectorObject remoteObject=null;
    try {
      remoteObject=connector.getObject(task.getPropagationMode(),task.getResourceOperationType(),ObjectClass.ACCOUNT,new Uid(task.getOldAccountId() == null ? task.getAccountId() : task.getOldAccountId()),null);
    }
 catch (    RuntimeException ignore) {
      LOG.debug("String_Node_Str" + "String_Node_Str",ignore);
    }
  if (remoteObject != null) {
    final Set<Attribute> attributes=new HashSet<Attribute>(task.getAttributes());
    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 {
    connector.create(task.getPropagationMode(),ObjectClass.ACCOUNT,task.getAttributes(),null,propagationAttempted);
  }
break;
case DELETE:
connector.delete(task.getPropagationMode(),ObjectClass.ACCOUNT,new Uid(task.getAccountId()),null,propagationAttempted);
break;
default :
}
execution.setStatus(task.getPropagationMode() == PropagationMode.SYNC ? PropagationTaskExecStatus.SUCCESS.toString() : PropagationTaskExecStatus.SUBMITTED.toString());
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.toString() : PropagationTaskExecStatus.UNSUBMITTED.toString());
}
 catch (Throwable wft) {
LOG.error("String_Node_Str",execution,wft);
}
propagationAttempted.add(task.getResourceOperationType().toString().toLowerCase());
}
 finally {
LOG.debug("String_Node_Str",task);
if (hasToBeregistered(task,execution)) {
PropagationTask savedTask=taskDAO.save(task);
if (!propagationAttempted.isEmpty()) {
execution.setStartDate(startDate);
execution.setMessage(taskExecutionMessage);
execution.setEndDate(new Date());
execution.setTask(savedTask);
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
 * @param startDate timestamp for beginning task excecution
 * @return TaskExecution
 */
public TaskExec execute(final PropagationTask task,final Date startDate){
  TaskExec execution=new TaskExec();
  execution.setStatus(PropagationTaskExecStatus.CREATED.toString());
  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);
    }
switch (task.getResourceOperationType()) {
case CREATE:
case UPDATE:
      ConnectorObject remoteObject=null;
    try {
      remoteObject=connector.getObject(task.getPropagationMode(),task.getResourceOperationType(),ObjectClass.ACCOUNT,new Uid(task.getOldAccountId() == null ? task.getAccountId() : task.getOldAccountId()),null);
    }
 catch (    RuntimeException ignore) {
      LOG.debug("String_Node_Str" + "String_Node_Str",ignore);
    }
  if (remoteObject != null) {
    final Set<Attribute> attributes=new HashSet<Attribute>(task.getAttributes());
    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 {
    connector.create(task.getPropagationMode(),ObjectClass.ACCOUNT,task.getAttributes(),null,propagationAttempted);
  }
break;
case DELETE:
connector.delete(task.getPropagationMode(),ObjectClass.ACCOUNT,new Uid(task.getAccountId()),null,propagationAttempted);
break;
default :
}
execution.setStatus(task.getPropagationMode() == PropagationMode.SYNC ? PropagationTaskExecStatus.SUCCESS.toString() : PropagationTaskExecStatus.SUBMITTED.toString());
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.toString() : PropagationTaskExecStatus.UNSUBMITTED.toString());
}
 catch (Throwable wft) {
LOG.error("String_Node_Str",execution,wft);
}
propagationAttempted.add(task.getResourceOperationType().toString().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;
}