Program: 104784
Project: 104784
Buggy source:
@SuppressWarnings("String_Node_Str") protected FieldCriteria(QueryImpl<?> query,String field,FilterOperator op,Object value,boolean validateNames,boolean validateTypes){
  StringBuffer sb=new StringBuffer(field);
  MappedField mf=Mapper.validate(query.getEntityClass(),query.getDatastore().getMapper(),sb,op,value,validateNames,validateTypes);
  field=sb.toString();
  Mapper mapr=query.getDatastore().getMapper();
  Object mappedValue;
  MappedClass mc=null;
  try {
    if (value != null && !ReflectionUtils.isPropertyType(value.getClass()) && !ReflectionUtils.implementsInterface(value.getClass(),Iterable.class))     if (mf != null && !mf.isTypeMongoCompatible())     mc=mapr.getMappedClass((mf.isSingleValue()) ? mf.getType() : mf.getSubClass());
 else     mc=mapr.getMappedClass(value);
  }
 catch (  Exception e) {
    log.debug("String_Node_Str",e);
  }
  if ((mf != null && (mf.hasAnnotation(Reference.class) || mf.getType().isAssignableFrom(Key.class))) || (mc != null && mc.getEntityAnnotation() != null)) {
    try {
      Key<?> k=(value instanceof Key) ? (Key<?>)value : query.getDatastore().getKey(value);
      mappedValue=mapr.keyToRef(k);
    }
 catch (    Exception e) {
      log.debug("String_Node_Str" + value + "String_Node_Str",e);
      mappedValue=mapr.toMongoObject(value);
    }
  }
 else   if (mf != null && mf.hasAnnotation(Serialized.class))   try {
    mappedValue=Serializer.serialize(value,!mf.getAnnotation(Serialized.class).disableCompression());
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
 else   if (value instanceof DBObject)   mappedValue=value;
 else   mappedValue=mapr.toMongoObject(value);
  Class<?> type=(mappedValue != null) ? mappedValue.getClass() : null;
  if (type != null && (op == FilterOperator.IN || op == FilterOperator.NOT_IN) && !type.isArray() && !Iterable.class.isAssignableFrom(type)) {
    mappedValue=Collections.singletonList(mappedValue);
  }
  this.field=field;
  this.operator=op;
  this.value=mappedValue;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected FieldCriteria(QueryImpl<?> query,String field,FilterOperator op,Object value,boolean validateNames,boolean validateTypes){
  StringBuffer sb=new StringBuffer(field);
  MappedField mf=Mapper.validate(query.getEntityClass(),query.getDatastore().getMapper(),sb,op,value,validateNames,validateTypes);
  field=sb.toString();
  Mapper mapr=query.getDatastore().getMapper();
  Object mappedValue;
  MappedClass mc=null;
  try {
    if (value != null && !ReflectionUtils.isPropertyType(value.getClass()) && !ReflectionUtils.implementsInterface(value.getClass(),Iterable.class))     if (mf != null && !mf.isTypeMongoCompatible())     mc=mapr.getMappedClass((mf.isSingleValue()) ? mf.getType() : mf.getSubClass());
 else     mc=mapr.getMappedClass(value);
  }
 catch (  Exception e) {
    log.debug("String_Node_Str",e);
  }
  if ((mf != null && (mf.hasAnnotation(Reference.class) || mf.getType().isAssignableFrom(Key.class))) || (mc != null && mc.getEntityAnnotation() != null)) {
    try {
      Key<?> k=(value instanceof Key) ? (Key<?>)value : query.getDatastore().getKey(value);
      mappedValue=mapr.keyToRef(k);
    }
 catch (    Exception e) {
      log.debug("String_Node_Str" + value + "String_Node_Str",e);
      mappedValue=mapr.toMongoObject(value);
    }
  }
 else   if (mf != null && mf.hasAnnotation(Serialized.class))   try {
    mappedValue=Serializer.serialize(value,!mf.getAnnotation(Serialized.class).disableCompression());
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
 else   if (value instanceof DBObject)   mappedValue=value;
 else   mappedValue=mapr.toMongoObject(value);
  Class<?> type=(mappedValue != null) ? mappedValue.getClass() : null;
  if (type != null && (op == FilterOperator.IN || op == FilterOperator.NOT_IN) && !type.isArray() && !Iterable.class.isAssignableFrom(type)) {
    mappedValue=Collections.singletonList(mappedValue);
  }
  if (op == FilterOperator.ELEMENT_MATCH && mappedValue instanceof DBObject)   ((DBObject)mappedValue).removeField(Mapper.ID_KEY);
  this.field=field;
  this.operator=op;
  this.value=mappedValue;
}