commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ki...@apache.org
Subject [2/2] commons-collections git commit: Fix two PMD issues, but comment others where if's were added for readability
Date Tue, 12 Sep 2017 12:56:26 GMT
Fix two PMD issues, but comment others where if's were added for readability


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

Branch: refs/heads/master
Commit: 9ae946c7daa09b20f4089f01202c5e73c5afb471
Parents: 55e8eac
Author: Bruno P. Kinoshita <brunodepaulak@yahoo.com.br>
Authored: Wed Sep 13 00:44:46 2017 +1200
Committer: Bruno P. Kinoshita <brunodepaulak@yahoo.com.br>
Committed: Wed Sep 13 00:51:31 2017 +1200

----------------------------------------------------------------------
 .../commons/collections4/functors/PrototypeFactory.java |  4 ++--
 .../commons/collections4/iterators/FilterIterator.java  |  6 ++----
 .../collections4/iterators/FilterListIterator.java      | 12 ++++--------
 .../collections4/iterators/PermutationIterator.java     |  2 +-
 .../commons/collections4/keyvalue/AbstractMapEntry.java |  2 +-
 .../commons/collections4/map/AbstractReferenceMap.java  |  3 ++-
 .../apache/commons/collections4/map/MultiValueMap.java  |  2 +-
 .../collections4/sequence/SequencesComparator.java      |  4 ++--
 .../commons/collections4/trie/AbstractPatriciaTrie.java |  2 +-
 9 files changed, 16 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-collections/blob/9ae946c7/src/main/java/org/apache/commons/collections4/functors/PrototypeFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/collections4/functors/PrototypeFactory.java
b/src/main/java/org/apache/commons/collections4/functors/PrototypeFactory.java
index 64173d2..03fea84 100644
--- a/src/main/java/org/apache/commons/collections4/functors/PrototypeFactory.java
+++ b/src/main/java/org/apache/commons/collections4/functors/PrototypeFactory.java
@@ -193,12 +193,12 @@ public class PrototypeFactory {
                     if (bais != null) {
                         bais.close();
                     }
-                } catch (final IOException ex) {
+                } catch (final IOException ex) { //NOPMD
                     // ignore
                 }
                 try {
                     baos.close();
-                } catch (final IOException ex) {
+                } catch (final IOException ex) { //NOPMD
                     // ignore
                 }
             }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/9ae946c7/src/main/java/org/apache/commons/collections4/iterators/FilterIterator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/collections4/iterators/FilterIterator.java b/src/main/java/org/apache/commons/collections4/iterators/FilterIterator.java
