Program: 117843
Project: 117843
Buggy source:
private void runProcessContextChanged(final PropertyChangeEvent evt){
  if (isDisposed()) {
    return;
  }
  String propName=evt.getPropertyName();
  if (ProcessMessageManager.UPDATE_CONSOLE.equals(propName)) {
    processNextMessage();
  }
 else   if (ProcessMessageManager.PROP_MESSAGE_ADD.equals(propName) || ProcessMessageManager.PROP_DEBUG_MESSAGE_ADD.equals(propName)) {
    IProcessMessage psMess=(IProcessMessage)evt.getNewValue();
    if (errorMessMap.size() <= CorePlugin.getDefault().getPreferenceStore().getInt(ITalendCorePrefConstants.PREVIEW_LIMIT)) {
      if (!(LanguageManager.getCurrentLanguage().equals(ECodeLanguage.PERL))) {
        getAllErrorMess(psMess);
      }
 else {
        addPerlMark(psMess);
      }
    }
    appendToConsole(psMess);
  }
 else   if (ProcessMessageManager.PROP_MESSAGE_CLEAR.equals(propName)) {
    newMessages.clear();
    getDisplay().asyncExec(new Runnable(){
      @Override public void run(){
        if (!consoleText.isDisposed()) {
          consoleText.setText("String_Node_Str");
        }
      }
    }
);
  }
 else   if (RunProcessContext.PROP_MONITOR.equals(propName)) {
  }
 else   if (RunProcessContext.TRACE_MONITOR.equals(propName)) {
  }
 else   if (RunProcessContext.PROP_RUNNING.equals(propName)) {
    boolean running=((Boolean)evt.getNewValue()).booleanValue();
    List<IProcessMessage> messages=new ArrayList<IProcessMessage>();
    while (!newMessages.isEmpty()) {
      messages.add(newMessages.poll());
    }
    doAppendToConsole(messages);
    if (!running && writer != null) {
      try {
        writer.flush();
        writer.close();
        writer=null;
      }
 catch (      IOException e) {
        ExceptionHandler.process(e);
      }
    }
    if (running == oldRunning) {
      getDisplay().asyncExec(new Runnable(){
        @Override public void run(){
          if (isDisposed()) {
            return;
          }
          setRunnable(!running);
          killBtn.setEnabled(running);
        }
      }
);
      if (!running) {
        appendToConsoleQueue(messagesToDisplay);
      }
    }
  }
}

Fixed version (ground truth):
private void runProcessContextChanged(final PropertyChangeEvent evt){
  if (isDisposed()) {
    return;
  }
  String propName=evt.getPropertyName();
  if (ProcessMessageManager.UPDATE_CONSOLE.equals(propName)) {
    processNextMessage();
  }
 else   if (ProcessMessageManager.PROP_MESSAGE_ADD.equals(propName) || ProcessMessageManager.PROP_DEBUG_MESSAGE_ADD.equals(propName)) {
    IProcessMessage psMess=(IProcessMessage)evt.getNewValue();
    if (errorMessMap.size() <= CorePlugin.getDefault().getPreferenceStore().getInt(ITalendCorePrefConstants.PREVIEW_LIMIT)) {
      if (!(LanguageManager.getCurrentLanguage().equals(ECodeLanguage.PERL))) {
        getAllErrorMess(psMess);
      }
 else {
        addPerlMark(psMess);
      }
    }
    appendToConsole(psMess);
  }
 else   if (ProcessMessageManager.PROP_MESSAGE_CLEAR.equals(propName)) {
    newMessages.clear();
    getDisplay().asyncExec(new Runnable(){
      @Override public void run(){
        if (!consoleText.isDisposed()) {
          consoleText.setText("String_Node_Str");
        }
      }
    }
);
  }
 else   if (RunProcessContext.PROP_MONITOR.equals(propName)) {
  }
 else   if (RunProcessContext.TRACE_MONITOR.equals(propName)) {
  }
 else   if (RunProcessContext.PROP_RUNNING.equals(propName)) {
    boolean running=((Boolean)evt.getNewValue()).booleanValue();
    List<IProcessMessage> messages=new ArrayList<IProcessMessage>();
    while (!newMessages.isEmpty()) {
      messages.add(newMessages.poll());
    }
    doAppendToConsole(messages);
    if (!running && writer != null) {
      try {
        writer.flush();
        writer.close();
        writer=null;
      }
 catch (      IOException e) {
        ExceptionHandler.process(e);
      }
    }
    if (running != oldRunning) {
      getDisplay().asyncExec(new Runnable(){
        @Override public void run(){
          if (isDisposed()) {
            return;
          }
          setRunnable(!running);
          killBtn.setEnabled(running);
        }
      }
);
      if (!running) {
        appendToConsoleQueue(messagesToDisplay);
      }
    }
    oldRunning=running;
  }
}