Program: 125620
Project: 125620
Buggy source:
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);
    }
  }
}

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);
    }
    String maprticket_Cluster=getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_MAPRTICKET_CLUSTER);
    String defaultMaprticket_Cluster=hiveVersion.getDefaultConfig(distribution,EHadoopProperties.MAPRTICKET_CLUSTER.getName());
    if (StringUtils.isNotEmpty(maprticket_Cluster)) {
      maprTClusterForHiveTxt.setText(maprticket_Cluster);
    }
 else     if (defaultMaprticket_Cluster != null) {
      maprTClusterForHiveTxt.setText(defaultMaprticket_Cluster);
    }
    String maprticket_Duration=getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_MAPRTICKET_DURATION);
    String defaultMaprticket_Duration=hiveVersion.getDefaultConfig(distribution,EHadoopProperties.MAPRTICKET_DURATION.getName());
    if (StringUtils.isNotEmpty(maprticket_Duration)) {
      maprTDurationForHiveTxt.setText(maprticket_Duration);
    }
 else     if (defaultMaprticket_Duration != null) {
      maprTDurationForHiveTxt.setText(defaultMaprticket_Duration);
    }
  }
}