Program: 37267
Project: 37267
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).
 * @param request request.
 * @return JSON formated result,with HTTP code.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryDomain(@PathVariable String domainName,HttpServletRequest request) throws DecodeException {
  domainName=queryParser.getLastSplitInURI(request);
  String decodeDomain=domainName;
  String punyDomainName=decodeDomain;
  decodeDomain=DomainUtil.urlDecode(domainName);
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeDomain)) {
    return RestResponseUtil.createResponse400();
  }
  decodeDomain=StringUtil.foldCaseAndNormalization(decodeDomain);
  try {
    punyDomainName=DomainUtil.geneDomainPunyName(decodeDomain);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  LOGGER.debug("String_Node_Str",decodeDomain);
  decodeDomain=DomainUtil.deleteLastPoint(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).
 * @param request request.
 * @return JSON formated result,with HTTP code.
 * @throws DecodeException DecodeException.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryDomain(@PathVariable String domainName,HttpServletRequest request) throws DecodeException {
  domainName=queryParser.getLastSplitInURI(request);
  String decodeDomain=domainName;
  String punyDomainName=decodeDomain;
  decodeDomain=DomainUtil.urlDecode(domainName);
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeDomain)) {
    return RestResponseUtil.createResponse400();
  }
  decodeDomain=StringUtil.foldCaseAndNormalization(decodeDomain);
  try {
    punyDomainName=DomainUtil.geneDomainPunyName(decodeDomain);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  LOGGER.debug("String_Node_Str",decodeDomain);
  decodeDomain=DomainUtil.deleteLastPoint(decodeDomain);
  QueryParam queryParam=queryParser.parseDomainQueryParam(decodeDomain,punyDomainName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryDomainInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam,domainName);
}