Program: 125517
Project: 125517
Buggy source:
@Override protected void addFieldsListeners(){
  final LDAPSchemaConnection connection=(LDAPSchemaConnection)connectionItem.getConnection();
  bindPrincipalCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      if (!isContextMode()) {
        checkFieldsValue();
        connection.setBindPrincipal(bindPrincipalCombo.getText().trim());
      }
    }
  }
);
  bindPasswordText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent event){
      if (!isContextMode()) {
        checkFieldsValue();
        password=bindPasswordText.getText().trim();
        if (saveBindPasswordButton.getSelection() == true) {
          connection.setSavePassword(true);
          connection.setBindPassword(connection.getValue(password,true));
        }
      }
    }
  }
);
  authenticationMethodCombo.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent event){
      if (authenticationMethodCombo.getText().equals(EAuthenticationMethod.ANONYMOUS.getName())) {
        refreshAuthParamGroup(connection,false);
        connection.setUseAuthen(false);
        String selectedDN=connection.getSelectedDN();
        if (selectedDN == null || selectedDN.length() == 0) {
          updateStatus(IStatus.ERROR,alertForFetchBaseDNs);
        }
      }
 else {
        refreshAuthParamGroup(connection,true);
        connection.setUseAuthen(true);
      }
    }
  }
);
  checkPrincipalPasswordAuthButton.addSelectionListener(new SelectionAdapter(){
    boolean isOK=false;
    @Override public void widgetSelected(    SelectionEvent event){
      try {
        IRunnableWithProgress op=new IRunnableWithProgress(){
          @Override public void run(          IProgressMonitor monitor){
            connection.setUseAuthen(true);
            isOK=LDAPConnectionUtils.checkParam(getOriginalValueConnection(),false);
          }
        }
;
        new ProgressMonitorDialog(Display.getDefault().getActiveShell()).run(true,false,op);
      }
 catch (      InvocationTargetException e) {
        updateStatus(IStatus.ERROR,null);
        MessageBoxExceptionHandler.process(e);
      }
catch (      InterruptedException e) {
        updateStatus(IStatus.ERROR,null);
        MessageBoxExceptionHandler.process(e);
      }
      if (!isContextMode()) {
        fetchBaseDnsButton.setEnabled(isOK);
      }
      connection.setUseAuthen(true);
      if (isOK) {
        if (!isContextMode()) {
          saveDialogSettings();
        }
        MessageDialog.openInformation(Display.getDefault().getActiveShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
        updateStatus(IStatus.ERROR,alertForFetchBaseDNs);
      }
 else {
        MessageDialog.openError(Display.getDefault().getActiveShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
        updateStatus(IStatus.ERROR,null);
      }
    }
  }
);
  autoFetchBaseDnsButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (!isContextMode()) {
        boolean isSelection=autoFetchBaseDnsButton.getSelection();
        baseDNCombo.setEnabled(!isSelection);
        connection.setGetBaseDNsFromRoot(isSelection);
      }
    }
  }
);
  fetchBaseDnsButton.addSelectionListener(new SelectionAdapter(){
    boolean isOK=false;
    List<String> dnList=null;
    @Override public void widgetSelected(    SelectionEvent event){
      try {
        IRunnableWithProgress op=new IRunnableWithProgress(){
          @Override public void run(          IProgressMonitor monitor){
            dnList=fetchBaseDNsList();
          }
        }
;
        new ProgressMonitorDialog(Display.getDefault().getActiveShell()).run(true,false,op);
      }
 catch (      InvocationTargetException e) {
        updateStatus(IStatus.ERROR,null);
        MessageBoxExceptionHandler.process(e);
      }
catch (      InterruptedException e) {
        updateStatus(IStatus.ERROR,null);
        MessageBoxExceptionHandler.process(e);
      }
      if (dnList != null && dnList.size() > 0) {
        isOK=true;
        int length=dnList.size();
        String[] baseDNarray=dnList.toArray(new String[length]);
        baseDNCombo.setItems((baseDNarray));
        baseDNCombo.select(0);
        connection.getBaseDNs().addAll(Arrays.asList(baseDNarray));
        connection.setSelectedDN(baseDNarray[0]);
      }
 else {
        isOK=false;
      }
      if (isOK) {
        if (!isContextMode()) {
          saveDialogSettings();
        }
        MessageDialog.openInformation(Display.getDefault().getActiveShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
        updateStatus(IStatus.OK,null);
      }
 else {
        MessageDialog.openError(Display.getDefault().getActiveShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
        updateStatus(IStatus.ERROR,null);
      }
    }
  }
);
  baseDNCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      if (baseDNCombo.getText() != null) {
        connection.setSelectedDN(baseDNCombo.getText());
      }
    }
  }
);
  findingButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (findingButton.getSelection()) {
        connection.setAliases(EAliasesDereference.FINDING.getRepositoryName());
      }
    }
  }
);
  searchButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (searchButton.getSelection()) {
        connection.setAliases(EAliasesDereference.SEARCHING.getRepositoryName());
      }
    }
  }
);
  alwaysButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (alwaysButton.getSelection()) {
        connection.setAliases(EAliasesDereference.ALWAYS.getRepositoryName());
      }
    }
  }
);
  neverButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (neverButton.getSelection()) {
        connection.setAliases(EAliasesDereference.NEVER.getRepositoryName());
      }
    }
  }
);
  ignoreButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (ignoreButton.getSelection()) {
        connection.setReferrals(EReferrals.IGNORE.getRepositoryName());
      }
    }
  }
);
  followButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (followButton.getSelection()) {
        connection.setReferrals(EReferrals.FOLLOW.getRepositoryName());
      }
    }
  }
);
  countLimitText.addVerifyListener(new VerifyListener(){
    @Override public void verifyText(    VerifyEvent e){
      if (!isContextMode()) {
        if (!e.text.matches("String_Node_Str")) {
          e.doit=false;
        }
      }
    }
  }
);
  countLimitText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      if (!isContextMode()) {
        String countLimit=countLimitText.getText();
        if (countLimit != null && countLimit.length() > 0) {
          connection.setCountLimit(countLimit);
        }
      }
    }
  }
);
  timeLimitText.addVerifyListener(new VerifyListener(){
    @Override public void verifyText(    VerifyEvent e){
      if (!isContextMode()) {
        if (!e.text.matches("String_Node_Str")) {
          e.doit=false;
        }
      }
    }
  }
);
  timeLimitText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      if (!isContextMode()) {
        String timeLimit=timeLimitText.getText();
        if (timeLimit != null && timeLimit.length() > 0) {
          connection.setTimeOutLimit(timeLimit);
        }
      }
    }
  }
);
}

