Program: 176303
Project: 176303
Buggy source:
/** 
 * Setter for column value, by default converted from string value, in case of map it is automatically converted into map using BasicDBObject.
 * @param document mongo document
 * @param entityObject searched entity.
 * @param column column field.
 */
static void setFieldValue(DBObject document,Object entityObject,Attribute column){
  Object value=document.get(((AbstractAttribute)column).getJPAColumnName());
  if (value != null) {
    Class javaType=column.getJavaType();
    try {
switch (AttributeType.getType(javaType)) {
case MAP:
        PropertyAccessorHelper.set(entityObject,(Field)column.getJavaMember(),((BasicDBObject)value).toMap());
      break;
case SET:
    List collectionValues=Arrays.asList(((BasicDBList)value).toArray());
  PropertyAccessorHelper.set(entityObject,(Field)column.getJavaMember(),new HashSet(collectionValues));
break;
case LIST:
PropertyAccessorHelper.set(entityObject,(Field)column.getJavaMember(),Arrays.asList(((BasicDBList)value).toArray()));
break;
case POINT:
BasicDBList list=(BasicDBList)value;
Object xObj=list.get(0);
Object yObj=list.get(1);
if (xObj != null && yObj != null) {
try {
double x=Double.parseDouble(xObj.toString());
double y=Double.parseDouble(yObj.toString());
Point point=new Point(x,y);
PropertyAccessorHelper.set(entityObject,(Field)column.getJavaMember(),point);
}
 catch (NumberFormatException e) {
log.error("String_Node_Str",column,e);
throw new EntityReaderException("String_Node_Str" + column + "String_Node_Str",e);
}
}
break;
case ENUM:
EnumAccessor accessor=new EnumAccessor();
value=accessor.fromString(javaType,value.toString());
PropertyAccessorHelper.set(entityObject,(Field)column.getJavaMember(),value);
break;
case PRIMITIVE:
value=MongoDBUtils.populateValue(value,value.getClass());
value=MongoDBUtils.getTranslatedObject(value,value.getClass(),javaType);
PropertyAccessorHelper.set(entityObject,(Field)column.getJavaMember(),value);
break;
}
}
 catch (PropertyAccessException paex) {
log.error("String_Node_Str",((AbstractAttribute)column).getJPAColumnName(),paex);
throw new PersistenceException(paex);
}
}
}

Fixed version (ground truth):
/** 
 * Setter for column value, by default converted from string value, in case of map it is automatically converted into map using BasicDBObject.
 * @param document mongo document
 * @param entityObject searched entity.
 * @param column column field.
 */
static void setFieldValue(DBObject document,Object entityObject,Attribute column){
  Object value=null;
  if (document != null) {
    value=document.get(((AbstractAttribute)column).getJPAColumnName());
  }
  if (value != null) {
    Class javaType=column.getJavaType();
    try {
switch (AttributeType.getType(javaType)) {
case MAP:
        PropertyAccessorHelper.set(entityObject,(Field)column.getJavaMember(),((BasicDBObject)value).toMap());
      break;
case SET:
    List collectionValues=Arrays.asList(((BasicDBList)value).toArray());
  PropertyAccessorHelper.set(entityObject,(Field)column.getJavaMember(),new HashSet(collectionValues));
break;
case LIST:
PropertyAccessorHelper.set(entityObject,(Field)column.getJavaMember(),Arrays.asList(((BasicDBList)value).toArray()));
break;
case POINT:
BasicDBList list=(BasicDBList)value;
Object xObj=list.get(0);
Object yObj=list.get(1);
if (xObj != null && yObj != null) {
try {
double x=Double.parseDouble(xObj.toString());
double y=Double.parseDouble(yObj.toString());
Point point=new Point(x,y);
PropertyAccessorHelper.set(entityObject,(Field)column.getJavaMember(),point);
}
 catch (NumberFormatException e) {
log.error("String_Node_Str",column,e);
throw new EntityReaderException("String_Node_Str" + column + "String_Node_Str",e);
}
}
break;
case ENUM:
EnumAccessor accessor=new EnumAccessor();
value=accessor.fromString(javaType,value.toString());
PropertyAccessorHelper.set(entityObject,(Field)column.getJavaMember(),value);
break;
case PRIMITIVE:
value=MongoDBUtils.populateValue(value,value.getClass());
value=MongoDBUtils.getTranslatedObject(value,value.getClass(),javaType);
PropertyAccessorHelper.set(entityObject,(Field)column.getJavaMember(),value);
break;
}
}
 catch (PropertyAccessException paex) {
log.error("String_Node_Str",((AbstractAttribute)column).getJPAColumnName(),paex);
throw new PersistenceException(paex);
}
}
}