On 04/04/14 16:06, Michael McMahon wrote:
In my view, it's the current behavior that is surprising.
Agreed. Considered and overridden. This has my vote. -Chris. >You would
really expect those methods to return the un-encoded strings. It's odd we haven't come across this issue before now, which probably indicates use of '[]' in those components is uncommon. Michael On 04/04/14 16:01, Chris Hegarty wrote:Pavel, The code changes and test update look good to me. I think I agree with the approach here, but just to clarify the change in behavior, that will be visible after the changes. $ cat Test.java public class Test { public static void main(String[] args) throws Exception { java.net.URI u = new java.net.URI("http", "example.org", "/a b[c d]", "a b[c d]", "a b[c d]"); System.out.println("path:" + u.getPath()); System.out.println("path:" + u.getQuery()); System.out.println("path:" + u.getFragment()); } } -- without fix -- $ java Test path:/a b[c d] path:a b[c%20d] path:a b[c%20d] -- with fix --- $ java Test path:/a b[c d] path:a b[c d] path:a b[c d] So the question now is; Will this surprise anyone? possibly embedding URLs/URIs in query strings? I expect not, but just want to spell out the change in behavior so that we can make an informed decision. -Chris. On 04/04/14 15:45, Pavel Rappo wrote:Hi everyone, could you please review my change for JDK-8037396: http://cr.openjdk.java.net/~michaelm/8037396/webrev/ As per API, getQuery() and getFragment() should return the decoded string. But this seems not to work properly if there are squared brackets around them. The result of analysis can be seen here: https://bugs.openjdk.java.net/browse/JDK-8037396?focusedCommentId=13479678&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13479678 I think we should go the least intrusive way here (excluding 'do nothing' option). Thanks -Pavel
