https://bz.apache.org/bugzilla/show_bug.cgi?id=62996

            Bug ID: 62996
           Summary: Unit tests fail in TestExcelStyleDateFormatter for
                    locale zh_CN (Zulu JDK)
           Product: POI
           Version: 4.0.0-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: POI Overall
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Running `ant test` fails like this:

Testcase: test60369 took 0.013 sec
        FAILED
Failed testDates for locale zh, provider: null and date Sat Jan 12 00:00:00 CET
1980, having: 1月 expected:<19968> but was:<57345>
junit.framework.AssertionFailedError: Failed testDates for locale zh, provider:
null and date Sat Jan 12 00:00:00 CET 1980, having: 1月 expected:<19968> but
was:<57345>
        at
org.apache.poi.ss.usermodel.TestExcelStyleDateFormatter.test60369(TestExcelStyleDateFormatter.java:82)
        at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

This might even be dependent on the JDK used. I have tried with Zulu OpenJDK:
openjdk version "11.0.1" 2018-10-16 LTS
OpenJDK Runtime Environment Zulu11.2+3 (build 11.0.1+13-LTS)
OpenJDK 64-Bit Server VM Zulu11.2+3 (build 11.0.1+13-LTS, mixed mode)


This issue seems to be the same as #60369 but this time with a chinese locale.
The test checks the first character of the month name, in this case "一月“ where
'一' is the chinese character for 1 (one). The actual result is "1月". Both are
common in China (hey, this is the first time studying chines comes in handy
while working with POI). There's an answer to a question on stackoverflow
suggesting that it's implementation defined which characters are used for month
names in this case.

I don't know what Excel does, and if it differs between Excel and/or operating
system versions, so this test should either be changed to accept both values
for the chinese locale or POI has to produce an output consistent with Excel.

Related: #51847, #60369

#51847: https://bz.apache.org/bugzilla/show_bug.cgi?id=51847
#60369: https://bz.apache.org/bugzilla/show_bug.cgi?id=60369
Stackoverflow:
https://stackoverflow.com/questions/24862866/dateformatsymbols-behavior-is-different-between-android-and-jre-1-7

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to