Program: 37230
Project: 37230
Buggy source:
/** 
 * <pre> query nameserver by nameserver name. URI:/nameserver/{nameserver name} This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. </pre>
 * @param nsName represents information regarding DNS name servers used in both forward and reverse DNS. RIRs and some DNRs register or expose nameserver information as an attribute of a domain name, while other DNRs model nameservers as "first class objects".
 * @param request request.
 * @return JSON formatted result,with HTTP code.
 * @throws DecodeException DecodeException.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryNameserver(@PathVariable String nsName,HttpServletRequest request) throws DecodeException {
  nsName=queryParser.getLastSplitInURI(request);
  String decodeNS=nsName;
  String punyNSName=decodeNS;
  decodeNS=DomainUtil.urlDecodeAndReplaceAsciiToLowercase(nsName);
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeNS)) {
    return RestResponseUtil.createResponse400();
  }
  decodeNS=StringUtil.foldCaseAndNormalization(decodeNS);
  LOGGER.debug("String_Node_Str",decodeNS);
  try {
    punyNSName=DomainUtil.geneDomainPunyName(decodeNS);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  decodeNS=DomainUtil.deleteLastPoint(decodeNS);
  QueryParam queryParam=queryParser.parseNameserverQueryParam(decodeNS,punyNSName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryNsInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam,nsName);
}

Fixed version (ground truth):
/** 
 * <pre> query nameserver by nameserver name. URI:/nameserver/{nameserver name} This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. </pre>
 * @param nsName represents information regarding DNS name servers used in both forward and reverse DNS. RIRs and some DNRs register or expose nameserver information as an attribute of a domain name, while other DNRs model nameservers as "first class objects".
 * @param request request.
 * @return JSON formatted result,with HTTP code.
 * @throws DecodeException DecodeException.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryNameserver(@PathVariable String nsName,HttpServletRequest request) throws DecodeException {
  nsName=queryParser.getLastSplitInURI(request);
  String decodeNS=nsName;
  String punyNSName=decodeNS;
  decodeNS=DomainUtil.urlDecodeAndReplaceAsciiToLowercase(nsName);
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeNS,false)) {
    return RestResponseUtil.createResponse400();
  }
  decodeNS=StringUtil.foldCaseAndNormalization(decodeNS);
  LOGGER.debug("String_Node_Str",decodeNS);
  try {
    punyNSName=DomainUtil.geneDomainPunyName(decodeNS);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  decodeNS=DomainUtil.deleteLastPoint(decodeNS);
  QueryParam queryParam=queryParser.parseNameserverQueryParam(decodeNS,punyNSName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryNsInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam,nsName);
}