nus-yam/ex-repair huggingface dataset:
Program: 37313
Project: 37313
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){
  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.
 */
@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);
}
Program: 37314
Project: 37314
Buggy source:
/** 
 * <pre> query entity. Uri:/entity/{handle}. This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. </pre>
 * @param handle entity handle.
 * @param request HttpServletRequest.
 * @param response HttpServletResponse
 * @return JSON formated result,with HTTP code.
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public ResponseEntity queryEntity(@PathVariable String handle,HttpServletRequest request,HttpServletResponse response){
  LOGGER.debug("String_Node_Str" + handle);
  handle=queryParser.getLastSplitInURI(request);
  handle=StringUtils.trim(handle);
  if (!StringUtil.isValidEntityHandleOrName(handle)) {
    return RestResponseUtil.createResponse400();
  }
  handle=StringUtil.foldCaseAndNormalization(handle);
  Entity result=queryService.queryEntity(queryParser.parseQueryParam(handle));
  if (null != result) {
    if (!accessControlManager.hasPermission(result)) {
      return RestResponseUtil.createResponse403();
    }
    responseDecorator.decorateResponse(result);
    return RestResponseUtil.createResponse200(result);
  }
  return RestResponseUtil.createResponse404();
}

Fixed version (ground truth):
/** 
 * <pre> query entity. Uri:/entity/{handle}. This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. </pre>
 * @param handle entity handle.
 * @param request HttpServletRequest.
 * @param response HttpServletResponse
 * @return JSON formated result,with HTTP code.
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public ResponseEntity queryEntity(@PathVariable String handle,HttpServletRequest request,HttpServletResponse response) throws DecodeException {
  LOGGER.debug("String_Node_Str" + handle);
  handle=queryParser.getLastSplitInURI(request);
  handle=StringUtils.trim(handle);
  if (!StringUtil.isValidEntityHandleOrName(handle)) {
    return RestResponseUtil.createResponse400();
  }
  handle=StringUtil.foldCaseAndNormalization(handle);
  Entity result=queryService.queryEntity(queryParser.parseQueryParam(handle));
  if (null != result) {
    if (!accessControlManager.hasPermission(result)) {
      return RestResponseUtil.createResponse403();
    }
    responseDecorator.decorateResponse(result);
    return RestResponseUtil.createResponse200(result);
  }
  return RestResponseUtil.createResponse404();
}
Program: 37318
Project: 37318
Buggy source:
@Override protected ModelAndView doResolveException(HttpServletRequest request,HttpServletResponse response,Object handler,Exception ex){
  ResponseEntity<ErrorMessage> responseEntity=null;
  LOGGER.error("String_Node_Str",ex);
  if (ex instanceof InvalidMediaTypeException || ex instanceof HttpMediaTypeNotAcceptableException) {
    responseEntity=RestResponseUtil.createResponse415();
  }
 else {
    responseEntity=RestResponseUtil.createResponse500();
  }
  try {
    FilterHelper.writeResponse(responseEntity,response);
  }
 catch (  IOException e) {
    LOGGER.error(e.getMessage());
  }
  return new ModelAndView();
}

Fixed version (ground truth):
@Override protected ModelAndView doResolveException(HttpServletRequest request,HttpServletResponse response,Object handler,Exception ex){
  ResponseEntity<ErrorMessage> responseEntity=null;
  LOGGER.error("String_Node_Str",ex);
  if (ex instanceof DecodeException) {
    responseEntity=RestResponseUtil.createResponse400();
  }
 else   if (ex instanceof InvalidMediaTypeException || ex instanceof HttpMediaTypeNotAcceptableException) {
    responseEntity=RestResponseUtil.createResponse415();
  }
 else {
    responseEntity=RestResponseUtil.createResponse500();
  }
  try {
    FilterHelper.writeResponse(responseEntity,response);
  }
 catch (  IOException e) {
    LOGGER.error(e.getMessage());
  }
  return new ModelAndView();
}
Program: 37319
Project: 37319
Buggy source:
/** 
 * get last split in URI. <p> For spring will ignore ending params, eg: /cnnic.cn%1a. <p> eg: for URI '/domain/cnnic.cn' return 'cnnic.cn'.
 * @param request request.
 * @return param value.
 */
public String getLastSplitInURI(HttpServletRequest request){
  String path=request.getRequestURI();
  String result=StringUtils.substringAfterLast(path,"String_Node_Str");
  result=DomainUtil.urlDecode(result);
  LOGGER.debug("String_Node_Str",result);
  return result;
}

Fixed version (ground truth):
/** 
 * get last split in URI. <p> For spring will ignore ending params, eg: /cnnic.cn%1a. <p> eg: for URI '/domain/cnnic.cn' return 'cnnic.cn'.
 * @param request request.
 * @return param value.
 */
public String getLastSplitInURI(HttpServletRequest request) throws DecodeException {
  String path=request.getRequestURI();
  String result=StringUtils.substringAfterLast(path,"String_Node_Str");
  result=DomainUtil.urlDecode(result);
  LOGGER.debug("String_Node_Str",result);
  return result;
}
Program: 37320
Project: 37320
Buggy source:
@Override protected String getRelativeRequestURI(Command command){
  List<String> argumentList=command.getArgumentList();
  throwExceptionIfArguementIsEmpty(argumentList);
  String argument=argumentList.get(0);
  return "String_Node_Str" + argument;
}

