View | Details | Raw Unified | Return to bug 191548 | Differences between
and this patch

Collapse All | Expand All

(-)miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java (-1 / +1 lines)
Lines 2123-2129 Link Here
2123
					.getRegisteredHandler(new File(vpath
2123
					.getRegisteredHandler(new File(vpath
2124
							.getContainingArchiveString()));
2124
							.getContainingArchiveString()));
2125
			if (handler == null || !handler.delete(vpath.getVirtualPart())) {
2125
			if (handler == null || !handler.delete(vpath.getVirtualPart())) {
2126
				status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
2126
				status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED + "|" + vpath.toString()); //$NON-NLS-1$
2127
				_dataStore.refresh(subject);
2127
				_dataStore.refresh(subject);
2128
				return statusDone(status);
2128
				return statusDone(status);
2129
			}
2129
			}
(-)src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java (-2 / +8 lines)
Lines 929-935 Link Here
929
		DataElement de = getElementFor(remotePath);
929
		DataElement de = getElementFor(remotePath);
930
		DataElement status = dsStatusCommand(de, IUniversalDataStoreConstants.C_DELETE, monitor);
930
		DataElement status = dsStatusCommand(de, IUniversalDataStoreConstants.C_DELETE, monitor);
931
		if (status == null) return false;
931
		if (status == null) return false;
932
		if (FileSystemMessageUtil.getSourceMessage(status).equals(IServiceConstants.SUCCESS)) {
932
		String sourceMsg = FileSystemMessageUtil.getSourceMessage(status);
933
		// When running a server older than 2.0.1 success is not set for directories, so we must
934
		// check if the source message is an empty string
935
		if (sourceMsg.equals(IServiceConstants.SUCCESS) || sourceMsg.equals("")) { //$NON-NLS-1$
933
			return true;
936
			return true;
934
		} else {
937
		} else {
935
			throw new SystemMessageException(getMessage("RSEF1300").makeSubstitution(FileSystemMessageUtil.getSourceLocation(status)));	 //$NON-NLS-1$
938
			throw new SystemMessageException(getMessage("RSEF1300").makeSubstitution(FileSystemMessageUtil.getSourceLocation(status)));	 //$NON-NLS-1$
Lines 949-955 Link Here
949
		}	
952
		}	
950
		DataElement status = dsStatusCommand((DataElement) dataElements.get(0), dataElements, IUniversalDataStoreConstants.C_DELETE_BATCH, monitor);
953
		DataElement status = dsStatusCommand((DataElement) dataElements.get(0), dataElements, IUniversalDataStoreConstants.C_DELETE_BATCH, monitor);
951
		if (status == null) return false;
954
		if (status == null) return false;
