Program: 177065
Project: 177065
Buggy source:
/** 
 * On compute graph.
 * @param entity the entity
 * @param objectGraph the object graph
 * @param client the client
 * @param rowId the row id
 * @param entityClass the entity class
 */
private void onComputeGraph(Object entity,EntitySaveGraph objectGraph,Client client,String rowId,Class<?> entityClass){
  IndexManager mgr=null;
  Set<?> chids=new HashSet();
  EntityMetadata childMetadata=null;
  Client childClient=null;
  Class<?> childClazz=null;
  try {
    if (entity.getClass().equals(objectGraph.getChildClass())) {
      String query=AssociationBuilder.getQuery(DocumentIndexer.PARENT_ID_CLASS,objectGraph.getParentClass().getCanonicalName().toLowerCase(),DocumentIndexer.ENTITY_ID_FIELD,rowId);
      childClazz=objectGraph.getParentClass();
      chids=populateAssociation(entity,objectGraph.getProperty(),childClient,query,objectGraph.getParentClass());
    }
 else {
      childClazz=objectGraph.getChildClass();
      String query=AssociationBuilder.getQuery(DocumentIndexer.PARENT_ID_CLASS,entity.getClass().getCanonicalName().toLowerCase(),DocumentIndexer.PARENT_ID_FIELD,rowId);
      if (objectGraph.isSharedPrimaryKey()) {
        List c=new ArrayList();
        c.add(childClient.find(childClazz,rowId));
        chids=onReflect(entityClass,objectGraph.getProperty(),c);
      }
 else {
        chids=populateAssociation(entity,objectGraph.getProperty(),childClient,query,childClazz);
      }
    }
    childMetadata=getMetadata(childClazz);
    childClient=getClient(childMetadata);
    onBiDirection(entity,objectGraph,client,rowId,entityClass,chids,childMetadata,childClient);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * On compute graph.
 * @param entity the entity
 * @param objectGraph the object graph
 * @param client the client
 * @param rowId the row id
 * @param entityClass the entity class
 */
private void onComputeGraph(Object entity,EntitySaveGraph objectGraph,Client client,String rowId,Class<?> entityClass){
  IndexManager mgr=null;
  Set<?> chids=new HashSet();
  EntityMetadata childMetadata=null;
  Client childClient=null;
  Class<?> childClazz=null;
  try {
    if (entity.getClass().equals(objectGraph.getChildClass())) {
      String query=AssociationBuilder.getQuery(DocumentIndexer.PARENT_ID_CLASS,objectGraph.getParentClass().getCanonicalName().toLowerCase(),DocumentIndexer.ENTITY_ID_FIELD,rowId);
      childClazz=objectGraph.getParentClass();
      childMetadata=getMetadata(childClazz);
      childClient=getClient(childMetadata);
      chids=populateAssociation(entity,objectGraph.getProperty(),childClient,query,objectGraph.getParentClass());
    }
 else {
      childClazz=objectGraph.getChildClass();
      childMetadata=getMetadata(childClazz);
      childClient=getClient(childMetadata);
      String query=AssociationBuilder.getQuery(DocumentIndexer.PARENT_ID_CLASS,entity.getClass().getCanonicalName().toLowerCase(),DocumentIndexer.PARENT_ID_FIELD,rowId);
      if (objectGraph.isSharedPrimaryKey()) {
        List c=new ArrayList();
        c.add(childClient.find(childClazz,rowId));
        chids=onReflect(entityClass,objectGraph.getProperty(),c);
      }
 else {
        chids=populateAssociation(entity,objectGraph.getProperty(),childClient,query,childClazz);
      }
    }
    onBiDirection(entity,objectGraph,client,rowId,entityClass,chids,childMetadata,childClient);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}