Program: 29076
Project: 29076
Buggy source:
/** 
 * Gets the <code>MQJMXConnector</code> object for a cluster. Since this code is executed in DAS, an admin API is used to resolve hostnames and ports of cluster instances for LOCAL type brokers while creating the connectionURL.
 */
protected MQJMXConnectorInfo _getMQJMXConnectorInfoForCluster(String target,JmsService jmsService,Class mqRAClassName,ServerContext serverContext) throws ConnectorRuntimeException {
  ResourceAdapter raInstance=null;
  MQAddressList list=null;
  try {
    if (jmsService.getType().equalsIgnoreCase(ActiveJmsResourceAdapter.REMOTE)) {
      list=getDefaultAddressList(jmsService);
    }
 else {
      list=new MQAddressList();
      CommandTarget ctarget=this.getTypeForTarget(target);
      if (ctarget == CommandTarget.CLUSTER) {
        Server[] servers=list.getServersInCluster(target);
        if (servers != null && servers.length > 0)         list.setInstanceName(servers[0].getName());
      }
 else       if (ctarget == CommandTarget.CLUSTERED_INSTANCE) {
        list.setInstanceName(target);
      }
      String domainurl=serverContext.getServerConfigURL();
      java.util.Map<String,JmsHost> hostMap=list.getResolvedLocalJmsHostsInMyCluster(true);
      if (hostMap.size() == 0) {
        String msg=localStrings.getLocalString("String_Node_Str","String_Node_Str");
        throw new ConnectorRuntimeException(msg);
      }
      for (      JmsHost host : hostMap.values()) {
        list.addMQUrl(host);
      }
    }
    String connectionUrl=list.toString();
    String adminUserName=null;
    String adminPassword=null;
    JmsHost jmsHost=list.getDefaultJmsHost(jmsService);
    if (jmsHost != null) {
      adminUserName=jmsHost.getAdminUserName();
      adminPassword=JmsRaUtil.getUnAliasedPwd(jmsHost.getAdminPassword());
    }
 else {
      logger.log(Level.FINE,"String_Node_Str");
    }
    raInstance=getConfiguredRA(mqRAClassName,connectionUrl,adminUserName,adminPassword);
  }
 catch (  Exception e) {
    e.printStackTrace();
    ConnectorRuntimeException cre=new ConnectorRuntimeException(e.getMessage());
    cre.initCause(e);
    throw cre;
  }
  try {
    String jmxServiceURL=null, jmxServiceURLList=null;
    Map<String,?> jmxConnectorEnv=null;
    Method[] methds=raInstance.getClass().getMethods();
    for (int i=0; i < methds.length; i++) {
      Method m=methds[i];
      if (m.getName().equalsIgnoreCase("String_Node_Str" + JMXSERVICEURLLIST)) {
        jmxServiceURLList=(String)m.invoke(raInstance,new Object[]{});
        if (jmxServiceURLList != null && !jmxServiceURLList.trim().equals("String_Node_Str")) {
          jmxServiceURL=getFirstJMXServiceURL(jmxServiceURLList);
        }
      }
 else       if (m.getName().equalsIgnoreCase("String_Node_Str" + JMXCONNECTORENV)) {
        jmxConnectorEnv=(Map<String,?>)m.invoke(raInstance,new Object[]{});
      }
    }
    MQJMXConnectorInfo mqInfo=new MQJMXConnectorInfo(target,ActiveJmsResourceAdapter.getBrokerInstanceName(jmsService),jmsService.getType(),jmxServiceURL,jmxConnectorEnv);
    return mqInfo;
  }
 catch (  Exception e) {
    e.printStackTrace();
    ConnectorRuntimeException cre=new ConnectorRuntimeException(e.getMessage());
    cre.initCause(e);
    throw cre;
  }
}

Fixed version (ground truth):
/** 
 * Gets the <code>MQJMXConnector</code> object for a cluster. Since this code is executed in DAS, an admin API is used to resolve hostnames and ports of cluster instances for LOCAL type brokers while creating the connectionURL.
 */
protected MQJMXConnectorInfo _getMQJMXConnectorInfoForCluster(String target,JmsService jmsService,Class mqRAClassName,ServerContext serverContext) throws ConnectorRuntimeException {
  ResourceAdapter raInstance=null;
  MQAddressList list=null;
  try {
    if (jmsService.getType().equalsIgnoreCase(ActiveJmsResourceAdapter.REMOTE)) {
      list=getDefaultAddressList(jmsService);
    }
 else {
      list=new MQAddressList();
      CommandTarget ctarget=this.getTypeForTarget(target);
      if (ctarget == CommandTarget.CLUSTER) {
        Server[] servers=list.getServersInCluster(target);
        if (servers != null && servers.length > 0)         list.setInstanceName(servers[0].getName());
      }
 else       if (ctarget == CommandTarget.CLUSTERED_INSTANCE) {
        list.setInstanceName(target);
      }
      java.util.Map<String,JmsHost> hostMap=list.getResolvedLocalJmsHostsInMyCluster(true);
      if (hostMap.size() == 0) {
        String msg=localStrings.getLocalString("String_Node_Str","String_Node_Str");
        throw new ConnectorRuntimeException(msg);
      }
      for (      JmsHost host : hostMap.values()) {
        list.addMQUrl(host);
      }
    }
    String connectionUrl=list.toString();
    String adminUserName=null;
    String adminPassword=null;
    JmsHost jmsHost=list.getDefaultJmsHost(jmsService);
    if (jmsHost != null) {
      adminUserName=jmsHost.getAdminUserName();
      adminPassword=JmsRaUtil.getUnAliasedPwd(jmsHost.getAdminPassword());
    }
 else {
      logger.log(Level.FINE,"String_Node_Str");
    }
    raInstance=getConfiguredRA(mqRAClassName,connectionUrl,adminUserName,adminPassword);
  }
 catch (  Exception e) {
    e.printStackTrace();
    ConnectorRuntimeException cre=new ConnectorRuntimeException(e.getMessage());
    cre.initCause(e);
    throw cre;
  }
  try {
    String jmxServiceURL=null, jmxServiceURLList=null;
    Map<String,?> jmxConnectorEnv=null;
    Method[] methds=raInstance.getClass().getMethods();
    for (int i=0; i < methds.length; i++) {
      Method m=methds[i];
      if (m.getName().equalsIgnoreCase("String_Node_Str" + JMXSERVICEURLLIST)) {
        jmxServiceURLList=(String)m.invoke(raInstance,new Object[]{});
        if (jmxServiceURLList != null && !jmxServiceURLList.trim().equals("String_Node_Str")) {
          jmxServiceURL=getFirstJMXServiceURL(jmxServiceURLList);
        }
      }
 else       if (m.getName().equalsIgnoreCase("String_Node_Str" + JMXCONNECTORENV)) {
        jmxConnectorEnv=(Map<String,?>)m.invoke(raInstance,new Object[]{});
      }
    }
    MQJMXConnectorInfo mqInfo=new MQJMXConnectorInfo(target,ActiveJmsResourceAdapter.getBrokerInstanceName(jmsService),jmsService.getType(),jmxServiceURL,jmxConnectorEnv);
    return mqInfo;
  }
 catch (  Exception e) {
    e.printStackTrace();
    ConnectorRuntimeException cre=new ConnectorRuntimeException(e.getMessage());
    cre.initCause(e);
    throw cre;
  }
}