1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-02 13:13:36 +02:00

[250168] update to just search file of canonical paths (not symbolic links)

This commit is contained in:
David McKnight 2008-11-26 16:29:59 +00:00
parent 49111998de
commit 633bd9be7a

View file

@ -19,7 +19,8 @@
* Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients * Noriaki Takatsu (IBM) - [220126] [dstore][api][breaking] Single process server for multiple clients
* Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers * Martin Oberhuber (Wind River) - [199854][api] Improve error reporting for archive handlers
* David McKnight (IBM) - [250168] handle malformed binary and always resolve canonical paths * David McKnight (IBM) - [250168] handle malformed binary and always resolve canonical paths
*******************************************************************************/ * David McKnight (IBM) - [250168] update to just search file of canonical paths (not symbolic links)
********************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem; package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@ -132,12 +133,12 @@ public class UniversalSearchHandler extends SecuredThread implements ICancellabl
_miner.statusCancelled(_status); _miner.statusCancelled(_status);
} }
else { else {
_alreadySearched.clear();
// previously, the status would be set to done immediately because search results were sent // previously, the status would be set to done immediately because search results were sent
// back to the client as they arrived. Now, the search handler wait until the search has // back to the client as they arrived. Now, the search handler wait until the search has
// completed before setting the status to done // completed before setting the status to done
_status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$ _status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$
_dataStore.refresh(_status); // true indicates refresh immediately _dataStore.refresh(_status); // true indicates refresh immediately
} }
} }
@ -157,13 +158,10 @@ public class UniversalSearchHandler extends SecuredThread implements ICancellabl
{ {
boolean result = false; boolean result = false;
try { try {
File canonicalFile = file.getCanonicalFile(); String canonicalPath = file.getCanonicalPath();
// if it's not a symbolic link - if not, we always search it
if (!file.getAbsolutePath().equals(canonicalFile.getAbsolutePath())){
// check whether it's already been searched // check whether it's already been searched
result = _alreadySearched.contains(canonicalFile); result = _alreadySearched.contains(canonicalPath);
}
} }
catch (IOException e){ catch (IOException e){
_dataStore.trace(e); _dataStore.trace(e);
@ -175,19 +173,18 @@ public class UniversalSearchHandler extends SecuredThread implements ICancellabl
protected void internalSearch(File theFile, int depth) throws SystemMessageException { protected void internalSearch(File theFile, int depth) throws SystemMessageException {
if (theFile.isFile() || !hasSearched(theFile)) { if (!hasSearched(theFile)) {
boolean isDirectory = theFile.isDirectory();
if (isDirectory){
try { try {
_alreadySearched.add(theFile.getCanonicalFile()); _alreadySearched.add(theFile.getCanonicalPath());
} }
catch (Exception e){ catch (Exception e){
_alreadySearched.add(theFile); _alreadySearched.add(theFile.getAbsolutePath());
_dataStore.trace(e); _dataStore.trace(e);
} }
}
boolean isDirectory = theFile.isDirectory();
// is it an archive? // is it an archive?
boolean isArchive = ArchiveHandlerManager.getInstance().isArchive(theFile); boolean isArchive = ArchiveHandlerManager.getInstance().isArchive(theFile);
@ -330,7 +327,6 @@ public class UniversalSearchHandler extends SecuredThread implements ICancellabl
if (children != null) { if (children != null) {
for (int i = 0; i < children.length && !_isCancelled; i++) { for (int i = 0; i < children.length && !_isCancelled; i++) {
File child = children[i]; File child = children[i];
internalSearch(child, depth - 1); internalSearch(child, depth - 1);
} }