Program: 13243
Project: 13243
Buggy source:
public Set<Attribute> getCreateAttributes(final CreateRequest request,final CryptoService cryptoService) throws ResourceException {
  JsonValue content=request.getContent().required().expect(Map.class);
  String nameValue=request.getNewResourceId();
  if (null == nameValue) {
    JsonValue o=content.get(nameAttribute);
    if (o.isNull()) {
      o=content.get(Resource.FIELD_CONTENT_ID);
    }
    if (o.isString()) {
      nameValue=o.asString();
    }
  }
  if (StringUtils.isBlank(nameValue)) {
    throw new BadRequestException("String_Node_Str" + nameAttribute + "String_Node_Str");
  }
  Set<String> keySet=content.keys();
  Map<String,Attribute> result=new HashMap<String,Attribute>(keySet.size());
  result.put(Name.NAME,new Name(nameValue));
  for (  AttributeInfoHelper attributeInfo : attributes) {
    if (Name.NAME.equals(attributeInfo.getAttributeInfo().getName()) || Uid.NAME.equals(attributeInfo.getAttributeInfo().getName()) || (!keySet.contains(attributeInfo.getName()) && !attributeInfo.getAttributeInfo().isRequired())) {
      continue;
    }
    if (attributeInfo.getAttributeInfo().isCreateable()) {
      JsonValue v=content.get(attributeInfo.getName());
      if (v.isNull() && attributeInfo.getAttributeInfo().isRequired()) {
        throw new BadRequestException("String_Node_Str" + attributeInfo.getName() + "String_Node_Str");
      }
      Attribute a=attributeInfo.build(v.getObject(),cryptoService);
      if (null != a) {
        result.put(attributeInfo.getAttributeInfo().getName(),a);
      }
    }
  }
  if (logger.isTraceEnabled()) {
    ConnectorObjectBuilder builder=new ConnectorObjectBuilder().addAttributes(result.values());
    builder.setName(nameValue);
    builder.setUid(nameValue);
    logger.trace("String_Node_Str",SerializerUtil.serializeXmlObject(builder.build(),false));
  }
  return new HashSet<Attribute>(result.values());
}

Fixed version (ground truth):
/** 
 * Get the attributes are that are writable on a create
 * @param request CreateRequest
 * @param cryptoService encryption and decryption service
 * @return Set of attributes to that are writable on create
 * @throws BadRequestException when attribute is missing or has a null value
 */
public Set<Attribute> getCreateAttributes(final CreateRequest request,final CryptoService cryptoService) throws ResourceException {
  JsonValue content=request.getContent().required().expect(Map.class);
  String nameValue=getCreateNameValue(request);
  if (StringUtils.isBlank(nameValue)) {
    throw new BadRequestException("String_Node_Str" + nameAttribute + "String_Node_Str");
  }
  Set<String> keySet=content.keys();
  Map<String,Attribute> result=new HashMap<String,Attribute>(keySet.size());
  result.put(Name.NAME,new Name(nameValue));
  for (  AttributeInfoHelper attributeInfo : attributes) {
    if (Name.NAME.equals(attributeInfo.getAttributeInfo().getName()) || Uid.NAME.equals(attributeInfo.getAttributeInfo().getName()) || (!keySet.contains(attributeInfo.getName()) && !attributeInfo.getAttributeInfo().isRequired())) {
      continue;
    }
    if (attributeInfo.getAttributeInfo().isCreateable()) {
      JsonValue v=content.get(attributeInfo.getName());
      if (v.isNull() && attributeInfo.getAttributeInfo().isRequired()) {
        throw new BadRequestException("String_Node_Str" + attributeInfo.getName() + "String_Node_Str");
      }
      Attribute a=attributeInfo.build(v.getObject(),cryptoService);
      if (null != a) {
        result.put(attributeInfo.getAttributeInfo().getName(),a);
      }
    }
  }
  if (logger.isTraceEnabled()) {
    ConnectorObjectBuilder builder=new ConnectorObjectBuilder().addAttributes(result.values());
    builder.setName(nameValue);
    builder.setUid(nameValue);
    logger.trace("String_Node_Str",SerializerUtil.serializeXmlObject(builder.build(),false));
  }
  return new HashSet<Attribute>(result.values());
}