taksan / skype-java-api

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

Skype.isRunning() work not correctly #26

Open AlexeyPirogov opened 11 years ago

AlexeyPirogov commented 11 years ago

1) Run java app. 2) Run skype. 3) Wait till skype loaded all contacts(we can even wait for 5 minutes). 4) Check from Java app Skype.isRunning(). 5) Check Skype.isRunning() return false. 6) Check Skype.isRunning() return true.

Some problem inside Connector classe private void assureAttached() throws ConnectorException { Status attachedStatus = getStatus(); if (attachedStatus != Status.ATTACHED) { attachedStatus = connect(); if (attachedStatus != Status.ATTACHED) { throw new NotAttachedException(attachedStatus); } } } , because after restarting of client the attachedStatus=API_AVAILABLE and after connect() it is also attachedStatus=API_AVAILABLE and than we are throwing exception com.skype.connector.NotAttachedException. But after next run of Connector.assureAttached() the attachedStatus=ATTACHED.

I haven't gone deep into the sources so I see two solutions: 1) In Connector.isRunning() don't catch exception and return FALSE, but rethrow exception like in LinuxConnector.isRunning(). So I as developer can catch this exception in the code and deal with it(make one more call or smth like this). 2) In Connector.assureAttached() make third call of connect():), perhaps it will update "attachedStatus" to correct one.

ENVIRONMENT: Windows 7 32-bit, Windows 7 64-bit, Skype 6.1.0.129.