This is an automated email from the ASF dual-hosted git repository. jmark99 pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push: new 2658dea Remove self-assignment statement. (#2445) 2658dea is described below commit 2658deaf326c58454e260a9b6777ced15ec095dc Author: Mark Owens <jmar...@apache.org> AuthorDate: Tue Feb 1 11:05:44 2022 -0500 Remove self-assignment statement. (#2445) Removed a self-assignment of the hostPortString variable to itself. If the hostPortString is non-null, nothing happens and the variable is unchanged. If the hostPortString is null, a NullPointerException is thrown. There is no need to assign it to itself. Change suggested by errorprone analysis. Added a message to the requireNonNull method indicating the cause of the NullPointerException. Also, added java.util.Objects import remove need for fully qualified path to requireNonNull. --- core/src/main/java/org/apache/accumulo/core/util/HostAndPort.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/apache/accumulo/core/util/HostAndPort.java b/core/src/main/java/org/apache/accumulo/core/util/HostAndPort.java index d6ba8da..a7affa5 100644 --- a/core/src/main/java/org/apache/accumulo/core/util/HostAndPort.java +++ b/core/src/main/java/org/apache/accumulo/core/util/HostAndPort.java @@ -19,6 +19,7 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; import java.io.Serializable; +import java.util.Objects; /** * This class was copied from Guava release 23.0 to replace the older Guava 14 version that had been @@ -143,7 +144,7 @@ public final class HostAndPort implements Serializable { * if nothing meaningful could be parsed. */ public static HostAndPort fromString(String hostPortString) { - hostPortString = java.util.Objects.requireNonNull(hostPortString); + Objects.requireNonNull(hostPortString, "hostPortString variable was null!"); String host; String portString = null; boolean hasBracketlessColons = false;