Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-443

UriBuilder.replaceQueryParam causes ArrayIndexOutOfBoundsException when query string contains empty parameters

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.1-beta-1
    • 2.0.GA, 2.0.1.GA
    • jaxrs
    • None
    • Hide

      Run the following code:

      import org.jboss.resteasy.specimpl.UriBuilderImpl;
      public class TestUriBuilder {
      public static void main(String[] args)

      { UriBuilderImpl.fromUri("?param=").replaceQueryParam("otherParam", "otherValue"); }

      }

      Show
      Run the following code: import org.jboss.resteasy.specimpl.UriBuilderImpl; public class TestUriBuilder { public static void main(String[] args) { UriBuilderImpl.fromUri("?param=").replaceQueryParam("otherParam", "otherValue"); } }

      Replacing a query parameter in a query string that contains empty parameters (i.e. a parameter without value) will cause an ArrayIndexOutOfBoundsException.

      UriBuilderImpl.fromUri("?param=").replaceQueryParam("otherParam", "otherValue");

      Result:

      Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
      at org.jboss.resteasy.specimpl.UriBuilderImpl.replaceQueryParam(UriBuilderImpl.java:685)
      at TestUriBuilder.main(TestUriBuilder.java:8)

            patriot1burke@gmail.com Bill Burke (Inactive)
            winterer_jira Mario Winterer (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: