You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2014/10/06 12:59:19 UTC

git commit: [CXF-5688] Ninor adjustments to the enum conversion code

Repository: cxf
Updated Branches:
  refs/heads/master 9a67cc9cd -> 691073067


[CXF-5688] Ninor adjustments to the enum conversion code


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

Branch: refs/heads/master
Commit: 691073067f89097ca951b89dafad82a5677417f4
Parents: 9a67cc9
Author: Sergey Beryozkin <sb...@talend.com>
Authored: Mon Oct 6 11:59:00 2014 +0100
Committer: Sergey Beryozkin <sb...@talend.com>
Committed: Mon Oct 6 11:59:00 2014 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/jaxrs/utils/InjectionUtils.java | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/69107306/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
index d59535f..cab2f3b 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
@@ -1296,10 +1296,21 @@ public final class InjectionUtils {
         } else if (cls.isPrimitive()) {
             return PrimitiveUtils.read(value, cls);
         } else if (cls.isEnum()) {
-            if (m == null || !MessageUtils.getContextualBoolean(m, ENUM_CONVERSION_CASE_SENSITIVE, false)) {
-                value = value.toUpperCase();
+            if (m != null && !MessageUtils.getContextualBoolean(m, ENUM_CONVERSION_CASE_SENSITIVE, false)) {
+                obj = invokeValueOf(value.toUpperCase(), cls);
             }
-            return invokeValueOf(value, cls);
+            if (obj == null) {
+                try {
+                    obj = invokeValueOf(value, cls);
+                } catch (RuntimeException ex) {
+                    if (m == null) {
+                        obj = invokeValueOf(value.toUpperCase(), cls);
+                    } else {
+                        throw ex;
+                    }
+                }
+            }
+            return obj;
         } else {
             try {
                 Constructor<?> c = cls.getConstructor(new Class<?>[]{String.class});