From e6cc7c220e833287bd1744a7cf19d4ee44d4dbd7 Mon Sep 17 00:00:00 2001 From: Mike Kucera Date: Thu, 25 Jun 2009 21:43:26 +0000 Subject: [PATCH] [281415] StandaloneIndexerInputAdapter.resolveIncludeFile() does not check that the include file exists --- .../core/indexer/StandaloneIndexerInputAdapter.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerInputAdapter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerInputAdapter.java index b80d8668208..f35f86c6208 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerInputAdapter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerInputAdapter.java @@ -21,6 +21,7 @@ import org.eclipse.cdt.core.parser.CodeReader; import org.eclipse.cdt.core.parser.IScannerInfo; import org.eclipse.cdt.internal.core.index.IndexFileLocation; import org.eclipse.cdt.internal.core.pdom.IndexerInputAdapter; +import org.eclipse.cdt.internal.core.pdom.indexer.FileExistsCache; import org.eclipse.core.filesystem.URIUtil; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; @@ -30,8 +31,9 @@ import org.eclipse.core.runtime.Path; * @since 5.0 */ public class StandaloneIndexerInputAdapter extends IndexerInputAdapter { - private HashMap fIflCache= new HashMap(); - + private final HashMap fIflCache= new HashMap(); + private final FileExistsCache fExistsCache = new FileExistsCache(); + private final StandaloneIndexer fIndexer; public StandaloneIndexerInputAdapter(StandaloneIndexer indexer) { @@ -87,11 +89,14 @@ public class StandaloneIndexerInputAdapter extends IndexerInputAdapter { @Override public boolean doesIncludeFileExist(String includePath) { - return new File(includePath).isFile(); + return fExistsCache.isFile(includePath); } @Override public IIndexFileLocation resolveIncludeFile(String includePath) { + if (!fExistsCache.isFile(includePath)) { + return null; + } IIndexFileLocation result= fIflCache.get(includePath); if (result == null) { File file= new File(includePath);