View | Details | Raw Unified | Return to bug 207095
Collapse All | Expand All

(-)src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java (-51 / +94 lines)
Lines 19-25 Link Here
19
 * David McKnight   (IBM)        - [196035] Wrapper SystemMessageExceptions for createFile and createFolder with RemoteFileSecurityException
19
 * David McKnight   (IBM)        - [196035] Wrapper SystemMessageExceptions for createFile and createFolder with RemoteFileSecurityException
20
 * Kevin Doyle 		(IBM)		 - [191548] Deleting Read-Only directory removes it from view and displays no error
20
 * Kevin Doyle 		(IBM)		 - [191548] Deleting Read-Only directory removes it from view and displays no error
21
 * Xuan Chen        (IBM)        - [202670] [Supertransfer] After doing a copy to a directory that contains folders some folders name's display "deleted"
21
 * Xuan Chen        (IBM)        - [202670] [Supertransfer] After doing a copy to a directory that contains folders some folders name's display "deleted"
22
 * Xuan Chen        (IBM)        - [190824] Incorrect result for DStore#getSeparator() function when parent is "/"  
22
 * Xuan Chen        (IBM)        - [190824] Incorrect result for DStore#getSeparator() function when parent is "/" 
23
 * David McKnight   (IBM)        - [207095] check for null datastore 
23
 ********************************************************************************/
24
 ********************************************************************************/
24
25
25
package org.eclipse.rse.internal.services.dstore.files;
26
package org.eclipse.rse.internal.services.dstore.files;
Lines 105-110 Link Here
105
		super.uninitService(monitor);
106
		super.uninitService(monitor);
106
		_fileElementMap.clear();
107
		_fileElementMap.clear();
107
		_dstoreFileMap.clear();
108
		_dstoreFileMap.clear();
109
		_uploadLogElement = null;
108
	}
110
	}
109
	
111
	
110
	public String getName()
112
	public String getName()
Lines 149-155 Link Here
149
	
151
	
150
	protected String getDataStoreRoot()
152
	protected String getDataStoreRoot()
151
	{
153
	{
152
		return getDataStore().getAttribute(DataStoreAttributes.A_LOCAL_PATH);
154
		DataStore ds = getDataStore();
155
		if (ds != null)
156
			return ds.getAttribute(DataStoreAttributes.A_LOCAL_PATH);
157
		return null;
153
	}
158
	}
154
	
159
	
155
160
Lines 172-199 Link Here
172
177
173
	protected void setDataStoreRoot(String root)
178
	protected void setDataStoreRoot(String root)
174
	{
179
	{
175
		getDataStore().setAttribute(DataStoreAttributes.A_LOCAL_PATH, root);
180
		DataStore ds = getDataStore();
181
		if (ds != null)
182
			ds.setAttribute(DataStoreAttributes.A_LOCAL_PATH, root);
176
	}
183
	}
177
	
184
	
178
	protected DataElement findUploadLog()
185
	protected DataElement findUploadLog()
179
	{
186
	{
180
	    DataElement minerInfo = getMinerElement();
187
	    DataElement minerInfo = getMinerElement();
181
		if (_uploadLogElement ==  null || _uploadLogElement.getDataStore() != getDataStore())
188
	    DataStore ds = getDataStore();
189
		if (_uploadLogElement ==  null || _uploadLogElement.getDataStore() != ds)
182
		{
190
		{
183
		    _uploadLogElement = getDataStore().find(minerInfo, DE.A_NAME, "universal.uploadlog", 2); //$NON-NLS-1$
191
			if (ds != null)
192
			{
193
				_uploadLogElement = ds.find(minerInfo, DE.A_NAME, "universal.uploadlog", 2); //$NON-NLS-1$
194
			}
195
			else
196
			{
197
				return null;
198
			}
184
		}
199
		}
185
		return _uploadLogElement;
200
		return _uploadLogElement;
186
	}
201
	}
187
	
202
	
188
	protected DataElement getAttributes(String fileNameFilter, boolean showHidden)
203
	protected DataElement getAttributes(String fileNameFilter, boolean showHidden)
