Program: 133541
Project: 133541
Buggy source:
/** 
 * Performs the synchronization of the node and the list of shapes
 */
public void commit(){
  ICEShape nodeShape=null;
  int primitiveShapeIndex=-1;
  int complexShapeIndex=-1;
  Vector<Integer> removeNodeIndices=new Vector<Integer>();
  int numNodeChildren=this.parentNode.getQuantity();
  for (int nodeIndex=0; nodeIndex < numNodeChildren; nodeIndex++) {
    Spatial childSpatial=this.parentNode.getChild(nodeIndex);
    Node childNode=null;
    try {
      childNode=(Node)childSpatial;
    }
 catch (    ClassCastException e) {
    }
    if (childSpatial.getUserData("String_Node_Str") != null) {
      nodeShape=((ShapeTransient)childSpatial.getUserData("String_Node_Str")).getShape();
      primitiveShapeIndex=primitiveShapes.indexOf(nodeShape);
      complexShapeIndex=complexShapes.indexOf(nodeShape);
    }
    if (primitiveShapeIndex >= 0) {
      ICEShape primitiveShape=primitiveShapes.get(primitiveShapeIndex);
      childSpatial.setLocalTransform(convertTransformation(primitiveShape.getTransformation()));
      if (primitiveShape.getShapeType() == ICEShapeType.Cylinder) {
        childSpatial.rotate(FastMath.PI / 2,0.0f,0.0f);
      }
      ShapeMaterial shapeMaterial=new ShapeMaterial(assetManager,primitiveShape);
      shapeMaterial.setMaterial(baseMaterial);
      shapeMaterial.setHighlightedMaterial(highlightedMaterial);
      childSpatial.setMaterial(shapeMaterial.getMaterial());
      this.primitiveShapes.remove(primitiveShapeIndex);
    }
 else     if (complexShapeIndex >= 0) {
      ICEShape complexShape=complexShapes.get(complexShapeIndex);
      childSpatial.setLocalTransform(convertTransformation(complexShape.getTransformation()));
      SyncShapes syncComplexShapes=new SyncShapes(childNode);
      ArrayList<ICEShape> complexShapeChildren=complexShape.getShapes();
      for (      ICEShape complexShapeChild : complexShapeChildren) {
        syncComplexShapes.addShape(complexShapeChild);
      }
      syncComplexShapes.commit();
      this.complexShapes.remove(complexShapeIndex);
    }
 else {
      removeNodeIndices.add(new Integer(nodeIndex));
    }
  }
  Collections.reverse(removeNodeIndices);
  for (  Integer nodeIndex : removeNodeIndices) {
    this.parentNode.detachChildAt(nodeIndex);
  }
  AddShapeToNode addShape=new AddShapeToNode(this.parentNode);
  for (  ICEShape primitiveShape : primitiveShapes) {
    addShape.addShape(primitiveShape);
  }
  for (  ICEShape complexShape : complexShapes) {
    addShape.addShape(complexShape);
  }
}

Fixed version (ground truth):
/** 
 * Performs the synchronization of the node and the list of shapes
 */
public void commit(){
  ICEShape nodeShape=null;
  int primitiveShapeIndex=-1;
  int complexShapeIndex=-1;
  Vector<Integer> removeNodeIndices=new Vector<Integer>();
  int numNodeChildren=this.parentNode.getQuantity();
  for (int nodeIndex=0; nodeIndex < numNodeChildren; nodeIndex++) {
    Spatial childSpatial=this.parentNode.getChild(nodeIndex);
    Node childNode=null;
    try {
      childNode=(Node)childSpatial;
    }
 catch (    ClassCastException e) {
    }
    if (childSpatial.getUserData("String_Node_Str") != null) {
      nodeShape=((ShapeTransient)childSpatial.getUserData("String_Node_Str")).getShape();
      primitiveShapeIndex=primitiveShapes.indexOf(nodeShape);
      complexShapeIndex=complexShapes.indexOf(nodeShape);
    }
    if (primitiveShapeIndex >= 0) {
      ICEShape primitiveShape=primitiveShapes.get(primitiveShapeIndex);
      childSpatial.setLocalTransform(convertTransformation(primitiveShape.getTransformation()));
      if (primitiveShape.getShapeType() == ShapeType.Cylinder) {
        childSpatial.rotate(FastMath.PI / 2,0.0f,0.0f);
      }
      ShapeMaterial shapeMaterial=new ShapeMaterial(assetManager,primitiveShape);
      shapeMaterial.setMaterial(baseMaterial);
      shapeMaterial.setHighlightedMaterial(highlightedMaterial);
      childSpatial.setMaterial(shapeMaterial.getMaterial());
      this.primitiveShapes.remove(primitiveShapeIndex);
    }
 else     if (complexShapeIndex >= 0) {
      ICEShape complexShape=complexShapes.get(complexShapeIndex);
      childSpatial.setLocalTransform(convertTransformation(complexShape.getTransformation()));
      SyncShapes syncComplexShapes=new SyncShapes(childNode);
      ArrayList<ICEShape> complexShapeChildren=complexShape.getShapes();
      for (      ICEShape complexShapeChild : complexShapeChildren) {
        syncComplexShapes.addShape(complexShapeChild);
      }
      syncComplexShapes.commit();
      this.complexShapes.remove(complexShapeIndex);
    }
 else {
      removeNodeIndices.add(new Integer(nodeIndex));
    }
  }
  Collections.reverse(removeNodeIndices);
  for (  Integer nodeIndex : removeNodeIndices) {
    this.parentNode.detachChildAt(nodeIndex);
  }
  AddShapeToNode addShape=new AddShapeToNode(this.parentNode);
  for (  ICEShape primitiveShape : primitiveShapes) {
    addShape.addShape(primitiveShape);
  }
  for (  ICEShape complexShape : complexShapes) {
    addShape.addShape(complexShape);
  }
}