Program: 126086
Project: 126086
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;
    }
    String[] versionPrefix=new String[]{distribution};
    if (HiveConnVersionInfo.AMAZON_EMR.getKey().equals(distribution)) {
      versionPrefix=(String[])ArrayUtils.add(versionPrefix,version);
    }
    boolean useYarn=Boolean.valueOf(getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_USE_YARN));
    String defaultNN=HadoopDefaultConfsManager.getInstance().getDefaultConfValue((String[])ArrayUtils.add(versionPrefix,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=HadoopDefaultConfsManager.getInstance().getDefaultConfValue((String[])ArrayUtils.add(versionPrefix,EHadoopProperties.RESOURCE_MANAGER.getName()));
    }
 else {
      defaultJTORRM=HadoopDefaultConfsManager.getInstance().getDefaultConfValue((String[])ArrayUtils.add(versionPrefix,EHadoopProperties.JOBTRACKER.getName()));
    }
    if (StringUtils.isNotEmpty(jobTrackerURLStr)) {
      jobTrackerURLTxt.setText(jobTrackerURLStr);
    }
 else     if (defaultJTORRM != null) {
      jobTrackerURLTxt.setText(defaultJTORRM);
    }
    String defaultPrincipal=HadoopDefaultConfsManager.getInstance().getDefaultConfValue(distribution,EHadoopCategory.HIVE.getName(),EHadoopProperties.HIVE_PRINCIPAL.getName());
    if (StringUtils.isNotEmpty(hiveKerberosPrin)) {
      hivePrincipalTxt.setText(hiveKerberosPrin);
    }
 else     if (defaultPrincipal != null) {
      hivePrincipalTxt.setText(defaultPrincipal);
    }
    String defaultDatabase=HadoopDefaultConfsManager.getInstance().getDefaultConfValue(distribution,EHadoopCategory.HIVE.getName(),EHadoopProperties.DATABASE.getName());
    if (StringUtils.isNotEmpty(getConnection().getSID())) {
      sidOrDatabaseText.setText(getConnection().getSID());
    }
 else     if (defaultDatabase != null) {
      sidOrDatabaseText.setText(defaultDatabase);
    }
  }
}

Fixed version (ground truth):
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;
    }
    String[] versionPrefix=new String[]{distribution};
    if (HiveConnVersionInfo.AMAZON_EMR.getKey().equals(distribution)) {
      versionPrefix=(String[])ArrayUtils.add(versionPrefix,version);
    }
    boolean useYarn=Boolean.valueOf(getConnection().getParameters().get(ConnParameterKeys.CONN_PARA_KEY_USE_YARN));
    String defaultNN=HadoopDefaultConfsManager.getInstance().getDefaultConfValue((String[])ArrayUtils.add(versionPrefix,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=HadoopDefaultConfsManager.getInstance().getDefaultConfValue((String[])ArrayUtils.add(versionPrefix,EHadoopProperties.RESOURCE_MANAGER.getName()));
    }
 else {
      defaultJTORRM=HadoopDefaultConfsManager.getInstance().getDefaultConfValue((String[])ArrayUtils.add(versionPrefix,EHadoopProperties.JOBTRACKER.getName()));
    }
    if (StringUtils.isNotEmpty(jobTrackerURLStr)) {
      jobTrackerURLTxt.setText(jobTrackerURLStr);
    }
 else     if (defaultJTORRM != null) {
      jobTrackerURLTxt.setText(defaultJTORRM);
    }
    String defaultPrincipal=HadoopDefaultConfsManager.getInstance().getDefaultConfValue(distribution,EHadoopCategory.HIVE.getName(),EHadoopProperties.HIVE_PRINCIPAL.getName());
    if (StringUtils.isNotEmpty(hiveKerberosPrin)) {
      hivePrincipalTxt.setText(hiveKerberosPrin);
    }
 else     if (defaultPrincipal != null) {
      hivePrincipalTxt.setText(defaultPrincipal);
    }
    String defaultDatabase=HadoopDefaultConfsManager.getInstance().getDefaultConfValue(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);
    }
  }
}