Program: 37376
Project: 37376
Buggy source:
/** 
 * <pre> query domain by domain name. URI:/domain/{domainName} If domain tld is configured in 'inTlds' and not in 'notInTlds' of rdap.properties file, will query in local registry;  If domain tld is configured in 'notInTlds' and not in 'inTlds', will query for redirect. This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. <pre>
 * @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 queryDomain(@PathVariable String domainName){
  String decodeDomain=domainName;
  String punyDomainName=decodeDomain;
  try {
    decodeDomain=DomainUtil.decodeAndReplaceAsciiToLowercase(domainName);
    punyDomainName=DomainUtil.geneDomainPunyName(decodeDomain);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  decodeDomain=StringUtil.getNormalization(decodeDomain);
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeDomain)) {
    return RestResponseUtil.createResponse400();
  }
  LOGGER.debug("String_Node_Str",decodeDomain);
  decodeDomain=DomainUtil.deleteLastPoint(decodeDomain);
  decodeDomain=StringUtils.lowerCase(decodeDomain);
  QueryParam queryParam=queryParser.parseDomainQueryParam(decodeDomain,punyDomainName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryDomainInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam,domainName);
}

Fixed version (ground truth):
/** 
 * <pre> query domain by domain name. URI:/domain/{domainName} If domain tld is configured in 'inTlds' and not in 'notInTlds' of rdap.properties file, will query in local registry;  If domain tld is configured in 'notInTlds' and not in 'inTlds', will query for redirect. This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. <pre>
 * @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 queryDomain(@PathVariable String domainName,HttpServletRequest request){
  domainName=queryParser.getLastSplitInURI(request);
  String decodeDomain=domainName;
  String punyDomainName=decodeDomain;
  try {
    decodeDomain=DomainUtil.decodeAndReplaceAsciiToLowercase(domainName);
    punyDomainName=DomainUtil.geneDomainPunyName(decodeDomain);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  decodeDomain=StringUtil.getNormalization(decodeDomain);
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeDomain)) {
    return RestResponseUtil.createResponse400();
  }
  LOGGER.debug("String_Node_Str",decodeDomain);
  decodeDomain=DomainUtil.deleteLastPoint(decodeDomain);
  decodeDomain=StringUtils.lowerCase(decodeDomain);
  QueryParam queryParam=queryParser.parseDomainQueryParam(decodeDomain,punyDomainName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryDomainInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam,domainName);
}