This is an automated email from the ASF dual-hosted git repository. rgoers pushed a commit to branch release-2.x in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/release-2.x by this push: new f60e4ed LOG4J2-3290. Remove unused method f60e4ed is described below commit f60e4edee46e9782a42acac93ccb24a85392e5bc Author: Ralph Goers <rgo...@apache.org> AuthorDate: Mon Dec 27 13:54:41 2021 -0700 LOG4J2-3290. Remove unused method --- log4j-core/revapi.json | 5 +++ .../apache/logging/log4j/core/util/NetUtils.java | 48 ---------------------- src/changes/changes.xml | 3 ++ 3 files changed, 8 insertions(+), 48 deletions(-) diff --git a/log4j-core/revapi.json b/log4j-core/revapi.json index 3cd34ec..fc773b9 100644 --- a/log4j-core/revapi.json +++ b/log4j-core/revapi.json @@ -187,6 +187,11 @@ "code": "java.field.removedWithConstant", "old": "field org.apache.logging.log4j.core.net.JndiManager.ALLOWED_PROTOCOLS", "justification": "Removed allowing additional protocols" + }, + { + "code": "java.method.removed", + "old": "method java.util.List<java.lang.String> org.apache.logging.log4j.core.util.NetUtils::getLocalIps()", + "justification": "method is no longer used." } ] } diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/NetUtils.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/NetUtils.java index 661f74f..8a8353e 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/NetUtils.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/NetUtils.java @@ -17,8 +17,6 @@ package org.apache.logging.log4j.core.util; import java.io.File; -import java.net.Inet4Address; -import java.net.Inet6Address; import java.net.InetAddress; import java.net.MalformedURLException; import java.net.NetworkInterface; @@ -27,14 +25,11 @@ import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.UnknownHostException; -import java.util.ArrayList; import java.util.Arrays; import java.util.Enumeration; -import java.util.List; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.status.StatusLogger; -import org.apache.logging.log4j.util.Strings; /** * Networking-related convenience methods. @@ -85,49 +80,6 @@ public final class NetUtils { } /** - * Returns all the local host names and ip addresses. - * @return The local host names and ip addresses. - */ - public static List<String> getLocalIps() { - List<String> localIps = new ArrayList<>(); - localIps.add("localhost"); - localIps.add("127.0.0.1"); - try { - final InetAddress addr = Inet4Address.getLocalHost(); - setHostName(addr, localIps); - } catch (final UnknownHostException ex) { - // Ignore this. - } - try { - final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); - if (interfaces != null) { - while (interfaces.hasMoreElements()) { - final NetworkInterface nic = interfaces.nextElement(); - final Enumeration<InetAddress> addresses = nic.getInetAddresses(); - while (addresses.hasMoreElements()) { - final InetAddress address = addresses.nextElement(); - setHostName(address, localIps); - } - } - } - } catch (final SocketException se) { - // ignore. - } - return localIps; - } - - private static void setHostName(InetAddress address, List<String> localIps) { - String[] parts = address.toString().split("\\s*/\\s*"); - if (parts.length > 0) { - for (String part : parts) { - if (Strings.isNotBlank(part) && !localIps.contains(part)) { - localIps.add(part); - } - } - } - } - - /** * Returns the local network interface's MAC address if possible. The local network interface is defined here as * the {@link java.net.NetworkInterface} that is both up and not a loopback interface. * diff --git a/src/changes/changes.xml b/src/changes/changes.xml index d915e85..e72e9e0 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -31,6 +31,9 @@ --> <release version="2.17.1" date="2021-MM-dd" description="GA Release 2.17.1"> <!-- FIXES --> + <action issue="LOG4J2-3290" dev="rogers" type="fix"> + Remove unused method. + </action> <action issue="LOG4J2-3292" dev="ckozak" type="fix"> ExtendedLoggerWrapper.logMessage no longer double-logs when location is requested. </action>