ibnemahdi / owasp-esapi-java

Automatically exported from code.google.com/p/owasp-esapi-java
Other
0 stars 0 forks source link

ValidatorTest fails with German default Locale #272

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Have a German Windows :)
2. Run the ValidatorTest JUnit test
3. See that testIsValidDate fails

Fix:
Replace the old code:
...
    final Validator instance = ESAPI.validator ();
    final DateFormat format = DateFormat.getDateInstance();
    assertTrue (instance.isValidDate ("datetest1", "September 11, 2001", format, true));
...

With the new code:
...
    final DateFormat format = DateFormat.getDateInstance (DateFormat.DEFAULT, Locale.US);
    assertTrue (instance.isValidDate ("datetest1", "September 11, 2001", format, true));
...

Original issue reported on code.google.com by philip@helger.com on 16 May 2012 at 10:31