Program: 116777
Project: 116777
Buggy source:
public CartridgeSubscription subscribeToCartridgeWithProperties(String cartridgeType,String cartridgeAlias,String autoscalingPolicyName,String deploymentPolicyName,String tenantDomain,int tenantId,String tenantAdminUsername,String repositoryType,String repositoryURL,boolean isPrivateRepository,String repositoryUsername,String repositoryPassword,Property[] props) throws ADCException, InvalidCartridgeAliasException, DuplicateCartridgeAliasException, PolicyException, UnregisteredCartridgeException, RepositoryRequiredException, RepositoryCredentialsRequiredException, RepositoryTransportException, AlreadySubscribedException, InvalidRepositoryException {
  ApplicationManagementUtil.validateCartridgeAlias(cartridgeAlias,cartridgeType);
  CartridgeInfo cartridgeInfo;
  try {
    cartridgeInfo=CloudControllerServiceClient.getServiceClient().getCartridgeInfo(cartridgeType);
    if (props != null) {
      cartridgeInfo.setProperties(props);
    }
  }
 catch (  UnregisteredCartridgeException e) {
    String message=cartridgeType + "String_Node_Str";
    log.error(message);
    throw e;
  }
catch (  Exception e) {
    String message="String_Node_Str" + cartridgeType;
    log.error(message,e);
    throw new ADCException(message,e);
  }
  SubscriptionTenancyBehaviour tenancyBehaviour;
  if (cartridgeInfo.getMultiTenant()) {
    tenancyBehaviour=new SubscriptionMultiTenantBehaviour();
  }
 else {
    tenancyBehaviour=new SubscriptionSingleTenantBehaviour();
  }
  CartridgeSubscription cartridgeSubscription=CartridgeSubscriptionFactory.getCartridgeSubscriptionInstance(cartridgeInfo,tenancyBehaviour);
  Repository repository=cartridgeSubscription.manageRepository(repositoryURL,repositoryUsername,repositoryPassword,isPrivateRepository,cartridgeAlias,cartridgeInfo,tenantDomain);
  Subscriber subscriber=new Subscriber(tenantAdminUsername,tenantId,tenantDomain);
  cartridgeSubscription.createSubscription(subscriber,cartridgeAlias,autoscalingPolicyName,deploymentPolicyName,repository);
  cartridgeSubscription.setSubscriptionKey(CartridgeSubscriptionUtils.generateSubscriptionKey());
  log.info("String_Node_Str" + tenantId + "String_Node_Str"+ tenantAdminUsername+ "String_Node_Str"+ "String_Node_Str"+ cartridgeAlias+ "String_Node_Str"+ cartridgeType+ "String_Node_Str"+ repositoryURL+ "String_Node_Str"+ autoscalingPolicyName);
  BasicPayloadData basicPayloadData=CartridgeSubscriptionUtils.createBasicPayload(cartridgeSubscription);
  basicPayloadData.populatePayload();
  PayloadData payloadData=PayloadFactory.getPayloadDataInstance(cartridgeInfo.getProvider(),cartridgeInfo.getType(),basicPayloadData);
  if (cartridgeInfo.getProperties() != null && cartridgeInfo.getProperties().length != 0) {
    for (    Property property : cartridgeInfo.getProperties()) {
      if (property.getName().startsWith(CartridgeConstants.CUSTOM_PAYLOAD_PARAM_NAME_PREFIX)) {
        String payloadParamName=property.getName();
        payloadData.add(payloadParamName.substring(payloadParamName.indexOf("String_Node_Str") + 1),property.getValue());
      }
    }
  }
  if (cartridgeSubscription.getCustomPayloadEntries() != null) {
    Map<String,String> customPayloadEntries=cartridgeSubscription.getCustomPayloadEntries();
    Set<Map.Entry<String,String>> entrySet=customPayloadEntries.entrySet();
    for (    Map.Entry<String,String> entry : entrySet) {
      payloadData.add(entry.getKey(),entry.getValue());
    }
  }
  cartridgeSubscription.setPayloadData(payloadData);
  CartridgeSubscriptionUtils.publishTenantSubscribedEvent(cartridgeSubscription.getSubscriber().getTenantId(),cartridgeSubscription.getCartridgeInfo().getType());
  return cartridgeSubscription;
}

