'URISyntaxException: Illegal character in path' on square brackets

Splash Forums PrettyFaces Users 'URISyntaxException: Illegal character in path' on square brackets

This topic contains 32 replies, has 5 voices, and was last updated by  Christian Kaltepoth 4 years, 3 months ago.

Viewing 15 posts - 1 through 15 (of 33 total)
  • Author
    Posts
  • #18118

    Keelhaul
    Participant

    Hi,

    since upgrading from PF 3.1.0 to 3.3.2, I get this exception when square brackets are in the URL:

    java.lang.IllegalArgumentException: java.net.URISyntaxException: Illegal character in path at index 20: http://localhost/1.+[=+100.]+Verba+mea+auribus

    com.ocpsoft.pretty.faces.url.URL.decodeSegment(URL.java:151)

    com.ocpsoft.pretty.faces.url.URL.getDecodedSegments(URL.java:97)

    com.ocpsoft.pretty.faces.url.URL.decode(URL.java:160)

    com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:112)

    root cause

    java.net.URISyntaxException: Illegal character in path at index 20: http://localhost/1.+[=+100.]+Verba+mea+auribus

    java.net.URI$Parser.fail(URI.java:2809)

    java.net.URI$Parser.checkChars(URI.java:2982)

    java.net.URI$Parser.parseHierarchical(URI.java:3066)

    java.net.URI$Parser.parse(URI.java:3014)

    java.net.URI.<init>(URI.java:578)

    com.ocpsoft.pretty.faces.url.URL.decodeSegment(URL.java:146)

    com.ocpsoft.pretty.faces.url.URL.getDecodedSegments(URL.java:97)

    com.ocpsoft.pretty.faces.url.URL.decode(URL.java:160)

    com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:112)

    This is what the HTML source code looks like:

    1. [= 100.] Verba mea auribus

    This is the pretty-config mapping for this pattern:

    <url-mapping id="newSearch2">

    <pattern value="/search/#{field:searchBean.browsingMenuField}/#{value:searchBean.browsingMenuValue}/" />

    <view-id value="/search.xhtml" />

    <action onPostback="false">#{searchBean.newSearch}</action>

    </url-mapping>

    Tomcat 7.0.22

    Mojarra 2.2.0

    PrettyFaces 3.3.2

    Any advice would be appreciated!

    #21810

    Hey Keelhaul,

    we fixed some issue regarding encoding and decoding of URLs in the recent versions of PrettyFaces. It may be possible that some characters aren’t handled correctly by this new mechanism. I’ll have a look at this issue and will come back to you ASAP.

    Thanks for reporting this.

    Christian

    #21811

    Keelhaul
    Participant

    Ok, thanks for looking into this. I’m having the same problem with ‘<‘ and ‘>’, btw.

    #21812

    Oh, thanks. In this case I’ll also have a look at these characters. Thanks for reporting this. I’ll come back to you as soon as I fixed it. :)

    #21813

    Keelhaul
    Participant

    Ok and while we’re at it… ;]

    URL-escaped slashes and backslashes don’t seem to work on either version I’ve used (if these characters are in the URL, I get a blank page). Right now I’m circumventing the issue by converting slashes and backslashes to custom character sequences, which works well but looks pretty awful in the address bar… Is there a more elegant solution?

    #21814

    Very strange. I just rested the URL-encoding being used in http://ocpsoft.com/rewrite (same as prettyfaces 3.3.2) and it works fine with those characters (at least, no exceptions.)

    What browser are you using?

    #21815

    Keelhaul
    Participant

    I’m using FF8. Do all characters I mentioned work for you?

    #21816

    Yes they do, but let me try using PrettyFaces itself just to be sure.

    #21817

    Confirmed! I can reproduce this! I’ll try to find some time today to fix this. Thanks for reporting!

    #21818

    I just committed a fix for this issue. Could you perhaps give the latest snapshot 3.3.3-SNAPSHOT a try?

    You will find all the details on how to use the snapshots here:

    https://github.com/ocpsoft/prettyfaces/wiki/Snapshots

    Thanks

    #21819

    Keelhaul
    Participant

    Hi, sorry about the delay. I can confirm that that issues have been resolved in 3.3.3-20111216. Thanks!

    #21820

    JonH
    Participant
    #21821

    Hey JonH,

    Thanks for finding this.

    Could you please post a sample project or test case that reproduces this so that we can check for a fix before releasing 3.3.3?

    You can attach it to this thread directly.

    Thanks,

    Lincoln

    #21822

    JonH
    Participant

    Attached is a webapp project I deployed under Tomcat 7.0.19. There’s a link on the index page that exercises:

    http://localhost:8080/pf_uri-1.0/%5D||!

    java.lang.IllegalArgumentException: java.net.URISyntaxException: Illegal character in path at index 20: http://localhost/%5D||!

    com.ocpsoft.pretty.faces.url.URL.decodeSegment(URL.java:160)

    com.ocpsoft.pretty.faces.url.URL.getDecodedSegments(URL.java:99)

    com.ocpsoft.pretty.faces.url.URL.decode(URL.java:169)

    com.ocpsoft.pretty.PrettyContext.<init>(PrettyContext.java:92)

    com.ocpsoft.pretty.PrettyContext.newDetachedInstance(PrettyContext.java:177)

    com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:83)

    root cause

    java.net.URISyntaxException: Illegal character in path at index 20: http://localhost/%5D||!

    java.net.URI$Parser.fail(URI.java:2809)

    java.net.URI$Parser.checkChars(URI.java:2982)

    java.net.URI$Parser.parseHierarchical(URI.java:3066)

    java.net.URI$Parser.parse(URI.java:3014)

    java.net.URI.<init>(URI.java:578)

    com.ocpsoft.pretty.faces.url.URL.decodeSegment(URL.java:148)

    com.ocpsoft.pretty.faces.url.URL.getDecodedSegments(URL.java:99)

    com.ocpsoft.pretty.faces.url.URL.decode(URL.java:169)

    com.ocpsoft.pretty.PrettyContext.<init>(PrettyContext.java:92)

    com.ocpsoft.pretty.PrettyContext.newDetachedInstance(PrettyContext.java:177)

    com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:83)

    #21823

    Thanks for reporting this. I just committed a fix for this issue:

    https://github.com/ocpsoft/prettyfaces/commit/f2c2bc68257ea1c3f380c131f0eecd3048cbb349

    If you like you could give the latest snapshots a try.

Viewing 15 posts - 1 through 15 (of 33 total)

You must be logged in to reply to this topic.

Comments are closed.