You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2018/08/09 04:55:58 UTC
tomee git commit: Convert anything supported by xbean-reflect
Repository: tomee
Updated Branches:
refs/heads/master 6f9f2cb79 -> 1217e64a8
Convert anything supported by xbean-reflect
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/1217e64a
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/1217e64a
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/1217e64a
Branch: refs/heads/master
Commit: 1217e64a8a3eef021e9cad1e6eb02a4e5d2d38c4
Parents: 6f9f2cb
Author: dblevins <da...@gmail.com>
Authored: Wed Aug 8 21:55:43 2018 -0700
Committer: dblevins <da...@gmail.com>
Committed: Wed Aug 8 21:55:43 2018 -0700
----------------------------------------------------------------------
.../java/org/apache/tomee/microprofile/jwt/cdi/ClaimBean.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/1217e64a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/ClaimBean.java
----------------------------------------------------------------------
diff --git a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/ClaimBean.java b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/ClaimBean.java
index f36405b..31093c8 100644
--- a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/ClaimBean.java
+++ b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/ClaimBean.java
@@ -16,6 +16,7 @@
*/
package org.apache.tomee.microprofile.jwt.cdi;
+import org.apache.xbean.propertyeditor.PropertyEditors;
import org.eclipse.microprofile.jwt.Claim;
import org.eclipse.microprofile.jwt.ClaimValue;
import org.eclipse.microprofile.jwt.Claims;
@@ -256,9 +257,11 @@ public class ClaimBean<T> implements Bean<T>, PassivationCapable {
// handle JsonValue<T> (number, string, etc)
return (T) toJson(key);
- } else if (((Class<?>) ip.getType()).isEnum()) {
+ } else if (PropertyEditors.canConvert((Class<?>) ip.getType())) {
try {
- return (T) ((Class<?>) ip.getType()).getMethod("valueOf", String.class).invoke(null, getClaimValue(key).toString());
+ final Class<?> type = (Class<?>) ip.getType();
+ final String claimValue = getClaimValue(key).toString();
+ return (T) PropertyEditors.getValue(type, claimValue);
} catch (Exception e) {
}
} else {