Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 339322

Summary: [validation] Chaotic problem markers in one file if other has real problems
Product: [WebTools] WTP Source Editing Reporter: Evgeniy Karyakin <anthropophagite>
Component: jst.jspAssignee: Salvador Zalapa <zalapa>
Status: CLOSED WORKSFORME QA Contact: Nick Sandonato <nsand.dev>
Severity: normal    
Priority: P3 CC: thatnitind
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
Example JSP screenshot
none
Example INC screenshot
none
Example JSP source code
none
Example INC source code
none
Another screenshot with pop-up message
none
Simple project as complement to the last message
none
Simple project as an example none

Description Evgeniy Karyakin CLA 2011-03-09 02:54:58 EST
Build Identifier: 20110218-0911

Freshly opened JSP file without any problems (either syntax errors or static code analysis results) suddenly become marked with huge amount of errors if another file opened, be it JSP or .inc include file.
I must say that my workspace is set to treat .inc files as real JSP pages when in reality they're not.
Worst situation happens with moderately complex files with many java code inclusions, JSP "include" directives, inter-file variables declarations and so on. I can't attach that files, but have two screenshots to describe what I see. Simple example JSP and include files are attached though, which performs relatively better but still erroneously.

Reproducible: Always

Steps to Reproduce:
1. Open JSP which has or has no syntax/static analysis errors (on 1st screenshot it's ByPersonRequestCreate.jsp).
2. Open INC file which has errors (on 2nd screenshot it's Service_providers.inc). See errors highlighted with red where they shouldn't be.
3. Switch back to 1st JSP file and see problem reports appeared in unexpected places (demonstration: screenshot only).

Better but still unacceptable:
1. Open attached Eclipse_bug_JSP.jsp. No errors.
2. Open attached Eclipse_bug_INC.inc. Two errors.
3. Switch to JSP file and change anything, add space somewhere. Switch to INC and see errors still there.
4. Switch to JSP file and change anything again or even don't do anything. Switch again to INC and see that errors disappeared.
Comment 1 Evgeniy Karyakin CLA 2011-03-09 02:56:07 EST
Created attachment 190730 [details]
Example JSP screenshot
Comment 2 Evgeniy Karyakin CLA 2011-03-09 02:56:52 EST
Created attachment 190731 [details]
Example INC screenshot
Comment 3 Evgeniy Karyakin CLA 2011-03-09 02:57:16 EST
Created attachment 190732 [details]
Example JSP source code
Comment 4 Evgeniy Karyakin CLA 2011-03-09 02:58:03 EST
Created attachment 190733 [details]
Example INC source code
Comment 5 Evgeniy Karyakin CLA 2011-03-09 03:01:47 EST
Eclipse version is latest Helios SR2 distribution downloaded few days before.
Comment 6 Nick Sandonato CLA 2011-03-09 10:23:53 EST
Hi Evgeniy,

I'm having trouble reproducing this with your sample files. So I have a few questions.

1. Is validation of JSP fragments enabled (Window > Preferences | Web > JSP Files > Validation "Validate JSP Fragments")? Validation of fragments is not aware of the context in which the fragments are used as this can be extremely messy to figure out. Disabling this should remove the errors from your fragments (assuming .inc is associated with the JSP Fragment content type and not JSP).

2. What are the messages behind the Errors that you see? Are they the same errors as reported in the .inc file?

3. Do you have any other configuration that I may need to take into account? Maybe a sample project might be useful.

Thanks.
Comment 7 Evgeniy Karyakin CLA 2011-03-10 02:23:42 EST
So, I started with fresh workspace, made simple Java project, threw servlet.jar there (Eclipse complained about its absence) and put those 2 example files in.
No settings were changes except switching off network connections so Eclipse won't nag me with proxy login/password dialogue.

Steps:
1. Open JSP file. No errors.
2. Open INC file. Two errors.
3. Switch back to JSP. Change anything (add space somewhere).
4. Switch to INC. Errors stays for a second, then disappear instantly in front of my eyes.

I tried associate INC files with either "JSP" or "JSP fragment" content type without any difference.
Switching off JSP fragments validation solves this problem, but this INC file is not a JSP fragments technology, just a bunch of HTML/JSP mess to be included when needed.

Returning to original bug "problem markers in one file if other has real problems", yes, those unexpected errors in JSP have descriptions saying that they originating from INC files, for example, "ksd cannot be resolved" message in JSP has its roots in real problem in INC. See last PNG attached: on line 13 the message "ServiceDto cannot be resolved to a type" is really INC problem, not JSP. In JSP, ServiceDto is imported properly, see line 6.

It seems like all this mess caused by moderately complex project structure. Simple project attached.
Comment 8 Evgeniy Karyakin CLA 2011-03-10 02:25:00 EST
Created attachment 190822 [details]
Another screenshot with pop-up message
Comment 9 Evgeniy Karyakin CLA 2011-03-10 02:26:50 EST
Created attachment 190823 [details]
Simple project as complement to the last message
Comment 10 Nitin Dahyabhai CLA 2011-03-17 00:51:12 EDT
Any chance you could reattach that in a more conventional format, like one supported by the Archive Export wizard?
Comment 11 Evgeniy Karyakin CLA 2011-03-17 06:22:46 EDT
Created attachment 191397 [details]
Simple project as an example

Created with "File" -> "Export..." -> "Archive file" feature.
Comment 12 Evgeniy Karyakin CLA 2012-02-06 08:07:43 EST
Still having these and similar other chaotic "problems" in Indigo (build id 20110916-0149). They are too difficult to describe by words, shortly saying: if one JSP has real problems, another opened JSP has some markers placed randomly *near* places where there are real errors on another file.
Comment 13 Salvador Zalapa CLA 2013-05-08 15:32:05 EDT
Hello Evgeniy :

I already was able to reproduce the problem you mentioned. The behavior you are pointing is this:

The errors from indirectly referenced files (e.g. you .inc file used in the include directive) are being showed in the main page, even if that main does not have explicit errors. am i correct?

This is working as design since once the translation takes place. The way to avoid this behavior is to switching off JSP fragments validation, and add the .inc content type as JSP and as JSP Fragment as well. With this configuration you will get the behavior you desire.
Comment 14 Salvador Zalapa CLA 2013-06-05 09:18:48 EDT
It has been a month since I provide the information without any response, i am resolving this defect.
Comment 15 Evgeniy Karyakin CLA 2013-06-06 01:57:40 EDT
Yes, Salvador, I think this issue is resolved, please close it.
Comment 16 Salvador Zalapa CLA 2013-06-06 08:36:48 EDT
Thanks Evgeniy