Program: 118224
Project: 118224
Buggy source:
/** 
 * Calculates the contents of page 2 when the it is activated.
 */
@Override protected void pageChange(final int newPageIndex){
  super.pageChange(newPageIndex);
  setName();
  if (newPageIndex == 1) {
    IComponentSettingsView viewer=(IComponentSettingsView)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(IComponentSettingsView.ID);
    if (viewer != null) {
      viewer.cleanDisplay();
    }
    if (codeEditor instanceof ISyntaxCheckableEditor) {
      moveCursorToSelectedComponent();
    }
    codeSync();
    updateCodeEditorContent();
    changeContextsViewStatus(true);
  }
 else   if (newPageIndex == 0 && (jobletEditor == getEditor(oldPageIndex))) {
    covertJobscriptOnPageChange();
    changeContextsViewStatus(true);
  }
 else   if (jobletEditor == getEditor(newPageIndex)) {
    ICreateXtextProcessService convertJobtoScriptService=CorePlugin.getDefault().getCreateXtextProcessService();
    try {
      final String scriptValue=convertJobtoScriptService.convertJobtoScript(getProcess().saveXmlFile());
      IFile file=(IFile)jobletEditor.getEditorInput().getAdapter(IResource.class);
      ByteArrayInputStream byteArrayInputStream=new ByteArrayInputStream(scriptValue.getBytes());
      if (file.exists()) {
        jobletEditor.getDocumentProvider().getDocument(jobletEditor.getEditorInput()).set(scriptValue);
        boolean isProcessReadOnly=((JobEditorInput)getEditor(0).getEditorInput()).isReadOnly();
        IProxyRepositoryFactory rFactory=ProxyRepositoryFactory.getInstance();
        if (isProcessReadOnly || rFactory.isUserReadOnlyOnCurrentProject()) {
          IDocumentProvider provider=jobletEditor.getDocumentProvider();
          Class p=provider.getClass();
          Class[] type=new Class[1];
          type[0]=Boolean.TYPE;
          Object[] para=new Object[1];
          para[0]=Boolean.TRUE;
          Method method=p.getMethod("String_Node_Str",type);
          method.invoke(provider,para);
        }
        IAction action=jobletEditor.getAction("String_Node_Str");
        action.run();
        jobletEditor.doSave(null);
      }
 else {
        file.create(byteArrayInputStream,true,null);
      }
      if (propertyListener == null) {
        propertyListener=new IPropertyListener(){
          @Override public void propertyChanged(          Object source,          int propId){
            if (source instanceof IEditorPart && ((IEditorPart)source).isDirty()) {
              getProcess().setProcessModified(true);
              getProcess().setNeedRegenerateCode(true);
            }
          }
        }
;
        jobletEditor.addPropertyListener(propertyListener);
      }
    }
 catch (    PartInitException e) {
      ExceptionHandler.process(e);
    }
catch (    CoreException e) {
      ExceptionHandler.process(e);
    }
catch (    IOException e) {
      ExceptionHandler.process(e);
    }
catch (    SecurityException e) {
      ExceptionHandler.process(e);
    }
catch (    NoSuchMethodException e) {
      ExceptionHandler.process(e);
    }
catch (    IllegalArgumentException e) {
      ExceptionHandler.process(e);
    }
catch (    IllegalAccessException e) {
      ExceptionHandler.process(e);
    }
catch (    InvocationTargetException e) {
      ExceptionHandler.process(e);
    }
    changeContextsViewStatus(false);
  }
  oldPageIndex=getActivePage();
}

Fixed version (ground truth):
/** 
 * Calculates the contents of page 2 when the it is activated.
 */
@Override protected void pageChange(final int newPageIndex){
  super.pageChange(newPageIndex);
  setName();
  if (newPageIndex == 1) {
    turnToCodePage(newPageIndex);
  }
 else   if (newPageIndex == 0 && (jobletEditor == getEditor(oldPageIndex))) {
    covertJobscriptOnPageChange();
    changeContextsViewStatus(true);
  }
 else   if (jobletEditor == getEditor(newPageIndex)) {
    turnToJobScriptPage(newPageIndex);
  }
  oldPageIndex=getActivePage();
}