Program: 116721
Project: 116721
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 {
  CartridgeSubscriptionUtils.validateCartridgeAlias(tenantId,cartridgeType,cartridgeAlias);
  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.setSubscriptionKey(CartridgeSubscriptionUtils.generateSubscriptionKey());
  cartridgeSubscription.createSubscription(subscriber,cartridgeAlias,autoscalingPolicyName,deploymentPolicyName,repository);
  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);
  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 {
  CartridgeSubscriptionUtils.validateCartridgeAlias(tenantId,cartridgeType,cartridgeAlias);
  CartridgeInfo cartridgeInfo;
  try {
    cartridgeInfo=CloudControllerServiceClient.getServiceClient().getCartridgeInfo(cartridgeType);
    if (props != null) {
      for (      Property property : props)       cartridgeInfo.addProperties(property);
    }
  }
 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.setSubscriptionKey(CartridgeSubscriptionUtils.generateSubscriptionKey());
  cartridgeSubscription.createSubscription(subscriber,cartridgeAlias,autoscalingPolicyName,deploymentPolicyName,repository);
  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);
  CartridgeSubscriptionUtils.publishTenantSubscribedEvent(cartridgeSubscription.getSubscriber().getTenantId(),cartridgeSubscription.getCartridgeInfo().getType());
  return cartridgeSubscription;
}