Fixed version (ground truth):
@Override protected String getRelativeRequestURI(Command command){
  List<String> argumentList=command.getArgumentList();
  throwExceptionIfArguementIsEmpty(argumentList);
  String argument=argumentList.get(0);
  return "String_Node_Str" + urlEncode(argument);
}
Program: 37321
Project: 37321
Buggy source:
@Override protected String getRelativeRequestURI(Command command){
  List<String> argumentList=command.getArgumentList();
  throwExceptionIfArguementIsEmpty(argumentList);
  String argument=argumentList.get(0);
  String uri="String_Node_Str" + argument;
  LOGGER.info("String_Node_Str",uri);
  return uri;
}

Fixed version (ground truth):
@Override protected String getRelativeRequestURI(Command command){
  List<String> argumentList=command.getArgumentList();
  throwExceptionIfArguementIsEmpty(argumentList);
  String argument=argumentList.get(0);
  String uri="String_Node_Str" + urlEncode(argument);
  LOGGER.info("String_Node_Str",uri);
  return uri;
}
Program: 37322
Project: 37322
Buggy source:
@Override protected String getRelativeRequestURI(Command command){
  List<String> argumntList=command.getArgumentList();
  throwExceptionIfArguementIsEmpty(argumntList);
  String argument=argumntList.get(0);
  return "String_Node_Str" + argument;
}

Fixed version (ground truth):
@Override protected String getRelativeRequestURI(Command command){
  List<String> argumntList=command.getArgumentList();
  throwExceptionIfArguementIsEmpty(argumntList);
  String argument=argumntList.get(0);
  return "String_Node_Str" + urlEncode(argument);
}
Program: 37323
Project: 37323
Buggy source:
@Override protected String getRelativeRequestURI(Command command){
  List<String> argumentList=command.getArgumentList();
  throwExceptionIfArguementIsEmpty(argumentList);
  String argument=argumentList.get(0);
  return "String_Node_Str" + argument;
}

Fixed version (ground truth):
@Override protected String getRelativeRequestURI(Command command){
  List<String> argumentList=command.getArgumentList();
  throwExceptionIfArguementIsEmpty(argumentList);
  String argument=argumentList.get(0);
  return "String_Node_Str" + urlEncode(argument);
}
Program: 37324
Project: 37324
Buggy source:
@Override protected String getRelativeRequestURI(Command command){
  List<String> argumentList=command.getArgumentList();
  throwExceptionIfArguementIsEmpty(argumentList);
  String uri="String_Node_Str";
  String OPTION_FN=CommandOption.ENTITY_SEARCH_FN.getOption();
  String OPTION_HANDLE=CommandOption.ENTITY_SEARCH_HANDLE.getOption();
  if (isPrefixedArgument(argumentList.get(0),OPTION_FN + PARAM_SEPARATOR)) {
    uri=uri + OPTION_FN + PARAM_SEPARATOR+ removePrefix(argumentList.get(0),OPTION_FN);
  }
 else   if (isPrefixedArgument(argumentList.get(0),OPTION_HANDLE + PARAM_SEPARATOR)) {
    uri=uri + OPTION_HANDLE + PARAM_SEPARATOR+ removePrefix(argumentList.get(0),OPTION_HANDLE);
  }
 else {
    throw new ServiceException("String_Node_Str");
  }
  return uri;
}

Fixed version (ground truth):
@Override protected String getRelativeRequestURI(Command command){
  List<String> argumentList=command.getArgumentList();
  throwExceptionIfArguementIsEmpty(argumentList);
  String uri="String_Node_Str";
  String OPTION_FN=CommandOption.ENTITY_SEARCH_FN.getOption();
  String OPTION_HANDLE=CommandOption.ENTITY_SEARCH_HANDLE.getOption();
  if (isPrefixedArgument(argumentList.get(0),OPTION_FN + PARAM_SEPARATOR)) {
    String argumentWithoutPrefix=removePrefix(argumentList.get(0),OPTION_FN);
    argumentWithoutPrefix=urlEncode(argumentWithoutPrefix);
    uri=uri + OPTION_FN + PARAM_SEPARATOR+ argumentWithoutPrefix;
  }
 else   if (isPrefixedArgument(argumentList.get(0),OPTION_HANDLE + PARAM_SEPARATOR)) {
    String argumentWithoutPrefix=removePrefix(argumentList.get(0),OPTION_HANDLE);
    argumentWithoutPrefix=urlEncode(argumentWithoutPrefix);
    uri=uri + OPTION_HANDLE + PARAM_SEPARATOR+ argumentWithoutPrefix;
  }
 else {
    throw new ServiceException("String_Node_Str");
  }
  return uri;
}
Program: 37325
Project: 37325
Buggy source:
@Override protected String getRelativeRequestURI(Command command){
  List<String> argumentList=command.getArgumentList();
  if (null == argumentList || argumentList.isEmpty()) {
    throw new ServiceException("String_Node_Str");
  }
  if (StringUtils.isBlank(argumentList.get(0))) {
    throw new ServiceException("String_Node_Str");
  }
  return "String_Node_Str" + argumentList.get(0);
}

Fixed version (ground truth):
@Override protected String getRelativeRequestURI(Command command){
  List<String> argumentList=command.getArgumentList();
  if (null == argumentList || argumentList.isEmpty()) {
    throw new ServiceException("String_Node_Str");
  }
  if (StringUtils.isBlank(argumentList.get(0))) {
    throw new ServiceException("String_Node_Str");
  }
  return "String_Node_Str" + urlEncode(argumentList.get(0));
}
Program: 37326
Project: 37326
Buggy source:
@Override protected String getRelativeRequestURI(Command command){
  List<String> argumentList=command.getArgumentList();
  throwExceptionIfArguementIsEmpty(argumentList);
  String argument=argumentList.get(0);
  return "String_Node_Str" + argument;
}

