You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2009/11/17 19:08:39 UTC

svn commit: r881418 - /myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCompareStrategy.java

Author: gpetracek
Date: Tue Nov 17 18:08:39 2009
New Revision: 881418

URL: http://svn.apache.org/viewvc?rev=881418&view=rev
Log:
cleanup

Modified:
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCompareStrategy.java

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCompareStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCompareStrategy.java?rev=881418&r1=881417&r2=881418&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCompareStrategy.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCompareStrategy.java Tue Nov 17 18:08:39 2009
@@ -158,9 +158,12 @@
         {
             ValidatorException validatorException = new ValidatorException(message);
 
+            boolean isSourceMetaDataUsed = false;
+
             if(entryOfTarget.getMetaDataEntry() == null)
             {
-                entryOfTarget.setMetaDataEntry(entryOfSource.getMetaDataEntry());
+                prepareTargetMetaDataForSeverityAwareInterception(entryOfSource, entryOfTarget);
+                isSourceMetaDataUsed = true;
             }
             
             if(ExtValUtils.executeAfterThrowingInterceptors(
@@ -170,9 +173,25 @@
                 ExtValUtils.tryToAddViolationMessageForComponentId(entryOfTarget.getClientId(),
                         ExtValUtils.convertFacesMessage(validatorException.getFacesMessage()));
             }
+
+            if(isSourceMetaDataUsed)
+            {
+                resetTargetMetaData(entryOfTarget);
+            }
         }
     }
 
+    private void prepareTargetMetaDataForSeverityAwareInterception(
+            CrossValidationStorageEntry entryOfSource, CrossValidationStorageEntry entryOfTarget)
+    {
+        entryOfTarget.setMetaDataEntry(entryOfSource.getMetaDataEntry());
+    }
+
+    private void resetTargetMetaData(CrossValidationStorageEntry entryOfTarget)
+    {
+        entryOfTarget.setMetaDataEntry(null);
+    }
+
     @SuppressWarnings({"ThrowableInstanceNeverThrown"})
     private void processTargetComponentAsSourceComponentAfterViolation(CrossValidationStorageEntry entryOfSource)
     {