This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch release-2.x in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit f3864e6d4d3f6697a5d875bf56a45c93e448cb6b Author: Gary Gregory <[email protected]> AuthorDate: Tue Feb 23 16:09:38 2021 -0500 Remove redundant code. --- .../src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java | 4 +--- .../java/org/apache/logging/log4j/core/tools/picocli/CommandLine.java | 4 +--- .../src/main/java/org/apache/logging/log4j/core/util/NetUtils.java | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java index ca09ed8..31951e8 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java @@ -226,7 +226,6 @@ public final class PropertiesUtil { try { return Double.parseDouble(prop); } catch (final Exception ignored) { - return defaultValue; } } return defaultValue; @@ -246,7 +245,7 @@ public final class PropertiesUtil { try { return Integer.parseInt(prop); } catch (final Exception ignored) { - return defaultValue; + // ignore } } return defaultValue; @@ -283,7 +282,6 @@ public final class PropertiesUtil { try { return Long.parseLong(prop); } catch (final Exception ignored) { - return defaultValue; } } return defaultValue; diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/tools/picocli/CommandLine.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/tools/picocli/CommandLine.java index 8dc4670..724ce47 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/tools/picocli/CommandLine.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/tools/picocli/CommandLine.java @@ -2542,9 +2542,7 @@ public class CommandLine { @SuppressWarnings("unchecked") private Collection<Object> createCollection(final Class<?> collectionClass) throws Exception { if (collectionClass.isInterface()) { - if (List.class.isAssignableFrom(collectionClass)) { - return new ArrayList<>(); - } else if (SortedSet.class.isAssignableFrom(collectionClass)) { + if (SortedSet.class.isAssignableFrom(collectionClass)) { return new TreeSet<>(); } else if (Set.class.isAssignableFrom(collectionClass)) { return new LinkedHashSet<>(); 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 195dbff..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 @@ -72,8 +72,7 @@ public final class NetUtils { } } } catch (final SocketException se) { - LOGGER.error("Could not determine local host name", uhe); - return UNKNOWN_LOCALHOST; + // ignore and log below. } LOGGER.error("Could not determine local host name", uhe); return UNKNOWN_LOCALHOST;
