<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.2.1-jre</version>
<!-- or, for Android: -->
<version>33.2.1-android</version>
</dependency>
Jar files
Guava requires one runtime dependency, which you can download here:
Javadoc
JDiff
Changelog
net
: ChangedInetAddress
-String
conversion methods to preserve the IPv6 scope ID if present. The scope ID can be necessary for IPv6-capable devices with multiple network interfaces. However, preserving it can also lead to problems for callers that rely on the returned values not to include the scope ID:- Callers might compensate for the old behavior of the methods by appending the scope ID to a returned string themselves. If so, you can update your code to stop doing so at the same time as you upgrade Guava. Of, if your code might run against multiple versions of Guava, you can check whether Guava has included a scope ID before you add one yourself.
- Callers might pass the returned string to another system that does not understand scope IDs. If so, you can strip the scope ID off, whether by truncating the string form at a
%
character (leaving behind any trailing]
character in the case offorUriString
) or by replacing the returnedInetAddress
with a new instance constructed by callingInetAddress.getByAddress(addr)
. java.net.InetAddress
validates any provided scope ID against the interfaces available on the machine. As a result, methods inInetAddresses
may now fail if the scope ID fails validation.- Notable cases in which this may happen include:
- if the code runs in an Android app without networking permission
- if code passes
InetAddress
instances or strings across devices
- If this is not the behavior that you want, then you can strip off the scope ID from the input string before passing it to Guava, as discussed above. (3f61870)
- Notable cases in which this may happen include: