Parsing too strict in java.net.URI?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Parsing too strict in java.net.URI?

David Lloyd-2
The following statement:

URI uri = URI.create("local:");

fails with an exception like this:

java.lang.IllegalArgumentException: Expected scheme-specific part at
index 6: local:
     at java.net.URI.create(URI.java:852)
     at
org.jboss.ejb.client.Affinity$LocalAffinity.<clinit>(Affinity.java:131)
     ... 32 more
Caused by: java.net.URISyntaxException: Expected scheme-specific part at
index 6: local:
     at java.net.URI$Parser.fail(URI.java:2848)
     at java.net.URI$Parser.failExpecting(URI.java:2854)
     at java.net.URI$Parser.parse(URI.java:3057)
     at java.net.URI.<init>(URI.java:588)
     at java.net.URI.create(URI.java:850)
     ... 33 more

However AFAICT scheme-only URIs are, while not strictly allowed by RFC
2396 [1], in common usage (for example, "about:" in web browsers).

WDYT?

[1] https://tools.ietf.org/html/rfc2396
--
- DML
Reply | Threaded
Open this post in threaded view
|

Re: Parsing too strict in java.net.URI?

Chris Hegarty
David,

On 14/11/16 16:47, David M. Lloyd wrote:

> The following statement:
>
> URI uri = URI.create("local:");
>
> fails with an exception like this:
>
> java.lang.IllegalArgumentException: Expected scheme-specific part at
> index 6: local:
>     at java.net.URI.create(URI.java:852)
>     at
> org.jboss.ejb.client.Affinity$LocalAffinity.<clinit>(Affinity.java:131)
>     ... 32 more
> Caused by: java.net.URISyntaxException: Expected scheme-specific part at
> index 6: local:
>     at java.net.URI$Parser.fail(URI.java:2848)
>     at java.net.URI$Parser.failExpecting(URI.java:2854)
>     at java.net.URI$Parser.parse(URI.java:3057)
>     at java.net.URI.<init>(URI.java:588)
>     at java.net.URI.create(URI.java:850)
>     ... 33 more
>
> However AFAICT scheme-only URIs are, while not strictly allowed by RFC
> 2396 [1], in common usage (for example, "about:" in web browsers).
>
> WDYT?

This seems to be allowable in the "more recent" RFC [2], that obsoletes
2396, which of course java.net.URI does not, yet, support. There was an
effort to support 3986 a number of years ago, but it was not successful.
The desire to support, keep up with standards, etc, has caused us to
give consideration to supporting 3986, but as of yet nothing concrete.

-Chris.


[1] https://tools.ietf.org/html/rfc3986#appendix-D.2
Reply | Threaded
Open this post in threaded view
|

Re: Parsing too strict in java.net.URI?

David Lloyd-2
On Mon, Nov 14, 2016 at 12:16 PM, Chris Hegarty
<[hidden email]> wrote:
> David,
>
> On 14/11/16 16:47, David M. Lloyd wrote:
>>
>> The following statement:
>>
>> URI uri = URI.create("local:");
>>
>> fails with an exception like this:
[...]
>> However AFAICT scheme-only URIs are, while not strictly allowed by RFC
>> 2396 [1], in common usage (for example, "about:" in web browsers).
>
> This seems to be allowable in the "more recent" RFC [2], that obsoletes
> 2396, which of course java.net.URI does not, yet, support. There was an
> effort to support 3986 a number of years ago, but it was not successful.
> The desire to support, keep up with standards, etc, has caused us to
> give consideration to supporting 3986, but as of yet nothing concrete.

Have there been any recent developments, updates, or insights on this
issue?  I wonder if a gradual change to RFC 3986 support might be more
appropriate: for example, start with *just* accepting empty SSP.

If the compatibility requirements of java.net.URI are too stringent to
allow for any change, then surely all that can be done is to deprecate
& replace it, which would need no further delay that I can see.
--
- DML