Re: URL context constructor broken?
Lew wrote:
The key seems to be in the phrase ??[i]f the spec's path component begins
with a slash character "/"??. How does the constructor decide what is the
"path component" of the spec? Maybe it thinks that the authority is
"fonts". If so it might be trying to construct the URL
"http://fonts/adobe/frutiger/", which does contain a scheme but looks
pretty malformed to me.
Joshua Cranmer wrote:
URLs have a basic structure:
<scheme>://<authority>/<path>
[Technically the `/' is also part of the path].
The exact form of <authority> is dictated by RFC 3986, so I won't repeat it here.
Yeah, I was reading that and took it all into account.
What's not clear is what the URL constructor does with the spec argument,
which needn't contain an authority. In turn, the definition of "authority"
that you didn't repeat here does not require periods or multiple components,
so the constructor could consider "fonts" as an authority despite that the
intent was to specify it as part of the path. At least as I read the RFC and
Javadocs.
The thing is that the constructor's spec argument needn't be an entire URL, so
I see ambiguity there. Regardless, the only documented reason for the
constructor to throw 'MalformedURLException' is if the scheme is absent, which
it isn't because it's supposed to come from the first constructor argument.
As Roedy said,
Since there are no examples,
the matter of what [it] SHOULD it do, still seems ambiguous.
--
Lew
Ceci n'est pas une pipe.