[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] GitDateFormatterTest failing only in bazel

Hi,

Thanks for checking David.

The test failure above is with java -version:Âopenjdk version "9.0.4" (linux).
After seeing it passes for you with "1.8.0_182" (OSX), I tried in another machine with "1.8.0_181" (linux) and it works.

I found a possible explanation here [1], which links to the java spec:
"In JDK 9, the Unicode Consortium's Common Locale Data Repository (CLDR) data is enabled as the default locale data, so that you can use standard locale data without any further action.

In JDK 8, although CLDR locale data is bundled with the JRE, it isnât enabled by default.

Code that uses locale-sensitive services such as date, time, and number formatting may produce different results with the CLDR locale data.


Not sure yet of the real impact in JGit beyond breaking one test. There is a way to make java 9 use the JRE locale instead of CLDR[2], but I would rather update the code to make it version-independent.

Regards,

Ivan

[1]Âhttps://stackoverflow.com/questions/50411064/simpledateformat-with-german-locale-java-8-vs-java-10
[2]Âhttps://bugs.java.com/bugdatabase/view_bug.do?bug_id=8152154

On Thu, Apr 25, 2019 at 5:57 PM David Pursehouse <david.pursehouse@xxxxxxxxx> wrote:
On Fri, Apr 26, 2019 at 4:48 AM Ivan Frade <ifrade@xxxxxxxxxx> wrote:
>
> Hi,
>
>Â GitDateFormatterTest passes fine in eclipse, but fails in bazel:
>
>Â ~/devel/jgit (master)$ bazel test --test_output=all //org.eclipse.jgit.test:org_eclipse_jgit_util_GitDateFormatterTest
> ==================== Test output for //org.eclipse.jgit.test:org_eclipse_jgit_util_GitDateFormatterTest:
> [...]
> There were 2 failures:
> 1) LOCALE(org.eclipse.jgit.util.GitDateFormatterTest)
> org.junit.ComparisonFailure: expected:<Sep 20, 2011[] 7:09:25 PM -0400> but was:<Sep 20, 2011[,] 7:09:25 PM -0400>
> at org.junit.Assert.assertEquals(Assert.java:115)
> at org.junit.Assert.assertEquals(Assert.java:144)
> at org.eclipse.jgit.util.GitDateFormatterTest.LOCALE(GitDateFormatterTest.java:123)
>
> 2) LOCALELOCAL(org.eclipse.jgit.util.GitDateFormatterTest)
> org.junit.ComparisonFailure: expected:<Sep 20, 2011[] 7:39:25 PM> but was:<Sep 20, 2011[,] 7:39:25 PM>
> at org.junit.Assert.assertEquals(Assert.java:115)
> at org.junit.Assert.assertEquals(Assert.java:144)
> at org.eclipse.jgit.util.GitDateFormatterTest.LOCALELOCAL(GitDateFormatterTest.java:129)
>
> IIUC, the tests use a hardcoded Locale.US via MockSystemReader.
>
> Is anybody else seeing this discrepancy?

It passes for me. See the log here:

http://paste.openstack.org/show/749785/

I also included some environment details, i.e. bazel and java
versions. I'm running it on OSX.

>
> Regards,
>
> Ivan
> _______________________________________________
> jgit-dev mailing list
> jgit-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/jgit-dev