RESTEasy
  1. RESTEasy
  2. RESTEASY-428

StringParameterInjector uses valueOf for Enums but JAXB creates fromValue

    Details

    • Type: Bug Bug
    • Status: Closed (View Workflow)
    • Priority: Major Major
    • Resolution: Done
    • Affects Version/s: 1.2.GA
    • Fix Version/s: 2.0.1.GA
    • Component/s: jaxrs
    • Labels:
      None
    • Estimated Difficulty:
      Low
    • Similar Issues:
      Show 10 results 

      Description

      Enums generated by JAXB include a fromValue method that converts an incoming value into the relevant constant. RestEasy is currently not compatible with JAXB generated enums, as it uses the valueOf method instead (which requires a string value that exactly matches the constant name).

      Can a simple change be considerd (to org.jboss.resteasy.core.StringParameterUnmarshallerBinder) to support the JAXB generated fromValue method?

      I've noticed that this problem has been fixed in CXF:
      https://issues.apache.org/jira/browse/CXF-2390

      (http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java line 319)

        Gliffy Diagrams

          Activity

          Hide
          Bill Burke added a comment -

          yup, i could do this. Can you give more details? Like attach a enum generated JAXB class?

          Show
          Bill Burke added a comment - yup, i could do this. Can you give more details? Like attach a enum generated JAXB class?
          Hide
          Joe Littlejohn added a comment -

          Thanks for the attention Bill!

          See attached JAXB generated Enum example.

          The schema document defines four values (north, south, east, west) for the enumeration 'Location'. These values are mapped to the constant values using fromValue(String), but (according to the JAXB spec) the constants themselves are uppercase.

          Show
          Joe Littlejohn added a comment - Thanks for the attention Bill! See attached JAXB generated Enum example. The schema document defines four values (north, south, east, west) for the enumeration 'Location'. These values are mapped to the constant values using fromValue(String), but (according to the JAXB spec) the constants themselves are uppercase.
          Hide
          Bill Burke added a comment -

          Fixed in Trunk, will be in 2.0.1

          Show
          Bill Burke added a comment - Fixed in Trunk, will be in 2.0.1
          Hide
          Joe Littlejohn added a comment -

          Cheers.

          Show
          Joe Littlejohn added a comment - Cheers.

            People

            • Assignee:
              Bill Burke
              Reporter:
              Joe Littlejohn
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development