[jira] [Created] (COLLECTIONS-402) Inconsistent Javadoc comment and code in intersection(List list1,List list2)in org.apache.commons.collections.ListUtils

2012-03-29 Thread SHIN HWEI TAN (Created) (JIRA)
Inconsistent Javadoc comment and code in intersection(List list1,List list2)in 
org.apache.commons.collections.ListUtils
---

 Key: COLLECTIONS-402
 URL: https://issues.apache.org/jira/browse/COLLECTIONS-402
 Project: Commons Collections
  Issue Type: Bug
  Components: Collection
Affects Versions: 3.2.1
 Environment: Platform Independent 
Reporter: SHIN HWEI TAN
 Fix For: 4.0


The Javadoc comment below states that the method "throws NullPointerException 
if either list is null". 
 /*..
 * 
 * @throws NullPointerException if either list is null
 */
public static List intersection(final List list1, final List list2)
..
}
However, when called with a null list1 and an empty list2(i.e., 
"intersection((List)null, new ArrayList())"), the method executes normally 
without throwing any exception.

Suggested Fixes:
1. Add code "if (list1 == null) throw NullPointerException();" at the beginning 
of the method body.
or
2. Remove "@throws NullPointerException if either list is null" from the 
Javadoc.
or
3. Change "@throws NullPointerException if either list is null" to "@throws 
NullPointerException if list2 is null or (the list2 is non-empty and the list1 
is null)".


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Created] (COLLECTIONS-401) Inconsistent Javadoc comment and code in removeAll(Collection, Collection) in org.apache.commons.collections.ListUtils

2012-03-29 Thread SHIN HWEI TAN (Created) (JIRA)
Inconsistent Javadoc comment and code in removeAll(Collection, 
Collection) in org.apache.commons.collections.ListUtils


 Key: COLLECTIONS-401
 URL: https://issues.apache.org/jira/browse/COLLECTIONS-401
 Project: Commons Collections
  Issue Type: Bug
  Components: Collection
Affects Versions: 3.2.1
Reporter: SHIN HWEI TAN


The Javadoc comment below states that the method "throws NullPointerException 
if either parameter is null". 
 /*..
 * 
 * @throws NullPointerException if either parameter is null
 */
public static  List removeAll(Collection collection, 
Collection remove) {
..
}
However, when called with two null collections (i.e., 
"removeAll((Collection)null, (Collection)null)"), the method executes normally 
without throwing any exception.

Suggested Fixes:
1. Add code "if (collection == null) throw NullPointerException();" at the 
beginning of the method body.
or
2. Remove "@throws NullPointerException if either parameter is null" from the 
Javadoc.
or
3. Change "@throws NullPointerException if either parameter is null" to 
"@throws NullPointerException if the first collection is null or (the first 
collection is non-empty and the second collection is null)".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Created] (COLLECTIONS-400) Inconsistent Javadoc comment and code in addIgnoreNull(Collection, T) in org.apache.commons.collections.CollectionUtils

2012-03-29 Thread SHIN HWEI TAN (Created) (JIRA)
Inconsistent Javadoc comment and code in addIgnoreNull(Collection, T) in 
org.apache.commons.collections.CollectionUtils
--

 Key: COLLECTIONS-400
 URL: https://issues.apache.org/jira/browse/COLLECTIONS-400
 Project: Commons Collections
  Issue Type: Bug
  Components: Collection
Affects Versions: 3.2.1
 Environment: Platform independent
Reporter: SHIN HWEI TAN


The Javadoc comment below states that the method "throws NullPointerException 
if the collection is null". 
/**
   .
 * @param collection  the collection to add to, must not be null
 * @param object  the object to add, if null it will not be added
 * @return true if the collection changed
 * @throws NullPointerException if the collection is null
 */
public static  boolean addIgnoreNull(Collection collection, T 
object) {
return (object != null && collection.add(object));
}
However, when called with an null collection and a null object (i.e., 
"addIgnoreNull((Collection)null, null)"), the method executes normally without 
throwing any exception.

Suggested Fixes:
1. Add code "if (collection == null) throw NullPointerException();" at the 
beginning of the method body.
or
2. Remove "@throws NullPointerException if the collection is null" from the 
Javadoc.
or
3. Change "@throws NullPointerException if the collection is null" to "@throws 
NullPointerException if the collection is null and the object is non-null)".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Created] (COLLECTIONS-391) Inconsistent Javadoc comment and code for toProperties(final Map) in org.apache.commons.collections.MapUtils

2012-01-08 Thread SHIN HWEI TAN (Created) (JIRA)
Inconsistent Javadoc comment and code for toProperties(final Map) in 
org.apache.commons.collections.MapUtils
--

 Key: COLLECTIONS-391
 URL: https://issues.apache.org/jira/browse/COLLECTIONS-391
 Project: Commons Collections
  Issue Type: Bug
  Components: Collection
Affects Versions: 4.0, 4.x
 Environment: Platform Indepedent
Reporter: SHIN HWEI TAN


The Javadoc comment below states that the parameter map "..., may not be null":
   /**
..
 * @param map  the map to convert to a Properties object, may not 
be null
 * @return the properties object
 */
public static  Properties toProperties(final Map map) {
Properties answer = new Properties();
if (map != null) {
...
}
return answer;
}
However, the method return normally without throwing any exception when called 
with null.

Suggested Fixes:
1. Change "@param map  the map to convert to a Properties object, may not be 
null" to "@param map  the map to convert to a Properties object, may be null"
or
2. Remove "may not be null" from @param.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Created] (COLLECTIONS-389) Inconsistent Javadoc comment and code for mapTransformer(Map) in org.apache.commons.collections.TransformerUtils

2012-01-08 Thread SHIN HWEI TAN (Created) (JIRA)
Inconsistent Javadoc comment and code for mapTransformer(Map) in org.apache.commons.collections.TransformerUtils


 Key: COLLECTIONS-389
 URL: https://issues.apache.org/jira/browse/COLLECTIONS-389
 Project: Commons Collections
  Issue Type: Bug
  Components: Collection
Affects Versions: 4.0, 4.x
 Environment: Platform Independent
Reporter: SHIN HWEI TAN


The Javadoc comment below states that the method "throws 
IllegalArgumentException if the map is null":
/** 
 
 * @param map  the map to use to transform the objects
 * @return the transformer
 * @throws IllegalArgumentException if the map is null
 */
public static  Transformer mapTransformer(Map map) {
return MapTransformer.mapTransformer(map);
}
However, the method returns a NULL_INSTANCE object instead of throwing 
IllegalArgumentException when called with null.

Suggested Fixes:
1. Change "@throws IllegalArgumentException if the map is null" and "@return" 
to "@return NULL_INSTANCE if the map is null".
or
2. Remove the entire "throws IllegalArgumentException if the map is null".


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Created] (COLLECTIONS-390) Inconsistent Javadoc comment and code for mapTransformer(Map) in org.apache.commons.collections.TransformerUtils

2012-01-08 Thread SHIN HWEI TAN (Created) (JIRA)
Inconsistent Javadoc comment and code for mapTransformer(Map) in org.apache.commons.collections.TransformerUtils


 Key: COLLECTIONS-390
 URL: https://issues.apache.org/jira/browse/COLLECTIONS-390
 Project: Commons Collections
  Issue Type: Bug
  Components: Buffer
Affects Versions: 4.0-beta-1, 4.0
 Environment: Platform Independent
Reporter: SHIN HWEI TAN


The Javadoc comment below states that the method "throws 
IllegalArgumentException if the map is null":
/** 
 
 * @param map  the map to use to transform the objects
 * @return the transformer
 * @throws IllegalArgumentException if the map is null
 */
public static  Transformer mapTransformer(Map map) {
return MapTransformer.mapTransformer(map);
}
However, the method returns a NULL_INSTANCE object instead of throwing 
IllegalArgumentException when called with null.

Suggested Fixes:
1. Change "@throws IllegalArgumentException if the map is null" and "@return" 
to "@return NULL_INSTANCE if the map is null".
or
2. Remove the entire "throws IllegalArgumentException if the map is null".


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Created] (COLLECTIONS-388) Inconsistent Javadoc comment and code for prototypeFactory(T) in org.apache.commons.collections.FactoryUtils

