Repository: struts Updated Branches: refs/heads/master 41227fab8 -> e2c6b42b8
WW-4595 Resolves regression issue but keeping support for custom text provider Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/e2c6b42b Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/e2c6b42b Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/e2c6b42b Branch: refs/heads/master Commit: e2c6b42b827764746713ecc0e0c7561c68c41984 Parents: 41227fa Author: Lukasz Lenart <lukaszlen...@apache.org> Authored: Thu Feb 25 20:12:23 2016 +0100 Committer: Lukasz Lenart <lukaszlen...@apache.org> Committed: Thu Feb 25 20:13:36 2016 +0100 ---------------------------------------------------------------------- .../xwork2/validator/DelegatingValidatorContext.java | 7 ++++++- .../xwork2/validator/VisitorFieldValidatorTest.java | 2 +- .../resources/com/opensymphony/xwork2/TestBean.properties | 2 +- .../xwork2/validator/VisitorValidatorTestAction.properties | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/e2c6b42b/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java b/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java index 41a42b0..0f56055 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java @@ -188,8 +188,13 @@ public class DelegatingValidatorContext implements ValidatorContext { // implements TextProvider. if (object != null && object instanceof DelegatingValidatorContext) { return ((DelegatingValidatorContext) object).getTextProvider(); + } else if (object != null && localeProvider != null && localeProvider instanceof DelegatingValidatorContext) { + return new CompositeTextProvider(new TextProvider[]{ + new TextProviderFactory().createInstance(object.getClass(), localeProvider), + ((DelegatingValidatorContext)localeProvider).getTextProvider() + }); } else if (localeProvider != null && localeProvider instanceof DelegatingValidatorContext) { - return ((DelegatingValidatorContext) localeProvider).getTextProvider(); + return ((DelegatingValidatorContext)localeProvider).getTextProvider(); } if ((object != null) && (object instanceof TextProvider)) { http://git-wip-us.apache.org/repos/asf/struts/blob/e2c6b42b/core/src/test/java/com/opensymphony/xwork2/validator/VisitorFieldValidatorTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/com/opensymphony/xwork2/validator/VisitorFieldValidatorTest.java b/core/src/test/java/com/opensymphony/xwork2/validator/VisitorFieldValidatorTest.java index c36f761..8191767 100644 --- a/core/src/test/java/com/opensymphony/xwork2/validator/VisitorFieldValidatorTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/validator/VisitorFieldValidatorTest.java @@ -97,7 +97,7 @@ public class VisitorFieldValidatorTest extends XWorkTestCase { assertEquals(1, beanCountMessages.size()); String beanCountMessage = beanCountMessages.get(0); - assertEquals("bean: Invalid count value, must be between 1 and 100, current value -1!", beanCountMessage); + assertEquals("bean: Model: Count must be between 1 and 100, current value is -1.", beanCountMessage); } public void testCollectionValidation() throws Exception { http://git-wip-us.apache.org/repos/asf/struts/blob/e2c6b42b/core/src/test/resources/com/opensymphony/xwork2/TestBean.properties ---------------------------------------------------------------------- diff --git a/core/src/test/resources/com/opensymphony/xwork2/TestBean.properties b/core/src/test/resources/com/opensymphony/xwork2/TestBean.properties index 577c8e1..86eab13 100644 --- a/core/src/test/resources/com/opensymphony/xwork2/TestBean.properties +++ b/core/src/test/resources/com/opensymphony/xwork2/TestBean.properties @@ -1 +1 @@ -invalid.count=Count must be between ${min} and ${max}, current value is ${count}. +invalid.count=Model: Count must be between ${min} and ${max}, current value is ${count}. http://git-wip-us.apache.org/repos/asf/struts/blob/e2c6b42b/xwork-core/src/test/resources/com/opensymphony/xwork2/validator/VisitorValidatorTestAction.properties ---------------------------------------------------------------------- diff --git a/xwork-core/src/test/resources/com/opensymphony/xwork2/validator/VisitorValidatorTestAction.properties b/xwork-core/src/test/resources/com/opensymphony/xwork2/validator/VisitorValidatorTestAction.properties new file mode 100644 index 0000000..6382497 --- /dev/null +++ b/xwork-core/src/test/resources/com/opensymphony/xwork2/validator/VisitorValidatorTestAction.properties @@ -0,0 +1 @@ +invalid.count=Action: Count must be between ${min} and ${max}, current value is ${count}.