Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356658

Summary: [dstore] getHostEnvironment returns an empty array immediately after connecting
Product: [Tools] Target Management Reporter: Petar Petrov <petar.petrov>
Component: RSEAssignee: David McKnight <dmcknigh>
Status: RESOLVED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: normal    
Priority: P3 CC: dmcknigh, petar.petrov
Version: 3.1.1   
Target Milestone: 3.4 M3   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
patch to waitForInitialize() before getting the host env none

Description Petar Petrov CLA 2011-09-03 04:09:43 EDT
Build Identifier: 20110615-0604

DStoreShellService.getHostEnvironment() will return an empty array if called immediately after connecting

Reproducible: Always

Steps to Reproduce:
Create a RSE connection configured to use the DStore shell subsystem.
Execute the following code:


		for(ISubSystem subSystem : host.getSubSystems())
		{
			if(subSystem instanceof IShellServiceSubSystem)
			{
				try
				{
					if(!subSystem.isConnected())
					{
						IConnectorService connectorService = subSystem.getConnectorService();

						connectorService.acquireCredentials(false);
						connectorService.connect(monitor);
					}
					IShellService shellService = ((IShellServiceSubSystem)subSystem).getShellService();
					shellService.getHostEnvironment();
				}
				catch(Exception e)
				{
					PluginLog.logError(e);
				}
			}
		}

If the connection was disconnected the call to getHostEnvironment will return an empty array. If called after a few seconds, it will properly return the environment variables. If a call to isInitialized() is made right after connecting, it will return false.

Looking at the DStoreShellService source code, it seems that all other public methods call waitForInitialize, while getHostEnvironment does not.
Comment 1 David McKnight CLA 2011-09-08 12:07:15 EDT
Created attachment 203008 [details]
patch to waitForInitialize() before getting the host env

Could you check if this patch fixes the issue?
Comment 2 David McKnight CLA 2011-10-06 14:59:49 EDT
I've committed the change to the HEAD stream.