Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 118575 Details for
Bug 251504
[index] Wrong indexes may be used while performing a search request
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Final? proposed patch
v04.txt (text/plain), 4.05 KB, created by
Frederic Fusier
on 2008-11-24 05:38:34 EST
(
hide
)
Description:
Final? proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2008-11-24 05:38:34 EST
Size:
4.05 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java,v >retrieving revision 1.75 >diff -u -r1.75 AddJarFileToIndex.java >--- search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java 27 Jun 2008 16:03:49 -0000 1.75 >+++ search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java 24 Nov 2008 10:37:16 -0000 >@@ -179,8 +179,7 @@ > // Index the jar for the first time or reindex the jar in case the previous index file has been corrupted > // index already existed: recreate it so that we forget about previous entries > SearchParticipant participant = SearchEngine.getDefaultSearchParticipant(); >- index = this.manager.recreateIndex(this.containerPath); >- if (index == null) { >+ if (!this.manager.resetIndex(this.containerPath)) { > // failed to recreate index, see 73330 > this.manager.removeIndex(this.containerPath); > return false; >Index: search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java,v >retrieving revision 1.162 >diff -u -r1.162 IndexManager.java >--- search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java 3 Oct 2008 10:47:56 -0000 1.162 >+++ search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java 24 Nov 2008 10:37:16 -0000 >@@ -622,6 +622,35 @@ > this.indexLocations = new SimpleLookupTable(); > this.javaPluginLocation = null; > } >+/** >+ * Resets the index for a given path. >+ * Returns true if the index was reset, false otherwise. >+ */ >+public synchronized boolean resetIndex(IPath containerPath) { >+ // only called to over write an existing cached index... >+ String containerPathString = containerPath.getDevice() == null ? containerPath.toString() : containerPath.toOSString(); >+ try { >+ // Path is already canonical >+ IPath indexLocation = computeIndexLocation(containerPath); >+ Index index = getIndex(indexLocation); >+ if (VERBOSE) { >+ Util.verbose("-> reseting index: "+indexLocation+" for path: "+containerPathString); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ if (index == null) { >+ // the index does not exist, try to recreate it >+ return recreateIndex(containerPath) != null; >+ } >+ index.reset(true/*reuse index file*/); >+ return true; >+ } catch (IOException e) { >+ // The file could not be created. Possible reason: the project has been deleted. >+ if (VERBOSE) { >+ Util.verbose("-> failed to reset index for path: "+containerPathString); //$NON-NLS-1$ >+ e.printStackTrace(); >+ } >+ return false; >+ } >+} > public void saveIndex(Index index) throws IOException { > // must have permission to write from the write monitor > if (index.hasChanged()) { >Index: search/org/eclipse/jdt/internal/core/index/Index.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/Index.java,v >retrieving revision 1.31 >diff -u -r1.31 Index.java >--- search/org/eclipse/jdt/internal/core/index/Index.java 27 Jun 2008 16:04:14 -0000 1.31 >+++ search/org/eclipse/jdt/internal/core/index/Index.java 24 Nov 2008 10:37:16 -0000 >@@ -172,6 +172,16 @@ > public void remove(String containerRelativePath) { > this.memoryIndex.remove(containerRelativePath); > } >+/** >+ * Reset memory and disk indexes. >+ * >+ * @throws IOException >+ */ >+public void reset(boolean reuseExistingFile) throws IOException { >+ this.memoryIndex = new MemoryIndex(); >+ this.diskIndex = new DiskIndex(this.diskIndex.indexFile.getCanonicalPath()); >+ this.diskIndex.initialize(reuseExistingFile); >+} > public void save() throws IOException { > // must own the write lock of the monitor > if (!hasChanged()) return;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 251504
:
118573
|
118574
|
118575
|
118601
|
118611