List<Part> validatePartsOrThrow(CompleteMultipartUpload request) throws RestServiceException {
    List<Part> parts = getParts(request);
    Set<Integer> partNumbers = new HashSet<>();
    Set<String> etags = new HashSet<>();
    for (Part part : parts) {
      int partNumber = getPartNumber(part);
      if (partNumber < S3Constants.MIN_PART_NUM || partNumber > S3Constants.MAX_PART_NUM) {
        String error = String.format(S3Constants.ERR_INVALID_PART_NUMBER, partNumber);
        throw new RestServiceException(error, RestServiceErrorCode.BadRequest);
      }
      if (!partNumbers.add(partNumber)) {
        String error = String.format(S3Constants.ERR_DUPLICATE_PART_NUMBER, partNumber);
        throw new RestServiceException(error, RestServiceErrorCode.BadRequest);
      }
      String etag = part.geteTag();
      if (!etags.add(etag)) {
        String error = String.format(S3Constants.ERR_DUPLICATE_ETAG, etag);
        throw new RestServiceException(error, RestServiceErrorCode.BadRequest);
      }
    }
    return parts;
  }
Check the list size and part number before processing request
1. Disallow duplicate part numbers
2. Disallow duplicate etags
3. Check for list size 10000
4. Check for part numbers integer 1-10000
@param request the {@link CompleteMultipartUpload} request
@return the bad request error
ambry-frontend/src/main/java/com/github/ambry/frontend/s3/S3MultipartCompleteUploadHandler.java