This is an automated email from the ASF dual-hosted git repository.

reta pushed a commit to branch 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 02d82fc9eddee0fdfe51ac2eb43b9b5415eceee8
Author: Andriy Redko <[email protected]>
AuthorDate: Wed Nov 20 10:29:58 2024 -0500

    CXF-9078: AsyncHTTPConduit.java causing NullPointerException when closing 
(#2145)
---
 .../http/asyncclient/AsyncHTTPConduit.java         |   6 +-
 .../asyncclient/URLConnectionAsyncHTTPConduit.java |   6 +-
 .../http/asyncclient/hc5/AsyncHTTPConduit.java     |   6 +-
 .../hc5/URLConnectionAsyncHTTPConduit.java         |   6 +-
 .../org/apache/cxf/systest/jaxrs/BookStore.java    |   8 ++
 .../cxf/systest/jaxrs/JAXRSAsyncClientTest.java    |  10 ++
 .../apache/cxf/systest/hc5/jaxrs/BookStore.java    |   8 ++
 .../systest/hc5/jaxrs/JAXRSAsyncClientTest.java    |  10 ++
 systests/transports/pom.xml                        |  12 ++-
 .../java/org/apache/cxf/systest/hc/jaxrs/Book.java | 116 +++++++++++++++++++++
 .../systest/hc/jaxrs/BookServerAsyncClient.java    | 107 +++++++++++++++++++
 .../apache/cxf/systest/hc}/jaxrs/BookStore.java    |  10 +-
 .../org/apache/cxf/systest/hc/jaxrs/Chapter.java   | 106 +++++++++++++++++++
 .../systest/hc}/jaxrs/JAXRSAsyncClientTest.java    |  14 ++-
 .../org/apache/cxf/systest/hc/jaxrs/RETRIEVE.java  |  33 ++++++
 15 files changed, 450 insertions(+), 8 deletions(-)

diff --git 
a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
 
b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
index 3cb93af102..edf8b8cfb9 100755
--- 
a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
+++ 
b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
@@ -420,7 +420,11 @@ public class AsyncHTTPConduit extends 
HttpClientHTTPConduit {
                     this.basicEntity.setContentLength(out.size());
                     wrappedStream = null;
                     handleHeadersTrustCaching();
-                    out.writeCacheTo(wrappedStream);
+                    // The wrappedStrem could be null for 
KNOWN_HTTP_VERBS_WITH_NO_CONTENT or empty
+                    // requests (org.apache.cxf.empty.request)
+                    if (wrappedStream != null) {
+                        out.writeCacheTo(wrappedStream);
+                    }
                 }
             }
             super.close();
diff --git 
a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/URLConnectionAsyncHTTPConduit.java
 
b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/URLConnectionAsyncHTTPConduit.java
index e7b280811f..9ced688c5e 100755
--- 
a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/URLConnectionAsyncHTTPConduit.java
+++ 
b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/URLConnectionAsyncHTTPConduit.java
@@ -420,7 +420,11 @@ public class URLConnectionAsyncHTTPConduit extends 
URLConnectionHTTPConduit {
                     this.basicEntity.setContentLength(out.size());
                     wrappedStream = null;
                     handleHeadersTrustCaching();
-                    out.writeCacheTo(wrappedStream);
+                    // The wrappedStrem could be null for 
KNOWN_HTTP_VERBS_WITH_NO_CONTENT or empty
+                    // requests (org.apache.cxf.empty.request)
+                    if (wrappedStream != null) {
+                        out.writeCacheTo(wrappedStream);
+                    }
                 }
             }
             super.close();
diff --git 
a/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/AsyncHTTPConduit.java
 
b/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/AsyncHTTPConduit.java
index 689341c4a5..8b27ffeea1 100644
--- 
a/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/AsyncHTTPConduit.java
+++ 
b/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/AsyncHTTPConduit.java
@@ -434,7 +434,11 @@ public class AsyncHTTPConduit extends 
HttpClientHTTPConduit {
                     this.basicEntity.setContentLength(out.size());
                     wrappedStream = null;
                     handleHeadersTrustCaching();
-                    out.writeCacheTo(wrappedStream);
+                    // The wrappedStrem could be null for 
KNOWN_HTTP_VERBS_WITH_NO_CONTENT or empty
+                    // requests (org.apache.cxf.empty.request)
+                    if (wrappedStream != null) {
+                        out.writeCacheTo(wrappedStream);
+                    }
                 }
             }
             super.close();
