From fb2d228380eba79585099e4c5737b3e764864d0b Mon Sep 17 00:00:00 2001 From: XenoAmess Date: Sat, 13 Jun 2020 23:17:52 +0800 Subject: [PATCH] simplify_if (#543) --- .../java/org/apache/commons/lang3/builder/ToStringStyle.java | 2 +- .../org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java index 83d0b5f75..aa8349698 100644 --- a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java +++ b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java @@ -439,7 +439,7 @@ public abstract class ToStringStyle implements Serializable { protected void removeLastFieldSeparator(final StringBuffer buffer) { final int len = buffer.length(); final int sepLen = fieldSeparator.length(); - if (len > 0 && sepLen > 0 && len >= sepLen) { + if (sepLen > 0 && len >= sepLen) { boolean match = true; for (int i = 0; i < sepLen; i++) { if (buffer.charAt(len - 1 - i) != fieldSeparator.charAt(sepLen - 1 - i)) { diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java index 642f97342..32a9f58dc 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java @@ -76,7 +76,7 @@ public class StringUtilsEqualsIndexOfTest { @Override public boolean equals(final Object obj) { - if (obj == null || !(obj instanceof CustomCharSequence)) { + if (!(obj instanceof CustomCharSequence)) { return false; } final CustomCharSequence other = (CustomCharSequence) obj;