Fixed version (ground truth):
@Override protected String getRelativeRequestURI(Command command){
  List<String> argumentList=command.getArgumentList();
  throwExceptionIfArguementIsEmpty(argumentList);
  String argument=argumentList.get(0);
  return "String_Node_Str" + urlEncode(argument);
}
Program: 37327
Project: 37327
Buggy source:
@Override protected String getRelativeRequestURI(Command command){
  List<String> argumentList=command.getArgumentList();
  throwExceptionIfArguementIsEmpty(argumentList);
  String uri="String_Node_Str";
  String OPTION_IP=CommandOption.NAMESERVER_SEARCH_BY_IP.getOption();
  String OPTION_NAME=CommandOption.NAMESERVER_SEARCH_BY_NAME.getOption();
  if (isPrefixedArgument(argumentList.get(0),OPTION_IP + PARAM_SEPARATOR)) {
    uri=uri + OPTION_IP + "String_Node_Str"+ removePrefix(argumentList.get(0),OPTION_IP);
  }
 else {
    List<String> argumntList=command.getArgumentList();
    throwExceptionIfArguementIsEmpty(argumntList);
    uri=uri + OPTION_NAME + "String_Node_Str"+ argumntList.get(0);
  }
  return uri;
}

Fixed version (ground truth):
@Override protected String getRelativeRequestURI(Command command){
  List<String> argumentList=command.getArgumentList();
  throwExceptionIfArguementIsEmpty(argumentList);
  String uri="String_Node_Str";
  String OPTION_IP=CommandOption.NAMESERVER_SEARCH_BY_IP.getOption();
  String OPTION_NAME=CommandOption.NAMESERVER_SEARCH_BY_NAME.getOption();
  if (isPrefixedArgument(argumentList.get(0),OPTION_IP + PARAM_SEPARATOR)) {
    String argumentWithoutPrefix=removePrefix(argumentList.get(0),OPTION_IP);
    argumentWithoutPrefix=urlEncode(argumentWithoutPrefix);
    uri=uri + OPTION_IP + "String_Node_Str"+ argumentWithoutPrefix;
  }
 else {
    List<String> argumntList=command.getArgumentList();
    throwExceptionIfArguementIsEmpty(argumntList);
    uri=uri + OPTION_NAME + "String_Node_Str"+ urlEncode(argumntList.get(0));
  }
  return uri;
}
Program: 37328
Project: 37328
Buggy source:
/** 
 * decoded url use UTF-8.
 * @param str string.
 * @return String decoded string.
 */
public static String urlDecode(String str){
  if (StringUtils.isBlank(str)) {
    return str;
  }
  String result=str;
  try {
    result=URLDecoder.decode(str,StringUtil.CHAR_SET_UTF8);
  }
 catch (  UnsupportedEncodingException e) {
    LOGGER.error(e.getMessage());
  }
  return result;
}

Fixed version (ground truth):
/** 
 * decoded url use UTF-8.
 * @param str string.
 * @return String decoded string.
 */
public static String urlDecode(String str) throws DecodeException {
  if (StringUtils.isBlank(str)) {
    return str;
  }
  String result=str;
  try {
    result=URLDecoder.decode(str,StringUtil.CHAR_SET_UTF8);
  }
 catch (  UnsupportedEncodingException e) {
    LOGGER.error("String_Node_Str",e);
  }
catch (  Exception e) {
    LOGGER.error("String_Node_Str",e);
    throw new DecodeException("String_Node_Str",e);
  }
  return result;
}
Program: 37329
Project: 37329
Buggy source:
/** 
 * decode,and replace ASCII char to lower case.
 * @param str string.
 * @return str.
 */
@Deprecated public static String decodeAndReplaceAsciiToLowercase(String str){
  if (StringUtils.isBlank(str)) {
    return str;
  }
  str=urlDecode(str);
  LOGGER.debug("String_Node_Str",str);
  StringBuffer asciiLowerCasedSb=new StringBuffer();
  for (int i=0; i < str.length(); i++) {
    int c=str.charAt(i);
    char charVal=str.charAt(i);
    if (c <= MAX_ASCII_CODE) {
      asciiLowerCasedSb.append(StringUtils.lowerCase(String.valueOf(charVal)));
    }
 else {
      asciiLowerCasedSb.append(String.valueOf(charVal));
    }
  }
  return asciiLowerCasedSb.toString();
}

Fixed version (ground truth):
/** 
 * decode,and replace ASCII char to lower case.
 * @param str string.
 * @return str.
 */
