Program: 116013
Project: 116013
Buggy source:
public static PayloadData createPayload(String appId,String groupName,CartridgeInfo cartridgeInfo,String subscriptionKey,int tenantId,String clusterId,String hostName,String repoUrl,String alias,Map<String,String> customPayloadEntries,String[] dependencyAliases,org.apache.stratos.common.Properties properties,String oauthToken) throws ApplicationDefinitionException {
  BasicPayloadData basicPayloadData=createBasicPayload(appId,groupName,cartridgeInfo,subscriptionKey,clusterId,hostName,repoUrl,alias,tenantId,dependencyAliases);
  basicPayloadData.populatePayload();
  PayloadData payloadData=PayloadFactory.getPayloadDataInstance(cartridgeInfo.getProvider(),cartridgeInfo.getType(),basicPayloadData);
  boolean isDeploymentParam=false;
  if (cartridgeInfo.getProperties() != null && cartridgeInfo.getProperties().length != 0) {
    org.apache.stratos.common.Properties cartridgeProps=AutoscalerUtil.toCommonProperties(cartridgeInfo.getProperties());
    if (cartridgeProps != null) {
      for (      Property propertyEntry : cartridgeProps.getProperties()) {
        if (propertyEntry.getName().startsWith("String_Node_Str")) {
          String payloadParamName=propertyEntry.getName();
          String payloadParamSubstring=payloadParamName.substring(payloadParamName.indexOf("String_Node_Str") + 1);
          if ("String_Node_Str".equals(payloadParamSubstring)) {
            isDeploymentParam=true;
          }
          payloadData.add(payloadParamSubstring,propertyEntry.getValue());
        }
      }
    }
  }
  if (properties != null && properties.getProperties() != null && properties.getProperties().length != 0) {
    for (    Property property : properties.getProperties()) {
      if (property.getName().startsWith("String_Node_Str")) {
        String payloadParamName=property.getName();
        String payloadParamSubstring=payloadParamName.substring(payloadParamName.indexOf("String_Node_Str") + 1);
        payloadData.add(payloadParamSubstring,property.getValue());
      }
    }
  }
  if (!isDeploymentParam) {
    payloadData.add("String_Node_Str","String_Node_Str");
  }
  if (!StringUtils.isEmpty(oauthToken)) {
    payloadData.add(TOKEN_PAYLOD_PARAM_NAME,oauthToken);
  }
  if (customPayloadEntries != null) {
    Set<Map.Entry<String,String>> entrySet=customPayloadEntries.entrySet();
    for (    Map.Entry<String,String> entry : entrySet) {
      payloadData.add(entry.getKey(),entry.getValue());
    }
  }
  return payloadData;
}

Fixed version (ground truth):
public static PayloadData createPayload(String appId,String groupName,CartridgeInfo cartridgeInfo,String subscriptionKey,int tenantId,String clusterId,String hostName,String repoUrl,String alias,Map<String,String> customPayloadEntries,String[] dependencyAliases,org.apache.stratos.common.Properties properties,String oauthToken) throws ApplicationDefinitionException {
  BasicPayloadData basicPayloadData=createBasicPayload(appId,groupName,cartridgeInfo,subscriptionKey,clusterId,hostName,repoUrl,alias,tenantId,dependencyAliases);
  basicPayloadData.populatePayload();
  PayloadData payloadData=PayloadFactory.getPayloadDataInstance(cartridgeInfo.getProvider(),cartridgeInfo.getType(),basicPayloadData);
  if (cartridgeInfo.getProperties() != null && cartridgeInfo.getProperties().length != 0) {
    org.apache.stratos.common.Properties cartridgeProps=AutoscalerUtil.toCommonProperties(cartridgeInfo.getProperties());
    if (cartridgeProps != null) {
      for (      Property propertyEntry : cartridgeProps.getProperties()) {
        if (propertyEntry.getName().startsWith("String_Node_Str")) {
          String payloadParamName=propertyEntry.getName();
          String payloadParamSubstring=payloadParamName.substring(payloadParamName.indexOf("String_Node_Str") + 1);
          if ("String_Node_Str".equals(payloadParamSubstring)) {
            payloadData.getBasicPayloadData().setDeployment(payloadParamSubstring);
            continue;
          }
          payloadData.add(payloadParamSubstring,propertyEntry.getValue());
        }
      }
    }
  }
  if (properties != null && properties.getProperties() != null && properties.getProperties().length != 0) {
    for (    Property property : properties.getProperties()) {
      if (property.getName().startsWith("String_Node_Str")) {
        String payloadParamName=property.getName();
        String payloadParamSubstring=payloadParamName.substring(payloadParamName.indexOf("String_Node_Str") + 1);
        payloadData.add(payloadParamSubstring,property.getValue());
      }
    }
  }
  if (!StringUtils.isEmpty(oauthToken)) {
    payloadData.add(TOKEN_PAYLOD_PARAM_NAME,oauthToken);
  }
  if (customPayloadEntries != null) {
    Set<Map.Entry<String,String>> entrySet=customPayloadEntries.entrySet();
    for (    Map.Entry<String,String> entry : entrySet) {
      payloadData.add(entry.getKey(),entry.getValue());
    }
  }
  return payloadData;
}