Skip to content

Commit 5b3c2a5

Browse files
committed
Fix PMD EmptyControlStatement in
org.apache.commons.codec.language.Metaphone
1 parent 1d718d8 commit 5b3c2a5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/changes/changes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ The <action> type attribute can be add,update,fix,remove.
6262
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD UnusedFormalParameter in private constructor in org.apache.commons.codec.binary.Base16.</action>
6363
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD multiple UnnecessaryFullyQualifiedName in org.apache.commons.codec.digest.Blake3.</action>
6464
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD UnnecessaryFullyQualifiedName in org.apache.commons.codec.digest.Md5Crypt.</action>
65+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD EmptyControlStatement in org.apache.commons.codec.language.Metaphone.</action>
6566
<!-- ADD -->
6667
<action type="add" dev="ggregory" due-to="Gary Gregory">Add HmacUtils.hmac(Path).</action>
6768
<action type="add" dev="ggregory" due-to="Gary Gregory">Add HmacUtils.hmacHex(Path).</action>

src/main/java/org/apache/commons/codec/language/Metaphone.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,8 @@ public String metaphone(final String txt) {
228228
while (code.length() < getMaxCodeLen() && n < wdsz) { // max code size of 4 works well
229229
final char symb = local.charAt(n);
230230
// remove duplicate letters except C
231-
if (symb != 'C' && isPreviousChar(local, n, symb)) {
232-
// empty
233-
} else { // not dup
231+
if (symb == 'C' || !isPreviousChar(local, n, symb)) {
232+
// not dup
234233
switch (symb) {
235234
case 'A':
236235
case 'E':

0 commit comments

Comments
 (0)