yixiaohui12345 / merapi

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

Unable to catch Exception on Flex side when sending message to Java #10

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Make sure Java side Merapi is down
2.Now call the API Bridge.getInstance().sendMessage() putting it in catch 
block with argument Error. (Supposed to be topmost class in Error handling 
hierarchy)
3.The exception is not caught and the applications gives an error warning

What is the expected output? What do you see instead?

We expect the exception to be caught.

What version of the product are you using? On what operating system?
0.1.8,On Windows XP

Please provide any additional information below.

What type of application are you building?
Building an application have to and fro messages in Java and Flex

Original issue reported on code.google.com by ajay.n...@gmail.com on 20 Nov 2009 at 4:02

GoogleCodeExporter commented 9 years ago
Actually with similar steps, I get :
Error #2044: Unhandled IOErrorEvent:. text=Error #2031: Socket Error.
    at merapi::Bridge$/connect()[/Users/adam/dev/os/merapi/pre-os/trunk/flex/merapi-core/src/merapi/Bridge.as:204]
    at merapi::Bridge/sendMessage()[/Users/adam/dev/os/merapi/pre-os/trunk/flex/merapi-core/src/merapi/Bridge.as:366]

An IOErrorEvent is unhandled.  I looked at the source for the connect. The 
problem is that the socket is instantiated with the host and port on sending. 
This triggers automatic connection.  
The recommendation is to instantiate the socket without parameters and then 
call the connect(host,port) on it.  
"Note:  It is strongly advised to use the constructor form without parameters, 
then add any event listeners, then call the connect method with host  and port 
parameters. This sequence guarantees that all event listeners will work 
properly."

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/Soc
ket.html?filter_flex=4.1&filter_flashplayer=10.1&filter_air=2#Socket%28%29

Original comment by AhmadHa...@gmail.com on 8 Nov 2010 at 5:22