@Deprecated public static String decodeAndReplaceAsciiToLowercase(String str) throws DecodeException {
  if (StringUtils.isBlank(str)) {
    return str;
  }
  str=urlDecode(str);
  LOGGER.debug("String_Node_Str",str);
  StringBuffer asciiLowerCasedSb=new StringBuffer();
  for (int i=0; i < str.length(); i++) {
    int c=str.charAt(i);
    char charVal=str.charAt(i);
    if (c <= MAX_ASCII_CODE) {
      asciiLowerCasedSb.append(StringUtils.lowerCase(String.valueOf(charVal)));
    }
 else {
      asciiLowerCasedSb.append(String.valueOf(charVal));
    }
  }
  return asciiLowerCasedSb.toString();
}
Program: 37330
Project: 37330
Buggy source:
/** 
 * <pre> query ip by ip and mask. URI:/ip/{ipAddr}/{mask}  This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. </pre>
 * @param ipAddr the query ip
 * @param mask the ip mask
 * @param request request.
 * @return JSON formatted result,with HTTP code.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryIpWithMask(@PathVariable String ipAddr,@PathVariable String mask,HttpServletRequest request){
  ipAddr=queryParser.getLastSecondSplitInURI(request);
  mask=queryParser.getLastSplitInURI(request);
  return queryIpAddress(ipAddr,mask,ipAddr + "String_Node_Str" + mask);
}

Fixed version (ground truth):
/** 
 * <pre> query ip by ip and mask. URI:/ip/{ipAddr}/{mask}  This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. </pre>
 * @param ipAddr the query ip
 * @param mask the ip mask
 * @param request request.
 * @return JSON formatted result,with HTTP code.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryIpWithMask(@PathVariable String ipAddr,@PathVariable String mask,HttpServletRequest request) throws DecodeException {
  ipAddr=queryParser.getLastSecondSplitInURI(request);
  mask=queryParser.getLastSplitInURI(request);
  return queryIpAddress(ipAddr,mask,ipAddr + "String_Node_Str" + mask);
}
Program: 37331
Project: 37331
Buggy source:
/** 
 * <pre> query ip by ip address. URI:/ip/{ipAddr}  This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. </pre>
 * @param ipAddr the query ip
 * @param request request.
 * @return ResponseEntity
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryIp(@PathVariable String ipAddr,HttpServletRequest request){
  ipAddr=queryParser.getLastSplitInURI(request);
  return queryIpAddress(ipAddr,"String_Node_Str",ipAddr);
}

Fixed version (ground truth):
/** 
 * <pre> query ip by ip address. URI:/ip/{ipAddr}  This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. </pre>
 * @param ipAddr the query ip
 * @param request request.
 * @return ResponseEntity
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryIp(@PathVariable String ipAddr,HttpServletRequest request) throws DecodeException {
  ipAddr=queryParser.getLastSplitInURI(request);
  return queryIpAddress(ipAddr,"String_Node_Str",ipAddr);
}
Program: 37334
Project: 37334
Buggy source:
/** 
 * <pre> Query help. URI:/help. This service is not under permission control. This service is not under policy control. </pre>
 * @param request HttpServletRequest.
 * @param response HttpServletResponse
 * @return JSON formated result,with HTTP code.
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public ResponseEntity queryHelp(HttpServletRequest request,HttpServletResponse response){
  String lastSpliInURI=queryParser.getLastSplitInURI(request);
  if (!"String_Node_Str".equals(lastSpliInURI)) {
    return RestResponseUtil.createResponse400();
  }
  Help result=queryService.queryHelp(queryParser.parseQueryParam("String_Node_Str"));
  if (null != result) {
    responseDecorator.decorateResponseForHelp(result);
    return RestResponseUtil.createResponse200(result);
  }
  return RestResponseUtil.createResponse404();
}

Fixed version (ground truth):
/** 
 * <pre> Query help. URI:/help. This service is not under permission control. This service is not under policy control. </pre>
 * @param request HttpServletRequest.
 * @param response HttpServletResponse
 * @return JSON formated result,with HTTP code.
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public ResponseEntity queryHelp(HttpServletRequest request,HttpServletResponse response) throws DecodeException {
  String lastSpliInURI=queryParser.getLastSplitInURI(request);
  if (!"String_Node_Str".equals(lastSpliInURI)) {
    return RestResponseUtil.createResponse400();
  }
  Help result=queryService.queryHelp(queryParser.parseQueryParam("String_Node_Str"));
  if (null != result) {
    responseDecorator.decorateResponseForHelp(result);
    return RestResponseUtil.createResponse200(result);
  }
  return RestResponseUtil.createResponse404();
}
Program: 37335
Project: 37335
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){
  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.
 */
@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);
}
Program: 37336
Project: 37336
Buggy source:
/** 
 * <pre> query entity. Uri:/entity/{handle}. This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. </pre>
 * @param handle entity handle.
 * @param request HttpServletRequest.
 * @param response HttpServletResponse
 * @return JSON formated result,with HTTP code.
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public ResponseEntity queryEntity(@PathVariable String handle,HttpServletRequest request,HttpServletResponse response){
  LOGGER.debug("String_Node_Str" + handle);
  handle=queryParser.getLastSplitInURI(request);
  handle=StringUtils.trim(handle);
  if (!StringUtil.isValidEntityHandleOrName(handle)) {
    return RestResponseUtil.createResponse400();
  }
  handle=StringUtil.foldCaseAndNormalization(handle);
  Entity result=queryService.queryEntity(queryParser.parseQueryParam(handle));
  if (null != result) {
    if (!accessControlManager.hasPermission(result)) {
      return RestResponseUtil.createResponse403();
    }
    responseDecorator.decorateResponse(result);
    return RestResponseUtil.createResponse200(result);
  }
  return RestResponseUtil.createResponse404();
}

Fixed version (ground truth):
/** 
 * <pre> query entity. Uri:/entity/{handle}. This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. </pre>
 * @param handle entity handle.
 * @param request HttpServletRequest.
 * @param response HttpServletResponse
 * @return JSON formated result,with HTTP code.
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public ResponseEntity queryEntity(@PathVariable String handle,HttpServletRequest request,HttpServletResponse response) throws DecodeException {
  LOGGER.debug("String_Node_Str" + handle);
  handle=queryParser.getLastSplitInURI(request);
  handle=StringUtils.trim(handle);
  if (!StringUtil.isValidEntityHandleOrName(handle)) {
    return RestResponseUtil.createResponse400();
  }
  handle=StringUtil.foldCaseAndNormalization(handle);
  Entity result=queryService.queryEntity(queryParser.parseQueryParam(handle));
  if (null != result) {
    if (!accessControlManager.hasPermission(result)) {
      return RestResponseUtil.createResponse403();
    }
    responseDecorator.decorateResponse(result);
    return RestResponseUtil.createResponse200(result);
  }
  return RestResponseUtil.createResponse404();
}
Program: 37340
Project: 37340
Buggy source:
@Override protected ModelAndView doResolveException(HttpServletRequest request,HttpServletResponse response,Object handler,Exception ex){
  ResponseEntity<ErrorMessage> responseEntity=null;
  LOGGER.error("String_Node_Str",ex);
  if (ex instanceof InvalidMediaTypeException || ex instanceof HttpMediaTypeNotAcceptableException) {
    responseEntity=RestResponseUtil.createResponse415();
  }
 else {
    responseEntity=RestResponseUtil.createResponse500();
  }
  try {
    FilterHelper.writeResponse(responseEntity,response);
  }
 catch (  IOException e) {
    LOGGER.error(e.getMessage());
  }
  return new ModelAndView();
}

Fixed version (ground truth):
@Override protected ModelAndView doResolveException(HttpServletRequest request,HttpServletResponse response,Object handler,Exception ex){
  ResponseEntity<ErrorMessage> responseEntity=null;
  LOGGER.error("String_Node_Str",ex);
  if (ex instanceof DecodeException) {
    responseEntity=RestResponseUtil.createResponse400();
  }
 else   if (ex instanceof InvalidMediaTypeException || ex instanceof HttpMediaTypeNotAcceptableException) {
    responseEntity=RestResponseUtil.createResponse415();
  }
 else {
    responseEntity=RestResponseUtil.createResponse500();
  }
  try {
    FilterHelper.writeResponse(responseEntity,response);
  }
 catch (  IOException e) {
    LOGGER.error(e.getMessage());
  }
  return new ModelAndView();
}
Program: 37341
Project: 37341
Buggy source:
/** 
 * get last split in URI. <p> For spring will ignore ending params, eg: /cnnic.cn%1a. <p> eg: for URI '/domain/cnnic.cn' return 'cnnic.cn'.
 * @param request request.
 * @return param value.
 */
