Invalid/Potentially misbehaving reference URI implementation

I have implemented part of my test cases using a smart fuzzer and I found a potential error in the reference implementation:

uri.tests.ValidTests.testFuzzy( ComparisonFailure: expected:<0[]99> but was:<0[.9.10.]99>

By the URI specification, is the host name and {0,9,10,99} are the corresponding bytes/octets, but the reference implementation removes the additional leading zeroes. This is an issue because when re-creating an URI from the parsed result, this results in an equivalent, but different URI.
It would be great if this behavior was documented.

PS: Don’t worry, my fuzzer only takes around 30ms to run :wink:

To quote the interface comments from IPv4Address:

	 * @return "a.b.c.d" where a-d are numbers from 0 to 255 without leading
	 *         zeros
	public String toString();

The leading zeros are removed for IPv4.

1 Like