nus-yam/ex-repair huggingface dataset:
Program: 37419
Project: 37419
Buggy source:
@Override public void doFilter(ServletRequest arg0,ServletResponse arg1,FilterChain chain) throws IOException, ServletException {
  LOGGER.debug("String_Node_Str");
  HttpServletRequest request=(HttpServletRequest)arg0;
  HttpServletResponse response=(HttpServletResponse)arg1;
  boolean success=preProcess(request,response);
  LOGGER.debug("String_Node_Str",success);
  if (!success) {
    LOGGER.error("String_Node_Str");
    return;
  }
  chain.doFilter(request,response);
  LOGGER.debug("String_Node_Str");
  success=postProcess(request,response);
  LOGGER.debug("String_Node_Str",success);
}

Fixed version (ground truth):
@Override public void doFilter(ServletRequest arg0,ServletResponse arg1,FilterChain chain) throws IOException, ServletException {
  LOGGER.debug("String_Node_Str");
  HttpServletRequest request=(HttpServletRequest)arg0;
  HttpServletResponse response=(HttpServletResponse)arg1;
  if (ConnectionControlService.incrementConcurrentQCountAndCheckIfExceedMax()) {
    writeError509Response(response);
    ConnectionControlService.decrementAndGetCurrentQueryCount();
    return;
  }
  boolean success=preProcess(request,response);
  LOGGER.debug("String_Node_Str",success);
  if (!success) {
    LOGGER.error("String_Node_Str");
    ConnectionControlService.decrementAndGetCurrentQueryCount();
    return;
  }
  try {
    chain.doFilter(request,response);
  }
 catch (  Exception e) {
    LOGGER.error("String_Node_Str" + e.getMessage());
  }
  LOGGER.debug("String_Node_Str");
  success=postProcess(request,response);
  LOGGER.debug("String_Node_Str",success);
  ConnectionControlService.decrementAndGetCurrentQueryCount();
}
Program: 37420
Project: 37420
Buggy source:
/** 
 * handle exception.
 */
@Override protected ModelAndView doResolveException(HttpServletRequest request,HttpServletResponse response,Object handler,Exception ex){
  ResponseEntity<ErrorMessage> responseEntity=null;
  if (ex instanceof InvalidMediaTypeException) {
    responseEntity=RestResponseUtil.createResponse415();
  }
  responseEntity=RestResponseUtil.createResponse500();
  try {
    FilterHelper.writeResponse(responseEntity,response);
  }
 catch (  IOException e) {
    LOGGER.error(e.getMessage());
  }
  return new ModelAndView();
}

Fixed version (ground truth):
/** 
 * handle exception.
 */
@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();
  }
  responseEntity=RestResponseUtil.createResponse500();
  try {
    FilterHelper.writeResponse(responseEntity,response);
  }
 catch (  IOException e) {
    LOGGER.error(e.getMessage());
  }
  return new ModelAndView();
}
Program: 37421
Project: 37421
Buggy source:
@Override public boolean postProcess(HttpServletRequest request,HttpServletResponse response) throws Exception {
  ConnectionControlService.decrementAndGetCurrentQueryCount();
  return true;
}

Fixed version (ground truth):
@Override public boolean postProcess(HttpServletRequest request,HttpServletResponse response) throws Exception {
  return true;
}
Program: 37422
Project: 37422
Buggy source:
/** 
 * get Model String.
 * @param objModel the model of object.
 * @return string of object type.
 */
private String getModelString(final Object objModel){
  String strObjType=null;
  ModelType modelType=((BaseModel)objModel).getObjectType();
  strObjType=modelType.getName();
  return strObjType;
}

Fixed version (ground truth):
/** 
 * get Model String.
 * @param objModel the model of object.
 * @return string of object type.
 */
private String getModelString(final Object objModel){
  String strObjType=null;
  ModelType modelType=((BaseModel)objModel).getObjectType();
  strObjType=modelType.getName();
  if (strObjType == "String_Node_Str") {
    return null;
  }
  return strObjType;
}
Program: 37423
Project: 37423
Buggy source:
/** 
 * decode,and replace ASCII char to lower case.
 * @param str string.
 * @return str.
 */