public String getLastSplitInURI(HttpServletRequest request){
  String path=request.getRequestURI();
  String result=StringUtils.substringAfterLast(path,"String_Node_Str");
  result=DomainUtil.urlDecode(result);
  LOGGER.debug("String_Node_Str",result);
  return result;
}

Fixed version (ground truth):
/** 
 * get last split in URI. <p> For spring will ignore ending params, eg: /cnnic.cn%1a. <p> eg: for URI '/domain/cnnic.cn' return 'cnnic.cn'.
 * @param request request.
 * @return param value.
 */
public String getLastSplitInURI(HttpServletRequest request) throws DecodeException {
  String path=request.getRequestURI();
  String result=StringUtils.substringAfterLast(path,"String_Node_Str");
  result=DomainUtil.urlDecode(result);
  LOGGER.debug("String_Node_Str",result);
  return result;
}
Program: 37342
Project: 37342
Buggy source:
@Override public void initChannel(SocketChannel ch) throws Exception {
  ChannelPipeline pipeline=ch.pipeline();
  pipeline.addLast(DELIMITER_BASED_FRAME_DECODER);
  pipeline.addLast(DECODER);
  pipeline.addLast(ENCODER);
  pipeline.addLast(MANAGE_HANDLER);
}

Fixed version (ground truth):
@Override public void initChannel(SocketChannel ch) throws Exception {
  ChannelPipeline pipeline=ch.pipeline();
  pipeline.addLast(new DelimiterBasedFrameDecoder(8192,Delimiters.lineDelimiter()));
  pipeline.addLast(DECODER);
  pipeline.addLast(ENCODER);
  pipeline.addLast(MANAGE_HANDLER);
}
Program: 37343
Project: 37343
Buggy source:
@Override public void initChannel(SocketChannel ch) throws Exception {
  ChannelPipeline pipeline=ch.pipeline();
  pipeline.addLast(DELIMITER_BASED_FRAME_DECODER);
  pipeline.addLast(DECODER);
  pipeline.addLast(ENCODER);
  pipeline.addLast(SERVICE_HANDLER);
}

Fixed version (ground truth):
@Override public void initChannel(SocketChannel ch) throws Exception {
  ChannelPipeline pipeline=ch.pipeline();
  pipeline.addLast(new DelimiterBasedFrameDecoder(8192,Delimiters.lineDelimiter()));
  pipeline.addLast(DECODER);
  pipeline.addLast(ENCODER);
  pipeline.addLast(SERVICE_HANDLER);
}
Program: 37344
Project: 37344
Buggy source:
@Override public void initChannel(SocketChannel ch) throws Exception {
  ChannelPipeline p=ch.pipeline();
  p.addLast(new LoggingHandler(LogLevel.INFO));
  p.addLast(ManageServerInitializer.DELIMITER_BASED_FRAME_DECODER);
  p.addLast(ManageServerInitializer.DECODER);
  p.addLast(ManageServerInitializer.ENCODER);
  p.addLast(new ShutdownClientHandler());
}

Fixed version (ground truth):
@Override public void initChannel(SocketChannel ch) throws Exception {
  ChannelPipeline p=ch.pipeline();
  p.addLast(new LoggingHandler(LogLevel.INFO));
  p.addLast(new DelimiterBasedFrameDecoder(8192,Delimiters.lineDelimiter()));
  p.addLast(ManageServerInitializer.DECODER);
  p.addLast(ManageServerInitializer.ENCODER);
  p.addLast(new ShutdownClientHandler());
}
Program: 37345
Project: 37345
Buggy source:
/** 
 * shutdown.
 * @throws InterruptedException InterruptedException.
 */
