Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 188583

Summary: [msn] Msn retrieve Buddy List error
Product: [RT] ECF Reporter: Cui Zihui <cuizihui>
Component: ecf.protocolsAssignee: Remy Suen <remy.suen>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ccalli, slewis
Version: 1.0.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch to force the usage of UTF-8 as an encoding. none

Description Cui Zihui CLA 2007-05-23 04:10:41 EDT
I use ecf msn protocol org.eclipse.ecf.protocol.msn_0.3.1.200705231606.jar.
The Exception:
java.lang.ArrayIndexOutOfBoundsException: 5
	at org.eclipse.ecf.protocol.msn.NotificationSession.retrieveBuddyList(NotificationSession.java:164)
	at org.eclipse.ecf.protocol.msn.NotificationSession.login(NotificationSession.java:114)
	at org.eclipse.ecf.protocol.msn.MsnClient.connect(MsnClient.java:147)
	at org.eclipse.ecf.internal.provider.msn.MSNContainer.connect(MSNContainer.java:299)
	at imclient.connect.XIMClient.createAndConnectClient(XIMClient.java:104)
	at imclient.connect.URIClientConnectControl$ClientConnectJob.run(URIClientConnectControl.java:75)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

I debug the parameter input value is: LST N=stonewang888@hotmail.com F=stone-感应守护ç¥&#65533;C=7f646cbf-7a6b-437c-8b1e-3b0a0a55f153 11.
The F is Chinese. Then F and C not space.
Comment 1 Remy Suen CLA 2007-05-23 07:00:57 EDT
Are you consistently getting this? From the user-contributed specification, there shouldn't be a semi-colon between the F and C parameters in the command you provided.

See http://msnpiki.msnfanatic.com/index.php/Command:LST
Comment 2 Scott Lewis CLA 2007-05-30 18:42:27 EDT
Is this not a bug?  Cuizhui please let us know about a response to question in comment #1.  

In the mean time, I'm moving to version 1.0.1.
Comment 3 Scott Lewis CLA 2007-07-19 03:10:59 EDT
cuizihui can we get your input on with respect to comment #1?
Comment 4 Cui Zihui CLA 2007-07-24 21:45:40 EDT
(In reply to comment #3)
> cuizihui can we get your input on with respect to comment #1?

This problem still exists.
If change org.eclipse.ecf.protocol.msn.NotificationSession line 128:
BufferedReader reader = new BufferedReader(new InputStreamReader(getInputStream()));
to
BufferedReader reader = new BufferedReader(new InputStreamReader(getInputStream(),"UTF-8"));
then not problem.
Comment 5 Remy Suen CLA 2007-07-24 21:48:34 EDT
(In reply to comment #4)
> This problem still exists.
> If change org.eclipse.ecf.protocol.msn.NotificationSession line 128:
> BufferedReader reader = new BufferedReader(new
> InputStreamReader(getInputStream()));
> to
> BufferedReader reader = new BufferedReader(new
> InputStreamReader(getInputStream(),"UTF-8"));
> then not problem.

Interesting. Care to supply a patch?
Comment 6 Cagatay Calli CLA 2007-07-27 18:44:56 EDT
This problem occurs because of looking for a message in every output of a read() call and sometimes leave message fragments behind. There's not a structure to combine the remaining parts of these reads after it is split into message pieces and processed. When you examine read() calls, you'll observe that the implementation tries to read incomplete messages and this makes it throw different kinds of exception. 

Probably, this case not only causes this "retrieve buddy list" error but also other failures in messaging.

I'm investigating this and hopefully produce a patch in 2-3 days. 
Comment 7 Remy Suen CLA 2007-11-16 18:47:37 EST
Created attachment 83137 [details]
Patch to force the usage of UTF-8 as an encoding.
Comment 8 Remy Suen CLA 2007-11-16 18:49:47 EST
The patch has been committed to CVS HEAD. Setting as RESOLVED/FIXED.

(In reply to comment #6)
> This problem occurs because of looking for a message in every output of a
> read() call and sometimes leave message fragments behind. There's not a
> structure to combine the remaining parts of these reads after it is split into
> message pieces and processed. When you examine read() calls, you'll observe
> that the implementation tries to read incomplete messages and this makes it
> throw different kinds of exception.

This issue is being covered by 207677.
Comment 9 Scott Lewis CLA 2008-05-18 19:08:07 EDT
closing.