Program: 37386
Project: 37386
Buggy source:
/** 
 * <pre> query autnum. URI:/autnum/{autnum} First query autnum in local registry, if not exist, then query  for redirect. This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. <pre>
 * @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.debug("String_Node_Str" + autnum);
  autnum=queryParser.getLastSplitInURI(request);
  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 (redirectService.isValidRedirect(redirect)) {
    String redirectUrl=StringUtil.generateEncodedRedirectURL(autnum,SERVICE_URI_AS_Q,redirect.getUrl());
    return RestResponseUtil.createResponse301(redirectUrl);
  }
  return RestResponseUtil.createResponse404();
}

Fixed version (ground truth):
/** 
 * <pre> query autnum. URI:/autnum/{autnum} First query autnum in local registry, if not exist, then query  for redirect. This service is under permission control, @see AccessControlManager. This service is under policy control, @see PolicyControlService. </pre>
 * @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.debug("String_Node_Str" + autnum);
  autnum=queryParser.getLastSplitInURI(request);
  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 (redirectService.isValidRedirect(redirect)) {
    String redirectUrl=StringUtil.generateEncodedRedirectURL(autnum,SERVICE_URI_AS_Q,redirect.getUrl());
    return RestResponseUtil.createResponse301(redirectUrl);
  }
  return RestResponseUtil.createResponse404();
}