Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2A08110CBB for ; Wed, 30 Apr 2014 11:02:15 +0000 (UTC) Received: (qmail 12487 invoked by uid 500); 30 Apr 2014 11:02:13 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 12365 invoked by uid 500); 30 Apr 2014 11:02:07 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 12350 invoked by uid 99); 30 Apr 2014 11:02:06 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Apr 2014 11:02:06 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B88C781528D; Wed, 30 Apr 2014 11:02:05 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergeyb@apache.org To: commits@cxf.apache.org Message-Id: <8119f7e6fc3942799ac66dc0f3195c38@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: [CXF-5717] Checking registered Param converters Date: Wed, 30 Apr 2014 11:02:05 +0000 (UTC) Repository: cxf Updated Branches: refs/heads/master fc4f04e39 -> a5be50145 [CXF-5717] Checking registered Param converters Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/a5be5014 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a5be5014 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a5be5014 Branch: refs/heads/master Commit: a5be50145737273c5694f05409d065b98dfa2e22 Parents: fc4f04e Author: Sergey Beryozkin Authored: Wed Apr 30 12:01:46 2014 +0100 Committer: Sergey Beryozkin Committed: Wed Apr 30 12:01:46 2014 +0100 ---------------------------------------------------------------------- .../java/org/apache/cxf/jaxrs/utils/InjectionUtils.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/a5be5014/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 193097c..2a3114c 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 @@ -92,7 +92,6 @@ import org.apache.cxf.jaxrs.provider.ServerProviderFactory; import org.apache.cxf.message.Exchange; import org.apache.cxf.message.Message; import org.apache.cxf.message.MessageUtils; -import org.apache.cxf.phase.PhaseInterceptorChain; public final class InjectionUtils { @@ -1254,12 +1253,21 @@ public final class InjectionUtils { } } public static Object convertStringToPrimitive(String value, Class cls) { + return convertStringToPrimitive(value, cls, new Annotation[]{}); + } + public static Object convertStringToPrimitive(String value, Class cls, Annotation[] anns) { + Message m = JAXRSUtils.getCurrentMessage(); + if (m != null) { + ParamConverter pc = ServerProviderFactory.getInstance(m).createParameterHandler(cls, anns); + if (pc != null) { + return pc.fromString(value); + } + } if (String.class == cls) { return value; } else if (cls.isPrimitive()) { return PrimitiveUtils.read(value, cls); } else if (cls.isEnum()) { - Message m = PhaseInterceptorChain.getCurrentMessage(); if (m == null || !MessageUtils.getContextualBoolean(m, ENUM_CONVERSION_CASE_SENSITIVE, false)) { value = value.toUpperCase(); }