nus-yam/ex-repair huggingface dataset:
Program: 104849
Project: 104849
Buggy source:
@Override public Object decode(Class targetClass,Object fromDBObject,MappedField optionalExtraInfo) throws MappingException {
  if (fromDBObject == null) {
    return null;
  }
  String l=fromDBObject.toString();
  try {
    return Class.forName(l);
  }
 catch (  ClassNotFoundException e) {
    throw new MappingException("String_Node_Str" + l + "String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public Object decode(Class targetClass,Object fromDBObject,MappedField optionalExtraInfo) throws MappingException {
  if (fromDBObject == null)   return null;
  String l=fromDBObject.toString();
  try {
    return Class.forName(l);
  }
 catch (  ClassNotFoundException e) {
    throw new MappingException("String_Node_Str" + l + "String_Node_Str",e);
  }
}
Program: 104850
Project: 104850
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public Object decode(Class targetClass,Object val,MappedField optionalExtraInfo) throws MappingException {
  if (val instanceof Date) {
    return val;
  }
  return new Date(Date.parse(val.toString()));
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public Object decode(Class targetClass,Object val,MappedField optionalExtraInfo) throws MappingException {
  if (val == null)   return null;
  if (val instanceof Date)   return val;
  return new Date(Date.parse(val.toString()));
}
Program: 104851
Project: 104851
Buggy source:
@Override public Object decode(Class targetClass,Object val,MappedField optionalExtraInfo) throws MappingException {
  if (val instanceof Double) {
    return (Double)val;
  }
  if (val instanceof Number) {
    return ((Number)val).doubleValue();
  }
  String sVal=val.toString();
  return Double.parseDouble(sVal);
}

Fixed version (ground truth):
@Override public Object decode(Class targetClass,Object val,MappedField optionalExtraInfo) throws MappingException {
  if (val == null)   return null;
  if (val instanceof Double)   return (Double)val;
  if (val instanceof Number)   return ((Number)val).doubleValue();
  String sVal=val.toString();
  return Double.parseDouble(sVal);
}
Program: 104852
Project: 104852
Buggy source:
@Override public Object decode(Class targetClass,Object fromDBObject,MappedField optionalExtraInfo) throws MappingException {
  return Enum.valueOf(targetClass,fromDBObject.toString());
}

Fixed version (ground truth):
@Override public Object decode(Class targetClass,Object fromDBObject,MappedField optionalExtraInfo) throws MappingException {
  if (fromDBObject == null)   return null;
  return Enum.valueOf(targetClass,fromDBObject.toString());
}
Program: 104853
Project: 104853
Buggy source:
@Override public Object decode(Class targetClass,Object val,MappedField optionalExtraInfo) throws MappingException {
  if (val instanceof Float)   return val;
  if (val instanceof Number) {
    return ((Number)val).floatValue();
  }
  String sVal=val.toString();
  return Float.parseFloat(sVal);
}

Fixed version (ground truth):
@Override public Object decode(Class targetClass,Object val,MappedField optionalExtraInfo) throws MappingException {
  if (val == null)   return null;
  if (val instanceof Float)   return val;
  if (val instanceof Number) {
    return ((Number)val).floatValue();
  }
  String sVal=val.toString();
  return Float.parseFloat(sVal);
}
Program: 104854
Project: 104854
Buggy source:
@Override public Object decode(Class targetClass,Object val,MappedField optionalExtraInfo) throws MappingException {
  if (val instanceof Integer)   return val;
  if (val instanceof Number)   return ((Number)val).intValue();
 else   return Integer.parseInt(val.toString());
}

Fixed version (ground truth):
@Override public Object decode(Class targetClass,Object val,MappedField optionalExtraInfo) throws MappingException {
  if (val == null)   return null;
  if (val instanceof Integer)   return val;
  if (val instanceof Number)   return ((Number)val).intValue();
 else   return Integer.parseInt(val.toString());
}
Program: 104855
Project: 104855
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public Object decode(Class targetClass,Object fromDBObject,MappedField mf) throws MappingException {
  if (mf == null)   return fromDBObject;
  if (fromDBObject == null)   return null;
  Class subtypeDest=mf.getSubType();
  Collection vals=null;
  if (fromDBObject.getClass().isArray()) {
    vals=new ArrayList();
    for (    Object o : (Object[])fromDBObject)     vals.add(chain.decode((subtypeDest != null) ? subtypeDest : o.getClass(),o));
  }
 else   if (fromDBObject instanceof Iterable) {
    vals=createNewCollection(mf);
    for (    Object o : (Iterable)fromDBObject)     vals.add(chain.decode((subtypeDest != null) ? subtypeDest : o.getClass(),o));
  }
  if (mf.getType().isArray()) {
    Object[] retArray=ReflectionUtils.convertToArray(subtypeDest,(ArrayList)vals);
    return retArray;
  }
 else   return vals;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public Object decode(Class targetClass,Object fromDBObject,MappedField mf) throws MappingException {
  if (mf == null || fromDBObject == null)   return fromDBObject;
  Class subtypeDest=mf.getSubType();
  Collection vals=null;
  if (fromDBObject.getClass().isArray()) {
    vals=new ArrayList();
    for (    Object o : (Object[])fromDBObject)     vals.add(chain.decode((subtypeDest != null) ? subtypeDest : o.getClass(),o));
  }
 else   if (fromDBObject instanceof Iterable) {
    vals=createNewCollection(mf);
    for (    Object o : (Iterable)fromDBObject)     vals.add(chain.decode((subtypeDest != null) ? subtypeDest : o.getClass(),o));
  }
  if (mf.getType().isArray()) {
    Object[] retArray=ReflectionUtils.convertToArray(subtypeDest,(ArrayList)vals);
    return retArray;
  }
 else   return vals;
}
Program: 104856
Project: 104856
Buggy source:
@Override public Object decode(Class targetClass,Object o,MappedField optionalExtraInfo) throws MappingException {
  return new Key((DBRef)o);
}

Fixed version (ground truth):
@Override public Object decode(Class targetClass,Object o,MappedField optionalExtraInfo) throws MappingException {
  if (o == null)   return null;
  return new Key((DBRef)o);
}
Program: 104857
Project: 104857
Buggy source:
@Override public Object encode(Object value,MappedField optionalExtraInfo){
  if (value == null)   return null;
  return value.toString();
}

Fixed version (ground truth):
@Override public Object encode(Object val,MappedField optionalExtraInfo){
  if (val == null)   return null;
  return val.toString();
}
Program: 104858
Project: 104858
Buggy source:
@Override public Object decode(Class targetClass,Object val,MappedField optionalExtraInfo) throws MappingException {
  if (val instanceof Number)   return ((Number)val).longValue();
 else   return Long.parseLong(val.toString());
}

Fixed version (ground truth):
@Override public Object decode(Class targetClass,Object val,MappedField optionalExtraInfo) throws MappingException {
  if (val == null)   return null;
  if (val instanceof Number)   return ((Number)val).longValue();
 else   return Long.parseLong(val.toString());
}
Program: 104859
Project: 104859
Buggy source:
@Override public Object decode(Class targetClass,Object fromDBObject,MappedField f) throws MappingException {
  Map<Object,Object> map=(Map<Object,Object>)fromDBObject;
  Map values=(Map)ReflectionUtils.newInstance(f.getCTor(),HashMap.class);
  for (  Map.Entry<Object,Object> entry : map.entrySet()) {
    Object objKey=converters.decode(f.getMapKeyType(),entry.getKey());
    values.put(objKey,converters.decode(f.getSubType(),entry.getValue()));
  }
  return values;
}

Fixed version (ground truth):
@Override public Object decode(Class targetClass,Object fromDBObject,MappedField f) throws MappingException {
  if (fromDBObject == null)   return null;
  Map<Object,Object> map=(Map<Object,Object>)fromDBObject;
  Map values=(Map)ReflectionUtils.newInstance(f.getCTor(),HashMap.class);
  for (  Map.Entry<Object,Object> entry : map.entrySet()) {
    Object objKey=converters.decode(f.getMapKeyType(),entry.getKey());
    values.put(objKey,converters.decode(f.getSubType(),entry.getValue()));
  }
  return values;
}
Program: 104860
Project: 104860
Buggy source:
@Override public Object decode(Class targetClass,Object fromDBObject,MappedField f) throws MappingException {
  if (!((fromDBObject instanceof Binary) || (fromDBObject instanceof byte[]))) {
    throw new MappingException("String_Node_Str" + f.getFullName() + "String_Node_Str"+ fromDBObject.getClass().getName());
  }
  try {
    boolean useCompression=!f.getAnnotation(Serialized.class).disableCompression();
    return Serializer.deserialize(fromDBObject,useCompression);
  }
 catch (  IOException e) {
    throw new MappingException("String_Node_Str" + f.getFullName(),e);
  }
catch (  ClassNotFoundException e) {
    throw new MappingException("String_Node_Str" + f.getFullName(),e);
  }
}

Fixed version (ground truth):
@Override public Object decode(Class targetClass,Object fromDBObject,MappedField f) throws MappingException {
  if (fromDBObject == null)   return null;
  if (!((fromDBObject instanceof Binary) || (fromDBObject instanceof byte[]))) {
    throw new MappingException("String_Node_Str" + f.getFullName() + "String_Node_Str"+ fromDBObject.getClass().getName());
  }
  try {
    boolean useCompression=!f.getAnnotation(Serialized.class).disableCompression();
    return Serializer.deserialize(fromDBObject,useCompression);
  }
 catch (  IOException e) {
    throw new MappingException("String_Node_Str" + f.getFullName(),e);
  }
catch (  ClassNotFoundException e) {
    throw new MappingException("String_Node_Str" + f.getFullName(),e);
  }
}
Program: 104861
Project: 104861
Buggy source:
@Override public Object decode(Class targetClass,Object val,MappedField optionalExtraInfo) throws MappingException {
  Object dbValue=val;
  if (dbValue instanceof Number)   return ((Number)dbValue).shortValue();
  String sVal=val.toString();
  return Short.parseShort(sVal);
}

Fixed version (ground truth):
@Override public Object decode(Class targetClass,Object val,MappedField optionalExtraInfo) throws MappingException {
  if (val == null)   return null;
  Object dbValue=val;
  if (dbValue instanceof Number)   return ((Number)dbValue).shortValue();
  String sVal=val.toString();
  return Short.parseShort(sVal);
}
Program: 104862
Project: 104862
Buggy source:
@Override public Object decode(Class targetClass,Object fromDBObject,MappedField optionalExtraInfo) throws MappingException {
  if (fromDBObject instanceof String) {
    return (String)fromDBObject;
  }
  return fromDBObject.toString();
}

Fixed version (ground truth):
@Override public Object decode(Class targetClass,Object fromDBObject,MappedField optionalExtraInfo) throws MappingException {
  if (fromDBObject == null)   return null;
  if (fromDBObject instanceof String)   return (String)fromDBObject;
  return fromDBObject.toString();
}
Program: 104863
Project: 104863
Buggy source:
public UpdateOperations<T> add(String fieldExpr,Object value,boolean addDups){
  Object dbObj=mapr.toMongoObject(value);
  add((addDups) ? "String_Node_Str" : "String_Node_Str",fieldExpr,dbObj);
  return this;
}

Fixed version (ground truth):
public UpdateOperations<T> add(String fieldExpr,Object value,boolean addDups){
  if (value == null)   throw new QueryException("String_Node_Str");
  Object dbObj=mapr.toMongoObject(value);
  add((addDups) ? "String_Node_Str" : "String_Node_Str",fieldExpr,dbObj);
  return this;
}
Program: 104864
Project: 104864
Buggy source:
public UpdateOperations<T> set(String fieldExpr,Object value){
  Object dbObj=mapr.toMongoObject(value);
  add("String_Node_Str",fieldExpr,dbObj);
  return this;
}

Fixed version (ground truth):
public UpdateOperations<T> set(String fieldExpr,Object value){
  if (value == null)   throw new QueryException("String_Node_Str");
  Object dbObj=mapr.toMongoObject(value);
  add("String_Node_Str",fieldExpr,dbObj);
  return this;
}
Program: 104865
Project: 104865
Buggy source:
public UpdateOperations<T> removeAll(String fieldExpr,List<?> values){
  List<Object> vals=toDBObjList(values);
  add("String_Node_Str",fieldExpr,vals);
  return this;
}

Fixed version (ground truth):
public UpdateOperations<T> removeAll(String fieldExpr,List<?> values){
  if (values == null || values.isEmpty())   throw new QueryException("String_Node_Str");
  List<Object> vals=toDBObjList(values);
  add("String_Node_Str",fieldExpr,vals);
  return this;
}
Program: 104866
Project: 104866
Buggy source:
public UpdateOperations<T> addAll(String fieldExpr,List<?> values,boolean addDups){
  List<?> convertedValues=(List<?>)mapr.toMongoObject(values);
  if (addDups)   add("String_Node_Str",fieldExpr,convertedValues);
 else   add("String_Node_Str",fieldExpr,new BasicDBObject("String_Node_Str",convertedValues));
  return this;
}

Fixed version (ground truth):
public UpdateOperations<T> addAll(String fieldExpr,List<?> values,boolean addDups){
  if (values == null || values.isEmpty())   throw new QueryException("String_Node_Str");
  List<?> convertedValues=(List<?>)mapr.toMongoObject(values);
  if (addDups)   add("String_Node_Str",fieldExpr,convertedValues);
 else   add("String_Node_Str",fieldExpr,new BasicDBObject("String_Node_Str",convertedValues));
  return this;
}
Program: 104867
Project: 104867
Buggy source:
public UpdateOperations<T> inc(String fieldExpr,Number value){
  add("String_Node_Str",fieldExpr,value);
  return this;
}

Fixed version (ground truth):
public UpdateOperations<T> inc(String fieldExpr,Number value){
  if (value == null)   throw new QueryException("String_Node_Str");
  add("String_Node_Str",fieldExpr,value);
  return this;
}
Program: 104868
Project: 104868
Buggy source:
public Query<T> hasThisOne(Object val){
  Assert.parametersNotNull("String_Node_Str",val);
  query.filter(fieldExpr + "String_Node_Str",val);
  return query;
}

Fixed version (ground truth):
public Query<T> hasThisOne(Object val){
  query.filter(fieldExpr + "String_Node_Str",val);
  return query;
}
Program: 104870
Project: 104870
Buggy source:
public Query<T> notEqual(Object val){
  Assert.parametersNotNull("String_Node_Str",val);
  query.filter(fieldExpr + "String_Node_Str",val);
  return query;
}

Fixed version (ground truth):
public Query<T> notEqual(Object val){
  query.filter(fieldExpr + "String_Node_Str",val);
  return query;
}
Program: 104871
Project: 104871
Buggy source:
public Query<T> equal(Object val){
  Assert.parametersNotNull("String_Node_Str",val);
  query.filter(fieldExpr + "String_Node_Str",val);
  return query;
}

Fixed version (ground truth):
public Query<T> equal(Object val){
  query.filter(fieldExpr + "String_Node_Str",val);
  return query;
}
Program: 104872
Project: 104872
Buggy source:
@Test public void testQueryOverReference() throws Exception {
  ContainsPic cpk=new ContainsPic();
  Pic p=new Pic();
  ds.save(p);
  cpk.pic=p;
  ds.save(cpk);
  Query<ContainsPic> query=ds.createQuery(ContainsPic.class);
  assertEquals(1,query.field("String_Node_Str").equal(p).asList().size());
}

Fixed version (ground truth):
@Test public void testQueryOverReference() throws Exception {
  ContainsPic cpk=new ContainsPic();
  Pic p=new Pic();
  ds.save(p);
  cpk.pic=p;
  ds.save(cpk);
  Query<ContainsPic> query=ds.createQuery(ContainsPic.class);
  assertEquals(1,query.field("String_Node_Str").equal(p).asList().size());
  try {
    ds.find(ContainsPic.class,"String_Node_Str","String_Node_Str").get();
    assertNull("String_Node_Str");
  }
 catch (  MappingException e) {
  }
}
Program: 104873
Project: 104873
Buggy source:
@Test public void testReferenceQuery() throws Exception {
  Photo p=new Photo();
  ContainsPhotoKey cpk=new ContainsPhotoKey();
  cpk.photo=ds.save(p);
  ds.save(cpk);
  assertNotNull(ds.find(ContainsPhotoKey.class,"String_Node_Str",p).get());
  assertNotNull(ds.find(ContainsPhotoKey.class,"String_Node_Str",cpk.photo).get());
  assertNull(ds.find(ContainsPhotoKey.class,"String_Node_Str",1).get());
}

Fixed version (ground truth):
@Test public void testReferenceQuery() throws Exception {
  Photo p=new Photo();
  ContainsPhotoKey cpk=new ContainsPhotoKey();
  cpk.photo=ds.save(p);
  ds.save(cpk);
  assertNotNull(ds.find(ContainsPhotoKey.class,"String_Node_Str",p).get());
  assertNotNull(ds.find(ContainsPhotoKey.class,"String_Node_Str",cpk.photo).get());
  assertNull(ds.find(ContainsPhotoKey.class,"String_Node_Str",1).get());
  try {
    ds.find(ContainsPhotoKey.class,"String_Node_Str","String_Node_Str").get();
    assertNull("String_Node_Str");
  }
 catch (  MappingException e) {
  }
}
Program: 104874
Project: 104874
Buggy source:
boolean exists(Class c,final DBRef dbRef){
  Datastore ds=mapper.datastoreProvider.get();
  return ds.createQuery(c).filter(Mapper.ID_KEY,dbRef.getId()).countAll() == 1;
}

Fixed version (ground truth):
boolean exists(Class c,final DBRef dbRef){
  Datastore ds=mapper.datastoreProvider.get();
  return dbRef.fetch() != null;
}
Program: 104875
Project: 104875
Buggy source:
@Test @Ignore public void testLoadingOfRefThroughInheritanceInField() throws Exception {
  morphia.map(ContainerWithRefInField.class);
  morphia.map(OtherEntityChild.class);
  OtherEntityChild otherEntity=new OtherEntityChild();
  ContainerWithRefInField containerWithRefInField=new ContainerWithRefInField();
  ds.save(otherEntity,containerWithRefInField);
  otherEntity=ds.get(otherEntity);
  final ContainerWithRefInField reload=ds.get(containerWithRefInField);
  Assert.assertNotNull(otherEntity);
  Assert.assertNotNull(reload);
  EmbedWithRef embedWithRef=new EmbedWithRef();
  embedWithRef.otherEntity=otherEntity;
  reload.embedWithRef=embedWithRef;
  ds.save(reload);
  ds.get(reload);
  containerWithRefInField=ds.get(containerWithRefInField);
  Assert.assertNotNull(containerWithRefInField);
}

Fixed version (ground truth):
@Test public void testLoadingOfRefThroughInheritanceInField() throws Exception {
  morphia.map(ContainerWithRefInField.class);
  morphia.map(OtherEntityChild.class);
  OtherEntityChild otherEntity=new OtherEntityChild();
  ContainerWithRefInField containerWithRefInField=new ContainerWithRefInField();
  ds.save(otherEntity,containerWithRefInField);
  otherEntity=ds.get(otherEntity);
  final ContainerWithRefInField reload=ds.get(containerWithRefInField);
  Assert.assertNotNull(otherEntity);
  Assert.assertNotNull(reload);
  EmbedWithRef embedWithRef=new EmbedWithRef();
  embedWithRef.otherEntity=otherEntity;
  reload.embedWithRef=embedWithRef;
  ds.save(reload);
  ds.get(reload);
  containerWithRefInField=ds.get(containerWithRefInField);
  Assert.assertNotNull(containerWithRefInField);
}
Program: 104876
Project: 104876
Buggy source:
@Test @Ignore public void testLoadingOfRefThroughInheritanceInList() throws Exception {
  morphia.map(ContainerWithRefList.class);
  morphia.map(OtherEntityChild.class);
  OtherEntityChild otherEntity=new OtherEntityChild();
  ContainerWithRefList containerWithRefInList=new ContainerWithRefList();
  ds.save(otherEntity,containerWithRefInList);
  otherEntity=ds.get(otherEntity);
  final ContainerWithRefList reload=ds.get(containerWithRefInList);
  Assert.assertNotNull(otherEntity);
  Assert.assertNotNull(reload);
  EmbedWithRef embedWithRef=new EmbedWithRef();
  embedWithRef.otherEntity=otherEntity;
  reload.embedWithRef.add(embedWithRef);
  ds.save(otherEntity,reload);
  ds.get(reload);
  containerWithRefInList=ds.get(reload);
  Assert.assertNotNull(containerWithRefInList);
  Query<ContainerWithRefList> createQuery=ds.createQuery(ContainerWithRefList.class);
  containerWithRefInList=createQuery.get();
  Assert.assertNotNull(containerWithRefInList);
}

Fixed version (ground truth):
@Test public void testLoadingOfRefThroughInheritanceInList() throws Exception {
  morphia.map(ContainerWithRefList.class);
  morphia.map(OtherEntityChild.class);
  OtherEntityChild otherEntity=new OtherEntityChild();
  ContainerWithRefList containerWithRefInList=new ContainerWithRefList();
  ds.save(otherEntity,containerWithRefInList);
  otherEntity=ds.get(otherEntity);
  final ContainerWithRefList reload=ds.get(containerWithRefInList);
  Assert.assertNotNull(otherEntity);
  Assert.assertNotNull(reload);
  EmbedWithRef embedWithRef=new EmbedWithRef();
  embedWithRef.otherEntity=otherEntity;
  reload.embedWithRef.add(embedWithRef);
  ds.save(otherEntity,reload);
  ds.get(reload);
  containerWithRefInList=ds.get(reload);
  Assert.assertNotNull(containerWithRefInList);
  Query<ContainerWithRefList> createQuery=ds.createQuery(ContainerWithRefList.class);
  containerWithRefInList=createQuery.get();
  Assert.assertNotNull(containerWithRefInList);
}
Program: 104877
Project: 104877
Buggy source:
@Test @Ignore public void testLoadingOfRefInList() throws Exception {
  morphia.map(ContainerWithRefList.class);
  morphia.map(OtherEntity.class);
  OtherEntity otherEntity=new OtherEntity();
  ContainerWithRefList containerWithRefInList=new ContainerWithRefList();
  ds.save(otherEntity,containerWithRefInList);
  otherEntity=ds.get(otherEntity);
  containerWithRefInList=ds.get(containerWithRefInList);
  Assert.assertNotNull(otherEntity);
  Assert.assertNotNull(containerWithRefInList);
  EmbedWithRef embedWithRef=new EmbedWithRef();
  embedWithRef.otherEntity=otherEntity;
  containerWithRefInList.embedWithRef.add(embedWithRef);
  ds.save(otherEntity,containerWithRefInList);
  containerWithRefInList=ds.get(containerWithRefInList);
  Assert.assertNotNull(containerWithRefInList);
  Query<ContainerWithRefList> createQuery=ds.createQuery(ContainerWithRefList.class);
  containerWithRefInList=createQuery.get();
  Assert.assertNotNull(containerWithRefInList);
}

Fixed version (ground truth):
@Test public void testLoadingOfRefInList() throws Exception {
  morphia.map(ContainerWithRefList.class);
  morphia.map(OtherEntity.class);
  OtherEntity otherEntity=new OtherEntity();
  ContainerWithRefList containerWithRefInList=new ContainerWithRefList();
  ds.save(otherEntity,containerWithRefInList);
  otherEntity=ds.get(otherEntity);
  containerWithRefInList=ds.get(containerWithRefInList);
  Assert.assertNotNull(otherEntity);
  Assert.assertNotNull(containerWithRefInList);
  EmbedWithRef embedWithRef=new EmbedWithRef();
  embedWithRef.otherEntity=otherEntity;
  containerWithRefInList.embedWithRef.add(embedWithRef);
  ds.save(otherEntity,containerWithRefInList);
  containerWithRefInList=ds.get(containerWithRefInList);
  Assert.assertNotNull(containerWithRefInList);
  Query<ContainerWithRefList> createQuery=ds.createQuery(ContainerWithRefList.class);
  containerWithRefInList=createQuery.get();
  Assert.assertNotNull(containerWithRefInList);
}
Program: 104878
Project: 104878
Buggy source:
private <T>void postSaveOperations(Object entity,DBObject dbObj,DBCollection dbColl,LinkedHashMap<Object,DBObject> involvedObjects){
  Mapper mapr=morphia.getMapper();
  MappedClass mc=mapr.getMappedClass(entity);
  mapr.updateKeyInfo(entity,dbObj.get(Mapper.ID_KEY));
  firePostPersistForChildren(involvedObjects,mapr);
  mc.callLifecycleMethods(PostPersist.class,entity,dbObj,mapr);
}

Fixed version (ground truth):
private <T>void postSaveOperations(Object entity,DBObject dbObj,DBCollection dbColl,LinkedHashMap<Object,DBObject> involvedObjects){
  Mapper mapr=morphia.getMapper();
  MappedClass mc=mapr.getMappedClass(entity);
  mapr.updateKeyInfo(entity,dbObj);
  firePostPersistForChildren(involvedObjects,mapr);
  mc.callLifecycleMethods(PostPersist.class,entity,dbObj,mapr);
}
Program: 104879
Project: 104879
Buggy source:
/** 
 * Returns the name of the field's key-name for mongodb
 */
private String getMappedFieldName(){
  if (hasAnnotation(Property.class)) {
    Property mv=(Property)mappingAnnotations.get(Property.class);
    if (!mv.value().equals(Mapper.IGNORED_FIELDNAME))     return mv.value();
  }
 else   if (hasAnnotation(Reference.class)) {
    Reference mr=(Reference)mappingAnnotations.get(Reference.class);
    if (!mr.value().equals(Mapper.IGNORED_FIELDNAME))     return mr.value();
  }
 else   if (hasAnnotation(Embedded.class)) {
    Embedded me=(Embedded)mappingAnnotations.get(Embedded.class);
    if (!me.value().equals(Mapper.IGNORED_FIELDNAME))     return me.value();
  }
 else   if (hasAnnotation(Serialized.class)) {
    Serialized me=(Serialized)mappingAnnotations.get(Serialized.class);
    if (!me.value().equals(Mapper.IGNORED_FIELDNAME))     return me.value();
  }
  return this.field.getName();
}

Fixed version (ground truth):
/** 
 * Returns the name of the field's key-name for mongodb
 */
private String getMappedFieldName(){
  if (hasAnnotation(Property.class)) {
    Property mv=(Property)mappingAnnotations.get(Property.class);
    if (!mv.value().equals(Mapper.IGNORED_FIELDNAME))     return mv.value();
  }
 else   if (hasAnnotation(Reference.class)) {
    Reference mr=(Reference)mappingAnnotations.get(Reference.class);
    if (!mr.value().equals(Mapper.IGNORED_FIELDNAME))     return mr.value();
  }
 else   if (hasAnnotation(Embedded.class)) {
    Embedded me=(Embedded)mappingAnnotations.get(Embedded.class);
    if (!me.value().equals(Mapper.IGNORED_FIELDNAME))     return me.value();
  }
 else   if (hasAnnotation(Serialized.class)) {
    Serialized me=(Serialized)mappingAnnotations.get(Serialized.class);
    if (!me.value().equals(Mapper.IGNORED_FIELDNAME))     return me.value();
  }
 else   if (hasAnnotation(Id.class))   return Mapper.ID_KEY;
  return this.field.getName();
}
Program: 104881
Project: 104881
Buggy source:
/** 
 * <p> Updates the @  {@link Id} fields.</p>
 * @param entity The object to update
 * @param rawIdValue Value to update with; null means skip
 */
public void updateKeyInfo(final Object entity,final Object rawIdValue){
  MappedClass mc=getMappedClass(entity);
  if ((mc.getIdField() != null) && (rawIdValue != null)) {
    try {
      Object dbIdValue=converters.decode(mc.getIdField().getType(),rawIdValue);
      Object idValue=mc.getIdField().get(entity);
      if (idValue != null) {
        if (!dbIdValue.equals(idValue)) {
          throw new RuntimeException("String_Node_Str" + idValue + "String_Node_Str"+ dbIdValue+ "String_Node_Str"+ entity.getClass().getName());
        }
      }
 else {
        mc.getIdField().set(entity,dbIdValue);
      }
    }
 catch (    Exception e) {
      if (e.getClass().equals(RuntimeException.class)) {
        throw (RuntimeException)e;
      }
      throw new RuntimeException(e);
    }
  }
}

Fixed version (ground truth):
/** 
 * <p> Updates the @  {@link Id} fields.</p>
 * @param entity The object to update
 * @param rawIdValue Value to update with; null means skip
 */
public void updateKeyInfo(final Object entity,final DBObject dbObj){
  MappedClass mc=getMappedClass(entity);
  if ((mc.getIdField() != null) && (dbObj != null) && (dbObj.get(ID_KEY) != null)) {
    try {
      MappedField mf=mc.getMappedField(ID_KEY);
      Object oldIdValue=mc.getIdField().get(entity);
      setIdValue(entity,mf,dbObj,new HashMap<Key,Object>());
      Object dbIdValue=mc.getIdField().get(entity);
      if (oldIdValue != null) {
        if (!dbIdValue.equals(oldIdValue)) {
          mf.setFieldValue(entity,oldIdValue);
          throw new RuntimeException("String_Node_Str" + oldIdValue + "String_Node_Str"+ dbIdValue+ "String_Node_Str"+ entity.getClass().getName());
        }
      }
 else {
        mc.getIdField().set(entity,dbIdValue);
      }
    }
 catch (    Exception e) {
      if (e.getClass().equals(RuntimeException.class)) {
        throw (RuntimeException)e;
      }
      throw new RuntimeException(e);
    }
  }
}
Program: 104883
Project: 104883
Buggy source:
@Test @Ignore public void SerializableId() throws Exception {
  CustomId cId=new CustomId();
  cId.id=new ObjectId();
  cId.type="String_Node_Str";
  UsesCustomIdObject ucio=new UsesCustomIdObject();
  ucio.id=cId;
  ucio.text="String_Node_Str";
  this.ds.save(ucio);
}

Fixed version (ground truth):
@Test public void SerializableId() throws Exception {
  CustomId cId=new CustomId();
  cId.id=new ObjectId();
  cId.type="String_Node_Str";
  UsesCustomIdObject ucio=new UsesCustomIdObject();
  ucio.id=cId;
  ucio.text="String_Node_Str";
  this.ds.save(ucio);
}
Program: 104884
Project: 104884
Buggy source:
@Override public Query<T> order(String condition){
  sort=BasicDBObjectBuilder.start();
  String[] sorts=condition.split("String_Node_Str");
  for (int i=0; i < sorts.length; i++) {
    String s=sorts[i];
    condition=condition.trim();
    int dir=1;
    if (condition.startsWith("String_Node_Str")) {
      dir=-1;
      condition=condition.substring(1).trim();
    }
    sort=sort.add(s,dir);
  }
  return this;
}

Fixed version (ground truth):
@Override public Query<T> order(String condition){
  sort=BasicDBObjectBuilder.start();
  String[] sorts=condition.split("String_Node_Str");
  for (  String s : sorts) {
    condition=condition.trim();
    int dir=1;
    if (condition.startsWith("String_Node_Str")) {
      dir=-1;
      condition=condition.substring(1).trim();
    }
    sort=sort.add(s,dir);
  }
  return this;
}
Program: 104887
Project: 104887
Buggy source:
void fromDBObject(final DBObject dbObject,final MappedField mf,final Object entity,final Map<Key,Object> retrieved){
  String name=mf.getName();
  Class fieldType=mf.getType();
  try {
    if (mf.isMap()) {
      readMap(dbObject,mf,entity,name,retrieved);
    }
 else     if (mf.isMultipleValues()) {
      readCollection(dbObject,mf,entity,name,retrieved);
    }
 else {
      if (dbObject.containsField(name)) {
        BasicDBObject dbVal=(BasicDBObject)dbObject.get(name);
        Object refObj=ReflectionUtils.createInstance(fieldType,dbVal);
        refObj=mapper.fromDb(dbVal,refObj,null);
        if (refObj != null) {
          mf.setFieldValue(entity,refObj);
        }
      }
    }
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
void fromDBObject(final DBObject dbObject,final MappedField mf,final Object entity,final Map<Key,Object> retrieved){
  String name=mf.getName();
  Class fieldType=mf.getType();
  try {
    if (mf.isMap()) {
      readMap(dbObject,mf,entity,name,retrieved);
    }
 else     if (mf.isMultipleValues()) {
      readCollection(dbObject,mf,entity,name,retrieved);
    }
 else {
      if (dbObject.containsField(name)) {
        BasicDBObject dbVal=(BasicDBObject)dbObject.get(name);
        Object refObj=ReflectionUtils.createInstance(fieldType,dbVal);
        refObj=mapper.fromDb(dbVal,refObj,retrieved);
        if (refObj != null) {
          mf.setFieldValue(entity,refObj);
        }
      }
    }
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}
Program: 104888
Project: 104888
Buggy source:
UpdateOperations add(String fieldExpr,List<?> values,boolean addDups);

Fixed version (ground truth):
UpdateOperations add(String fieldExpr,Object value,boolean addDups);
Program: 104889
Project: 104889
Buggy source:
public UpdateOperations add(String fieldExpr,List<?> values,boolean addDups){
  List<Object> vals=toDBObjList(values);
  add((addDups) ? "String_Node_Str" : "String_Node_Str",fieldExpr,vals);
  return this;
}

Fixed version (ground truth):
public UpdateOperations add(String fieldExpr,Object value,boolean addDups){
  Object dbObj=mapr.toMongoObject(value);
  add((addDups) ? "String_Node_Str" : "String_Node_Str",fieldExpr,dbObj);
  return this;
}
Program: 104890
Project: 104890
Buggy source:
private void readMap(final DBObject dbObject,final MappedField mf,final Object entity,String name){
  Map map=(Map)ReflectionUtils.newInstance(mf.getCTor(),HashMap.class);
  if (dbObject.containsField(name)) {
    BasicDBObject dbVal=(BasicDBObject)dbObject.get(name);
    for (    Map.Entry entry : dbVal.entrySet()) {
      Object newEntity=ReflectionUtils.createInstance(mf.getSubType(),(BasicDBObject)entry.getValue());
      newEntity=mapper.fromDb((BasicDBObject)entry.getValue(),newEntity,null);
      Object objKey=converters.decode(mf.getMapKeyType(),entry.getKey());
      map.put(objKey,newEntity);
    }
  }
  if (map.size() > 0) {
    mf.setFieldValue(entity,map);
  }
}

Fixed version (ground truth):
private void readMap(final DBObject dbObject,final MappedField mf,final Object entity,String name,Map<Key,Object> retrieved){
  Map map=(Map)ReflectionUtils.newInstance(mf.getCTor(),HashMap.class);
  if (dbObject.containsField(name)) {
    BasicDBObject dbVal=(BasicDBObject)dbObject.get(name);
    for (    Map.Entry entry : dbVal.entrySet()) {
      Object newEntity=ReflectionUtils.createInstance(mf.getSubType(),(BasicDBObject)entry.getValue());
      newEntity=mapper.fromDb((BasicDBObject)entry.getValue(),newEntity,retrieved);
      Object objKey=converters.decode(mf.getMapKeyType(),entry.getKey());
      map.put(objKey,newEntity);
    }
  }
  if (map.size() > 0) {
    mf.setFieldValue(entity,map);
  }
}
Program: 104891
Project: 104891
Buggy source:
private void readCollection(final DBObject dbObject,final MappedField mf,final Object entity,String name){
  Class newEntityType=mf.getSubType();
  Collection values=(Collection)ReflectionUtils.newInstance(mf.getCTor(),(!mf.isSet()) ? ArrayList.class : HashSet.class);
  if (dbObject.containsField(name)) {
    Object dbVal=dbObject.get(name);
    List<BasicDBObject> dbVals=(dbVal instanceof List) ? (List<BasicDBObject>)dbVal : Collections.singletonList((BasicDBObject)dbVal);
    for (    BasicDBObject dbObj : dbVals) {
      Object newEntity=ReflectionUtils.createInstance(newEntityType,dbObj);
      newEntity=mapper.fromDb(dbObj,newEntity,null);
      values.add(newEntity);
    }
  }
  if (values.size() > 0) {
    if (mf.getType().isArray()) {
      Object[] array=ReflectionUtils.convertToArray(mf.getSubType(),values);
      mf.setFieldValue(entity,array);
    }
 else {
      mf.setFieldValue(entity,values);
    }
  }
}

Fixed version (ground truth):
private void readCollection(final DBObject dbObject,final MappedField mf,final Object entity,String name,final Map<Key,Object> retrieved){
  Class newEntityType=mf.getSubType();
  Collection values=(Collection)ReflectionUtils.newInstance(mf.getCTor(),(!mf.isSet()) ? ArrayList.class : HashSet.class);
  if (dbObject.containsField(name)) {
    Object dbVal=dbObject.get(name);
    List<BasicDBObject> dbVals=(dbVal instanceof List) ? (List<BasicDBObject>)dbVal : Collections.singletonList((BasicDBObject)dbVal);
    for (    BasicDBObject dbObj : dbVals) {
      Object newEntity=ReflectionUtils.createInstance(newEntityType,dbObj);
      newEntity=mapper.fromDb(dbObj,newEntity,retrieved);
      values.add(newEntity);
    }
  }
  if (values.size() > 0) {
    if (mf.getType().isArray()) {
      Object[] array=ReflectionUtils.convertToArray(mf.getSubType(),values);
      mf.setFieldValue(entity,array);
    }
 else {
      mf.setFieldValue(entity,values);
    }
  }
}
Program: 104892
Project: 104892
Buggy source:
void fromDBObject(final DBObject dbObject,final MappedField mf,final Object entity){
  String name=mf.getName();
  Class fieldType=mf.getType();
  try {
    if (mf.isMap()) {
      readMap(dbObject,mf,entity,name);
    }
 else     if (mf.isMultipleValues()) {
      readCollection(dbObject,mf,entity,name);
    }
 else {
      if (dbObject.containsField(name)) {
        BasicDBObject dbVal=(BasicDBObject)dbObject.get(name);
        Object refObj=ReflectionUtils.createInstance(fieldType,dbVal);
        refObj=mapper.fromDb(dbVal,refObj,null);
        if (refObj != null) {
          mf.setFieldValue(entity,refObj);
        }
      }
    }
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
void fromDBObject(final DBObject dbObject,final MappedField mf,final Object entity,final Map<Key,Object> retrieved){
  String name=mf.getName();
  Class fieldType=mf.getType();
  try {
    if (mf.isMap()) {
      readMap(dbObject,mf,entity,name,retrieved);
    }
 else     if (mf.isMultipleValues()) {
      readCollection(dbObject,mf,entity,name,retrieved);
    }
 else {
      if (dbObject.containsField(name)) {
        BasicDBObject dbVal=(BasicDBObject)dbObject.get(name);
        Object refObj=ReflectionUtils.createInstance(fieldType,dbVal);
        refObj=mapper.fromDb(dbVal,refObj,null);
        if (refObj != null) {
          mf.setFieldValue(entity,refObj);
        }
      }
    }
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}
Program: 104895
Project: 104895
Buggy source:
public void save(T entity){
  DBObject dbObj=morphia.toDBObject(entity);
  collection().save(dbObj);
  DBObject lastErr=collection().getDB().getLastError();
  if (lastErr.get("String_Node_Str") != null)   throw new MappingException("String_Node_Str" + lastErr.toString());
  morphia.getMapper().updateKeyInfo(entity,dbObj.get(Mapper.ID_KEY),collectionName);
  morphia.getMapper().getMappedClass(entity).callLifecycleMethods(PostPersist.class,entity,dbObj);
}

Fixed version (ground truth):
public void save(T entity){
  DBObject dbObj=morphia.getMapper().toDBObject(entity,false);
  collection().save(dbObj);
  DBObject lastErr=collection().getDB().getLastError();
  if (lastErr.get("String_Node_Str") != null)   throw new MappingException("String_Node_Str" + lastErr.toString());
  morphia.getMapper().updateKeyInfo(entity,dbObj.get(Mapper.ID_KEY),collectionName);
  morphia.getMapper().getMappedClass(entity).callLifecycleMethods(PostPersist.class,entity,dbObj);
}
Program: 104896
Project: 104896
Buggy source:
public <T>T fromDBObject(Class<T> entityClass,DBObject dbObject){
  if (!entityClass.isInterface() && !mapper.isMapped(entityClass)) {
    throw new MappingException("String_Node_Str" + entityClass.getName());
  }
  try {
    return (T)mapper.fromDBObject(entityClass,(BasicDBObject)dbObject);
  }
 catch (  Exception e) {
    throw new MappingException("String_Node_Str",e);
  }
 finally {
    mapper.clearHistory();
  }
}

Fixed version (ground truth):
public <T>T fromDBObject(Class<T> entityClass,DBObject dbObject){
  if (!entityClass.isInterface() && !mapper.isMapped(entityClass)) {
    throw new MappingException("String_Node_Str" + entityClass.getName());
  }
  try {
    return (T)mapper.fromDBObject(entityClass,(BasicDBObject)dbObject);
  }
 catch (  Exception e) {
    throw new MappingException("String_Node_Str",e);
  }
}
Program: 104897
Project: 104897
Buggy source:
public DBObject toDBObject(Object entity){
  if (!mapper.isMapped(entity.getClass())) {
    throw new MappingException("String_Node_Str" + entity.getClass().getName());
  }
  try {
    return mapper.toDBObject(entity);
  }
 catch (  Exception e) {
    throw new MappingException("String_Node_Str",e);
  }
 finally {
    mapper.clearHistory();
  }
}

Fixed version (ground truth):
public DBObject toDBObject(Object entity){
  try {
    return mapper.toDBObject(entity);
  }
 catch (  Exception e) {
    throw new MappingException("String_Node_Str",e);
  }
}
Program: 104898
Project: 104898
Buggy source:
/** 
 * converts an entity to a DBObject 
 */
public DBObject toDBObject(Object entity){
  BasicDBObject dbObject=new BasicDBObject();
  MappedClass mc=getMappedClass(entity);
  if (mc.getPolymorphicAnnotation() != null) {
    dbObject.put(CLASS_NAME_FIELDNAME,entity.getClass().getCanonicalName());
  }
  dbObject=(BasicDBObject)mc.callLifecycleMethods(PrePersist.class,entity,dbObject);
  for (  MappedField mf : mc.getPersistenceFields()) {
    try {
      if (mf.hasAnnotation(Id.class)) {
        Object dbVal=mf.getFieldValue(entity);
        if (dbVal != null) {
          dbObject.put(ID_KEY,objectToValue(asObjectIdMaybe(dbVal)));
        }
      }
 else       if (mf.hasAnnotation(Reference.class)) {
        mapReferencesToDBObject(entity,mf,dbObject);
      }
 else       if (mf.hasAnnotation(Embedded.class) && !mf.isTypeMongoCompatible()) {
        mapEmbeddedToDBObject(entity,mf,dbObject);
      }
 else       if (mf.hasAnnotation(Property.class) || mf.hasAnnotation(Serialized.class) || mf.isTypeMongoCompatible()) {
        mapValuesToDBObject(entity,mf,dbObject);
      }
 else {
        logger.warning("String_Node_Str" + mf.getFullName() + "String_Node_Str"+ mf.getType().getSimpleName()+ "String_Node_Str");
      }
    }
 catch (    Exception e) {
      throw new MappingException("String_Node_Str" + mf.getFullName(),e);
    }
  }
  return dbObject;
}

Fixed version (ground truth):
public DBObject toDBObject(Object entity,boolean callPostPersist){
  BasicDBObject dbObject=new BasicDBObject();
  MappedClass mc=getMappedClass(entity);
  if (mc.getPolymorphicAnnotation() != null) {
    dbObject.put(CLASS_NAME_FIELDNAME,entity.getClass().getCanonicalName());
  }
  dbObject=(BasicDBObject)mc.callLifecycleMethods(PrePersist.class,entity,dbObject);
  for (  MappedField mf : mc.getPersistenceFields()) {
    try {
      if (mf.hasAnnotation(Id.class)) {
        Object dbVal=mf.getFieldValue(entity);
        if (dbVal != null) {
          dbObject.put(ID_KEY,objectToValue(asObjectIdMaybe(dbVal)));
        }
      }
 else       if (mf.hasAnnotation(Reference.class)) {
        mapReferencesToDBObject(entity,mf,dbObject);
      }
 else       if (mf.hasAnnotation(Embedded.class) && !mf.isTypeMongoCompatible()) {
        mapEmbeddedToDBObject(entity,mf,dbObject);
      }
 else       if (mf.hasAnnotation(Property.class) || mf.hasAnnotation(Serialized.class) || mf.isTypeMongoCompatible()) {
        mapValuesToDBObject(entity,mf,dbObject);
      }
 else {
        logger.warning("String_Node_Str" + mf.getFullName() + "String_Node_Str"+ mf.getType().getSimpleName()+ "String_Node_Str");
      }
    }
 catch (    Exception e) {
      throw new MappingException("String_Node_Str" + mf.getFullName(),e);
    }
  }
  if (callPostPersist)   mc.callLifecycleMethods(PostPersist.class,entity,dbObject);
  return dbObject;
}
Program: 104899
Project: 104899
Buggy source:
/** 
 * coverts a DBObject back to a type-safe java object
 */
public Object fromDBObject(Class entityClass,BasicDBObject dbObject){
  if (dbObject == null) {
    Throwable t=new Throwable();
    logger.log(Level.SEVERE,"String_Node_Str",t);
    return null;
  }
  entityCache.set(new HashMap<String,Object>());
  Object entity=createInstance(entityClass,dbObject);
  mapDBObjectToEntity(dbObject,entity);
  entityCache.remove();
  return entity;
}

Fixed version (ground truth):
/** 
 * coverts a DBObject back to a type-safe java object
 */
public Object fromDBObject(Class entityClass,BasicDBObject dbObject){
  if (dbObject == null) {
    Throwable t=new Throwable();
    logger.log(Level.SEVERE,"String_Node_Str",t);
    return null;
  }
  entityCache.set(new HashMap<String,Object>());
  Object entity=null;
  try {
    entity=createInstance(entityClass,dbObject);
    mapDBObjectToEntity(dbObject,entity);
  }
  finally {
    entityCache.remove();
  }
  return entity;
}
Program: 104902
Project: 104902
Buggy source:
/** 
 * Connects to "test" database on localhost 
 */
public static Datastore getDatastore(){
  return ds;
}

Fixed version (ground truth):
/** 
 * Connects to "test" database on localhost by default 
 */
public static Datastore getDatastore(){
  return ds;
}
Program: 104906
Project: 104906
Buggy source:
/** 
 * Get a set of all classes that are mapped by this instance.
 * @return all classes that are mapped by this instance
 */
public Map<String,MappedClass> getMappedClasses(){
  return new HashMap(mapper.getMappedClasses());
}

Fixed version (ground truth):
/** 
 * Get a set of all classes that are mapped by this instance.
 * @return all classes that are mapped by this instance
 */
public Map<String,MappedClass> getMappedClasses(){
  return Collections.unmodifiableMap(mapper.getMappedClasses());
}
Program: 104908
Project: 104908
Buggy source:
private void firePostPersistForChildren(Object entity,DBObject dbObj,Mapper mapr){
  MappedClass mc=mapr.getMappedClass(entity);
  for (  MappedField mf : mc.getPersistenceFields()) {
    try {
      if (mf.hasAnnotation(Embedded.class) && !mf.isTypeMongoCompatible()) {
        Object embedded=mf.getFieldValue(entity);
        if (embedded != null) {
          if (mf.isMap()) {
            Map<?,?> map=(Map<?,?>)embedded;
            for (            Map.Entry<?,?> entry : map.entrySet()) {
              Object key=entry.getKey();
              Object value=entry.getValue();
              Class<? extends Object> keyClass=entry.getKey().getClass();
              Class<? extends Object> valueClass=entry.getValue().getClass();
              if (mapr.isMapped(keyClass)) {
                mapr.getMappedClass(keyClass).callLifecycleMethods(PostPersist.class,key,dbObj,mapr);
                firePostPersistForChildren(key,dbObj,mapr);
              }
              if (mapr.isMapped(valueClass)) {
                mapr.getMappedClass(valueClass).callLifecycleMethods(PostPersist.class,value,dbObj,mapr);
                firePostPersistForChildren(value,dbObj,mapr);
              }
            }
          }
 else           if (mf.isMultipleValues()) {
            Iterable col=(Iterable)embedded;
            for (            Object o : col) {
              Class<? extends Object> clazz=o.getClass();
              if (mapr.isMapped(clazz)) {
                mapr.getMappedClass(clazz).callLifecycleMethods(PostPersist.class,o,dbObj,mapr);
                firePostPersistForChildren(o,dbObj,mapr);
              }
            }
          }
 else {
            MappedClass embedClass=mapr.getMappedClass(embedded);
            embedClass.callLifecycleMethods(PostPersist.class,embedded,dbObj,mapr);
            firePostPersistForChildren(embedded,dbObj,mapr);
          }
        }
      }
    }
 catch (    Exception e) {
      throw new MappingException("String_Node_Str" + mf.getFullName(),e);
    }
  }
}

Fixed version (ground truth):
private void firePostPersistForChildren(LinkedHashMap<Object,DBObject> involvedObjects,Mapper mapr){
  for (  Map.Entry<Object,DBObject> e : involvedObjects.entrySet()) {
    Object entity=e.getKey();
    DBObject dbObj=e.getValue();
    MappedClass mc=mapr.getMappedClass(entity);
    mc.callLifecycleMethods(PostPersist.class,entity,dbObj,mapr);
  }
}