The URL
class is particularly forgiving when it comes to tolerating syntactically incorrect URLs. If I remember correctly, it only validates if there is a known protocol handler for the scheme and accepts everything in the scheme specific part.
The easiest way to produce a URISyntaxException
is probably something like this:
new URL("http:// ").toURI();