Program: 13310
Project: 13310
Buggy source:
/** 
 * Convert from JSON object structures (akin to simple binding), composed of the basic Java types:   {@link Map},   {@link List},   {@link String},  {@link Number},   {@link Boolean}. to OrientDB document
 * @param id
 * @param revision
 * @param content the JSON object structure to convert
 * @param docToPopulate an optional existing ODocument to update with new values from {@code objModel}
 * @return the converted orientdb document, or null if objModel was null
 * @throws ConflictException when the revision in the Object model is invalid
 */
public static ODocument toDocument(final String id,final String revision,final JsonValue content,final ODocument docToPopulate) throws ResourceException {
  if (null == docToPopulate) {
    return null;
  }
  try {
    if (null != content) {
      for (      String name : content.keys()) {
        if (isSpecialAttribute(name) || name.startsWith("String_Node_Str")) {
          content.remove(name);
        }
      }
    }
    if (null != content && content.size() > 0) {
      docToPopulate.fromJSON(JsonUtil.writeValueAsString(content));
    }
 else {
      for (      String iFieldName : docToPopulate.fieldNames()) {
        docToPopulate.removeField(iFieldName);
      }
    }
    if (StringUtils.isNotBlank(id)) {
      if (!docToPopulate.containsField(ORIENTDB_PRIMARY_KEY) || !docToPopulate.field(ORIENTDB_PRIMARY_KEY).equals(id)) {
        logger.trace("String_Node_Str",id);
        docToPopulate.field(ORIENTDB_PRIMARY_KEY,id);
      }
    }
    if (StringUtils.isNotBlank(revision) && !"String_Node_Str".equalsIgnoreCase(revision)) {
      int rev=parseVersion(revision);
      logger.trace("String_Node_Str",rev);
      if (docToPopulate.getVersion() != rev) {
        docToPopulate.setVersion(rev);
      }
    }
    return docToPopulate;
  }
 catch (  JsonProcessingException e) {
    throw new BadRequestException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Convert from JSON object structures (akin to simple binding), composed of the basic Java types:   {@link Map},   {@link List},   {@link String},  {@link Number},   {@link Boolean}. to OrientDB document
 * @param id
 * @param revision
 * @param content the JSON object structure to convert
 * @param docToPopulate an optional existing ODocument to update with new values from {@code objModel}
 * @return the converted orientdb document, or null if objModel was null
 * @throws ConflictException when the revision in the Object model is invalid
 */
public static ODocument toDocument(final String id,final String revision,final JsonValue content,final ODocument docToPopulate) throws ResourceException {
  if (null == docToPopulate) {
    return null;
  }
  try {
    if (null != content) {
      for (      String name : content.keys()) {
        if (isSpecialAttribute(name) || name.startsWith("String_Node_Str")) {
          content.remove(name);
        }
      }
    }
    String tmpId=id;
    if (null == tmpId) {
      tmpId=docToPopulate.field(ORIENTDB_PRIMARY_KEY);
    }
    if (null != content && content.size() > 0) {
      docToPopulate.fromJSON(JsonUtil.writeValueAsString(content));
    }
 else {
      for (      String iFieldName : docToPopulate.fieldNames()) {
        docToPopulate.removeField(iFieldName);
      }
    }
    if (StringUtils.isNotBlank(tmpId)) {
      if (!docToPopulate.containsField(ORIENTDB_PRIMARY_KEY) || !docToPopulate.field(ORIENTDB_PRIMARY_KEY).equals(id)) {
        logger.trace("String_Node_Str",tmpId);
        docToPopulate.field(ORIENTDB_PRIMARY_KEY,tmpId);
      }
    }
    if (StringUtils.isNotBlank(revision) && !"String_Node_Str".equalsIgnoreCase(revision)) {
      int rev=parseVersion(revision);
      logger.trace("String_Node_Str",rev);
      if (docToPopulate.getVersion() != rev) {
        docToPopulate.setVersion(rev);
      }
    }
    return docToPopulate;
  }
 catch (  JsonProcessingException e) {
    throw new BadRequestException("String_Node_Str",e);
  }
}