Program: 116894
Project: 116894
Buggy source:
/** 
 * Handles update requests for specific paths
 * @param model
 * @param pathIdentifier
 * @param profileIdentifier
 * @param clientUUID
 * @param responseEnabled
 * @param requestEnabled
 * @param addOverride
 * @param enabledMoveUp
 * @param enabledMoveDown
 * @param pathName
 * @param path
 * @param bodyFilter
 * @param customResponse
 * @param customRequest
 * @param resetResponse
 * @param resetRequest
 * @param contentType
 * @param repeatNumber
 * @param global
 * @return
 * @throws Exception
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST) public @ResponseBody String setPath(Model model,@PathVariable String pathIdentifier,@RequestParam(value="String_Node_Str",required=false) String profileIdentifier,@RequestParam(value="String_Node_Str",defaultValue=Constants.PROFILE_CLIENT_DEFAULT_ID) String clientUUID,@RequestParam(required=false) Boolean responseEnabled,@RequestParam(required=false) Boolean requestEnabled,@RequestParam(value="String_Node_Str",required=false) Integer addOverride,@RequestParam(value="String_Node_Str",required=false) String enabledMoveUp,@RequestParam(value="String_Node_Str",required=false) String enabledMoveDown,@RequestParam(required=false) String pathName,@RequestParam(required=false) String path,@RequestParam(required=false) String bodyFilter,@RequestParam(required=false) String customResponse,@RequestParam(required=false) String customRequest,@RequestParam(required=false) Boolean resetResponse,@RequestParam(required=false) Boolean resetRequest,@RequestParam(required=false) String contentType,@RequestParam(required=false) Integer repeatNumber,@RequestParam(required=false) Boolean global,@RequestParam(value="String_Node_Str",required=false) Integer[] groups,HttpServletResponse response) throws Exception {
  String decodedProfileIdentifier=null;
  if (profileIdentifier != null)   decodedProfileIdentifier=URLDecoder.decode(profileIdentifier,"String_Node_Str");
  Identifiers identifiers=ControllerUtils.convertProfileAndPathIdentifier(decodedProfileIdentifier,pathIdentifier);
  Integer pathId=identifiers.getPathId();
  if (responseEnabled != null) {
    PathOverrideService.getInstance().setResponseEnabled(pathId,responseEnabled,clientUUID);
  }
  if (requestEnabled != null) {
    PathOverrideService.getInstance().setRequestEnabled(pathId,requestEnabled,clientUUID);
  }
  if (addOverride != null) {
    OverrideService.getInstance().enableOverride(addOverride,pathId,clientUUID);
  }
  if (enabledMoveUp != null) {
    String[] parts=enabledMoveUp.split("String_Node_Str");
    OverrideService.getInstance().increasePriority(Integer.parseInt(parts[0]),pathId,clientUUID);
  }
  if (enabledMoveDown != null) {
    String[] parts=enabledMoveDown.split("String_Node_Str");
    OverrideService.getInstance().decreasePriority(Integer.parseInt(parts[0]),pathId,clientUUID);
  }
  if (pathName != null) {
    if (pathName.equals("String_Node_Str")) {
      response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
      return "String_Node_Str";
    }
    if (pathName.contains("String_Node_Str")) {
      response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
      return "String_Node_Str";
    }
    PathOverrideService.getInstance().setName(pathId,pathName);
  }
  if (path != null) {
    try {
      Pattern.compile(path);
    }
 catch (    PatternSyntaxException pse) {
      response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
      return "String_Node_Str";
    }
    PathOverrideService.getInstance().setPath(pathId,path);
  }
  if (bodyFilter != null) {
    PathOverrideService.getInstance().setBodyFilter(pathId,bodyFilter);
  }
  if (customResponse != null) {
    PathOverrideService.getInstance().setCustomResponse(pathId,customResponse,clientUUID);
  }
  if (customRequest != null) {
    PathOverrideService.getInstance().setCustomRequest(pathId,customRequest,clientUUID);
  }
  if (resetResponse != null) {
    PathOverrideService.getInstance().clearResponseSettings(pathId,clientUUID);
  }
  if (resetRequest != null) {
    PathOverrideService.getInstance().clearRequestSettings(pathId,clientUUID);
  }
  if (contentType != null) {
    PathOverrideService.getInstance().setContentType(pathId,contentType);
  }
  if (global != null) {
    PathOverrideService.getInstance().setGlobal(pathId,global);
  }
  if (repeatNumber != null) {
    EditService.getInstance().updateRepeatNumber(repeatNumber,pathId,clientUUID);
  }
  if (groups != null) {
    pathOverrideService.setGroupsForPath(groups,pathId);
  }
  ObjectMapper objectMapper=new ObjectMapper();
  ObjectWriter writer=objectMapper.writer();
  return writer.writeValueAsString(PathOverrideService.getInstance().getPath(pathId,clientUUID,null));
}

Fixed version (ground truth):
/** 
 * Handles update requests for specific paths
 * @param model
 * @param pathIdentifier
 * @param profileIdentifier
 * @param clientUUID
 * @param responseEnabled
 * @param requestEnabled
 * @param addOverride
 * @param enabledMoveUp
 * @param enabledMoveDown
 * @param pathName
 * @param path
 * @param bodyFilter
 * @param customResponse
 * @param customRequest
 * @param resetResponse
 * @param resetRequest
 * @param contentType
 * @param repeatNumber
 * @param global
 * @return
 * @throws Exception
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST) public @ResponseBody String setPath(Model model,@PathVariable String pathIdentifier,@RequestParam(value="String_Node_Str",required=false) String profileIdentifier,@RequestParam(value="String_Node_Str",defaultValue=Constants.PROFILE_CLIENT_DEFAULT_ID) String clientUUID,@RequestParam(required=false) Boolean responseEnabled,@RequestParam(required=false) Boolean requestEnabled,@RequestParam(value="String_Node_Str",required=false) Integer addOverride,@RequestParam(value="String_Node_Str",required=false) String enabledMoveUp,@RequestParam(value="String_Node_Str",required=false) String enabledMoveDown,@RequestParam(required=false) String pathName,@RequestParam(required=false) String path,@RequestParam(required=false) String bodyFilter,@RequestParam(required=false) String customResponse,@RequestParam(required=false) String customRequest,@RequestParam(required=false) Boolean resetResponse,@RequestParam(required=false) Boolean resetRequest,@RequestParam(required=false) String contentType,@RequestParam(required=false) Integer repeatNumber,@RequestParam(required=false) Boolean global,@RequestParam(required=false) Integer requestType,@RequestParam(value="String_Node_Str",required=false) Integer[] groups,HttpServletResponse response) throws Exception {
  String decodedProfileIdentifier=null;
  if (profileIdentifier != null)   decodedProfileIdentifier=URLDecoder.decode(profileIdentifier,"String_Node_Str");
  Identifiers identifiers=ControllerUtils.convertProfileAndPathIdentifier(decodedProfileIdentifier,pathIdentifier);
  Integer pathId=identifiers.getPathId();
  if (responseEnabled != null) {
    PathOverrideService.getInstance().setResponseEnabled(pathId,responseEnabled,clientUUID);
  }
  if (requestEnabled != null) {
    PathOverrideService.getInstance().setRequestEnabled(pathId,requestEnabled,clientUUID);
  }
  if (addOverride != null) {
    OverrideService.getInstance().enableOverride(addOverride,pathId,clientUUID);
  }
  if (enabledMoveUp != null) {
    String[] parts=enabledMoveUp.split("String_Node_Str");
    OverrideService.getInstance().increasePriority(Integer.parseInt(parts[0]),pathId,clientUUID);
  }
  if (enabledMoveDown != null) {
    String[] parts=enabledMoveDown.split("String_Node_Str");
    OverrideService.getInstance().decreasePriority(Integer.parseInt(parts[0]),pathId,clientUUID);
  }
  if (pathName != null) {
    if (pathName.equals("String_Node_Str")) {
      response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
      return "String_Node_Str";
    }
    if (pathName.contains("String_Node_Str")) {
      response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
      return "String_Node_Str";
    }
    PathOverrideService.getInstance().setName(pathId,pathName);
  }
  if (path != null) {
    try {
      Pattern.compile(path);
    }
 catch (    PatternSyntaxException pse) {
      response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
      return "String_Node_Str";
    }
    PathOverrideService.getInstance().setPath(pathId,path);
  }
  if (bodyFilter != null) {
    PathOverrideService.getInstance().setBodyFilter(pathId,bodyFilter);
  }
  if (customResponse != null) {
    PathOverrideService.getInstance().setCustomResponse(pathId,customResponse,clientUUID);
  }
  if (customRequest != null) {
    PathOverrideService.getInstance().setCustomRequest(pathId,customRequest,clientUUID);
  }
  if (resetResponse != null) {
    PathOverrideService.getInstance().clearResponseSettings(pathId,clientUUID);
  }
  if (resetRequest != null) {
    PathOverrideService.getInstance().clearRequestSettings(pathId,clientUUID);
  }
  if (contentType != null) {
    PathOverrideService.getInstance().setContentType(pathId,contentType);
  }
  if (global != null) {
    PathOverrideService.getInstance().setGlobal(pathId,global);
  }
  if (repeatNumber != null) {
    EditService.getInstance().updateRepeatNumber(repeatNumber,pathId,clientUUID);
  }
  if (requestType != null) {
    PathOverrideService.getInstance().setRequestType(pathId,requestType);
  }
  if (groups != null) {
    pathOverrideService.setGroupsForPath(groups,pathId);
  }
  ObjectMapper objectMapper=new ObjectMapper();
  ObjectWriter writer=objectMapper.writer();
  return writer.writeValueAsString(PathOverrideService.getInstance().getPath(pathId,clientUUID,null));
}