Program: 125516
Project: 125516
Buggy source:
private void addImpalaSettingFieldsListeners(){
  impalaDistributionCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (isContextMode()) {
        return;
      }
      String originalDistributionName=getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_IMPALA_DISTRIBUTION);
      String newDistributionDisplayName=impalaDistributionCombo.getText();
      IHadoopDistributionService hadoopService=getHadoopDistributionService();
      if (hadoopService == null) {
        return;
      }
      IHDistribution newDistribution=hadoopService.getImpalaDistributionManager().getDistribution(newDistributionDisplayName,true);
      if (newDistribution == null) {
        return;
      }
      if (!newDistribution.getName().equals(originalDistributionName)) {
        getConnection().getParameters().put(ConnParameterKeys.CONN_PARA_KEY_IMPALA_DISTRIBUTION,newDistribution.getName());
        updateImpalaVersionPart(newDistribution);
        fillDefaultsWhenImpalaVersionChanged();
        checkFieldsValue();
      }
    }
  }
);
  impalaVersionCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (isContextMode()) {
        return;
      }
      String originalVersionName=getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_IMPALA_VERSION);
      String newVersionDisplayName=StringUtils.trimToNull(impalaVersionCombo.getText());
      IHadoopDistributionService hadoopService=getHadoopDistributionService();
      if (hadoopService == null) {
        return;
      }
      IHDistribution impalaDistribution=hadoopService.getImpalaDistributionManager().getDistribution(impalaDistributionCombo.getText(),true);
      if (impalaDistribution == null) {
        return;
      }
      IHDistributionVersion impalaVersion=impalaDistribution.getHDVersion(newVersionDisplayName,true);
      if (impalaVersion != null && !impalaVersion.getVersion().equals(originalVersionName)) {
        getConnection().getParameters().put(ConnParameterKeys.CONN_PARA_KEY_IMPALA_VERSION,impalaVersion.getVersion());
        fillDefaultsWhenImpalaVersionChanged();
        checkFieldsValue();
      }
    }
  }
);
  impalaCustomButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      handleHadoopCustomVersion(ECustomVersionType.ALL);
    }
  }
);
}

Fixed version (ground truth):
private void addImpalaSettingFieldsListeners(){
  impalaDistributionCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (isContextMode()) {
        return;
      }
      String originalDistributionName=getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_IMPALA_DISTRIBUTION);
      String newDistributionDisplayName=impalaDistributionCombo.getText();
      IHadoopDistributionService hadoopService=getHadoopDistributionService();
      if (hadoopService == null) {
        return;
      }
      IHDistribution newDistribution=hadoopService.getImpalaDistributionManager().getDistribution(newDistributionDisplayName,true);
      if (newDistribution == null) {
        return;
      }
      if (!newDistribution.getName().equals(originalDistributionName)) {
        getConnection().getParameters().put(ConnParameterKeys.CONN_PARA_KEY_IMPALA_DISTRIBUTION,newDistribution.getName());
        updateImpalaVersionPart(newDistribution);
        fillDefaultsWhenImpalaVersionChanged();
        checkFieldsValue();
      }
    }
  }
);
  impalaVersionCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (isContextMode()) {
        return;
      }
      String originalVersionName=getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_IMPALA_VERSION);
      String newVersionDisplayName=StringUtils.trimToNull(impalaVersionCombo.getText());
      IHadoopDistributionService hadoopService=getHadoopDistributionService();
      if (hadoopService == null) {
        return;
      }
      IHDistribution impalaDistribution=hadoopService.getImpalaDistributionManager().getDistribution(impalaDistributionCombo.getText(),true);
      if (impalaDistribution == null) {
        return;
      }
      IHDistributionVersion impalaVersion=impalaDistribution.getHDVersion(newVersionDisplayName,true);
      if (impalaVersion != null && !impalaVersion.getVersion().equals(originalVersionName)) {
        getConnection().getParameters().put(ConnParameterKeys.CONN_PARA_KEY_IMPALA_VERSION,impalaVersion.getVersion());
        fillDefaultsWhenImpalaVersionChanged();
        checkFieldsValue();
      }
    }
  }
);
  impalaCustomButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      handleHadoopCustomVersion(ECustomVersionType.HIVE);
    }
  }
);
}