Program: 96376
Project: 96376
Buggy source:
/** 
 * Initializes the Hibernator using the given connection information. If the information contains a username <em>and</em> password, then  these are used for initialization. If not, then a login dialog is  presented.
 * @param connectionInfo The information to use to initialize the Hibernator.
 */
private void connectWithoutLoginDialog(final DatabaseConnectionInfo connectionInfo){
  Display.getDefault().syncExec(new Runnable(){
    public void run(){
      String predefinedUsername=connectionInfo.getProperty(HIBERNATE_CONNECTION_USERNAME);
      String predefinedPassword=connectionInfo.getProperty(HIBERNATE_CONNECTION_PASSWORD);
      if (predefinedUsername != null && predefinedPassword != null) {
        Hibernator.setUser(predefinedUsername);
        Hibernator.setPw(predefinedPassword);
        Hibernator.setDbConnectionName(connectionInfo);
        if (Hibernator.instance() != null) {
          CompNamePM.dispose();
          GeneralStorage.getInstance().dispose();
          if (LockManager.isRunning()) {
            LockManager.instance().dispose();
          }
          Hibernator.instance().dispose();
          DataEventDispatcher.getInstance().fireTestresultChanged(TestresultState.Clear);
        }
        ConnectDbOperation connDbOp=new ConnectDbOperation();
        try {
          PlatformUI.getWorkbench().getProgressService().run(true,false,connDbOp);
        }
 catch (        InvocationTargetException e) {
          hibernateInit=false;
        }
catch (        InterruptedException e) {
          hibernateInit=false;
        }
        if (hibernateInit) {
          Utils.clearClient();
          LockManager.instance();
          Plugin.getDefault().writeLineToConsole(Messages.SelectDatabaseActionInfoConnectSuccessful,true);
        }
 else {
          Utils.clearClient(true);
          Plugin.getDefault().writeLineToConsole(Messages.SelectDatabaseActionInfoConnectFailed,true);
        }
        Plugin.stopLongRunning();
      }
 else {
        ProgressEventDispatcher.notifyListener(new ProgressEvent(ProgressEvent.LOGIN,null,null));
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Initializes the Hibernator using the given connection information. If the information contains a username <em>and</em> password, then  these are used for initialization. If not, then a login dialog is  presented.
 * @param connectionInfo The information to use to initialize the Hibernator.
 */
private void connectWithoutLoginDialog(final DatabaseConnectionInfo connectionInfo){
  Display.getDefault().syncExec(new Runnable(){
    public void run(){
      Utils.clearClient();
      String predefinedUsername=connectionInfo.getProperty(HIBERNATE_CONNECTION_USERNAME);
      String predefinedPassword=connectionInfo.getProperty(HIBERNATE_CONNECTION_PASSWORD);
      if (predefinedUsername != null && predefinedPassword != null) {
        Hibernator.setUser(predefinedUsername);
        Hibernator.setPw(predefinedPassword);
        Hibernator.setDbConnectionName(connectionInfo);
        if (Hibernator.instance() != null) {
          CompNamePM.dispose();
          GeneralStorage.getInstance().dispose();
          if (LockManager.isRunning()) {
            LockManager.instance().dispose();
          }
          Hibernator.instance().dispose();
        }
        ConnectDbOperation connDbOp=new ConnectDbOperation();
        try {
          PlatformUI.getWorkbench().getProgressService().run(true,false,connDbOp);
        }
 catch (        InvocationTargetException e) {
          hibernateInit=false;
        }
catch (        InterruptedException e) {
          hibernateInit=false;
        }
        if (hibernateInit) {
          LockManager.instance();
          Plugin.getDefault().writeLineToConsole(Messages.SelectDatabaseActionInfoConnectSuccessful,true);
        }
 else {
          Plugin.getDefault().writeLineToConsole(Messages.SelectDatabaseActionInfoConnectFailed,true);
        }
        Plugin.stopLongRunning();
      }
 else {
        ProgressEventDispatcher.notifyListener(new ProgressEvent(ProgressEvent.LOGIN,null,null));
      }
    }
  }
);
}