Author: tn Date: Mon Jun 22 13:00:27 2015 New Revision: 1686855 URL: http://svn.apache.org/r1686855 Log: [COLLECTIONS-570] Consistently use a NullPointerException if a required input is null.
Modified: commons/proper/collections/trunk/src/changes/changes.xml commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/BagUtils.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ClosureUtils.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/FactoryUtils.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/IteratorUtils.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ListUtils.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/MapUtils.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/PredicateUtils.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/QueueUtils.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/SetUtils.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/SplitMapUtils.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/TransformerUtils.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/TrieUtils.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/AbstractBagDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/AbstractSortedBagDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/CollectionBag.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/CollectionSortedBag.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/PredicatedBag.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/PredicatedSortedBag.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/SynchronizedBag.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/SynchronizedSortedBag.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/TransformedBag.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/TransformedSortedBag.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/UnmodifiableBag.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/UnmodifiableSortedBag.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/AbstractBidiMapDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/AbstractSortedBidiMapDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableBidiMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableOrderedBidiMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableSortedBidiMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/AbstractCollectionDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/PredicatedCollection.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/SynchronizedCollection.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/TransformedCollection.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/UnmodifiableBoundedCollection.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/UnmodifiableCollection.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/comparators/FixedOrderComparator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/AllPredicate.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/AndPredicate.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/AnyPredicate.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ChainedClosure.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ChainedTransformer.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ClosureTransformer.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ComparatorPredicate.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/FactoryTransformer.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/FunctorUtils.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/IdentityPredicate.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/IfClosure.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/IfTransformer.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/InstanceofPredicate.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/InstantiateFactory.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/InstantiateTransformer.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/InvokerTransformer.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/NonePredicate.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/NotPredicate.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/NullIsExceptionPredicate.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/NullIsFalsePredicate.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/NullIsTruePredicate.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/OnePredicate.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/OrPredicate.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/SwitchClosure.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/SwitchTransformer.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/TransformedPredicate.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/TransformerPredicate.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/WhileClosure.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/iterators/AbstractIteratorDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/iterators/AbstractListIteratorDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/iterators/AbstractMapIteratorDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/iterators/AbstractOrderedMapIteratorDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/iterators/AbstractUntypedIteratorDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/iterators/BoundedIterator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/iterators/NodeListIterator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/iterators/PeekingIterator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/iterators/PushbackIterator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/iterators/ReverseListIterator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableIterator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableListIterator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableMapIterator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/iterators/UnmodifiableOrderedMapIterator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/keyvalue/AbstractMapEntryDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/list/AbstractListDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/list/AbstractSerializableListDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/list/FixedSizeList.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/list/GrowthList.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/list/LazyList.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/list/PredicatedList.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/list/SetUniqueList.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/list/TransformedList.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/list/UnmodifiableList.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/AbstractInputCheckedMapDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/AbstractMapDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/AbstractOrderedMapDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/AbstractSortedMapDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/DefaultedMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/FixedSizeMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/FixedSizeSortedMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/LazyMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/LazySortedMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/ListOrderedMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/MultiKeyMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/PassiveExpiringMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/PredicatedMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/PredicatedSortedMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/SingletonMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/TransformedMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/TransformedSortedMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/UnmodifiableEntrySet.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/UnmodifiableMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/UnmodifiableOrderedMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/map/UnmodifiableSortedMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/multiset/AbstractMultiSetDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/queue/AbstractQueueDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/queue/PredicatedQueue.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/queue/TransformedQueue.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/queue/UnmodifiableQueue.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/set/AbstractNavigableSetDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/set/AbstractSerializableSetDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/set/AbstractSetDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/set/AbstractSortedSetDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/set/ListOrderedSet.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/set/MapBackedSet.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/set/PredicatedNavigableSet.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/set/PredicatedSet.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/set/PredicatedSortedSet.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/set/TransformedNavigableSet.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/set/TransformedSet.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/set/TransformedSortedSet.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/set/UnmodifiableNavigableSet.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/set/UnmodifiableSet.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/set/UnmodifiableSortedSet.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/splitmap/AbstractIterableGetMapDecorator.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/splitmap/TransformedSplitMap.java commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/trie/UnmodifiableTrie.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/BagUtilsTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/ClosureUtilsTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/ListUtilsTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/MapUtilsTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/PredicateUtilsTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/QueueUtilsTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/SetUtilsTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/TrieUtilsTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/bag/PredicatedBagTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/bag/PredicatedSortedBagTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/bag/UnmodifiableBagTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/bag/UnmodifiableSortedBagTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/bidimap/UnmodifiableBidiMapTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/bidimap/UnmodifiableOrderedBidiMapTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/bidimap/UnmodifiableSortedBidiMapTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/collection/UnmodifiableBoundedCollectionTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/collection/UnmodifiableCollectionTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/functors/AbstractCompositePredicateTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/iterators/NodeListIteratorTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/iterators/UnmodifiableIteratorTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/iterators/UnmodifiableListIteratorTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/iterators/UnmodifiableMapIteratorTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/iterators/UnmodifiableOrderedMapIteratorTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/list/UnmodifiableListTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/map/LazySortedMapTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/map/UnmodifiableMapTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/map/UnmodifiableOrderedMapTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/map/UnmodifiableSortedMapTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/queue/UnmodifiableQueueTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/set/ListOrderedSetTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/set/UnmodifiableNavigableSetTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/set/UnmodifiableSetTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/set/UnmodifiableSortedSetTest.java commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/trie/UnmodifiableTrieTest.java Modified: commons/proper/collections/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/changes/changes.xml?rev=1686855&r1=1686854&r2=1686855&view=diff ============================================================================== --- commons/proper/collections/trunk/src/changes/changes.xml (original) +++ commons/proper/collections/trunk/src/changes/changes.xml Mon Jun 22 13:00:27 2015 @@ -22,6 +22,10 @@ <body> <release version="4.1" date="TBD" description=""> + <action issue="COLLECTIONS-570" dev="tn" type="update"> + All constructors and static factory methods will now throw a "NullPointerException" if + a required input argument is null. Previously sometimes a "IllegalArgumentException" was used. + </action> <action issue="COLLECTIONS-571" dev="tn" type="update"> Deprecated methods "synchronizedCollection(Collection)" and "unmodifiableCollection(Collection)" in class "CollectionUtils", the corresponding methods in "java.util.Collections" should be used instead. Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/BagUtils.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/BagUtils.java?rev=1686855&r1=1686854&r2=1686855&view=diff ============================================================================== --- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/BagUtils.java (original) +++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/BagUtils.java Mon Jun 22 13:00:27 2015 @@ -79,7 +79,7 @@ public class BagUtils { * @param <E> the element type * @param bag the bag to synchronize, must not be null * @return a synchronized bag backed by that bag - * @throws IllegalArgumentException if the Bag is null + * @throws NullPointerException if the Bag is null */ public static <E> Bag<E> synchronizedBag(final Bag<E> bag) { return SynchronizedBag.synchronizedBag(bag); @@ -92,7 +92,7 @@ public class BagUtils { * @param <E> the element type * @param bag the bag whose unmodifiable view is to be returned, must not be null * @return an unmodifiable view of that bag - * @throws IllegalArgumentException if the Bag is null + * @throws NullPointerException if the Bag is null */ public static <E> Bag<E> unmodifiableBag(final Bag<? extends E> bag) { return UnmodifiableBag.unmodifiableBag(bag); @@ -111,7 +111,7 @@ public class BagUtils { * @param bag the bag to predicate, must not be null * @param predicate the predicate for the bag, must not be null * @return a predicated bag backed by the given bag - * @throws IllegalArgumentException if the Bag or Predicate is null + * @throws NullPointerException if the Bag or Predicate is null */ public static <E> Bag<E> predicatedBag(final Bag<E> bag, final Predicate<? super E> predicate) { return PredicatedBag.predicatedBag(bag, predicate); @@ -131,7 +131,7 @@ public class BagUtils { * @param bag the bag to predicate, must not be null * @param transformer the transformer for the bag, must not be null * @return a transformed bag backed by the given bag - * @throws IllegalArgumentException if the Bag or Transformer is null + * @throws NullPointerException if the Bag or Transformer is null */ public static <E> Bag<E> transformingBag(final Bag<E> bag, final Transformer<? super E, ? extends E> transformer) { return TransformedBag.transformingBag(bag, transformer); @@ -143,7 +143,7 @@ public class BagUtils { * @param <E> the element type * @param bag the bag to decorate, must not be null * @return a Bag that complies to the Collection contract - * @throws IllegalArgumentException if bag is null + * @throws NullPointerException if bag is null * @since 4.0 */ public static <E> Bag<E> collectionBag(final Bag<E> bag) { @@ -175,7 +175,7 @@ public class BagUtils { * @param <E> the element type * @param bag the bag to synchronize, must not be null * @return a synchronized bag backed by that bag - * @throws IllegalArgumentException if the SortedBag is null + * @throws NullPointerException if the SortedBag is null */ public static <E> SortedBag<E> synchronizedSortedBag(final SortedBag<E> bag) { return SynchronizedSortedBag.synchronizedSortedBag(bag); @@ -189,7 +189,7 @@ public class BagUtils { * @param <E> the element type * @param bag the bag whose unmodifiable view is to be returned, must not be null * @return an unmodifiable view of that bag - * @throws IllegalArgumentException if the SortedBag is null + * @throws NullPointerException if the SortedBag is null */ public static <E> SortedBag<E> unmodifiableSortedBag(final SortedBag<E> bag) { return UnmodifiableSortedBag.unmodifiableSortedBag(bag); @@ -209,7 +209,7 @@ public class BagUtils { * @param bag the sorted bag to predicate, must not be null * @param predicate the predicate for the bag, must not be null * @return a predicated bag backed by the given bag - * @throws IllegalArgumentException if the SortedBag or Predicate is null + * @throws NullPointerException if the SortedBag or Predicate is null */ public static <E> SortedBag<E> predicatedSortedBag(final SortedBag<E> bag, final Predicate<? super E> predicate) { @@ -231,7 +231,7 @@ public class BagUtils { * @param bag the bag to predicate, must not be null * @param transformer the transformer for the bag, must not be null * @return a transformed bag backed by the given bag - * @throws IllegalArgumentException if the Bag or Transformer is null + * @throws NullPointerException if the Bag or Transformer is null */ public static <E> SortedBag<E> transformingSortedBag(final SortedBag<E> bag, final Transformer<? super E, ? extends E> transformer) { Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ClosureUtils.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ClosureUtils.java?rev=1686855&r1=1686854&r2=1686855&view=diff ============================================================================== --- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ClosureUtils.java (original) +++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ClosureUtils.java Mon Jun 22 13:00:27 2015 @@ -125,7 +125,7 @@ public class ClosureUtils { * @param predicate the predicate to use as an end of loop test, not null * @param closure the closure to call repeatedly, not null * @return the <code>while</code> closure - * @throws IllegalArgumentException if either argument is null + * @throws NullPointerException if either argument is null */ public static <E> Closure<E> whileClosure(final Predicate<? super E> predicate, final Closure<? super E> closure) { return WhileClosure.<E>whileClosure(predicate, closure, false); @@ -141,7 +141,7 @@ public class ClosureUtils { * @param closure the closure to call repeatedly, not null * @param predicate the predicate to use as an end of loop test, not null * @return the <code>do-while</code> closure - * @throws IllegalArgumentException if either argument is null + * @throws NullPointerException if either argument is null */ public static <E> Closure<E> doWhileClosure(final Closure<? super E> closure, final Predicate<? super E> predicate) { @@ -158,7 +158,7 @@ public class ClosureUtils { * @param <E> the type that the closure acts on * @param methodName the name of the method * @return the <code>invoker</code> closure - * @throws IllegalArgumentException if the method name is null + * @throws NullPointerException if the method name is null */ public static <E> Closure<E> invokerClosure(final String methodName) { // reuse transformer as it has caching - this is lazy really, should have inner class here @@ -177,7 +177,7 @@ public class ClosureUtils { * @param paramTypes the parameter types * @param args the arguments * @return the <code>invoker</code> closure - * @throws IllegalArgumentException if the method name is null + * @throws NullPointerException if the method name is null * @throws IllegalArgumentException if the paramTypes and args don't match */ public static <E> Closure<E> invokerClosure(final String methodName, final Class<?>[] paramTypes, @@ -195,8 +195,8 @@ public class ClosureUtils { * @param <E> the type that the closure acts on * @param closures an array of closures to chain * @return the <code>chained</code> closure - * @throws IllegalArgumentException if the closures array is null - * @throws IllegalArgumentException if any closure in the array is null + * @throws NullPointerException if the closures array is null + * @throws NullPointerException if any closure in the array is null */ public static <E> Closure<E> chainedClosure(final Closure<? super E>... closures) { return ChainedClosure.chainedClosure(closures); @@ -212,9 +212,9 @@ public class ClosureUtils { * @param <E> the type that the closure acts on * @param closures a collection of closures to chain * @return the <code>chained</code> closure - * @throws IllegalArgumentException if the closures collection is null + * @throws NullPointerException if the closures collection is null + * @throws NullPointerException if any closure in the collection is null * @throws IllegalArgumentException if the closures collection is empty - * @throws IllegalArgumentException if any closure in the collection is null */ public static <E> Closure<E> chainedClosure(final Collection<? extends Closure<? super E>> closures) { return ChainedClosure.chainedClosure(closures); @@ -230,8 +230,7 @@ public class ClosureUtils { * @param predicate the validating predicate * @param trueClosure the closure called if the predicate is true * @return the <code>if</code> closure - * @throws IllegalArgumentException if the predicate is null - * @throws IllegalArgumentException if the closure is null + * @throws NullPointerException if the predicate or closure is null * @since 3.2 */ public static <E> Closure<E> ifClosure(final Predicate<? super E> predicate, @@ -250,8 +249,7 @@ public class ClosureUtils { * @param trueClosure the closure called if the predicate is true * @param falseClosure the closure called if the predicate is false * @return the <code>switch</code> closure - * @throws IllegalArgumentException if the predicate is null - * @throws IllegalArgumentException if either closure is null + * @throws NullPointerException if the predicate or either closure is null */ public static <E> Closure<E> ifClosure(final Predicate<? super E> predicate, final Closure<? super E> trueClosure, @@ -273,9 +271,9 @@ public class ClosureUtils { * @param predicates an array of predicates to check, not null * @param closures an array of closures to call, not null * @return the <code>switch</code> closure - * @throws IllegalArgumentException if the either array is null - * @throws IllegalArgumentException if any element in the arrays is null - * @throws IllegalArgumentException if the arrays are different sizes + * @throws NullPointerException if the either array is null + * @throws NullPointerException if any element in the arrays is null + * @throws IllegalArgumentException if the arrays have different sizes */ public static <E> Closure<E> switchClosure(final Predicate<? super E>[] predicates, final Closure<? super E>[] closures) { @@ -298,8 +296,8 @@ public class ClosureUtils { * @param closures an array of closures to call, not null * @param defaultClosure the default to call if no predicate matches * @return the <code>switch</code> closure - * @throws IllegalArgumentException if the either array is null - * @throws IllegalArgumentException if any element in the arrays is null + * @throws NullPointerException if the either array is null + * @throws NullPointerException if any element in the arrays is null * @throws IllegalArgumentException if the arrays are different sizes */ public static <E> Closure<E> switchClosure(final Predicate<? super E>[] predicates, @@ -324,9 +322,9 @@ public class ClosureUtils { * @param <E> the type that the closure acts on * @param predicatesAndClosures a map of predicates to closures * @return the <code>switch</code> closure - * @throws IllegalArgumentException if the map is null + * @throws NullPointerException if the map is null + * @throws NullPointerException if any closure in the map is null * @throws IllegalArgumentException if the map is empty - * @throws IllegalArgumentException if any closure in the map is null * @throws ClassCastException if the map elements are of the wrong type */ public static <E> Closure<E> switchClosure(final Map<Predicate<E>, Closure<E>> predicatesAndClosures) { @@ -347,14 +345,14 @@ public class ClosureUtils { * @param <E> the type that the closure acts on * @param objectsAndClosures a map of objects to closures * @return the closure - * @throws IllegalArgumentException if the map is null + * @throws NullPointerException if the map is null + * @throws NullPointerException if any closure in the map is null * @throws IllegalArgumentException if the map is empty - * @throws IllegalArgumentException if any closure in the map is null */ @SuppressWarnings("unchecked") public static <E> Closure<E> switchMapClosure(final Map<? extends E, Closure<E>> objectsAndClosures) { if (objectsAndClosures == null) { - throw new IllegalArgumentException("The object and closure map must not be null"); + throw new NullPointerException("The object and closure map must not be null"); } final Closure<? super E> def = objectsAndClosures.remove(null); final int size = objectsAndClosures.size(); Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java?rev=1686855&r1=1686854&r2=1686855&view=diff ============================================================================== --- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java (original) +++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java Mon Jun 22 13:00:27 2015 @@ -545,14 +545,14 @@ public class CollectionUtils { * @param b the second collection, must not be null * @param equator the Equator used for testing equality * @return <code>true</code> iff the collections contain the same elements with the same cardinalities. - * @throws IllegalArgumentException if the equator is null + * @throws NullPointerException if the equator is null * @since 4.0 */ public static <E> boolean isEqualCollection(final Collection<? extends E> a, final Collection<? extends E> b, final Equator<? super E> equator) { if (equator == null) { - throw new IllegalArgumentException("equator may not be null"); + throw new NullPointerException("Equator must not be null."); } if(a.size() != b.size()) { @@ -1509,7 +1509,7 @@ public class CollectionUtils { * @param a the first collection, must not be null * @param b the second collection, must not be null * @return a new sorted List, containing the elements of Collection a and b - * @throws IllegalArgumentException if either collection is null + * @throws NullPointerException if either collection is null * @since 4.0 */ public static <O extends Comparable<? super O>> List<O> collate(Iterable<? extends O> a, @@ -1529,7 +1529,7 @@ public class CollectionUtils { * @param includeDuplicates if {@code true} duplicate elements will be retained, otherwise * they will be removed in the output collection * @return a new sorted List, containing the elements of Collection a and b - * @throws IllegalArgumentException if either collection is null + * @throws NullPointerException if either collection is null * @since 4.0 */ public static <O extends Comparable<? super O>> List<O> collate(final Iterable<? extends O> a, @@ -1549,7 +1549,7 @@ public class CollectionUtils { * @param b the second collection, must not be null * @param c the comparator to use for the merge. * @return a new sorted List, containing the elements of Collection a and b - * @throws IllegalArgumentException if either collection or the comparator is null + * @throws NullPointerException if either collection or the comparator is null * @since 4.0 */ public static <O> List<O> collate(final Iterable<? extends O> a, final Iterable<? extends O> b, @@ -1570,17 +1570,17 @@ public class CollectionUtils { * @param includeDuplicates if {@code true} duplicate elements will be retained, otherwise * they will be removed in the output collection * @return a new sorted List, containing the elements of Collection a and b - * @throws IllegalArgumentException if either collection or the comparator is null + * @throws NullPointerException if either collection or the comparator is null * @since 4.0 */ public static <O> List<O> collate(final Iterable<? extends O> a, final Iterable<? extends O> b, final Comparator<? super O> c, final boolean includeDuplicates) { if (a == null || b == null) { - throw new IllegalArgumentException("The collections must not be null"); + throw new NullPointerException("The collections must not be null"); } if (c == null) { - throw new IllegalArgumentException("The comparator must not be null"); + throw new NullPointerException("The comparator must not be null"); } // if both Iterables are a Collection, we can estimate the size @@ -1807,7 +1807,7 @@ public class CollectionUtils { * @param <C> the type of object the {@link Collection} contains * @param collection the collection to synchronize, must not be null * @return a synchronized collection backed by the given collection - * @throws IllegalArgumentException if the collection is null + * @throws NullPointerException if the collection is null * @deprecated since 4.1, use {@link java.util.Collections#synchronizedCollection(Collection)} instead */ @Deprecated @@ -1823,7 +1823,7 @@ public class CollectionUtils { * @param <C> the type of object the {@link Collection} contains * @param collection the collection to make unmodifiable, must not be null * @return an unmodifiable collection backed by the given collection - * @throws IllegalArgumentException if the collection is null + * @throws NullPointerException if the collection is null * @deprecated since 4.1, use {@link java.util.Collections#unmodifiableCollection(Collection)} instead */ @Deprecated @@ -1839,11 +1839,11 @@ public class CollectionUtils { * It is important not to use the original collection after invoking this method, * as it is a backdoor for adding invalid objects. * + * @param <C> the type of objects in the Collection. * @param collection the collection to predicate, must not be null * @param predicate the predicate for the collection, must not be null - * @param <C> the type of objects in the Collection. * @return a predicated collection backed by the given collection - * @throws IllegalArgumentException if the Collection is null + * @throws NullPointerException if the Collection is null */ public static <C> Collection<C> predicatedCollection(final Collection<C> collection, final Predicate<? super C> predicate) { @@ -1860,11 +1860,11 @@ public class CollectionUtils { * Existing entries in the specified collection will not be transformed. * If you want that behaviour, see {@link TransformedCollection#transformedCollection}. * - * @param <E> the type of object the {@link Collection} contains + * @param <E> the type of object the {@link Collection} contains * @param collection the collection to predicate, must not be null * @param transformer the transformer for the collection, must not be null * @return a transformed collection backed by the given collection - * @throws IllegalArgumentException if the Collection or Transformer is null + * @throws NullPointerException if the Collection or Transformer is null */ public static <E> Collection<E> transformingCollection(final Collection<E> collection, final Transformer<? super E, ? extends E> transformer) { @@ -1876,11 +1876,15 @@ public class CollectionUtils { * @param <E> collection type * @param collection to read * @return sole member of collection - * @throws IllegalArgumentException if collection is null/empty or contains more than one element + * @throws NullPointerException if collection is null + * @throws IllegalArgumentException if collection is empty or contains more than one element * @since 4.0 */ public static <E> E extractSingleton(final Collection<E> collection) { - if (collection == null || collection.size() != 1) { + if (collection == null) { + throw new NullPointerException("Collection must not be null."); + } + if (collection.size() != 1) { throw new IllegalArgumentException("Can extract singleton only when collection size == 1"); } return collection.iterator().next(); Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/FactoryUtils.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/FactoryUtils.java?rev=1686855&r1=1686854&r2=1686855&view=diff ============================================================================== --- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/FactoryUtils.java (original) +++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/FactoryUtils.java Mon Jun 22 13:00:27 2015 @@ -115,7 +115,7 @@ public class FactoryUtils { * @param <T> the type that the factory creates * @param classToInstantiate the Class to instantiate each time in the factory * @return the <code>reflection</code> factory - * @throws IllegalArgumentException if the classToInstantiate is null + * @throws NullPointerException if the classToInstantiate is null */ public static <T> Factory<T> instantiateFactory(final Class<T> classToInstantiate) { return InstantiateFactory.instantiateFactory(classToInstantiate, null, null); @@ -132,7 +132,7 @@ public class FactoryUtils { * @param paramTypes parameter types for the constructor, can be null * @param args the arguments to pass to the constructor, can be null * @return the <code>reflection</code> factory - * @throws IllegalArgumentException if the classToInstantiate is null + * @throws NullPointerException if the classToInstantiate is null * @throws IllegalArgumentException if the paramTypes and args don't match * @throws IllegalArgumentException if the constructor doesn't exist */ Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/IteratorUtils.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/IteratorUtils.java?rev=1686855&r1=1686854&r2=1686855&view=diff ============================================================================== --- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/IteratorUtils.java (original) +++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/IteratorUtils.java Mon Jun 22 13:00:27 2015 @@ -430,7 +430,8 @@ public class IteratorUtils { * @param iterator the iterator to decorate * @param max the maximum number of elements returned by this iterator * @return a new bounded iterator - * @throws IllegalArgumentException if the iterator is null or max is negative + * @throws NullPointerException if the iterator is null + * @throws IllegalArgumentException if max is negative * @since 4.1 */ public static <E> BoundedIterator<E> boundedIterator(final Iterator<? extends E> iterator, long max) { @@ -450,7 +451,8 @@ public class IteratorUtils { * @param offset the index of the first element of the decorated iterator to return * @param max the maximum number of elements returned by this iterator * @return a new bounded iterator - * @throws IllegalArgumentException if the iterator is null or either offset or max is negative + * @throws NullPointerException if the iterator is null + * @throws IllegalArgumentException if either offset or max is negative * @since 4.1 */ public static <E> BoundedIterator<E> boundedIterator(final Iterator<? extends E> iterator, Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ListUtils.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ListUtils.java?rev=1686855&r1=1686854&r2=1686855&view=diff ============================================================================== --- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ListUtils.java (original) +++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ListUtils.java Mon Jun 22 13:00:27 2015 @@ -80,7 +80,7 @@ public class ListUtils { * Returns a new list containing all elements that are contained in * both given lists. * - * @param <E> the element type + * @param <E> the element type * @param list1 the first list * @param list2 the second list * @return the intersection of those two lists @@ -117,10 +117,10 @@ public class ListUtils { * contains one occurrence, then the returned list will still contain * one occurrence. * - * @param <E> the element type + * @param <E> the element type * @param list1 the list to subtract from * @param list2 the list to subtract - * @return a new list containing the results + * @return a new list containing the results * @throws NullPointerException if either list is null */ public static <E> List<E> subtract(final List<E> list1, final List<? extends E> list2) { @@ -138,7 +138,7 @@ public class ListUtils { * Returns the sum of the given lists. This is their intersection * subtracted from their union. * - * @param <E> the element type + * @param <E> the element type * @param list1 the first list * @param list2 the second list * @return a new list containing the sum of those lists @@ -153,10 +153,10 @@ public class ListUtils { * first list. The {@link List#addAll(Collection)} operation is * used to append the two given lists into a new list. * - * @param <E> the element type + * @param <E> the element type * @param list1 the first list * @param list2 the second list - * @return a new list containing the union of those lists + * @return a new list containing the union of those lists * @throws NullPointerException if either list is null */ public static <E> List<E> union(final List<? extends E> list1, final List<? extends E> list2) { @@ -171,14 +171,11 @@ public class ListUtils { * <p> * A <code>null</code> predicate matches no elements. * - * @param <E> the element type - * @param inputCollection - * the collection to get the input from, may not be null - * @param predicate - * the predicate to use, may be null + * @param <E> the element type + * @param inputCollection the collection to get the input from, may not be null + * @param predicate the predicate to use, may be null * @return the elements matching the predicate (new list) - * @throws NullPointerException - * if the input list is null + * @throws NullPointerException if the input list is null * * @since 4.0 * @see CollectionUtils#select(Iterable, Predicate) @@ -192,17 +189,13 @@ public class ListUtils { * Selects all elements from inputCollection which don't match the given * predicate into an output collection. * <p> - * If the input predicate is <code>null</code>, the result is an empty - * list. + * If the input predicate is <code>null</code>, the result is an empty list. * - * @param <E> the element type - * @param inputCollection - * the collection to get the input from, may not be null - * @param predicate - * the predicate to use, may be null + * @param <E> the element type + * @param inputCollection the collection to get the input from, may not be null + * @param predicate the predicate to use, may be null * @return the elements <b>not</b> matching the predicate (new list) - * @throws NullPointerException - * if the input collection is null + * @throws NullPointerException if the input collection is null * * @since 4.0 * @see CollectionUtils#selectRejected(Iterable, Predicate) @@ -378,10 +371,10 @@ public class ListUtils { * * This method is just a wrapper for {@link Collections#synchronizedList(List)}. * - * @param <E> the element type + * @param <E> the element type * @param list the list to synchronize, must not be null * @return a synchronized list backed by the given list - * @throws IllegalArgumentException if the list is null + * @throws NullPointerException if the list is null */ public static <E> List<E> synchronizedList(final List<E> list) { return Collections.synchronizedList(list); @@ -395,7 +388,7 @@ public class ListUtils { * @param <E> the element type * @param list the list to make unmodifiable, must not be null * @return an unmodifiable list backed by the given list - * @throws IllegalArgumentException if the list is null + * @throws NullPointerException if the list is null */ public static <E> List<E> unmodifiableList(final List<? extends E> list) { return UnmodifiableList.unmodifiableList(list); @@ -409,11 +402,11 @@ public class ListUtils { * It is important not to use the original list after invoking this method, * as it is a backdoor for adding invalid objects. * - * @param <E> the element type + * @param <E> the element type * @param list the list to predicate, must not be null * @param predicate the predicate for the list, must not be null * @return a predicated list backed by the given list - * @throws IllegalArgumentException if the List or Predicate is null + * @throws NullPointerException if the List or Predicate is null */ public static <E> List<E> predicatedList(final List<E> list, final Predicate<E> predicate) { return PredicatedList.predicatedList(list, predicate); @@ -433,11 +426,11 @@ public class ListUtils { * Existing entries in the specified list will not be transformed. * If you want that behaviour, see {@link TransformedList#transformedList}. * - * @param <E> the element type + * @param <E> the element type * @param list the list to predicate, must not be null * @param transformer the transformer for the list, must not be null * @return a transformed list backed by the given list - * @throws IllegalArgumentException if the List or Transformer is null + * @throws NullPointerException if the List or Transformer is null */ public static <E> List<E> transformedList(final List<E> list, final Transformer<? super E, ? extends E> transformer) { @@ -468,11 +461,11 @@ public class ListUtils { * instance is the fourth element in the list. The first, second, * and third element are all set to <code>null</code>. * - * @param <E> the element type + * @param <E> the element type * @param list the list to make lazy, must not be null * @param factory the factory for creating new objects, must not be null * @return a lazy list backed by the given list - * @throws IllegalArgumentException if the List or Factory is null + * @throws NullPointerException if the List or Factory is null */ public static <E> List<E> lazyList(final List<E> list, final Factory<? extends E> factory) { return LazyList.lazyList(list, factory); @@ -487,7 +480,7 @@ public class ListUtils { * @param <E> the element type * @param list the list whose size to fix, must not be null * @return a fixed-size list backed by that list - * @throws IllegalArgumentException if the List is null + * @throws NullPointerException if the List is null */ public static <E> List<E> fixedSizeList(final List<E> list) { return FixedSizeList.fixedSizeList(list); @@ -525,7 +518,7 @@ public class ListUtils { * @param a the first list * @param b the second list * @return the longest common subsequence - * @throws IllegalArgumentException if either list is {@code null} + * @throws NullPointerException if either list is {@code null} * @since 4.0 */ public static <E> List<E> longestCommonSubsequence(final List<E> a, final List<E> b) { @@ -540,16 +533,16 @@ public class ListUtils { * @param b the second list * @param equator the equator used to test object equality * @return the longest common subsequence - * @throws IllegalArgumentException if either list or the equator is {@code null} + * @throws NullPointerException if either list or the equator is {@code null} * @since 4.0 */ public static <E> List<E> longestCommonSubsequence(final List<E> a, final List<E> b, final Equator<? super E> equator) { if (a == null || b == null) { - throw new IllegalArgumentException("List must not be null"); + throw new NullPointerException("List must not be null"); } if (equator == null) { - throw new IllegalArgumentException("Equator must not be null"); + throw new NullPointerException("Equator must not be null"); } final SequencesComparator<E> comparator = new SequencesComparator<E>(a, b, equator); @@ -568,12 +561,12 @@ public class ListUtils { * @param a the first sequence * @param b the second sequence * @return the longest common subsequence as {@link String} - * @throws IllegalArgumentException if either sequence is {@code null} + * @throws NullPointerException if either sequence is {@code null} * @since 4.0 */ public static String longestCommonSubsequence(final CharSequence a, final CharSequence b) { if (a == null || b == null) { - throw new IllegalArgumentException("CharSequence must not be null"); + throw new NullPointerException("CharSequence must not be null"); } final List<Character> lcs = longestCommonSubsequence(new CharSequenceAsList( a ), new CharSequenceAsList( b )); final StringBuilder sb = new StringBuilder(); @@ -644,16 +637,17 @@ public class ListUtils { * <p> * Adapted from http://code.google.com/p/guava-libraries/ * - * @param <T> the element type + * @param <T> the element type * @param list the list to return consecutive sublists of * @param size the desired size of each sublist (the last may be smaller) * @return a list of consecutive sublists - * @throws IllegalArgumentException if list is {@code null} or size is not strictly positive + * @throws NullPointerException if list is null + * @throws IllegalArgumentException if size is not strictly positive * @since 4.0 */ public static <T> List<List<T>> partition(final List<T> list, final int size) { if (list == null) { - throw new IllegalArgumentException("List must not be null"); + throw new NullPointerException("List must not be null"); } if (size <= 0) { throw new IllegalArgumentException("Size must be greater than 0"); Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/MapUtils.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/MapUtils.java?rev=1686855&r1=1686854&r2=1686855&view=diff ============================================================================== --- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/MapUtils.java (original) +++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/MapUtils.java Mon Jun 22 13:00:27 2015 @@ -1262,7 +1262,7 @@ public class MapUtils { * @param <V> the value type * @param map the map to make unmodifiable, must not be null * @return an unmodifiable map backed by the given map - * @throws IllegalArgumentException if the map is null + * @throws NullPointerException if the map is null */ public static <K, V> Map<K, V> unmodifiableMap(final Map<? extends K, ? extends V> map) { return UnmodifiableMap.unmodifiableMap(map); @@ -1283,7 +1283,7 @@ public class MapUtils { * @param keyPred the predicate for keys, null means no check * @param valuePred the predicate for values, null means no check * @return a predicated map backed by the given map - * @throws IllegalArgumentException if the Map is null + * @throws NullPointerException if the Map is null */ public static <K, V> IterableMap<K, V> predicatedMap(final Map<K, V> map, final Predicate<? super K> keyPred, final Predicate<? super V> valuePred) { @@ -1311,7 +1311,7 @@ public class MapUtils { * @param keyTransformer the transformer for the map keys, null means no transformation * @param valueTransformer the transformer for the map values, null means no transformation * @return a transformed map backed by the given map - * @throws IllegalArgumentException if the Map is null + * @throws NullPointerException if the Map is null */ public static <K, V> IterableMap<K, V> transformedMap(final Map<K, V> map, final Transformer<? super K, ? extends K> keyTransformer, @@ -1329,7 +1329,7 @@ public class MapUtils { * @param <V> the value type * @param map the map whose size to fix, must not be null * @return a fixed-size map backed by that map - * @throws IllegalArgumentException if the Map is null + * @throws NullPointerException if the Map is null */ public static <K, V> IterableMap<K, V> fixedSizeMap(final Map<K, V> map) { return FixedSizeMap.fixedSizeMap(map); @@ -1363,7 +1363,7 @@ public class MapUtils { * @param map the map to make lazy, must not be null * @param factory the factory for creating new objects, must not be null * @return a lazy map backed by the given map - * @throws IllegalArgumentException if the Map or Factory is null + * @throws NullPointerException if the Map or Factory is null */ public static <K, V> IterableMap<K, V> lazyMap(final Map<K, V> map, final Factory<? extends V> factory) { return LazyMap.lazyMap(map, factory); @@ -1404,7 +1404,7 @@ public class MapUtils { * @param map the map to make lazy, must not be null * @param transformerFactory the factory for creating new objects, must not be null * @return a lazy map backed by the given map - * @throws IllegalArgumentException if the Map or Transformer is null + * @throws NullPointerException if the Map or Transformer is null */ public static <K, V> IterableMap<K, V> lazyMap(final Map<K, V> map, final Transformer<? super K, ? extends V> transformerFactory) { @@ -1422,7 +1422,7 @@ public class MapUtils { * @param <V> the value type * @param map the map to order, must not be null * @return an ordered map backed by the given map - * @throws IllegalArgumentException if the Map is null + * @throws NullPointerException if the Map is null */ public static <K, V> OrderedMap<K, V> orderedMap(final Map<K, V> map) { return ListOrderedMap.listOrderedMap(map); @@ -1512,7 +1512,7 @@ public class MapUtils { * @param <V> the value type * @param map the map to synchronize, must not be null * @return a synchronized map backed by the given map - * @throws IllegalArgumentException if the map is null + * @throws NullPointerException if the map is null */ public static <K, V> SortedMap<K, V> synchronizedSortedMap(final SortedMap<K, V> map) { return Collections.synchronizedSortedMap(map); @@ -1527,7 +1527,7 @@ public class MapUtils { * @param <V> the value type * @param map the sorted map to make unmodifiable, must not be null * @return an unmodifiable map backed by the given map - * @throws IllegalArgumentException if the map is null + * @throws NullPointerException if the map is null */ public static <K, V> SortedMap<K, V> unmodifiableSortedMap(final SortedMap<K, ? extends V> map) { return UnmodifiableSortedMap.unmodifiableSortedMap(map); @@ -1548,7 +1548,7 @@ public class MapUtils { * @param keyPred the predicate for keys, null means no check * @param valuePred the predicate for values, null means no check * @return a predicated map backed by the given map - * @throws IllegalArgumentException if the SortedMap is null + * @throws NullPointerException if the SortedMap is null */ public static <K, V> SortedMap<K, V> predicatedSortedMap(final SortedMap<K, V> map, final Predicate<? super K> keyPred, final Predicate<? super V> valuePred) { @@ -1576,7 +1576,7 @@ public class MapUtils { * @param keyTransformer the transformer for the map keys, null means no transformation * @param valueTransformer the transformer for the map values, null means no transformation * @return a transformed map backed by the given map - * @throws IllegalArgumentException if the SortedMap is null + * @throws NullPointerException if the SortedMap is null */ public static <K, V> SortedMap<K, V> transformedSortedMap(final SortedMap<K, V> map, final Transformer<? super K, ? extends K> keyTransformer, @@ -1594,7 +1594,7 @@ public class MapUtils { * @param <V> the value type * @param map the map whose size to fix, must not be null * @return a fixed-size map backed by that map - * @throws IllegalArgumentException if the SortedMap is null + * @throws NullPointerException if the SortedMap is null */ public static <K, V> SortedMap<K, V> fixedSizeSortedMap(final SortedMap<K, V> map) { return FixedSizeSortedMap.fixedSizeSortedMap(map); @@ -1629,7 +1629,7 @@ public class MapUtils { * @param map the map to make lazy, must not be null * @param factory the factory for creating new objects, must not be null * @return a lazy map backed by the given map - * @throws IllegalArgumentException if the SortedMap or Factory is null + * @throws NullPointerException if the SortedMap or Factory is null */ public static <K, V> SortedMap<K, V> lazySortedMap(final SortedMap<K, V> map, final Factory<? extends V> factory) { return LazySortedMap.lazySortedMap(map, factory); @@ -1670,7 +1670,7 @@ public class MapUtils { * @param map the map to make lazy, must not be null * @param transformerFactory the factory for creating new objects, must not be null * @return a lazy map backed by the given map - * @throws IllegalArgumentException if the Map or Transformer is null + * @throws NullPointerException if the Map or Transformer is null */ public static <K, V> SortedMap<K, V> lazySortedMap(final SortedMap<K, V> map, final Transformer<? super K, ? extends V> transformerFactory) { @@ -1762,11 +1762,12 @@ public class MapUtils { * @param <V> the value type * @param map to wrap if necessary. * @return IterableMap<K, V> + * @throws NullPointerException if map is null * @since 4.0 */ public static <K, V> IterableMap<K, V> iterableMap(final Map<K, V> map) { if (map == null) { - throw new IllegalArgumentException("Map must not be null"); + throw new NullPointerException("Map must not be null"); } return map instanceof IterableMap ? (IterableMap<K, V>) map : new AbstractMapDecorator<K, V>(map) {}; } @@ -1778,11 +1779,12 @@ public class MapUtils { * @param <V> the value type * @param sortedMap to wrap if necessary * @return {@link IterableSortedMap}<K, V> + * @throws NullPointerException if sortedMap is null * @since 4.0 */ public static <K, V> IterableSortedMap<K, V> iterableSortedMap(final SortedMap<K, V> sortedMap) { if (sortedMap == null) { - throw new IllegalArgumentException("Map must not be null"); + throw new NullPointerException("Map must not be null"); } return sortedMap instanceof IterableSortedMap ? (IterableSortedMap<K, V>) sortedMap : new AbstractSortedMapDecorator<K, V>(sortedMap) {}; Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/PredicateUtils.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/PredicateUtils.java?rev=1686855&r1=1686854&r2=1686855&view=diff ============================================================================== --- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/PredicateUtils.java (original) +++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/PredicateUtils.java Mon Jun 22 13:00:27 2015 @@ -168,7 +168,7 @@ public class PredicateUtils { * * @param type the type to check for, may not be null * @return the predicate - * @throws IllegalArgumentException if the class is null + * @throws NullPointerException if the class is null * @see InstanceofPredicate */ public static Predicate<Object> instanceofPredicate(final Class<?> type) { @@ -204,7 +204,7 @@ public class PredicateUtils { * @param <T> the type that the predicate queries * @param methodName the method name to call on the input object, may not be null * @return the predicate - * @throws IllegalArgumentException if the methodName is null. + * @throws NullPointerException if the methodName is null. * @see InvokerTransformer * @see TransformerPredicate */ @@ -228,7 +228,7 @@ public class PredicateUtils { * @param paramTypes the parameter types * @param args the arguments * @return the predicate - * @throws IllegalArgumentException if the method name is null + * @throws NullPointerException if the method name is null * @throws IllegalArgumentException if the paramTypes and args don't match * @see InvokerTransformer * @see TransformerPredicate @@ -250,7 +250,7 @@ public class PredicateUtils { * @param predicate1 the first predicate, may not be null * @param predicate2 the second predicate, may not be null * @return the <code>and</code> predicate - * @throws IllegalArgumentException if either predicate is null + * @throws NullPointerException if either predicate is null * @see AndPredicate */ public static <T> Predicate<T> andPredicate(final Predicate<? super T> predicate1, @@ -266,8 +266,8 @@ public class PredicateUtils { * @param <T> the type that the predicate queries * @param predicates an array of predicates to check, may not be null * @return the <code>all</code> predicate - * @throws IllegalArgumentException if the predicates array is null - * @throws IllegalArgumentException if any predicate in the array is null + * @throws NullPointerException if the predicates array is null + * @throws NullPointerException if any predicate in the array is null * @see AllPredicate */ public static <T> Predicate<T> allPredicate(final Predicate<? super T>... predicates) { @@ -282,8 +282,8 @@ public class PredicateUtils { * @param <T> the type that the predicate queries * @param predicates a collection of predicates to check, may not be null * @return the <code>all</code> predicate - * @throws IllegalArgumentException if the predicates collection is null - * @throws IllegalArgumentException if any predicate in the collection is null + * @throws NullPointerException if the predicates collection is null + * @throws NullPointerException if any predicate in the collection is null * @see AllPredicate */ public static <T> Predicate<T> allPredicate(final Collection<? extends Predicate<? super T>> predicates) { @@ -298,7 +298,7 @@ public class PredicateUtils { * @param predicate1 the first predicate, may not be null * @param predicate2 the second predicate, may not be null * @return the <code>or</code> predicate - * @throws IllegalArgumentException if either predicate is null + * @throws NullPointerException if either predicate is null * @see OrPredicate */ public static <T> Predicate<T> orPredicate(final Predicate<? super T> predicate1, @@ -314,8 +314,8 @@ public class PredicateUtils { * @param <T> the type that the predicate queries * @param predicates an array of predicates to check, may not be null * @return the <code>any</code> predicate - * @throws IllegalArgumentException if the predicates array is null - * @throws IllegalArgumentException if any predicate in the array is null + * @throws NullPointerException if the predicates array is null + * @throws NullPointerException if any predicate in the array is null * @see AnyPredicate */ public static <T> Predicate<T> anyPredicate(final Predicate<? super T>... predicates) { @@ -330,8 +330,8 @@ public class PredicateUtils { * @param <T> the type that the predicate queries * @param predicates a collection of predicates to check, may not be null * @return the <code>any</code> predicate - * @throws IllegalArgumentException if the predicates collection is null - * @throws IllegalArgumentException if any predicate in the collection is null + * @throws NullPointerException if the predicates collection is null + * @throws NullPointerException if any predicate in the collection is null * @see AnyPredicate */ public static <T> Predicate<T> anyPredicate(final Collection<? extends Predicate<? super T>> predicates) { @@ -346,7 +346,7 @@ public class PredicateUtils { * @param predicate1 the first predicate, may not be null * @param predicate2 the second predicate, may not be null * @return the <code>either</code> predicate - * @throws IllegalArgumentException if either predicate is null + * @throws NullPointerException if either predicate is null * @see OnePredicate */ public static <T> Predicate<T> eitherPredicate(final Predicate<? super T> predicate1, @@ -364,8 +364,8 @@ public class PredicateUtils { * @param <T> the type that the predicate queries * @param predicates an array of predicates to check, may not be null * @return the <code>one</code> predicate - * @throws IllegalArgumentException if the predicates array is null - * @throws IllegalArgumentException if any predicate in the array is null + * @throws NullPointerException if the predicates array is null + * @throws NullPointerException if any predicate in the array is null * @see OnePredicate */ public static <T> Predicate<T> onePredicate(final Predicate<? super T>... predicates) { @@ -380,8 +380,8 @@ public class PredicateUtils { * @param <T> the type that the predicate queries * @param predicates a collection of predicates to check, may not be null * @return the <code>one</code> predicate - * @throws IllegalArgumentException if the predicates collection is null - * @throws IllegalArgumentException if any predicate in the collection is null + * @throws NullPointerException if the predicates collection is null + * @throws NullPointerException if any predicate in the collection is null * @see OnePredicate */ public static <T> Predicate<T> onePredicate(final Collection<? extends Predicate<? super T>> predicates) { @@ -396,7 +396,7 @@ public class PredicateUtils { * @param predicate1 the first predicate, may not be null * @param predicate2 the second predicate, may not be null * @return the <code>neither</code> predicate - * @throws IllegalArgumentException if either predicate is null + * @throws NullPointerException if either predicate is null * @see NonePredicate */ public static <T> Predicate<T> neitherPredicate(final Predicate<? super T> predicate1, @@ -414,8 +414,8 @@ public class PredicateUtils { * @param <T> the type that the predicate queries * @param predicates an array of predicates to check, may not be null * @return the <code>none</code> predicate - * @throws IllegalArgumentException if the predicates array is null - * @throws IllegalArgumentException if any predicate in the array is null + * @throws NullPointerException if the predicates array is null + * @throws NullPointerException if any predicate in the array is null * @see NonePredicate */ public static <T> Predicate<T> nonePredicate(final Predicate<? super T>... predicates) { @@ -430,8 +430,8 @@ public class PredicateUtils { * @param <T> the type that the predicate queries * @param predicates a collection of predicates to check, may not be null * @return the <code>none</code> predicate - * @throws IllegalArgumentException if the predicates collection is null - * @throws IllegalArgumentException if any predicate in the collection is null + * @throws NullPointerException if the predicates collection is null + * @throws NullPointerException if any predicate in the collection is null * @see NonePredicate */ public static <T> Predicate<T> nonePredicate(final Collection<? extends Predicate<? super T>> predicates) { @@ -445,7 +445,7 @@ public class PredicateUtils { * @param <T> the type that the predicate queries * @param predicate the predicate to not * @return the <code>not</code> predicate - * @throws IllegalArgumentException if the predicate is null + * @throws NullPointerException if the predicate is null * @see NotPredicate */ public static <T> Predicate<T> notPredicate(final Predicate<? super T> predicate) { @@ -463,7 +463,7 @@ public class PredicateUtils { * @param <T> the type that the predicate queries * @param transformer the transformer to wrap, may not be null * @return the transformer wrapping predicate - * @throws IllegalArgumentException if the transformer is null + * @throws NullPointerException if the transformer is null * @see TransformerPredicate */ public static <T> Predicate<T> asPredicate(final Transformer<? super T, Boolean> transformer) { @@ -481,7 +481,7 @@ public class PredicateUtils { * @param <T> the type that the predicate queries * @param predicate the predicate to wrap, may not be null * @return the predicate - * @throws IllegalArgumentException if the predicate is null. + * @throws NullPointerException if the predicate is null. * @see NullIsExceptionPredicate */ public static <T> Predicate<T> nullIsExceptionPredicate(final Predicate<? super T> predicate){ @@ -496,7 +496,7 @@ public class PredicateUtils { * @param <T> the type that the predicate queries * @param predicate the predicate to wrap, may not be null * @return the predicate - * @throws IllegalArgumentException if the predicate is null. + * @throws NullPointerException if the predicate is null. * @see NullIsFalsePredicate */ public static <T> Predicate<T> nullIsFalsePredicate(final Predicate<? super T> predicate){ @@ -511,7 +511,7 @@ public class PredicateUtils { * @param <T> the type that the predicate queries * @param predicate the predicate to wrap, may not be null * @return the predicate - * @throws IllegalArgumentException if the predicate is null. + * @throws NullPointerException if the predicate is null. * @see NullIsTruePredicate */ public static <T> Predicate<T> nullIsTruePredicate(final Predicate<? super T> predicate){ @@ -528,7 +528,7 @@ public class PredicateUtils { * @param transformer the transformer to call first * @param predicate the predicate to call with the result of the transform * @return the predicate - * @throws IllegalArgumentException if the transformer or the predicate is null + * @throws NullPointerException if the transformer or the predicate is null * @see TransformedPredicate * @since 3.1 */ Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/QueueUtils.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/QueueUtils.java?rev=1686855&r1=1686854&r2=1686855&view=diff ============================================================================== --- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/QueueUtils.java (original) +++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/QueueUtils.java Mon Jun 22 13:00:27 2015 @@ -50,7 +50,7 @@ public class QueueUtils { * @param <E> the type of the elements in the queue * @param queue the queue to make unmodifiable, must not be null * @return an unmodifiable queue backed by that queue - * @throws IllegalArgumentException if the Queue is null + * @throws NullPointerException if the queue is null */ public static <E> Queue<E> unmodifiableQueue(final Queue<? extends E> queue) { return UnmodifiableQueue.unmodifiableQueue(queue); @@ -68,7 +68,7 @@ public class QueueUtils { * @param queue the queue to predicate, must not be null * @param predicate the predicate used to evaluate new elements, must not be null * @return a predicated queue - * @throws IllegalArgumentException if the Queue or Predicate is null + * @throws NullPointerException if the queue or predicate is null */ public static <E> Queue<E> predicatedQueue(final Queue<E> queue, final Predicate<? super E> predicate) { return PredicatedQueue.predicatedQueue(queue, predicate); @@ -88,7 +88,7 @@ public class QueueUtils { * @param queue the queue to predicate, must not be null * @param transformer the transformer for the queue, must not be null * @return a transformed queue backed by the given queue - * @throws IllegalArgumentException if the Queue or Transformer is null + * @throws NullPointerException if the queue or transformer is null */ public static <E> Queue<E> transformingQueue(final Queue<E> queue, final Transformer<? super E, ? extends E> transformer) { Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/SetUtils.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/SetUtils.java?rev=1686855&r1=1686854&r2=1686855&view=diff ============================================================================== --- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/SetUtils.java (original) +++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/SetUtils.java Mon Jun 22 13:00:27 2015 @@ -202,7 +202,7 @@ public class SetUtils { * @param <E> the element type * @param set the set to synchronize, must not be null * @return a synchronized set backed by the given set - * @throws IllegalArgumentException if the set is null + * @throws NullPointerException if the set is null */ public static <E> Set<E> synchronizedSet(final Set<E> set) { return Collections.synchronizedSet(set); @@ -216,7 +216,7 @@ public class SetUtils { * @param <E> the element type * @param set the set to make unmodifiable, must not be null * @return an unmodifiable set backed by the given set - * @throws IllegalArgumentException if the set is null + * @throws NullPointerException if the set is null */ public static <E> Set<E> unmodifiableSet(final Set<? extends E> set) { return UnmodifiableSet.unmodifiableSet(set); @@ -234,7 +234,7 @@ public class SetUtils { * @param set the set to predicate, must not be null * @param predicate the predicate for the set, must not be null * @return a predicated set backed by the given set - * @throws IllegalArgumentException if the Set or Predicate is null + * @throws NullPointerException if the set or predicate is null */ public static <E> Set<E> predicatedSet(final Set<E> set, final Predicate<? super E> predicate) { return PredicatedSet.predicatedSet(set, predicate); @@ -254,7 +254,7 @@ public class SetUtils { * @param set the set to transform, must not be null * @param transformer the transformer for the set, must not be null * @return a transformed set backed by the given set - * @throws IllegalArgumentException if the Set or Transformer is null + * @throws NullPointerException if the set or transformer is null */ public static <E> Set<E> transformedSet(final Set<E> set, final Transformer<? super E, ? extends E> transformer) { @@ -271,7 +271,7 @@ public class SetUtils { * @param <E> the element type * @param set the set to order, must not be null * @return an ordered set backed by the given set - * @throws IllegalArgumentException if the Set is null + * @throws NullPointerException if the set is null */ public static <E> Set<E> orderedSet(final Set<E> set) { return ListOrderedSet.listOrderedSet(set); @@ -300,7 +300,7 @@ public class SetUtils { * @param <E> the element type * @param set the sorted set to synchronize, must not be null * @return a synchronized set backed by the given set - * @throws IllegalArgumentException if the set is null + * @throws NullPointerException if the set is null */ public static <E> SortedSet<E> synchronizedSortedSet(final SortedSet<E> set) { return Collections.synchronizedSortedSet(set); @@ -314,7 +314,7 @@ public class SetUtils { * @param <E> the element type * @param set the sorted set to make unmodifiable, must not be null * @return an unmodifiable set backed by the given set - * @throws IllegalArgumentException if the set is null + * @throws NullPointerException if the set is null */ public static <E> SortedSet<E> unmodifiableSortedSet(final SortedSet<E> set) { return UnmodifiableSortedSet.unmodifiableSortedSet(set); @@ -332,7 +332,7 @@ public class SetUtils { * @param set the sorted set to predicate, must not be null * @param predicate the predicate for the sorted set, must not be null * @return a predicated sorted set backed by the given sorted set - * @throws IllegalArgumentException if the Set or Predicate is null + * @throws NullPointerException if the set or predicate is null */ public static <E> SortedSet<E> predicatedSortedSet(final SortedSet<E> set, final Predicate<? super E> predicate) { @@ -353,7 +353,7 @@ public class SetUtils { * @param set the set to transform, must not be null * @param transformer the transformer for the set, must not be null * @return a transformed set backed by the given set - * @throws IllegalArgumentException if the Set or Transformer is null + * @throws NullPointerException if the set or transformer is null */ public static <E> SortedSet<E> transformedSortedSet(final SortedSet<E> set, final Transformer<? super E, ? extends E> transformer) { @@ -370,7 +370,7 @@ public class SetUtils { * @param <E> the element type * @param set the navigable set to make unmodifiable, must not be null * @return an unmodifiable set backed by the given set - * @throws IllegalArgumentException if the set is null + * @throws NullPointerException if the set is null * @since 4.1 */ public static <E> SortedSet<E> unmodifiableNavigableSet(final NavigableSet<E> set) { @@ -389,7 +389,7 @@ public class SetUtils { * @param set the navigable set to predicate, must not be null * @param predicate the predicate for the navigable set, must not be null * @return a predicated navigable set backed by the given navigable set - * @throws IllegalArgumentException if the Set or Predicate is null + * @throws NullPointerException if the set or predicate is null * @since 4.1 */ public static <E> SortedSet<E> predicatedNavigableSet(final NavigableSet<E> set, @@ -411,7 +411,7 @@ public class SetUtils { * @param set the navigable set to transform, must not be null * @param transformer the transformer for the set, must not be null * @return a transformed set backed by the given set - * @throws IllegalArgumentException if the Set or Transformer is null + * @throws NullPointerException if the set or transformer is null * @since 4.1 */ public static <E> SortedSet<E> transformedNavigableSet(final NavigableSet<E> set,