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

Exception thrown when REST URLs contain + or @

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • RC 1
    • Beta 7
    • None
    • None

      When I include the + or @ characters in my REST URL, I get the following exception thrown:

      java.lang.StringIndexOutOfBoundsException: String index out of range: -1
      at java.lang.String.substring(String.java:1768)
      at org.jboss.resteasy.specimpl.UriInfoImpl.<init>(UriInfoImpl.java:99)
      at org.jboss.resteasy.plugins.server.servlet.ServletUtil.extractUriInfo(ServletUtil.java:65)

      (Note that the line numbers may be wrong as I tried many times to fix the problem, but the problem is here alright.

      From what I know, I should be able to "GET /foo+bar@gee", which should be decoded as "/foo bar@gee". However I get this exception and no amount of tinkering on my part managed to find an appropriate fix.

      What happens is that the request URI "/foo+bar@gee" is given to UriBuilderImpl which escapes these characters (even though they are allows in the path segment from what I think), which leads to the unescaped absolutePath "/foo%2Bbar%40gee" being compared to the encoded path "/foo+bar@gee" which throws this exception.

            patriot1burke@gmail.com Bill Burke (Inactive)
            separdau@redhat.com Stephane Epardaud
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours
                5h