Program: 29723
Project: 29723
Buggy source:
private void setAvailabilityProperties() throws ConnectorRuntimeException {
  if (!isClustered())   return;
  try {
    Domain domain=Globals.get(Domain.class);
    ServerContext serverContext=Globals.get(ServerContext.class);
    Server server=domain.getServerNamed(serverContext.getInstanceName());
    JmsService jmsService=server.getConfig().getExtensionByType(JmsService.class);
    if (jmsService.getType().equals(REMOTE)) {
      return;
    }
    AvailabilityService as=server.getConfig().getAvailabilityService();
    if (as == null) {
      logFine("String_Node_Str");
      return;
    }
    boolean useMasterBroker=true;
    if (as != null && as.getExtensionByType(JmsAvailability.class) != null && !MASTERBROKER.equalsIgnoreCase(as.getExtensionByType(JmsAvailability.class).getConfigStoreType()))     useMasterBroker=false;
    boolean isJmsAvailabilityEnabled=this.isJMSAvailabilityOn(as);
    logFine("String_Node_Str");
    if (!useMasterBroker || isJmsAvailabilityEnabled) {
      ConnectorDescriptor cd=getDescriptor();
      String clusterName=getMQClusterName();
      ConnectorConfigProperty envProp1=new ConnectorConfigProperty(CLUSTERID,clusterName,"String_Node_Str","String_Node_Str");
      setProperty(cd,envProp1);
      if (brokerInstanceName == null) {
        brokerInstanceName=getBrokerInstanceName(jmsService);
      }
      ConnectorConfigProperty envProp2=new ConnectorConfigProperty(BROKERID,brokerInstanceName,"String_Node_Str","String_Node_Str");
      setProperty(cd,envProp2);
      if (isJmsAvailabilityEnabled) {
        ConnectorConfigProperty envProp3=new ConnectorConfigProperty(HAREQUIRED,"String_Node_Str","String_Node_Str","String_Node_Str");
        setProperty(cd,envProp3);
        ConnectorConfigProperty envProp4=new ConnectorConfigProperty(BROKERENABLEHA,"String_Node_Str","String_Node_Str","String_Node_Str");
        setProperty(cd,envProp4);
        String nodeHostName=domain.getNodeNamed(server.getNodeRef()).getNodeHost();
        if (nodeHostName != null) {
          ConnectorConfigProperty envProp5=new ConnectorConfigProperty(BROKERBINDADDRESS,nodeHostName,"String_Node_Str","String_Node_Str");
          setProperty(cd,envProp5);
        }
        loadDBProperties(as.getExtensionByType(JmsAvailability.class),ClusterMode.ENHANCED);
      }
 else {
        JmsAvailability jmsAvailability=as.getExtensionByType(JmsAvailability.class);
        if ("String_Node_Str".equals(jmsAvailability.getMessageStoreType()))         loadDBProperties(jmsAvailability,ClusterMode.ENHANCED);
        loadDBProperties(jmsAvailability,ClusterMode.CONVENTIONAL_OF_PEER_BROKERS);
      }
    }
 else {
      if ("String_Node_Str".equals(as.getExtensionByType(JmsAvailability.class).getMessageStoreType()))       loadDBProperties(as.getExtensionByType(JmsAvailability.class),ClusterMode.CONVENTIONAL_WITH_MASTER_BROKER);
    }
  }
 catch (  Exception e) {
    ConnectorRuntimeException crex=new ConnectorRuntimeException(e.getMessage());
    throw (ConnectorRuntimeException)crex.initCause(e);
  }
}

Fixed version (ground truth):
private void setAvailabilityProperties() throws ConnectorRuntimeException {
  if (!isClustered())   return;
  try {
    Domain domain=Globals.get(Domain.class);
    ServerContext serverContext=Globals.get(ServerContext.class);
    Server server=domain.getServerNamed(serverContext.getInstanceName());
    JmsService jmsService=server.getConfig().getExtensionByType(JmsService.class);
    if (jmsService.getType().equals(REMOTE)) {
      return;
    }
    AvailabilityService as=server.getConfig().getAvailabilityService();
    if (as == null) {
      logFine("String_Node_Str");
      return;
    }
    boolean useMasterBroker=true;
    if (as.getExtensionByType(JmsAvailability.class) != null && !MASTERBROKER.equalsIgnoreCase(as.getExtensionByType(JmsAvailability.class).getConfigStoreType()))     useMasterBroker=false;
    boolean isJmsAvailabilityEnabled=this.isJMSAvailabilityOn(as);
    logFine("String_Node_Str");
    if (!useMasterBroker || isJmsAvailabilityEnabled) {
      ConnectorDescriptor cd=getDescriptor();
      String clusterName=getMQClusterName();
      ConnectorConfigProperty envProp1=new ConnectorConfigProperty(CLUSTERID,clusterName,"String_Node_Str","String_Node_Str");
      setProperty(cd,envProp1);
      if (brokerInstanceName == null) {
        brokerInstanceName=getBrokerInstanceName(jmsService);
      }
      ConnectorConfigProperty envProp2=new ConnectorConfigProperty(BROKERID,brokerInstanceName,"String_Node_Str","String_Node_Str");
      setProperty(cd,envProp2);
      if (isJmsAvailabilityEnabled) {
        ConnectorConfigProperty envProp3=new ConnectorConfigProperty(HAREQUIRED,"String_Node_Str","String_Node_Str","String_Node_Str");
        setProperty(cd,envProp3);
        ConnectorConfigProperty envProp4=new ConnectorConfigProperty(BROKERENABLEHA,"String_Node_Str","String_Node_Str","String_Node_Str");
        setProperty(cd,envProp4);
        String nodeHostName=domain.getNodeNamed(server.getNodeRef()).getNodeHost();
        if (nodeHostName != null) {
          ConnectorConfigProperty envProp5=new ConnectorConfigProperty(BROKERBINDADDRESS,nodeHostName,"String_Node_Str","String_Node_Str");
          setProperty(cd,envProp5);
        }
        loadDBProperties(as.getExtensionByType(JmsAvailability.class),ClusterMode.ENHANCED);
      }
 else {
        JmsAvailability jmsAvailability=as.getExtensionByType(JmsAvailability.class);
        if ("String_Node_Str".equals(jmsAvailability.getMessageStoreType()))         loadDBProperties(jmsAvailability,ClusterMode.ENHANCED);
        loadDBProperties(jmsAvailability,ClusterMode.CONVENTIONAL_OF_PEER_BROKERS);
      }
    }
 else {
      if ("String_Node_Str".equals(as.getExtensionByType(JmsAvailability.class).getMessageStoreType()))       loadDBProperties(as.getExtensionByType(JmsAvailability.class),ClusterMode.CONVENTIONAL_WITH_MASTER_BROKER);
    }
  }
 catch (  Exception e) {
    ConnectorRuntimeException crex=new ConnectorRuntimeException(e.getMessage());
    throw (ConnectorRuntimeException)crex.initCause(e);
  }
}