jersey
  1. jersey
  2. JERSEY-1323

UriBuilder#uri(String) works differently from #uri(URI)

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-m05
    • Fix Version/s: 2.0-m09, 2.0
    • Component/s: core
    • Labels:
      None

      Description

      String uriOrig = "ftp://ftp.is.co.za/rfc/rfc1808.txt";
      URI uriReplace = new URI(null, "ftp.is.co.za","/test/rfc1808.txt", null, null);
      uri = UriBuilder.fromUri(new URI(uriOrig)).uri(uriReplace).build();
      System.out.println(uri); // ftp://ftp.is.co.za/test/rfc1808.txt
      

      However, protocol ftp is missing here:

      uri = UriBuilder.fromUri(new URI(uriOrig)).uri(uriReplace.toASCIIString()).build();
      System.out.println(uri); // /ftp.is.co.za/test/rfc1808.txt
      

      The javadoc says the uri(String) checks the string to be a correct URI, hence one would assume these two uri(URI) and uri(String) would work similar.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Miroslav Fuksa
            Reporter:
            jan.supol
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 3 hours
              3h
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 1 hour Time Not Required
              1h