commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject [lang] PMD: These nested if statements could be combined
Date Tue, 20 Sep 2016 16:01:16 GMT
Repository: commons-lang
Updated Branches:
  refs/heads/master 31d02f680 -> db6f7c1d7


PMD: These nested if statements could be combined


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/db6f7c1d
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/db6f7c1d
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/db6f7c1d

Branch: refs/heads/master
Commit: db6f7c1d74ba64211221a69cfa9fe7171a9199e8
Parents: 31d02f6
Author: Benedikt Ritter <britter@apache.org>
Authored: Tue Sep 20 18:01:10 2016 +0200
Committer: Benedikt Ritter <britter@apache.org>
Committed: Tue Sep 20 18:01:10 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/commons/lang3/time/FastDateParser.java   | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/db6f7c1d/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
index 8275ddf..f52008d 100644
--- a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
+++ b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
@@ -242,11 +242,9 @@ public class FastDateParser implements DateParser, Serializable {
                 char c = pattern.charAt(currentIdx);
                 if (!activeQuote && isFormatLetter(c)) {
                     break;
-                } else if (c == '\'') {
-                    if (++currentIdx == pattern.length() || pattern.charAt(currentIdx) !=
'\'') {
-                        activeQuote = !activeQuote;
-                        continue;
-                    }
+                } else if (c == '\'' && (++currentIdx == pattern.length() || pattern.charAt(currentIdx)
!= '\'')) {
+                    activeQuote = !activeQuote;
+                    continue;
                 }
                 ++currentIdx;
                 sb.append(c);


Mime
View raw message