Fixed version (ground truth):
@Override protected void addFieldsListeners(){
  final LDAPSchemaConnection connection=(LDAPSchemaConnection)connectionItem.getConnection();
  bindPrincipalCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      if (!isContextMode()) {
        checkFieldsValue();
        connection.setBindPrincipal(bindPrincipalCombo.getText().trim());
      }
    }
  }
);
  bindPasswordText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent event){
      if (!isContextMode()) {
        checkFieldsValue();
        password=bindPasswordText.getText().trim();
        if (saveBindPasswordButton.getSelection() == true) {
          connection.setSavePassword(true);
          connection.setBindPassword(connection.getValue(password,true));
        }
      }
    }
  }
);
  authenticationMethodCombo.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent event){
      if (authenticationMethodCombo.getText().equals(EAuthenticationMethod.ANONYMOUS.getName())) {
        refreshAuthParamGroup(connection,false);
        connection.setUseAuthen(false);
        String selectedDN=connection.getSelectedDN();
        if (selectedDN == null || selectedDN.length() == 0) {
          updateStatus(IStatus.ERROR,alertForFetchBaseDNs);
        }
      }
 else {
        refreshAuthParamGroup(connection,true);
        connection.setUseAuthen(true);
      }
    }
  }
);
  checkPrincipalPasswordAuthButton.addSelectionListener(new SelectionAdapter(){
    boolean isOK=false;
    @Override public void widgetSelected(    SelectionEvent event){
      try {
        IRunnableWithProgress op=new IRunnableWithProgress(){
          @Override public void run(          IProgressMonitor monitor){
            connection.setUseAuthen(true);
            isOK=LDAPConnectionUtils.checkParam(getOriginalValueConnection(),false);
          }
        }
;
        new ProgressMonitorDialog(Display.getDefault().getActiveShell()).run(true,false,op);
      }
 catch (      InvocationTargetException e) {
        updateStatus(IStatus.ERROR,null);
        MessageBoxExceptionHandler.process(e);
      }
catch (      InterruptedException e) {
        updateStatus(IStatus.ERROR,null);
        MessageBoxExceptionHandler.process(e);
      }
      if (!isContextMode()) {
        fetchBaseDnsButton.setEnabled(isOK);
      }
      connection.setUseAuthen(true);
      if (isOK) {
        if (!isContextMode()) {
          saveDialogSettings();
        }
        MessageDialog.openInformation(Display.getDefault().getActiveShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
        String baseDN=baseDNCombo.getText();
        if (baseDN == null || baseDN.length() <= 0) {
          updateStatus(IStatus.ERROR,alertForFetchBaseDNs);
        }
      }
 else {
        MessageDialog.openError(Display.getDefault().getActiveShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
        updateStatus(IStatus.ERROR,null);
      }
    }
  }
);
  autoFetchBaseDnsButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (!isContextMode()) {
        boolean isSelection=autoFetchBaseDnsButton.getSelection();
        baseDNCombo.setEnabled(!isSelection);
        connection.setGetBaseDNsFromRoot(isSelection);
      }
    }
  }
);
  fetchBaseDnsButton.addSelectionListener(new SelectionAdapter(){
    boolean isOK=false;
    List<String> dnList=null;
    @Override public void widgetSelected(    SelectionEvent event){
      try {
        IRunnableWithProgress op=new IRunnableWithProgress(){
          @Override public void run(          IProgressMonitor monitor){
            dnList=fetchBaseDNsList();
          }
        }
;
        new ProgressMonitorDialog(Display.getDefault().getActiveShell()).run(true,false,op);
      }
 catch (      InvocationTargetException e) {
        updateStatus(IStatus.ERROR,null);
        MessageBoxExceptionHandler.process(e);
      }
catch (      InterruptedException e) {
        updateStatus(IStatus.ERROR,null);
        MessageBoxExceptionHandler.process(e);
      }
      if (dnList != null && dnList.size() > 0) {
        isOK=true;
        int length=dnList.size();
        String[] baseDNarray=dnList.toArray(new String[length]);
        baseDNCombo.setItems((baseDNarray));
        baseDNCombo.select(0);
        connection.getBaseDNs().addAll(Arrays.asList(baseDNarray));
        connection.setSelectedDN(baseDNarray[0]);
      }
 else {
        isOK=false;
      }
      if (isOK) {
        if (!isContextMode()) {
          saveDialogSettings();
        }
        MessageDialog.openInformation(Display.getDefault().getActiveShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
        updateStatus(IStatus.OK,null);
      }
 else {
        MessageDialog.openError(Display.getDefault().getActiveShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
        updateStatus(IStatus.ERROR,null);
      }
    }
  }
);
  baseDNCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      if (baseDNCombo.getText() != null) {
        connection.setSelectedDN(baseDNCombo.getText());
      }
    }
  }
);
  findingButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (findingButton.getSelection()) {
        connection.setAliases(EAliasesDereference.FINDING.getRepositoryName());
      }
    }
  }
);
  searchButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (searchButton.getSelection()) {
        connection.setAliases(EAliasesDereference.SEARCHING.getRepositoryName());
      }
    }
  }
);
  alwaysButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (alwaysButton.getSelection()) {
        connection.setAliases(EAliasesDereference.ALWAYS.getRepositoryName());
      }
    }
  }
);
  neverButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (neverButton.getSelection()) {
        connection.setAliases(EAliasesDereference.NEVER.getRepositoryName());
      }
    }
  }
);
  ignoreButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (ignoreButton.getSelection()) {
        connection.setReferrals(EReferrals.IGNORE.getRepositoryName());
      }
    }
  }
);
  followButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (followButton.getSelection()) {
        connection.setReferrals(EReferrals.FOLLOW.getRepositoryName());
      }
    }
  }
);
  countLimitText.addVerifyListener(new VerifyListener(){
    @Override public void verifyText(    VerifyEvent e){
      if (!isContextMode()) {
        if (!e.text.matches("String_Node_Str")) {
          e.doit=false;
        }
      }
    }
  }
);
  countLimitText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      if (!isContextMode()) {
        String countLimit=countLimitText.getText();
        if (countLimit != null && countLimit.length() > 0) {
          connection.setCountLimit(countLimit);
        }
      }
    }
  }
);
  timeLimitText.addVerifyListener(new VerifyListener(){
    @Override public void verifyText(    VerifyEvent e){
      if (!isContextMode()) {
        if (!e.text.matches("String_Node_Str")) {
          e.doit=false;
        }
      }
    }
  }
);
  timeLimitText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      if (!isContextMode()) {
        String timeLimit=timeLimitText.getText();
        if (timeLimit != null && timeLimit.length() > 0) {
          connection.setTimeOutLimit(timeLimit);
        }
      }
    }
  }
);
}