Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356658 - [dstore] getHostEnvironment returns an empty array immediately after connecting
Summary: [dstore] getHostEnvironment returns an empty array immediately after connecting
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 3.1.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.4 M3   Edit
Assignee: David McKnight CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-03 04:09 EDT by Petar Petrov CLA
Modified: 2012-02-06 09:33 EST (History)
2 users (show)

See Also:


Attachments
patch to waitForInitialize() before getting the host env (1.97 KB, patch)
2011-09-08 12:07 EDT, David McKnight CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.