Program: 95126
Project: 95126
Buggy source:
public void run(){
  try {
    IEditorPart editorPart=page.openEditor(new FileEditorInput(file),editorDescriptor.getId());
    if (editorPart instanceof AbstractTextEditor) {
      IEditorInput editorInput=editorPart.getEditorInput();
      IDocumentProvider dp=DocumentProviderRegistry.getDefault().getDocumentProvider(editorInput);
      AbstractTextEditor textEditor=(AbstractTextEditor)editorPart;
      IDocument document=dp.getDocument(editorPart.getEditorInput());
      if (document != null) {
        EditorListener listener=new EditorListener(document,textEditor);
        document.addDocumentListener(listener);
      }
 else {
        if (dp instanceof TextFileDocumentProvider) {
          ((TextFileDocumentProvider)dp).connect(editorPart.getEditorInput());
          document=((TextFileDocumentProvider)dp).getDocument(editorPart.getEditorInput());
          if (document != null) {
            EditorListener listener=new EditorListener(document,textEditor);
            document.addDocumentListener(listener);
            return;
          }
 else {
            Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,"String_Node_Str",null));
          }
        }
        Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,"String_Node_Str",null));
      }
    }
  }
 catch (  PartInitException e) {
    Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,e.getLocalizedMessage(),e));
  }
catch (  CoreException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void run(){
  try {
    IEditorPart editorPart=page.openEditor(new FileEditorInput(file),editorDescriptor.getId());
    if (editorPart instanceof AbstractTextEditor) {
      IEditorInput editorInput=editorPart.getEditorInput();
      IDocumentProvider dp=DocumentProviderRegistry.getDefault().getDocumentProvider(editorInput);
      AbstractTextEditor textEditor=(AbstractTextEditor)editorPart;
      IDocument document=dp.getDocument(editorPart.getEditorInput());
      if (document != null) {
        EditorListener listener=new EditorListener(document,textEditor,true);
        document.addDocumentListener(listener);
      }
 else {
        if (dp instanceof TextFileDocumentProvider) {
          ((TextFileDocumentProvider)dp).connect(editorPart.getEditorInput());
          document=((TextFileDocumentProvider)dp).getDocument(editorPart.getEditorInput());
          if (document != null) {
            EditorListener listener=new EditorListener(document,textEditor,true);
            document.addDocumentListener(listener);
            return;
          }
 else {
            Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,"String_Node_Str",null));
          }
        }
        Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,"String_Node_Str",null));
      }
    }
  }
 catch (  PartInitException e) {
    Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,e.getLocalizedMessage(),e));
  }
catch (  CoreException e) {
    Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,e.getLocalizedMessage(),e));
  }
}