Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1889

org.apache.http.client.utils.URLEncodedUtils.parse() should return a new ArrayList when there are no query parameters

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.5.4
    • Fix Version/s: 4.5.5
    • Component/s: HttpClient (classic)
    • Labels:
      None

      Description

      org.apache.http.client.utils.URLEncodedUtils.parse(URI, Charset) should return a new ArrayList when there are no query parameters.

      Currently, org.apache.http.client.utils.URLEncodedUtils.parse(URI, Charset) returns an immutable list through Collections.emptyList() if there are no params> But if there are parameters, the method returns a mutable list.

      This makes it impossible to write the same code to handle both cases.

      This change will cause the method to return a new ArrayList if there are no parameters.

      The methods that are directly affected are:

      • org.apache.http.client.utils.URLEncodedUtils.parse(URI, Charset)
      • org.apache.http.client.utils.URLEncodedUtils.parse(HttpEntity)
      • org.apache.http.client.utils.URLEncodedUtils.parse(String, Charset)
      • org.apache.http.client.utils.URLEncodedUtils.parse(String, Charset, char...)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ggregory Gary Gregory
                Reporter:
                ggregory Gary Gregory
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: