Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 507719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:50:00+00:00 2026-05-13T06:50:00+00:00

why does this throw an exception? messageSource.getMessage(‘UserService.msg.forgot.unknown’, [test@mail.com], null) unless I do this… def

  • 0

why does this throw an exception?

messageSource.getMessage('UserService.msg.forgot.unknown', ["test@mail.com"], null) 

unless I do this…

def Object[] args = ["test@mail.com"]
messageSource.getMessage('UserService.msg.forgot.unknown', args, null) 
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:50:00+00:00Added an answer on May 13, 2026 at 6:50 am

    Because [“test@mail.com”] evaluates to an ArrayList, not an array:

    groovy:000> o = ["asdf"]
    ===> [asdf]
    groovy:000> o.getClass()
    ===> class java.util.ArrayList
    

    OTOH your declaration creates an array of Objects:

    groovy:000>  Object[] args = ["asdf"]
    ===> [Ljava.lang.Object;@14e113b
    

    and the method you’re calling needs an array. You can create an array using as:

    Object[] args = ["asdf"] as Object[]
    

    The Groovy creators made a point of making higher-level data structures like lists idiomatic, while arrays are present for interoperability with Java.

    In his interview in Coders at Work Guy Steele talks about choices made in designing a language:

    “There’s this Huffman encoding problem. If you make something concise,
    something is going to have to be more verbose as a consequence. So in
    designing a language, one of the things you think about is, ‘What are
    the things I want to make very easy to say and very easy to get
    right?’ But with the understanding that, having used up characters or
    symbols for that purpose, you’re going to have to make something else
    a little bit harder to say.”

    It certainly looks like Groovy made lists more concise, with the side effect that arrays became more verbose.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://jsbin.com/ifabem/2/edit use strict; window.x = Hello World; alert(x); // this does't throw an exception
* Simple question : Why does this function throw an exception when evaluated ?
Why does this code throw an Invalid Operation Exception? private SqlCommand cmd; // initialized
Why does the Android system throw this Exception? 05-18 12:33:44.169 W/System.err( 8230): java.io.IOException: Is
why does this code throw an exception? file = file.replaceAll(Pattern.quote(/),File.separator); Message: String index out
Can someone explain me in simple terms, why does this code throw an exception,
Why does this throw NullPointerException public static void main(String[] args) throws Exception { Boolean
Why does this piece of code throw an exception when I try to change
I'm using Selenium 2.20 . Why does WebDriver InternetExplorerDriver throw this warning when launching
This code does not throw an error but the query fails, that is, the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.