Program: 75642
Project: 75642
Buggy source:
/** 
 * The property is a simple value list. If property is a list property, the method will check to see if the current element has the local list value, if it has, the method returns, otherwise, a copy of the list value inherited from container or parent will be set locally on the element itself. <p> This method is supposed to be used when we need to change the value of a composite property( a simple list property ). These kind of property is inherited as a whole, so when the value changed from a child element. This method will be called to ensure that a local copy will be made, so change to the child won't affect the original value in the parent.
 * @param ref a reference to a list property or member.
 */
private DesignElement makeLocalCompositeValue(DesignElement topElement,ElementPropertyDefn prop,DesignElement content){
  ArrayList list=(ArrayList)topElement.getLocalProperty(module,prop);
  if (list != null)   return content;
  ArrayList inherited=(ArrayList)topElement.getProperty(module,prop);
  if (inherited == null)   return null;
  int index=-1;
  if (content != null)   index=inherited.indexOf(content);
  List value=(List)ModelUtil.copyValue(prop,inherited);
  ActivityStack activityStack=module.getActivityStack();
  list=new ArrayList();
  PropertyRecord propRecord=new PropertyRecord(topElement,prop,list);
  activityStack.execute(propRecord);
  ContainerContext context=new ContainerContext(topElement,prop.getName());
  for (int i=0; i < value.size(); i++) {
    DesignElement tmpContent=(DesignElement)value.get(i);
    ContentRecord addRecord=new ContentRecord(module,context,tmpContent,i);
    activityStack.execute(addRecord);
  }
  if (index != -1)   return (DesignElement)value.get(index);
  return null;
}

Fixed version (ground truth):
/** 
 * The property is a simple value list. If property is a list property, the method will check to see if the current element has the local list value, if it has, the method returns, otherwise, a copy of the list value inherited from container or parent will be set locally on the element itself. <p> This method is supposed to be used when we need to change the value of a composite property( a simple list property ). These kind of property is inherited as a whole, so when the value changed from a child element. This method will be called to ensure that a local copy will be made, so change to the child won't affect the original value in the parent.
 * @param ref a reference to a list property or member.
 */
private DesignElement makeLocalCompositeValue(DesignElement topElement,ElementPropertyDefn prop,DesignElement content){
  Object localValue=topElement.getLocalProperty(module,prop);
  if (localValue != null)   return content;
  Object inherited=topElement.getProperty(module,prop);
  if (inherited == null)   return null;
  int index=-1;
  if (content != null && inherited instanceof List)   index=((List)inherited).indexOf(content);
  Object newValue=ModelUtil.copyValue(prop,inherited);
  ActivityStack activityStack=module.getActivityStack();
  ContainerContext context=new ContainerContext(topElement,prop.getName());
  if (newValue instanceof List) {
    List list=new ArrayList();
    PropertyRecord propRecord=new PropertyRecord(topElement,prop,list);
    activityStack.execute(propRecord);
    list=(List)newValue;
    for (int i=0; i < list.size(); i++) {
      DesignElement tmpContent=(DesignElement)list.get(i);
      ContentRecord addRecord=new ContentRecord(module,context,tmpContent,i);
      activityStack.execute(addRecord);
    }
  }
 else {
    PropertyRecord propRecord=new PropertyRecord(topElement,prop,newValue);
    activityStack.execute(propRecord);
  }
  if (index != -1)   return (DesignElement)((List)newValue).get(index);
  return content;
}