Program: 37264
Project: 37264
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.
 */
@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.urlDecode(nsName);
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeNS)) {
    return RestResponseUtil.createResponse400();
  }
  decodeNS=StringUtil.foldCaseAndNormalization(decodeNS);
  try {
    punyNSName=DomainUtil.geneDomainPunyName(decodeNS);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  LOGGER.debug("String_Node_Str",decodeNS);
  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.urlDecode(nsName);
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeNS)) {
    return RestResponseUtil.createResponse400();
  }
  decodeNS=StringUtil.foldCaseAndNormalization(decodeNS);
  try {
    punyNSName=DomainUtil.geneDomainPunyName(decodeNS);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  LOGGER.debug("String_Node_Str",decodeNS);
  decodeNS=DomainUtil.deleteLastPoint(decodeNS);
  QueryParam queryParam=queryParser.parseNameserverQueryParam(decodeNS,punyNSName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryNsInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam,nsName);
}