public static void shutdown() throws InterruptedException {
  Bootstrap boot=new Bootstrap();
  boot.group(EVENT_GROUP).channel(NioSocketChannel.class).option(ChannelOption.TCP_NODELAY,true).handler(new ChannelInitializer<SocketChannel>(){
    @Override public void initChannel(    SocketChannel ch) throws Exception {
      ChannelPipeline p=ch.pipeline();
      p.addLast(new LoggingHandler(LogLevel.INFO));
      p.addLast(ManageServerInitializer.DELIMITER_BASED_FRAME_DECODER);
      p.addLast(ManageServerInitializer.DECODER);
      p.addLast(ManageServerInitializer.ENCODER);
      p.addLast(new ShutdownClientHandler());
    }
  }
);
  channelFuture=boot.connect(HOST,MANAGE_PORT).sync();
}

Fixed version (ground truth):
/** 
 * shutdown.
 * @throws InterruptedException InterruptedException.
 */
public static void shutdown() throws InterruptedException {
  Bootstrap boot=new Bootstrap();
  boot.group(EVENT_GROUP).channel(NioSocketChannel.class).option(ChannelOption.TCP_NODELAY,true).handler(new ChannelInitializer<SocketChannel>(){
    @Override public void initChannel(    SocketChannel ch) throws Exception {
      ChannelPipeline p=ch.pipeline();
      p.addLast(new LoggingHandler(LogLevel.INFO));
      p.addLast(new DelimiterBasedFrameDecoder(8192,Delimiters.lineDelimiter()));
      p.addLast(ManageServerInitializer.DECODER);
      p.addLast(ManageServerInitializer.ENCODER);
      p.addLast(new ShutdownClientHandler());
    }
  }
);
  channelFuture=boot.connect(HOST,MANAGE_PORT).sync();
}
Program: 37346
Project: 37346
Buggy source:
@Test public void testGetProp(){
  assertNotNull(RdapProperties.getMinSecondsAccessInterval());
  assertNotNull(RdapProperties.getPort());
  assertNotNull(RdapProperties.getRdapServerBaseUrl());
  assertNotNull(RdapProperties.getResponseFormater());
}

Fixed version (ground truth):
@Test public void testGetProp(){
  assertNotNull(RdapProperties.getMinSecondsAccessInterval());
  assertNotNull(RdapProperties.getServicePort());
  assertNotNull(RdapProperties.getManagePort());
  assertNotNull(RdapProperties.getRdapServerBaseUrl());
  assertNotNull(RdapProperties.getResponseFormater());
}
Program: 37347
Project: 37347
Buggy source:
/** 
 * test exceedRateLimit.
 * @throws InterruptedException InterruptedException.
 */
@Test public void testExceedRateLimit() throws InterruptedException {
  String clientIp="String_Node_Str";
  RdapProperties prop=new RdapProperties();
  ReflectionTestUtils.setField(prop,"String_Node_Str",1L);
  assertFalse(ConnectionControlService.exceedRateLimit(null));
  assertFalse(ConnectionControlService.exceedRateLimit("String_Node_Str"));
  assertFalse(ConnectionControlService.exceedRateLimit(clientIp));
  Thread.sleep(2);
  assertFalse(ConnectionControlService.exceedRateLimit(clientIp));
  ReflectionTestUtils.setField(prop,"String_Node_Str",1000L);
  assertTrue(ConnectionControlService.exceedRateLimit(clientIp));
}

Fixed version (ground truth):
/** 
 * test exceedRateLimit.
 * @throws InterruptedException InterruptedException.
 */
@Test public void testExceedRateLimit() throws InterruptedException {
  String clientIp="String_Node_Str";
  RdapProperties prop=new RdapProperties();
  ReflectionTestUtils.setField(prop,"String_Node_Str",1L);
  assertFalse(ConnectionControlService.exceedRateLimit(null));
  assertFalse(ConnectionControlService.exceedRateLimit("String_Node_Str"));
  assertFalse(ConnectionControlService.exceedRateLimit(clientIp));
  Thread.sleep(2);
  assertFalse(ConnectionControlService.exceedRateLimit(clientIp));
  ReflectionTestUtils.setField(prop,"String_Node_Str",1000L);
}
Program: 37348
Project: 37348
Buggy source:
/** 
 * format object.
 * @param key key.
 * @param object object.
 * @param result result.
 */
public void formatObject(String key,Object object,StringBuffer result){
  if ("String_Node_Str".equals(key)) {
    result.append(MAX_INDENTS,0,getDepth());
    String displayValue=getTextFormatedVcardStr(object);
    String replacement=StringUtils.substring(MAX_INDENTS,0,getDepth() + 1);
    displayValue=LINE_SEPARATOR + displayValue;
    displayValue=StringUtils.removeEnd(displayValue,LINE_SEPARATOR);
    displayValue=StringUtils.replace(displayValue,LINE_SEPARATOR,LINE_SEPARATOR + replacement);
    result.append(key);
    result.append(KEY_VALUE_SEPARATOR);
    result.append(displayValue);
    result.append(LINE_SEPARATOR);
  }
 else   if (object instanceof String) {
    result.append(MAX_INDENTS,0,getDepth());
    result.append(key);
    result.append(KEY_VALUE_SEPARATOR);
    result.append(object);
    result.append(LINE_SEPARATOR);
  }
 else   if (object instanceof Map) {
    result.append(MAX_INDENTS,0,getDepth());
    result.append(key);
    result.append(KEY_VALUE_SEPARATOR);
    result.append(LINE_SEPARATOR);
    depth.get().increment();
    formatMap((Map)object,result);
    depth.get().decrement();
  }
 else   if (object instanceof List) {
    formatList(key,(List)object,result);
  }
}

