Skip to content

Commit a70c38f

Browse files
committed
fix(rest): also handle MissingServletRequestPartException for multipart missing params
1 parent f3fe695 commit a70c38f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/core/RestExceptionHandler.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.springframework.web.HttpRequestMethodNotSupportedException;
3131
import org.springframework.web.bind.MissingServletRequestParameterException;
3232
import org.springframework.web.bind.annotation.ControllerAdvice;
33+
import org.springframework.web.multipart.support.MissingServletRequestPartException;
3334
import org.springframework.web.bind.annotation.ExceptionHandler;
3435
import org.springframework.web.client.HttpClientErrorException;
3536
import org.springframework.web.servlet.resource.NoResourceFoundException;
@@ -59,8 +60,8 @@ public ResponseEntity<ErrorMessage> handleMessageNotReadableException(RuntimeExc
5960
return new ResponseEntity<>(new ErrorMessage(e, HttpStatus.BAD_REQUEST), HttpStatus.BAD_REQUEST);
6061
}
6162

62-
@ExceptionHandler(MissingServletRequestParameterException.class)
63-
public ResponseEntity<ErrorMessage> handleMissingServletRequestParameter(MissingServletRequestParameterException e) {
63+
@ExceptionHandler({MissingServletRequestParameterException.class, MissingServletRequestPartException.class})
64+
public ResponseEntity<ErrorMessage> handleMissingServletRequestParameter(Exception e) {
6465
return new ResponseEntity<>(new ErrorMessage(e, HttpStatus.BAD_REQUEST), HttpStatus.BAD_REQUEST);
6566
}
6667

0 commit comments

Comments
 (0)