diff --git 
a/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/URLConnectionAsyncHTTPConduit.java
 
b/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/URLConnectionAsyncHTTPConduit.java
index 81010856e5..6732f1e124 100644
--- 
a/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/URLConnectionAsyncHTTPConduit.java
+++ 
b/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/URLConnectionAsyncHTTPConduit.java
@@ -436,7 +436,11 @@ public class URLConnectionAsyncHTTPConduit extends 
URLConnectionHTTPConduit {
                     this.basicEntity.setContentLength(out.size());
                     wrappedStream = null;
                     handleHeadersTrustCaching();
-                    out.writeCacheTo(wrappedStream);
+                    // The wrappedStrem could be null for 
KNOWN_HTTP_VERBS_WITH_NO_CONTENT or empty
+                    // requests (org.apache.cxf.empty.request)
+                    if (wrappedStream != null) {
+                        out.writeCacheTo(wrappedStream);
+                    }
                 }
             }
             super.close();
diff --git 
a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java 
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
index bdbbeed451..774a8a3aa6 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
@@ -337,6 +337,14 @@ public class BookStore {
         return book;
     }
 
+    @GET
+    @Path("/getbody")
+    @Produces("application/xml")
+    @Consumes("application/xml")
+    public Book getBodyBook(Book book) {
+        return book;
+    }
+
     @POST
     @Path("/echoxmlbookquery")
     @Produces("application/xml")
diff --git 
a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
 
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
index 8d9268c6b2..fd238515fe 100644
--- 
a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
+++ 
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
@@ -166,6 +166,16 @@ public class JAXRSAsyncClientTest extends 
AbstractBusClientServerTestBase {
         wc.close();
     }
 
