This is an automated email from the ASF dual-hosted git repository.

garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit 4f5af28cdc8aa99ab9b782925c71f2be59f90a8f
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Jul 25 08:13:59 2026 -0400

    Merge if statements with the same return value.
---
 .../commons/lang3/time/DurationFormatUtils.java    | 25 +++++++++-------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java 
b/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
index b4ef81a7a..23799d633 100644
--- a/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
+++ b/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
@@ -140,10 +140,7 @@ static boolean containsTokenWithValue(final Token[] 
tokens, final Object value)
         public boolean equals(final Object obj2) {
             if (obj2 instanceof Token) {
                 final Token tok2 = (Token) obj2;
-                if (this.value.getClass() != tok2.value.getClass()) {
-                    return false;
-                }
-                if (this.count != tok2.count) {
+                if (this.value.getClass() != tok2.value.getClass() || 
this.count != tok2.count) {
                     return false;
                 }
                 if (this.value instanceof StringBuilder) {
@@ -696,18 +693,16 @@ static Token[] lexx(final String format) {
                         buffer = null;
                         inLiteral = false;
                     }
+                } else if (i + 1 < format.length() && format.charAt(i + 1) == 
'\'') {
+                    // standalone '' outside a literal ? emit a single 
apostrophe
+                    buffer = new StringBuilder("'");
+                    list.add(new Token(buffer, inOptional, optionalIndex));
+                    buffer = null;
+                    i++;
                 } else {
-                    if (i + 1 < format.length() && format.charAt(i + 1) == 
'\'') {
-                        // standalone '' outside a literal ? emit a single 
apostrophe
-                        buffer = new StringBuilder("'");
-                        list.add(new Token(buffer, inOptional, optionalIndex));
-                        buffer = null;
-                        i++;
-                    } else {
-                        buffer = new StringBuilder();
-                        list.add(new Token(buffer, inOptional, optionalIndex));
-                        inLiteral = true;
-                    }
+                    buffer = new StringBuilder();
+                    list.add(new Token(buffer, inOptional, optionalIndex));
+                    inLiteral = true;
                 }
                 previous = null;
                 break;

Reply via email to