I am testing SimpleMsn.java in an simple Google Android application.
It logs in successfully but I only get part of the contact list sometimes and other times it is null.
The following issue is encountered:
- Exception occurred for user@hotmail.com: java.lang.IndexOutOfBoundsException: Invalid location -1, size is 0.
Does anyone know what is the problem?
Many thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First of all I would like to thank you a lot for providing an excellent library for developing MSN instant messenger client.
I have downloaded your library to use in Android Mobile phone platform to develop MSN instant messenger application. I could successfully login to MSN server but I face some problems in getting contacts list. Then I thought there might be problems with the library but to puzzle me more it works perfectly if I use that library in simple Java application running on Windows XP platform.
I checked the forums for help and I could see some one recently facing the same problem but I see nothing has been concluded on this issue. I see in that post that you want to see details logs, so I thought it would good if I could send some more information so that you can investigate the issue further with this information.
Please find attached the logs taken with two applications,
1. Simple java application running on Windows XP platform (Windows_Java_Logs.txt)
2. Android application running on Android platform (Android_Logs.txt)
To describe the issue in brief
-----------------------------------------
(part of Windows_Java_Logs.txt)
......
......
stetesting1@hotmail.de NS >>> SYN 5 0 0
....
....
stetesting1@hotmail.de NS <<< SYN 5 2009-03-25T08:20:21.82-07:00 2009-03-23T07:11:03.207-07:00 2 1
From the above logs I could not understand why server is not properly sending SYN response back to us correctly in Android. Where as in simple Windows XP based java application, the server SYN response is proper and in proper oreder the commands come.
And finally we get Contacts Sync completed event to our listener but this never been happend in Android.
Could you please look into the issue with this information and please help me in resolving this issue?
Please note that it is not possible to set net.sf.jml.level = FINEST as the we can not see loggs produced by 'org.apache.commons.logging.Log' in Android as this does not work in Android. So please let me know if you need more logs, please tell me in which files I should put logs then I will put Android compatible log statements in that files and give you more logs.
Looking forward to hearing from.
P.S.: I had send a separate email to your id to give logs as an attachment.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hum as I can see either you are not using latest svn or you are specifying a protocol version to be used. Am I right ?
You are using protocol version 11 (VER 1 MSNP11). As SYN packet must not be sent for protocol version 13 or greater.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am just using the example given in SimpleMSN.java file, which sets the protocol version to 11. For your information, the JML code I am using is one month old (not the lates).
More information,
I have monitered TCP stream packets on my ethearnet card using Wireshark software.
Surpringly I find that MSN servers are behaving exactly the same for both cases i.e., they are sending correct responses in correct order to both java application in windows XP platform and to Android application on Android platform.
Hum, basic parsing is done in net.sf.jml.net.Session using java.nio.ByteBuffer. Maybe this is not behaving properly. You can put some prints from there to the IncomingSYN to check where is the problem. Thats my guess for now :)
What about running without specifying MSNP11 ? Is it working ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was using a month old code.
Now I have updated to the latest code and I am using the latest trunk code.
If I don't specify the protocol version, it started using protocol version 15 and in Android application now I could not even login but simple java application in windows XP platform works correctly even in this case.
In Android application case why are we failing to send out the command
USR 4 SSO S .........
So from there on there is no communication between us and MSN servers and login process is not completed.
Do you have any idea of why we are failing to send out USR 4 SSO S ..... command to MSN servers?
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Good news, I could now solve the issue of retrieving contact list in Android application also. I have debugged the JML code by putting some logging statements from Session.java file and landed up in MsnMessage.java, where the problem is happening.
The problem occurs during parsing of incoming MSN server commands. For some reasons the command parser fails to correctly parse and put them in event dispatch queue, when we receive commands in bunch. (I see that SYN, GTC, BLP etc etc commands are coming all together and parser is failing to separate them correctly) I debugged further and found the problem at following place,
For some reasons in Android buffer.slice().limit() is not working correctly and it always giving the data from the start of the buffer instead of from the position we set and that's why see always getting SYN command instead of getting next GTC, BTC etc.,
Now all commands SYN, GTC, BLP etc., are correctly extracted and I now I could get the contact list correctly using MSN protocol version 11.
I am not sure whether the above fix is a proper one, please suggest if you get any better idea of fixing the issue.
With the above fix I could now successfully login using MSN protocol version 15 but I see some NULL pointer exception in net.sf.jml.protocol.soap.ContactList.java file and I will now debug this and post you back if I make any good progress with the issue. If you have any idea or hint please let me know, that may help in my debugging.
THANKS A LOT FOR YOUR KIND REPLIES WITH USEFUL HINTS.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
I am testing SimpleMsn.java in an simple Google Android application.
It logs in successfully but I only get part of the contact list sometimes and other times it is null.
The following issue is encountered:
- Exception occurred for user@hotmail.com: java.lang.IndexOutOfBoundsException: Invalid location -1, size is 0.
Does anyone know what is the problem?
Many thanks
Hi,
can you put the logging level to :
net.sf.jml.level = FINEST
and send me the log.
Most probably error in parsing the contact list xml which I haven't met.
damencho
Hi Damencho,
First of all I would like to thank you a lot for providing an excellent library for developing MSN instant messenger client.
I have downloaded your library to use in Android Mobile phone platform to develop MSN instant messenger application. I could successfully login to MSN server but I face some problems in getting contacts list. Then I thought there might be problems with the library but to puzzle me more it works perfectly if I use that library in simple Java application running on Windows XP platform.
I checked the forums for help and I could see some one recently facing the same problem but I see nothing has been concluded on this issue. I see in that post that you want to see details logs, so I thought it would good if I could send some more information so that you can investigate the issue further with this information.
Please find attached the logs taken with two applications,
1. Simple java application running on Windows XP platform (Windows_Java_Logs.txt)
2. Android application running on Android platform (Android_Logs.txt)
To describe the issue in brief
-----------------------------------------
(part of Windows_Java_Logs.txt)
......
......
stetesting1@hotmail.de NS >>> SYN 5 0 0
....
....
stetesting1@hotmail.de NS <<< SYN 5 2009-03-25T08:20:21.82-07:00 2009-03-23T07:11:03.207-07:00 2 1
stetesting1@hotmail.de NS <<< GTC A
stetesting1@hotmail.de NS <<< BLP BL
stetesting1@hotmail.de NS <<< PRP MFN STE
stetesting1@hotmail.de NS <<< PRP MBE N
stetesting1@hotmail.de NS <<< PRP WWE 0
stetesting1@hotmail.de NS <<< LSG Favorites fa12774d-63cb-42fe-bca8-24dfbd9e5a58
stetesting1@hotmail.de NS <<< LST N=stetesting2@hotmail.co.uk F=stetesting2@hotmail.co.uk C=3c695cd9-ff82-4e9d-b0f8-20fd82018374 11
stetesting1@hotmail.de NS <<< LST N=stetesting2@hotmail.de F=stetesting2@hotmail.de C=d1c907ec-1d91-48b5-85c4-bca541f0ebe9 11
stetesting1@hotmail.de NS >>> CHG 6 NLN 1342472236
....
....
(Part of Android_Logs.txt)
.....
.....
stetesting1@hotmail.de NS >>> SYN 5 0 0
....
....
stetesting1@hotmail.de NS <<< SYN 5 2009-03-25T08:20:21.82-07:00 2009-03-23T07:11:03.207-07:00 2 1
stetesting1@hotmail.de NS >>> CHG 6 NLN 1342472236
stetesting1@hotmail.de NS <<< SYN 5
stetesting1@hotmail.de NS <<< SYN 5
stetesting1@hotmail.de NS >>> UUX 7 53
stetesting1@hotmail.de NS <<< SYN 5 2009-
stetesting1@hotmail.de NS <<< SYN 5 200
stetesting1@hotmail.de NS <<< SYN 5 200
stetesting1@hotmail.de NS <<< SYN 5 2009-03-25T08:20:21.82-07:00 2009-03-23T07:1
stetesting1@hotmail.de NS <<< LST N=stetesting2@hotmail.co.uk F=stetesting2@hotmail.co.uk C=3c695cd9-ff82-4e9d-b0f8-20fd82018374 11
stetesting1@hotmail.de NS <<< LST N=stetesting2@hotmail.co.uk F=stetesting2@hotmail.co.uk C=3c695cd9-ff82-4e9d-b0f8-20fd82018
....
....
From the above logs I could not understand why server is not properly sending SYN response back to us correctly in Android. Where as in simple Windows XP based java application, the server SYN response is proper and in proper oreder the commands come.
And finally we get Contacts Sync completed event to our listener but this never been happend in Android.
Could you please look into the issue with this information and please help me in resolving this issue?
Please note that it is not possible to set net.sf.jml.level = FINEST as the we can not see loggs produced by 'org.apache.commons.logging.Log' in Android as this does not work in Android. So please let me know if you need more logs, please tell me in which files I should put logs then I will put Android compatible log statements in that files and give you more logs.
Looking forward to hearing from.
P.S.: I had send a separate email to your id to give logs as an attachment.
Hum as I can see either you are not using latest svn or you are specifying a protocol version to be used. Am I right ?
You are using protocol version 11 (VER 1 MSNP11). As SYN packet must not be sent for protocol version 13 or greater.
Hi Damencho,
I am just using the example given in SimpleMSN.java file, which sets the protocol version to 11. For your information, the JML code I am using is one month old (not the lates).
More information,
I have monitered TCP stream packets on my ethearnet card using Wireshark software.
Surpringly I find that MSN servers are behaving exactly the same for both cases i.e., they are sending correct responses in correct order to both java application in windows XP platform and to Android application on Android platform.
Java application TCP stream
---------------------------
....
....
SYN 5 0 0
SYN 5 2009-03-25T08:20:21.82-07:00 2009-03-23T07:11:03.207-07:00 2 1
GTC A
BLP BL
PRP MFN STE
PRP MBE N
PRP WWE 0
LSG Favorites fa12774d-63cb-42fe-bca8-24dfbd9e5a58
LST N=stetesting2@hotmail.co.uk F=stetesting2@hotmail.co.uk C=3c695cd9-ff82-4e9d-b0f8-20fd82018374 11
LST N=stetesting2@hotmail.de F=stetesting2@hotmail.de C=d1c907ec-1d91-48b5-85c4-bca541f0ebe9 11
CHG 6 NLN 1342472236
MSG Hotmail Hotmail 289
MIME-Version: 1.0
Content-Type: text/x-msmsgsinitialmdatanotification; charset=UTF-8
...
...
Android Application TCP Stream
------------------------------
...
...
SYN 5 0 0
SYN 5 2009-03-25T08:20:21.82-07:00 2009-03-23T07:11:03.207-07:00 2 1
GTC A
BLP BL
PRP MFN STE
PRP MBE N
PRP WWE 0
LSG Favorites fa12774d-63cb-42fe-bca8-24dfbd9e5a58
LST N=stetesting2@hotmail.co.uk F=stetesting2@hotmail.co.uk C=3c695cd9-ff82-4e9d-b0f8-20fd82018374 11
LST N=stetesting2@hotmail.de F=stetesting2@hotmail.de C=d1c907ec-1d91-48b5-85c4-bca541f0ebe9 11
CHG 6 NLN 1342472236
MSG Hotmail Hotmail 289
MIME-Version: 1.0
Content-Type: text/x-msmsgsinitialmdatanotification; charset=UTF-8
....
....
Now then I am not sure why the parser of SYN response gone bad in Android application but not in java application.
I hope this information helps you more in finding the problem.
P.S.: Please excuse me for posting a very long messages but I think more details will help in resolving the issue.
Hum, basic parsing is done in net.sf.jml.net.Session using java.nio.ByteBuffer. Maybe this is not behaving properly. You can put some prints from there to the IncomingSYN to check where is the problem. Thats my guess for now :)
What about running without specifying MSNP11 ? Is it working ?
Hi Damian,
I was using a month old code.
Now I have updated to the latest code and I am using the latest trunk code.
If I don't specify the protocol version, it started using protocol version 15 and in Android application now I could not even login but simple java application in windows XP platform works correctly even in this case.
Java application TCP stream
---------------------------
....
....
VER 1 MSNP15 CVR0
VER 1 MSNP15
CVR 2 0x0409 winnt 5.1 i386 MSNMSGR 8.5.1288.816 MSMSGS stetesting1@hotmail.de
CVR 2 14.0.8064 14.0.8064 8.1.0178 http://msgr.dlservice.microsoft.com/download/5/2/E/52EB299A-E4DE-43E2-8D55-510D7FB03610/en/wlsetup-cvr.exe http://download.live.com/?sku=messenger
USR 3 SSO I stetesting1@hotmail.de
GCF 0 6601
<Policies><Policy type=" .....
..........
USR 3 SSO S MBI_KEY_OLD Bq/rKdMMRPda79voc3PkMx4RxhhuPqpNUmVfKyIV7b9HUN0VgTBh4BmRBItftqF+
USR 4 SSO S t=EwBoAswbAQAUs1/VcBU2sH7mwYy3BysWZ71CRDGAACFfSYSpUjY160ZI4g/7FcPOyxjLpKfbVXO2XwcCzRl98xYXIboQ1+1r1VcBfEOcXVq9dUG6JIJfg5elYN5oISZN8I16JixKABivE8EC86BoJx3sar191nXNmqd2WL7rCa9KiFHXZdjA0+nskgouinobT4Ca2yQqJx9eIOjnS2NMA2YAAAiRcgvvEPElwrgB90PrM0dVwz1s3OrvhWizTBbCcsOlNVk5EppsZXFs9h4Nd9GzTpHKeI2W3D/l5uf4A1eI5+GW0duLQ3u+HADG6reiG3Dq2fJXuk0FS6Evgy4jESmI167mmkqdVINp97rCp5KvI3jvSLaJXWwsO1ybnKNCsXWcEpEdyT7Oq0+AXkGwtnwQWWk31wjDzRUV0IVivg8Ku3pgPa0VWfmnI5HO4OWfl8d1OjUYBMCQGkGNSTC+FxNtM7A1nw+4DI9H69AR9d5WGwY4ceacbtSPguSvi3ByRhBckb9K72/04K1yxBe2ZxArrAF7v9spCtYew52WY7FI/96hjabFscDT+F7KDsbqvBG3ujZ8EX6NuqEA4SIgsgatmKkuxSdXRY4zdv9tACVv8MZqDLetIOaCpo4UDUfsCt8xclVzguuKJzgbXjkYxgDs8Qw8P5v3Two6pRzuKnVzP9bt7dz7rLIufxyjf+azYCL+VHFeCaFdn/YUE5pdLx9V/FUaGPbkslwUHmISsE3Njj46Seps5MN1odfAcPGUANQoT2W1UDKWSSz8UWoPsu5jFMpVnl0TNNxzBVz9d6YrPuxEqdTNAQ==&p= HAAAAAEAAAADZgAABIAAAAgAAAAUAAAASAAAAAABAgMEBQYHX/8WyGum2BnENa88+fKvl96IYh90QdCjeJYvm+2W0w/v+M+R42z44bfbCSmsVONQtN88Uvk7cdDVNbSWyCgITsmpDa+UCsyhzvgN9Tmc0w7t2LHbSPWP2afCeNA=
USR 4 OK stetesting1@hotmail.de 1 0
SBS 0 null
MSG Hotmail Hotmail 1248
MIME-Version: 1.0
......
......
LP 5 AL
BLP 5 AL
ADL 6 128
<ml l="1"><d n="hotmail.de"><c n="stetesting2" l="3" t="1" /></d><d n="hotmail.co.uk"><c n="stetesting2" l="3" t="1" /></d></ml>PRP 7 MFN STE
CHG 8 NLN 1879343148
UUX 9 118
<Data><PSM></PSM><CurrentMedia></CurrentMedia><MachineGuid>{F26D1F07-95E2-403C-BC18-D4BFED493428}</MachineGuid></Data>PRP 7 MFN STE
ADL 6 OK
CHG 8 NLN 1879343148
UUX 9 0
Android TCP stream
------------------
VER 1 MSNP15 CVR0
VER 1 MSNP15
CVR 2 0x0409 winnt 5.1 i386 MSNMSGR 8.5.1288.816 MSMSGS stetesting1@hotmail.de
CVR 2 14.0.8064 14.0.8064 8.1.0178 http://msgr.dlservice.microsoft.com/download/5/2/E/52EB299A-E4DE-43E2-8D55-510D7FB03610/en/wlsetup-cvr.exe http://download.live.com/?sku=messenger
USR 3 SSO I stetesting1@hotmail.de
GCF 0 6601
<Policies><Policy type" .....
........
USR 3 SSO S MBI_KEY_OLD b03ftZG8hikIPp66lXBVBhq/E7NreBALu/5GlxRkRNmUntM7l4+xpVpsyCQcrMVP
-----------------------------------------------------------------
In Android application case why are we failing to send out the command
USR 4 SSO S .........
So from there on there is no communication between us and MSN servers and login process is not completed.
Do you have any idea of why we are failing to send out USR 4 SSO S ..... command to MSN servers?
Thanks
If you cannot run some logging on Android try putting it yourself. The package responsible for the contactlist is net.sf.jml.protocol.soap.
Hi Damian,
Good news, I could now solve the issue of retrieving contact list in Android application also. I have debugged the JML code by putting some logging statements from Session.java file and landed up in MsnMessage.java, where the problem is happening.
The problem occurs during parsing of incoming MSN server commands. For some reasons the command parser fails to correctly parse and put them in event dispatch queue, when we receive commands in bunch. (I see that SYN, GTC, BLP etc etc commands are coming all together and parser is failing to separate them correctly) I debugged further and found the problem at following place,
File name: MsnMessage.java
Method: protected boolean load(ByteBuffer buffer) {
....
....
String s = Charset.decode((ByteBuffer) buffer.slice().limit(index - buffer.position()));
....
....
}
For some reasons in Android buffer.slice().limit() is not working correctly and it always giving the data from the start of the buffer instead of from the position we set and that's why see always getting SYN command instead of getting next GTC, BTC etc.,
Possible fix:
------------
Method: protected boolean load(ByteBuffer buffer) {
....
....
ByteBuffer rBuffer = (ByteBuffer) buffer.asReadOnlyBuffer();
String s = Charset.decode((ByteBuffer) rBuffer.limit(index));
//String s = Charset.decode((ByteBuffer) buffer.slice().limit(index - buffer.position()));
....
....
}
Now all commands SYN, GTC, BLP etc., are correctly extracted and I now I could get the contact list correctly using MSN protocol version 11.
I am not sure whether the above fix is a proper one, please suggest if you get any better idea of fixing the issue.
With the above fix I could now successfully login using MSN protocol version 15 but I see some NULL pointer exception in net.sf.jml.protocol.soap.ContactList.java file and I will now debug this and post you back if I make any good progress with the issue. If you have any idea or hint please let me know, that may help in my debugging.
THANKS A LOT FOR YOUR KIND REPLIES WITH USEFUL HINTS.
Hi Damian,
The issue with protocol version 15 is now resolved by doing the following modication in file,
net.sf.jml.protocol.soap.ContactList.java file,
Modification:
SSLContext sc = SSLContext.getInstance("TLSv1");
instead of:
SSLContext sc = SSLContext.getInstance("SSLv3");
As SSL is not supported in Android platform at the moment.
Now the JML library works well on Android platform too.
Once again thanks for the library and your support.
Thanks