You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2021/06/22 21:52:35 UTC

[cxf] branch 3.3.x-fixes updated (18407bd -> abaf852)

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

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


    from 18407bd  Skip TLSv1 and TLSv1.1 test cases when these protocols are disabled (JDK16+)
     new 5e5352e  Fixing CXF-8514 & CXF-8515, NPE during ResourceContext contextual injection (#817)
     new abaf852  Recording .gitmergeinfo Changes

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .gitmergeinfo                                      |  4 +++
 .../org/apache/cxf/jaxrs/utils/JAXRSUtils.java     |  5 ++-
 .../systest/jaxrs/JAXRS20ClientServerBookTest.java | 38 +++++++++++++++++++++-
 3 files changed, 45 insertions(+), 2 deletions(-)

[cxf] 02/02: Recording .gitmergeinfo Changes

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit abaf852da10878948e10507681b5758483f383f6
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Tue Jun 22 17:52:16 2021 -0400

    Recording .gitmergeinfo Changes
---
 .gitmergeinfo | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/.gitmergeinfo b/.gitmergeinfo
index 8af95bb..6af5e7c 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -906,6 +906,7 @@ M a7e3d0cfb720310bbd17315de3a9ece7fe4e697e
 M a8fcf81a7a7f06a9c5ffb75cbe372b841f4ba38c
 M a9ba4196e8f914b04c1465f909a68122b4ce7fdf
 M a9eb350f7cc28347ffeb7a8af44ba661531429f1
+M aa5d15f2bd08b120eae082ebefb02f80a1e78cb7
 M aa995675095ca648c1458cb8bf82c357160dfe16
 M aabf37788e571426e70250e7a62c7f4502e4d6e9
 M aaf6d041f6d0671a08f38133bfd5196f9ee8ad0b
@@ -929,6 +930,7 @@ M be41158d8c65b227c77d927ace7ca30c7c6dd015
 M be75ea56aa3724bcdc7f8223cd8cc129a08fdf44
 M bf1b85003e89c4b3e28384f0de476cf0e5b1af12
 M bfc509c206d67124d3f0ae46cea6963cabb8f3ca
+M c014484a5bb740bae2e3bcee071c936f159869c5
 M c0690e1fa57e0231461c9dd644d6b3c80852eef9
 M c070a8f50d83b82d864884020a64d1d67f5e7c95
 M c0d43454ebc8ef766c94404d5d897675ac704a09
@@ -962,6 +964,7 @@ M d8619b13cd9ff375590946c1349f6fe374959f30
 M d875ceee917237f5c344df989947aff025d45d4f
 M d88202133e39bebdb966b6ccfed57e1ff9d73638
 M da8b11585ed2eca131a8c12bcad3e838f3f4434d
+M dad173bd043cbbf214acf76e8407deec712d8ecf
 M dc5660291478e5429eadc69dfd6dd8c7051b0be1
 M dca1f9a88bbd11f52cc565f4ae4bc61372ecc53b
 M dccf38113b9a3566b0c2360ea2e129694938639a
@@ -990,6 +993,7 @@ M f275d9d39a92781536259cdf4dd79bfa2987c2b4
 M f2db0305bb77f3d54b493ed54ea926a614b26e20
 M f315acdde42f967102c7503d46d1edbb3affc210
 M f355b9b3ec8b6f77198baefa051bd817807e5a94
+M f39a5f30f192a15fbd014219fef63a2685d27708
 M f3e2a52faec1210b1a45eaa36e3812ca03a4969d
 M f401076b1c98fe0d43865f1ea633301725866f8c
 M f4a82cd5ebf2675085e7aa48bbcd10b50b1dd337

[cxf] 01/02: Fixing CXF-8514 & CXF-8515, NPE during ResourceContext contextual injection (#817)

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 5e5352eeb29df607822217c7f0276f6752ece071
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Mon Jun 21 22:04:01 2021 -0400

    Fixing CXF-8514 & CXF-8515, NPE during ResourceContext contextual injection (#817)
    
    (cherry picked from commit 60752e33639c92f912936c72f836bb1c6e6603f4)
    (cherry picked from commit 179f96b1568b30e728e5bc1e9fb5b0679a844f0d)
---
 .../org/apache/cxf/jaxrs/utils/JAXRSUtils.java     |  5 ++-
 .../systest/jaxrs/JAXRS20ClientServerBookTest.java | 38 +++++++++++++++++++++-
 2 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
index 52a8bf1..5923836 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
@@ -1175,7 +1175,10 @@ public final class JAXRSUtils {
         } else if (ResourceInfo.class.isAssignableFrom(clazz)) {
             o = new ResourceInfoImpl(contextMessage);
         } else if (ResourceContext.class.isAssignableFrom(clazz)) {
-            o = new ResourceContextImpl(contextMessage, contextMessage.getExchange().get(OperationResourceInfo.class));
+            final OperationResourceInfo ori = contextMessage.getExchange().get(OperationResourceInfo.class);
+            if (ori != null) {
+                o = new ResourceContextImpl(contextMessage, ori);
+            }
         } else if (Request.class.isAssignableFrom(clazz)) {
             o = new RequestImpl(contextMessage);
         } else if (Providers.class.isAssignableFrom(clazz)) {
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java
index 3a2e996..9c105a1 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java
@@ -45,6 +45,8 @@ import javax.ws.rs.client.Invocation;
 import javax.ws.rs.client.InvocationCallback;
 import javax.ws.rs.client.ResponseProcessingException;
 import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.container.ResourceContext;
+import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Feature;
 import javax.ws.rs.core.FeatureContext;
 import javax.ws.rs.core.GenericEntity;
@@ -240,6 +242,17 @@ public class JAXRS20ClientServerBookTest extends AbstractBusClientServerTestBase
         assertEquals(124L, book.getId());
 
     }
+    
+    @Test
+    public void testGetBookWebTargetInjectableProvider() {
+        String address = "http://localhost:" + PORT + "/bookstore/bookheaders";
+        Client client = ClientBuilder.newClient();
+        client.register(new BookInfoInjectableReader());
+        BookInfo book = client.target(address).path("simple")
+            .request("application/xml").get(BookInfo.class);
+        assertEquals(124L, book.getId());
+
+    }
 
     @Test
     public void testGetBookSyncWithAsync() {
@@ -1061,9 +1074,31 @@ public class JAXRS20ClientServerBookTest extends AbstractBusClientServerTestBase
 
     }
 
-    private static class BookInfoReader implements MessageBodyReader<BookInfo> {
+    private static class BookInfoInjectableReader implements MessageBodyReader<BookInfo> {
+        @Context private ResourceContext resourceContext;
+
+        @Override
+        public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+            return true;
+        }
 
         @Override
+        public BookInfo readFrom(Class<BookInfo> arg0, Type arg1, Annotation[] anns, MediaType mt,
+                                 MultivaluedMap<String, String> headers, InputStream is) throws IOException,
+            WebApplicationException {
+            
+            if (resourceContext == null) {
+                throw new WebApplicationException("The resourceContext should not be null");
+            }
+            
+            Book book = new JAXBElementProvider<Book>().readFrom(Book.class, Book.class, anns, mt, headers, is);
+            return new BookInfo(book);
+        }
+
+    }
+    
+    private static class BookInfoReader implements MessageBodyReader<BookInfo> {
+        @Override
         public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
             return true;
         }
@@ -1077,6 +1112,7 @@ public class JAXRS20ClientServerBookTest extends AbstractBusClientServerTestBase
         }
 
     }
+
     private static class ClientTestFeature implements Feature {
 
         @Override