Program: 95479
Project: 95479
Buggy source:
/** 
 * Creates the instance of the persistent object which is defined by the XML element used as parameter. The method generates all dependent objects as well.
 * @param dtoProj the XML-Project
 * @param proj the IProjectPO
 * @param compNameCache The cache for storing and retrieving Component Names in memory.
 * @param assignNewGuid <code>true</code> if the project and all subnodesshould be assigned new GUIDs. Otherwise <code>false</code>.
 */
private void createComponentNames(ProjectDTO dtoProj,IProjectPO proj,IWritableComponentNameCache compNameCache,boolean assignNewGuid){
  final List<ComponentNameDTO> componentNamesList=dtoProj.getComponentNames();
  final Map<String,String> oldToNewGUID=new HashMap<String,String>(componentNamesList.size());
  Set<IComponentNamePO> createdCompNames=new HashSet<IComponentNamePO>();
  for (  ComponentNameDTO compName : componentNamesList) {
    String guid=compName.getUuid();
    if (assignNewGuid) {
      final String newGuid=PersistenceUtil.generateUUID();
      oldToNewGUID.put(guid,newGuid);
      guid=newGuid;
    }
    final String name=compName.getCompName();
    final String type=compName.getCompType();
    if (!componentHasDefaultMapping(type)) {
      final String creationContext=compName.getCreationContext();
      final CompNameCreationContext ctx=CompNameCreationContext.forName(creationContext);
      final IComponentNamePO componentNamePO=PoMaker.createComponentNamePO(guid,name,type,ctx,proj.getId());
      componentNamePO.setReferencedGuid(compName.getRefUuid());
      createdCompNames.add(componentNamePO);
      compNameCache.addCompNamePO(componentNamePO);
    }
  }
  if (assignNewGuid) {
    for (    IComponentNamePO createdName : createdCompNames) {
      String newGuid=oldToNewGUID.get(createdName.getReferencedGuid());
      if (newGuid != null) {
        createdName.setReferencedGuid(newGuid);
      }
    }
    ImportExportUtil.switchCompNamesGuids(proj,oldToNewGUID);
  }
}

Fixed version (ground truth):
/** 
 * Creates the instance of the persistent object which is defined by the XML element used as parameter. The method generates all dependent objects as well.
 * @param dtoProj the XML-Project
 * @param proj the IProjectPO
 * @param compNameCache The cache for storing and retrieving Component Names in memory.
 * @param assignNewGuid <code>true</code> if the project and all subnodesshould be assigned new GUIDs. Otherwise <code>false</code>.
 */
private void createComponentNames(ProjectDTO dtoProj,IProjectPO proj,IWritableComponentNameCache compNameCache,boolean assignNewGuid){
  final List<ComponentNameDTO> componentNamesList=dtoProj.getComponentNames();
  final Map<String,String> oldToNewGUID=new HashMap<String,String>(componentNamesList.size());
  Set<IComponentNamePO> createdCompNames=new HashSet<IComponentNamePO>();
  for (  ComponentNameDTO compName : componentNamesList) {
    String guid=compName.getUuid();
    if (assignNewGuid) {
      final String newGuid=PersistenceUtil.generateUUID();
      oldToNewGUID.put(guid,newGuid);
      guid=newGuid;
    }
    final String name=compName.getCompName();
    final String type=compName.getCompType();
    final String creationContext=compName.getCreationContext();
    final CompNameCreationContext ctx=CompNameCreationContext.forName(creationContext);
    final IComponentNamePO componentNamePO=PoMaker.createComponentNamePO(guid,name,type,ctx,proj.getId());
    componentNamePO.setReferencedGuid(compName.getRefUuid());
    createdCompNames.add(componentNamePO);
    compNameCache.addCompNamePO(componentNamePO);
  }
  if (assignNewGuid) {
    for (    IComponentNamePO createdName : createdCompNames) {
      String newGuid=oldToNewGUID.get(createdName.getReferencedGuid());
      if (newGuid != null) {
        createdName.setReferencedGuid(newGuid);
      }
    }
    ImportExportUtil.switchCompNamesGuids(proj,oldToNewGUID);
  }
}