Program: 116640
Project: 116640
Buggy source:
@Override public void run(){
  if (log.isInfoEnabled()) {
    log.info("String_Node_Str");
  }
  String jndiPropertiesDir=System.getProperty(CartridgeAgentConstants.JNDI_PROPERTIES_DIR);
  if (StringUtils.isBlank(jndiPropertiesDir)) {
    if (log.isErrorEnabled()) {
      log.error(String.format("String_Node_Str",CartridgeAgentConstants.JNDI_PROPERTIES_DIR));
    }
    return;
  }
  String payloadPath=System.getProperty(CartridgeAgentConstants.PARAM_FILE_PATH);
  if (StringUtils.isBlank(payloadPath)) {
    if (log.isErrorEnabled()) {
      log.error(String.format("String_Node_Str",CartridgeAgentConstants.PARAM_FILE_PATH));
    }
    return;
  }
  String extensionsDir=System.getProperty(CartridgeAgentConstants.EXTENSIONS_DIR);
  if (StringUtils.isBlank(extensionsDir)) {
    if (log.isWarnEnabled()) {
      log.warn(String.format("String_Node_Str",CartridgeAgentConstants.EXTENSIONS_DIR));
    }
  }
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  InstanceNotifierMessageProcessorChain processorChain=new InstanceNotifierMessageProcessorChain();
  processorChain.addEventListener(new ArtifactUpdateEventListener(){
    @Override protected void onEvent(    Event event){
      onArtifactUpdateEvent((ArtifactUpdatedEvent)event);
    }
  }
);
  processorChain.addEventListener(new InstanceCleanupMemberEventListener(){
    @Override protected void onEvent(    Event event){
      String memberIdInPayload=CartridgeAgentConfiguration.getInstance().getMemberId();
      InstanceCleanupMemberEvent instanceCleanupMemberEvent=(InstanceCleanupMemberEvent)event;
      if (memberIdInPayload.equals(instanceCleanupMemberEvent.getMemberId())) {
        onInstanceCleanupEvent();
      }
    }
  }
);
  processorChain.addEventListener(new InstanceCleanupClusterEventListener(){
    @Override protected void onEvent(    Event event){
      String clusterIdInPayload=CartridgeAgentConfiguration.getInstance().getClusterId();
      InstanceCleanupClusterEvent instanceCleanupClusterEvent=(InstanceCleanupClusterEvent)event;
      if (clusterIdInPayload.equals(instanceCleanupClusterEvent.getClusterId())) {
        onInstanceCleanupEvent();
      }
    }
  }
);
  InstanceNotifierEventMessageDelegator messageDelegator=new InstanceNotifierEventMessageDelegator(processorChain);
  InstanceNotifierEventMessageReceiver messageReceiver=new InstanceNotifierEventMessageReceiver(messageDelegator);
  Thread messageReceiverThread=new Thread(messageReceiver);
  messageReceiverThread.start();
  while (!messageReceiver.isSubscribed()) {
    try {
      Thread.sleep(2000);
    }
 catch (    InterruptedException e) {
    }
  }
  CartridgeAgentEventPublisher.publishInstanceStartedEvent();
  ExtensionUtils.executeStartServersExtension();
  CartridgeAgentUtils.waitUntilPortsActive("String_Node_Str",CartridgeAgentConfiguration.getInstance().getPorts());
  String repoUrl=CartridgeAgentConfiguration.getInstance().getRepoUrl();
  if ("String_Node_Str".equals(repoUrl) || StringUtils.isBlank(repoUrl)) {
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str");
    }
    CartridgeAgentEventPublisher.publishInstanceActivatedEvent();
  }
  LogPublisherManager logPublisherManager=new LogPublisherManager();
  publishLogs(logPublisherManager);
  while (!terminated)   ;
  logPublisherManager.stop();
}

Fixed version (ground truth):
@Override public void run(){
  if (log.isInfoEnabled()) {
    log.info("String_Node_Str");
  }
  String jndiPropertiesDir=System.getProperty(CartridgeAgentConstants.JNDI_PROPERTIES_DIR);
  if (StringUtils.isBlank(jndiPropertiesDir)) {
    if (log.isErrorEnabled()) {
      log.error(String.format("String_Node_Str",CartridgeAgentConstants.JNDI_PROPERTIES_DIR));
    }
    return;
  }
  String payloadPath=System.getProperty(CartridgeAgentConstants.PARAM_FILE_PATH);
  if (StringUtils.isBlank(payloadPath)) {
    if (log.isErrorEnabled()) {
      log.error(String.format("String_Node_Str",CartridgeAgentConstants.PARAM_FILE_PATH));
    }
    return;
  }
  String extensionsDir=System.getProperty(CartridgeAgentConstants.EXTENSIONS_DIR);
  if (StringUtils.isBlank(extensionsDir)) {
    if (log.isWarnEnabled()) {
      log.warn(String.format("String_Node_Str",CartridgeAgentConstants.EXTENSIONS_DIR));
    }
  }
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  InstanceNotifierMessageProcessorChain processorChain=new InstanceNotifierMessageProcessorChain();
  processorChain.addEventListener(new ArtifactUpdateEventListener(){
    @Override protected void onEvent(    Event event){
      onArtifactUpdateEvent((ArtifactUpdatedEvent)event);
    }
  }
);
  processorChain.addEventListener(new InstanceCleanupMemberEventListener(){
    @Override protected void onEvent(    Event event){
      String memberIdInPayload=CartridgeAgentConfiguration.getInstance().getMemberId();
      InstanceCleanupMemberEvent instanceCleanupMemberEvent=(InstanceCleanupMemberEvent)event;
      if (memberIdInPayload.equals(instanceCleanupMemberEvent.getMemberId())) {
        onInstanceCleanupEvent();
      }
    }
  }
);
  processorChain.addEventListener(new InstanceCleanupClusterEventListener(){
    @Override protected void onEvent(    Event event){
      String clusterIdInPayload=CartridgeAgentConfiguration.getInstance().getClusterId();
      InstanceCleanupClusterEvent instanceCleanupClusterEvent=(InstanceCleanupClusterEvent)event;
      if (clusterIdInPayload.equals(instanceCleanupClusterEvent.getClusterId())) {
        onInstanceCleanupEvent();
      }
    }
  }
);
  InstanceNotifierEventMessageDelegator messageDelegator=new InstanceNotifierEventMessageDelegator(processorChain);
  InstanceNotifierEventMessageReceiver messageReceiver=new InstanceNotifierEventMessageReceiver(messageDelegator);
  Thread messageReceiverThread=new Thread(messageReceiver);
  messageReceiverThread.start();
  while (!messageReceiver.isSubscribed()) {
    try {
      Thread.sleep(2000);
    }
 catch (    InterruptedException e) {
    }
  }
  CartridgeAgentEventPublisher.publishInstanceStartedEvent();
  ExtensionUtils.executeStartServersExtension();
  CartridgeAgentUtils.waitUntilPortsActive("String_Node_Str",CartridgeAgentConfiguration.getInstance().getPorts());
  String repoUrl=CartridgeAgentConfiguration.getInstance().getRepoUrl();
  if ("String_Node_Str".equals(repoUrl) || StringUtils.isBlank(repoUrl)) {
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str");
    }
    CartridgeAgentEventPublisher.publishInstanceActivatedEvent();
  }
  LogPublisherManager logPublisherManager=new LogPublisherManager();
  publishLogs(logPublisherManager);
  while (!terminated) {
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException ignore) {
    }
  }
  logPublisherManager.stop();
}