Program: 117813
Project: 117813
Buggy source:
@Override public ProcessType saveXmlFile(boolean checkJoblet) throws IOException {
  init();
  TalendFileFactory fileFact=TalendFileFactory.eINSTANCE;
  ProcessType processType=createProcessType(fileFact);
  processType.setParameters(fileFact.createParametersType());
  saveProcessElementParameters(processType);
  saveRoutinesDependencies(processType);
  saveAdditionalProperties();
  String sourceJobType=ConvertJobsUtil.getJobTypeFromFramework(this.getProperty().getItem());
  String sourceJobFramework=(String)this.getProperty().getAdditionalProperties().get(ConvertJobsUtil.FRAMEWORK);
  if (sourceJobType != null) {
    processType.setJobType(sourceJobType.replace(' ','_'));
  }
  if (sourceJobFramework != null) {
    processType.setFramework(sourceJobFramework.replace(' ','_'));
  }
  EList nList=processType.getNode();
  EList cList=processType.getConnection();
  MetadataEmfFactory factory=new MetadataEmfFactory();
  JobletUtil jutil=new JobletUtil();
  for (  Element element : elem) {
    if (element instanceof SubjobContainer) {
      saveSubjob(fileFact,processType,(SubjobContainer)element);
      for (      NodeContainer container : ((SubjobContainer)element).getNodeContainers()) {
        if (container instanceof AbstractJobletContainer) {
          if (checkJoblet && container.getNode().isJoblet()) {
            AbstractJobletContainer jobletCon=(AbstractJobletContainer)container;
            saveJobletNode(jobletCon);
          }
          saveNode(fileFact,processType,nList,cList,container.getNode(),factory);
        }
 else {
          saveNode(fileFact,processType,nList,cList,container.getNode(),factory);
        }
      }
    }
 else     if (element instanceof AbstractJobletContainer) {
      if (checkJoblet && ((AbstractJobletContainer)element).getNode().isJoblet()) {
        AbstractJobletContainer jobletCon=(AbstractJobletContainer)element;
        saveJobletNode(jobletCon);
      }
      saveNode(fileFact,processType,nList,cList,((NodeContainer)element).getNode(),factory);
    }
 else     if (element instanceof NodeContainer) {
      saveNode(fileFact,processType,nList,cList,((NodeContainer)element).getNode(),factory);
    }
 else     if (element instanceof Note) {
      saveNote(fileFact,processType,(Note)element);
    }
  }
  processType.setDefaultContext(contextManager.getDefaultContext().getName());
  if (!getScreenshots().isEmpty()) {
    for (    String key : getScreenshots().keySet()) {
      processType.getScreenshots().put(key,getScreenshots().get(key));
    }
  }
  contextManager.saveToEmf(processType.getContext());
  EmfHelper.removeProxy(processType);
  return processType;
}

Fixed version (ground truth):
@Override public ProcessType saveXmlFile(boolean checkJoblet) throws IOException {
  init();
  TalendFileFactory fileFact=TalendFileFactory.eINSTANCE;
  ProcessType processType=createProcessType(fileFact);
  processType.setParameters(fileFact.createParametersType());
  saveProcessElementParameters(processType);
  saveRoutinesDependencies(processType);
  saveAdditionalProperties();
  String sourceJobType=ConvertJobsUtil.getJobTypeFromFramework(this.getProperty().getItem());
  String sourceJobFramework=(String)this.getProperty().getAdditionalProperties().get(ConvertJobsUtil.FRAMEWORK);
  if (sourceJobType != null) {
    processType.setJobType(sourceJobType.replace(' ','_'));
  }
  if (sourceJobFramework != null) {
    processType.setFramework(sourceJobFramework.replace(' ','_'));
  }
  EList nList=processType.getNode();
  EList cList=processType.getConnection();
  MetadataEmfFactory factory=new MetadataEmfFactory();
  JobletUtil jutil=new JobletUtil();
  List<Node> savedNodes=new ArrayList<Node>();
  for (  Element element : elem) {
    if (element instanceof SubjobContainer) {
      saveSubjob(fileFact,processType,(SubjobContainer)element);
      for (      NodeContainer container : ((SubjobContainer)element).getNodeContainers()) {
        if (container instanceof AbstractJobletContainer) {
          if (checkJoblet && container.getNode().isJoblet()) {
            AbstractJobletContainer jobletCon=(AbstractJobletContainer)container;
            saveJobletNode(jobletCon);
          }
          if (!savedNodes.contains(container.getNode())) {
            saveNode(fileFact,processType,nList,cList,container.getNode(),factory);
            savedNodes.add(container.getNode());
          }
        }
 else {
          if (!savedNodes.contains(container.getNode())) {
            saveNode(fileFact,processType,nList,cList,container.getNode(),factory);
            savedNodes.add(container.getNode());
          }
        }
      }
    }
 else     if (element instanceof AbstractJobletContainer) {
      if (checkJoblet && ((AbstractJobletContainer)element).getNode().isJoblet()) {
        AbstractJobletContainer jobletCon=(AbstractJobletContainer)element;
        saveJobletNode(jobletCon);
      }
      if (!savedNodes.contains(((NodeContainer)element).getNode())) {
        saveNode(fileFact,processType,nList,cList,((NodeContainer)element).getNode(),factory);
        savedNodes.add(((NodeContainer)element).getNode());
      }
    }
 else     if (element instanceof NodeContainer) {
      if (!savedNodes.contains(((NodeContainer)element).getNode())) {
        saveNode(fileFact,processType,nList,cList,((NodeContainer)element).getNode(),factory);
        savedNodes.add(((NodeContainer)element).getNode());
      }
    }
 else     if (element instanceof Note) {
      saveNote(fileFact,processType,(Note)element);
    }
  }
  processType.setDefaultContext(contextManager.getDefaultContext().getName());
  if (!getScreenshots().isEmpty()) {
    for (    String key : getScreenshots().keySet()) {
      processType.getScreenshots().put(key,getScreenshots().get(key));
    }
  }
  contextManager.saveToEmf(processType.getContext());
  EmfHelper.removeProxy(processType);
  return processType;
}