
merapi - issue #1
The message length sent from Java Bridge and read from ActionScript Bridge is consistent.
This bug cause various types of unexpected behaviors:
What steps will reproduce the problem? 1. Print the byte array size (code "bytes.length") from the Java Bridge class inthe method sendMessage(...) 2. In the ActionScript Bridge, print the readed __totalBytes after the line "__totalBytes = __client.readByte();"
What is the expected output? What do you see instead? Expected: The __totalBytes variable in ActionScript should have the same value of "bytes.length" in Java.
Get: A different value.
Cause: This happens because the byte array length is write in raw mode on the socket to the ActionScript bridge, but the "__client.readByte();" requires that the byte is write in AMF3 encoding.
Using an Amf3Output class to convert the byte array length in AMF3 using writeInt(...) in Java Bridge writing the relative encoded byte array and reading the "__totalBytes" using readInt() in ActionScript Bridge fix the problem.
Comment #1
Posted on May 22, 2009 by Happy OxSorry, the right summary should be "The message length sent from Java Bridge and read from ActionScript Bridge is NOT consistent."
Comment #2
Posted on Jun 4, 2009 by Swift Monkey(No comment was entered for this change.)
Comment #3
Posted on Jun 12, 2009 by Grumpy GiraffeCan you please brief me on how to send objects via merapi??
Comment #4
Posted on Jun 12, 2009 by Happy OxThere are the Bridge classes with the "brute" fix for this issue. The ActionScript fix is simple (row 444: used readInt instead of readByte). The Java fix is more complex (rows from 237 to 249: used an Amf3Output class to encode the byte array length of the message on the socket).
Bye. Luca De Petrillo
- Bridge.java 10.31KB
- Bridge.as 17.67KB
Comment #5
Posted on Jun 12, 2009 by Grumpy GiraffeSorry. My doubt was regarding sending an array or any other object from java to flex (and vice versa) via merapi. If you have a sample code for the same that will be great !!
Thanks in advance
Comment #6
Posted on Jun 12, 2009 by Happy OxTo pass other data, you must define a new class that extends the Message class of merapi both in Java and ActionScript, adding your custom fields. This way, the conversion should happen like in BlazeDS.
Comment #7
Posted on Jun 12, 2009 by Swift MonkeyPlease consider using the Google group for questions about using the framework:
http://groups.google.com/group/merapi-project
This issues section is for reporting bugs or enhancements.
thanks -adam
Comment #8
Posted on Jul 31, 2009 by Swift ElephantIs the brute fix by lukakama stable as I don't see it being used(neither in the trunk version nor in the branch version of Bridge.java) .
And in case it is not then what is the solution for this bug?
Comment #9
Posted on Sep 9, 2009 by Swift MonkeyThis is fixed in the branch now.
Status: Fixed