952
		if (FileSystemMessageUtil.getSourceMessage(status).equals(IServiceConstants.SUCCESS)) {
955
		String sourceMsg = FileSystemMessageUtil.getSourceMessage(status);
956
		// When running a server older than 2.0.1 success is not set for directories, so we must
957
		// check if the source message is an empty string
958
		if (sourceMsg.equals(IServiceConstants.SUCCESS) || sourceMsg.equals("")) { //$NON-NLS-1$
953
			return true;
959
			return true;
954
		} else {
960
		} else {
955
			throw new SystemMessageException(getMessage("RSEF1300").makeSubstitution(FileSystemMessageUtil.getSourceLocation(status)));	 //$NON-NLS-1$
961
			throw new SystemMessageException(getMessage("RSEF1300").makeSubstitution(FileSystemMessageUtil.getSourceLocation(status)));	 //$NON-NLS-1$
(-)src/org/eclipse/rse/internal/services/dstore/files/DStoreHostFile.java (-2 / +15 lines)
Lines 15-20 Link Here
15
 * {Name} (company) - description of contribution.
15
 * {Name} (company) - description of contribution.
16
 * Xuan Chen        (IBM)   - [189041] incorrect file name after rename a file inside a zip file - DStore Windows
16
 * Xuan Chen        (IBM)   - [189041] incorrect file name after rename a file inside a zip file - DStore Windows
17
 * Xuan Chen        (IBM)   - [187548] Editor shows incorrect file name after renaming file on Linux dstore
17
 * Xuan Chen        (IBM)   - [187548] Editor shows incorrect file name after renaming file on Linux dstore
18
 * Kevin Doyle 		(IBM) 	- [191548] Various NPE fixes 
18
 *******************************************************************************/
19
 *******************************************************************************/
19
20
20
package org.eclipse.rse.internal.services.dstore.files;
21
package org.eclipse.rse.internal.services.dstore.files;
Lines 85-90 Link Here
85
	
86
	
86
	public String getName()
87
	public String getName()
87
	{
88
	{
89
		if (_element.getName() == null) {
90
			// file was deleted on the host
91
			return null;
92
		}
88
		String type = _element.getType();
93
		String type = _element.getType();
89
		if (type != null && type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR))
94
		if (type != null && type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR))
90
		{
95
		{
Lines 122-127 Link Here
122
127
123
	public String getParentPath()
128
	public String getParentPath()
124
	{
129
	{
130
		if (_element.getName() == null) {
131
			// file was deleted on the host
132
			return null;
133
		}
125
		String type = _element.getType();
134
		String type = _element.getType();
126
		if (type != null && type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR))
135
		if (type != null && type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR))
127
		{
136
		{
Lines 192-197 Link Here
192
	{
201
	{
193
		String parentPath = _element.getValue();
202
		String parentPath = _element.getValue();
194
		String name = _element.getName();
203
		String name = _element.getName();
204
		if (name == null) {
205
			// file was deleted on the host
206
			return false;
207
		}
195
		if (parentPath == null || 
208
		if (parentPath == null || 
196
				parentPath.length() == 0 || 
209
				parentPath.length() == 0 || 
197
				(name.length() == 0 && (parentPath.equals("/") || parentPath.endsWith(":\\")) || //$NON-NLS-1$ //$NON-NLS-2$
210
				(name.length() == 0 && (parentPath.equals("/") || parentPath.endsWith(":\\")) || //$NON-NLS-1$ //$NON-NLS-2$
Lines 210-218 Link Here
210
	public boolean isFile()
223
	public boolean isFile()
211
	{
224
	{
212
		String type = _element.getType();
225
		String type = _element.getType();
213
		if (type != null && type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR)
226
		if (type != null && (type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR)
214
				|| type.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR)
227
				|| type.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR)
215
				|| type.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR))
228
				|| type.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR)))
216
		{
229
		{
217
			return true;
230
			return true;
218
		}
231
		}
(-)miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/ArchiveQueryThread.java (-56 / +72 lines)
Lines 10-15 Link Here
10
 * 
10
 * 
11
 * Contributors:
11
 * Contributors:
12
 * {Name} (company) - description of contribution.
12
 * {Name} (company) - description of contribution.
13
 * Kevin Doyle (IBM) - [191548] Deleting Read-Only directory removes it from view and displays no error
13
 ********************************************************************************/
14
 ********************************************************************************/
14
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
15
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
15
16
Lines 114-120 Link Here
114
					virtualPath = avp.getVirtualPart();
115
					virtualPath = avp.getVirtualPart();
115
					fileobj = new File(rootPath);
116
					fileobj = new File(rootPath);
116
117
117
					if (fileobj.exists()) {
118
					if (fileobj.exists() && mgr.getVirtualObject(path).exists()) {
118
119
119
						if (_foldersOnly) {
120
						if (_foldersOnly) {
120
							children = mgr.getFolderContents(fileobj,
121
							children = mgr.getFolderContents(fileobj,
Lines 132-137 Link Here
132
						if (isCancelled())
133
						if (isCancelled())
133
							return;
134
							return;
134
					} else {
135
					} else {
136
						// Update the properties so the file's exists() will return false
137
						_subject.setAttribute(DE.A_TYPE, IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR);
138
						_subject.setAttribute(DE.A_SOURCE, setProperties(fileobj));
139
						_status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED_WITH_DOES_NOT_EXIST);	
140
						
141
						// Update all the children showing that they are deleted.
142
						if (_subject.getNestedSize() > 0)
143
						{
144
							List nestedChildren = _subject.getNestedData();
145
							for (int i = nestedChildren.size() - 1; i >= 0; i--)
146
							{
147
								_dataStore.deleteObject(_subject, (DataElement) nestedChildren.get(i));
148
							}					
149
						}
135
						_dataStore.trace("problem with File:" + rootPath); //$NON-NLS-1$
150
						_dataStore.trace("problem with File:" + rootPath); //$NON-NLS-1$
136
					}
151
					}
137
				}
152
				}
Lines 226-288 Link Here
226
		// Check if the current Objects in the DataStore are valid... exist
241
		// Check if the current Objects in the DataStore are valid... exist
227
		// on the remote host
242
		// on the remote host
228
		try {
243
		try {
229
			boolean found = false;
244
			if (list != null) {
230
			for (int j = 0; j < list.length; ++j) {
245
				boolean found = false;
231
				if (isCancelled())
246
				for (int j = 0; j < list.length; ++j) {
232
					return;
247
					if (isCancelled())
233
				
248
						return;
234
				found = false;
249
					
235
				DataElement previousElement = (DataElement) filteredChildren
250
					found = false;
236
						.get(list[j].name);
251
					DataElement previousElement = (DataElement) filteredChildren
237
				if (previousElement != null && !previousElement.isDeleted()) {
252
							.get(list[j].name);
238
					// Type have to be equal as well
253
					if (previousElement != null && !previousElement.isDeleted()) {
239
					String type = previousElement.getType();
254
						// Type have to be equal as well
240
					boolean isfile = !list[j].isDirectory;
255
						String type = previousElement.getType();
241
					if (type
256
						boolean isfile = !list[j].isDirectory;
242
							.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR)
257
						if (type
243
							|| (type
258
								.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR)
244
									.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR) && !isfile)) {
259
								|| (type
245
						filteredChildren.remove(list[j].name);
260
										.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR) && !isfile)) {
246
						found = true;
261
							filteredChildren.remove(list[j].name);
262
							found = true;
263
						}
247
					}
264
					}
248
				}
265
					DataElement deObj = null;
249
				DataElement deObj = null;
266
					VirtualChild child = list[j];
250
				VirtualChild child = list[j];
267
	
251
268
					if (found) {
252
				if (found) {
269
						deObj = previousElement;
253
					deObj = previousElement;
254
				}
255
				if (deObj == null) {
256
					if (child.isDirectory) {
257
						deObj = _dataStore
258
								.createObject(
259
										subject,
260
										IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR,
261
										child.name);
262
					} else // file
263
					{
264
						deObj = _dataStore
265
								.createObject(
266
										subject,
267
										IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR,
268
										child.name);
269
					}
270
					}
270
271
					if (deObj == null) {
271
				}
272
						if (child.isDirectory) {
272
				String oldValue = deObj.getAttribute(DE.A_VALUE);
273
							deObj = _dataStore
273
				String newValue = rootPath
274
									.createObject(
274
						+ ArchiveHandlerManager.VIRTUAL_SEPARATOR + virtualPath;
275
											subject,
275
				if (!oldValue.equals(newValue)) {
276
											IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR,
276
					deObj.setAttribute(DE.A_VALUE, newValue);
277
											child.name);
277
				}
278
						} else // file
278
				String oldSource = deObj.getAttribute(DE.A_SOURCE);
279
						{
279
				String newSource = setProperties(child);
280
							deObj = _dataStore
280
				if (!oldSource.startsWith(newSource)) {
281
									.createObject(
281
					deObj.setAttribute(DE.A_SOURCE, newSource);
282
											subject,
282
				}
283
											IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR,
283
284
											child.name);
284
			} // end for j
285
						}
285
286
	
287
					}
288
					String oldValue = deObj.getAttribute(DE.A_VALUE);
289
					String newValue = rootPath
290
							+ ArchiveHandlerManager.VIRTUAL_SEPARATOR + virtualPath;
291
					if (!oldValue.equals(newValue)) {
292
						deObj.setAttribute(DE.A_VALUE, newValue);
293
					}
294
					String oldSource = deObj.getAttribute(DE.A_SOURCE);
295
					String newSource = setProperties(child);
296
					if (!oldSource.startsWith(newSource)) {
297
						deObj.setAttribute(DE.A_SOURCE, newSource);
298
					}
299
	
300
				} // end for j
301
			}
286
			// Object left over in the filteredChildren is no longer in the
302
			// Object left over in the filteredChildren is no longer in the
287
			// system any more. Need to remove.
303
			// system any more. Need to remove.
288
			Iterator myIterator = filteredChildren.keySet().iterator();
304
			Iterator myIterator = filteredChildren.keySet().iterator();

Return to bug 191548