cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tam Freestone-Bayes (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-5688) Problem Parsing FIQL Involving Enums
Date Thu, 02 Oct 2014 11:05:34 GMT

    [ https://issues.apache.org/jira/browse/CXF-5688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14156372#comment-14156372
] 

Tam Freestone-Bayes commented on CXF-5688:
------------------------------------------

Hello Sergey,

While the addition of a property to override this behaviour is appreciated, the change to
apply toUpperCase() to Enum comparison values is a breaking change from 2.6 to 2.7+. 

If only using CXF for its FiqlParser, then convertStringToPrimitive() breaks things when passed
Enums that are not upper case (say, for instance, because values in legacy databases are lower
or mixed case). In this situation, where only the FIQL Parser features of CXF are in use,
there is no access to configuration properties via MessageUtils (there is no "current" message
or relevant PhaseInterceptorChain). The only way to access a configuration property via MessageUtils
requires additional dependencies on other parts of CXF that are not directly relevant to FIQL.

The base assumption that all Enum values would be uppercase in the first place seems incorrect.
A developer can easily handle the "brittle" situation where, as you suggest, client-provided
input may be in the incorrect case, by ensuring that any case validation is pre-applied to
the fiqlExpression String passed to FiqlParser's parse() method.

If this auto-uppercase behaviour is to be incorporated, then it would make sense for it to
default to "off" rather than "on". It may also be helpful to move its configuration to somewhere
that is not tied to CXF's messaging components.

Kind regards,
tam

> Problem Parsing FIQL Involving Enums
> ------------------------------------
>
>                 Key: CXF-5688
>                 URL: https://issues.apache.org/jira/browse/CXF-5688
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>            Reporter: Azitabh
>            Assignee: Sergey Beryozkin
>            Priority: Minor
>             Fix For: 3.0.0, 2.7.12
>
>
> FIQL parser assumes that enums would be defined in all caps. 
> In case Enums are not defined in all caps, InjectionUtils.convertStringToPrimitive(String
value, Class<?> cls) raises PropertyNotFoundException because it's converting the user
provided enum value to caps and calling ENUM.valueOf(UPPERCASE_STR).
> ethod m  = cls.getMethod("valueOf", new Class[]{String.class});
> return m.invoke(null, value.toUpperCase());
> Since JAVA doesn't enforce enums to be all caps, I don't see any reason why FIQLParser
should assume this.
> https://github.com/apache/cxf/blob/master/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message