246872 Duplicated warnings from validation
diff --git a/features/org.eclipse.wst.common_core.feature.patch/buildnotes_org.eclipse.wst.common_core.feature.patch.html b/features/org.eclipse.wst.common_core.feature.patch/buildnotes_org.eclipse.wst.common_core.feature.patch.html
index 6415a6c..3c77372 100644
--- a/features/org.eclipse.wst.common_core.feature.patch/buildnotes_org.eclipse.wst.common_core.feature.patch.html
+++ b/features/org.eclipse.wst.common_core.feature.patch/buildnotes_org.eclipse.wst.common_core.feature.patch.html
@@ -21,4 +21,5 @@
<p>Bug <a href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=229110'>229110</a>. ComponentUtilities.findFile() may cause ClassCastException</p>
<p>Bug <a href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=229478'>229478</a>. ComponentSaveStrategyImpl needs to respect deploy paths</p>
<p>Bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=239309">239309</a>. Deadlock</p>
+<p>Bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=246872">246872</a>. Duplicated warnings from validation</p>
</body></html>
\ No newline at end of file
diff --git a/features/org.eclipse.wst.common_core.feature.patch/feature.properties b/features/org.eclipse.wst.common_core.feature.patch/feature.properties
index 2c58ec1..bdb9f05 100644
--- a/features/org.eclipse.wst.common_core.feature.patch/feature.properties
+++ b/features/org.eclipse.wst.common_core.feature.patch/feature.properties
@@ -38,6 +38,7 @@
Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=229110 ComponentUtilities.findFile() may cause ClassCastException\n\
Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=229478 ComponentSaveStrategyImpl needs to respect deploy paths\n\
Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=239309 Deadlock\n\
+Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=246872 Duplicated warnings from validation\n\
\n\
# "copyright" property - text of the "Feature Update Copyright"
diff --git a/features/org.eclipse.wst.common_core.feature.patch/feature.xml b/features/org.eclipse.wst.common_core.feature.patch/feature.xml
index c4c5a35..a2318dd 100644
--- a/features/org.eclipse.wst.common_core.feature.patch/feature.xml
+++ b/features/org.eclipse.wst.common_core.feature.patch/feature.xml
@@ -22,6 +22,13 @@
</requires>
<plugin
+ id="org.eclipse.wst.validation"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
id="org.eclipse.wst.common.emfworkbench.integration"
download-size="0"
install-size="0"
diff --git a/plugins/org.eclipse.wst.validation/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.validation/META-INF/MANIFEST.MF
index 03348a6..a8421a3 100644
--- a/plugins/org.eclipse.wst.validation/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.validation/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Validation Framework
Bundle-SymbolicName: org.eclipse.wst.validation; singleton:=true
-Bundle-Version: 1.1.5.qualifier
+Bundle-Version: 1.1.6.qualifier
Bundle-Activator: org.eclipse.wst.validation.internal.plugin.ValidationPlugin
Bundle-Vendor: Eclipse.org
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationBuilder.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationBuilder.java
index 01074b5..48e0b56 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationBuilder.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationBuilder.java
@@ -12,7 +12,9 @@
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -34,6 +36,7 @@
import org.eclipse.wst.validation.internal.TimeEntry;
import org.eclipse.wst.validation.internal.ValidatorMetaData;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
+import org.eclipse.wst.validation.internal.provisional.core.IValidator;
/**
* Validation Framework Builder.
@@ -193,6 +196,7 @@
return referenced;
}
if (doFullBuild) {
+ cleanupReferencedProjectsMarkers(prjp, referenced);
performFullBuild(monitor, prjp);
} else {
// if (doAutoBuild && !prjp.isAutoValidate()) {
@@ -200,8 +204,10 @@
// return referenced;
// }
if (delta.getAffectedChildren().length == 0) {
- if (isReferencedProjectInDelta(referenced))
+ if (isReferencedProjectInDelta(referenced)){
+ cleanupReferencedProjectsMarkers(prjp, referenced);
performFullBuildForReferencedProjectChanged(monitor, prjp);
+ }
else
executionMap |= 0x10;
return referenced;
@@ -300,4 +306,49 @@
entry.setToolName("ValidationBuilder"); //$NON-NLS-1$
logger.write(Level.FINE, entry);
}
+
+ private void cleanupReferencedProjectsMarkers(final ProjectConfiguration prjp, IProject[] referenced){
+ //When a project references one or more project, performing a clean build on referenced
+ //causes delta to be invoked on referencee, aka, parent. This causes following code to
+ //be invoked.
+ //The following code is trying to fix a case where Ejb project references a utility project,
+ //and the clean build on utility project causes the code to come here, the ejb validator runs
+ //on the ejb project due to performFullBuildForReferencedProjectChanged() below, but it also
+ //causes marker to be generated for the util project, but the markers for util project are not
+ //cleaned up.
+
+ if( referenced == null || referenced.length == 0 ){
+ return;
+ }
+
+ try{
+ ValidatorMetaData[] enabledValidators = prjp.getEnabledFullBuildValidators(true, false);
+
+ HashSet set = new HashSet();
+ set.addAll( Arrays.asList( enabledValidators ) );
+ for (int i = 0; i < referenced.length; i++) {
+ IProject p = referenced[i];
+ ProjectConfiguration refProjectCfg = ConfigurationManager.getManager().getProjectConfiguration(p);
+
+ ValidatorMetaData[] refEnabledValidators = refProjectCfg.getEnabledFullBuildValidators(true, false);
+ for( int j=0; j< refEnabledValidators.length; j++ ){
+ //remove from the set the validators which are also in child
+ set.remove(refEnabledValidators[j]);
+ }
+ Iterator it = set.iterator();
+ while( it.hasNext() ){
+ ValidatorMetaData validatorMetaData = (ValidatorMetaData)it.next();
+ WorkbenchReporter.removeAllMessages(p, validatorMetaData.getValidator());
+ }
+
+ }
+ }catch (InvocationTargetException exc) {
+ Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
+ logInvocationTargetException(logger, exc);
+ }
+ catch (Throwable exc) {
+ Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
+ logBuildError(logger, exc);
+ }
+ }
}
\ No newline at end of file