1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-08 17:45:24 +02:00

Bug 147792 - patch to put an end to circular searches

This commit is contained in:
David Dykstal 2006-06-20 21:38:20 +00:00
parent b761dbbd49
commit 5272f66d8d
3 changed files with 38 additions and 6 deletions

View file

@ -145,9 +145,18 @@ public class UniversalSearchHandler extends Thread implements ICancellableHandle
_isCancelled = true; _isCancelled = true;
} }
protected boolean hasSearchedDirectory(File file) { protected boolean hasSearchedDirectory(File file)
{
try
{
return _alreadySearched.contains(file.getCanonicalFile());
}
catch (IOException e)
{
_dataStore.trace(e);
return _alreadySearched.contains(file); return _alreadySearched.contains(file);
} }
}
protected void internalSearch(File theFile, int depth) { protected void internalSearch(File theFile, int depth) {
@ -256,7 +265,15 @@ public class UniversalSearchHandler extends Thread implements ICancellableHandle
if (!hasSearchedDirectory(theFile)) { if (!hasSearchedDirectory(theFile)) {
try
{
_alreadySearched.add(theFile.getCanonicalFile());
}
catch (IOException e)
{
_dataStore.trace(e);
_alreadySearched.add(theFile); _alreadySearched.add(theFile);
}
File[] children = null; File[] children = null;

View file

@ -173,9 +173,16 @@ public class LocalSearchHandler implements ISearchHandler
} }
private boolean hasSearchedDirectory(File file) private boolean hasSearchedDirectory(File file)
{
try
{
return _alreadySearched.contains(file.getCanonicalFile());
}
catch (IOException e)
{ {
return _alreadySearched.contains(file); return _alreadySearched.contains(file);
} }
}
private boolean internalSearch(File theFile, int depth, IHostFile context) private boolean internalSearch(File theFile, int depth, IHostFile context)
{ {
@ -306,7 +313,14 @@ public class LocalSearchHandler implements ISearchHandler
if (!hasSearchedDirectory(theFile)) if (!hasSearchedDirectory(theFile))
{ {
try
{
_alreadySearched.add(theFile.getCanonicalFile());
}
catch (IOException e)
{
_alreadySearched.add(theFile); _alreadySearched.add(theFile);
}
File[] children = null; File[] children = null;

View file

@ -979,7 +979,8 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
for (int i = 0; i < folderOrFileNames.size(); i++) for (int i = 0; i < folderOrFileNames.size(); i++)
{ {
String path = (String)folderOrFileNames.get(i); String path = (String)folderOrFileNames.get(i);
results.addResource(getRemoteFileObject(path)); IRemoteFile nextFile = getRemoteFileObject(path);
if (nextFile != null) results.addResource(nextFile);
} }
return results; return results;
} }