Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 320322 - [validation] JSP source validators running even when respective batch validators have been turned off
Summary: [validation] JSP source validators running even when respective batch validat...
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: jst.jsp (show other bugs)
Version: 3.0.5   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.0.5 P   Edit
Assignee: Ian Tewksbury CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 320324
  Show dependency tree
 
Reported: 2010-07-19 16:44 EDT by Ian Tewksbury CLA
Modified: 2010-08-16 14:21 EDT (History)
1 user (show)

See Also:
thatnitind: review+


Attachments
Fix Patch (3.04 KB, patch)
2010-07-19 16:46 EDT, Ian Tewksbury CLA
no flags Details | Diff
Fix Patch - Update 1 (5.08 KB, patch)
2010-07-19 18:11 EDT, Ian Tewksbury CLA
no flags Details | Diff
updated patch (4.42 KB, patch)
2010-07-21 23:09 EDT, Nitin Dahyabhai CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Tewksbury CLA 2010-07-19 16:44:36 EDT
Even if he JSP Content Validator and JSP Syntax Validator (both batch validators) are turned off using the Validation preferences page the source validators that those batch validators use are still run as you type.

The problem here is a disconnect between batch validators and source validators and the enablement of the batch validators.  The ValiatorStrategy checks for the enablement of the batch validators to determine which source validators are enabled but because there is currently no relation between the JSP batch validators and the source validators the ValidatorStrategy never sees the JSP source validators as disabled.

The fix for this problem is two fold.  First use the existing "sourceid" filed on the batch validator extension point to list all of the source validators related to a given batch validator.  In the case of JSP the relations are as follows:

JSPBatchValidator:
* JSPDirectiveValidator - org.eclipse.jst.jsp.tldsourcevalidator
* JSPELValidator - org.eclipse.jst.jsp.jspelsourcevalidator
* JSPJavaValidator - org.eclipse.jst.jsp.jspsourcevalidator
* JSPActionValidator - org.eclipse.jst.jsp.ui.internal.validation.jspactionvalidator

JSPContentValidator:
* JSPMarkupValidator - org.eclipse.jst.jsp.ui.internal.validation.markupvalidator
* JSPContentSourceValidator - org.eclipse.jst.jsp.ui.internal.validation.htmlsyntaxvalidator
* * this is actually a special case because strictly speeking the JSPContentValidator batch validator does not use the JSPContentSourceValidator but the JSPContentSourceValidator is itself checking the enablement of the JSPContentValidator batch validator to determine if its enabled thus establishment a pre-existing relationship between this source validator and this batch validator. The problem with the existing implementation of the relationship is that the JSPContentSourceValidator only checks the enablement of the JSPContentValidator batch validator on document connect which means if the enablement of the JSPContentValidator batch validator changes while a JSP document is open the JSPContentSourceValidator  will stay enabled.  Thus adding this relationship will ensure the JSPContentSourceValidator never runs if the JSPContentValidator batch validator is disabled.

The second fix that is needed is to update ValidatorStrategy to read the "sourceid" field of the batch validators as a comma separated value rather then as a single ID so that multiple source validators can be related to a single batch validator.  This is simply done using existing utility methods.

Patch to follow.
Comment 1 Ian Tewksbury CLA 2010-07-19 16:46:20 EDT
Created attachment 174673 [details]
Fix Patch

Patch as described in bug description.
Comment 2 Ian Tewksbury CLA 2010-07-19 18:11:03 EDT
Created attachment 174685 [details]
Fix Patch - Update 1

Add check to see if validation is even enabled as per Nitin request.
Comment 3 Nitin Dahyabhai CLA 2010-07-21 23:09:00 EDT
Created attachment 174938 [details]
updated patch

Attaching a replacement for Ian's updated patch.  It removes stray sysouts that were left in, a pair of redundant validation framework calls, and one whose return value isn't even used.
Comment 4 Ian Tewksbury CLA 2010-07-22 08:14:15 EDT
(In reply to comment #3)
> Created an attachment (id=174938) [details]
> updated patch
> 
> Attaching a replacement for Ian's updated patch.  It removes stray sysouts that
> were left in, a pair of redundant validation framework calls, and one whose
> return value isn't even used.

Mrrrg, Sorry about that.
Comment 5 Carl Anderson CLA 2010-07-27 08:21:56 EDT
Committed to R3_0_5_patches
Comment 6 Ian Tewksbury CLA 2010-08-16 14:21:25 EDT
(In reply to comment #5)
> Committed to R3_0_5_patches

Just an FYI the fix for 3.2.x and 3.3 is tracked by Bug 320325