jersey
  1. jersey
  2. JERSEY-1064

NPE when sending a NULL to UriComponent.encode(null, ??)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.12
    • Fix Version/s: 1.13
    • Component/s: security
    • Labels:
      None
    • Environment:

      Mac OS X

      Description

      Found by using a URL parameter that has an empty value. I.e. "...myfirst=whatever&myparam=&myother=test..."

      To see this happen (w/TestNG env):
      @Test
      public void testNullAccepted()

      { assertNull(UriComponent.encode(null, UriComponent.Type.UNRESERVED)); }

      First solution, in UriComponent
      _encode(String s, Type t, boolean template, boolean contextualEncode) {
      if (s == null)

      { return null; }

      ...

      Second solution, if the first one is not appropriate in all cases, in OAuthSignature:
      private static void addParam(String key, String value, List<String[]> list) {
      list.add(new String[]

      { UriComponent.encode(key, UriComponent.Type.UNRESERVED), value == null ? null : UriComponent.encode(value, UriComponent.Type.UNRESERVED) }

      );
      }

        Activity

        Hide
        Martin Matula added a comment -

        Fixed in 1.13 snapshot. Thanks for the bug report.

        Show
        Martin Matula added a comment - Fixed in 1.13 snapshot. Thanks for the bug report.

          People

          • Assignee:
            Martin Matula
            Reporter:
            nelz9999
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 30 minutes
              30m
              Remaining:
              Remaining Estimate - 30 minutes
              30m
              Logged:
              Time Spent - Not Specified
              Not Specified