diff --git a/src/main/java/org/apache/commons/collections4/IteratorUtils.java b/src/main/java/org/apache/commons/collections4/IteratorUtils.java index 676d406c7..19f15e649 100644 --- a/src/main/java/org/apache/commons/collections4/IteratorUtils.java +++ b/src/main/java/org/apache/commons/collections4/IteratorUtils.java @@ -1047,13 +1047,13 @@ public class IteratorUtils { return it; } } - } catch (final RuntimeException e) { + } catch (final RuntimeException e) { // NOPMD // ignore - } catch (final NoSuchMethodException e) { + } catch (final NoSuchMethodException e) { // NOPMD // ignore - } catch (final IllegalAccessException e) { + } catch (final IllegalAccessException e) { // NOPMD // ignore - } catch (final InvocationTargetException e) { + } catch (final InvocationTargetException e) { // NOPMD // ignore } return singletonIterator(obj); diff --git a/src/main/java/org/apache/commons/collections4/MapUtils.java b/src/main/java/org/apache/commons/collections4/MapUtils.java index 68dea2037..afba05c5b 100644 --- a/src/main/java/org/apache/commons/collections4/MapUtils.java +++ b/src/main/java/org/apache/commons/collections4/MapUtils.java @@ -190,7 +190,7 @@ public class MapUtils { try { final String text = (String) answer; return NumberFormat.getInstance().parse(text); - } catch (final ParseException e) { + } catch (final ParseException e) { // NOPMD // failure means null is returned } } diff --git a/src/main/java/org/apache/commons/collections4/iterators/ObjectGraphIterator.java b/src/main/java/org/apache/commons/collections4/iterators/ObjectGraphIterator.java index 6da45fa96..631447fca 100644 --- a/src/main/java/org/apache/commons/collections4/iterators/ObjectGraphIterator.java +++ b/src/main/java/org/apache/commons/collections4/iterators/ObjectGraphIterator.java @@ -138,7 +138,7 @@ public class ObjectGraphIterator implements Iterator { return; } if (currentIterator == null) { - if (root == null) { + if (root == null) { // NOPMD // do nothing, hasNext will be false } else { if (transformer == null) { @@ -191,11 +191,8 @@ public class ObjectGraphIterator implements Iterator { } findNext(next); } - if (hasNext) { - // next value found - } else if (stack.isEmpty()) { - // all iterators exhausted - } else { + // if we havn't found the next value and iterators are not yet exhausted + if (!hasNext && !stack.isEmpty()) { // current iterator exhausted, go up a level currentIterator = stack.pop(); findNextByIterator(currentIterator); diff --git a/src/main/java/org/apache/commons/collections4/list/CursorableLinkedList.java b/src/main/java/org/apache/commons/collections4/list/CursorableLinkedList.java index c5c06f8f7..fb63fbfc6 100644 --- a/src/main/java/org/apache/commons/collections4/list/CursorableLinkedList.java +++ b/src/main/java/org/apache/commons/collections4/list/CursorableLinkedList.java @@ -431,7 +431,7 @@ public class CursorableLinkedList extends AbstractLinkedList implements Se public void remove() { // overridden, as the nodeRemoved() method updates the iterator // state in the parent.removeNode() call below - if (current == null && currentRemovedByAnother) { + if (current == null && currentRemovedByAnother) { // NOPMD // quietly ignore, as the last returned node was removed // by the list or some other iterator // by ignoring it, we keep this iterator independent from diff --git a/src/main/java/org/apache/commons/collections4/map/StaticBucketMap.java b/src/main/java/org/apache/commons/collections4/map/StaticBucketMap.java index f2d989935..0dd9e7796 100644 --- a/src/main/java/org/apache/commons/collections4/map/StaticBucketMap.java +++ b/src/main/java/org/apache/commons/collections4/map/StaticBucketMap.java @@ -150,7 +150,7 @@ public final class StaticBucketMap extends AbstractIterableMap { * the number of buckets. *

*/ - private final int getHash(final Object key) { + private int getHash(final Object key) { if (key == null) { return 0; }