This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-net.git
commit 058eefb178373ad0c23367604f4a421ea8f58d20 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sun Jun 16 09:02:46 2024 -0400 Fix SpotBugs RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE in SSLSocketUtils --- src/changes/changes.xml | 2 ++ src/main/java/org/apache/commons/net/util/SSLSocketUtils.java | 9 +++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 75a6967f..249d86dc 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -70,6 +70,8 @@ The <action> type attribute can be add,update,fix,remove. <action type="fix" dev="ggregory" due-to="Gary Gregory">Remove InvalidKeySpecException from AuthenticatingIMAPClient.authenticate(AUTH_METHOD, String, String) never throws, it's not thrown.</action> <action type="fix" dev="ggregory" due-to="Gary Gregory">Remove InvalidKeySpecException from ExtendedPOP3Client.auth(AUTH_METHOD, String, String) never throws, it's not thrown.</action> <action type="fix" dev="ggregory" due-to="Gary Gregory">Remove InvalidKeySpecException from org.apache.commons.net.smtp.AuthenticatingSMTPClient.auth(AUTH_METHOD, String, String) never throws, it's not thrown.</action> + <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix SpotBugs RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE in SSLSocketUtils.</action> + <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix some PMD issues.</action> <!-- ADD --> <!-- UPDATE --> <action type="update" dev="ggregory" due-to="Gary Gregory, Dependabot">Bump org.apache.commons:commons-parent from 70 to 71 #261.</action> diff --git a/src/main/java/org/apache/commons/net/util/SSLSocketUtils.java b/src/main/java/org/apache/commons/net/util/SSLSocketUtils.java index 27462919..b37161d6 100644 --- a/src/main/java/org/apache/commons/net/util/SSLSocketUtils.java +++ b/src/main/java/org/apache/commons/net/util/SSLSocketUtils.java @@ -35,12 +35,9 @@ public class SSLSocketUtils { */ public static boolean enableEndpointNameVerification(final SSLSocket socket) { final SSLParameters sslParameters = socket.getSSLParameters(); - if (sslParameters != null) { - sslParameters.setEndpointIdentificationAlgorithm("HTTPS"); - socket.setSSLParameters(sslParameters); - return true; - } - return false; + sslParameters.setEndpointIdentificationAlgorithm("HTTPS"); + socket.setSSLParameters(sslParameters); + return true; } private SSLSocketUtils() {