Commons Collections
  1. Commons Collections
  2. COLLECTIONS-389

Inconsistent Javadoc comment and code for mapTransformer(Map<? super I, ? extends O>) in org.apache.commons.collections.TransformerUtils

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0, 4.x
    • Fix Version/s: 4.0-alpha1, 4.0
    • Component/s: Collection
    • Labels:
    • Environment:

      Platform Independent

      Description

      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 <I, O> Transformer<I, O> mapTransformer(Map<? super I, ? extends O> 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".

        Activity

        Hide
        Hudson added a comment -

        Integrated in commons-collections #16 (See https://builds.apache.org/job/commons-collections/16/)
        COLLECTIONS-389 Fixed javadoc, thanks to Shin Hwei Tan. (Revision 1311337)

        Result = SUCCESS
        tn : http://svn.apache.org/viewvc/?view=rev&rev=1311337
        Files :

        • /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/TransformerUtils.java
        Show
        Hudson added a comment - Integrated in commons-collections #16 (See https://builds.apache.org/job/commons-collections/16/ ) COLLECTIONS-389 Fixed javadoc, thanks to Shin Hwei Tan. (Revision 1311337) Result = SUCCESS tn : http://svn.apache.org/viewvc/?view=rev&rev=1311337 Files : /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/TransformerUtils.java
        Hide
        Thomas Neidhart added a comment -

        Thanks for the report. It has been fixed in r1311337.

        I have picked option 1.

        Show
        Thomas Neidhart added a comment - Thanks for the report. It has been fixed in r1311337. I have picked option 1.

          People

          • Assignee:
            Unassigned
            Reporter:
            SHIN HWEI TAN
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 2m
              2m
              Remaining:
              Remaining Estimate - 2m
              2m
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development