Program: 37443
Project: 37443
Buggy source:
/** 
 * search domain by domain name.
 * @param domainName is a fully-qualified (relative to the root) domain name [RFC1594] in either the in-addr.arpa or ip6.arpa zones (for RIRs) or a fully-qualified domain name in a zone administered by the server operator (for DNRs).
 * @return JSON formated result,with HTTP code.
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) @ResponseBody public ResponseEntity searchDomain(@RequestParam(required=false) String name,HttpServletRequest request,HttpServletResponse response){
  name=queryParser.getParameter(request,"String_Node_Str");
  String decodeDomain=name;
  try {
    decodeDomain=DomainUtil.iso8859Decode(name);
    decodeDomain=DomainUtil.decodeAndTrimAndReplaceAsciiToLowercase(decodeDomain);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  if (StringUtils.isBlank(decodeDomain)) {
    return RestResponseUtil.createResponse400();
  }
  decodeDomain=StringUtil.getNormalization(decodeDomain);
  if (!StringUtil.checkIsValidSearchPattern(decodeDomain)) {
    return RestResponseUtil.createResponse422();
  }
  if (!DomainUtil.validateSearchStringIsValidIdna(decodeDomain)) {
    return RestResponseUtil.createResponse400();
  }
  decodeDomain=DomainUtil.deleteLastPoint(decodeDomain);
  decodeDomain=StringUtils.lowerCase(decodeDomain);
  DomainSearch domainSearch=searchService.searchDomain(queryParser.parseDomainQueryParam(decodeDomain,decodeDomain));
  if (null != domainSearch) {
    if (domainSearch.getHasNoAuthForAllObjects()) {
      return RestResponseUtil.createResponse403();
    }
    responseDecorator.decorateResponse(domainSearch);
    policyControlService.applyPolicy(domainSearch);
    return RestResponseUtil.createResponse200(domainSearch);
  }
  return RestResponseUtil.createResponse404();
}

Fixed version (ground truth):
/** 
 * search domain by domain name.
 * @param domainName is a fully-qualified (relative to the root) domain name [RFC1594] in either the in-addr.arpa or ip6.arpa zones (for RIRs) or a fully-qualified domain name in a zone administered by the server operator (for DNRs).
 * @return JSON formated result,with HTTP code.
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) @ResponseBody public ResponseEntity searchDomain(@RequestParam(required=false) String name,HttpServletRequest request,HttpServletResponse response){
  name=queryParser.getParameter(request,"String_Node_Str");
  String decodeDomain=name;
  try {
    decodeDomain=DomainUtil.iso8859Decode(name);
    decodeDomain=DomainUtil.decodeAndReplaceAsciiToLowercase(decodeDomain);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  if (StringUtils.isBlank(decodeDomain)) {
    return RestResponseUtil.createResponse400();
  }
  decodeDomain=StringUtil.getNormalization(decodeDomain);
  if (!StringUtil.checkIsValidSearchPattern(decodeDomain)) {
    return RestResponseUtil.createResponse422();
  }
  if (!DomainUtil.validateSearchStringIsValidIdna(decodeDomain)) {
    return RestResponseUtil.createResponse400();
  }
  decodeDomain=DomainUtil.deleteLastPoint(decodeDomain);
  decodeDomain=StringUtils.lowerCase(decodeDomain);
  DomainSearch domainSearch=searchService.searchDomain(queryParser.parseDomainQueryParam(decodeDomain,decodeDomain));
  if (null != domainSearch) {
    if (domainSearch.getHasNoAuthForAllObjects()) {
      return RestResponseUtil.createResponse403();
    }
    responseDecorator.decorateResponse(domainSearch);
    policyControlService.applyPolicy(domainSearch);
    return RestResponseUtil.createResponse200(domainSearch);
  }
  return RestResponseUtil.createResponse404();
}