Program: 177001
Project: 177001
Buggy source:
private void computeJoinTableRelations(EnhanceEntity e,Client client,EntityMetadata entityMetadata,EntitySaveGraph objectGraph,PersistenceDelegator delegator,Relation relation){
  Object entity=e.getEntity();
  objectGraph.setParentId(getId(entity,entityMetadata));
  JoinTableMetadata jtMetadata=relation.getJoinTableMetadata();
  String joinTableName=jtMetadata.getJoinTableName();
  Set<String> joinColumns=jtMetadata.getJoinColumns();
  Set<String> inverseJoinColumns=jtMetadata.getInverseJoinColumns();
  String joinColumnName=(String)joinColumns.toArray()[0];
  String inverseJoinColumnName=(String)inverseJoinColumns.toArray()[0];
  EntityMetadata relMetadata=delegator.getMetadata(objectGraph.getChildClass());
  Client pClient=delegator.getClient(entityMetadata);
  List<?> foreignKeys=pClient.getForeignKeysFromJoinTable(joinTableName,joinColumnName,inverseJoinColumnName,relMetadata,objectGraph);
  List childrenEntities=new ArrayList();
  for (  Object foreignKey : foreignKeys) {
    try {
      EntityMetadata childMetadata=delegator.getMetadata(relation.getTargetEntity());
      Client childClient=delegator.getClient(childMetadata);
      Object child=childClient.find(relation.getTargetEntity(),childMetadata,(String)foreignKey,null);
      onBiDirection(e,client,objectGraph,entityMetadata,child,childMetadata,childClient);
      childrenEntities.add(child);
    }
 catch (    Exception ex) {
      ex.printStackTrace();
    }
  }
  Field childField=objectGraph.getProperty();
  try {
    PropertyAccessorHelper.set(entity,childField,PropertyAccessorHelper.isCollection(childField.getType()) ? getFieldInstance(childrenEntities,childField) : childrenEntities.get(0));
  }
 catch (  PropertyAccessException ex) {
    ex.printStackTrace();
  }
}

Fixed version (ground truth):
private void computeJoinTableRelations(EnhanceEntity e,Client client,EntityMetadata entityMetadata,EntitySaveGraph objectGraph,PersistenceDelegator delegator,Relation relation){
  Object entity=e.getEntity();
  objectGraph.setParentId(getId(entity,entityMetadata));
  JoinTableMetadata jtMetadata=relation.getJoinTableMetadata();
  String joinTableName=jtMetadata.getJoinTableName();
  Set<String> joinColumns=jtMetadata.getJoinColumns();
  Set<String> inverseJoinColumns=jtMetadata.getInverseJoinColumns();
  String joinColumnName=(String)joinColumns.toArray()[0];
  String inverseJoinColumnName=(String)inverseJoinColumns.toArray()[0];
  EntityMetadata relMetadata=delegator.getMetadata(objectGraph.getChildClass());
  Client pClient=delegator.getClient(entityMetadata);
  List<?> foreignKeys=pClient.getForeignKeysFromJoinTable(joinTableName,joinColumnName,inverseJoinColumnName,relMetadata,objectGraph);
  List childrenEntities=new ArrayList();
  for (  Object foreignKey : foreignKeys) {
    try {
      EntityMetadata childMetadata=delegator.getMetadata(relation.getTargetEntity());
      Client childClient=delegator.getClient(childMetadata);
      Object child=delegator.find(relation.getTargetEntity(),foreignKey);
      onBiDirection(e,client,objectGraph,entityMetadata,child,childMetadata,childClient);
      childrenEntities.add(child);
    }
 catch (    Exception ex) {
      ex.printStackTrace();
    }
  }
  Field childField=objectGraph.getProperty();
  try {
    PropertyAccessorHelper.set(entity,childField,PropertyAccessorHelper.isCollection(childField.getType()) ? getFieldInstance(childrenEntities,childField) : childrenEntities.get(0));
  }
 catch (  PropertyAccessException ex) {
    ex.printStackTrace();
  }
}