### Eclipse Workspace Patch 1.0 #P org.eclipse.rse.services.dstore Index: miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java,v retrieving revision 1.21 diff -u -r1.21 UniversalFileSystemMiner.java --- miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java 11 Aug 2007 03:26:56 -0000 1.21 +++ miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java 17 Aug 2007 19:48:14 -0000 @@ -2123,7 +2123,7 @@ .getRegisteredHandler(new File(vpath .getContainingArchiveString())); if (handler == null || !handler.delete(vpath.getVirtualPart())) { - status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED); + status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED + "|" + vpath.toString()); //$NON-NLS-1$ _dataStore.refresh(subject); return statusDone(status); } Index: src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java,v retrieving revision 1.16 diff -u -r1.16 DStoreFileService.java --- src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java 11 Aug 2007 03:26:56 -0000 1.16 +++ src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java 17 Aug 2007 19:48:14 -0000 @@ -929,7 +929,10 @@ DataElement de = getElementFor(remotePath); DataElement status = dsStatusCommand(de, IUniversalDataStoreConstants.C_DELETE, monitor); if (status == null) return false; - if (FileSystemMessageUtil.getSourceMessage(status).equals(IServiceConstants.SUCCESS)) { + String sourceMsg = FileSystemMessageUtil.getSourceMessage(status); + // When running a server older than 2.0.1 success is not set for directories, so we must + // check if the source message is an empty string + if (sourceMsg.equals(IServiceConstants.SUCCESS) || sourceMsg.equals("")) { //$NON-NLS-1$ return true; } else { throw new SystemMessageException(getMessage("RSEF1300").makeSubstitution(FileSystemMessageUtil.getSourceLocation(status))); //$NON-NLS-1$ @@ -949,7 +952,10 @@ } DataElement status = dsStatusCommand((DataElement) dataElements.get(0), dataElements, IUniversalDataStoreConstants.C_DELETE_BATCH, monitor); if (status == null) return false; - if (FileSystemMessageUtil.getSourceMessage(status).equals(IServiceConstants.SUCCESS)) { + String sourceMsg = FileSystemMessageUtil.getSourceMessage(status); + // When running a server older than 2.0.1 success is not set for directories, so we must + // check if the source message is an empty string + if (sourceMsg.equals(IServiceConstants.SUCCESS) || sourceMsg.equals("")) { //$NON-NLS-1$ return true; } else { throw new SystemMessageException(getMessage("RSEF1300").makeSubstitution(FileSystemMessageUtil.getSourceLocation(status))); //$NON-NLS-1$ Index: src/org/eclipse/rse/internal/services/dstore/files/DStoreHostFile.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreHostFile.java,v retrieving revision 1.11 diff -u -r1.11 DStoreHostFile.java --- src/org/eclipse/rse/internal/services/dstore/files/DStoreHostFile.java 24 Jul 2007 19:18:47 -0000 1.11 +++ src/org/eclipse/rse/internal/services/dstore/files/DStoreHostFile.java 17 Aug 2007 19:48:14 -0000 @@ -15,6 +15,7 @@ * {Name} (company) - description of contribution. * Xuan Chen (IBM) - [189041] incorrect file name after rename a file inside a zip file - DStore Windows * Xuan Chen (IBM) - [187548] Editor shows incorrect file name after renaming file on Linux dstore + * Kevin Doyle (IBM) - [191548] Various NPE fixes *******************************************************************************/ package org.eclipse.rse.internal.services.dstore.files; @@ -85,6 +86,10 @@ public String getName() { + if (_element.getName() == null) { + // file was deleted on the host + return null; + } String type = _element.getType(); if (type != null && type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR)) { @@ -122,6 +127,10 @@ public String getParentPath() { + if (_element.getName() == null) { + // file was deleted on the host + return null; + } String type = _element.getType(); if (type != null && type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR)) { @@ -192,6 +201,10 @@ { String parentPath = _element.getValue(); String name = _element.getName(); + if (name == null) { + // file was deleted on the host + return false; + } if (parentPath == null || parentPath.length() == 0 || (name.length() == 0 && (parentPath.equals("/") || parentPath.endsWith(":\\")) || //$NON-NLS-1$ //$NON-NLS-2$ @@ -210,9 +223,9 @@ public boolean isFile() { String type = _element.getType(); - if (type != null && type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR) + if (type != null && (type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR) || type.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR) - || type.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR)) + || type.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR))) { return true; } Index: miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/ArchiveQueryThread.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/ArchiveQueryThread.java,v retrieving revision 1.1 diff -u -r1.1 ArchiveQueryThread.java --- miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/ArchiveQueryThread.java 9 Jul 2007 17:59:35 -0000 1.1 +++ miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/ArchiveQueryThread.java 17 Aug 2007 19:48:14 -0000 @@ -10,6 +10,7 @@ * * Contributors: * {Name} (company) - description of contribution. + * Kevin Doyle (IBM) - [191548] Deleting Read-Only directory removes it from view and displays no error ********************************************************************************/ package org.eclipse.rse.internal.dstore.universal.miners.filesystem; @@ -114,7 +115,7 @@ virtualPath = avp.getVirtualPart(); fileobj = new File(rootPath); - if (fileobj.exists()) { + if (fileobj.exists() && mgr.getVirtualObject(path).exists()) { if (_foldersOnly) { children = mgr.getFolderContents(fileobj, @@ -132,6 +133,20 @@ if (isCancelled()) return; } else { + // Update the properties so the file's exists() will return false + _subject.setAttribute(DE.A_TYPE, IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR); + _subject.setAttribute(DE.A_SOURCE, setProperties(fileobj)); + _status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED_WITH_DOES_NOT_EXIST); + + // Update all the children showing that they are deleted. + if (_subject.getNestedSize() > 0) + { + List nestedChildren = _subject.getNestedData(); + for (int i = nestedChildren.size() - 1; i >= 0; i--) + { + _dataStore.deleteObject(_subject, (DataElement) nestedChildren.get(i)); + } + } _dataStore.trace("problem with File:" + rootPath); //$NON-NLS-1$ } } @@ -226,63 +241,64 @@ // Check if the current Objects in the DataStore are valid... exist // on the remote host try { - boolean found = false; - for (int j = 0; j < list.length; ++j) { - if (isCancelled()) - return; - - found = false; - DataElement previousElement = (DataElement) filteredChildren - .get(list[j].name); - if (previousElement != null && !previousElement.isDeleted()) { - // Type have to be equal as well - String type = previousElement.getType(); - boolean isfile = !list[j].isDirectory; - if (type - .equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR) - || (type - .equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR) && !isfile)) { - filteredChildren.remove(list[j].name); - found = true; + if (list != null) { + boolean found = false; + for (int j = 0; j < list.length; ++j) { + if (isCancelled()) + return; + + found = false; + DataElement previousElement = (DataElement) filteredChildren + .get(list[j].name); + if (previousElement != null && !previousElement.isDeleted()) { + // Type have to be equal as well + String type = previousElement.getType(); + boolean isfile = !list[j].isDirectory; + if (type + .equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR) + || (type + .equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR) && !isfile)) { + filteredChildren.remove(list[j].name); + found = true; + } } - } - DataElement deObj = null; - VirtualChild child = list[j]; - - if (found) { - deObj = previousElement; - } - if (deObj == null) { - if (child.isDirectory) { - deObj = _dataStore - .createObject( - subject, - IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR, - child.name); - } else // file - { - deObj = _dataStore - .createObject( - subject, - IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR, - child.name); + DataElement deObj = null; + VirtualChild child = list[j]; + + if (found) { + deObj = previousElement; } - - } - String oldValue = deObj.getAttribute(DE.A_VALUE); - String newValue = rootPath - + ArchiveHandlerManager.VIRTUAL_SEPARATOR + virtualPath; - if (!oldValue.equals(newValue)) { - deObj.setAttribute(DE.A_VALUE, newValue); - } - String oldSource = deObj.getAttribute(DE.A_SOURCE); - String newSource = setProperties(child); - if (!oldSource.startsWith(newSource)) { - deObj.setAttribute(DE.A_SOURCE, newSource); - } - - } // end for j - + if (deObj == null) { + if (child.isDirectory) { + deObj = _dataStore + .createObject( + subject, + IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR, + child.name); + } else // file + { + deObj = _dataStore + .createObject( + subject, + IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR, + child.name); + } + + } + String oldValue = deObj.getAttribute(DE.A_VALUE); + String newValue = rootPath + + ArchiveHandlerManager.VIRTUAL_SEPARATOR + virtualPath; + if (!oldValue.equals(newValue)) { + deObj.setAttribute(DE.A_VALUE, newValue); + } + String oldSource = deObj.getAttribute(DE.A_SOURCE); + String newSource = setProperties(child); + if (!oldSource.startsWith(newSource)) { + deObj.setAttribute(DE.A_SOURCE, newSource); + } + + } // end for j + } // Object left over in the filteredChildren is no longer in the // system any more. Need to remove. Iterator myIterator = filteredChildren.keySet().iterator();