Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 299849 - [remotesvcs] RegistrySharedObject#handle* can throw NPE
Summary: [remotesvcs] RegistrySharedObject#handle* can throw NPE
Status: RESOLVED FIXED
Alias: None
Product: ECF
Classification: RT
Component: ecf.remoteservices (show other bugs)
Version: 3.1.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: ecf.core-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-16 11:33 EST by Pavel Samolisov CLA
Modified: 2010-01-16 12:01 EST (History)
1 user (show)

See Also:


Attachments
My patch for fix this one (2.78 KB, patch)
2010-01-16 11:38 EST, Pavel Samolisov CLA
slewis: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Samolisov CLA 2010-01-16 11:33:20 EST
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.
Comment 1 Pavel Samolisov CLA 2010-01-16 11:38:00 EST
Created attachment 156314 [details]
My patch for fix this one
Comment 2 Scott Lewis CLA 2010-01-16 12:01:20 EST
Attachment 156314 [details] applied and released to HEAD.  Thanks kindly Pavel.  Resolving as fixed.