index 457430d..7789578 100644
--- a/src/main/java/org/apache/commons/collections4/iterators/FilterIterator.java
+++ b/src/main/java/org/apache/commons/collections4/iterators/FilterIterator.java
@@ -96,10 +96,8 @@ public class FilterIterator<E> implements Iterator<E> {
      */
     @Override
     public E next() {
-        if (!nextObjectSet) {
-            if (!setNextObject()) {
-                throw new NoSuchElementException();
-            }
+        if (!nextObjectSet && !setNextObject()) {
+            throw new NoSuchElementException();
         }
         nextObjectSet = false;
         return nextObject;

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/9ae946c7/src/main/java/org/apache/commons/collections4/iterators/FilterListIterator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/collections4/iterators/FilterListIterator.java
b/src/main/java/org/apache/commons/collections4/iterators/FilterListIterator.java
index 370dbb5..1f2bef2 100644
--- a/src/main/java/org/apache/commons/collections4/iterators/FilterListIterator.java
+++ b/src/main/java/org/apache/commons/collections4/iterators/FilterListIterator.java
@@ -132,10 +132,8 @@ public class FilterListIterator<E> implements ListIterator<E>
{
 
     @Override
     public E next() {
-        if (!nextObjectSet) {
-            if (!setNextObject()) {
-                throw new NoSuchElementException();
-            }
+        if (!nextObjectSet && !setNextObject()) {
+            throw new NoSuchElementException();
         }
         nextIndex++;
         final E temp = nextObject;
@@ -150,10 +148,8 @@ public class FilterListIterator<E> implements ListIterator<E>
{
 
     @Override
     public E previous() {
-        if (!previousObjectSet) {
-            if (!setPreviousObject()) {
-                throw new NoSuchElementException();
-            }
+        if (!previousObjectSet && !setPreviousObject()) {
+            throw new NoSuchElementException();
         }
         nextIndex--;
         final E temp = previousObject;

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/9ae946c7/src/main/java/org/apache/commons/collections4/iterators/PermutationIterator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/collections4/iterators/PermutationIterator.java
b/src/main/java/org/apache/commons/collections4/iterators/PermutationIterator.java
index 494e79c..c0c5fe8 100644
--- a/src/main/java/org/apache/commons/collections4/iterators/PermutationIterator.java
+++ b/src/main/java/org/apache/commons/collections4/iterators/PermutationIterator.java
@@ -116,7 +116,7 @@ public class PermutationIterator<E> implements Iterator<List<E>>
{
         for (int i = 0; i < keys.length; i++) {
             if ((direction[i] && i < keys.length - 1 && keys[i] > keys[i
+ 1]) ||
                 (!direction[i] && i > 0 && keys[i] > keys[i - 1]))
{
-                if (keys[i] > largestKey) {
+                if (keys[i] > largestKey) { // NOPMD
                     largestKey = keys[i];
                     indexOfLargestMobileInteger = i;
                 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/9ae946c7/src/main/java/org/apache/commons/collections4/keyvalue/AbstractMapEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/collections4/keyvalue/AbstractMapEntry.java
b/src/main/java/org/apache/commons/collections4/keyvalue/AbstractMapEntry.java
index 5182930..15d461e 100644
--- a/src/main/java/org/apache/commons/collections4/keyvalue/AbstractMapEntry.java
+++ b/src/main/java/org/apache/commons/collections4/keyvalue/AbstractMapEntry.java
@@ -48,7 +48,7 @@ public abstract class AbstractMapEntry<K, V> extends AbstractKeyValue<K,
V> impl
      * @return the previous value
      */
     @Override
-    public V setValue(final V value) {
+    public V setValue(final V value) { // NOPMD
         return super.setValue(value);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/9ae946c7/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java b/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java
index 9ccd7e5..82ac7e3 100644
--- a/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java
+++ b/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java
@@ -291,7 +291,8 @@ public abstract class AbstractReferenceMap<K, V> extends AbstractHashedMap<K,
V>
     @Override
     public void clear() {
         super.clear();
-        while (queue.poll() != null) {} // drain the queue
+        // drain the queue
+        while (queue.poll() != null) {} // NOPMD
     }
 
     //-----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/9ae946c7/src/main/java/org/apache/commons/collections4/map/MultiValueMap.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/collections4/map/MultiValueMap.java b/src/main/java/org/apache/commons/collections4/map/MultiValueMap.java
index 5ff05ca..a929006 100644
--- a/src/main/java/org/apache/commons/collections4/map/MultiValueMap.java
+++ b/src/main/java/org/apache/commons/collections4/map/MultiValueMap.java
@@ -309,7 +309,7 @@ public class MultiValueMap<K, V> extends AbstractMapDecorator<K,
Object> impleme
      * @see #iterator()
      */
     @Override
-    public Set<Entry<K, Object>> entrySet() {
+    public Set<Entry<K, Object>> entrySet() { // NOPMD
         return super.entrySet();
     }
 

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/9ae946c7/src/main/java/org/apache/commons/collections4/sequence/SequencesComparator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/collections4/sequence/SequencesComparator.java
b/src/main/java/org/apache/commons/collections4/sequence/SequencesComparator.java
index 6228b85..7c6d4f5 100644
--- a/src/main/java/org/apache/commons/collections4/sequence/SequencesComparator.java
+++ b/src/main/java/org/apache/commons/collections4/sequence/SequencesComparator.java
@@ -201,7 +201,7 @@ public class SequencesComparator<T> {
                 }
                 // Second step
                 if (delta % 2 != 0 && delta - d <= k && k <= delta
+ d) {
-                    if (vUp[i-delta] <= vDown[i]) {
+                    if (vUp[i-delta] <= vDown[i]) { // NOPMD
                         return buildSnake(vUp[i-delta], k + start1 - start2, end1, end2);
                     }
                 }
@@ -227,7 +227,7 @@ public class SequencesComparator<T> {
                 }
                 // Second step
                 if (delta % 2 == 0 && -d <= k && k <= d ) {
-                    if (vUp[i] <= vDown[i + delta]) {
+                    if (vUp[i] <= vDown[i + delta]) { // NOPMD
                         return buildSnake(vUp[i], k + start1 - start2, end1, end2);
                     }
                 }

http://git-wip-us.apache.org/repos/asf/commons-collections/blob/9ae946c7/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java
b/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java
index e46cbfb..65b9809 100644
--- a/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java
+++ b/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java
@@ -177,7 +177,7 @@ abstract class AbstractPatriciaTrie<K, V> extends AbstractBitwiseTrie<K,
V> {
                 // This is a very special and rare case.
 
                 /* REPLACE OLD KEY+VALUE */
-                if (found != root) {
+                if (found != root) { // NOPMD
                     incrementModCount();
                     return found.setKeyValue(key, value);
                 }


Mime
View raw message