views:

49

answers:

1

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.

+2  A: 

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.

Mike Baranczak
I doubt it's a simple error unrelated to serializing. Mainly because most of our objects like these are populated from hibernate queries just before being sent over the network. There's little room for typos. However, I will dig back into this problem in the next few days and pray that you are right! Otherwise, it's potentially a nasty bug to fix.
gmale
turned out we were both right. It was, in fact, a really simple error... but it wasn't in our source code, which is far too structured to leave room for a typo. The problem? The person who loads the database transposed the field names in the script they recently wrote to populate the database! It was a data issue: garbage in, garbage out.
gmale
Aha... glad to hear it worked out for you.
Mike Baranczak