Program: 125641
Project: 125641
Buggy source:
private void fillDefaultsWhenHiveVersionChanged(){
  if (isCreation) {
    String distribution=getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_DISTRIBUTION);
    String version=getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_VERSION);
    if (distribution == null) {
      return;
    }
    IHadoopDistributionService hadoopDistributionService=getHadoopDistributionService();
    if (hadoopDistributionService == null) {
      return;
    }
    IHDistribution hiveDistribution=hadoopDistributionService.getHiveDistributionManager().getDistribution(distribution,false);
    if (hiveDistribution == null) {
      return;
    }
    IHDistributionVersion hiveVersion=hiveDistribution.getHDVersion(version,false);
    if (hiveVersion == null) {
      return;
    }
    boolean useYarn=Boolean.valueOf(getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_USE_YARN));
    String defaultNN=hiveVersion.getDefaultConfig(distribution,EHadoopProperties.NAMENODE_URI.getName());
    String nameNodeURLstr=getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_URL);
    String jobTrackerURLStr=getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_URL);
    String hiveKerberosPrin=getConnection().getParameters().get(ConnParameterKeys.HIVE_AUTHENTICATION_HIVEPRINCIPLA);
    if (StringUtils.isNotEmpty(nameNodeURLstr)) {
      nameNodeURLTxt.setText(nameNodeURLstr);
    }
 else     if (defaultNN != null) {
      nameNodeURLTxt.setText(defaultNN);
    }
    String defaultJTORRM=null;
    if (useYarn) {
      defaultJTORRM=hiveVersion.getDefaultConfig(distribution,EHadoopProperties.RESOURCE_MANAGER.getName());
    }
 else {
      defaultJTORRM=hiveVersion.getDefaultConfig(distribution,EHadoopProperties.JOBTRACKER.getName());
    }
    if (StringUtils.isNotEmpty(jobTrackerURLStr)) {
      jobTrackerURLTxt.setText(jobTrackerURLStr);
    }
 else     if (defaultJTORRM != null) {
      jobTrackerURLTxt.setText(defaultJTORRM);
    }
    String defaultPrincipal=hiveVersion.getDefaultConfig(distribution,EHadoopCategory.HIVE.getName(),EHadoopProperties.HIVE_PRINCIPAL.getName());
    if (StringUtils.isNotEmpty(hiveKerberosPrin)) {
      hivePrincipalTxt.setText(hiveKerberosPrin);
    }
 else     if (defaultPrincipal != null) {
      hivePrincipalTxt.setText(defaultPrincipal);
    }
    String defaultDatabase=hiveVersion.getDefaultConfig(distribution,EHadoopCategory.HIVE.getName(),EHadoopProperties.DATABASE.getName());
    if (StringUtils.isNotEmpty(getConnection().getSID())) {
      sidOrDatabaseText.setText(getConnection().getSID());
    }
 else     if (defaultDatabase != null) {
      sidOrDatabaseText.setText(defaultDatabase);
      getConnection().setSID(defaultDatabase);
    }
  }
}

Fixed version (ground truth):
private void fillDefaultsWhenHiveVersionChanged(){
  if (isCreation && isNeedFillDefaults()) {
    String distribution=getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_DISTRIBUTION);
    String version=getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_VERSION);
    if (distribution == null) {
      return;
    }
    IHadoopDistributionService hadoopDistributionService=getHadoopDistributionService();
    if (hadoopDistributionService == null) {
      return;
    }
    IHDistribution hiveDistribution=hadoopDistributionService.getHiveDistributionManager().getDistribution(distribution,false);
    if (hiveDistribution == null) {
      return;
    }
    IHDistributionVersion hiveVersion=hiveDistribution.getHDVersion(version,false);
    if (hiveVersion == null) {
      return;
    }
    boolean useYarn=Boolean.valueOf(getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_USE_YARN));
    String defaultNN=hiveVersion.getDefaultConfig(distribution,EHadoopProperties.NAMENODE_URI.getName());
    String nameNodeURLstr=getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_URL);
    String jobTrackerURLStr=getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_URL);
    String hiveKerberosPrin=getConnection().getParameters().get(ConnParameterKeys.HIVE_AUTHENTICATION_HIVEPRINCIPLA);
    if (StringUtils.isNotEmpty(nameNodeURLstr)) {
      nameNodeURLTxt.setText(nameNodeURLstr);
    }
 else     if (defaultNN != null) {
      nameNodeURLTxt.setText(defaultNN);
    }
    String defaultJTORRM=null;
    if (useYarn) {
      defaultJTORRM=hiveVersion.getDefaultConfig(distribution,EHadoopProperties.RESOURCE_MANAGER.getName());
    }
 else {
      defaultJTORRM=hiveVersion.getDefaultConfig(distribution,EHadoopProperties.JOBTRACKER.getName());
    }
    if (StringUtils.isNotEmpty(jobTrackerURLStr)) {
      jobTrackerURLTxt.setText(jobTrackerURLStr);
    }
 else     if (defaultJTORRM != null) {
      jobTrackerURLTxt.setText(defaultJTORRM);
    }
    String defaultPrincipal=hiveVersion.getDefaultConfig(distribution,EHadoopCategory.HIVE.getName(),EHadoopProperties.HIVE_PRINCIPAL.getName());
    if (StringUtils.isNotEmpty(hiveKerberosPrin)) {
      hivePrincipalTxt.setText(hiveKerberosPrin);
    }
 else     if (defaultPrincipal != null) {
      hivePrincipalTxt.setText(defaultPrincipal);
    }
    String defaultDatabase=hiveVersion.getDefaultConfig(distribution,EHadoopCategory.HIVE.getName(),EHadoopProperties.DATABASE.getName());
    if (StringUtils.isNotEmpty(getConnection().getSID())) {
      sidOrDatabaseText.setText(getConnection().getSID());
    }
 else     if (defaultDatabase != null) {
      sidOrDatabaseText.setText(defaultDatabase);
      getConnection().setSID(defaultDatabase);
    }
  }
}