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-codec.git

commit 5b3c2a5e130bc2f27e5ba34384f7b2cf503a5fbe
Author: Gary D. Gregory <garydgreg...@gmail.com>
AuthorDate: Fri Jul 18 21:57:15 2025 -0400

    Fix PMD EmptyControlStatement in
    org.apache.commons.codec.language.Metaphone
---
 src/changes/changes.xml                                        | 1 +
 src/main/java/org/apache/commons/codec/language/Metaphone.java | 5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index e37ff1e8..cb6e6bf3 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -62,6 +62,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD 
UnusedFormalParameter in private constructor in 
org.apache.commons.codec.binary.Base16.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD multiple 
UnnecessaryFullyQualifiedName in 
org.apache.commons.codec.digest.Blake3.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD 
UnnecessaryFullyQualifiedName in 
org.apache.commons.codec.digest.Md5Crypt.</action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD 
EmptyControlStatement in org.apache.commons.codec.language.Metaphone.</action>
       <!-- ADD -->
       <action type="add" dev="ggregory" due-to="Gary Gregory">Add 
HmacUtils.hmac(Path).</action>      
       <action type="add" dev="ggregory" due-to="Gary Gregory">Add 
HmacUtils.hmacHex(Path).</action>      
diff --git a/src/main/java/org/apache/commons/codec/language/Metaphone.java 
b/src/main/java/org/apache/commons/codec/language/Metaphone.java
index 22220e4e..1dedf674 100644
--- a/src/main/java/org/apache/commons/codec/language/Metaphone.java
+++ b/src/main/java/org/apache/commons/codec/language/Metaphone.java
@@ -228,9 +228,8 @@ public class Metaphone implements StringEncoder {
         while (code.length() < getMaxCodeLen() && n < wdsz) { // max code size 
of 4 works well
             final char symb = local.charAt(n);
             // remove duplicate letters except C
-            if (symb != 'C' && isPreviousChar(local, n, symb)) {
-                // empty
-            } else { // not dup
+            if (symb == 'C' || !isPreviousChar(local, n, symb)) {
+                // not dup
                 switch (symb) {
                 case 'A':
                 case 'E':

Reply via email to