Program: 37369
Project: 37369
Buggy source:
/** 
 * <pre> search entity by handle or name. URI:/entities?fn={entity name} ; /entities?handle={handle}. This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. The first appearance parameter 'fn' and 'handle' will be handled, and other parameters will be ignored. Parameter will be trimed. <pre>
 * @param fn fn.
 * @param handle handle.
 * @param request request.
 * @return ResponseEntity.
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public ResponseEntity searchEntity(@RequestParam(required=false) String fn,@RequestParam(required=false) String handle,HttpServletRequest request){
  LOGGER.debug("String_Node_Str",fn,handle);
  final String fnParamName="String_Node_Str";
  final String handleParamName="String_Node_Str";
  String paramName=queryParser.getFirstParameter(request,new String[]{fnParamName,handleParamName});
  if (StringUtils.isBlank(paramName)) {
    return RestResponseUtil.createResponse400();
  }
  String paramValue=queryParser.getParameter(request,paramName);
  paramValue=DomainUtil.iso8859Decode(paramValue);
  paramValue=StringUtils.trim(paramValue);
  if (!StringUtil.isValidEntityHandleOrName(paramValue)) {
    return RestResponseUtil.createResponse400();
  }
  if (!StringUtil.checkIsValidSearchPattern(paramValue)) {
    return RestResponseUtil.createResponse422();
  }
  QueryParam queryParam=queryParser.parseEntityQueryParam(paramValue,paramName);
  LOGGER.debug("String_Node_Str",queryParam);
  EntitySearch result=searchService.searchEntity(queryParam);
  if (null != result) {
    if (result.getHasNoAuthForAllObjects()) {
      return RestResponseUtil.createResponse403();
    }
    responseDecorator.decorateResponse(result);
    return RestResponseUtil.createResponse200(result);
  }
  return RestResponseUtil.createResponse404();
}

Fixed version (ground truth):
/** 
 * <pre> search entity by handle or name. URI:/entities?fn={entity name} ; /entities?handle={handle}. This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. The first appearance parameter 'fn' and 'handle' will be handled, and other parameters will be ignored. Parameter will be trimed. </pre>
 * @param fn fn.
 * @param handle handle.
 * @param request request.
 * @return ResponseEntity.
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public ResponseEntity searchEntity(@RequestParam(required=false) String fn,@RequestParam(required=false) String handle,HttpServletRequest request){
  LOGGER.debug("String_Node_Str",fn,handle);
  final String fnParamName="String_Node_Str";
  final String handleParamName="String_Node_Str";
  String paramName=queryParser.getFirstParameter(request,new String[]{fnParamName,handleParamName});
  if (StringUtils.isBlank(paramName)) {
    return RestResponseUtil.createResponse400();
  }
  String paramValue=queryParser.getParameter(request,paramName);
  paramValue=DomainUtil.iso8859Decode(paramValue);
  paramValue=StringUtils.trim(paramValue);
  if (!StringUtil.isValidEntityHandleOrName(paramValue)) {
    return RestResponseUtil.createResponse400();
  }
  if (!StringUtil.checkIsValidSearchPattern(paramValue)) {
    return RestResponseUtil.createResponse422();
  }
  QueryParam queryParam=queryParser.parseEntityQueryParam(paramValue,paramName);
  LOGGER.debug("String_Node_Str",queryParam);
  EntitySearch result=searchService.searchEntity(queryParam);
  if (null != result) {
    if (result.getHasNoAuthForAllObjects()) {
      return RestResponseUtil.createResponse403();
    }
    responseDecorator.decorateResponse(result);
    return RestResponseUtil.createResponse200(result);
  }
  return RestResponseUtil.createResponse404();
}