Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4055

Parameter Handler not Invoked if Constructor or Static Methods Succeed

    XMLWordPrintableJSON

Details

    • Novice

    Description

      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).

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            hijon89 Jonathan Haber
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 3h
                3h
                Remaining:
                Remaining Estimate - 3h
                3h
                Logged:
                Time Spent - Not Specified
                Not Specified