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 results in NPE #2910

Closed
dansiviter opened this issue Apr 4, 2021 · 2 comments · Fixed by #2911
Closed

CompletionStage results in NPE #2910

dansiviter opened this issue Apr 4, 2021 · 2 comments · Fixed by #2911
Assignees
Labels
bug Something isn't working jax-rs JAX-RS and Jersey related issues

Comments

@dansiviter
Copy link
Contributor

Environment Details

  • Helidon Version: 2.2.2
  • Helidon SE or Helidon MP: MP
  • JDK version: 11
  • OS: Windows
  • Docker version (if applicable): N/A

Problem Description

If you use a CompletionStage as a response it results in a NPE:

Apr 04, 2021 7:09:57 PM io.helidon.webserver.RequestRouting$RoutedRequest defaultHandler
WARNING: Default error handler: Unhandled exception encountered.
java.util.concurrent.ExecutionException: Unhandled 'cause' of this exception encountered.
        at io.helidon.webserver.RequestRouting$RoutedRequest.defaultHandler(RequestRouting.java:397)
        at io.helidon.webserver.RequestRouting$RoutedRequest.nextNoCheck(RequestRouting.java:377)
        at io.helidon.webserver.RequestRouting$RoutedRequest.next(RequestRouting.java:420)
        at io.helidon.webserver.jersey.ResponseWriter.failure(ResponseWriter.java:172)
        at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:438)
        at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:263)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:234)
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:680)
        at io.helidon.webserver.jersey.JerseySupport$JerseyHandler.lambda$doAccept$3(JerseySupport.java:293)
        at io.helidon.common.context.Contexts.runInContext(Contexts.java:117)
        at io.helidon.common.context.ContextAwareExecutorImpl.lambda$wrap$5(ContextAwareExecutorImpl.java:154)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException
        at org.glassfish.jersey.internal.PropertiesResolver$1.resolveProperty(PropertiesResolver.java:88)
        at org.glassfish.jersey.internal.PropertiesResolver$1.resolveProperty(PropertiesResolver.java:83)
        at org.glassfish.jersey.server.ContainerRequest.resolveProperty(ContainerRequest.java:292)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.unwrapInvocableResponseType(ResourceMethodInvoker.java:489)  
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.lambda$invoke$2(ResourceMethodInvoker.java:468)
        at org.glassfish.jersey.process.internal.Stages$LinkedStage.apply(Stages.java:284)
        at org.glassfish.jersey.process.internal.Stages.process(Stages.java:147)
        at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:371)
        at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:363)
        at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:258)
        ... 14 more

Steps to reproduce

  1. Use helidon-mp-quickstart
  2. Create a resource that responds with CompletionStage:
	@GET
	@Path("foo")
	@Produces(MediaType.TEXT_PLAIN)
	public CompletionStage<String> foo() {
		return CompletableFuture.completedStage("bar");
	}
@danielkec danielkec self-assigned this Apr 4, 2021
@danielkec danielkec added bug Something isn't working jax-rs JAX-RS and Jersey related issues labels Apr 4, 2021
@dansiviter
Copy link
Contributor Author

@danielkec Thanks for quick fix!

@danielkec
Copy link
Contributor

@dansiviter Thx for reporting! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working jax-rs JAX-RS and Jersey related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants