Program: 37026
Project: 37026
Buggy source:
public SearchRequest decodeSearchRequestBody(String scimResourceString,SCIMResourceTypeSchema schema) throws BadRequestException {
  FilterTreeManager filterTreeManager=null;
  Node rootNode=null;
  try {
    JSONObject decodedJsonObj=new JSONObject(new JSONTokener(scimResourceString));
    SearchRequest searchRequest=new SearchRequest();
    ArrayList<String> attributes=new ArrayList<>();
    ArrayList<String> excludedAttributes=new ArrayList<>();
    JSONArray attributesValues=(JSONArray)decodedJsonObj.opt(SCIMConstants.OperationalConstants.ATTRIBUTES);
    JSONArray excludedAttributesValues=(JSONArray)decodedJsonObj.opt(SCIMConstants.OperationalConstants.EXCLUDED_ATTRIBUTES);
    JSONArray schemas=(JSONArray)decodedJsonObj.opt(SCIMConstants.CommonSchemaConstants.SCHEMAS);
    if (schemas.length() != 1) {
      throw new BadRequestException("String_Node_Str",ResponseCodeConstants.INVALID_VALUE);
    }
    if (attributesValues != null) {
      for (int i=0; i < attributesValues.length(); i++) {
        attributes.add((String)attributesValues.get(i));
      }
    }
    if (excludedAttributesValues != null) {
      for (int i=0; i < excludedAttributesValues.length(); i++) {
        excludedAttributes.add((String)excludedAttributesValues.get(i));
      }
    }
    if (decodedJsonObj.optString(SCIMConstants.OperationalConstants.FILTER) != null) {
      filterTreeManager=new FilterTreeManager(decodedJsonObj.optString(SCIMConstants.OperationalConstants.FILTER),schema);
      rootNode=filterTreeManager.buildTree();
    }
    searchRequest.setAttributes(attributes);
    searchRequest.setExcludedAttributes(excludedAttributes);
    searchRequest.setSchema((String)schemas.get(0));
    searchRequest.setCount(decodedJsonObj.optInt(SCIMConstants.OperationalConstants.COUNT));
    searchRequest.setStartIndex(decodedJsonObj.optInt(SCIMConstants.OperationalConstants.START_INDEX));
    searchRequest.setFilter(rootNode);
    if (!decodedJsonObj.optString(SCIMConstants.OperationalConstants.SORT_BY).equals("String_Node_Str")) {
      searchRequest.setSortBy(decodedJsonObj.optString(SCIMConstants.OperationalConstants.SORT_BY));
    }
    if (!decodedJsonObj.optString(SCIMConstants.OperationalConstants.SORT_ORDER).equals("String_Node_Str")) {
      searchRequest.setSortOder(decodedJsonObj.optString(SCIMConstants.OperationalConstants.SORT_ORDER));
    }
    return searchRequest;
  }
 catch (  JSONException|IOException e) {
    logger.error("String_Node_Str");
    throw new BadRequestException(ResponseCodeConstants.INVALID_SYNTAX);
  }
}

Fixed version (ground truth):
public SearchRequest decodeSearchRequestBody(String scimResourceString,SCIMResourceTypeSchema schema) throws BadRequestException {
  FilterTreeManager filterTreeManager=null;
  Node rootNode=null;
  try {
    JSONObject decodedJsonObj=new JSONObject(new JSONTokener(scimResourceString));
    SearchRequest searchRequest=new SearchRequest();
    ArrayList<String> attributes=new ArrayList<>();
    ArrayList<String> excludedAttributes=new ArrayList<>();
    JSONArray attributesValues=(JSONArray)decodedJsonObj.opt(SCIMConstants.OperationalConstants.ATTRIBUTES);
    JSONArray excludedAttributesValues=(JSONArray)decodedJsonObj.opt(SCIMConstants.OperationalConstants.EXCLUDED_ATTRIBUTES);
    JSONArray schemas=(JSONArray)decodedJsonObj.opt(SCIMConstants.CommonSchemaConstants.SCHEMAS);
    if (schemas.length() != 1) {
      throw new BadRequestException("String_Node_Str",ResponseCodeConstants.INVALID_VALUE);
    }
    if (attributesValues != null) {
      for (int i=0; i < attributesValues.length(); i++) {
        attributes.add((String)attributesValues.get(i));
      }
    }
    if (excludedAttributesValues != null) {
      for (int i=0; i < excludedAttributesValues.length(); i++) {
        excludedAttributes.add((String)excludedAttributesValues.get(i));
      }
    }
    if (decodedJsonObj.opt(SCIMConstants.OperationalConstants.FILTER) != null) {
      filterTreeManager=new FilterTreeManager((String)decodedJsonObj.opt(SCIMConstants.OperationalConstants.FILTER),schema);
      rootNode=filterTreeManager.buildTree();
    }
    searchRequest.setAttributes(attributes);
    searchRequest.setExcludedAttributes(excludedAttributes);
    searchRequest.setSchema((String)schemas.get(0));
    searchRequest.setCount(decodedJsonObj.optInt(SCIMConstants.OperationalConstants.COUNT));
    searchRequest.setStartIndex(decodedJsonObj.optInt(SCIMConstants.OperationalConstants.START_INDEX));
    searchRequest.setFilter(rootNode);
    if (!decodedJsonObj.optString(SCIMConstants.OperationalConstants.SORT_BY).equals("String_Node_Str")) {
      searchRequest.setSortBy(decodedJsonObj.optString(SCIMConstants.OperationalConstants.SORT_BY));
    }
    if (!decodedJsonObj.optString(SCIMConstants.OperationalConstants.SORT_ORDER).equals("String_Node_Str")) {
      searchRequest.setSortOder(decodedJsonObj.optString(SCIMConstants.OperationalConstants.SORT_ORDER));
    }
    return searchRequest;
  }
 catch (  JSONException|IOException e) {
    logger.error("String_Node_Str");
    throw new BadRequestException(ResponseCodeConstants.INVALID_SYNTAX);
  }
}