On 17/01/2016 15:30, Claes Redestad wrote:
Hi,

please review this patch which might make URI.toURL more efficient

Webrev: http://cr.openjdk.java.net/~redestad/8147462
Bug: https://bugs.openjdk.java.net/browse/JDK-8147462

This patch exploits the fact that URI will apply the same validation to the URI/URL specification for any valid non-opaque URL, thus it's safe to use the component-based URL constructor. Also, URIs representing malformed URLs will throw an exception as specified both before and after. A number of simple test cases to capture and document this was added to the existing java/net/URI/URItoURL jtreg test.
I think the change to URI looks okay but it would be good to include a brief comment as otherwise it will be difficult for future maintainers to understand.

In the test then it might be simpler to just check that the type of toURLException and newURLException are the same.

-Alan.


Reply via email to