Program: 29072
Project: 29072
Buggy source:
/** 
 * Executes the command with the command parameters passed as Properties where the keys are the paramter names and the values the parameter values
 * @param context information
 */
public void execute(AdminCommandContext context){
  final ActionReport report=context.getActionReport();
  Cluster cluster=domain.getClusterNamed(clusterName);
  if (cluster == null) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    return;
  }
  List instances=cluster.getInstances();
  Config config=domain.getConfigNamed(cluster.getConfigRef());
  JmsService jmsService=config.getExtensionByType(JmsService.class);
  if (jmsService == null) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    return;
  }
  if (!CONVENTIONAL.equalsIgnoreCase(clusterType) && !ENHANCED.equalsIgnoreCase(clusterType)) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    return;
  }
  if (CONVENTIONAL.equalsIgnoreCase(clusterType) && !MASTER_BROKER.equalsIgnoreCase(configStoreType) && !SHARED_DB.equalsIgnoreCase(configStoreType)) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    return;
  }
  if (ENHANCED.equalsIgnoreCase(clusterType) && configStoreType != null) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    return;
  }
  if (CONVENTIONAL.equalsIgnoreCase(clusterType) && !MASTER_BROKER.equalsIgnoreCase(configStoreType) && !FILE.equalsIgnoreCase(messageStoreType)&& !JDBC.equalsIgnoreCase(messageStoreType)) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    return;
  }
  if (ENHANCED.equalsIgnoreCase(clusterType) && messageStoreType != null) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    return;
  }
  String integrationMode=jmsService.getType();
  if (REMOTE.equalsIgnoreCase(integrationMode)) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    return;
  }
  String changeIntegrationMode=null;
  if (EMBEDDED.equalsIgnoreCase(integrationMode) && ENHANCED.equalsIgnoreCase(clusterType)) {
    try {
      ConfigSupport.apply(new SingleConfigCode<JmsService>(){
        public Object run(        JmsService param) throws PropertyVetoException, TransactionFailure {
          param.setType(LOCAL);
          return param;
        }
      }
,jmsService);
      changeIntegrationMode=localStrings.getLocalString("String_Node_Str","String_Node_Str");
    }
 catch (    TransactionFailure tfe) {
      report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str",clusterName) + "String_Node_Str" + tfe.getLocalizedMessage());
      report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      report.setFailureCause(tfe);
      return;
    }
  }
  if (MASTER_BROKER.equalsIgnoreCase(configStoreType) && FILE.equals(messageStoreType)) {
    if (dbvendor != null || dburl != null || dbuser != null) {
      report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
      report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      return;
    }
  }
  if (!MASTER_BROKER.equalsIgnoreCase(configStoreType) || ENHANCED.equalsIgnoreCase(clusterType) || JDBC.equalsIgnoreCase(messageStoreType)) {
    if (dbvendor == null) {
      report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
      report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      return;
    }
 else     if (dburl == null) {
      report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
      report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      return;
    }
 else     if (!isSupportedDbVendor()) {
      report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
      report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      return;
    }
  }
  if (CONVENTIONAL.equalsIgnoreCase(clusterType) && configStoreType == null) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    configStoreType="String_Node_Str";
  }
  if (CONVENTIONAL.equalsIgnoreCase(clusterType) && messageStoreType == null) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    messageStoreType="String_Node_Str";
  }
  config=domain.getConfigNamed(cluster.getConfigRef());
  JmsAvailability jmsAvailability=config.getAvailabilityService().getExtensionByType(JmsAvailability.class);
  JmsService jmsservice=config.getExtensionByType(JmsService.class);
  final Boolean availabilityEnabled=Boolean.valueOf(ENHANCED.equalsIgnoreCase(clusterType));
  try {
    ConfigSupport.apply(new SingleConfigCode<JmsAvailability>(){
      public Object run(      JmsAvailability param) throws PropertyVetoException, TransactionFailure {
        param.setAvailabilityEnabled(availabilityEnabled.toString());
        if (availabilityEnabled.booleanValue()) {
          param.setMessageStoreType(JDBC);
        }
 else {
          param.setConfigStoreType(configStoreType.toLowerCase());
          param.setMessageStoreType(messageStoreType.toLowerCase());
        }
        param.setDbVendor(dbvendor);
        param.setDbUsername(dbuser);
        param.setDbPassword(jmsDbPassword);
        param.setDbUrl(dburl);
        if (props != null) {
          for (          Map.Entry e : props.entrySet()) {
            Property prop=param.createChild(Property.class);
            prop.setName((String)e.getKey());
            prop.setValue((String)e.getValue());
            param.getProperty().add(prop);
          }
        }
        return param;
      }
    }
,jmsAvailability);
  }
 catch (  TransactionFailure tfe) {
    report.setMessage((changeIntegrationMode == null ? "String_Node_Str" : changeIntegrationMode + "String_Node_Str") + localStrings.getLocalString("String_Node_Str","String_Node_Str",clusterName) + "String_Node_Str"+ tfe.getLocalizedMessage());
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    report.setFailureCause(tfe);
  }
  String warning=null;
  if (instances.size() > 0) {
    warning=localStrings.getLocalString("String_Node_Str","String_Node_Str");
  }
  report.setMessage((warning == null ? "String_Node_Str" : warning + "String_Node_Str") + (changeIntegrationMode == null ? "String_Node_Str" : changeIntegrationMode + "String_Node_Str") + localStrings.getLocalString("String_Node_Str","String_Node_Str",clusterName));
  report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}

