gMale
gMale

Reputation: 17895

Fields are mismatched when passing object from Java to Flex, how do I fix it?

We have a pretty big application with lots of objects being passed between flex and java. One object in particular has a subtle bug:

It's a plain old java object being passed to the flex front end (using blazeds producer/consumer messaging). The POJO has two String properties such as:

myShirt.color = "brown";
myShirt.description = "winter shirt with 3 buttons";

when I get the object on the frontend, in Flex, the value object's properties are swapped, as in:

myShirt.color = "winter shirt with 3 buttons";
myShirt.description = "brown";

Clearly, this is some type of confusion blazeds is having when the objects are serialized/deserialized. Since they are both Strings, it seems something is getting confused when reading/writing the objects.

Both objects exactly mirror each other with parameters and methods in the same order in the files with the same names.

How do I correct the serialization, preferably without having to handle it on my own?

Thanks in advance for any suggestions.

Upvotes: 1

Views: 274

Answers (1)

Mike Baranczak
Mike Baranczak

Reputation: 8374

I bet it's just a really simple error in your code (those can be the hardest to find). Maybe something like:

public void setColor(String s) {
    this.description = s;
}

Or:

System.out.println("description: "+myShirt.color);

If the above didn't help, try changing the name of one (or both) of the properties that are getting switched, and see what happens.

Upvotes: 2

Related Questions