2012-01-08 Thread SHIN HWEI TAN (Created) (JIRA)
Inconsistent Javadoc comment and code for prototypeFactory(T) in 
org.apache.commons.collections.FactoryUtils


 Key: COLLECTIONS-388
 URL: https://issues.apache.org/jira/browse/COLLECTIONS-388
 Project: Commons Collections
  Issue Type: Bug
  Components: Collection
Affects Versions: 4.0, 4.x
 Environment: Platform independent
Reporter: SHIN HWEI TAN


The Javadoc comment below states that the method "throws 
IllegalArgumentException if the prototype is null":
/**  
 ..
 * @param prototype  the object to clone each time in the factory
 * @return the prototype factory
 * @throws IllegalArgumentException if the prototype is null
 * @throws IllegalArgumentException if the prototype cannot be 
cloned
 */
public static  Factory prototypeFactory(T  prototype) {
return PrototypeFactory.prototypeFactory(prototype);
}

However, the method returns a NULL_INSTANCE object instead of throwing 
IllegalArgumentException when called with null.

Suggested Fixes:
1. Change "@throws IllegalArgumentException if the prototype is null" and 
"@return" to "@return NULL_INSTANCE if the prototype is null".
or
2. Remove the entire "throws IllegalArgumentException if the prototype is null".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Created] (COLLECTIONS-385) Inconsistent Javadoc comment and code in addAll(Collection, Object[]) in org.apache.commons.collections.CollectionUtils

2011-10-26 Thread SHIN HWEI TAN (Created) (JIRA)
Inconsistent Javadoc comment and code in addAll(Collection, Object[]) in 
org.apache.commons.collections.CollectionUtils
---

 Key: COLLECTIONS-385
 URL: https://issues.apache.org/jira/browse/COLLECTIONS-385
 Project: Commons Collections
  Issue Type: Bug
  Components: Collection
Affects Versions: 3.2, 3.1, 3.0, 2.1.1, 2.1
 Environment: Platform Independent
Reporter: SHIN HWEI TAN
Priority: Minor


The Javadoc comment below states that the method "throws NullPointerException 
if the collection or array is null". 
/** 
 * Adds all elements in the array to the given collection.
 * 
 * @param collection  the collection to add to, must not be null
 * @param elements  the array of elements to add, must not be null
 * @throws NullPointerException if the collection or array is null
 */
public static void addAll(Collection collection, Object[] elements) {
for (int i = 0, size = elements.length; i < size; i++) {
collection.add(elements[i]);
}
}

However, when called with an empty array and a null collection (i.e., 
"addAll((Collection)null, new Object[])"), the method executes normally without 
throwing any exception.

Suggested Fixes:
1. Add code "if (collection == null) throw NullPointerException();" at the 
beginning of the method body.
or
2. Remove "@throws NullPointerException if the collection or array is null" 
from the Javadoc.
or
3. Change "@throws NullPointerException if the collection or array is null" to 
"@throws NullPointerException if the array is null or (the array is non-empty 
and the collection is null)".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Created] (COLLECTIONS-384) Inconsistent Javadoc comment and code for synchronizedMap(Map) in org.apache.commons.collections.MapUtils

2011-10-26 Thread SHIN HWEI TAN (Created) (JIRA)
Inconsistent Javadoc comment and code for synchronizedMap(Map) in 
org.apache.commons.collections.MapUtils
-

 Key: COLLECTIONS-384
 URL: https://issues.apache.org/jira/browse/COLLECTIONS-384
 Project: Commons Collections
  Issue Type: Bug
  Components: Collection
Affects Versions: 3.2, 3.1, 3.0
 Environment: Platform independent
Reporter: SHIN HWEI TAN
Priority: Minor


The Javadoc comment below states that the method "throws 
IllegalArgumentException if the map is null":
/**
 ...
 * @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
 */
public static Map synchronizedMap(Map map) {
return Collections.synchronizedMap(map);
}

However, the method throws NullPointerException instead of 
IllegalArgumentException when called with null.

Suggested Fixes:
1. Add code "if (map == null) throw IllegalArgumentException();" at the 
beginning of the method body.
or
2. Change "@throws IllegalArgumentException  if the map is null" to "@throws 
NullPointerException  if the map is null".
or
3. Remove the entire "@throws IllegalArgumentException  if the map is null".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira