Bug 262151 - [validation] ValidatorStrategy triggering unwanted plug-in activation
Summary: [validation] ValidatorStrategy triggering unwanted plug-in activation
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.sse (show other bugs)
Version: 3.0.3   Edit
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: 3.2 RC1   Edit
Assignee: Nick Sandonato CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard: needs VF API?
Keywords: performance
Depends on: 262360 295066
Blocks:
  Show dependency tree
 
Reported: 2009-01-23 07:09 EST by Gary Karasiuk CLA
Modified: 2010-05-11 10:51 EDT (History)
2 users (show)

See Also:
thatnitind: review+


Attachments
Fix Patch (1.03 KB, patch)
2009-11-12 08:28 EST, Ian Tewksbury CLA
no flags Details | Diff
patch (1.38 KB, patch)
2010-05-06 16:26 EDT, Nick Sandonato CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gary Karasiuk CLA 2009-01-23 07:09:20 EST
The org.eclipse.wst.sse.ui.internal.reconcile.validator.ValidatorStrategy in the reconcile method is calling an internal validation framework method:

IValidator iv = v.asIValidator();

This call triggers that validator's plug-in to be activated. Since this is being called on all the disabled validators, it is causing all the validation plug-ins to load.

If I provided you with a method, so that you could first tell if the validator was activated, could you make use of it to not call this asIValidator() ?
Comment 1 Nitin Dahyabhai CLA 2009-01-23 10:15:39 EST
We'd be happy to.
Comment 2 Gary Karasiuk CLA 2009-01-26 07:51:20 EST
I have added a public method via bug 262360. I have attached a patch to that bug. (I'll release it as soon as the driver is opened up). 
Comment 3 Ian Tewksbury CLA 2009-11-12 08:28:30 EST
Created attachment 152032 [details]
Fix Patch

This patch wraps the #asIValidator call in an if statement that first checks to see if the validator is loaded.

I noticed there is also a #asV1Validator call, Gary does that need to check to see if the validator is loaded first as well?
Comment 4 Ian Tewksbury CLA 2009-11-12 09:47:18 EST
Nick and I just discussed this more and realized that we can not just add a check to see if the disabled validator is not loaded and if its not then preced not to call the asIValidator method because then it would not be added to our list of deactivated validators which is then used to create a list of activated validators.

What we really need is a ValidationFramework.getDefault().getEnabledValidatorsFor(file) because currentlyt here is only a get DisabledValidatorsFor which we then have to use in conjuction with getValidatorsFor to create our own list of Enabled validators and its this hackish operation which requires the calling of asIValidator.

But if there was a getEnabledValidators then the whole situation could be avoided.
Comment 5 Nick Sandonato CLA 2010-05-06 16:26:22 EDT
Created attachment 167390 [details]
patch

This patch uses asV1Validator() first to start with the V1 validator. If the V1 validator is null, then it just uses the sourceId. No more invocation of asIValidator to get the V2 validator.
Comment 6 Nick Sandonato CLA 2010-05-06 16:28:00 EDT
Nitin, can we try to get this in for RC1? This seems to be a pretty bad performance drag if we're activating plug-ins just to assemble a list of validators that shouldn't be run anyway.
Comment 7 Nitin Dahyabhai CLA 2010-05-10 12:11:25 EDT
Test well.
Comment 8 Nick Sandonato CLA 2010-05-11 10:51:49 EDT
Fix checked in.