You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Jonathan Haber (Created) (JIRA)" <ji...@apache.org> on 2012/01/23 18:24:40 UTC

[jira] [Created] (CXF-4055) Parameter Handler not Invoked if Constructor or Static Methods Succeed

Parameter Handler not Invoked if Constructor or Static Methods Succeed
----------------------------------------------------------------------

                 Key: CXF-4055
                 URL: https://issues.apache.org/jira/browse/CXF-4055
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 2.5.1
            Reporter: Jonathan Haber
            Priority: Minor
             Fix For: 2.5.2


My reading of InjectionUtils suggests that when performing type conversion, custom parameter handlers appear to be the last resort. If the object has a single-string constructor or a static valueOf/fromString method and any of these succeed, custom parameter handlers will not be invoked. 

This is causing issues in our application where users are able to define their own date formats and the string values are passed as query parameters. We implemented ParameterHandler<Date> and in the fromString body parse the string value according to the specific user's date format. But depending on the date format, the String constructor of java.util.Date may or may not throw an exception depending on the specific date format. If it does not succeed, our parameter handler is reached and all is well. But if it does "succeed" this date will be used by CXF and our parameter handler is never reached (This is a problem because even if the constructor doesn't throw an exception, the date is usually parsed incorrectly and represents the wrong date).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CXF-4055) Parameter Handler not Invoked if Constructor or Static Methods Succeed

Posted by "Sergey Beryozkin (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4055?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-4055.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.6
                   2.5.3
                   2.4.7
                   2.3.10
         Assignee: Sergey Beryozkin

Handlers for Date & Locale will always be checked first, additionally a "check.parameter.handlers.first" contextual property can be set to true if some other types are processed
                
> Parameter Handler not Invoked if Constructor or Static Methods Succeed
> ----------------------------------------------------------------------
>
>                 Key: CXF-4055
>                 URL: https://issues.apache.org/jira/browse/CXF-4055
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.5.1
>            Reporter: Jonathan Haber
>            Assignee: Sergey Beryozkin
>            Priority: Minor
>              Labels: injectionutils, jaxrs, parameterhandler, queryparam
>             Fix For: 2.3.10, 2.4.7, 2.5.3, 2.6
>
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> My reading of InjectionUtils suggests that when performing type conversion, custom parameter handlers appear to be the last resort. If the object has a single-string constructor or a static valueOf/fromString method and any of these succeed, custom parameter handlers will not be invoked. 
> This is causing issues in our application where users are able to define their own date formats and the string values are passed as query parameters. We implemented ParameterHandler<Date> and in the fromString body parse the string value according to the specific user's date format. But depending on the date format, the String constructor of java.util.Date may or may not throw an exception depending on the specific date format. If it does not succeed, our parameter handler is reached and all is well. But if it does "succeed" this date will be used by CXF and our parameter handler is never reached (This is a problem because even if the constructor doesn't throw an exception, the date is usually parsed incorrectly and represents the wrong date).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CXF-4055) Parameter Handler not Invoked if Constructor or Static Methods Succeed

Posted by "Daniel Kulp (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4055?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp updated CXF-4055:
-----------------------------

    Fix Version/s:     (was: 2.5.2)
    
> Parameter Handler not Invoked if Constructor or Static Methods Succeed
> ----------------------------------------------------------------------
>
>                 Key: CXF-4055
>                 URL: https://issues.apache.org/jira/browse/CXF-4055
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.5.1
>            Reporter: Jonathan Haber
>            Priority: Minor
>              Labels: injectionutils, jaxrs, parameterhandler, queryparam
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> My reading of InjectionUtils suggests that when performing type conversion, custom parameter handlers appear to be the last resort. If the object has a single-string constructor or a static valueOf/fromString method and any of these succeed, custom parameter handlers will not be invoked. 
> This is causing issues in our application where users are able to define their own date formats and the string values are passed as query parameters. We implemented ParameterHandler<Date> and in the fromString body parse the string value according to the specific user's date format. But depending on the date format, the String constructor of java.util.Date may or may not throw an exception depending on the specific date format. If it does not succeed, our parameter handler is reached and all is well. But if it does "succeed" this date will be used by CXF and our parameter handler is never reached (This is a problem because even if the constructor doesn't throw an exception, the date is usually parsed incorrectly and represents the wrong date).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CXF-4055) Parameter Handler not Invoked if Constructor or Static Methods Succeed

Posted by "Jonathan Haber (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13191278#comment-13191278 ] 

Jonathan Haber commented on CXF-4055:
-------------------------------------

At the very least I think an option should be added to the configuration that allows parameter handlers to override constructors/static methods.
                
> Parameter Handler not Invoked if Constructor or Static Methods Succeed
> ----------------------------------------------------------------------
>
>                 Key: CXF-4055
>                 URL: https://issues.apache.org/jira/browse/CXF-4055
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.5.1
>            Reporter: Jonathan Haber
>            Priority: Minor
>              Labels: injectionutils, jaxrs, parameterhandler, queryparam
>             Fix For: 2.5.2
>
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> My reading of InjectionUtils suggests that when performing type conversion, custom parameter handlers appear to be the last resort. If the object has a single-string constructor or a static valueOf/fromString method and any of these succeed, custom parameter handlers will not be invoked. 
> This is causing issues in our application where users are able to define their own date formats and the string values are passed as query parameters. We implemented ParameterHandler<Date> and in the fromString body parse the string value according to the specific user's date format. But depending on the date format, the String constructor of java.util.Date may or may not throw an exception depending on the specific date format. If it does not succeed, our parameter handler is reached and all is well. But if it does "succeed" this date will be used by CXF and our parameter handler is never reached (This is a problem because even if the constructor doesn't throw an exception, the date is usually parsed incorrectly and represents the wrong date).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira