Program: 95639
Project: 95639
Buggy source:
/** 
 * Creates the instance of the persistent object which is defined by the DTO element used as parameter. The method generates all dependent objects as well.
 * @param proj The IProjectPO which is currently build. The instance isneeded by some objects to verify that their data confirms to project specification (for instance languages).
 * @param dto Abstraction of the DTO element
 * @param assignNewGuid <code>true</code> if the testcase should be assigned a new GUID. Otherwise <code>false</code>.
 * @param mapper mapper to resolve param names
 * @return a persistent object generated from the information in the DTO element
 * @throws InvalidDataException 
 */
private ISpecTestCasePO createTestCaseBase(IProjectPO proj,TestCaseDTO dto,boolean assignNewGuid,IParamNameMapper mapper) throws InvalidDataException {
  ISpecTestCasePO tc;
  if (assignNewGuid) {
    tc=NodeMaker.createSpecTestCasePO(dto.getName());
    m_tcRef.put(tc.getGuid(),tc);
    m_oldToNewGuids.put(dto.getUuid(),tc.getGuid());
  }
 else {
    tc=NodeMaker.createSpecTestCasePO(dto.getName(),dto.getUuid());
    m_tcRef.put(dto.getUuid(),tc);
  }
  tc.setComment(dto.getComment());
  tc.setDescription(dto.getDescription());
  tc.setGenerated(dto.getGenerated());
  tc.setTaskId(dto.getTaskId());
  tc.setInterfaceLocked(dto.isInterfaceLocked());
  tc.setDataFile(dto.getDatafile());
  fillTrackedChangesInformation(tc,dto);
  if (dto.getReferencedTestData() != null) {
    String referencedDataName=dto.getReferencedTestData();
    for (    IParameterInterfacePO testDataCube : TestDataCubeBP.getAllTestDataCubesFor(proj)) {
      if (referencedDataName.equals(testDataCube.getName())) {
        tc.setReferencedDataCube(testDataCube);
        break;
      }
    }
  }
  for (  ParamDescriptionDTO pdDto : dto.getParameterDescription()) {
    String uniqueId=pdDto.getUuid();
    if (assignNewGuid) {
      IParamDescriptionPO paramDesc=tc.addParameter(pdDto.getType(),pdDto.getName(),mapper);
      m_oldToNewGuids.put(uniqueId,paramDesc.getUniqueId());
    }
 else {
      if (uniqueId != null && Pattern.matches("String_Node_Str" + GUID_LENGTH + "String_Node_Str",uniqueId)) {
        tc.addParameter(pdDto.getType(),pdDto.getName(),uniqueId,mapper);
      }
 else {
        tc.addParameter(pdDto.getType(),pdDto.getName(),mapper);
      }
    }
  }
  tc.setDataManager(createTDManager(tc,dto.getTDManager(),assignNewGuid));
  if (!assignNewGuid) {
    generateRefTestCase(dto,proj,tc,assignNewGuid);
  }
  return tc;
}

Fixed version (ground truth):
/** 
 * Creates the instance of the persistent object which is defined by the DTO element used as parameter. The method generates all dependent objects as well.
 * @param proj The IProjectPO which is currently build. The instance isneeded by some objects to verify that their data confirms to project specification (for instance languages).
 * @param dto Abstraction of the DTO element
 * @param assignNewGuid <code>true</code> if the testcase should be assigned a new GUID. Otherwise <code>false</code>.
 * @param mapper mapper to resolve param names
 * @return a persistent object generated from the information in the DTO element
 * @throws InvalidDataException 
 */
private ISpecTestCasePO createTestCaseBase(IProjectPO proj,TestCaseDTO dto,boolean assignNewGuid,IParamNameMapper mapper) throws InvalidDataException {
  ISpecTestCasePO tc;
  if (assignNewGuid) {
    tc=NodeMaker.createSpecTestCasePO(dto.getName());
    m_tcRef.put(tc.getGuid(),tc);
    m_oldToNewGuids.put(dto.getUuid(),tc.getGuid());
  }
 else {
    tc=NodeMaker.createSpecTestCasePO(dto.getName(),dto.getUuid());
    m_tcRef.put(dto.getUuid(),tc);
  }
  tc.setComment(dto.getComment());
  tc.setDescription(dto.getDescription());
  tc.setGenerated(dto.getGenerated());
  tc.setTaskId(dto.getTaskId());
  tc.setInterfaceLocked(dto.isInterfaceLocked());
  tc.setDataFile(dto.getDatafile());
  fillTrackedChangesInformation(tc,dto);
  if (dto.getReferencedTestData() != null) {
    String referencedDataName=dto.getReferencedTestData();
    for (    IParameterInterfacePO testDataCube : TestDataCubeBP.getAllTestDataCubesFor(proj)) {
      if (referencedDataName.equals(testDataCube.getName())) {
        tc.setReferencedDataCube(testDataCube);
        break;
      }
    }
  }
  for (  ParamDescriptionDTO pdDto : dto.getParameterDescription()) {
    String uniqueId=pdDto.getUuid();
    if (assignNewGuid) {
      IParamDescriptionPO paramDesc=tc.addParameter(pdDto.getType(),pdDto.getName(),mapper);
      m_oldToNewGuids.put(uniqueId,paramDesc.getUniqueId());
    }
 else {
      if (uniqueId != null && Pattern.matches("String_Node_Str" + ImportExportUtil.UUID_LENGTH + "String_Node_Str",uniqueId)) {
        tc.addParameter(pdDto.getType(),pdDto.getName(),uniqueId,mapper);
      }
 else {
        tc.addParameter(pdDto.getType(),pdDto.getName(),mapper);
      }
    }
  }
  tc.setDataManager(createTDManager(tc,dto.getTDManager(),assignNewGuid));
  if (!assignNewGuid) {
    generateRefTestCase(dto,proj,tc,assignNewGuid);
  }
  return tc;
}