taksan / skype-java-api

Skype API for Java, based on Skype4Java library
128 stars 60 forks source link

NotAttachedException throws if call ChatMessage.getStatus() inside ChatMessageListener.chatMessageReceived #9

Closed evluhin closed 12 years ago

evluhin commented 12 years ago

if call ChatMessage.getStatus() inside ChatMessageListener.chatMessageReceived(ChatMessage m) execution will stop for some time and then status will change to NOT_RUNNING and will try to reconnect (and it's actually connected) and get refused status. All listeners are notified but NotAttachedException is thrown.

Environment: Mac OS Lion, 64bit, Mac OS JDK 1.6

Example of two messages received (only one copy of stacktrace) Console log:

Skype: CHATMESSAGE 1675305 STATUS RECEIVED Skype: CHAT #sergey/$publisher;1d2681243dabfe7f ACTIVITY_TIMESTAMP 1324933032 Skype: CHATMESSAGE 1675337 STATUS RECEIVED Skype: #0 MESSAGE 1675305 STATUS RECEIVED Skype: #1 MESSAGE 1675337 STATUS RECEIVED Skype: CHAT #sergey/$publisher;1d2681243dabfe7f ACTIVITY_TIMESTAMP 1324933056 Skype: #0 MESSAGE 1675305 STATUS RECEIVED Skype: #1 MESSAGE 1675337 STATUS RECEIVED com.skype.NotAttachedException at com.skype.Utils.convertToSkypeException(Utils.java:57) at com.skype.Utils.getPropertyWithCommandId(Utils.java:97) at com.skype.ChatMessage.getStatus(ChatMessage.java:211) at mysite.skype.message.push.service.SkypeServer$1.chatMessageReceived(SkypeServer.java:43) at com.skype.Skype$3.messageReceived(Skype.java:782) at com.skype.connector.Connector.fireMessageEvent(Connector.java:1119) at com.skype.connector.Connector.access$5(Connector.java:1114) at com.skype.connector.Connector$13.run(Connector.java:1098) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:680) Caused by: com.skype.connector.NotAttachedException at com.skype.connector.Connector.execute(Connector.java:871) at com.skype.connector.Connector.execute(Connector.java:827) at com.skype.connector.Connector.executeWithId(Connector.java:677) at com.skype.Utils.getPropertyWithCommandId(Utils.java:93) ... 9 more Caused by: com.skype.connector.NotAttachedException at com.skype.connector.Connector$11.call(Connector.java:935) at com.skype.connector.Connector$11.call(Connector.java:1) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) ... 3 more
taksan commented 12 years ago

This bug is confirmed under Mac OS (it is not a problem under linux). I'll investigate it further,

taksan commented 12 years ago

This problem is because OSX's skype replies with MESSAGE instead of CHATMESSAGE. Anyway, the exception is misleading, because it makes the user believe skype disconnected, which is not the case.