189
	{
204
	{
190
		DataElement attributes = getDataStore().createTransientObject(_filterAttributes);
205
		DataStore ds = getDataStore();
191
		String version = IServiceConstants.VERSION_1;
206
		if (ds != null)
192
		StringBuffer buffer = new StringBuffer();
207
		{
193
		String filter = ((fileNameFilter == null) ? "*" : fileNameFilter); //$NON-NLS-1$
208
			DataElement attributes = ds.createTransientObject(_filterAttributes);
194
		buffer.append(version).append(IServiceConstants.TOKEN_SEPARATOR).append(filter).append(IServiceConstants.TOKEN_SEPARATOR).append(showHidden);
209
			String version = IServiceConstants.VERSION_1;
195
		attributes.setAttribute(DE.A_SOURCE, buffer.toString());
210
			StringBuffer buffer = new StringBuffer();
196
		return attributes;
211
			String filter = ((fileNameFilter == null) ? "*" : fileNameFilter); //$NON-NLS-1$
212
			buffer.append(version).append(IServiceConstants.TOKEN_SEPARATOR).append(filter).append(IServiceConstants.TOKEN_SEPARATOR).append(showHidden);
213
			attributes.setAttribute(DE.A_SOURCE, buffer.toString());
214
			return attributes;
215
		}
216
		else
217
		{
218
			return null;
219
		}
197
	}
220
	}
198
221
199
	
222
	
Lines 776-785 Link Here
776
			buf.append(name);
799
			buf.append(name);
777
			de = getElementFor(buf.toString());
800
			de = getElementFor(buf.toString());
778
		}
801
		}
779
		dsQueryCommand(de, IUniversalDataStoreConstants.C_QUERY_GET_REMOTE_OBJECT, monitor);
802
		
780
		//getFile call should also need to convert this DataElement into a HostFile using
803
		// with 207095, it's possible to get here unconnected such that there is no element	
781
		//convertToHostFile() call.  This way, this DataElement will be put into _fileMap.
804
		if (de != null) {
782
		return convertToHostFile(de);
805
			dsQueryCommand(de, IUniversalDataStoreConstants.C_QUERY_GET_REMOTE_OBJECT, monitor);
806
			//getFile call should also need to convert this DataElement into a HostFile using
807
			//convertToHostFile() call.  This way, this DataElement will be put into _fileMap.
808
			return convertToHostFile(de);
809
		}
810
		else {
811
			return null;
812
		}
783
	}
813
	}
