Program: 63506
Project: 63506
Buggy source:
/** 
 * INTERNAL:
 * @param session typically will be a unit of work
 * @param userSpecifiedResolver a user-provided subclass of IDResolver, may be null 
 */
public void resolveReferences(CoreAbstractSession session,IDResolver userSpecifiedResolver,ErrorHandler handler){
  for (int x=0, referencesSize=references.size(); x < referencesSize; x++) {
    Reference reference=(Reference)references.get(x);
    Object referenceSourceObject=reference.getSourceObject();
    if (reference.getMapping() instanceof CollectionReferenceMapping) {
      CollectionReferenceMapping mapping=(CollectionReferenceMapping)reference.getMapping();
      CoreContainerPolicy cPolicy=mapping.getContainerPolicy();
      Object container=reference.getContainer();
      createPKVectorsFromMap(reference,mapping);
      if (reference.getPrimaryKey() == null) {
        continue;
      }
      Object value=null;
      if (!mapping.isWriteOnly()) {
        for (Iterator pkIt=((Vector)reference.getPrimaryKey()).iterator(); pkIt.hasNext(); ) {
          CacheId primaryKey=(CacheId)pkIt.next();
          if (userSpecifiedResolver != null) {
            final Callable c;
            try {
              if (primaryKey.getPrimaryKey().length > 1) {
                Map<String,Object> idWrapper=new HashMap<String,Object>();
                for (int y=0; y < primaryKey.getPrimaryKey().length; y++) {
                  ObjectReferenceMapping refMapping=(ObjectReferenceMapping)reference.getMapping();
                  String idName=(String)refMapping.getReferenceDescriptor().getPrimaryKeyFieldNames().get(y);
                  Object idValue=primaryKey.getPrimaryKey()[y];
                  idWrapper.put(idName,idValue);
                }
                c=userSpecifiedResolver.resolve(idWrapper,reference.getTargetClass());
              }
 else {
                c=userSpecifiedResolver.resolve(primaryKey.getPrimaryKey()[0],reference.getTargetClass());
              }
              if (c != null) {
                value=c.call();
              }
            }
 catch (            Exception e) {
              throw XMLMarshalException.unmarshalException(e);
            }
          }
 else {
            value=getValue(session,reference,primaryKey,handler);
          }
          if (value != null) {
            cPolicy.addInto(value,container,session);
          }
        }
      }
      mapping.setAttributeValueInObject(referenceSourceObject,container);
      InverseReferenceMapping inverseReferenceMapping=mapping.getInverseReferenceMapping();
      if (inverseReferenceMapping != null && value != null) {
        CoreAttributeAccessor backpointerAccessor=inverseReferenceMapping.getAttributeAccessor();
        CoreContainerPolicy backpointerContainerPolicy=inverseReferenceMapping.getContainerPolicy();
        if (backpointerContainerPolicy == null) {
          backpointerAccessor.setAttributeValueInObject(value,referenceSourceObject);
        }
 else {
          Object backpointerContainer=backpointerAccessor.getAttributeValueFromObject(value);
          if (backpointerContainer == null) {
            backpointerContainer=backpointerContainerPolicy.containerInstance();
            backpointerAccessor.setAttributeValueInObject(value,backpointerContainer);
          }
          backpointerContainerPolicy.addInto(referenceSourceObject,backpointerContainer,session);
        }
      }
    }
 else     if (reference.getMapping() instanceof ObjectReferenceMapping) {
      CacheId primaryKey=(CacheId)reference.getPrimaryKey();
      Object value=null;
      if (userSpecifiedResolver != null) {
        final Callable c;
        try {
          if (primaryKey.getPrimaryKey().length > 1) {
            Map<String,Object> idWrapper=new HashMap<String,Object>();
            for (int y=0; y < primaryKey.getPrimaryKey().length; y++) {
              ObjectReferenceMapping refMapping=(ObjectReferenceMapping)reference.getMapping();
              String idName=(String)refMapping.getReferenceDescriptor().getPrimaryKeyFieldNames().get(y);
              Object idValue=primaryKey.getPrimaryKey()[y];
              idWrapper.put(idName,idValue);
            }
            c=userSpecifiedResolver.resolve(idWrapper,reference.getTargetClass());
          }
 else {
            c=userSpecifiedResolver.resolve(primaryKey.getPrimaryKey()[0],reference.getTargetClass());
          }
          if (c != null) {
            value=c.call();
          }
        }
 catch (        Exception e) {
          throw XMLMarshalException.unmarshalException(e);
        }
      }
 else {
        value=getValue(session,reference,primaryKey,handler);
      }
      ObjectReferenceMapping mapping=(ObjectReferenceMapping)reference.getMapping();
      if (value != null) {
        mapping.setAttributeValueInObject(reference.getSourceObject(),value);
      }
      if (null != reference.getSetting()) {
        reference.getSetting().setValue(value);
      }
      InverseReferenceMapping inverseReferenceMapping=mapping.getInverseReferenceMapping();
      if (inverseReferenceMapping != null) {
        CoreAttributeAccessor backpointerAccessor=inverseReferenceMapping.getAttributeAccessor();
        CoreContainerPolicy backpointerContainerPolicy=inverseReferenceMapping.getContainerPolicy();
        if (backpointerContainerPolicy == null) {
          backpointerAccessor.setAttributeValueInObject(value,referenceSourceObject);
        }
 else {
          Object backpointerContainer=backpointerAccessor.getAttributeValueFromObject(value);
          if (backpointerContainer == null) {
            backpointerContainer=backpointerContainerPolicy.containerInstance();
            backpointerAccessor.setAttributeValueInObject(value,backpointerContainer);
          }
          backpointerContainerPolicy.addInto(reference.getSourceObject(),backpointerContainer,session);
        }
      }
    }
  }
  references=new ArrayList<Reference>();
  cache.clear();
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 * @param session               typically will be a unit of work
 * @param userSpecifiedResolver a user-provided subclass of IDResolver, may be null
 */
public final void resolveReferences(final CoreAbstractSession session,final IDResolver userSpecifiedResolver,final ErrorHandler handler){
}