cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: [CXF-5688] Ninor adjustments to the enum conversion code
Date Mon, 06 Oct 2014 11:04:16 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes c26d81446 -> 07c973bbf


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

Branch: refs/heads/2.7.x-fixes
Commit: 07c973bbfd140c7c717c03f086a2e280e307b9bd
Parents: c26d814
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Mon Oct 6 11:59:00 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Mon Oct 6 12:03:53 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/07c973bb/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 84461b4..4ffa13c 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
@@ -1268,10 +1268,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});


Mime
View raw message