All empties "Javascript Array" are converted to "Java List" having the same Instance.

Description

My English is bad thus I give you an example :

//Javascript

var test1 = {
listA : new Array(),
listB : new Array(),
test2 : {
listC : new Array()
}
};
TestController.saveTest1(test1, function(){alert('OK')});

//Java

class Test1 {
private List<A> listA;
private List<B> listB;
private Test2 test2;
...
}
class Test2 {
private List<C> listC;
...
}
class A{...}
class B{...}
class C{...}

class TestController {
public void saveTest1(test1) {
// here test1.listA = test1.listB = test1.test2.listC
// all the lists have the same instance
}
}

Activity

Show:
Mike Wilson
November 10, 2009, 1:52 PM

I've started analyzing and have ruled out the client side. Thus we have a bug in the server side and I'll hunt it down the next few days.

Mike Wilson
November 11, 2009, 2:36 PM

I've checked in a fix for a bug that seems to have affected us in making variables with the same value becoming the same object. David: would you like to take it for a spin to see if it works ok?
The new testdwr project only works for 3.0, so you'll have to run against the old dwr-test project at sourceforge. I don't have it setup at the moment, so if you do it would be great with a test there as well.
Best regards
Mike

Mike Wilson
November 12, 2009, 12:35 AM

I've found some related stuff regarding object identities, so hold off any validations until i test some more.

Mike Wilson
November 12, 2009, 2:07 AM

So, I have now checked in a correction to my first fix, and also fixed a related issue in the client code. Next I'll validate with the old unit test project.

Mike Wilson
November 12, 2009, 3:29 AM

I've now verified with the old dwr-test project. Dwr-test has a number of breaking unit tests before applying my updates (I guess some tests haven't been updated lately), and my updates don't change anything which is good enough for me. I'm resolving this bug now but I'd be happy if someone would take the code for an extra spin .

Assignee

Mike Wilson

Reporter

VANTILLARD

Labels

None

Documentation Required

No

Components

Fix versions

Affects versions

Priority

Minor
Configure