784
814
785
	/**
815
	/**
Lines 1284-1289 Link Here
1284
			waitForInitialize(null);
1314
			waitForInitialize(null);
1285
		}
1315
		}
1286
	
1316
	
1317
		DataStore ds = getDataStore();
1318
		
1319
		// with 207095, it's possible to get here when disconnected and no dstore	
1320
		if (ds == null){
1321
			return null;
1322
		}
1287
		
1323
		
1288
		String normalizedPath = PathUtility.normalizeUnknown(path);
1324
		String normalizedPath = PathUtility.normalizeUnknown(path);
1289
		DataElement element = (DataElement)_fileElementMap.get(normalizedPath);
1325
		DataElement element = (DataElement)_fileElementMap.get(normalizedPath);
Lines 1295-1301 Link Here
1295
		if (element == null || element.isDeleted())
1331
		if (element == null || element.isDeleted())
1296
		{
1332
		{
1297
			DataElement universaltemp = getMinerElement();
1333
			DataElement universaltemp = getMinerElement();
1298
			element = getDataStore().createObject(universaltemp, IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR, normalizedPath, normalizedPath, "", false); //$NON-NLS-1$
1334
			element = ds.createObject(universaltemp, IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR, normalizedPath, normalizedPath, "", false); //$NON-NLS-1$
1299
		}
1335
		}
1300
		return element;
1336
		return element;
1301
	}
1337
	}
Lines 1314-1321 Link Here
1314
	protected IHostFile[] fetch(String remoteParent, String fileFilter, String queryType, IProgressMonitor monitor)
1350
	protected IHostFile[] fetch(String remoteParent, String fileFilter, String queryType, IProgressMonitor monitor)
1315
	{
1351
	{
1316
		DataStore ds = getDataStore();
1352
		DataStore ds = getDataStore();
1317
	
1353
		if (ds == null)
1318
	
1354
		{
1355
			return new IHostFile[0];
1356
		}
1357
		
1319
		// create filter descriptor
1358
		// create filter descriptor
1320
		DataElement deObj = getElementFor(remoteParent);
1359
		DataElement deObj = getElementFor(remoteParent);
1321
		if (deObj == null)
1360
		if (deObj == null)
Lines 1343-1357 Link Here
1343
		String remotePath = parent + getSeparator(parent) + name;
1382
		String remotePath = parent + getSeparator(parent) + name;
1344
		DataElement de = getElementFor(remotePath);
1383
		DataElement de = getElementFor(remotePath);
1345
		DataStore ds = de.getDataStore();
1384
		DataStore ds = de.getDataStore();
1346
1385
		if (ds != null)
1347
		
1348
		DataElement setCmd = getCommandDescriptor(de, IUniversalDataStoreConstants.C_SET_LASTMODIFIED);
1349
		if (setCmd != null)
1350
		{
1386
		{
1351
			// first modify the source attribute to temporarily be the date field
1387
			DataElement setCmd = getCommandDescriptor(de, IUniversalDataStoreConstants.C_SET_LASTMODIFIED);
1352
			de.setAttribute(DE.A_SOURCE, timestamp + "");			 //$NON-NLS-1$
1388
			if (setCmd != null)
1353
			ds.command(setCmd, de, true);
1389
			{
1354
			return true;
1390
				// first modify the source attribute to temporarily be the date field
1391
				de.setAttribute(DE.A_SOURCE, timestamp + "");			 //$NON-NLS-1$
1392
				ds.command(setCmd, de, true);
1393
				return true;
1394
			}
1355
		}
1395
		}
1356
		
1396
		
1357
		return false;
1397
		return false;
Lines 1363-1385 Link Here
1363
		String remotePath = parent + getSeparator(parent) + name;
1403
		String remotePath = parent + getSeparator(parent) + name;
1364
		DataElement de = getElementFor(remotePath);
1404
		DataElement de = getElementFor(remotePath);
1365
		DataStore ds = de.getDataStore();
1405
		DataStore ds = de.getDataStore();
1366
1406
		if (ds != null)
1367
		
1368
		DataElement setCmd = getCommandDescriptor(de, IUniversalDataStoreConstants.C_SET_READONLY);
1369
		if (setCmd != null)
1370
		{
1407
		{
1371
			String flag = readOnly ? "true" : "false"; //$NON-NLS-1$ //$NON-NLS-2$
1408
			DataElement setCmd = getCommandDescriptor(de, IUniversalDataStoreConstants.C_SET_READONLY);
1372
			de.setAttribute(DE.A_SOURCE, flag);
1409
			if (setCmd != null)
1373
			DataElement status = ds.command(setCmd, de, true);
1374
			try
1375
			{
1376
				getStatusMonitor(ds).waitForUpdate(status);
1377
			}
1378
			catch (Exception e)
1379
			{
1410
			{
1411
				String flag = readOnly ? "true" : "false"; //$NON-NLS-1$ //$NON-NLS-2$
1412
				de.setAttribute(DE.A_SOURCE, flag);
1413
				DataElement status = ds.command(setCmd, de, true);
1414
				try
1415
				{
1416
					getStatusMonitor(ds).waitForUpdate(status);
1417
				}
1418
				catch (Exception e)
1419
				{
1380
				
1420
				
1421
				}
1422
				return true;
1381
			}
1423
			}
1382
			return true;
1383
		}
1424
		}
1384
		return false;
1425
		return false;
1385
	}
1426
	}
Lines 1394-1413 Link Here
1394
		if (remoteEncoding == null) {
1435
		if (remoteEncoding == null) {
1395
			
1436
			
1396
			DataStore ds = getDataStore();
1437
			DataStore ds = getDataStore();
1438
			if (ds != null)
1439
			{
1440
				DataElement encodingElement = ds.createObject(null, IUniversalDataStoreConstants.UNIVERSAL_TEMP_DESCRIPTOR, ""); //$NON-NLS-1$
1441
				
1442
				DataElement queryCmd = ds.localDescriptorQuery(encodingElement.getDescriptor(),IUniversalDataStoreConstants.C_SYSTEM_ENCODING);
1397
1443
1398
			DataElement encodingElement = ds.createObject(null, IUniversalDataStoreConstants.UNIVERSAL_TEMP_DESCRIPTOR, ""); //$NON-NLS-1$
1444
				DataElement status = ds.command(queryCmd, encodingElement, true);
1399
1400
			DataElement queryCmd = ds.localDescriptorQuery(encodingElement.getDescriptor(),IUniversalDataStoreConstants.C_SYSTEM_ENCODING);
1401
1402
			DataElement status = ds.command(queryCmd, encodingElement, true);
1403
1445
1404
			try {
1446
				try {
1405
				getStatusMonitor(ds).waitForUpdate(status);
1447
					getStatusMonitor(ds).waitForUpdate(status);
1406
			}
1448
				}
1407
			catch (Exception e) {
1449
				catch (Exception e) {
1408
			}
1450
				}
1409
			
1451
			
1410
			remoteEncoding = encodingElement.getValue();
1452
				remoteEncoding = encodingElement.getValue();
1453
			}
1411
		}
1454
		}
1412
1455
1413
		return remoteEncoding;
1456
		return remoteEncoding;
(-)src/org/eclipse/rse/services/dstore/AbstractDStoreService.java (-32 / +59 lines)
Lines 13-18 Link Here
13
 * Contributors:
13
 * Contributors:
14
 * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
14
 * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
15
 * David McKnight   (IBM)        - [190803] Canceling a long-running dstore job prints "InterruptedException" to stdout  
15
 * David McKnight   (IBM)        - [190803] Canceling a long-running dstore job prints "InterruptedException" to stdout  
16
 * David McKnight   (IBM)        - [207095] check for null datastore
16
 ********************************************************************************/
