Program: 125904
Project: 125904
Buggy source:
/** 
 * Makes sure if the hive server2 UI displays. If displaying it, then check the selection. Added by Marvin Wang on Mar 25, 2013.
 * @param distributionIndex
 * @param hiveVersionIndex
 */
protected void updateHiveServerAndMakeSelection(IHDistribution hiveDistribution,IHDistributionVersion hiveVersion){
  if (hiveDistribution == null) {
    hiveDistribution=getCurrentHiveDistribution(true);
  }
  IHadoopDistributionService hadoopDistributionService=getHadoopDistributionService();
  if (hiveDistribution == null || hadoopDistributionService == null) {
    return;
  }
  IHDistributionVersion[] hdVersions=hiveDistribution.getHDVersions();
  if (hiveVersion == null && hdVersions.length > 0) {
    hiveVersion=hdVersions[0];
  }
  if (doSupportHive2()) {
    DatabaseConnection conn=getConnection();
    String mode=conn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_MODE);
    HiveModeInfo hiveMode=HiveModeInfo.getByDisplay(mode);
    if (hiveMode == null) {
      String[] hiveModesDisplay=HiveMetadataHelper.getHiveModesDisplay(hiveDistribution.getName(),hiveVersion.getVersion(),false);
      if (hiveModesDisplay.length > 0) {
        hiveMode=HiveModeInfo.getByDisplay(hiveModesDisplay[0]);
      }
    }
    String[] hiveServersDisplay=HiveMetadataHelper.getHiveServersDisplay(hiveDistribution.getName(),hiveVersion.getVersion(),hiveMode.getName(),false);
    hiveServerVersionCombo.getCombo().setItems(hiveServersDisplay);
    String hiveServerKey=conn.getParameters().get(ConnParameterKeys.HIVE_SERVER_VERSION);
    if (hiveServerKey != null) {
      HiveServerVersionInfo serverVersion=HiveServerVersionInfo.getByKey(hiveServerKey);
      if (serverVersion != null) {
        hiveServerVersionCombo.setText(serverVersion.getDisplayName());
      }
 else {
        hiveServerVersionCombo.select(0);
      }
    }
 else {
      hiveServerVersionCombo.select(0);
    }
  }
}

Fixed version (ground truth):
/** 
 * Makes sure if the hive server2 UI displays. If displaying it, then check the selection. Added by Marvin Wang on Mar 25, 2013.
 * @param distributionIndex
 * @param hiveVersionIndex
 */
protected void updateHiveServerAndMakeSelection(IHDistribution hiveDistribution,IHDistributionVersion hiveVersion){
  if (hiveDistribution == null) {
    hiveDistribution=getCurrentHiveDistribution(true);
  }
  IHadoopDistributionService hadoopDistributionService=getHadoopDistributionService();
  if (hiveDistribution == null || hadoopDistributionService == null) {
    return;
  }
  IHDistributionVersion[] hdVersions=hiveDistribution.getHDVersions();
  if (hiveVersion == null && hdVersions.length > 0) {
    hiveVersion=hdVersions[0];
  }
  DatabaseConnection conn=getConnection();
  String[] hiveServersDisplay=HiveMetadataHelper.getHiveServersDisplay(hiveDistribution.getName(),hiveVersion.getVersion(),false);
  hiveServerVersionCombo.getCombo().setItems(hiveServersDisplay);
  String hiveServerKey=conn.getParameters().get(ConnParameterKeys.HIVE_SERVER_VERSION);
  if (hiveServerKey != null) {
    HiveServerVersionInfo serverVersion=HiveServerVersionInfo.getByKey(hiveServerKey);
    if (serverVersion != null) {
      hiveServerVersionCombo.setText(serverVersion.getDisplayName());
    }
 else {
      hiveServerVersionCombo.select(0);
    }
  }
 else {
    hiveServerVersionCombo.select(0);
  }
}