A DESCRIPTION OF THE PROBLEM :
The erroneous documentation claims that the grammar listed in RFC 2396 doesn't permit an empty authority, when in fact it does. Appendix A, which lists the collected BNF for URIs, includes the following productions:
<pre style="font-family: monospace;">
absoluteURI = scheme ":" ( hier_part | opaque_part )
hier_part = ( net_path | abs_path ) [ "?" query ]
net_path = "//" authority [ abs_path ]
authority = ( server | reg_name )
server = [ [ userinfo "@" ] hostport ]
</pre>
Since square brackets surround optional fragments, the <code>server</code> production allows an empty string.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Everything expected is already in the documentation; the problem is the <em>presence</em> of an additional, factually incorrect item.
ACTUAL -
The erroneous item is as follows:
An empty authority component is permitted as long as it is followed by a non-empty path, a query component, or a fragment component. This allows the parsing of URIs such as "file:///foo/bar", which seems to be the intent of RFC 2396 although the grammar does not permit it. If the authority component is empty then the user-information, host, and port components are undefined.
URL OF FAULTY DOCUMENTATION :
https://docs.oracle.com/javase/8/docs/api/java/net/URI.html#URI-java.lang.String-
The erroneous documentation claims that the grammar listed in RFC 2396 doesn't permit an empty authority, when in fact it does. Appendix A, which lists the collected BNF for URIs, includes the following productions:
<pre style="font-family: monospace;">
absoluteURI = scheme ":" ( hier_part | opaque_part )
hier_part = ( net_path | abs_path ) [ "?" query ]
net_path = "//" authority [ abs_path ]
authority = ( server | reg_name )
server = [ [ userinfo "@" ] hostport ]
</pre>
Since square brackets surround optional fragments, the <code>server</code> production allows an empty string.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Everything expected is already in the documentation; the problem is the <em>presence</em> of an additional, factually incorrect item.
ACTUAL -
The erroneous item is as follows:
An empty authority component is permitted as long as it is followed by a non-empty path, a query component, or a fragment component. This allows the parsing of URIs such as "file:///foo/bar", which seems to be the intent of RFC 2396 although the grammar does not permit it. If the authority component is empty then the user-information, host, and port components are undefined.
URL OF FAULTY DOCUMENTATION :
https://docs.oracle.com/javase/8/docs/api/java/net/URI.html#URI-java.lang.String-
- relates to
-
JDK-8075116 java.net.URI does not parse empty authority correctly.
-
- Open
-