You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2020/04/20 05:24:06 UTC

[struts] branch struts-2-5-x updated: Initial fix for WW-5069:

This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch struts-2-5-x
in repository https://gitbox.apache.org/repos/asf/struts.git


The following commit(s) were added to refs/heads/struts-2-5-x by this push:
     new 6d6a422  Initial fix for WW-5069:
     new 1526b36  Merge pull request #404 from JCgH4164838Gh792C124B5/WW-5069
6d6a422 is described below

commit 6d6a422db7950634ae5bfbc2153e27ae056adaff
Author: JCgH4164838Gh792C124B5 <43...@users.noreply.github.com>
AuthorDate: Sun Apr 19 21:50:09 2020 -0400

    Initial fix for WW-5069:
    
    - Force US Locale for two tests that use date strings of the form
    MM/DD/CCYY.
    - When the tests/build are run in an environment with a non-US Locale
    and newer JDKs the tests may fail due to inability to parse the US date
    format.
    
    Note: Was noticed on Windows 10 with JDK11, but could affect other
    environments when run in a non-US Locale.
---
 .../java/com/opensymphony/xwork2/validator/DateRangeValidatorTest.java   | 1 +
 .../com/opensymphony/xwork2/validator/VisitorFieldValidatorTest.java     | 1 +
 2 files changed, 2 insertions(+)

diff --git a/core/src/test/java/com/opensymphony/xwork2/validator/DateRangeValidatorTest.java b/core/src/test/java/com/opensymphony/xwork2/validator/DateRangeValidatorTest.java
index a8f64e9..98a5ed0 100644
--- a/core/src/test/java/com/opensymphony/xwork2/validator/DateRangeValidatorTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/validator/DateRangeValidatorTest.java
@@ -48,6 +48,7 @@ public class DateRangeValidatorTest extends XWorkTestCase {
         HashMap<String, Object> params = new HashMap<>();
         params.put("date", date.getTime());
         context.put(ActionContext.PARAMETERS, HttpParameters.create(params).build());
+        context.put(ActionContext.LOCALE, Locale.US);  // Force US Locale for date conversion tests on JDK9+
 
         ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.VALIDATION_ACTION_NAME, null, context);
         proxy.execute();
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 cd66aca..c1f0904 100644
--- a/core/src/test/java/com/opensymphony/xwork2/validator/VisitorFieldValidatorTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/validator/VisitorFieldValidatorTest.java
@@ -38,6 +38,7 @@ public class VisitorFieldValidatorTest extends XWorkTestCase {
     public void setUp() throws Exception {
         super.setUp();
 
+        ActionContext.getContext().put(ActionContext.LOCALE, Locale.US);  // Force US Locale for date conversion tests on JDK9+
         action = container.inject(VisitorValidatorTestAction.class);
 
         TestBean bean = action.getBean();