Program: 61320
Project: 61320
Buggy source:
/** 
 * Propagate provision/update the resource indicated.
 * @param user to be created.
 * @param resource to be provisioned.
 * @param type to be performed on the specified resource
 * @throws NoSuchBeanDefinitionException if the connector bean doesn'texist.
 * @throws IllegalStateException if propagation fails.
 */
private void propagate(SyncopeUser user,TargetResource resource,Type type) throws NoSuchBeanDefinitionException, IllegalStateException {
  ConnectorInstance connectorInstance=resource.getConnector();
  ConnectorFacade connector=getConnectorFacade(connectorInstance.getId().toString());
  if (connector == null) {
    log.error("String_Node_Str" + connectorInstance.getId().toString() + "String_Node_Str");
    throw new NoSuchBeanDefinitionException("String_Node_Str");
  }
  String password=user.getPassword();
  List<SchemaMapping> mappings=resource.getMappings();
  Set<Attribute> attrs=new HashSet<Attribute>();
  Class castToBeApplied=null;
  String accountId=null;
  String field=null;
  Set objValues=null;
  String schema=null;
  UserAttribute userAttribute=null;
  SchemaType schemaType=null;
  List<UserAttributeValue> values=null;
  for (  SchemaMapping mapping : mappings) {
    field=mapping.getField();
    schema=mapping.getUserSchema().getName();
    userAttribute=user.getAttribute(schema);
    values=null;
    try {
      schemaType=mapping.getUserSchema().getType();
      castToBeApplied=Class.forName(schemaType.getClassName());
    }
 catch (    ClassNotFoundException e) {
      castToBeApplied=String.class;
    }
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + "String_Node_Str" + field + "String_Node_Str"+ mapping.isAccountid()+ "String_Node_Str"+ mapping.isPassword()+ "String_Node_Str"+ mapping.isNullable()+ "String_Node_Str"+ schema+ "String_Node_Str"+ schemaType.getClassName());
    }
    objValues=new HashSet();
    if (userAttribute != null) {
      values=userAttribute.getAttributeValues();
      for (      UserAttributeValue value : values) {
        objValues.add(value.getValue());
      }
    }
    if (!objValues.isEmpty() && mapping.isAccountid()) {
      accountId=objValues.iterator().next().toString();
      attrs.add(new Name(accountId));
    }
    if (password != null && mapping.isPassword()) {
      attrs.add(AttributeBuilder.buildPassword(password.toCharArray()));
    }
    if (!mapping.isPassword() && !mapping.isAccountid() && !objValues.isEmpty()) {
      if (mapping.getUserSchema().isMultivalue()) {
        attrs.add(AttributeBuilder.build(field,objValues));
      }
 else {
        attrs.add(AttributeBuilder.build(field,castToBeApplied.cast(objValues.iterator().next())));
      }
    }
  }
  Uid userUid=null;
switch (type) {
case CREATE:
    userUid=connector.create(ObjectClass.ACCOUNT,attrs,null);
  break;
case UPDATE:
userUid=connector.update(ObjectClass.ACCOUNT,new Uid(accountId),attrs,null);
break;
case DELETE:
connector.delete(ObjectClass.ACCOUNT,new Uid(accountId),null);
break;
}
if (userUid == null && type != Type.DELETE) {
log.error("String_Node_Str" + resource);
throw new IllegalStateException("String_Node_Str");
}
}

Fixed version (ground truth):
/** 
 * Propagate provision/update the resource indicated.
 * @param user to be created.
 * @param resource to be provisioned.
 * @param type to be performed on the specified resource
 * @throws NoSuchBeanDefinitionException if the connector bean doesn'texist.
 * @throws IllegalStateException if propagation fails.
 */
private void propagate(SyncopeUser user,TargetResource resource,Type type) throws NoSuchBeanDefinitionException, IllegalStateException {
  ConnectorInstance connectorInstance=resource.getConnector();
  ConnectorFacade connector=getConnectorFacade(connectorInstance.getId().toString());
  if (connector == null) {
    log.error("String_Node_Str" + connectorInstance.getId().toString() + "String_Node_Str");
    throw new NoSuchBeanDefinitionException("String_Node_Str");
  }
  String password=user.getPassword();
  List<SchemaMapping> mappings=resource.getMappings();
  Set<Attribute> attrs=new HashSet<Attribute>();
  Class castToBeApplied=null;
  String accountId=null;
  String field=null;
  Set objValues=null;
  String schema=null;
  UserAttribute userAttribute=null;
  SchemaType schemaType=null;
  List<UserAttributeValue> values=null;
  for (  SchemaMapping mapping : mappings) {
    try {
      field=mapping.getField();
      schema=mapping.getUserSchema().getName();
      schemaType=mapping.getUserSchema().getType();
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + "String_Node_Str" + field + "String_Node_Str"+ mapping.isAccountid()+ "String_Node_Str"+ mapping.isPassword()+ "String_Node_Str"+ mapping.isNullable()+ "String_Node_Str"+ schema+ "String_Node_Str"+ schemaType.getClassName());
      }
      userAttribute=user.getAttribute(schema);
      if (userAttribute == null) {
        throw new Exception("String_Node_Str" + userAttribute);
      }
      objValues=new HashSet();
      values=userAttribute.getAttributeValues();
      for (      UserAttributeValue value : values) {
        castToBeApplied=Class.forName(schemaType.getClassName());
        if (!FrameworkUtil.isSupportedAttributeType(castToBeApplied)) {
          castToBeApplied=String.class;
          objValues.add(value.getValueAsString());
        }
 else {
          objValues.add(value.getValue());
        }
      }
      if (mapping.isAccountid()) {
        accountId=objValues.iterator().next().toString();
        attrs.add(new Name(accountId));
      }
      if (mapping.isPassword()) {
        attrs.add(AttributeBuilder.buildPassword(password.toCharArray()));
      }
      Object objValue=null;
      if (!objValues.isEmpty())       objValue=objValues.iterator().next();
      if (!mapping.isPassword() && !mapping.isAccountid()) {
        if (mapping.getUserSchema().isMultivalue()) {
          attrs.add(AttributeBuilder.build(field,objValues));
        }
 else {
          attrs.add(AttributeBuilder.build(field,castToBeApplied.cast(objValue)));
        }
      }
    }
 catch (    ClassNotFoundException e) {
      if (log.isWarnEnabled()) {
        log.warn("String_Node_Str" + schemaType.getClassName(),e);
      }
    }
catch (    Throwable t) {
      if (log.isWarnEnabled()) {
        log.warn("String_Node_Str" + schema + "String_Node_Str",t);
      }
    }
  }
  Uid userUid=null;
switch (type) {
case CREATE:
    userUid=connector.create(ObjectClass.ACCOUNT,attrs,null);
  break;
case UPDATE:
userUid=connector.update(ObjectClass.ACCOUNT,new Uid(accountId),attrs,null);
break;
case DELETE:
connector.delete(ObjectClass.ACCOUNT,new Uid(accountId),null);
break;
}
if (userUid == null && type != Type.DELETE) {
log.error("String_Node_Str" + resource);
throw new IllegalStateException("String_Node_Str");
}
}