Fixed version (ground truth):
/** 
 * format object.
 * @param key key.
 * @param object object.
 * @param result result.
 */
public void formatObject(String key,Object object,StringBuffer result){
  if ("String_Node_Str".equals(key)) {
    result.append(MAX_INDENTS,0,getDepth());
    String displayValue=getTextFormatedVcardStr(object);
    String replacement=StringUtils.substring(MAX_INDENTS,0,getDepth() + 1);
    displayValue=LINE_SEPARATOR + displayValue;
    displayValue=StringUtils.removeEnd(displayValue,LINE_SEPARATOR);
    displayValue=StringUtils.replace(displayValue,LINE_SEPARATOR,LINE_SEPARATOR + replacement);
    result.append(key);
    result.append(KEY_VALUE_SEPARATOR);
    result.append(displayValue);
    result.append(LINE_SEPARATOR);
  }
 else   if (object instanceof Map) {
    result.append(MAX_INDENTS,0,getDepth());
    result.append(key);
    result.append(KEY_VALUE_SEPARATOR);
    result.append(LINE_SEPARATOR);
    depth.get().increment();
    formatMap((Map)object,result);
    depth.get().decrement();
  }
 else   if (object instanceof List) {
    formatList(key,(List)object,result);
  }
 else {
    result.append(MAX_INDENTS,0,getDepth());
    result.append(key);
    result.append(KEY_VALUE_SEPARATOR);
    result.append(object);
    result.append(LINE_SEPARATOR);
  }
}
Program: 37349
Project: 37349
Buggy source:
/** 
 * check if decodeUri contain non-ascii-printable chars.
 * @param decodeUri decodeUri
 * @return true if contains,false if not.
 */
public static boolean containNonAsciiPrintableChars(String decodeUri){
  if (StringUtils.isBlank(decodeUri)) {
    return false;
  }
  return !StringUtils.isAsciiPrintable(decodeUri);
}

Fixed version (ground truth):
/** 
 * check if decodeUri contain non-ASCII-printable chars.
 * @param decodeUri decodeUri
 * @return true if contains,false if not.
 */
public static boolean containNonAsciiPrintableChars(String decodeUri){
  if (StringUtils.isBlank(decodeUri)) {
    return false;
  }
  return !StringUtils.isAsciiPrintable(decodeUri);
}
Program: 37350
Project: 37350
Buggy source:
/** 
 * do pre process request method.
 * @param request request.
 * @param response response.
 * @throws Exception Exception.
 * @return true if success processed,and can do service operation; false ifnot.
 */
