yangxu998 / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

InetAddresses.forString does not throw IllegalArgumentException on an invalid IPv6 address #572

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. InetAddresses.forString("fe80::aaaaaa");

What is the expected output? What do you see instead?
I expect an IllegalArgumentException.
Instead I receive a Inet6Address object with the address "fe80::aa:aaaa".

What version of the product are you using? On what operating system?
guava-r08 
Windows XP Professional 32bit

Please provide any additional information below.
According to the http://tools.ietf.org/html/rfc4291#section-2.2 this form of a 
text representation is invalid.

Original issue reported on code.google.com by krzyszto...@gmail.com on 18 Mar 2011 at 9:31

GoogleCodeExporter commented 9 years ago
Usually Java's InetAddress is more lenient than Guava's approach ("127.1", 
"fe80::9%3") therefore we prefer Guava's InetAddresses (and of course the 
lookup),
but in this case: InetAddress.getByName("fe80::aaaaaa") throws 
UnknownHostException.

Original comment by krzyszto...@gmail.com on 18 Mar 2011 at 9:35

GoogleCodeExporter commented 9 years ago
The implementation was blindly truncating all the hextets to 16 bits, so 
"fe80::aaaaaa" became "fe80::aaaa".

A stricter hextet parser will be included in the next release.

Original comment by pma...@google.com on 5 May 2011 at 10:35

GoogleCodeExporter commented 9 years ago

Original comment by kevinb@google.com on 16 Jul 2011 at 8:11

GoogleCodeExporter commented 9 years ago

Original comment by fry@google.com on 27 Jul 2011 at 5:59

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:15

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:09