Fixed version (ground truth):
public CartridgeSubscription subscribeToCartridgeWithProperties(String cartridgeType,String cartridgeAlias,String autoscalingPolicyName,String deploymentPolicyName,String tenantDomain,int tenantId,String tenantAdminUsername,String repositoryType,String repositoryURL,boolean isPrivateRepository,String repositoryUsername,String repositoryPassword,Property[] props) throws ADCException, InvalidCartridgeAliasException, DuplicateCartridgeAliasException, PolicyException, UnregisteredCartridgeException, RepositoryRequiredException, RepositoryCredentialsRequiredException, RepositoryTransportException, AlreadySubscribedException, InvalidRepositoryException {
  ApplicationManagementUtil.validateCartridgeAlias(cartridgeAlias,cartridgeType);
  CartridgeInfo cartridgeInfo;
  try {
    cartridgeInfo=CloudControllerServiceClient.getServiceClient().getCartridgeInfo(cartridgeType);
    if (props != null) {
      cartridgeInfo.setProperties(props);
    }
  }
 catch (  UnregisteredCartridgeException e) {
    String message=cartridgeType + "String_Node_Str";
    log.error(message);
    throw e;
  }
catch (  Exception e) {
    String message="String_Node_Str" + cartridgeType;
    log.error(message,e);
    throw new ADCException(message,e);
  }
  SubscriptionTenancyBehaviour tenancyBehaviour;
  if (cartridgeInfo.getMultiTenant()) {
    tenancyBehaviour=new SubscriptionMultiTenantBehaviour();
  }
 else {
    tenancyBehaviour=new SubscriptionSingleTenantBehaviour();
  }
  CartridgeSubscription cartridgeSubscription=CartridgeSubscriptionFactory.getCartridgeSubscriptionInstance(cartridgeInfo,tenancyBehaviour);
  Repository repository=cartridgeSubscription.manageRepository(repositoryURL,repositoryUsername,repositoryPassword,isPrivateRepository,cartridgeAlias,cartridgeInfo,tenantDomain);
  Subscriber subscriber=new Subscriber(tenantAdminUsername,tenantId,tenantDomain);
  cartridgeSubscription.createSubscription(subscriber,cartridgeAlias,autoscalingPolicyName,deploymentPolicyName,repository);
  cartridgeSubscription.setSubscriptionKey(CartridgeSubscriptionUtils.generateSubscriptionKey());
  log.info("String_Node_Str" + tenantId + "String_Node_Str"+ tenantAdminUsername+ "String_Node_Str"+ "String_Node_Str"+ cartridgeAlias+ "String_Node_Str"+ cartridgeType+ "String_Node_Str"+ repositoryURL+ "String_Node_Str"+ autoscalingPolicyName);
  BasicPayloadData basicPayloadData=CartridgeSubscriptionUtils.createBasicPayload(cartridgeSubscription);
  basicPayloadData.populatePayload();
  PayloadData payloadData=PayloadFactory.getPayloadDataInstance(cartridgeInfo.getProvider(),cartridgeInfo.getType(),basicPayloadData);
  if (cartridgeInfo.getProperties() != null && cartridgeInfo.getProperties().length != 0) {
    for (    Property property : cartridgeInfo.getProperties()) {
      if (property.getName().startsWith(CartridgeConstants.CUSTOM_PAYLOAD_PARAM_NAME_PREFIX)) {
        String payloadParamName=property.getName();
        payloadData.add(payloadParamName.substring(payloadParamName.indexOf("String_Node_Str") + 1),property.getValue());
      }
    }
  }
  if (cartridgeSubscription.getCustomPayloadEntries() != null) {
    Map<String,String> customPayloadEntries=cartridgeSubscription.getCustomPayloadEntries();
    Set<Map.Entry<String,String>> entrySet=customPayloadEntries.entrySet();
    for (    Map.Entry<String,String> entry : entrySet) {
      payloadData.add(entry.getKey(),entry.getValue());
    }
  }
  cartridgeSubscription.setPayloadData(payloadData);
  CartridgeSubscriptionUtils.publishTenantSubscribedEvent(cartridgeSubscription.getSubscriber().getTenantId(),cartridgeSubscription.getCartridgeInfo().getType());
  if (cartridgeInfo.getMultiTenant()) {
    log.info("String_Node_Str");
    ArtifactUpdatePublisher publisher=new ArtifactUpdatePublisher(cartridgeSubscription.getRepository(),cartridgeSubscription.getClusterDomain(),String.valueOf(cartridgeSubscription.getSubscriber().getTenantId()));
    publisher.publish();
  }
  return cartridgeSubscription;
}