Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3590

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

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.6
    • 1.6.4, 1.7-beta-1
    • groovy-jdk
    • None
    • 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).

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            roshandawrani Roshan Dawrani
            paulcz Paul Czyzewski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment