Program: 133418
Project: 133418
Buggy source:
/** 
 * <p> Opens the replicate dialog box and clones the selected shape to the properties </p>
 */
@Override public void run(){
  AbstractController geometry=(AbstractController)view.treeViewer.getInput();
  ITreeSelection selection=(ITreeSelection)view.treeViewer.getSelection();
  TreePath[] paths=selection.getPaths();
  if (paths.length != 1) {
    return;
  }
  Object selectedObject=paths[0].getLastSegment();
  if (!(selectedObject instanceof Shape)) {
    return;
  }
  Shape selectedShape=(Shape)selectedObject;
  Transformation accumulatedTransformation=(Transformation)selectedShape.getTransformation().clone();
  ReplicateDialog replicateDialog=new ReplicateDialog(view.getSite().getShell());
  if (replicateDialog.open() != IDialogConstants.OK_ID) {
    return;
  }
  int quantity=replicateDialog.getQuantity();
  double[] shift=replicateDialog.getShift();
  if (quantity == 1) {
    return;
  }
  Shape parentShape=(Shape)selectedShape.getEntitiesByCategory("String_Node_Str").get(0);
synchronized (geometry) {
    if (parentShape != null) {
      parentShape.removeEntity(selectedShape);
    }
 else {
      geometry.removeEntity(selectedShape);
    }
  }
  ShapeComponent replicateUnionComponent=new ShapeComponent();
  Shape replicateUnion=(Shape)view.getFactory().createController(replicateUnionComponent);
  replicateUnion.setProperty("String_Node_Str","String_Node_Str");
  replicateUnion.setProperty("String_Node_Str","String_Node_Str");
  replicateUnion.setProperty("String_Node_Str",selectedShape.getProperty("String_Node_Str"));
  for (int i=1; i <= quantity; i++) {
    Shape clonedShape=(Shape)selectedShape.clone();
    clonedShape.setProperty("String_Node_Str","String_Node_Str");
    clonedShape.setProperty("String_Node_Str",Integer.toString(i));
    clonedShape.setTransformation((Transformation)accumulatedTransformation.clone());
    replicateUnion.addEntity(clonedShape);
    accumulatedTransformation.translate(shift);
  }
  if (parentShape != null) {
synchronized (geometry) {
      parentShape.addEntity(replicateUnion);
    }
    view.treeViewer.refresh(parentShape);
  }
 else {
synchronized (geometry) {
      geometry.addEntity(replicateUnion);
    }
    view.treeViewer.refresh();
  }
  view.treeViewer.expandToLevel(parentShape,1);
}

Fixed version (ground truth):
/** 
 * <p> Opens the replicate dialog box and clones the selected shape to the properties </p>
 */
@Override public void run(){
  AbstractController geometry=(AbstractController)view.treeViewer.getInput();
  ITreeSelection selection=(ITreeSelection)view.treeViewer.getSelection();
  TreePath[] paths=selection.getPaths();
  if (paths.length != 1) {
    return;
  }
  Object selectedObject=paths[0].getLastSegment();
  if (!(selectedObject instanceof Shape)) {
    return;
  }
  Shape selectedShape=(Shape)selectedObject;
  Transformation accumulatedTransformation=(Transformation)selectedShape.getTransformation().clone();
  ReplicateDialog replicateDialog=new ReplicateDialog(view.getSite().getShell());
  if (replicateDialog.open() != IDialogConstants.OK_ID) {
    return;
  }
  int quantity=replicateDialog.getQuantity();
  double[] shift=replicateDialog.getShift();
  if (quantity == 1) {
    return;
  }
  Shape parentShape=(Shape)selectedShape.getEntitiesByCategory("String_Node_Str").get(0);
synchronized (geometry) {
    if (parentShape != null) {
      parentShape.removeEntity(selectedShape);
    }
 else {
      geometry.removeEntity(selectedShape);
    }
  }
  ShapeComponent replicateUnionComponent=new ShapeComponent();
  Shape replicateUnion=(Shape)view.getFactory().createController(replicateUnionComponent);
  replicateUnion.setProperty("String_Node_Str","String_Node_Str");
  replicateUnion.setProperty("String_Node_Str","String_Node_Str");
  replicateUnion.setProperty("String_Node_Str",selectedShape.getProperty("String_Node_Str"));
  for (int i=1; i <= quantity; i++) {
    Shape clonedShape=(Shape)selectedShape.clone();
    clonedShape.setProperty("String_Node_Str","String_Node_Str");
    clonedShape.setProperty("String_Node_Str",Integer.toString(i));
    clonedShape.setTransformation((Transformation)accumulatedTransformation.clone());
    replicateUnion.addEntity(clonedShape);
    accumulatedTransformation.translate(shift);
  }
  if (parentShape != null) {
synchronized (geometry) {
      parentShape.addEntity(replicateUnion);
      replicateUnion.setParent(parentShape);
    }
    view.treeViewer.refresh(parentShape);
  }
 else {
synchronized (geometry) {
      geometry.addEntity(replicateUnion);
    }
    view.treeViewer.refresh();
  }
  view.treeViewer.expandToLevel(parentShape,1);
}