Bug 323392 - [index] IndexbinaryFolder removing JSP translations from index because their in memory CompliationUnits no longer exist
Summary: [index] IndexbinaryFolder removing JSP translations from index because their ...
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M2   Edit
Assignee: Satyam Kandula CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-23 10:41 EDT by Ian Tewksbury CLA
Modified: 2010-09-13 08:10 EDT (History)
5 users (show)

See Also:


Attachments
Patch to test (954 bytes, patch)
2010-08-25 11:25 EDT, Satyam Kandula CLA
no flags Details | Diff
SSE/JSP Patch needed to reproduce the problem (142.91 KB, patch)
2010-09-01 08:23 EDT, Ian Tewksbury CLA
no flags Details | Diff
Sample Project (4.33 KB, application/octet-stream)
2010-09-01 08:33 EDT, Ian Tewksbury CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Tewksbury CLA 2010-08-23 10:41:46 EDT
Admittedly this is not so much a bug as something JSP would very much appreciate some sort of assistance with.

Now that Bug 308402 is fixed when loading an existing Eclipse workspace the index files specified by our SearchParticipant are now loaded by the JDT index.  These index files are of the Java translations of JSP files.  The problem is these translations never exist on disk, we simply create in memory CompilcationUnits representing the Java translations of the JSP documents and add those to the JDT index through our SearchParticipant.  The problem is after closing the workspace these in memory CUs no longer exist.  Then when the workspace is opened again JDT finds our index files and then checks to see if the files that were indexed there still exist, they don't because they never really existed they were only ever in memory.

Is there any way to prevent this, short of changing the way we do things and actually save our JSP Java translations to disk so that the JDT index doesn't think they have disappeared?

More discussion on this can be found starting in Bug 308402 comment 32 and continuing to Bug 308402 comment 34
Comment 1 Srikanth Sankaran CLA 2010-08-23 22:16:49 EDT
Satyam, please investigate, Thanks.
Comment 2 Satyam Kandula CLA 2010-08-25 11:23:51 EDT
I am probably mistaken in my last analysis. The index states is not updated properly and hence next time a file is getting scheduled, the index manager tries to reindex and hence things seem to go bad.
Comment 3 Satyam Kandula CLA 2010-08-25 11:25:29 EDT
Created attachment 177432 [details]
Patch to test

Ian, Can you please see if this patch helps?
Comment 4 Ian Tewksbury CLA 2010-08-30 10:54:20 EDT
(In reply to comment #3)
> Created an attachment (id=177432) [details]
> Patch to test
> 
> Ian, Can you please see if this patch helps?

Unfortunately this patch does not seem to make any difference.  After opening the workspace again our index file contains the information about the JSP but then as soon as I invoke a search the index file gets emptied of any information about the JSP translation.

Any other ideas?
Comment 5 Satyam Kandula CLA 2010-09-01 08:01:27 EDT
Can you please give me a sample dynamic web project so that I can reproduce the problem easily?
Comment 6 Ian Tewksbury CLA 2010-09-01 08:23:52 EDT
Created attachment 177941 [details]
SSE/JSP Patch needed to reproduce the problem

(In reply to comment #5)
> Can you please give me a sample dynamic web project so that I can reproduce the
> problem easily?

Unfortunately I need to give you more then just a project to be able to reproduce this.  You will need to load a patch into your workspace for our JSP plugins to get our plugins to a state where this is actually reproducible.  I am attaching the patch you would need to load up.  The plugins from the R3_2_maintenance stream you will need in your workspace to apply the patch are:

org.eclipse.jst.jsp.core
org.eclipse.jst.jsp.ui
org.eclipse.wst.sse.core

I will attach a sample project as well.
Comment 7 Ian Tewksbury CLA 2010-09-01 08:33:46 EDT
Created attachment 177942 [details]
Sample Project

This is a sample project you can use to reproduce the problem.

Steps:
1. import the project

2. do a references search on the "neto" method defined in class "foo.Awesome"

3. One result in the "fooy.jsp" page should be found

4. close the workspace (if you have the JSP file open be sure to close it before closing the workspace), then open it again

5. take a look at "[path_to_workspace]/.metadata\.plugins\org.eclipse.jst.jsp.core\jspsearch", there will be one *.index file in there. If you open it up you can see there is index information in there for the one JSP in the project, close the *.index file

6. perform the search again

7. no results will be found (should have found it in the JSP again)

8. open the *.index file again, you will see its contents have been whipped clean
Comment 8 Satyam Kandula CLA 2010-09-02 08:55:37 EDT
This is because of the call JavaModelManager.getIndexManager().indexLocations.put() in JSPSearchSupport#computeIndexLocation(). It looks like it works if this call is removed. Can you verify?
Comment 9 Ian Tewksbury CLA 2010-09-02 09:23:16 EDT
(In reply to comment #8)
> This is because of the call
> JavaModelManager.getIndexManager().indexLocations.put() in
> JSPSearchSupport#computeIndexLocation(). It looks like it works if this call is
> removed. Can you verify?

You rock.  That call was in there from the old days when Bug 308402 wasn't fixed and we were trying to work around it, unsuccessfully.

Thank you very much working through both this and Bug 308402 with me, it has been much appreciated.

Closing this as invalid.
Comment 10 Ayushman Jain CLA 2010-09-13 08:10:23 EDT
Verified for 3.7M2