File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
spring-webmvc/src/main/java/org/springframework/web/servlet Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2016 the original author or authors.
2
+ * Copyright 2002-2017 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -1091,7 +1091,7 @@ protected HttpServletRequest checkMultipart(HttpServletRequest request) throws M
1091
1091
logger .debug ("Request is already a MultipartHttpServletRequest - if not in a forward, " +
1092
1092
"this typically results from an additional MultipartFilter in web.xml" );
1093
1093
}
1094
- else if (request . getAttribute ( WebUtils . ERROR_EXCEPTION_ATTRIBUTE ) instanceof MultipartException ) {
1094
+ else if (hasMultipartException ( request ) ) {
1095
1095
logger .debug ("Multipart resolution failed for current request before - " +
1096
1096
"skipping re-resolution for undisturbed error rendering" );
1097
1097
}
@@ -1103,6 +1103,20 @@ else if (request.getAttribute(WebUtils.ERROR_EXCEPTION_ATTRIBUTE) instanceof Mul
1103
1103
return request ;
1104
1104
}
1105
1105
1106
+ /**
1107
+ * Check "javax.servlet.error.exception" attribute for a multipart exception.
1108
+ */
1109
+ private boolean hasMultipartException (HttpServletRequest request ) {
1110
+ Throwable error = (Throwable ) request .getAttribute (WebUtils .ERROR_EXCEPTION_ATTRIBUTE );
1111
+ while (error != null ) {
1112
+ if (error instanceof MultipartException ) {
1113
+ return true ;
1114
+ }
1115
+ error = error .getCause ();
1116
+ }
1117
+ return false ;
1118
+ }
1119
+
1106
1120
/**
1107
1121
* Clean up any resources used by the given multipart request (if any).
1108
1122
* @param request current HTTP request
You can’t perform that action at this time.
0 commit comments