Program: 177061
Project: 177061
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();
      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();
  }
}

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(entity,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();
  }
}