Skip to content

Commit 4760c68

Browse files
committed
SonarQube fixes
1 parent 0fc00ef commit 4760c68

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

utils/src/main/java/net/objectlab/kit/util/StringUtil.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,14 +497,14 @@ public static String nullIfEmpty(final String txt) {
497497
*/
498498
public static int compareTo(final String s1, final String s2) {
499499
int ret;
500-
if (s1 == null && s2 == null) {
500+
if (s1 != null && s2 != null) {
501+
ret = s1.compareTo(s2);
502+
} else if (s1 == null && s2 == null) {
501503
ret = 0;
502504
} else if (s1 != null && s2 == null) {
503505
ret = 1;
504-
} else if (s1 == null && s2 != null) {
505-
ret = -1;
506506
} else {
507-
ret = s1.compareTo(s2);
507+
ret = -1;
508508
}
509509
return ret;
510510
}

0 commit comments

Comments
 (0)