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

@QueryParam char return incorrect default value

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 2.6.15, 2.7.12, 3.0.1
    • Component/s: JAX-RS
    • Labels:
      None
    • Estimated Complexity:
      Novice

      Description

      I used @QueryParam to inject a char variable in a method of a resource class:

      @Path("char")
      @GET
      public String getDefault(@QueryParam("letter") char count)

      { return String.valueOf(count); }

      I don't use @DefaultValue. According to the jaxrs 2.0 API javadoc:

      If this annotation is not used and the corresponding meta-data is not present in the request, the value will be an empty collection for List, Set or SortedSet, null for other object types, and the Java-defined default for primitive types.

      So if I access the method without value in the request, I should get the Java-defined default value of char – \u0000, but what I get is "0"

        Attachments

          Activity

            People

            • Assignee:
              sergey_beryozkin Sergey Beryozkin
              Reporter:
              weiz810706 Wei Zhang
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

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