Program: 119260
Project: 119260
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);
  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.getNode().isJoblet()) {
          if (checkJoblet) {
            JobletContainer jobletCon=(JobletContainer)container;
            boolean needUpdate=false;
            IJobletProviderService service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
            if (service != null) {
              needUpdate=service.checkModify(jobletCon);
            }
            saveJobletNode(jobletCon,needUpdate);
          }
          saveNode(fileFact,processType,nList,cList,container.getNode(),factory);
        }
 else {
          saveNode(fileFact,processType,nList,cList,container.getNode(),factory);
        }
      }
    }
    if (element instanceof JobletContainer) {
      if (checkJoblet) {
        JobletContainer jobletCon=(JobletContainer)element;
        boolean needUpdate=false;
        IJobletProviderService service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
        if (service != null) {
          needUpdate=service.checkModify(jobletCon);
        }
        saveJobletNode(jobletCon,needUpdate);
      }
      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 (getScreenshot() != null) {
    processType.getScreenshots().put("String_Node_Str",getScreenshot());
  }
  setScreenshot(null);
  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);
  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.getNode().isJoblet()) {
          if (checkJoblet) {
            JobletContainer jobletCon=(JobletContainer)container;
            boolean needUpdate=false;
            IJobletProviderService service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
            if (service != null) {
              needUpdate=service.checkModify(jobletCon);
            }
            saveJobletNode(jobletCon,needUpdate);
          }
          saveNode(fileFact,processType,nList,cList,container.getNode(),factory);
        }
 else {
          saveNode(fileFact,processType,nList,cList,container.getNode(),factory);
        }
      }
    }
    if (element instanceof JobletContainer) {
      if (checkJoblet) {
        JobletContainer jobletCon=(JobletContainer)element;
        boolean needUpdate=false;
        IJobletProviderService service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
        if (service != null) {
          needUpdate=service.checkModify(jobletCon);
        }
        saveJobletNode(jobletCon,needUpdate);
      }
      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 (getScreenshot() != null) {
    processType.getScreenshots().put(PROCESS_SCREENSHOT_KEY,getScreenshot());
    if (property != null && (property.getItem() != null) && (property.getItem() instanceof ProcessItem)) {
      ProcessItem pi=(ProcessItem)property.getItem();
      ProcessType pt=pi.getProcess();
      if (pt != null) {
        EMap delegateScreenshots=pt.getScreenshots();
        for (        Object objkey : delegateScreenshots.keySet()) {
          if (!PROCESS_SCREENSHOT_KEY.equals(objkey)) {
            processType.getScreenshots().put(objkey,delegateScreenshots.get(objkey));
          }
        }
      }
    }
  }
  setScreenshot(null);
  contextManager.saveToEmf(processType.getContext());
  EmfHelper.removeProxy(processType);
  return processType;
}