Program: 73113
Project: 73113
Buggy source:
protected static void addCommandToCompound(Object transferData,Object targetObj,int position,String commandName,String commandType,CompoundCommand commands) throws SemanticException {
  if (transferData instanceof SlotHandle) {
    transferData=transferSlotHandle(commandType,transferData);
  }
  if (transferData instanceof Object[]) {
    Object[] array=(Object[])transferData;
    for (int i=0; i < array.length; i++) {
      if (array[i] instanceof EmbeddedImageHandle) {
        if (((EmbeddedImageHandle)array[i]).getElementHandle().getRoot() instanceof LibraryHandle) {
          try {
            array[i]=StructureFactory.newEmbeddedImageFrom((EmbeddedImageHandle)array[i],SessionHandleAdapter.getInstance().getReportDesignHandle());
          }
 catch (          LibraryException e) {
          }
        }
      }
      addCommandToCompound(array[i],targetObj,position,commandName,commandType,commands);
      if (position > -1) {
        position++;
      }
    }
  }
 else   if (transferData instanceof DesignElementHandle || transferData instanceof IDesignElement) {
    if (transferData instanceof DesignElementHandle && targetObj instanceof SlotHandle && ((DesignElementHandle)transferData).getContainerSlotHandle() == targetObj) {
      ((DesignElementHandle)transferData).moveTo(position);
    }
 else     if (targetObj instanceof DesignElementHandle || targetObj instanceof SlotHandle || targetObj instanceof PropertyHandle) {
      commands.add(getNewCommand(commandType,transferData,targetObj,position));
    }
  }
 else   if (transferData instanceof IStructure) {
    commands.add(new PasteStructureCommand((IStructure)transferData,targetObj));
  }
 else   if (transferData instanceof StructureHandle) {
    commands.add(new PasteStructureCommand(((StructureHandle)transferData).getStructure(),targetObj));
  }
}

Fixed version (ground truth):
private static void addCommandToCompound(Object transferData,Object targetObj,int position,String commandName,String commandType,CompoundCommand commands) throws SemanticException {
  if (transferData instanceof SlotHandle) {
    transferData=transferSlotHandle(commandType,transferData);
  }
  if (transferData instanceof Object[]) {
    Object[] array=(Object[])transferData;
    for (int i=0; i < array.length; i++) {
      if (array[i] instanceof EmbeddedImageHandle) {
        if (((EmbeddedImageHandle)array[i]).getElementHandle().getRoot() instanceof LibraryHandle) {
          try {
            array[i]=StructureFactory.newEmbeddedImageFrom((EmbeddedImageHandle)array[i],SessionHandleAdapter.getInstance().getReportDesignHandle());
          }
 catch (          LibraryException e) {
          }
        }
      }
      addCommandToCompound(array[i],targetObj,position,commandName,commandType,commands);
      if (position > -1) {
        position++;
      }
    }
  }
 else   if (transferData instanceof DesignElementHandle || transferData instanceof IDesignElement) {
    if (transferData instanceof DesignElementHandle && targetObj instanceof SlotHandle && ((DesignElementHandle)transferData).getContainerSlotHandle() == targetObj) {
      ((DesignElementHandle)transferData).moveTo(position);
    }
 else     if (targetObj instanceof DesignElementHandle || targetObj instanceof SlotHandle || targetObj instanceof PropertyHandle) {
      commands.add(getNewCommand(commandType,transferData,targetObj,position));
    }
  }
 else   if (transferData instanceof IStructure) {
    commands.add(new PasteStructureCommand((IStructure)transferData,targetObj));
  }
 else   if (transferData instanceof StructureHandle) {
    commands.add(new PasteStructureCommand(((StructureHandle)transferData).getStructure(),targetObj));
  }
}