Groovy
  1. Groovy
  2. GROOVY-3590

Map.get(key, defaultvalue) doesn't work properly if current value is null.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.6
    • Fix Version/s: 1.6.4, 1.7-beta-1
    • Component/s: groovy-jdk
    • Labels:
      None
    • Environment:
      windows xp
      Groovy Version: 1.6.0 JVM: 1.6.0_05

      Description

      I have a Map, args, which contains a key/value pair 'abcd':null .
      I create an default object and then do the get:

      def default_abcd = new abcd(blah, blah)
      args.get('freq',default_freq)

      Now the value of args.abcd is the new object. However, since the key 'abcd' previously existed and had a value (null), the get() call should have left the value alone (as null).

        Activity

        Paul Czyzewski created issue -
        Hide
        Paul Czyzewski added a comment -

        oops. code lines should read:

        def default_abcd = new abcd(blah, blah)
        args.get('freq',default_abcd)

        Also, I meant to check "no" for 'testcase included'.

        Show
        Paul Czyzewski added a comment - oops. code lines should read: def default_abcd = new abcd(blah, blah) args.get('freq',default_abcd) Also, I meant to check "no" for 'testcase included'.
        Roshan Dawrani made changes -
        Field Original Value New Value
        Assignee Roshan Dawrani [ roshandawrani ]
        Hide
        Roshan Dawrani added a comment -

        Fixed

        Show
        Roshan Dawrani added a comment - Fixed
        Roshan Dawrani made changes -
        Fix Version/s 1.6.4 [ 15291 ]
        Fix Version/s 1.7-beta-1 [ 14014 ]
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Paul King made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12732579 ] Default workflow, editable Closed status [ 12744421 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12970376 ] Default workflow, editable Closed status [ 12978148 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        1d 11h 2m 1 Roshan Dawrani 24/Jun/09 06:55
        Resolved Resolved Closed Closed
        113d 11h 20m 1 Paul King 15/Oct/09 18:16

          People

          • Assignee:
            Roshan Dawrani
            Reporter:
            Paul Czyzewski
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development