ewertonbermejo / merapi

Automatically exported from code.google.com/p/merapi
0 stars 0 forks source link

The message length sent from Java Bridge and read from ActionScript Bridge is consistent. #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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.

Original issue reported on code.google.com by lukak...@gmail.com on 22 May 2009 at 4:06

GoogleCodeExporter commented 8 years ago
Sorry, the right summary should be "The message length sent from Java Bridge 
and read 
from ActionScript Bridge is NOT consistent."

Original comment by lukak...@gmail.com on 22 May 2009 at 4:07

GoogleCodeExporter commented 8 years ago

Original comment by adamfla...@gmail.com on 4 Jun 2009 at 5:40

GoogleCodeExporter commented 8 years ago
Can you please brief me on how to send objects via merapi?? 

Original comment by vembus...@gmail.com on 12 Jun 2009 at 8:12

GoogleCodeExporter commented 8 years ago
There 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

Original comment by lukak...@gmail.com on 12 Jun 2009 at 8:33

Attachments:

GoogleCodeExporter commented 8 years ago
Sorry. 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

Original comment by vembus...@gmail.com on 12 Jun 2009 at 10:28

GoogleCodeExporter commented 8 years ago
To 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.

Original comment by lukak...@gmail.com on 12 Jun 2009 at 11:55

GoogleCodeExporter commented 8 years ago
Please 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

Original comment by adamfla...@gmail.com on 12 Jun 2009 at 3:17

GoogleCodeExporter commented 8 years ago
Is 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?

Original comment by kunjan.a...@gmail.com on 31 Jul 2009 at 11:25

GoogleCodeExporter commented 8 years ago
This is fixed in the branch now.

Original comment by adamfla...@gmail.com on 9 Sep 2009 at 8:00