Program: 37231
Project: 37231
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.
 * @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.urlDecodeAndReplaceAsciiToLowercase(domainName);
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeDomain)) {
    return RestResponseUtil.createResponse400();
  }
  decodeDomain=StringUtil.foldCaseAndNormalization(decodeDomain);
  LOGGER.debug("String_Node_Str",decodeDomain);
  try {
    punyDomainName=DomainUtil.geneDomainPunyName(decodeDomain);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  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.urlDecodeAndReplaceAsciiToLowercase(domainName);
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeDomain,false)) {
    return RestResponseUtil.createResponse400();
  }
  decodeDomain=StringUtil.foldCaseAndNormalization(decodeDomain);
  LOGGER.debug("String_Node_Str",decodeDomain);
  try {
    punyDomainName=DomainUtil.geneDomainPunyName(decodeDomain);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  decodeDomain=DomainUtil.deleteLastPoint(decodeDomain);
  QueryParam queryParam=queryParser.parseDomainQueryParam(decodeDomain,punyDomainName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryDomainInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam,domainName);
}