You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java.lang.UnsupportedOperationException at java.base/java.util.Collections$UnmodifiableMap.put(Collections.java:1453) at org.springframework.http.HttpHeaders.set(HttpHeaders.java:1512) at org.springframework.http.HttpHeaders.setBasicAuth(HttpHeaders.java:750) at org.springframework.http.HttpHeaders.setBasicAuth(HttpHeaders.java:720) at de.hska.kunde.rest.KundeRestTest$beforeAll$1.apply(KundeRestTest.kt:108) at de.hska.kunde.rest.KundeRestTest$beforeAll$1.apply(KundeRestTest.kt:93) at org.springframework.web.reactive.function.client.ExchangeFilterFunction.lambda$ofRequestProcessor$3(ExchangeFilterFunction.java:77) at org.springframework.web.reactive.function.client.ExchangeFilterFunction.lambda$apply$2(ExchangeFilterFunction.java:66) at org.springframework.web.reactive.function.client.DefaultWebClient$DefaultRequestBodyUriSpec.exchange(DefaultWebClient.java:321) at org.springframework.web.reactive.function.client.DefaultWebClient$DefaultRequestBodyUriSpec.retrieve(DefaultWebClient.java:367) at de.hska.kunde.rest.KundeRestTest$Lesen.Suche mit vorhandenem Nachnamen(KundeRestTest.kt:268) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:515) ... at java.base/java.lang.Thread.run(Thread.java:844)
Looks like this is operating against a read-only HttpHeaders instance... At the very least we should provide a proper exception here, and revisit why the HttpHeaders are read-only at that point to begin with.
I've updated ExchangeFilterFunctions.basicAuthentication(String user, String password) to delegate to HttpHeaders#setBasicAuth(user, password) internally, and I've also removed the deprecation from it since it is still useful and saves a bit of boilerplate.
I kept the no-arg method, which looks up the credentials from a request attribute, deprecated since that one is a straight-forward use of HttpHeaders when building the request:
Juergen Zimmermann opened SPR-17099 and commented
I replaced the deprecated ExchangeFilterFunction.basicAuthentication(USERNAME, PASSWORD) with this Kotlin fragment:
ExchangeFilterFunction.ofRequestProcessor { request ->
request.headers().setBasicAuth(USERNAME, PASSWORD)
request.toMono()
}
Now I get the following stacktrace:
java.lang.UnsupportedOperationException
at java.base/java.util.Collections$UnmodifiableMap.put(Collections.java:1453)
at org.springframework.http.HttpHeaders.set(HttpHeaders.java:1512)
at org.springframework.http.HttpHeaders.setBasicAuth(HttpHeaders.java:750)
at org.springframework.http.HttpHeaders.setBasicAuth(HttpHeaders.java:720)
at de.hska.kunde.rest.KundeRestTest$beforeAll$1.apply(KundeRestTest.kt:108)
at de.hska.kunde.rest.KundeRestTest$beforeAll$1.apply(KundeRestTest.kt:93)
at org.springframework.web.reactive.function.client.ExchangeFilterFunction.lambda$ofRequestProcessor$3(ExchangeFilterFunction.java:77)
at org.springframework.web.reactive.function.client.ExchangeFilterFunction.lambda$apply$2(ExchangeFilterFunction.java:66)
at org.springframework.web.reactive.function.client.DefaultWebClient$DefaultRequestBodyUriSpec.exchange(DefaultWebClient.java:321)
at org.springframework.web.reactive.function.client.DefaultWebClient$DefaultRequestBodyUriSpec.retrieve(DefaultWebClient.java:367)
at de.hska.kunde.rest.KundeRestTest$Lesen.Suche mit vorhandenem Nachnamen(KundeRestTest.kt:268)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:515)
...
at java.base/java.lang.Thread.run(Thread.java:844)
Affects: 5.1 RC1
Referenced from: commits 4a18488
The text was updated successfully, but these errors were encountered: