You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/05/06 19:39:34 UTC
svn commit: r1100297 -
/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ValidatorTagHandlerDelegate.java
Author: lu4242
Date: Fri May 6 17:39:34 2011
New Revision: 1100297
URL: http://svn.apache.org/viewvc?rev=1100297&view=rev
Log:
MYFACES-3125 ValidatorTagHandlerDelegate does not invoke next handler in partial processing mode, which damages the component structure
Modified:
myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ValidatorTagHandlerDelegate.java
Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ValidatorTagHandlerDelegate.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ValidatorTagHandlerDelegate.java?rev=1100297&r1=1100296&r2=1100297&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ValidatorTagHandlerDelegate.java (original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ValidatorTagHandlerDelegate.java Fri May 6 17:39:34 2011
@@ -87,12 +87,6 @@ public class ValidatorTagHandlerDelegate
@Override
public void apply(FaceletContext ctx, UIComponent parent) throws IOException
{
- // Apply only if we are creating a new component
- if (!ComponentHandler.isNew(parent))
- {
- return;
- }
-
// we need methods from AbstractFaceletContext
FaceletCompositionContext mctx = FaceletCompositionContext.getCurrentInstance(ctx);
@@ -120,14 +114,20 @@ public class ValidatorTagHandlerDelegate
{
// the validator is disabled --> add its id to the exclusion stack
boolean validatorIdAvailable = validatorId != null && !"".equals(validatorId);
- if (validatorIdAvailable)
- {
- mctx.pushExcludedValidatorIdToStack(validatorId);
- }
- _delegate.getValidatorConfig().getNextHandler().apply(ctx, parent);
- if (validatorIdAvailable)
+ try
{
- mctx.popExcludedValidatorIdToStack();
+ if (validatorIdAvailable)
+ {
+ mctx.pushExcludedValidatorIdToStack(validatorId);
+ }
+ _delegate.getValidatorConfig().getNextHandler().apply(ctx, parent);
+ }
+ finally
+ {
+ if (validatorIdAvailable)
+ {
+ mctx.popExcludedValidatorIdToStack();
+ }
}
}
else
@@ -138,21 +138,39 @@ public class ValidatorTagHandlerDelegate
// spec: don't save the validation groups string if it is null or empty string
boolean groupsAvailable = groups != null
&& !groups.matches(BeanValidator.EMPTY_VALIDATION_GROUPS_PATTERN);
- if (groupsAvailable)
+ try
{
- mctx.pushValidationGroupsToStack(groups);
- }
- mctx.pushEnclosingValidatorIdToStack(validatorId);
- _delegate.getValidatorConfig().getNextHandler().apply(ctx, parent);
- mctx.popEnclosingValidatorIdToStack();
- if (groupsAvailable)
- {
- mctx.popValidationGroupsToStack();
+ if (groupsAvailable)
+ {
+ mctx.pushValidationGroupsToStack(groups);
+ }
+ try
+ {
+ mctx.pushEnclosingValidatorIdToStack(validatorId);
+ _delegate.getValidatorConfig().getNextHandler().apply(ctx, parent);
+ }
+ finally
+ {
+ mctx.popEnclosingValidatorIdToStack();
+ }
+ }
+ finally
+ {
+ if (groupsAvailable)
+ {
+ mctx.popValidationGroupsToStack();
+ }
}
}
}
else
{
+ // Apply only if we are creating a new component
+ if (!ComponentHandler.isNew(parent))
+ {
+ return;
+ }
+
// the tag is a leave --> attach validator to parent
if (parent instanceof EditableValueHolder)
{