Skip to content

Commit

Permalink
Avoid NPE when RESTEasy Reactive is used together with the classic RE…
Browse files Browse the repository at this point in the history
…ST client

Fixes: quarkusio#24120
  • Loading branch information
geoand committed Mar 8, 2022
1 parent b98c54c commit d3fd924
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
/**
* These work for MultivaluedMap with String and Object
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public class HeaderUtil {

private static final ClassValue<RuntimeDelegate.HeaderDelegate> HEADER_DELEGATE_CACHE = new ClassValue() {
private static final ClassValue<RuntimeDelegate.HeaderDelegate<?>> HEADER_DELEGATE_CACHE = new ClassValue<>() {
@Override
protected RuntimeDelegate.HeaderDelegate<?> computeValue(Class type) {
return RuntimeDelegate.getInstance().createHeaderDelegate(type);
Expand All @@ -41,7 +42,11 @@ public static String headerToString(Object obj) {
if (obj instanceof String) {
return (String) obj;
} else {
return HEADER_DELEGATE_CACHE.get(obj.getClass()).toString(obj);
RuntimeDelegate.HeaderDelegate delegate = HEADER_DELEGATE_CACHE.get(obj.getClass());
if (delegate != null) {
return delegate.toString(obj);
}
return obj.toString();
}
}

Expand Down

0 comments on commit d3fd924

Please sign in to comment.