17
 ********************************************************************************/
17
18
18
package org.eclipse.rse.services.dstore;
19
package org.eclipse.rse.services.dstore;
Lines 72-88 Link Here
72
	
73
	
73
	protected DataElement getMinerElement(String id)
74
	protected DataElement getMinerElement(String id)
74
	{	    
75
	{	    
75
	    return getDataStore().findMinerInformation(id);	        
76
		DataStore ds = getDataStore();
77
		if (ds != null)
78
		{
79
			return ds.findMinerInformation(id);	        
80
		}
81
		else
82
		{
83
			return null;
84
		}
76
	}
85
	}
77
	 
86
	 
78
	protected DataElement[] dsQueryCommand(DataElement subject, ArrayList args, String command, IProgressMonitor monitor)
87
	protected DataElement[] dsQueryCommand(DataElement subject, ArrayList args, String command, IProgressMonitor monitor)
79
	{
88
	{
80
		// query roots
89
		// query roots
81
		DataElement queryCmd = getCommandDescriptor(subject, command);
90
		DataElement queryCmd = getCommandDescriptor(subject, command);
91
		DataStore ds = getDataStore();
82
	
92
	
83
		if (queryCmd != null)
93
		if (queryCmd != null && ds != null)
84
		{
94
		{
85
			DataElement status = getDataStore().command(queryCmd, args, subject, true);
95
			DataElement status = ds.command(queryCmd, args, subject, true);
86
			try
96
			try
87
			{
97
			{
88
				DStoreStatusMonitor smon = getStatusMonitor(getDataStore());
98
				DStoreStatusMonitor smon = getStatusMonitor(getDataStore());
Lines 118-127 Link Here
118
	{
128
	{
119
		// query roots
129
		// query roots
120
		DataElement queryCmd = getCommandDescriptor(subject, command);
130
		DataElement queryCmd = getCommandDescriptor(subject, command);
131
		DataStore ds = getDataStore();
121
	
132
	
122
		if (queryCmd != null)
133
		if (queryCmd != null && ds != null)
123
		{
134
		{
124
			DataElement status = getDataStore().command(queryCmd, args, subject, true);
135
			DataElement status = ds.command(queryCmd, args, subject, true);
125
			try
136
			try
126
			{
137
			{
127
				DStoreStatusMonitor smon = getStatusMonitor(getDataStore());
138
				DStoreStatusMonitor smon = getStatusMonitor(getDataStore());
Lines 147-156 Link Here
147
	{
158
	{
148
		// query roots
159
		// query roots
149
		DataElement queryCmd = getCommandDescriptor(subject, command);
160
		DataElement queryCmd = getCommandDescriptor(subject, command);
150
	
161
		DataStore ds = getDataStore();
151
		if (queryCmd != null)
162
		if (queryCmd != null && ds != null)
152
		{
163
		{
153
			DataStore ds = getDataStore();
154
			DataElement status = ds.command(queryCmd, subject, true);
164
			DataElement status = ds.command(queryCmd, subject, true);
155
			try
165
			try
156
			{
166
			{
Lines 181-191 Link Here
181
	protected DataElement dsStatusCommand(DataElement subject, String command, IProgressMonitor monitor)
191
	protected DataElement dsStatusCommand(DataElement subject, String command, IProgressMonitor monitor)
182
	{
192
	{
183
		// query roots
193
		// query roots
184
		DataElement queryCmd = getCommandDescriptor(subject, command);
194
		DataElement queryCmd = getCommandDescriptor(subject, command);	
185
	
195
		DataStore ds = getDataStore();
186
		if (queryCmd != null)
196
		
187
		{
197
		if (queryCmd != null && ds != null)
188
			DataStore ds = getDataStore();
198
		{			
189
			DataElement status = ds.command(queryCmd, subject, true);
199
			DataElement status = ds.command(queryCmd, subject, true);
190
			try
200
			try
191
			{
201
			{
Lines 214-233 Link Here
214
		DataElement cmd = (DataElement)_cmdDescriptorMap.get(command);
224
		DataElement cmd = (DataElement)_cmdDescriptorMap.get(command);
215
		if (cmd == null || ds != cmd.getDataStore())
225
		if (cmd == null || ds != cmd.getDataStore())
216
		{
226
		{
217
			cmd = getDataStore().localDescriptorQuery(subject.getDescriptor(), command);
227
			if (ds != null)
218
			_cmdDescriptorMap.put(command, cmd);
228
			{
229
				cmd = ds.localDescriptorQuery(subject.getDescriptor(), command);
230
				_cmdDescriptorMap.put(command, cmd);
231
			}
219
		}
232
		}
220
		return cmd;
233
		return cmd;
221
	}
234
	}
222
	
235
	
223
	public int getServerVersion()
236
	public int getServerVersion()
224
	{
237
	{
225
		return getDataStore().getServerVersion();
238
		DataStore ds = getDataStore();
239
		if (ds != null)
240
			return ds.getServerVersion();
241
		return 0;
226
	}
242
	}
227
	
243
	
228
	public int getServerMinor()
244
	public int getServerMinor()
229
	{
245
	{
230
		return getDataStore().getServerMinor();
246
		DataStore ds = getDataStore();
247
		if (ds != null)
248
			return ds.getServerMinor();
249
		return 0;
231
	}
250
	}
232
	
251
	
233
	protected void checkHostJVM()
252
	protected void checkHostJVM()
Lines 261-268 Link Here
261
	{
280
	{
262
		if (_initializeStatus != null)
281
		if (_initializeStatus != null)
263
		{
282
		{
264
			DStoreStatusMonitor smon = getStatusMonitor(getDataStore());
283
			DataStore ds = getDataStore();
265
			return smon.determineStatusDone(_initializeStatus);
284
			if (ds != null)
285
			{
286
				DStoreStatusMonitor smon = getStatusMonitor(ds);
287
				return smon.determineStatusDone(_initializeStatus);
288
			}
266
		}
289
		}
267
		return false;
290
		return false;
268
	}
291
	}
Lines 271-294 Link Here
271
	{
294
	{
272
		if (_initializeStatus != null)
295
		if (_initializeStatus != null)
273
		{
296
		{
274
			DStoreStatusMonitor smon = getStatusMonitor(getDataStore());
297
			DataStore ds = getDataStore();
275
			try
298
			if (ds != null)
276
			{
277
				smon.waitForUpdate(_initializeStatus, monitor, 100);
278
			}
279
			catch (InterruptedException e)
280
			{
299
			{
281
				// cancel monitor if it's still not canceled
300
				DStoreStatusMonitor smon = getStatusMonitor(getDataStore());
282
				if (monitor != null && !monitor.isCanceled())
301
				try
283
				{
302
				{
284
					monitor.setCanceled(true);
303
					smon.waitForUpdate(_initializeStatus, monitor, 100);
285
				}
304
				}
305
				catch (InterruptedException e)
306
				{
307
					// cancel monitor if it's still not canceled
308
					if (monitor != null && !monitor.isCanceled())
309
					{
310
						monitor.setCanceled(true);
311
					}
286
				
312
				
287
				//InterruptedException is used to report user cancellation, so no need to log
313
					//InterruptedException is used to report user cancellation, so no need to log
288
				//This should be reviewed (use OperationCanceledException) with bug #190750
314
					//This should be reviewed (use OperationCanceledException) with bug #190750
289
			}
315
				}
290
			
316
			
291
			getMinerElement();
317
				getMinerElement();
318
			}
292
		}
319
		}
293
	}
320
	}
294
	
321
	
(-)src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java (-11 / +32 lines)
Lines 19-24 Link Here
19
 * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
19
 * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
20
 * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
20
 * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
21
 * Javier Montalvo Orus (Symbian) - [199773] Default file transfer mode is ignored for some file types
21
 * Javier Montalvo Orus (Symbian) - [199773] Default file transfer mode is ignored for some file types
22
 * David McKnight   (IBM)        - [207095] Implicit connect on getRemoteFileObject
22
 *******************************************************************************/
23
 *******************************************************************************/
23
24
24
package org.eclipse.rse.subsystems.files.core.servicesubsystem;
25
package org.eclipse.rse.subsystems.files.core.servicesubsystem;
Lines 127-137 Link Here
127
	 * an unqualified file or folder name and its parent folder object. 
128
	 * an unqualified file or folder name and its parent folder object. 
128
	 * @param parent Folder containing the folder or file
129
	 * @param parent Folder containing the folder or file
129
	 * @param folderOrFileName Un-qualified folder or file name
130
	 * @param folderOrFileName Un-qualified folder or file name
131
	 * @param monitor the progress monitor
130
	 * @return an IRemoteFile object for the file.
132
	 * @return an IRemoteFile object for the file.
131
	 * @see IRemoteFile
133
	 * @see IRemoteFile
132
	 */
134
	 */
133
	public IRemoteFile getRemoteFileObject(IRemoteFile parent, String folderOrFileName, IProgressMonitor monitor) throws SystemMessageException 
135
	public IRemoteFile getRemoteFileObject(IRemoteFile parent, String folderOrFileName, IProgressMonitor monitor) throws SystemMessageException 
134
	{
136
	{
137
		// for bug 207095, implicit connect if the connection is not connected
138
		checkIsConnected();
139
135
		String fullPath = parent.getAbsolutePath() + getSeparator() + folderOrFileName;
140
		String fullPath = parent.getAbsolutePath() + getSeparator() + folderOrFileName;
136
		IRemoteFile file = getCachedRemoteFile(fullPath);
141
		IRemoteFile file = getCachedRemoteFile(fullPath);
137
		if (file != null && !file.isStale()) 
142
		if (file != null && !file.isStale()) 
Lines 147-157 Link Here
147
	 * Constructs and returns an IRemoteFile object given a fully-qualified 
152
	 * Constructs and returns an IRemoteFile object given a fully-qualified 
148
	 * file or folder name.
153
	 * file or folder name.
149
	 * @param folderOrFileName Fully qualified folder or file name
154
	 * @param folderOrFileName Fully qualified folder or file name
155
	 * @param monitor the progress monitor
150
	 * @return The constructed IRemoteFile
156
	 * @return The constructed IRemoteFile
151
	 * @see IRemoteFile
157
	 * @see IRemoteFile
152
	 */
158
	 */
153
	public IRemoteFile getRemoteFileObject(String folderOrFileName, IProgressMonitor monitor) throws SystemMessageException 
159
	public IRemoteFile getRemoteFileObject(String folderOrFileName, IProgressMonitor monitor) throws SystemMessageException 
154
	{
160
	{
161
155
		String fofName = folderOrFileName;
162
		String fofName = folderOrFileName;
156
		if (folderOrFileName.length() > 1)
163
		if (folderOrFileName.length() > 1)
157
		{
164
		{
Lines 162-173 Link Here
162
			return file;
169
			return file;
163
		}
170
		}
164
		
171
		
172
		// for bug 207095, implicit connect if the connection is not connected
173
		checkIsConnected();
174
		
165
		if (fofName.endsWith(ArchiveHandlerManager.VIRTUAL_SEPARATOR))
175
		if (fofName.endsWith(ArchiveHandlerManager.VIRTUAL_SEPARATOR))
166
		{
176
		{
167
			fofName = fofName.substring(0, fofName.length() - ArchiveHandlerManager.VIRTUAL_SEPARATOR.length());
177
			fofName = fofName.substring(0, fofName.length() - ArchiveHandlerManager.VIRTUAL_SEPARATOR.length());
168
		}
178
		}	
169
	
179
		
170
171
		int j = fofName.indexOf(ArchiveHandlerManager.VIRTUAL_SEPARATOR);
180
		int j = fofName.indexOf(ArchiveHandlerManager.VIRTUAL_SEPARATOR);
172
		if (j == -1)
181
		if (j == -1)
173
		{
182
		{
Lines 184-190 Link Here
184
			} 
193
			} 
185
			
194
			
186
			if (fofName.equals(".")) { //$NON-NLS-1$
195
			if (fofName.equals(".")) { //$NON-NLS-1$
187
				return getUserHome();
196
				IRemoteFile userHome =  getUserHome();
197
				if (userHome == null){
198
					
199
					// with 207095, it's possible that we could be trying to get user home when not connected	
200
					SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_UNEXPECTED);
201
					throw new SystemMessageException(msg);
202
				}
203
				return userHome;
188
			}
204
			}
189
205
190
			String sep = PathUtility.getSeparator(folderOrFileName);
206
			String sep = PathUtility.getSeparator(folderOrFileName);
Lines 262-277 Link Here
262
			return root;
278
			return root;
263
		}
279
		}
264
		IHostFile userHome = getFileService().getUserHome();
280
		IHostFile userHome = getFileService().getUserHome();
281
		// with 207095, it's possible that user is not connected, and that userHome is null
282
		if (userHome == null) {
283
			return null;
284
		}
285
		
265
		IRemoteFile parent = null;
286
		IRemoteFile parent = null;
266
		if (!userHome.getParentPath().equals(".")) //$NON-NLS-1$
287
		if (!userHome.getParentPath().equals(".")) //$NON-NLS-1$
267
		{
288
		{
268
		try
289
			try
269
		{
290
			{
270
			//parent = getRemoteFileObject(userHome.getParentPath());
291
				//parent = getRemoteFileObject(userHome.getParentPath());
271
		}
292
			}
272
		catch (Exception e)
293
			catch (Exception e)
273
		{			
294
			{			
274
		}
295
			}
275
		}
296
		}
276
		root = getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), parent, userHome);
297
		root = getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), parent, userHome);
277
		cacheRemoteFile(root, "."); //$NON-NLS-1$
298
		cacheRemoteFile(root, "."); //$NON-NLS-1$

Return to bug 207095