@Override public boolean preProcess(HttpServletRequest request,HttpServletResponse response) throws Exception {
  boolean httpMethodIsValid=httpMethodIsValid(request);
  if (!httpMethodIsValid) {
    ResponseEntity<ErrorMessage> responseEntity=RestResponseUtil.createResponse405();
    FilterHelper.writeResponse(responseEntity,response);
    return false;
  }
  boolean contentTypeIsValid=contentTypeIsValid(request);
  if (!contentTypeIsValid) {
    ResponseEntity<ErrorMessage> responseEntity=RestResponseUtil.createResponse415();
    FilterHelper.writeResponse(responseEntity,response);
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * do pre process request method.
 * @param request request.
 * @param response response.
 * @throws Exception Exception.
 * @return true if success processed,and can do service operation; false ifnot.
 */
@Override public boolean preProcess(HttpServletRequest request,HttpServletResponse response) throws Exception {
  boolean httpMethodIsValid=httpMethodIsValid(request);
  LOGGER.debug("String_Node_Str",httpMethodIsValid);
  if (!httpMethodIsValid) {
    ResponseEntity<ErrorMessage> responseEntity=RestResponseUtil.createResponse405();
    FilterHelper.writeResponse(responseEntity,response);
    return false;
  }
  boolean mediaTypeIsValid=mediaTypeIsValid(request);
  LOGGER.debug("String_Node_Str",mediaTypeIsValid);
  if (!mediaTypeIsValid) {
    ResponseEntity<ErrorMessage> responseEntity=RestResponseUtil.createResponse415();
    FilterHelper.writeResponse(responseEntity,response);
    return false;
  }
  return true;
}
Program: 37351
Project: 37351
Buggy source:
@Override protected ModelAndView doResolveException(HttpServletRequest request,HttpServletResponse response,Object handler,Exception ex){
  ResponseEntity<ErrorMessage> responseEntity=null;
  LOGGER.error("String_Node_Str",ex);
  if (ex instanceof InvalidMediaTypeException) {
    responseEntity=RestResponseUtil.createResponse415();
  }
 else {
    responseEntity=RestResponseUtil.createResponse500();
  }
  try {
    FilterHelper.writeResponse(responseEntity,response);
  }
 catch (  IOException e) {
    LOGGER.error(e.getMessage());
  }
  return new ModelAndView();
}

Fixed version (ground truth):
@Override protected ModelAndView doResolveException(HttpServletRequest request,HttpServletResponse response,Object handler,Exception ex){
  ResponseEntity<ErrorMessage> responseEntity=null;
  LOGGER.error("String_Node_Str",ex);
  if (ex instanceof InvalidMediaTypeException || ex instanceof HttpMediaTypeNotAcceptableException) {
    responseEntity=RestResponseUtil.createResponse415();
  }
 else {
    responseEntity=RestResponseUtil.createResponse500();
  }
  try {
    FilterHelper.writeResponse(responseEntity,response);
  }
 catch (  IOException e) {
    LOGGER.error(e.getMessage());
  }
  return new ModelAndView();
}
Program: 37352
Project: 37352
Buggy source:
/** 
 * check if content type is valid.
 * @param request HttpServletRequest
 * @return true if valid, false if not
 */
private boolean contentTypeIsValid(HttpServletRequest request){
  String acceptHeader=request.getHeader("String_Node_Str");
  if (StringUtils.isBlank(acceptHeader)) {
    return true;
  }
  if (VALID_CONTENT_TYPE.equals(acceptHeader) || acceptHeader.startsWith(VALID_CONTENT_TYPE + "String_Node_Str")) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * check if content type is valid.
 * @param request HttpServletRequest
 * @return true if valid, false if not
 */
private boolean contentTypeIsValid(HttpServletRequest request){
  String acceptHeader=request.getHeader("String_Node_Str");
  if (StringUtils.isBlank(acceptHeader)) {
    return true;
  }
  if (VALID_CONTENT_TYPE.equals(acceptHeader) || acceptHeader.startsWith(VALID_CONTENT_TYPE + "String_Node_Str") || acceptHeader.startsWith(VALID_CONTENT_TYPE + "String_Node_Str")|| acceptHeader.contains("String_Node_Str" + VALID_CONTENT_TYPE + "String_Node_Str")|| acceptHeader.endsWith("String_Node_Str" + VALID_CONTENT_TYPE)) {
    return true;
  }
  return false;
}
Program: 37353
Project: 37353
Buggy source:
/** 
 * get name.
 * @return name.
 */
public String getName(){
  return name;
}

Fixed version (ground truth):
/** 
 * get name.
 * @return name.
 */
@JsonValue public String getName(){
  return name;
}
Program: 37355
Project: 37355
Buggy source:
/** 
 * decoded url use UTF-8.
 * @param str string.
 * @return String decoded string.
 */
private static String urlDecode(String str){
  if (StringUtils.isBlank(str)) {
    return str;
  }
  String result=str;
  try {
    result=URLDecoder.decode(str,StringUtil.CHAR_SET_UTF8);
  }
 catch (  UnsupportedEncodingException e) {
    LOGGER.error(e.getMessage());
  }
  return result;
}

Fixed version (ground truth):
/** 
 * decoded url use UTF-8.
 * @param str string.
 * @return String decoded string.
 */
public static String urlDecode(String str){
  if (StringUtils.isBlank(str)) {
    return str;
  }
  String result=str;
  try {
    result=URLDecoder.decode(str,StringUtil.CHAR_SET_UTF8);
  }
 catch (  UnsupportedEncodingException e) {
    LOGGER.error(e.getMessage());
  }
  return result;
}
Program: 37359
Project: 37359
Buggy source:
/** 
 * get last split in URI. <p> For spring will ignore ending params, eg: /cnnic.cn%1a. <p> eg: for URI '/domain/cnnic.cn' return 'cnnic.cn'.
 * @param request request.
 * @return param value.
 */
public String getLastSplitInURI(HttpServletRequest request){
  String path=request.getRequestURI();
  String result=StringUtils.substringAfterLast(path,"String_Node_Str");
  LOGGER.debug("String_Node_Str",result);
  return result;
}

Fixed version (ground truth):
/** 
 * get last split in URI. <p> For spring will ignore ending params, eg: /cnnic.cn%1a. <p> eg: for URI '/domain/cnnic.cn' return 'cnnic.cn'.
 * @param request request.
 * @return param value.
 */
public String getLastSplitInURI(HttpServletRequest request){
  String path=request.getRequestURI();
  String result=StringUtils.substringAfterLast(path,"String_Node_Str");
  result=DomainUtil.urlDecode(result);
  LOGGER.debug("String_Node_Str",result);
  return result;
}
Program: 37360
Project: 37360
Buggy source:
/** 
 * <pre> query ip by ip and mask. URI:/ip/{ipAddr}/{mask}  This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. <pre>
 * @param ipAddr the query ip
 * @param mask the ip mask
 * @return JSON formatted result,with HTTP code.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryIpWithMask(@PathVariable String ipAddr,@PathVariable String mask,HttpServletRequest request){
  ipAddr=queryParser.getLastSecondSplitInURI(request);
  mask=queryParser.getLastSplitInURI(request);
  return queryIpAddress(ipAddr,mask,ipAddr + "String_Node_Str" + mask);
}

Fixed version (ground truth):
/** 
 * <pre> query ip by ip and mask. URI:/ip/{ipAddr}/{mask}  This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. </pre>
 * @param ipAddr the query ip
 * @param mask the ip mask
 * @param request request.
 * @return JSON formatted result,with HTTP code.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryIpWithMask(@PathVariable String ipAddr,@PathVariable String mask,HttpServletRequest request){
  ipAddr=queryParser.getLastSecondSplitInURI(request);
  mask=queryParser.getLastSplitInURI(request);
  return queryIpAddress(ipAddr,mask,ipAddr + "String_Node_Str" + mask);
}
Program: 37361
Project: 37361
Buggy source:
/** 
 * <pre> query ip by ip address. URI:/ip/{ipAddr}  This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. <pre>
 * @param ipAddr the query ip
 * @return ResponseEntity
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryIp(@PathVariable String ipAddr,HttpServletRequest request){
  ipAddr=queryParser.getLastSplitInURI(request);
  return queryIpAddress(ipAddr,"String_Node_Str",ipAddr);
}

Fixed version (ground truth):
/** 
 * <pre> query ip by ip address. URI:/ip/{ipAddr}  This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. </pre>
 * @param ipAddr the query ip
 * @param request request.
 * @return ResponseEntity
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryIp(@PathVariable String ipAddr,HttpServletRequest request){
  ipAddr=queryParser.getLastSplitInURI(request);
  return queryIpAddress(ipAddr,"String_Node_Str",ipAddr);
}