cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6701] Checking field annotations on super classes
Date Thu, 03 Dec 2015 15:41:29 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes a67a0a692 -> 44316035a


[CXF-6701] Checking field annotations on super classes


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/44316035
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/44316035
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/44316035

Branch: refs/heads/3.1.x-fixes
Commit: 44316035a065b648b65737e4597050dd7bff24ae
Parents: a67a0a6
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Thu Dec 3 15:40:13 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Thu Dec 3 15:40:55 2015 +0000

----------------------------------------------------------------------
 .../cxf/jaxrs/client/ClientProxyImpl.java       | 13 ++++++++++-
 .../org/apache/cxf/systest/jaxrs/BookStore.java | 24 ++++++++++++--------
 2 files changed, 26 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/44316035/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
----------------------------------------------------------------------
diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
index 37b798f..4f25895 100644
--- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
+++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
@@ -534,7 +534,7 @@ public class ClientProxyImpl extends AbstractClient implements
                         }
                     } else {
                         String fieldName = StringUtils.uncapitalize(propertyName);
-                        Field f = ReflectionUtil.getDeclaredField(bean.getClass(), fieldName);
+                        Field f = getDeclaredField(bean.getClass(), fieldName);
                         if (f == null) {
                             continue;
                         }
@@ -560,6 +560,17 @@ public class ClientProxyImpl extends AbstractClient implements
         return values;
     }
     
+    private static Field getDeclaredField(Class<?> cls, String fieldName) {
+        if (cls == null || cls == Object.class) {
+            return null;
+        }
+        Field f = ReflectionUtil.getDeclaredField(cls, fieldName);
+        if (f != null) {
+            return f;
+        }
+        return getDeclaredField(cls.getSuperclass(), fieldName);
+    }
+    
     private void handleMatrixes(Method m,
                                 Object[] params,
                                 MultivaluedMap<ParameterType, Parameter> map,

http://git-wip-us.apache.org/repos/asf/cxf/blob/44316035/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
----------------------------------------------------------------------
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 a0d506b..4192ee1 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
@@ -1775,10 +1775,22 @@ public class BookStore {
                                     handler);
     }
     
-    public static class BookBean {
-        private long id;
+    public abstract static class AbstractBookBean {
         @QueryParam("id_2")
         private long id2;
+        public long getId2() {
+            return id2;
+        }
+
+        public void setId2(long id2) {
+            this.id2 = id2;
+        }
+    }
+    
+    public static class BookBean extends AbstractBookBean {
+        private long id;
+        
+        
         private long id3;
         private BookBeanNested nested;
 
@@ -1791,14 +1803,6 @@ public class BookStore {
             this.id = id;
         }
         
-        public long getId2() {
-            return id2;
-        }
-
-        public void setId2(long id2) {
-            this.id2 = id2;
-        }
-        
         @Context
         public void setUriInfo(UriInfo ui) {
             String id3Value = ui.getQueryParameters().getFirst("id3");


Mime
View raw message