Grails 2.0.1: Bug in map to domain instance binding during constructor invocation ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Grails 2.0.1: Bug in map to domain instance binding during constructor invocation ?

Roshan Dawrani
Hi,

I am observing some behavior that looks like a bug in map-to-domain-instance binding logic used when a constructor is invoked with named arguments.

My domain class looks like this:

---------------------------
class Book {
byte[] token
}
---------------------------

and my unit test looks like this:
---------------------------
    void testSomething() {
def b1 = new Book(token: 1..32) // this incorrectly gets set through the domain instance binding logic - [49, 46, 46, 51, 50]
def b2 = new Book()
b2.token = 1..32 // this correctly gets set as a byte array - [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]
    }
---------------------------

Can someone confirm please?

--
Roshan
Reply | Threaded
Open this post in threaded view
|

Re: Grails 2.0.1: Bug in map to domain instance binding during constructor invocation ?

Fran García
I can confirm that and it is driving me crazy. I am going to write a bug with the less code posible to the Grails team.
What doesn't kill you, makes you stronger
Reply | Threaded
Open this post in threaded view
|

Re: Grails 2.0.1: Bug in map to domain instance binding during constructor invocation ?

Roshan Dawrani
On Mon, Apr 2, 2012 at 1:56 PM, Fran García <[hidden email]> wrote:
I can confirm that and it is driving me crazy. I am going to write a bug with
the less code posible to the Grails team.

Hi,

Since it looked like a clear-cut bug to me, I filed http://jira.grails.org/browse/GRAILS-8957 already. 

You can probably attach your example to the issue as well and track it for further progress.

Cheers.

--
Roshan