[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [ecf-dev] Small problem with RegistrySharedObject#handleAddRegistration
|
Hi Pavel,
Yes, this is a bug...thanks for finding. If you could open a bug report
and attach code for fix (in patch or in comment given that it's so
small), I'll apply.
There are one or two other handle* methods in the RegistrySharedObject
class that should probably also be adjusted similarly...just to avoid
spurious NPEs reported to console because of thread race.
Thanks,
Scott
Samolisov Pavel wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello folks,
I find a potential bug in the method
RegistrySharedObject#handleAddRegistration:
in this code:
if (remoteContainerID == null ||
getLocalContainerID().equals(remoteContainerID)) { return;
}
XMPPRemoteServiceAdapterFactory#XMPPRegistrySharedObject#getLocalContainerID()
returns container ID as connected ID:
protected ID getLocalContainerID() {
// For XMPP, the local container ID is its connected ID.
return getContext().getConnectedID();
}
this code returns XMPPContainer.remoteServerID
But! If we will invoke method XMPPContainer.disconnect() then we will
set remoteServerID to null and getLocalContainerID will return null. In
RegistrySharedObject#handleAddRegistration we will have NPE.
This situation can occur because we receive/handle packet in another
(not main) thread.
We can receive message in thread A, close connection in thread Main and
begin handle received message in thread A. Therefore we can got NPE.
May be we should change code in the
RegistrySharedObject#handleAddRegistration to:
ID localContainerID = getLocalContainerID();
if (remoteContainerID == null || localContainerID == null ||
localContainerID.equals(remoteContainerID)) { return;
}
Any ideas?
- --
Pavel Samolisov
Meet me at:
Vkontakte.ru: http://vkontakte.ru/id3178981
Blog: http://samolisov.blogspot.com
Twitter: http://twitter.com/samolisov
XMPP/Jabber: samolisov@xxxxxxxxx
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAktR3RgACgkQ20T0Vos3rqAO8gCgryxqdMrQQYxQ03pVCj54WTQH
LjAAniU6GHH1G/Z8o/1rGGtfUPBXZx85
=7ZXC
-----END PGP SIGNATURE-----
_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev