[ 
https://issues.apache.org/jira/browse/CXF-7989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16794559#comment-16794559
 ] 

Andriy Redko edited comment on CXF-7989 at 3/17/19 6:40 PM:
------------------------------------------------------------

Ok, I think I found the issue, the snippet below to reproduce the problem:

{code:java}
    public void get(@PathParam("isbn") String isbn, @Suspended final 
AsyncResponse resp) {
        client.target("http://localhost:19092/services/catalog/"; + isbn)
            .request()
            .rx()
            .get(Book.class)
            .whenComplete((r, ex) -> {
                if (ex != null) {
                    resp.resume(ex);
                } else {
                    resp.resume(r);
                }
            });
    }
{code:java}

The "ex" is indeed the instance of "CompletionException", but I don't think 
this issue is specific to rx() part of the invocation. Here is another example 
which leads to the same result:

{code:java}
public CompletableFuture<Book> getf(@PathParam("isbn") String isbn) {
        return ClientBuilder
            .newClient()
            .target("http://localhost:19092/services/catalog/"; + isbn)
            .request()
            .rx()
            .get(Book.class)
            .toCompletableFuture();
    }
{code:java}

In both cases the JAXRS Invoker does not properly unwrap the 
CompletionException (since it wraps it into Fault instance). 


was (Author: reta):
Ok, I think I found the issue, the snippet below to reproduce the problem:
{code:java}
    public void get(@PathParam("isbn") String isbn, @Suspended final 
AsyncResponse resp) {
        client.target("http://localhost:19092/services/catalog/"; + isbn)
            .request()
            .rx()
            .get(Book.class)
            .whenComplete((r, ex) -> {
                if (ex != null) {
                    resp.resume(ex);
                } else {
                    resp.resume(r);
                }
            });
    }
{code:java}

The "ex" is indeed the instance of "CompletionException", but I don't think 
this issue is specific to rx() part of the invocation. Here is another example 
which leads to the same result:

{code:java}
public CompletableFuture<Book> getf(@PathParam("isbn") String isbn) {
        return ClientBuilder
            .newClient()
            .target("http://localhost:19092/services/catalog/"; + isbn)
            .request()
            .rx()
            .get(Book.class)
            .toCompletableFuture();
    }
{code:java}

In both cases the JAXRS Invoker does not properly unwrap the 
CompletionException (since it wraps it into Fault instance). 

> org.apache.cxf.jaxrs.JAXRSInvoker#checkFutureResponse should probably handle 
> CompletionException
> ------------------------------------------------------------------------------------------------
>
>                 Key: CXF-7989
>                 URL: https://issues.apache.org/jira/browse/CXF-7989
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 3.3.0
>            Reporter: Romain Manni-Bucau
>            Assignee: Andriy Redko
>            Priority: Major
>
> The check should probably unwrap CompletionException otherwise it can require 
> some more custom ExceptionMappers to achieve a correct behavior.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to