cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1435037 - in /cxf/branches/2.6.x-fixes: ./ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java
Date Fri, 18 Jan 2013 06:12:33 GMT
Author: ema
Date: Fri Jan 18 06:12:32 2013
New Revision: 1435037

URL: http://svn.apache.org/viewvc?rev=1435037&view=rev
Log:
Merged revisions 1435036 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes

................
  r1435036 | ema | 2013-01-18 14:09:01 +0800 (Fri, 18 Jan 2013) | 9 lines
  
  Merged revisions 1435034 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1435034 | ema | 2013-01-18 14:03:23 +0800 (Fri, 18 Jan 2013) | 1 line
    
    CXF-4735:@XmlJavaTypeAdapter ignored on exception setters(Patch from Richard)
  ........
................

Modified:
    cxf/branches/2.6.x-fixes/   (props changed)
    cxf/branches/2.6.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/branches/2.7.x-fixes:r1435036
  Merged /cxf/trunk:r1435034

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.6.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java?rev=1435037&r1=1435036&r2=1435037&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java
Fri Jan 18 06:12:32 2013
@@ -148,22 +148,25 @@ final class Utils {
     }
     
     private static boolean isGetter(Method m) {
-        Class<?> declaringClass = m.getDeclaringClass();
-        if (m.getReturnType() != Void.class && m.getParameterTypes().length == 0)
{
-            final int index = getterIndex(m.getName());
-            if (index != -1) {
-                String setterName = "set" + m.getName().substring(index);
-                Class<?> paramTypes = m.getReturnType();
-                Method setter = getDeclaredMethod(declaringClass, setterName, paramTypes);
-                
-                if (setter != null && setter.isAnnotationPresent(XmlTransient.class))
{
-                    return false;
-                } 
-                return true;
+        if (m.getReturnType() != Void.class && m.getReturnType() != Void.TYPE &&
m.getParameterTypes().length == 0) {
+            Method setter = getSetter(m);
+            if (setter != null) {
+                return !setter.isAnnotationPresent(XmlTransient.class);
             }
+            return true;
         }
         return false;
     }
+
+    private static Method getSetter(Method m) {
+        final int index = getterIndex(m.getName());
+        if (index != -1) {
+            String setterName = "set" + m.getName().substring(index);
+            Class<?> paramTypes = m.getReturnType();
+            return getDeclaredMethod(m.getDeclaringClass(), setterName, paramTypes);
+        }
+        return null;
+    }
     
     private static boolean isSetter(Method m) {
         Class<?> declaringClass = m.getDeclaringClass();
@@ -266,6 +269,12 @@ final class Utils {
     static XmlJavaTypeAdapter getMethodXJTA(final Method m) {
         XmlJavaTypeAdapter adapter = m.getAnnotation(XmlJavaTypeAdapter.class);
         if (adapter == null) {
+            Method setter = getSetter(m);
+            if (setter != null) {
+                adapter = setter.getAnnotation(XmlJavaTypeAdapter.class);
+            }
+        }
+        if (adapter == null) {
             adapter = m.getReturnType().getAnnotation(XmlJavaTypeAdapter.class);
         }
         if (adapter == null) {
@@ -281,7 +290,7 @@ final class Utils {
         }
         return adapter;
     }
-
+    
     static Type getTypeFromXmlAdapter(XmlJavaTypeAdapter xjta) {
         if (xjta != null) {
             Class<?> c2 = xjta.value();



Mime
View raw message