| Summary: | validators are still being triggered when they use contentTypeBinding | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [WebTools] WTP Common Tools | Reporter: | Amy Wu <for.work.things> | ||||||
| Component: | wst.validation | Assignee: | Gary Karasiuk <karasiuk> | ||||||
| Status: | CLOSED FIXED | QA Contact: | Chuck Bridgham <cbridgha> | ||||||
| Severity: | major | ||||||||
| Priority: | P3 | CC: | ccc, remy.suen, thatnitind | ||||||
| Version: | 2.0 | ||||||||
| Target Milestone: | 3.0.3 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Amy Wu
Created attachment 72088 [details] org.eclipse.wst.validation.patch Fix is in 2 isApplicableTo() methods in ValidatorMetaData. In the first one, isApplicableTo() was checking if there were any filters associated with the validator, if not, then the validator would run on every resource. The fix was not only to check if there were any filters, but also to check if the validator was associated with any content types. If not, then it would run on every resource. But if so, then do further checking. public boolean isApplicableTo(IResource resource, int resourceDelta) { // If no filters are specified, then every type of resource should be // validated/trigger a // rebuild of the model cache // Also make sure no content type id is specified (BUG 193816) ===> if (_filters == null && getContentTypeIds() == null) return true; return isApplicableTo(resource, resourceDelta, _filters); } In the second isApplicableTo(), just need to add a null check for _filters since the first isApplicableTo() was altered to allow null _filters as long as the validator was associated with some contentTypeIds. boolean isApplicableTo(IResource resource, int resourceDelta, ValidatorFilter[] filters) { // Are any of the filters satisfied? (i.e., OR them, not AND them.) // make sure filters is not null (BUG 193816) ==> if (_filters != null && checkIfValidSourceFile(resource)) { for (int i = 0; i < filters.length; i++) { ValidatorFilter filter = filters[i]; ... I should note that this problem will occur if a validator only specifies a contentTypeBinding and no name filters in its extension. Moving to 3.0 Amy, Can you please confirm if this is still a problem in WTP 3.0? With the JSP validator being ported to the new framework, I'm wondering if this problem has gone away (at least for the JSP validator). Yes, this is still a problem in WTP 3.0. I ran into this problem with the validator formerly known as the JSP Semantics Validator which was contributed by JSF component, not JSP component. The validator is now called the JSF View Validator, and this validator has not migrated to the new V2 framework yet. I verified on a recent WTP 3.0.1 build that if I create a JSF project (Web project + JSF Facet) and then create a text file, I verified that the JSF validator will still be called even though it's only supposed to run on files with JSP content type. JSF has since fixed their validator a bit so that at least the validator will check again once it's called to validate to make sure the file is JSP content type. They also added some project facet filters so that their validator at least doesnt run on all files in all projects (see bug 214385). So I can lower the severity to normal if you'd like, but yes, this is still a problem with the old validation framework. Created attachment 114182 [details]
updated patch
Released to 3.0.3 Released to 3.1 (i.e. HEAD) I didn't see the JSF View Validator popping up in my progress view when I validated a text file in a recent wtp 303 build, so it looks like this bug is fixed. marking as verified. closing |