Uploaded image for project: 'HttpComponents HttpCore'
  1. HttpComponents HttpCore
  2. HTTPCORE-501

org.apache.hc.core5.net.URLEncodedUtils.parse() should return a new ArrayList when there are no query parameters

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 5.0-beta1
    • 5.0-beta2
    • HttpCore
    • 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.hc.core5.net.URLEncodedUtils.parse(String, Charset, char...)
      • org.apache.hc.core5.net.URLEncodedUtils.parse(String, Charset)
      • org.apache.hc.core5.net.URLEncodedUtils.parse(URI, Charset)

      Attachments

        Issue Links

          Activity

            People

              ggregory Gary D. Gregory
              ggregory Gary D. Gregory
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: