cxf-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=1435036&view=rev
Log:
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.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java

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

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Jan 18 06:09:01 2013
@@ -1 +1 @@
-/cxf/trunk:1-1430398,1430564,1430881-1430882,1430905,1430965,1430976,1431315,1431604-1431607,1432070,1432236,1432798,1433007,1433033,1433135,1433305,1433347,1433895,1434042,1434124,1434564
+/cxf/trunk:1-1430398,1430564,1430881-1430882,1430905,1430965,1430976,1431315,1431604-1431607,1432070,1432236,1432798,1433007,1433033,1433135,1433305,1433347,1433895,1434042,1434124,1434564,1435034

Modified: cxf/branches/2.7.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java?rev=1435036&r1=1435035&r2=1435036&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java
Fri Jan 18 06:09:01 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