Skip to content

Commit

Permalink
MissingServletRequestPartException extends ServletRequestBindingExcep…
Browse files Browse the repository at this point in the history
  • Loading branch information
heowc authored and rstoyanchev committed Feb 14, 2022
1 parent 303e363 commit ad2722b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,8 +16,7 @@

package org.springframework.web.multipart.support;

import jakarta.servlet.ServletException;

import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.multipart.MultipartResolver;

/**
Expand All @@ -30,10 +29,11 @@
* e.g. no {@link MultipartResolver}.
*
* @author Rossen Stoyanchev
* @author Wonchul Heo
* @since 3.1
*/
@SuppressWarnings("serial")
public class MissingServletRequestPartException extends ServletException {
public class MissingServletRequestPartException extends ServletRequestBindingException {

private final String requestPartName;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -73,6 +73,7 @@
* detected, {@link ExceptionHandlerExceptionResolver} must be configured.
*
* @author Rossen Stoyanchev
* @author Wonchul Heo
* @since 3.2
* @see #handleException(Exception, WebRequest)
* @see org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver
Expand Down Expand Up @@ -108,13 +109,13 @@ public abstract class ResponseEntityExceptionHandler {
HttpMediaTypeNotAcceptableException.class,
MissingPathVariableException.class,
MissingServletRequestParameterException.class,
MissingServletRequestPartException.class,
ServletRequestBindingException.class,
ConversionNotSupportedException.class,
TypeMismatchException.class,
HttpMessageNotReadableException.class,
HttpMessageNotWritableException.class,
MethodArgumentNotValidException.class,
MissingServletRequestPartException.class,
BindException.class,
NoHandlerFoundException.class,
AsyncRequestTimeoutException.class
Expand Down Expand Up @@ -143,6 +144,10 @@ else if (ex instanceof MissingServletRequestParameterException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleMissingServletRequestParameter((MissingServletRequestParameterException) ex, headers, status, request);
}
else if (ex instanceof MissingServletRequestPartException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleMissingServletRequestPart((MissingServletRequestPartException) ex, headers, status, request);
}
else if (ex instanceof ServletRequestBindingException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleServletRequestBindingException((ServletRequestBindingException) ex, headers, status, request);
Expand All @@ -167,10 +172,6 @@ else if (ex instanceof MethodArgumentNotValidException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleMethodArgumentNotValid((MethodArgumentNotValidException) ex, headers, status, request);
}
else if (ex instanceof MissingServletRequestPartException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleMissingServletRequestPart((MissingServletRequestPartException) ex, headers, status, request);
}
else if (ex instanceof BindException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleBindException((BindException) ex, headers, status, request);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -90,6 +90,10 @@
* <td><p>400 (SC_BAD_REQUEST)</p></td>
* </tr>
* <tr class="rowColor">
* <td><p>MissingServletRequestPartException</p></td>
* <td><p>400 (SC_BAD_REQUEST)</p></td>
* </tr>
* <tr class="rowColor">
* <td><p>ServletRequestBindingException</p></td>
* <td><p>400 (SC_BAD_REQUEST)</p></td>
* </tr>
Expand All @@ -113,10 +117,6 @@
* <td><p>MethodArgumentNotValidException</p></td>
* <td><p>400 (SC_BAD_REQUEST)</p></td>
* </tr>
* <tr class="rowColor">
* <td><p>MissingServletRequestPartException</p></td>
* <td><p>400 (SC_BAD_REQUEST)</p></td>
* </tr>
* <tr class="altColor">
* <td><p>BindException</p></td>
* <td><p>400 (SC_BAD_REQUEST)</p></td>
Expand All @@ -135,6 +135,7 @@
* @author Arjen Poutsma
* @author Rossen Stoyanchev
* @author Juergen Hoeller
* @author Wonchul Heo
* @since 3.0
* @see org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
*/
Expand Down Expand Up @@ -188,6 +189,10 @@ else if (ex instanceof MissingServletRequestParameterException) {
return handleMissingServletRequestParameter(
(MissingServletRequestParameterException) ex, request, response, handler);
}
else if (ex instanceof MissingServletRequestPartException) {
return handleMissingServletRequestPartException(
(MissingServletRequestPartException) ex, request, response, handler);
}
else if (ex instanceof ServletRequestBindingException) {
return handleServletRequestBindingException(
(ServletRequestBindingException) ex, request, response, handler);
Expand All @@ -212,10 +217,6 @@ else if (ex instanceof MethodArgumentNotValidException) {
return handleMethodArgumentNotValidException(
(MethodArgumentNotValidException) ex, request, response, handler);
}
else if (ex instanceof MissingServletRequestPartException) {
return handleMissingServletRequestPartException(
(MissingServletRequestPartException) ex, request, response, handler);
}
else if (ex instanceof BindException) {
return handleBindException((BindException) ex, request, response, handler);
}
Expand Down

0 comments on commit ad2722b

Please sign in to comment.