Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CompletionStage not unwrapped in 3.0.6 #5126

Closed
mihalyr opened this issue Aug 11, 2022 · 1 comment · Fixed by #5128
Closed

CompletionStage not unwrapped in 3.0.6 #5126

mihalyr opened this issue Aug 11, 2022 · 1 comment · Fixed by #5128
Milestone

Comments

@mihalyr
Copy link

mihalyr commented Aug 11, 2022

Hi,

our resources returning a CompletionStage are broken on 3.0.6 but work fine on 3.0.5.

This is a regression for the issue in #4640 which was fixed with https://github.com/eclipse-ee4j/jersey/pull/4885/files

The error I get is:

java.lang.IllegalArgumentException: Class `xyz.SearchResult` not subtype of `java.util.concurrent.CompletableFuture<xyz.SearchResult>`
	at com.fasterxml.jackson.databind.type.TypeFactory.constructSpecializedType(TypeFactory.java:446) ~[jackson-databind-2.13.3.jar:2.13.3]
	at com.fasterxml.jackson.databind.type.TypeFactory.constructSpecializedType(TypeFactory.java:408) ~[jackson-databind-2.13.3.jar:2.13.3]
	at org.glassfish.jersey.jackson.internal.jackson.jaxrs.base.ProviderBase.writeTo(ProviderBase.java:621) ~[jersey-media-json-jackson-3.0.6.jar:?]
	at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:242) ~[jersey-common-3.0.6.jar:?]
	at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:227) ~[jersey-common-3.0.6.jar:?]
	at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:139) ~[jersey-common-3.0.6.jar:?]
	at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:85) ~[jersey-server-3.0.6.jar:?]
	at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:139) ~[jersey-common-3.0.6.jar:?]
	at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:61) ~[jersey-server-3.0.6.jar:?]
	at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:139) ~[jersey-common-3.0.6.jar:?]
	at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1116) ~[jersey-common-3.0.6.jar:?]
	at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:642) ~[jersey-server-3.0.6.jar:?]

One of the changes in #4885 fix was changing UNWRAP_COMPLETION_STAGE_IN_WRITER_ENABLE to true in unwrapInvocableResponseType in ResourceMethodInvoker.java

I've noticed that a merge commit included in 3.0.6 reverted those lines in 3619462#diff-9a15f3d079f85bb08c309d8c3ec510242d1a284b7145b5f35978c519ba20355bL490

For now I stick to 3.0.5 which seems to be working fine.

@jansupol
Copy link
Contributor

@mihalyr Thanks for spotting this, in 2.x the default should be false, in 3.x true. Seems like false got propagated from master. I would expect a test would be failing :(

@jansupol jansupol linked a pull request Aug 16, 2022 that will close this issue
@senivam senivam added this to the 3.0.7 milestone Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants