Program: 133422
Project: 133422
Buggy source:
public void syncShapes(Group parentNode,List<Shape> primitiveShapes,List<Shape> complexShapes){
  Shape nodeShape=null;
  int primitiveShapeIndex=-1;
  int complexShapeIndex=-1;
  List<Node> removeNodeIndices=new ArrayList<Node>();
  int numNodeChildren=parentNode.getChildren().size();
  for (int nodeIndex=0; nodeIndex < numNodeChildren; nodeIndex++) {
    Node childSpatial=parentNode.getChildren().get(nodeIndex);
    Group childNode=null;
    try {
      childNode=(Group)childSpatial;
    }
 catch (    ClassCastException e) {
      return;
    }
    if (childSpatial.getProperties().containsKey(Shape.class)) {
      nodeShape=(Shape)childSpatial.getProperties().get(Shape.class);
      primitiveShapeIndex=primitiveShapes.indexOf(nodeShape);
      complexShapeIndex=complexShapes.indexOf(nodeShape);
    }
    if (primitiveShapeIndex >= 0) {
      Shape primitiveShape=primitiveShapes.get(primitiveShapeIndex);
      childSpatial.getTransforms().setAll(Util.convertTransformation(primitiveShape.getTransformation()));
      primitiveShapes.remove(primitiveShapeIndex);
    }
 else     if (complexShapeIndex >= 0) {
      Shape complexShape=complexShapes.get(complexShapeIndex);
      childSpatial.getTransforms().setAll(Util.convertTransformation(complexShape.getTransformation()));
      List<AbstractController> complexShapeChildren=complexShape.getEntitiesByCategory("String_Node_Str");
      List<Shape> childPrimitiveShapes=new ArrayList<Shape>();
      List<Shape> childComplexShapes=new ArrayList<Shape>();
      for (      AbstractController complexShapeChild : complexShapeChildren) {
        if (complexShapeChild.getProperty("String_Node_Str") != null) {
          childPrimitiveShapes.add((Shape)complexShapeChild);
        }
 else {
          childComplexShapes.add((Shape)complexShapeChild);
        }
      }
      syncShapes(childNode,childPrimitiveShapes,childComplexShapes);
      complexShapes.remove(complexShapeIndex);
    }
 else {
      removeNodeIndices.add(childSpatial);
    }
  }
  for (  Node nodeIndex : removeNodeIndices) {
    nodeIndex.setVisible(false);
    parentNode.getChildren().remove(nodeIndex);
  }
  for (  Shape primitiveShape : primitiveShapes) {
    ShapeType shapeType=ShapeType.None;
    Mesh mesh=null;
    shapeType=ShapeType.valueOf(primitiveShape.getProperty("String_Node_Str"));
    FXShape shape=new FXShape(shapeType);
    shape.getProperties().put(Shape.class,primitiveShape);
    shape.getTransforms().setAll(Util.convertTransformation(primitiveShape.getTransformation()));
    parentNode.getChildren().add(shape);
  }
  for (  Shape complexShape : complexShapes) {
    if (OperatorType.valueOf(complexShape.getProperty("String_Node_Str")) == OperatorType.Union) {
      Group complexShapeNode=new Group();
      complexShapeNode.setId(complexShape.getProperty("String_Node_Str"));
      complexShapeNode.getProperties().put(IShape.class,complexShape);
      complexShapeNode.getTransforms().setAll(Util.convertTransformation(complexShape.getTransformation()));
      List<AbstractController> shapes=complexShape.getEntitiesByCategory("String_Node_Str");
      addShapesToNode(complexShapeNode,shapes);
      parentNode.getChildren().add(complexShapeNode);
    }
  }
}

Fixed version (ground truth):
public void syncShapes(Group parentNode,List<AbstractController> shapeList){
  Shape nodeShape=null;
  int primitiveShapeIndex=-1;
  int complexShapeIndex=-1;
  List<Node> removeNodeIndices=new ArrayList<Node>();
  int numNodeChildren=parentNode.getChildren().size();
  for (int nodeIndex=0; nodeIndex < numNodeChildren; nodeIndex++) {
    Node childSpatial=parentNode.getChildren().get(nodeIndex);
    Group childNode=null;
    try {
      childNode=(Group)childSpatial;
    }
 catch (    ClassCastException e) {
      return;
    }
    if (childSpatial.getProperties().containsKey(Shape.class)) {
      nodeShape=(Shape)childSpatial.getProperties().get(Shape.class);
    }
    childSpatial.getTransforms().setAll(Util.convertTransformation(nodeShape.getTransformation()));
    List<AbstractController> complexShapeChildren=nodeShape.getEntitiesByCategory("String_Node_Str");
    if (!complexShapeChildren.isEmpty()) {
      syncShapes(childNode,complexShapeChildren);
    }
  }
  for (  Node nodeIndex : removeNodeIndices) {
    nodeIndex.setVisible(false);
    parentNode.getChildren().remove(nodeIndex);
  }
  for (  AbstractController shape : shapeList) {
    if (shape.getProperty("String_Node_Str") == null) {
      ShapeType shapeType=ShapeType.None;
      Mesh mesh=null;
      shapeType=ShapeType.valueOf(shape.getProperty("String_Node_Str"));
      FXShape fxShape=new FXShape(shapeType);
      fxShape.getProperties().put(Shape.class,shape);
      fxShape.getTransforms().setAll(Util.convertTransformation(shape.getTransformation()));
      parentNode.getChildren().add(fxShape);
    }
 else {
      if (OperatorType.valueOf(shape.getProperty("String_Node_Str")) == OperatorType.Union) {
        Group complexShapeNode=new Group();
        complexShapeNode.setId(shape.getProperty("String_Node_Str"));
        complexShapeNode.getProperties().put(IShape.class,shape);
        complexShapeNode.getTransforms().setAll(Util.convertTransformation(shape.getTransformation()));
        List<AbstractController> shapes=shape.getEntitiesByCategory("String_Node_Str");
        addShapesToNode(complexShapeNode,shapes);
        parentNode.getChildren().add(complexShapeNode);
      }
    }
  }
}