+    @Test
+    public void testGetWithBody() throws Exception {
+        String address = "http://localhost:"; + PORT + "/bookstore/getbody";
+        WebClient wc = 
createWebClient(address).type("application/xml").accept("application/xml");
+        try (Response response = wc.invoke("GET", new Book("Get", 123L))) {
+            assertEquals(400, response.getStatus());
+        }
+        wc.close();
+    }
+
     @Test
     public void testRetrieveBookCustomMethodAsync() throws Exception {
         String address = "http://localhost:"; + PORT + "/bookstore/retrieve";
diff --git 
a/systests/transport-hc5/src/test/java/org/apache/cxf/systest/hc5/jaxrs/BookStore.java
 
b/systests/transport-hc5/src/test/java/org/apache/cxf/systest/hc5/jaxrs/BookStore.java
index 178f302c08..6b88d01658 100644
--- 
a/systests/transport-hc5/src/test/java/org/apache/cxf/systest/hc5/jaxrs/BookStore.java
+++ 
b/systests/transport-hc5/src/test/java/org/apache/cxf/systest/hc5/jaxrs/BookStore.java
@@ -121,6 +121,14 @@ public class BookStore {
         return book;
     }
 
+    @GET
+    @Path("/getbody")
+    @Produces("application/xml")
+    @Consumes("application/xml")
+    public Book getBodyBook(Book book) {
+        return book;
+    }
+
     @GET
     @Path("setcookies")
     public Response setComplexCookies() {
diff --git 
a/systests/transport-hc5/src/test/java/org/apache/cxf/systest/hc5/jaxrs/JAXRSAsyncClientTest.java
 
b/systests/transport-hc5/src/test/java/org/apache/cxf/systest/hc5/jaxrs/JAXRSAsyncClientTest.java
index fb914bb68d..e1ea7dac93 100644
--- 
a/systests/transport-hc5/src/test/java/org/apache/cxf/systest/hc5/jaxrs/JAXRSAsyncClientTest.java
+++ 
b/systests/transport-hc5/src/test/java/org/apache/cxf/systest/hc5/jaxrs/JAXRSAsyncClientTest.java
@@ -144,6 +144,16 @@ public class JAXRSAsyncClientTest extends 
AbstractBusClientServerTestBase {
         wc.close();
     }
 
+    @Test
+    public void testGetWithBody() throws Exception {
+        String address = "http://localhost:"; + PORT + "/bookstore/getbody";
+        WebClient wc = 
createWebClient(address).type("application/xml").accept("application/xml");
+        try (Response response = wc.invoke("GET", new Book("Get", 123L))) {
+            assertEquals(400, response.getStatus());
+        }
+        wc.close();
+    }
+
     @Test
     public void testRetrieveBookCustomMethodAsync() throws Exception {
         String address = "http://localhost:"; + PORT + "/bookstore/retrieve";
diff --git a/systests/transports/pom.xml b/systests/transports/pom.xml
index 9ccd53e813..5acfee0ee0 100644
--- a/systests/transports/pom.xml
+++ b/systests/transports/pom.xml
@@ -398,6 +398,16 @@
             <version>${cxf.jetty10.version}</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.jaxrs</groupId>
+            <artifactId>jackson-jaxrs-json-provider</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>cglib</groupId>
+            <artifactId>cglib-nodep</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <profiles>
@@ -407,7 +417,7 @@
                 <jdk>[16,)</jdk>
             </activation>
             <properties>
-                <cxf.surefire.fork.vmargs>--add-opens 
java.xml/com.sun.org.apache.xerces.internal.dom=ALL-UNNAMED 
-Djdk.http.auth.tunneling.disabledSchemes=""</cxf.surefire.fork.vmargs>
+                <cxf.surefire.fork.vmargs>--add-opens 
java.xml/com.sun.org.apache.xerces.internal.dom=ALL-UNNAMED 
-Djdk.http.auth.tunneling.disabledSchemes="" --add-opens 
java.base/java.lang=ALL-UNNAMED</cxf.surefire.fork.vmargs>
             </properties>
         </profile>
     </profiles>
diff --git 
a/systests/transports/src/test/java/org/apache/cxf/systest/hc/jaxrs/Book.java 
b/systests/transports/src/test/java/org/apache/cxf/systest/hc/jaxrs/Book.java
new file mode 100644
index 0000000000..7a1ef672b0
--- /dev/null
+++ 
b/systests/transports/src/test/java/org/apache/cxf/systest/hc/jaxrs/Book.java
@@ -0,0 +1,116 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.hc.jaxrs;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
+import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
+
+@JsonTypeInfo(use = Id.CLASS, include = As.PROPERTY, property = "class")
+@XmlRootElement(name = "Book")
+public class Book {
+    private String name;
+    private long id;
+    private Map<Long, Chapter> chapters = new HashMap<>();
+
+    public Book() {
+        Chapter c1 = new Chapter();
+        c1.setId(1L);
+        c1.setTitle("chapter 1");
+        chapters.put(c1.getId(), c1);
+        Chapter c2 = new Chapter();
+        c2.setId(2L);
+        c2.setTitle("chapter 2");
+        chapters.put(c2.getId(), c2);
+    }
+
+    public Book(String name, long id) {
+        this.name = name;
+        this.id = id;
+    }
+
+    public void setName(String n) {
+        name = n;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setId(long i) {
+        id = i;
+    }
+    public long getId() {
+        return id;
+    }
+
+    @PUT
+    public void cloneState(Book book) {
+        id = book.getId();
+        name = book.getName();
+    }
+
+    @GET
+    public Book retrieveState() {
+        return this;
+    }
+
+    @GET
+    @Path("chapters/{chapterid}/")
+    @Produces("application/xml;charset=ISO-8859-1")
+    public Chapter getChapter(@PathParam("chapterid") long chapterid) {
+        return chapters.get(chapterid);
+    }
+
+    @GET
+    @Path("chapters/acceptencoding/{chapterid}/")
+    @Produces("application/xml")
+    public Chapter getChapterAcceptEncoding(@PathParam("chapterid") long 
chapterid) {
+        return chapters.get(chapterid);
+    }
+
+    @GET
+    @Path("chapters/badencoding/{chapterid}/")
+    @Produces("application/xml;charset=UTF-48")
+    public Chapter getChapterBadEncoding(@PathParam("chapterid") long 
chapterid) {
+        return chapters.get(chapterid);
+    }
+
+    @Path("chapters/sub/{chapterid}/")
+    public Chapter getSubChapter(@PathParam("chapterid") long chapterid) {
+        return chapters.get(chapterid);
+    }
+
+    @Path("chaptersobject/sub/{chapterid}/")
+    public Object getSubChapterObject(@PathParam("chapterid") long chapterid) {
+        return getSubChapter(chapterid);
+    }
+
+}
diff --git 
a/systests/transports/src/test/java/org/apache/cxf/systest/hc/jaxrs/BookServerAsyncClient.java
 
b/systests/transports/src/test/java/org/apache/cxf/systest/hc/jaxrs/BookServerAsyncClient.java
new file mode 100644
index 0000000000..671b8809b3
--- /dev/null
+++ 
b/systests/transports/src/test/java/org/apache/cxf/systest/hc/jaxrs/BookServerAsyncClient.java
@@ -0,0 +1,107 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.hc.jaxrs;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.MessageBodyWriter;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
+import org.apache.cxf.jaxrs.provider.StreamingResponseProvider;
+import org.apache.cxf.testutil.common.AbstractServerTestServerBase;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+public class BookServerAsyncClient extends AbstractServerTestServerBase {
+    public static final String PORT = 
allocatePort(BookServerAsyncClient.class);
+
+    @Override
+    protected Server createServer(Bus bus) throws Exception {
+        JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
+        sf.setResourceClasses(BookStore.class);
+        sf.setResourceProvider(BookStore.class,
+                               new SingletonResourceProvider(new BookStore(), 
true));
+        sf.setAddress("http://localhost:"; + PORT + "/");
+        sf.setProvider(new BooleanReaderWriter());
+        sf.setProvider(new JacksonJsonProvider());
+        sf.setProvider(new StreamingResponseProvider<Book>());
+        sf.getProperties(true).put("default.content.type", "*/*");
+        return sf.create();
+    }
+
+    public static void main(String[] args) throws Exception {
+        new BookServerAsyncClient().start();
+    }
+
+    @Consumes("text/boolean")
+    @Produces("text/boolean")
+    public static class BooleanReaderWriter implements
+        MessageBodyReader<Object>, MessageBodyWriter<Boolean> {
+
+        @Override
+        public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, 
MediaType arg3) {
+            return true;
+        }
+
+        @Override
+        public Object readFrom(Class<Object> arg0, Type arg1, Annotation[] 
arg2, MediaType arg3,
+                             MultivaluedMap<String, String> arg4, InputStream 
is) throws IOException,
+            WebApplicationException {
+            return Boolean.valueOf(IOUtils.readStringFromStream(is));
+        }
+
+        @Override
+        public boolean isWriteable(Class<?> type, Type genericType, 
Annotation[] annotations,
+                                   MediaType mediaType) {
+            return true;
+        }
+
+        @Override
+        public long getSize(Boolean t, Class<?> type, Type genericType, 
Annotation[] annotations,
+                            MediaType mediaType) {
+            return -1;
+        }
+
+        @Override
+        public void writeTo(Boolean t, Class<?> type, Type genericType, 
Annotation[] annotations,
+                            MediaType mediaType, MultivaluedMap<String, 
Object> httpHeaders,
+                            OutputStream os) throws IOException, 
WebApplicationException {
+            byte[] bytes = t.toString().getBytes("UTF-8");
+            os.write(bytes);
+
+        }
+
+
+    }
+}
diff --git 
a/systests/transport-hc5/src/test/java/org/apache/cxf/systest/hc5/jaxrs/BookStore.java
 
b/systests/transports/src/test/java/org/apache/cxf/systest/hc/jaxrs/BookStore.java
similarity index 97%
copy from 
systests/transport-hc5/src/test/java/org/apache/cxf/systest/hc5/jaxrs/BookStore.java
copy to 
systests/transports/src/test/java/org/apache/cxf/systest/hc/jaxrs/BookStore.java
index 178f302c08..85abcbf2f1 100644
--- 
a/systests/transport-hc5/src/test/java/org/apache/cxf/systest/hc5/jaxrs/BookStore.java
+++ 
b/systests/transports/src/test/java/org/apache/cxf/systest/hc/jaxrs/BookStore.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.systest.hc5.jaxrs;
+package org.apache.cxf.systest.hc.jaxrs;
 
 import java.io.IOException;
 import java.io.OutputStream;
@@ -121,6 +121,14 @@ public class BookStore {
         return book;
     }
 
+    @GET
+    @Path("/getbody")
+    @Produces("application/xml")
+    @Consumes("application/xml")
+    public Book getBodyBook(Book book) {
+        return book;
+    }
+
     @GET
     @Path("setcookies")
     public Response setComplexCookies() {
diff --git 
a/systests/transports/src/test/java/org/apache/cxf/systest/hc/jaxrs/Chapter.java
 
b/systests/transports/src/test/java/org/apache/cxf/systest/hc/jaxrs/Chapter.java
new file mode 100644
index 0000000000..2040ddebb5
--- /dev/null
+++ 
b/systests/transports/src/test/java/org/apache/cxf/systest/hc/jaxrs/Chapter.java
@@ -0,0 +1,106 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.hc.jaxrs;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.UriInfo;
+import javax.xml.bind.annotation.XmlRootElement;
+
+
+@XmlRootElement(name = "Chapter")
+public class Chapter {
+    private String title;
+    private long id;
+
+    public Chapter() {
+    }
+
+    public void setTitle(String n) {
+        title = n;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setId(long i) {
+        id = i;
+    }
+    public long getId() {
+        return id;
+    }
+
+    @GET
+    @Path("/recurse")
+    @Produces("application/xml")
+    public Chapter getItself() {
+        return this;
+    }
+
+    @Path("/recurse2")
+    public Chapter getItself2() {
+        return this;
+    }
+
+    @GET
+    @Produces("application/xml;charset=ISO-8859-1")
+    public Chapter get() {
+        return this;
+    }
+
+    @GET
+    @Path("/ids")
+    @Produces("application/xml;charset=ISO-8859-1")
+    public Chapter getWithBookId(@PathParam("bookId") int bookId,
+                                 @PathParam("chapterid") int chapterId) {
+        if (bookId != 123 || chapterId != 1) {
+            throw new RuntimeException();
+        }
+        return this;
+    }
+
+
+    @GET
+    @Path("/matched-resources")
+    @Produces("text/plain")
+    public String getMatchedResources(@Context UriInfo ui) {
+        List<String> list = new ArrayList<>();
+        for (Object obj : ui.getMatchedResources()) {
+            list.add(obj.toString());
+        }
+        return list.toString();
+    }
+
+    @GET
+    @Path("/matched!uris")
+    @Produces("text/plain")
+    public String getMatchedUris(@Context UriInfo ui,
+                                 @QueryParam("decode") String decode) {
+        return ui.getMatchedURIs(Boolean.parseBoolean(decode)).toString();
+    }
+}
diff --git 
a/systests/transport-hc5/src/test/java/org/apache/cxf/systest/hc5/jaxrs/JAXRSAsyncClientTest.java
 
b/systests/transports/src/test/java/org/apache/cxf/systest/hc/jaxrs/JAXRSAsyncClientTest.java
similarity index 97%
copy from 
systests/transport-hc5/src/test/java/org/apache/cxf/systest/hc5/jaxrs/JAXRSAsyncClientTest.java
copy to 
systests/transports/src/test/java/org/apache/cxf/systest/hc/jaxrs/JAXRSAsyncClientTest.java
index fb914bb68d..c81ca6a598 100644
--- 
a/systests/transport-hc5/src/test/java/org/apache/cxf/systest/hc5/jaxrs/JAXRSAsyncClientTest.java
+++ 
b/systests/transports/src/test/java/org/apache/cxf/systest/hc/jaxrs/JAXRSAsyncClientTest.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.systest.hc5.jaxrs;
+package org.apache.cxf.systest.hc.jaxrs;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
@@ -61,7 +61,7 @@ import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
-import org.apache.cxf.transport.http.asyncclient.hc5.AsyncHTTPConduit;
+import org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit;
 import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
 
 import org.junit.BeforeClass;
@@ -144,6 +144,16 @@ public class JAXRSAsyncClientTest extends 
AbstractBusClientServerTestBase {
         wc.close();
     }
 
+    @Test
+    public void testGetWithBody() throws Exception {
+        String address = "http://localhost:"; + PORT + "/bookstore/getbody";
+        WebClient wc = 
createWebClient(address).type("application/xml").accept("application/xml");
+        try (Response response = wc.invoke("GET", new Book("Get", 123L))) {
+            assertEquals(400, response.getStatus());
+        }
+        wc.close();
+    }
+
     @Test
     public void testRetrieveBookCustomMethodAsync() throws Exception {
         String address = "http://localhost:"; + PORT + "/bookstore/retrieve";
diff --git 
a/systests/transports/src/test/java/org/apache/cxf/systest/hc/jaxrs/RETRIEVE.java
 
b/systests/transports/src/test/java/org/apache/cxf/systest/hc/jaxrs/RETRIEVE.java
new file mode 100644
index 0000000000..20e0cc5dd3
--- /dev/null
+++ 
b/systests/transports/src/test/java/org/apache/cxf/systest/hc/jaxrs/RETRIEVE.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.hc.jaxrs;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.ws.rs.HttpMethod;
+
+@Target({ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+@HttpMethod("RETRIEVE")
+public @interface RETRIEVE {
+
+}

Reply via email to