public static String decodeAndReplaceAsciiToLowercase(String str){
  if (StringUtils.isBlank(str)) {
    return str;
  }
  str=urlDecode(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.
 */
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();
}
Program: 37424
Project: 37424
Buggy source:
/** 
 * validate domain search string represent a valid IDNA domain.
 * @param searchString domain or name server string.
 * @return true if is valid IDNA2008 domain, false if not.
 */
public static boolean validateSearchStringIsValidIdna(String searchString){
  if (StringUtils.isBlank(searchString)) {
    return false;
  }
  if (searchString.contains(BLANK_IN_DOMAIN)) {
    return false;
  }
  if (1 < StringUtils.countMatches(searchString,StringUtil.ASTERISK)) {
    return false;
  }
  String domainName=searchString.replace(StringUtil.ASTERISK,"String_Node_Str");
  if (validateDomainNameIsValidIdna(domainName)) {
    return true;
  }
  domainName=searchString.replace(StringUtil.ASTERISK,StringUtil.TLD_SPLITOR);
  if (validateDomainNameIsValidIdna(domainName)) {
    return true;
  }
  domainName=searchString.replace(StringUtil.ASTERISK,"String_Node_Str");
  if (validateDomainNameIsValidIdna(domainName)) {
    return true;
  }
  domainName=searchString.replace("String_Node_Str","String_Node_Str");
  if (validateDomainNameIsValidIdna(domainName)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * validate domain search string represent a valid IDNA domain.
 * @param searchString domain or name server string.
 * @return true if is valid IDNA2008 domain, false if not.
 */
public static boolean validateSearchStringIsValidIdna(String searchString){
  if (StringUtils.isBlank(searchString)) {
    return false;
  }
  if (searchString.contains(BLANK_IN_DOMAIN)) {
    return false;
  }
  if (1 < StringUtils.countMatches(searchString,StringUtil.ASTERISK)) {
    return false;
  }
  String domainName=searchString.replace(StringUtil.ASTERISK,"String_Node_Str");
  if (validateDomainNameIsValidIdna(domainName)) {
    return true;
  }
  domainName=searchString.replace(StringUtil.ASTERISK,StringUtil.TLD_SPLITOR);
  if (validateDomainNameIsValidIdna(domainName)) {
    return true;
  }
  domainName=searchString.replace(StringUtil.ASTERISK,"String_Node_Str");
  if (validateDomainNameIsValidIdna(domainName)) {
    return true;
  }
  domainName=searchString.replace("String_Node_Str","String_Node_Str");
  if (validateDomainNameIsValidIdna(domainName)) {
    return true;
  }
  domainName=searchString.replace("String_Node_Str","String_Node_Str");
  if (validateDomainNameIsValidIdna(domainName)) {
    return true;
  }
  return false;
}
Program: 37427
Project: 37427
Buggy source:
/** 
 * query nameserver by nameserver name.
 * @param nameserverName 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".
 * @return JSON formatted result,with HTTP code.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryNameserver(@PathVariable String nameserverName){
  String decodeNS=nameserverName;
  String punyNSName=decodeNS;
  try {
    decodeNS=DomainUtil.decodeAndReplaceAsciiToLowercase(nameserverName);
    punyNSName=DomainUtil.geneDomainPunyName(decodeNS);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeNS)) {
    return RestResponseUtil.createResponse400();
  }
  decodeNS=DomainUtil.deleteLastPoint(decodeNS);
  decodeNS=StringUtils.lowerCase(decodeNS);
  QueryParam queryParam=queryParser.parseNameserverQueryParam(decodeNS,punyNSName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryNsInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam,nameserverName);
}

Fixed version (ground truth):
/** 
 * query nameserver by nameserver name.
 * @param nameserverName 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".
 * @return JSON formatted result,with HTTP code.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryNameserver(@PathVariable String nameserverName){
  String decodeNS=nameserverName;
  String punyNSName=decodeNS;
  try {
    decodeNS=DomainUtil.decodeAndReplaceAsciiToLowercase(nameserverName);
    punyNSName=DomainUtil.geneDomainPunyName(decodeNS);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeNS)) {
    return RestResponseUtil.createResponse400();
  }
  decodeNS=StringUtil.getNormalization(decodeNS);
  LOGGER.debug("String_Node_Str",decodeNS);
  decodeNS=DomainUtil.deleteLastPoint(decodeNS);
  decodeNS=StringUtils.lowerCase(decodeNS);
  QueryParam queryParam=queryParser.parseNameserverQueryParam(decodeNS,punyNSName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryNsInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam,nameserverName);
}
Program: 37428
Project: 37428
Buggy source:
/** 
 * query domain by domain name.
 * @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).
 * @return JSON formated result,with HTTP code.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryDomain(@PathVariable String domainName){
  String decodeDomain=domainName;
  String punyDomainName=decodeDomain;
  try {
    decodeDomain=DomainUtil.decodeAndReplaceAsciiToLowercase(domainName);
    punyDomainName=DomainUtil.geneDomainPunyName(decodeDomain);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeDomain)) {
    return RestResponseUtil.createResponse400();
  }
  decodeDomain=DomainUtil.deleteLastPoint(decodeDomain);
  decodeDomain=StringUtils.lowerCase(decodeDomain);
  QueryParam queryParam=queryParser.parseDomainQueryParam(decodeDomain,punyDomainName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryDomainInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam,domainName);
}

Fixed version (ground truth):
/** 
 * query domain by domain name.
 * @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).
 * @return JSON formated result,with HTTP code.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryDomain(@PathVariable String domainName){
  String decodeDomain=domainName;
  String punyDomainName=decodeDomain;
  try {
    decodeDomain=DomainUtil.decodeAndReplaceAsciiToLowercase(domainName);
    punyDomainName=DomainUtil.geneDomainPunyName(decodeDomain);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeDomain)) {
    return RestResponseUtil.createResponse400();
  }
  decodeDomain=StringUtil.getNormalization(decodeDomain);
  LOGGER.debug("String_Node_Str",decodeDomain);
  decodeDomain=DomainUtil.deleteLastPoint(decodeDomain);
  decodeDomain=StringUtils.lowerCase(decodeDomain);
  QueryParam queryParam=queryParser.parseDomainQueryParam(decodeDomain,punyDomainName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryDomainInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam,domainName);
}
Program: 37429
Project: 37429
Buggy source:
/** 
 * query arpa, without inner objects.
 * @param queryParam query parameter
 * @return domain
 */
private Domain queryDomainWithoutInnerObjects(QueryParam queryParam){
  DomainQueryParam domainQueryParam=(DomainQueryParam)queryParam;
  final String punyName=domainQueryParam.getPunyName();
  final String sql="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str";
  List<Domain> result=jdbcTemplate.query(new PreparedStatementCreator(){
    @Override public PreparedStatement createPreparedStatement(    Connection connection) throws SQLException {
      PreparedStatement ps=connection.prepareStatement(sql);
      ps.setString(1,punyName);
      return ps;
    }
  }
,new DomainWithStatusResultSetExtractor());
  if (null == result || result.size() == 0) {
    return null;
  }
  return result.get(0);
}

Fixed version (ground truth):
/** 
 * query arpa, without inner objects.
 * @param queryParam query parameter
 * @return domain
 */
private Domain queryDomainWithoutInnerObjects(QueryParam queryParam){
  DomainQueryParam domainQueryParam=(DomainQueryParam)queryParam;
  final String punyName=domainQueryParam.getPunyName();
  LOGGER.debug("String_Node_Str",punyName);
  final String sql="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str";
  List<Domain> result=jdbcTemplate.query(new PreparedStatementCreator(){
    @Override public PreparedStatement createPreparedStatement(    Connection connection) throws SQLException {
      PreparedStatement ps=connection.prepareStatement(sql);
      ps.setString(1,punyName);
      return ps;
    }
  }
,new DomainWithStatusResultSetExtractor());
  if (null == result || result.size() == 0) {
    return null;
  }
  return result.get(0);
}
Program: 37432
Project: 37432
Buggy source:
/** 
 * test query exist domain.
 * @throws Exception
 */
@Test @DatabaseTearDown("String_Node_Str") @DatabaseSetup("String_Node_Str") public void testQueryExistDomain() throws Exception {
  String domainName="String_Node_Str";
  String domainNameWithLastDot="String_Node_Str";
  String domainNameWithPrefixBlank="String_Node_Str";
  commonQueryExistDomain(domainName,domainName,domainName);
  commonQueryExistDomain(domainNameWithLastDot,domainName,domainName);
  commonQueryExistDomain(domainNameWithPrefixBlank,domainName,domainName);
}

Fixed version (ground truth):
/** 
 * test query exist domain.
 * @throws Exception
 */
@Test @DatabaseTearDown("String_Node_Str") @DatabaseSetup("String_Node_Str") public void testQueryExistDomain() throws Exception {
  String domainName="String_Node_Str";
  String domainNameWithLastDot="String_Node_Str";
  String domainNameWithPrefixBlank="String_Node_Str";
  String domainNameWithUpperCase="String_Node_Str";
  String domainNameInFullWith="String_Node_Str";
  commonQueryExistDomain(domainName,domainName,domainName);
  commonQueryExistDomain(domainNameWithLastDot,domainName,domainName);
  commonQueryExistDomain(domainNameWithPrefixBlank,domainName,domainName);
  commonQueryExistDomain(domainNameWithUpperCase,domainName,domainName);
  commonQueryExistDomain(domainNameInFullWith,domainName,domainName);
}
Program: 37433
Project: 37433
Buggy source:
/** 
 * test query exist domain.
 * @throws Exception
 */
@Test @DatabaseSetup("String_Node_Str") public void testQueryInvalidDomain() throws Exception {
  RestResponseUtil.initErrorMessages();
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * test query exist domain.
 * @throws Exception
 */
@Test @DatabaseSetup("String_Node_Str") public void testQueryInvalidDomain() throws Exception {
  RestResponseUtil.initErrorMessages();
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
  commonQueryInvalidDomain("String_Node_Str");
}
Program: 37434
Project: 37434
Buggy source:
/** 
 * common query non-exist domain.
 * @param domainName domain name.
 * @throws Exception Exception.
 */
private void commonQueryNonExistDomain(String queryDomainName) throws Exception {
  mockMvc.perform(get("String_Node_Str" + queryDomainName).accept(MediaType.parseMediaType("String_Node_Str"))).andExpect(status().isNotFound()).andExpect(content().contentType("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value(404)).andExpect(jsonPath("String_Node_Str").value("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * common query non-exist domain.
 * @param domainName domain name.
 * @throws Exception Exception.
 */
private void commonQueryNonExistDomain(String queryDomainName) throws Exception {
  mockMvc.perform(get("String_Node_Str" + StringUtil.urlEncode(queryDomainName)).accept(MediaType.parseMediaType("String_Node_Str"))).andExpect(status().isNotFound()).andExpect(content().contentType("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value(404)).andExpect(jsonPath("String_Node_Str").value("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value("String_Node_Str"));
}
Program: 37435
Project: 37435
Buggy source:
/** 
 * common query invalid domain.
 * @param domainName domain name.
 * @throws Exception Exception.
 */
private void commonQueryInvalidDomain(String domainName) throws Exception {
  mockMvc.perform(get("String_Node_Str" + domainName).accept(MediaType.parseMediaType("String_Node_Str"))).andExpect(status().isBadRequest()).andExpect(content().contentType("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value(400)).andExpect(jsonPath("String_Node_Str").value("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * common query invalid domain.
 * @param domainName domain name.
 * @throws Exception Exception.
 */
private void commonQueryInvalidDomain(String domainName) throws Exception {
  mockMvc.perform(get("String_Node_Str" + StringUtil.urlEncode(domainName)).accept(MediaType.parseMediaType("String_Node_Str"))).andExpect(status().isBadRequest()).andExpect(content().contentType("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value(400)).andExpect(jsonPath("String_Node_Str").value("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value("String_Node_Str"));
}
Program: 37437
Project: 37437
Buggy source:
/** 
 * test query exist ns.
 * @throws Exception
 */
@Test @DatabaseTearDown("String_Node_Str") @DatabaseSetup("String_Node_Str") public void testQueryExistNameserver() throws Exception {
  String nsName="String_Node_Str";
  String nsNameWithPrefixBlank="String_Node_Str";
  String nsChineseLDH="String_Node_Str";
  String nsChineseUnicode="String_Node_Str";
  String nsLangEn="String_Node_Str";
  String nsLangZh="String_Node_Str";
  commonQueryExistNS(nsName,nsName,nsName,nsLangEn);
  commonQueryExistNS(nsNameWithPrefixBlank,nsName,nsName,nsLangEn);
  String nsChineseOrg=nsChineseLDH;
  nsChineseLDH=StringUtil.urlEncode(nsChineseLDH);
  commonQueryExistNS(nsChineseLDH,nsChineseOrg,nsChineseUnicode,nsLangZh);
}

Fixed version (ground truth):
/** 
 * test query exist ns.
 * @throws Exception
 */
@Test @DatabaseTearDown("String_Node_Str") @DatabaseSetup("String_Node_Str") public void testQueryExistNameserver() throws Exception {
  String nsName="String_Node_Str";
  String nsNameWithPrefixBlank="String_Node_Str";
  String nsChineseLDH="String_Node_Str";
  String nsChineseUnicode="String_Node_Str";
  String nsLangEn="String_Node_Str";
  String nsLangZh="String_Node_Str";
  String nsNameWithUpperCase="String_Node_Str";
  String nsNameInFullWith="String_Node_Str";
  commonQueryExistNS(nsName,nsName,nsName,nsLangEn);
  commonQueryExistNS(nsNameWithPrefixBlank,nsName,nsName,nsLangEn);
  commonQueryExistNS(nsNameWithUpperCase,nsName,nsName,nsLangEn);
  commonQueryExistNS(nsNameInFullWith,nsName,nsName,nsLangEn);
  String nsChineseOrg=nsChineseLDH;
  nsChineseLDH=StringUtil.urlEncode(nsChineseLDH);
  commonQueryExistNS(nsChineseLDH,nsChineseOrg,nsChineseUnicode,nsLangZh);
}
Program: 37438
Project: 37438
Buggy source:
@Override public void doFilter(ServletRequest arg0,ServletResponse arg1,FilterChain chain) throws IOException, ServletException {
  LOGGER.debug("String_Node_Str");
  HttpServletRequest request=(HttpServletRequest)arg0;
  HttpServletResponse response=(HttpServletResponse)arg1;
  boolean success=preProcess(request,response);
  LOGGER.debug("String_Node_Str",success);
  if (!success) {
    LOGGER.error("String_Node_Str");
    return;
  }
  chain.doFilter(request,response);
  LOGGER.debug("String_Node_Str");
  success=postProcess(request,response);
  LOGGER.debug("String_Node_Str",success);
}

Fixed version (ground truth):
@Override public void doFilter(ServletRequest arg0,ServletResponse arg1,FilterChain chain) throws IOException, ServletException {
  LOGGER.debug("String_Node_Str");
  HttpServletRequest request=(HttpServletRequest)arg0;
  HttpServletResponse response=(HttpServletResponse)arg1;
  if (ConnectionControlService.incrementConcurrentQCountAndCheckIfExceedMax()) {
    ConnectionControlService.decrementAndGetCurrentQueryCount();
    writeError509Response(response);
    return;
  }
  boolean success=preProcess(request,response);
  LOGGER.debug("String_Node_Str",success);
  if (!success) {
    LOGGER.error("String_Node_Str");
    ConnectionControlService.decrementAndGetCurrentQueryCount();
    return;
  }
  try {
    chain.doFilter(request,response);
  }
 catch (  Exception e) {
    LOGGER.error("String_Node_Str" + e.getMessage());
  }
  LOGGER.debug("String_Node_Str");
  success=postProcess(request,response);
  LOGGER.debug("String_Node_Str",success);
  ConnectionControlService.decrementAndGetCurrentQueryCount();
}
Program: 37439
Project: 37439
Buggy source:
/** 
 * handle exception.
 */
@Override protected ModelAndView doResolveException(HttpServletRequest request,HttpServletResponse response,Object handler,Exception ex){
  ResponseEntity<ErrorMessage> responseEntity=null;
  if (ex instanceof InvalidMediaTypeException) {
    responseEntity=RestResponseUtil.createResponse415();
  }
  responseEntity=RestResponseUtil.createResponse500();
  try {
    FilterHelper.writeResponse(responseEntity,response);
  }
 catch (  IOException e) {
    LOGGER.error(e.getMessage());
  }
  return new ModelAndView();
}

Fixed version (ground truth):
/** 
 * handle exception.
 */
@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();
  }
  responseEntity=RestResponseUtil.createResponse500();
  try {
    FilterHelper.writeResponse(responseEntity,response);
  }
 catch (  IOException e) {
    LOGGER.error(e.getMessage());
  }
  return new ModelAndView();
}
Program: 37440
Project: 37440
Buggy source:
@Override public boolean postProcess(HttpServletRequest request,HttpServletResponse response) throws Exception {
  ConnectionControlService.decrementAndGetCurrentQueryCount();
  return true;
}

Fixed version (ground truth):
@Override public boolean postProcess(HttpServletRequest request,HttpServletResponse response) throws Exception {
  return true;
}
Program: 37441
Project: 37441
Buggy source:
/** 
 * increment concurrent query count, and check if exceed max count.MUST call decrementAndGetCurrentQueryCount after query.
 * @return true if exceed, false if not.
 */
public static boolean incrementConcurrentQCountAndCheckIfExceedMax(){
  int count=CONCURRENT_Q_COUNT.getAndIncrement();
  LOGGER.debug("String_Node_Str",count);
  if (count >= RdapProperties.getMaxConcurrentCount() - 1) {
    LOGGER.debug("String_Node_Str",RdapProperties.getMaxConcurrentCount());
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * increment concurrent query count, and check if exceed max count.MUST call decrementAndGetCurrentQueryCount after query.
 * @return true if exceed, false if not.
 */
public static boolean incrementConcurrentQCountAndCheckIfExceedMax(){
  int count=CONCURRENT_Q_COUNT.getAndIncrement();
  LOGGER.debug("String_Node_Str",count);
  if (count > RdapProperties.getMaxConcurrentCount() - 1) {
    LOGGER.debug("String_Node_Str",RdapProperties.getMaxConcurrentCount());
    return true;
  }
  return false;
}
Program: 37442
Project: 37442
Buggy source:
/** 
 * validate domain search string represent a valid IDNA domain.
 * @param searchString domain or name server string.
 * @return true if is valid IDNA2008 domain, false if not.
 */
public static boolean validateSearchStringIsValidIdna(String searchString){
  if (StringUtils.isBlank(searchString)) {
    return false;
  }
  if (searchString.contains(BLANK_IN_DOMAIN)) {
    return false;
  }
  if (1 != StringUtils.countMatches(searchString,StringUtil.ASTERISK)) {
    return false;
  }
  String domainName=searchString.replace(StringUtil.ASTERISK,"String_Node_Str");
  if (validateDomainNameIsValidIdna(domainName)) {
    return true;
  }
  domainName=searchString.replace(StringUtil.ASTERISK,StringUtil.TLD_SPLITOR);
  if (validateDomainNameIsValidIdna(domainName)) {
    return true;
  }
  domainName=searchString.replace(StringUtil.ASTERISK,"String_Node_Str");
  if (validateDomainNameIsValidIdna(domainName)) {
    return true;
  }
  domainName=searchString.replace("String_Node_Str","String_Node_Str");
  if (validateDomainNameIsValidIdna(domainName)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * validate domain search string represent a valid IDNA domain.
 * @param searchString domain or name server string.
 * @return true if is valid IDNA2008 domain, false if not.
 */
public static boolean validateSearchStringIsValidIdna(String searchString){
  if (StringUtils.isBlank(searchString)) {
    return false;
  }
  if (searchString.contains(BLANK_IN_DOMAIN)) {
    return false;
  }
  if (1 < StringUtils.countMatches(searchString,StringUtil.ASTERISK)) {
    return false;
  }
  String domainName=searchString.replace(StringUtil.ASTERISK,"String_Node_Str");
  if (validateDomainNameIsValidIdna(domainName)) {
    return true;
  }
  domainName=searchString.replace(StringUtil.ASTERISK,StringUtil.TLD_SPLITOR);
  if (validateDomainNameIsValidIdna(domainName)) {
    return true;
  }
  domainName=searchString.replace(StringUtil.ASTERISK,"String_Node_Str");
  if (validateDomainNameIsValidIdna(domainName)) {
    return true;
  }
  domainName=searchString.replace("String_Node_Str","String_Node_Str");
  if (validateDomainNameIsValidIdna(domainName)) {
    return true;
  }
  return false;
}
Program: 37445
Project: 37445
Buggy source:
/** 
 * query nameserver by nameserver name.
 * @param nameserverName 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".
 * @return JSON formatted result,with HTTP code.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryNameserver(@PathVariable String nameserverName){
  String decodeNS=nameserverName;
  String punyNSName=decodeNS;
  try {
    decodeNS=DomainUtil.decodeAndTrimAndReplaceAsciiToLowercase(nameserverName);
    punyNSName=DomainUtil.geneDomainPunyName(decodeNS);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeNS)) {
    return RestResponseUtil.createResponse400();
  }
  decodeNS=DomainUtil.deleteLastPoint(decodeNS);
  decodeNS=StringUtils.lowerCase(decodeNS);
  QueryParam queryParam=queryParser.parseNameserverQueryParam(decodeNS,punyNSName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryNsInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam,nameserverName);
}

Fixed version (ground truth):
/** 
 * query nameserver by nameserver name.
 * @param nameserverName 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".
 * @return JSON formatted result,with HTTP code.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryNameserver(@PathVariable String nameserverName){
  String decodeNS=nameserverName;
  String punyNSName=decodeNS;
  try {
    decodeNS=DomainUtil.decodeAndReplaceAsciiToLowercase(nameserverName);
    punyNSName=DomainUtil.geneDomainPunyName(decodeNS);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeNS)) {
    return RestResponseUtil.createResponse400();
  }
  decodeNS=DomainUtil.deleteLastPoint(decodeNS);
  decodeNS=StringUtils.lowerCase(decodeNS);
  QueryParam queryParam=queryParser.parseNameserverQueryParam(decodeNS,punyNSName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryNsInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam,nameserverName);
}
Program: 37446
Project: 37446
Buggy source:
/** 
 * query domain by domain name.
 * @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).
 * @return JSON formated result,with HTTP code.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryDomain(@PathVariable String domainName){
  String decodeDomain=domainName;
  String punyDomainName=decodeDomain;
  try {
    decodeDomain=DomainUtil.decodeAndTrimAndReplaceAsciiToLowercase(domainName);
    punyDomainName=DomainUtil.geneDomainPunyName(decodeDomain);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeDomain)) {
    return RestResponseUtil.createResponse400();
  }
  decodeDomain=DomainUtil.deleteLastPoint(decodeDomain);
  decodeDomain=StringUtils.lowerCase(decodeDomain);
  QueryParam queryParam=queryParser.parseDomainQueryParam(decodeDomain,punyDomainName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryDomainInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam,domainName);
}

Fixed version (ground truth):
/** 
 * query domain by domain name.
 * @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).
 * @return JSON formated result,with HTTP code.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryDomain(@PathVariable String domainName){
  String decodeDomain=domainName;
  String punyDomainName=decodeDomain;
  try {
    decodeDomain=DomainUtil.decodeAndReplaceAsciiToLowercase(domainName);
    punyDomainName=DomainUtil.geneDomainPunyName(decodeDomain);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeDomain)) {
    return RestResponseUtil.createResponse400();
  }
  decodeDomain=DomainUtil.deleteLastPoint(decodeDomain);
  decodeDomain=StringUtils.lowerCase(decodeDomain);
  QueryParam queryParam=queryParser.parseDomainQueryParam(decodeDomain,punyDomainName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryDomainInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam,domainName);
}
Program: 37447
Project: 37447
Buggy source:
/** 
 * validate search domain.
 * @param domainName domain name.
 * @return boolean.
 */
private boolean validateSearchStringIsValidIdna(String domainName){
  String decodeDomain=DomainUtil.decodeAndTrimAndReplaceAsciiToLowercase(domainName);
  return DomainUtil.validateSearchStringIsValidIdna(decodeDomain);
}

Fixed version (ground truth):
/** 
 * validate search domain.
 * @param domainName domain name.
 * @return boolean.
 */
private boolean validateSearchStringIsValidIdna(String domainName){
  String decodeDomain=DomainUtil.decodeAndReplaceAsciiToLowercase(domainName);
  return DomainUtil.validateSearchStringIsValidIdna(decodeDomain);
}
Program: 37448
Project: 37448
Buggy source:
/** 
 * test decodeAndTrim.
 */
@Test public void testDecodeAndTrimDecodedStr(){
  String result=DomainUtil.decodeAndTrimAndReplaceAsciiToLowercase("String_Node_Str");
  assertEquals("String_Node_Str",result);
}

Fixed version (ground truth):
/** 
 * test decodeAndTrim.
 */
@Test public void testDecodeAndTrimDecodedStr(){
  String result=DomainUtil.decodeAndReplaceAsciiToLowercase("String_Node_Str");
  assertEquals("String_Node_Str",result);
}
Program: 37449
Project: 37449
Buggy source:
/** 
 * validate domain.
 * @param domainName domain name.
 * @return boolean.
 */
private boolean validateDomainNameIsValidIdna(String domainName){
  String decodeDomain=DomainUtil.decodeAndTrimAndReplaceAsciiToLowercase(domainName);
  return DomainUtil.validateDomainNameIsValidIdna(decodeDomain);
}

Fixed version (ground truth):
/** 
 * validate domain.
 * @param domainName domain name.
 * @return boolean.
 */
private boolean validateDomainNameIsValidIdna(String domainName){
  String decodeDomain=DomainUtil.decodeAndReplaceAsciiToLowercase(domainName);
  return DomainUtil.validateDomainNameIsValidIdna(decodeDomain);
}
Program: 37450
Project: 37450
Buggy source:
/** 
 * test decodeAndTrim.
 */
@Test public void testDecodeAndTrim(){
  assertEquals("String_Node_Str",DomainUtil.decodeAndTrimAndReplaceAsciiToLowercase("String_Node_Str"));
  assertEquals("String_Node_Str",DomainUtil.decodeAndTrimAndReplaceAsciiToLowercase("String_Node_Str"));
  assertEquals("String_Node_Str",DomainUtil.decodeAndTrimAndReplaceAsciiToLowercase("String_Node_Str"));
  assertEquals("String_Node_Str",DomainUtil.decodeAndTrimAndReplaceAsciiToLowercase("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * test decodeAndTrim.
 */
@Test public void testDecodeAndTrim(){
  assertEquals("String_Node_Str",DomainUtil.decodeAndReplaceAsciiToLowercase("String_Node_Str"));
  assertEquals("String_Node_Str",DomainUtil.decodeAndReplaceAsciiToLowercase("String_Node_Str"));
  assertEquals("String_Node_Str",DomainUtil.decodeAndReplaceAsciiToLowercase("String_Node_Str"));
  assertEquals("String_Node_Str",DomainUtil.decodeAndReplaceAsciiToLowercase("String_Node_Str"));
}
Program: 37451
Project: 37451
Buggy source:
/** 
 * constructor.
 * @param q for query string.
 * @param punyName nameserver puny name.
 */
public NameserverQueryParam(String q,String punyName){
  super(q);
  this.punyName=punyName;
}

Fixed version (ground truth):
/** 
 * constructor.
 * @param q for query string.
 * @param punyName nameserver puny name.
 */
public NameserverQueryParam(String q,String punyName){
  super(q,punyName);
}
Program: 37452
Project: 37452
Buggy source:
/** 
 * query ip by mask.
 * @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){
  ResponseEntity res=queryIpAddress(ipAddr,mask);
  return res;
}

Fixed version (ground truth):
/** 
 * query ip by mask.
 * @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){
  return queryIpAddress(ipAddr,mask,ipAddr + "String_Node_Str" + mask);
}
Program: 37453
Project: 37453
Buggy source:
/** 
 * query ip by address.
 * @param ipAddr the query ip
 * @return ResponseEntity
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryIp(@PathVariable String ipAddr){
  ResponseEntity res=queryIpAddress(ipAddr,"String_Node_Str");
  return res;
}

Fixed version (ground truth):
/** 
 * query ip by address.
 * @param ipAddr the query ip
 * @return ResponseEntity
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryIp(@PathVariable String ipAddr){
  return queryIpAddress(ipAddr,"String_Node_Str",ipAddr);
}
Program: 37455
Project: 37455
Buggy source:
/** 
 * query redirect domain or nameserver.
 * @param queryParam queryParam.
 * @return ResponseEntity.
 */
private ResponseEntity queryRedirectDomainOrNs(QueryParam queryParam){
  LOGGER.info("String_Node_Str",queryParam);
  RedirectResponse redirect=redirectService.queryDomain(queryParam);
  if (null != redirect && StringUtils.isNotBlank(redirect.getUrl())) {
    LOGGER.info("String_Node_Str",redirect.getUrl());
    return RestResponseUtil.createResponse301(redirect.getUrl());
  }
  LOGGER.info("String_Node_Str",queryParam);
  return RestResponseUtil.createResponse404();
}

Fixed version (ground truth):
/** 
 * query redirect domain or nameserver.
 * @param queryParam queryParam.
 * @return ResponseEntity.
 */
private ResponseEntity queryRedirectDomainOrNs(QueryParam queryParam,String paramName){
  LOGGER.info("String_Node_Str",queryParam);
  RedirectResponse redirect=redirectService.queryDomain(queryParam);
  String servicePartUri=SERVICE_URI_DOMAIN_Q;
  if (queryParam instanceof NameserverQueryParam) {
    servicePartUri=SERVICE_URI_NS_Q;
  }
  if (null != redirect && StringUtils.isNotBlank(redirect.getUrl())) {
    String redirectUrl=StringUtil.generateEncodedRedirectURL(paramName,servicePartUri,redirect.getUrl());
    return RestResponseUtil.createResponse301(redirectUrl);
  }
  LOGGER.info("String_Node_Str",queryParam);
  return RestResponseUtil.createResponse404();
}
Program: 37456
Project: 37456
Buggy source:
/** 
 * query nameserver by nameserver name.
 * @param nameserverName 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".
 * @return JSON formatted result,with HTTP code.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryNameserver(@PathVariable String nameserverName){
  String decodeNS=nameserverName;
  String punyNSName=decodeNS;
  try {
    decodeNS=DomainUtil.decodeAndTrimAndReplaceAsciiToLowercase(nameserverName);
    punyNSName=DomainUtil.geneDomainPunyName(decodeNS);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeNS)) {
    return RestResponseUtil.createResponse400();
  }
  decodeNS=DomainUtil.deleteLastPoint(decodeNS);
  decodeNS=StringUtils.lowerCase(decodeNS);
  QueryParam queryParam=queryParser.parseNameserverQueryParam(decodeNS,punyNSName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryNsInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam);
}

Fixed version (ground truth):
/** 
 * query nameserver by nameserver name.
 * @param nameserverName 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".
 * @return JSON formatted result,with HTTP code.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryNameserver(@PathVariable String nameserverName){
  String decodeNS=nameserverName;
  String punyNSName=decodeNS;
  try {
    decodeNS=DomainUtil.decodeAndTrimAndReplaceAsciiToLowercase(nameserverName);
    punyNSName=DomainUtil.geneDomainPunyName(decodeNS);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeNS)) {
    return RestResponseUtil.createResponse400();
  }
  decodeNS=DomainUtil.deleteLastPoint(decodeNS);
  decodeNS=StringUtils.lowerCase(decodeNS);
  QueryParam queryParam=queryParser.parseNameserverQueryParam(decodeNS,punyNSName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryNsInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam,nameserverName);
}
Program: 37457
Project: 37457
Buggy source:
/** 
 * query autnum.
 * @param autnum an AS Plain autonomous system number [RFC5396].
 * @param request HttpServletRequest.
 * @param response HttpServletResponse
 * @return JSON formated result,with HTTP code.
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public ResponseEntity queryAs(@PathVariable String autnum,HttpServletRequest request,HttpServletResponse response){
  LOGGER.info("String_Node_Str" + autnum);
  if (!AutnumValidator.isValidAutnum(autnum)) {
    return RestResponseUtil.createResponse400();
  }
  QueryParam queryParam=queryParser.parseQueryParam(autnum);
  Autnum result=queryService.queryAutnum(queryParam);
  if (null != result) {
    if (!accessControlManager.hasPermission(result)) {
      return RestResponseUtil.createResponse403();
    }
    responseDecorator.decorateResponse(result);
    return RestResponseUtil.createResponse200(result);
  }
  LOGGER.debug("String_Node_Str",queryParam);
  RedirectResponse redirect=redirectService.queryAutnum(queryParam);
  if (null != redirect && StringUtils.isNotBlank(redirect.getUrl())) {
    LOGGER.info("String_Node_Str",redirect.getUrl());
    return RestResponseUtil.createResponse301(redirect.getUrl());
  }
  return RestResponseUtil.createResponse404();
}

Fixed version (ground truth):
/** 
 * query autnum.
 * @param autnum an AS Plain autonomous system number [RFC5396].
 * @param request HttpServletRequest.
 * @param response HttpServletResponse
 * @return JSON formated result,with HTTP code.
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public ResponseEntity queryAs(@PathVariable String autnum,HttpServletRequest request,HttpServletResponse response){
  LOGGER.info("String_Node_Str" + autnum);
  if (!AutnumValidator.isValidAutnum(autnum)) {
    return RestResponseUtil.createResponse400();
  }
  QueryParam queryParam=queryParser.parseQueryParam(autnum);
  Autnum result=queryService.queryAutnum(queryParam);
  if (null != result) {
    if (!accessControlManager.hasPermission(result)) {
      return RestResponseUtil.createResponse403();
    }
    responseDecorator.decorateResponse(result);
    return RestResponseUtil.createResponse200(result);
  }
  LOGGER.debug("String_Node_Str",queryParam);
  RedirectResponse redirect=redirectService.queryAutnum(queryParam);
  if (null != redirect && StringUtils.isNotBlank(redirect.getUrl())) {
    String redirectUrl=StringUtil.generateEncodedRedirectURL(autnum,SERVICE_URI_AS_Q,redirect.getUrl());
    return RestResponseUtil.createResponse301(redirectUrl);
  }
  return RestResponseUtil.createResponse404();
}