Program: 73193
Project: 73193
Buggy source:
/** 
 * Check the clone(Workspace) method of the IterateOverArray class. Instantiate an IterateOverArray actor and get the Workspace of the inner IterateDirector.  Then clone the actor into a  new Workspace and get the Workspace of the inner IterateDirector of the *clone*.  The Workspaces should be different. <p>To run:</p> <code> java -classpath $PTII ptolemy.actor.lib.hoc.test.IterateOverArrayCloneTest </code>
 * @param args Ignored
 * @exception Throwable If there is a problem with the test.
 */
public static void main(String args[]) throws Throwable {
  Workspace workspace=new Workspace("String_Node_Str");
  TypedCompositeActor container=new TypedCompositeActor(workspace);
  IterateOverArray iterateOverArray=new IterateOverArray(container,"String_Node_Str");
  Class iterateDirectorClass=Class.forName("String_Node_Str");
  List iterateDirectors=iterateOverArray.attributeList(iterateDirectorClass);
  Object iterateDirector=iterateDirectors.get(0);
  Field thisZeroField=iterateDirectorClass.getDeclaredField("String_Node_Str");
  thisZeroField.setAccessible(true);
  IterateOverArray outerIterateOverArray=(IterateOverArray)thisZeroField.get(iterateDirectorClass.cast(iterateDirector));
  Workspace outerIterateOverArrayWorkspace=outerIterateOverArray.workspace();
  System.out.println("String_Node_Str" + outerIterateOverArrayWorkspace.getName());
  Workspace cloneWorkspace=new Workspace("String_Node_Str");
  IterateOverArray clonedIterateOverArray=(IterateOverArray)iterateOverArray.clone(cloneWorkspace);
  List clonedIterateDirectors=clonedIterateOverArray.attributeList(iterateDirectorClass);
  Object clonedIterateDirector=clonedIterateDirectors.get(0);
  IterateOverArray clonedOuterIterateOverArray=(IterateOverArray)thisZeroField.get(iterateDirectorClass.cast(clonedIterateDirector));
  Workspace clonedOuterIterateOverArrayWorkspace=clonedOuterIterateOverArray.workspace();
  System.out.println("String_Node_Str" + clonedOuterIterateOverArrayWorkspace.getName());
  if (outerIterateOverArrayWorkspace.equals(clonedOuterIterateOverArrayWorkspace)) {
    System.err.println("String_Node_Str");
    System.exit(1);
  }
 else {
    System.err.println("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Check the clone(Workspace) method of the IterateOverArray class. Instantiate an IterateOverArray actor and get the Workspace of the inner IterateDirector.  Then clone the actor into a  new Workspace and get the Workspace of the inner IterateDirector of the *clone*.  The Workspaces should be different. <p>To run:</p> <code> java -classpath $PTII ptolemy.actor.lib.hoc.test.IterateOverArrayCloneTest </code>
 * @param args Ignored
 * @exception Throwable If there is a problem with the test.
 */
public static void main(String args[]) throws Throwable {
  Workspace workspace=new Workspace("String_Node_Str");
  TypedCompositeActor container=new TypedCompositeActor(workspace);
  IterateOverArray iterateOverArray=new IterateOverArray(container,"String_Node_Str");
  Class iterateDirectorClass=Class.forName("String_Node_Str");
  List iterateDirectors=iterateOverArray.attributeList(iterateDirectorClass);
  Object iterateDirector=iterateDirectors.get(0);
  Field thisZeroField=iterateDirectorClass.getDeclaredField("String_Node_Str");
  thisZeroField.setAccessible(true);
  IterateOverArray outerIterateOverArray=(IterateOverArray)thisZeroField.get(iterateDirectorClass.cast(iterateDirector));
  Workspace outerIterateOverArrayWorkspace=outerIterateOverArray.workspace();
  System.out.println("String_Node_Str" + outerIterateOverArrayWorkspace.getName());
  Workspace cloneWorkspace=new Workspace("String_Node_Str");
  IterateOverArray clonedIterateOverArray=(IterateOverArray)iterateOverArray.clone(cloneWorkspace);
  List clonedIterateDirectors=clonedIterateOverArray.attributeList(iterateDirectorClass);
  Object clonedIterateDirector=clonedIterateDirectors.get(0);
  IterateOverArray clonedOuterIterateOverArray=(IterateOverArray)thisZeroField.get(iterateDirectorClass.cast(clonedIterateDirector));
  Workspace clonedOuterIterateOverArrayWorkspace=clonedOuterIterateOverArray.workspace();
  System.out.println("String_Node_Str" + clonedOuterIterateOverArrayWorkspace.getName());
  if (outerIterateOverArray.equals(clonedOuterIterateOverArray)) {
    System.err.println("String_Node_Str");
  }
 else {
    System.err.println("String_Node_Str");
  }
  if (outerIterateOverArrayWorkspace.equals(clonedOuterIterateOverArrayWorkspace)) {
    System.err.println("String_Node_Str");
    System.exit(1);
  }
 else {
    System.err.println("String_Node_Str");
  }
}