Program: 105463
Project: 105463
Buggy source:
/** 
 * Build URL for api call using region end_point Parameters are sorted and signed using secret_key
 * @param apiParams
 * @param region
 * @return
 */
private static String buildUrl(String apiParams,Region region){
  String apiKey="String_Node_Str";
  String secretKey="String_Node_Str";
  if (apiKey == null || secretKey == null) {
    return region.getEndPoint() + "String_Node_Str" + apiParams;
  }
  String encodedApiKey;
  try {
    encodedApiKey=URLEncoder.encode(apiKey,"String_Node_Str");
    List<String> sortedParams=new ArrayList<String>();
    sortedParams.add("String_Node_Str" + encodedApiKey.toLowerCase());
    StringTokenizer st=new StringTokenizer(apiParams,"String_Node_Str");
    String url=null;
    boolean first=true;
    while (st.hasMoreTokens()) {
      String paramValue=st.nextToken();
      String param=paramValue.substring(0,paramValue.indexOf("String_Node_Str"));
      String value=paramValue.substring(paramValue.indexOf("String_Node_Str") + 1,paramValue.length());
      if (first) {
        url=param + "String_Node_Str" + value;
        first=false;
      }
 else {
        url=url + "String_Node_Str" + param+ "String_Node_Str"+ value;
      }
      sortedParams.add(param.toLowerCase() + "String_Node_Str" + value.toLowerCase());
    }
    Collections.sort(sortedParams);
    String sortedUrl=null;
    first=true;
    for (    String param : sortedParams) {
      if (first) {
        sortedUrl=param;
        first=false;
      }
 else {
        sortedUrl=sortedUrl + "String_Node_Str" + param;
      }
    }
    String encodedSignature=signRequest(sortedUrl,secretKey);
    String finalUrl=region.getEndPoint() + "String_Node_Str" + apiParams+ "String_Node_Str"+ apiKey+ "String_Node_Str"+ encodedSignature;
    return finalUrl;
  }
 catch (  UnsupportedEncodingException e) {
    s_logger.error(e.getMessage());
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Build URL for api call using region end_point Parameters are sorted and signed using secret_key
 * @param apiParams
 * @param region
 * @return
 */
private static String buildUrl(String apiParams,Region region){
  String apiKey="String_Node_Str";
  String secretKey="String_Node_Str";
  String encodedApiKey;
  try {
    encodedApiKey=URLEncoder.encode(apiKey,"String_Node_Str");
    List<String> sortedParams=new ArrayList<String>();
    sortedParams.add("String_Node_Str" + encodedApiKey.toLowerCase());
    StringTokenizer st=new StringTokenizer(apiParams,"String_Node_Str");
    String url=null;
    boolean first=true;
    while (st.hasMoreTokens()) {
      String paramValue=st.nextToken();
      String param=paramValue.substring(0,paramValue.indexOf("String_Node_Str"));
      String value=paramValue.substring(paramValue.indexOf("String_Node_Str") + 1,paramValue.length());
      if (first) {
        url=param + "String_Node_Str" + value;
        first=false;
      }
 else {
        url=url + "String_Node_Str" + param+ "String_Node_Str"+ value;
      }
      sortedParams.add(param.toLowerCase() + "String_Node_Str" + value.toLowerCase());
    }
    Collections.sort(sortedParams);
    String sortedUrl=null;
    first=true;
    for (    String param : sortedParams) {
      if (first) {
        sortedUrl=param;
        first=false;
      }
 else {
        sortedUrl=sortedUrl + "String_Node_Str" + param;
      }
    }
    String encodedSignature=signRequest(sortedUrl,secretKey);
    String finalUrl=region.getEndPoint() + "String_Node_Str" + apiParams+ "String_Node_Str"+ apiKey+ "String_Node_Str"+ encodedSignature;
    return finalUrl;
  }
 catch (  UnsupportedEncodingException e) {
    s_logger.error(e.getMessage());
    return null;
  }
}