Program: 121582
Project: 121582
Buggy source:
/** 
 * Saves the multi-page editor's document.
 */
@Override public void doSave(final IProgressMonitor monitor){
  Item curItem=getProcess().getProperty().getItem();
  IRepositoryService service=CorePlugin.getDefault().getRepositoryService();
  IProxyRepositoryFactory repFactory=service.getProxyRepositoryFactory();
  try {
    repFactory.updateLockStatus();
    boolean locked=repFactory.getStatus(curItem) == ERepositoryStatus.LOCK_BY_USER;
    if (!locked && !getProcess().isReadOnly()) {
      repFactory.lock(curItem);
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  if (getProcess().isReadOnly()) {
    return;
  }
  ERepositoryStatus status=repFactory.getStatus(curItem);
  if (!status.equals(ERepositoryStatus.LOCK_BY_USER) && !repFactory.getRepositoryContext().isEditableAsReadOnly()) {
    MessageDialog.openWarning(getEditor(0).getEditorSite().getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
    return;
  }
  if (!isDirty()) {
    return;
  }
  Map<String,Boolean> jobletMap=new HashMap<String,Boolean>();
  changeCollapsedState(true,jobletMap);
  updateRunJobContext();
  designerEditor.getProcess().getProperty().eAdapters().remove(dirtyListener);
  repFactory.addRepositoryWorkUnitListener(repositoryWorkListener);
  if (getActivePage() == 0 || getActivePage() == 1) {
    getEditor(0).doSave(monitor);
  }
 else   if (getActivePage() == 2) {
    boolean isDirty=getEditor(2).isDirty();
    getEditor(2).doSave(monitor);
    try {
      IProcess2 oldProcess=getProcess();
      ICreateXtextProcessService n=CorePlugin.getDefault().getCreateXtextProcessService();
      ProcessType processType=n.convertDesignerEditorInput(((IFile)getEditor(2).getEditorInput().getAdapter(IResource.class)).getLocation().toOSString(),oldProcess.getProperty());
      IProcess2 newProcess=null;
      Item item=getProcess().getProperty().getItem();
      if (item instanceof ProcessItem) {
        ((Process)designerEditor.getProcess()).updateProcess(processType);
        if (isDirty) {
          getProcess().setProcessModified(true);
          getProcess().setNeedRegenerateCode(true);
        }
      }
 else       if (item instanceof JobletProcessItem) {
        AbstractProcessProvider processProvider=AbstractProcessProvider.findProcessProviderFromPID(IComponent.JOBLET_PID);
        if (processProvider != null) {
          newProcess=processProvider.buildNewGraphicProcess(item);
        }
        designerEditor.setProcess(newProcess);
        Boolean lastVersion=null;
        if (oldProcess instanceof ILastVersionChecker) {
          lastVersion=((ILastVersionChecker)oldProcess).isLastVersion(item);
        }
        if (designerEditor.getEditorInput() instanceof JobEditorInput) {
          ((JobEditorInput)designerEditor.getEditorInput()).checkInit(lastVersion,null,true);
        }
      }
      getEditor(0).doSave(monitor);
    }
 catch (    PersistenceException e) {
      ExceptionHandler.process(e);
    }
  }
  if (processEditorInput != null) {
    propertyInformation=new ArrayList(processEditorInput.getItem().getProperty().getInformations());
    propertyIsDirty=false;
    firePropertyChange(IEditorPart.PROP_DIRTY);
    if (processEditorInput.getItem() instanceof ProcessItem) {
      RepositoryManager.refresh(ERepositoryObjectType.PROCESS);
    }
 else {
      RepositoryManager.refresh(ERepositoryObjectType.JOBLET);
    }
  }
  if (designerEditor != null && dirtyListener != null) {
    designerEditor.getProcess().getProperty().eAdapters().add(dirtyListener);
  }
  refreshJobSettingsView();
  changeCollapsedState(false,jobletMap);
}

Fixed version (ground truth):
/** 
 * Saves the multi-page editor's document.
 */
@Override public void doSave(final IProgressMonitor monitor){
  Item curItem=getProcess().getProperty().getItem();
  IRepositoryService service=CorePlugin.getDefault().getRepositoryService();
  IProxyRepositoryFactory repFactory=service.getProxyRepositoryFactory();
  try {
    repFactory.updateLockStatus();
    boolean locked=repFactory.getStatus(curItem) == ERepositoryStatus.LOCK_BY_USER;
    if (!locked && !getProcess().isReadOnly()) {
      repFactory.lock(curItem);
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  if (getProcess().isReadOnly()) {
    return;
  }
  ERepositoryStatus status=repFactory.getStatus(curItem);
  if (!status.equals(ERepositoryStatus.LOCK_BY_USER) && !repFactory.getRepositoryContext().isEditableAsReadOnly()) {
    MessageDialog.openWarning(getEditor(0).getEditorSite().getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
    return;
  }
  if (!isDirty()) {
    return;
  }
  Map<String,Boolean> jobletMap=new HashMap<String,Boolean>();
  changeCollapsedState(true,jobletMap);
  updateRunJobContext();
  designerEditor.getProcess().getProperty().eAdapters().remove(dirtyListener);
  repFactory.addRepositoryWorkUnitListener(repositoryWorkListener);
  if (getActivePage() == 0 || getActivePage() == 1) {
    getEditor(0).doSave(monitor);
  }
 else   if (getActivePage() == 2) {
    boolean isDirty=getEditor(2).isDirty();
    getEditor(2).doSave(monitor);
    try {
      IProcess2 oldProcess=getProcess();
      ICreateXtextProcessService n=CorePlugin.getDefault().getCreateXtextProcessService();
      ProcessType processType=n.convertDesignerEditorInput(((IFile)getEditor(2).getEditorInput().getAdapter(IResource.class)).getLocation().toOSString(),oldProcess.getProperty());
      IProcess2 newProcess=null;
      Item item=getProcess().getProperty().getItem();
      if (item instanceof ProcessItem) {
        ((Process)designerEditor.getProcess()).updateProcess(processType);
        if (isDirty) {
          getProcess().setProcessModified(true);
          getProcess().setNeedRegenerateCode(true);
        }
      }
 else       if (item instanceof JobletProcessItem) {
        AbstractProcessProvider processProvider=AbstractProcessProvider.findProcessProviderFromPID(IComponent.JOBLET_PID);
        if (processProvider != null) {
          newProcess=processProvider.buildNewGraphicProcess(item);
        }
        designerEditor.setProcess(newProcess);
        Boolean lastVersion=null;
        if (oldProcess instanceof ILastVersionChecker) {
          lastVersion=((ILastVersionChecker)oldProcess).isLastVersion(item);
        }
        if (designerEditor.getEditorInput() instanceof JobEditorInput) {
          ((JobEditorInput)designerEditor.getEditorInput()).checkInit(lastVersion,null,true);
        }
      }
      getEditor(0).doSave(monitor);
    }
 catch (    PersistenceException e) {
      ExceptionHandler.process(e);
    }
  }
  if (processEditorInput != null) {
    propertyInformation=new ArrayList(processEditorInput.getItem().getProperty().getInformations());
    propertyIsDirty=false;
  }
  if (designerEditor != null && dirtyListener != null) {
    designerEditor.getProcess().getProperty().eAdapters().add(dirtyListener);
  }
  refreshJobSettingsView();
  changeCollapsedState(false,jobletMap);
}