Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0, 3.1, 3.2
-
Platform independent
Description
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".