Program: 49191
Project: 49191
Buggy source:
public void contextInitialized(Injector injector){
  org.candlepin.common.config.Configuration candlepinConfig=injector.getInstance(org.candlepin.common.config.Configuration.class);
  if (activeMQServer == null) {
    Configuration config=new ConfigurationImpl();
    HashSet<TransportConfiguration> transports=new HashSet<>();
    transports.add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
    config.setAcceptorConfigurations(transports);
    config.setClusterUser(null);
    config.setClusterPassword(null);
    config.setSecurityEnabled(false);
    config.setJournalType(JournalType.NIO);
    config.setCreateBindingsDir(true);
    config.setCreateJournalDir(true);
    String baseDir=candlepinConfig.getString(ConfigProperties.ACTIVEMQ_BASE_DIR);
    config.setBindingsDirectory(new File(baseDir,"String_Node_Str").toString());
    config.setJournalDirectory(new File(baseDir,"String_Node_Str").toString());
    config.setLargeMessagesDirectory(new File(baseDir,"String_Node_Str").toString());
    config.setPagingDirectory(new File(baseDir,"String_Node_Str").toString());
    Map<String,AddressSettings> settings=new HashMap<>();
    AddressSettings pagingConfig=new AddressSettings();
    String addressPolicyString=candlepinConfig.getString(ConfigProperties.ACTIVEMQ_ADDRESS_FULL_POLICY);
    long maxQueueSizeInMb=candlepinConfig.getInt(ConfigProperties.ACTIVEMQ_MAX_QUEUE_SIZE);
    long maxPageSizeInMb=candlepinConfig.getInt(ConfigProperties.ACTIVEMQ_MAX_PAGE_SIZE);
    AddressFullMessagePolicy addressPolicy=null;
    if (addressPolicyString.equals("String_Node_Str")) {
      addressPolicy=AddressFullMessagePolicy.PAGE;
    }
 else     if (addressPolicyString.equals("String_Node_Str")) {
      addressPolicy=AddressFullMessagePolicy.BLOCK;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + addressPolicyString + "String_Node_Str");
    }
    pagingConfig.setMaxSizeBytes(maxQueueSizeInMb * FileUtils.ONE_MB);
    if (addressPolicy == AddressFullMessagePolicy.PAGE) {
      pagingConfig.setPageSizeBytes(maxPageSizeInMb * FileUtils.ONE_MB);
    }
    pagingConfig.setAddressFullMessagePolicy(addressPolicy);
    settings.put("String_Node_Str",pagingConfig);
    config.setAddressesSettings(settings);
    int maxScheduledThreads=candlepinConfig.getInt(ConfigProperties.ACTIVEMQ_MAX_SCHEDULED_THREADS);
    int maxThreads=candlepinConfig.getInt(ConfigProperties.ACTIVEMQ_MAX_THREADS);
    if (maxThreads != -1) {
      config.setThreadPoolMaxSize(maxThreads);
    }
    if (maxScheduledThreads != -1) {
      config.setScheduledThreadPoolMaxSize(maxScheduledThreads);
    }
    int largeMsgSize=candlepinConfig.getInt(ConfigProperties.ACTIVEMQ_LARGE_MSG_SIZE);
    config.setJournalBufferSize_AIO(largeMsgSize);
    config.setJournalBufferSize_NIO(largeMsgSize);
    activeMQServer=new EmbeddedActiveMQ();
    activeMQServer.setConfiguration(config);
  }
  try {
    activeMQServer.start();
    log.info("String_Node_Str");
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
    throw new RuntimeException(e);
  }
  setupAmqp(injector,candlepinConfig);
  cleanupOldQueues();
  List<String> listeners=getActiveMQListeners(candlepinConfig);
  eventSource=injector.getInstance(EventSource.class);
  for (int i=0; i < listeners.size(); i++) {
    try {
      Class<?> clazz=this.getClass().getClassLoader().loadClass(listeners.get(i));
      eventSource.registerListener((EventListener)injector.getInstance(clazz));
    }
 catch (    Exception e) {
      log.warn("String_Node_Str" + listeners.get(i),e);
    }
  }
  EventSink sink=injector.getInstance(EventSink.class);
  try {
    sink.initialize();
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public void contextInitialized(Injector injector){
  org.candlepin.common.config.Configuration candlepinConfig=injector.getInstance(org.candlepin.common.config.Configuration.class);
  if (activeMQServer == null) {
    Configuration config=new ConfigurationImpl();
    HashSet<TransportConfiguration> transports=new HashSet<>();
    transports.add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
    config.setAcceptorConfigurations(transports);
    config.setClusterUser(null);
    config.setClusterPassword(null);
    config.setSecurityEnabled(false);
    config.setJournalType(JournalType.NIO);
    config.setCreateBindingsDir(true);
    config.setCreateJournalDir(true);
    String baseDir=candlepinConfig.getString(ConfigProperties.ACTIVEMQ_BASE_DIR);
    config.setBindingsDirectory(new File(baseDir,"String_Node_Str").toString());
    config.setJournalDirectory(new File(baseDir,"String_Node_Str").toString());
    config.setLargeMessagesDirectory(new File(baseDir,"String_Node_Str").toString());
    config.setPagingDirectory(new File(baseDir,"String_Node_Str").toString());
    Map<String,AddressSettings> settings=new HashMap<>();
    AddressSettings commonAddressConfig=new AddressSettings();
    String addressPolicyString=candlepinConfig.getString(ConfigProperties.ACTIVEMQ_ADDRESS_FULL_POLICY);
    long maxQueueSizeInMb=candlepinConfig.getInt(ConfigProperties.ACTIVEMQ_MAX_QUEUE_SIZE);
    long maxPageSizeInMb=candlepinConfig.getInt(ConfigProperties.ACTIVEMQ_MAX_PAGE_SIZE);
    AddressFullMessagePolicy addressPolicy=null;
    if (addressPolicyString.equals("String_Node_Str")) {
      addressPolicy=AddressFullMessagePolicy.PAGE;
    }
 else     if (addressPolicyString.equals("String_Node_Str")) {
      addressPolicy=AddressFullMessagePolicy.BLOCK;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + addressPolicyString + "String_Node_Str");
    }
    commonAddressConfig.setMaxSizeBytes(maxQueueSizeInMb * FileUtils.ONE_MB);
    if (addressPolicy == AddressFullMessagePolicy.PAGE) {
      commonAddressConfig.setPageSizeBytes(maxPageSizeInMb * FileUtils.ONE_MB);
    }
    commonAddressConfig.setAddressFullMessagePolicy(addressPolicy);
    configureMessageRetry(commonAddressConfig,candlepinConfig);
    settings.put("String_Node_Str",commonAddressConfig);
    config.setAddressesSettings(settings);
    int maxScheduledThreads=candlepinConfig.getInt(ConfigProperties.ACTIVEMQ_MAX_SCHEDULED_THREADS);
    int maxThreads=candlepinConfig.getInt(ConfigProperties.ACTIVEMQ_MAX_THREADS);
    if (maxThreads != -1) {
      config.setThreadPoolMaxSize(maxThreads);
    }
    if (maxScheduledThreads != -1) {
      config.setScheduledThreadPoolMaxSize(maxScheduledThreads);
    }
    int largeMsgSize=candlepinConfig.getInt(ConfigProperties.ACTIVEMQ_LARGE_MSG_SIZE);
    config.setJournalBufferSize_AIO(largeMsgSize);
    config.setJournalBufferSize_NIO(largeMsgSize);
    activeMQServer=new EmbeddedActiveMQ();
    activeMQServer.setConfiguration(config);
  }
  try {
    activeMQServer.start();
    log.info("String_Node_Str");
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
    throw new RuntimeException(e);
  }
  setupAmqp(injector,candlepinConfig);
  cleanupOldQueues();
  List<String> listeners=getActiveMQListeners(candlepinConfig);
  eventSource=injector.getInstance(EventSource.class);
  for (int i=0; i < listeners.size(); i++) {
    try {
      Class<?> clazz=this.getClass().getClassLoader().loadClass(listeners.get(i));
      eventSource.registerListener((EventListener)injector.getInstance(clazz));
    }
 catch (    Exception e) {
      log.warn("String_Node_Str" + listeners.get(i),e);
    }
  }
  EventSink sink=injector.getInstance(EventSink.class);
  try {
    sink.initialize();
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
    throw new RuntimeException(e);
  }
}