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:42:26 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 3aca88243 -> 3459edc0e


[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/3459edc0
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/3459edc0
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/3459edc0

Branch: refs/heads/3.0.x-fixes
Commit: 3459edc0e80780eb501b02d162a18f2f50c4ab51
Parents: 3aca882
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:42:12 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/3459edc0/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 0049f51..3a2dd9c 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
@@ -537,7 +537,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;
                         }
@@ -563,6 +563,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/3459edc0/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 b122546..60a7341 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