Program: 65078
Project: 65078
Buggy source:
/** 
 * Executes the Command. This method should not be called if the Command is not executable.
 */
public void execute(){
  if (DesignerConstants.TRACING_COMMANDS) {
    System.out.println("String_Node_Str");
  }
  try {
    DesignElementHandle containerHandle=null;
    int slotID=-1, pos=-1;
    String contentString=null;
    if (container instanceof ListBandProxy) {
      containerHandle=((ListBandProxy)container).getSlotHandle().getElementHandle();
      ElementDetailHandle slot=((ListBandProxy)container).getSlotHandle();
      if (slot instanceof SlotHandle) {
        slotID=((SlotHandle)slot).getSlotID();
      }
 else {
        slotID=-1;
      }
      pos=DEUtil.findInsertPosition(containerHandle,(DesignElementHandle)after,slotID);
      int cur=DEUtil.findInsertPosition(containerHandle,(DesignElementHandle)child,slotID);
      if (cur < pos) {
        pos--;
      }
    }
 else     if (container instanceof DesignElementHandle) {
      containerHandle=(DesignElementHandle)container;
      slotID=DEUtil.getSlotID(containerHandle,after);
      if (slotID == -1) {
        contentString=DEUtil.getDefaultContentName(containerHandle);
        pos=DEUtil.findInsertPosition(containerHandle,(DesignElementHandle)after,contentString);
      }
 else {
        pos=DEUtil.findInsertPosition(containerHandle,(DesignElementHandle)after);
      }
    }
 else     if (container instanceof SlotHandle) {
      containerHandle=((SlotHandle)container).getElementHandle();
      slotID=((SlotHandle)container).getSlotID();
      pos=DEUtil.findInsertPosition(containerHandle,(DesignElementHandle)after,slotID);
    }
    DesignElementHandle handle=(DesignElementHandle)child;
    CommandStack stack=SessionHandleAdapter.getInstance().getCommandStack();
    stack.startTrans(TRANS_LABEL_MOVE_ELEMENT);
    if (slotID == -1) {
      handle.moveTo(containerHandle,contentString);
      containerHandle.getPropertyHandle(contentString).shift(handle,pos);
    }
 else {
      handle.moveTo(containerHandle,slotID);
      containerHandle.getSlot(slotID).shift(handle,pos);
    }
    stack.commit();
    if (DesignerConstants.TRACING_COMMANDS) {
      System.out.println("String_Node_Str" + DEUtil.getDisplayLabel(handle) + "String_Node_Str"+ slotID+ "String_Node_Str"+ DEUtil.getDisplayLabel(containerHandle)+ "String_Node_Str"+ pos);
    }
  }
 catch (  ContentException e) {
    if (DesignerConstants.TRACING_COMMANDS) {
      System.out.println("String_Node_Str");
    }
    logger.log(Level.SEVERE,e.getMessage(),e);
  }
catch (  SemanticException ee) {
    logger.log(Level.SEVERE,ee.getMessage(),ee);
  }
}

Fixed version (ground truth):
/** 
 * Executes the Command. This method should not be called if the Command is not executable.
 */
public void execute(){
  if (DesignerConstants.TRACING_COMMANDS) {
    System.out.println("String_Node_Str");
  }
  try {
    DesignElementHandle containerHandle=null;
    int slotID=-1, pos=-1;
    String contentString=null;
    if (container instanceof ListBandProxy) {
      containerHandle=((ListBandProxy)container).getSlotHandle().getElementHandle();
      ElementDetailHandle slot=((ListBandProxy)container).getSlotHandle();
      if (slot instanceof SlotHandle) {
        slotID=((SlotHandle)slot).getSlotID();
      }
 else {
        slotID=-1;
      }
      pos=DEUtil.findInsertPosition(containerHandle,(DesignElementHandle)after,slotID);
      int cur=DEUtil.findInsertPosition(containerHandle,(DesignElementHandle)child,slotID);
      if (cur < pos) {
        pos--;
      }
    }
 else     if (container instanceof DesignElementHandle) {
      containerHandle=(DesignElementHandle)container;
      slotID=DEUtil.getSlotID(containerHandle,after);
      if (slotID == -1) {
        contentString=DEUtil.getDefaultContentName(containerHandle);
        pos=DEUtil.findInsertPosition(containerHandle,(DesignElementHandle)after,contentString);
      }
 else {
        pos=DEUtil.findInsertPosition(containerHandle,(DesignElementHandle)after);
      }
    }
 else     if (container instanceof SlotHandle) {
      containerHandle=((SlotHandle)container).getElementHandle();
      slotID=((SlotHandle)container).getSlotID();
      pos=DEUtil.findInsertPosition(containerHandle,(DesignElementHandle)after,slotID);
    }
 else     if (container instanceof IMixedHandle) {
      IMixedHandle mixHandleInstance=(IMixedHandle)container;
      if (child instanceof CubeHandle) {
        containerHandle=mixHandleInstance.getSlotHandle().getElementHandle();
        ElementDetailHandle slot=mixHandleInstance.getSlotHandle();
        if (slot instanceof SlotHandle) {
          slotID=((SlotHandle)slot).getSlotID();
        }
        pos=DEUtil.findInsertPosition(containerHandle,(DesignElementHandle)adjustAfterObjectForSlotHandleInIMixedHandle(),slotID);
        int cur=DEUtil.findInsertPosition(containerHandle,(DesignElementHandle)child,slotID);
        if (cur < pos) {
          pos--;
        }
      }
 else {
        containerHandle=mixHandleInstance.getPropertyHandle().getElementHandle();
        contentString=DEUtil.getDefaultContentName(containerHandle);
        pos=computePosForPropertyHandleInIMixedHandle(containerHandle,contentString);
        int cur=DEUtil.findInsertPosition(containerHandle,(DesignElementHandle)child,contentString);
        if (cur < pos) {
          pos--;
        }
      }
    }
    DesignElementHandle handle=(DesignElementHandle)child;
    CommandStack stack=SessionHandleAdapter.getInstance().getCommandStack();
    stack.startTrans(TRANS_LABEL_MOVE_ELEMENT);
    if (slotID == -1) {
      handle.moveTo(containerHandle,contentString);
      containerHandle.getPropertyHandle(contentString).shift(handle,pos);
    }
 else {
      handle.moveTo(containerHandle,slotID);
      containerHandle.getSlot(slotID).shift(handle,pos);
    }
    stack.commit();
    if (DesignerConstants.TRACING_COMMANDS) {
      System.out.println("String_Node_Str" + DEUtil.getDisplayLabel(handle) + "String_Node_Str"+ slotID+ "String_Node_Str"+ DEUtil.getDisplayLabel(containerHandle)+ "String_Node_Str"+ pos);
    }
  }
 catch (  ContentException e) {
    if (DesignerConstants.TRACING_COMMANDS) {
      System.out.println("String_Node_Str");
    }
    logger.log(Level.SEVERE,e.getMessage(),e);
  }
catch (  SemanticException ee) {
    logger.log(Level.SEVERE,ee.getMessage(),ee);
  }
}