On 01/03/2016 14:57, Konstantin Kolinko wrote:
> 2016-03-01 17:20 GMT+03:00 <[email protected]>:
>> Author: markt
>> Date: Tue Mar 1 14:20:56 2016
>> New Revision: 1733077
>>
>> URL: http://svn.apache.org/viewvc?rev=1733077&view=rev
>> Log:
>> Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=59001
>> Correctly handle the case when Tomcat is installed on a path where one of
>> the segments ends in an exclamation mark.
<snip/>
> One more note to this commit.
>
> java.net.URI.toURL() is implemented as the following in JDK 8u72
>
> public URL toURL()
> throws MalformedURLException {
> if (!isAbsolute())
> throw new IllegalArgumentException("URI is not absolute");
> return new URL(toString());
> }
>
>
> The above does File -> URI -> String -> URL, URL -> String -> String ->
> URL.
Good catch. I hadn't looked at the implementation. I can make that code
cleaner.
> 1. I do not see any testcases in this commit.
There is one but I forgot the svn add.
> The last step performs parsing of String into URL. It needs a testcase
> that the parsing performed by (new URL(fileUrlString)) does not
> convert "%21/" back to "!/", nullifying the efforts.
It doesn't.
> 2. It will be cheaper to process the String generated from
> URI.toString(), making it
>
> File -> URI -> String -> String -> URL.
>
> String fileUriString = file.toURI().toString();
> fileUriString = fileUrlString.replaceAll("!/", "%21/");
> return new URL(fileUrlString);
Agreed.
Thanks for the review. I'll have a commit with the necessary fixes ready
shortly.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]