jersey
  1. jersey
  2. JERSEY-1368

UriBuilderImpl.clone doesn't function correctly for matrix and query parameters if build has not been called

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 1.13
    • Fix Version/s: 1.13
    • Component/s: None
    • Labels:
      None

      Description

      Consider the following snipped of code:

      UriBuilder first = UriBuilder.fromUri("http://www.com/").replaceMatrixParam("example", "one", "two");
      UriBuilder second = first.clone();
      System.out.println(first.build());
      System.out.println(second.build());

      If you ran this code you would expect the following output:

      http://www.com/;example=one;example=two
      http://www.com/;example=one;example=two

      But instead you get:

      http://www.com/;example=one;example=two
      http://www.com/

      The problem is that the copy constructor doesn't copy the state of the matrixParams and queryParams, if you perform a build before the clone then the values are written throught to the path.

        Activity

        Hide
        Martin Matula added a comment -

        This looks like a duplicate of http://java.net/jira/browse/JERSEY-1081 which is fixed in 1.13. Are you sure 1.13 is the version you are working with??

        Show
        Martin Matula added a comment - This looks like a duplicate of http://java.net/jira/browse/JERSEY-1081 which is fixed in 1.13. Are you sure 1.13 is the version you are working with??
        Hide
        gdavison added a comment -

        I must have been using an interim build, now works fine.

        Show
        gdavison added a comment - I must have been using an interim build, now works fine.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: