30
30
import org .apache .commons .logging .LogFactory ;
31
31
32
32
import org .springframework .lang .Nullable ;
33
- import org .springframework .util .Assert ;
34
33
import org .springframework .web .filter .GenericFilterBean ;
35
34
import org .springframework .web .util .UrlPathHelper ;
36
35
@@ -87,7 +86,6 @@ public void setAttribute(String name, Object value) {
87
86
initLookupPath ((ResourceUrlProvider ) value );
88
87
}
89
88
}
90
-
91
89
}
92
90
93
91
private void initLookupPath (ResourceUrlProvider urlProvider ) {
@@ -97,10 +95,12 @@ private void initLookupPath(ResourceUrlProvider urlProvider) {
97
95
String requestUri = pathHelper .getRequestUri (this );
98
96
String lookupPath = pathHelper .getLookupPathForRequest (this );
99
97
this .indexLookupPath = requestUri .lastIndexOf (lookupPath );
100
- Assert .isTrue (this .indexLookupPath != -1 , () ->
101
- "Failed to find lookupPath '" + lookupPath + "' within requestUri '" + requestUri + ". " +
102
- "Does the path have invalid encoded characters " +
103
- "for characterEncoding=" + getRequest ().getCharacterEncoding () + "?" );
98
+ if (this .indexLookupPath == -1 ) {
99
+ throw new IllegalStateException (
100
+ "Failed to find lookupPath '" + lookupPath + "' within requestUri '" + requestUri + "'. " +
101
+ "Does the path have invalid encoded characters for characterEncoding '" +
102
+ getRequest ().getCharacterEncoding () + "'?" );
103
+ }
104
104
this .prefixLookupPath = requestUri .substring (0 , this .indexLookupPath );
105
105
if ("/" .equals (lookupPath ) && !"/" .equals (requestUri )) {
106
106
String contextPath = pathHelper .getContextPath (this );
@@ -116,7 +116,7 @@ private void initLookupPath(ResourceUrlProvider urlProvider) {
116
116
public String resolveUrlPath (String url ) {
117
117
if (this .resourceUrlProvider == null ) {
118
118
logger .trace ("ResourceUrlProvider not available via request attribute " +
119
- " ResourceUrlProviderExposingInterceptor.RESOURCE_URL_PROVIDER_ATTR" );
119
+ ResourceUrlProviderExposingInterceptor .RESOURCE_URL_PROVIDER_ATTR );
120
120
return null ;
121
121
}
122
122
if (this .indexLookupPath != null && url .startsWith (this .prefixLookupPath )) {
0 commit comments