Program: 96191
Project: 96191
Buggy source:
/** 
 * Extracts a given List of nodes from a node to a new TestCase and inserts the new created/extracted TestCase into the owner node as an ExecTestCase.
 * @param newTcName The name of the new SpecTestCase
 * @param ownerNode the edited node from which to extract
 * @param modNodes the node to be extracted
 * @param s the database session
 * @param mapper mapper to resolve param names
 * @return an ExecTestCasePO, the location of use of the extracted TestCase
 * @throws TreeOpFailedException if the operation failed
 */
public static IExecTestCasePO extractTestCase(String newTcName,INodePO ownerNode,List<IParamNodePO> modNodes,EntityManager s,ParamNameBPDecorator mapper) throws TreeOpFailedException {
  final boolean isOwnerSpecTestCase=ownerNode instanceof ISpecTestCasePO;
  ISpecTestCasePO newTc=NodeMaker.createSpecTestCasePO(newTcName);
  s.persist(newTc);
  IProjectPO project=GeneralStorage.getInstance().getProject();
  AbstractCmdHandleChild handler=NodePM.getCmdHandleChild(project,newTc);
  handler.add(project,newTc,null);
  int pos=-1;
  Map<String,String> oldToNewParamGuids=new HashMap<String,String>();
  for (  IParamNodePO selectecNode : modNodes) {
    INodePO moveNode=findNode(ownerNode,selectecNode);
    if (moveNode == null) {
      throw new TreeOpFailedException(Messages.NodeMismatch,MessageIDs.E_PO_NOT_FOUND);
    }
    if (isOwnerSpecTestCase) {
      addParamsToParent(newTc,selectecNode,mapper,(ISpecTestCasePO)ownerNode,oldToNewParamGuids);
    }
    pos=ownerNode.indexOf(moveNode);
    AbstractCmdHandleChild childHandler=NodePM.getCmdHandleChild(ownerNode,moveNode);
    childHandler.remove(ownerNode,moveNode);
    childHandler.add(newTc,moveNode,null);
  }
  IExecTestCasePO newExec=NodeMaker.createExecTestCasePO(newTc);
  if (isOwnerSpecTestCase) {
    propagateParams(newExec,(IParamNodePO)ownerNode);
  }
  propagateCompNames(modNodes,newExec);
  ownerNode.addNode(pos,newExec);
  return newExec;
}

Fixed version (ground truth):
/** 
 * Extracts a given List of nodes from a node to a new TestCase and inserts the new created/extracted TestCase into the owner node as an ExecTestCase.
 * @param newTcName The name of the new SpecTestCase
 * @param ownerNode the edited node from which to extract
 * @param modNodes the node to be extracted
 * @param s the database session
 * @param mapper mapper to resolve param names
 * @return an ExecTestCasePO, the location of use of the extracted TestCase
 * @throws TreeOpFailedException if the operation failed
 */
public static IExecTestCasePO extractTestCase(String newTcName,INodePO ownerNode,List<IParamNodePO> modNodes,EntityManager s,ParamNameBPDecorator mapper) throws TreeOpFailedException {
  final boolean isOwnerSpecTestCase=ownerNode instanceof ISpecTestCasePO;
  ISpecTestCasePO newTc=NodeMaker.createSpecTestCasePO(newTcName);
  s.persist(newTc);
  INodePO parent=ISpecObjContPO.TCB_ROOT_NODE;
  AbstractCmdHandleChild handler=NodePM.getCmdHandleChild(parent,newTc);
  handler.add(parent,newTc,null);
  int pos=-1;
  Map<String,String> oldToNewParamGuids=new HashMap<String,String>();
  for (  IParamNodePO selectecNode : modNodes) {
    INodePO moveNode=findNode(ownerNode,selectecNode);
    if (moveNode == null) {
      throw new TreeOpFailedException(Messages.NodeMismatch,MessageIDs.E_PO_NOT_FOUND);
    }
    if (isOwnerSpecTestCase) {
      addParamsToParent(newTc,selectecNode,mapper,(ISpecTestCasePO)ownerNode,oldToNewParamGuids);
    }
    pos=ownerNode.indexOf(moveNode);
    AbstractCmdHandleChild childHandler=NodePM.getCmdHandleChild(ownerNode,moveNode);
    childHandler.remove(ownerNode,moveNode);
    childHandler.add(newTc,moveNode,null);
  }
  IExecTestCasePO newExec=NodeMaker.createExecTestCasePO(newTc);
  if (isOwnerSpecTestCase) {
    propagateParams(newExec,(IParamNodePO)ownerNode);
  }
  propagateCompNames(modNodes,newExec);
  ownerNode.addNode(pos,newExec);
  return newExec;
}