Program: 61379
Project: 61379
Buggy source:
/** 
 * Propagate provision/update the resource indicated.
 * @param user to be created.
 * @param resource to be provisioned.
 * @param merge specifies if it must be performed an update (true) or acreation (false).
 * @throws NoSuchBeanDefinitionException if the connector bean doesn'texist.
 * @throws IllegalStateException if propagation fails.
 */
private void propagate(SyncopeUser user,Resource resource,boolean merge) throws NoSuchBeanDefinitionException, IllegalStateException {
  ConnectorInstance connectorInstance=resource.getConnector();
  ConfigurableApplicationContext context=ApplicationContextManager.getApplicationContext();
  DefaultListableBeanFactory beanFactory=(DefaultListableBeanFactory)context.getBeanFactory();
  ConnectorFacade connector=(ConnectorFacade)beanFactory.getSingleton(connectorInstance.getId().toString());
  if (connector == null) {
    if (log.isErrorEnabled()) {
      log.error("String_Node_Str" + connectorInstance.getId().toString() + "String_Node_Str");
    }
    throw new NoSuchBeanDefinitionException("String_Node_Str");
  }
  Set<SchemaMapping> mappings=resource.getMappings();
  Set<Attribute> attrs=new HashSet<Attribute>();
  String accountId=null;
  String field=null;
  String password=user.getPassword();
  for (  SchemaMapping mapping : mappings) {
    field=mapping.getField();
    Object value=user.getAttribute(mapping.getUserSchema().getName());
    if (value != null && mapping.isAccountid()) {
      accountId=value.toString();
      attrs.add(new Name(accountId));
    }
    if (password != null && mapping.isPassword()) {
      attrs.add(AttributeBuilder.buildPassword(password.toCharArray()));
    }
    if (!mapping.isPassword() && !mapping.isAccountid()) {
      attrs.add(AttributeBuilder.build(field,value));
    }
  }
  Uid userUid=null;
  if (merge) {
    userUid=connector.update(ObjectClass.ACCOUNT,new Uid(accountId),attrs,null);
  }
 else {
    userUid=connector.create(ObjectClass.ACCOUNT,attrs,null);
  }
  if (userUid == null) {
    if (log.isErrorEnabled()) {
      log.error("String_Node_Str" + resource.getName());
    }
    throw new IllegalStateException("String_Node_Str");
  }
  if (log.isInfoEnabled()) {
    log.info("String_Node_Str" + userUid.getUidValue());
  }
}

Fixed version (ground truth):
/** 
 * Propagate provision/update the resource indicated.
 * @param user to be created.
 * @param resource to be provisioned.
 * @param merge specifies if it must be performed an update (true) or acreation (false).
 * @throws NoSuchBeanDefinitionException if the connector bean doesn'texist.
 * @throws IllegalStateException if propagation fails.
 */
private void propagate(SyncopeUser user,Resource resource,boolean merge) throws NoSuchBeanDefinitionException, IllegalStateException {
  ConnectorInstance connectorInstance=resource.getConnector();
  ConfigurableApplicationContext context=ApplicationContextManager.getApplicationContext();
  DefaultListableBeanFactory beanFactory=(DefaultListableBeanFactory)context.getBeanFactory();
  ConnectorFacade connector=(ConnectorFacade)beanFactory.getBean(connectorInstance.getId().toString());
  if (connector == null) {
    if (log.isErrorEnabled()) {
      log.error("String_Node_Str" + connectorInstance.getId().toString() + "String_Node_Str");
    }
    throw new NoSuchBeanDefinitionException("String_Node_Str");
  }
  Set<SchemaMapping> mappings=resource.getMappings();
  Set<Attribute> attrs=new HashSet<Attribute>();
  String accountId=null;
  String field=null;
  String password=user.getPassword();
  for (  SchemaMapping mapping : mappings) {
    field=mapping.getField();
    Object value=user.getAttribute(mapping.getUserSchema().getName());
    if (value != null && mapping.isAccountid()) {
      accountId=value.toString();
      attrs.add(new Name(accountId));
    }
    if (password != null && mapping.isPassword()) {
      attrs.add(AttributeBuilder.buildPassword(password.toCharArray()));
    }
    if (!mapping.isPassword() && !mapping.isAccountid()) {
      attrs.add(AttributeBuilder.build(field,value));
    }
  }
  Uid userUid=null;
  if (merge) {
    userUid=connector.update(ObjectClass.ACCOUNT,new Uid(accountId),attrs,null);
  }
 else {
    userUid=connector.create(ObjectClass.ACCOUNT,attrs,null);
  }
  if (userUid == null) {
    if (log.isErrorEnabled()) {
      log.error("String_Node_Str" + resource.getName());
    }
    throw new IllegalStateException("String_Node_Str");
  }
  if (log.isInfoEnabled()) {
    log.info("String_Node_Str" + userUid.getUidValue());
  }
}