Fixed version (ground truth):
/** 
 * Executes the command with the command parameters passed as Properties where the keys are the paramter names and the values the parameter values
 * @param context information
 */
public void execute(AdminCommandContext context){
  final ActionReport report=context.getActionReport();
  Cluster cluster=domain.getClusterNamed(clusterName);
  if (cluster == null) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    return;
  }
  List instances=cluster.getInstances();
  Config config=domain.getConfigNamed(cluster.getConfigRef());
  JmsService jmsService=config.getExtensionByType(JmsService.class);
  if (jmsService == null) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    return;
  }
  if (!CONVENTIONAL.equalsIgnoreCase(clusterType) && !ENHANCED.equalsIgnoreCase(clusterType)) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    return;
  }
  if (CONVENTIONAL.equalsIgnoreCase(clusterType) && !MASTER_BROKER.equalsIgnoreCase(configStoreType) && !SHARED_DB.equalsIgnoreCase(configStoreType)) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    return;
  }
  if (ENHANCED.equalsIgnoreCase(clusterType) && configStoreType != null) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    return;
  }
  if (CONVENTIONAL.equalsIgnoreCase(clusterType) && !MASTER_BROKER.equalsIgnoreCase(configStoreType) && !FILE.equalsIgnoreCase(messageStoreType)&& !JDBC.equalsIgnoreCase(messageStoreType)) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    return;
  }
  if (ENHANCED.equalsIgnoreCase(clusterType) && messageStoreType != null) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    return;
  }
  String integrationMode=jmsService.getType();
  if (REMOTE.equalsIgnoreCase(integrationMode)) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    return;
  }
  String changeIntegrationMode=null;
  if (EMBEDDED.equalsIgnoreCase(integrationMode) && ENHANCED.equalsIgnoreCase(clusterType)) {
    try {
      ConfigSupport.apply(new SingleConfigCode<JmsService>(){
        public Object run(        JmsService param) throws PropertyVetoException, TransactionFailure {
          param.setType(LOCAL);
          return param;
        }
      }
,jmsService);
      changeIntegrationMode=localStrings.getLocalString("String_Node_Str","String_Node_Str");
    }
 catch (    TransactionFailure tfe) {
      report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str",clusterName) + "String_Node_Str" + tfe.getLocalizedMessage());
      report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      report.setFailureCause(tfe);
      return;
    }
  }
  if (MASTER_BROKER.equalsIgnoreCase(configStoreType) && FILE.equals(messageStoreType)) {
    if (dbvendor != null || dburl != null || dbuser != null) {
      report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
      report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      return;
    }
  }
  if (!MASTER_BROKER.equalsIgnoreCase(configStoreType) || ENHANCED.equalsIgnoreCase(clusterType) || JDBC.equalsIgnoreCase(messageStoreType)) {
    if (dbvendor == null) {
      report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
      report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      return;
    }
 else     if (dburl == null) {
      report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
      report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      return;
    }
 else     if (!isSupportedDbVendor()) {
      report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
      report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      return;
    }
  }
  if (CONVENTIONAL.equalsIgnoreCase(clusterType) && configStoreType == null) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    configStoreType="String_Node_Str";
  }
  if (CONVENTIONAL.equalsIgnoreCase(clusterType) && messageStoreType == null) {
    report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
    messageStoreType="String_Node_Str";
  }
  config=domain.getConfigNamed(cluster.getConfigRef());
  JmsAvailability jmsAvailability=config.getAvailabilityService().getExtensionByType(JmsAvailability.class);
  final Boolean availabilityEnabled=Boolean.valueOf(ENHANCED.equalsIgnoreCase(clusterType));
  try {
    ConfigSupport.apply(new SingleConfigCode<JmsAvailability>(){
      public Object run(      JmsAvailability param) throws PropertyVetoException, TransactionFailure {
        param.setAvailabilityEnabled(availabilityEnabled.toString());
        if (availabilityEnabled.booleanValue()) {
          param.setMessageStoreType(JDBC);
        }
 else {
          param.setConfigStoreType(configStoreType.toLowerCase());
          param.setMessageStoreType(messageStoreType.toLowerCase());
        }
        param.setDbVendor(dbvendor);
        param.setDbUsername(dbuser);
        param.setDbPassword(jmsDbPassword);
        param.setDbUrl(dburl);
        if (props != null) {
          for (          Map.Entry e : props.entrySet()) {
            Property prop=param.createChild(Property.class);
            prop.setName((String)e.getKey());
            prop.setValue((String)e.getValue());
            param.getProperty().add(prop);
          }
        }
        return param;
      }
    }
,jmsAvailability);
  }
 catch (  TransactionFailure tfe) {
    report.setMessage((changeIntegrationMode == null ? "String_Node_Str" : changeIntegrationMode + "String_Node_Str") + localStrings.getLocalString("String_Node_Str","String_Node_Str",clusterName) + "String_Node_Str"+ tfe.getLocalizedMessage());
    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    report.setFailureCause(tfe);
  }
  String warning=null;
  if (instances.size() > 0) {
    warning=localStrings.getLocalString("String_Node_Str","String_Node_Str");
  }
  report.setMessage((warning == null ? "String_Node_Str" : warning + "String_Node_Str") + (changeIntegrationMode == null ? "String_Node_Str" : changeIntegrationMode + "String_Node_Str") + localStrings.getLocalString("String_Node_Str","String_Node_Str",clusterName));
  report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}