Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
3.14.0
-
None
-
None
-
Not working: Android 14 (API 34) phone and emulator, Android 12 (API 31) emulator
Working: Arch Linux OpenJDK 11
Description
Commons Lang3 3.14.0 DateUtils, i.e. FastDateParser under the hood, doesn't accept "GMT" as a valid timezone for "zzz" on Android 14, but does accept it on desktop OpenJDK 11.
For example, the string "Mon, 01 May 2023 08:52:19 GMT" can't be parsed with pattern "EEE, dd MMM yyyy HH:mm:ss zzz" on Android.
The same issue was reported at https://github.com/bitfireAT/dav4jvm/issues/22 , but I found that it's also not working on Android 12 emulator, so I believe the actual cause is Commons Lang3 using FastDateParser v.s. previously using SimpleDateFormat, instead of upgraded Android platform version.
I debugged this a little bit and found that the generated regex in FastDateParser.TimeZoneStrategy doesn't contain "|gmt|" on Android 14, but does contain "|gmt|" on desktop. I suspect maybe Android has some different timezone info. I also saw the intentional skip for `TimeZones.GMT_ID` in FastDateParser code, which makes me wonder how it got the "|gmt|" on desktop.
Here are the different generated regexes I saw, with unrelated timezones replaced with "...":
```
((?iu)[+-]\d
```
```
((?iu)[+-]\d{4}
|GMT[+-]\d
{1,2}:\d
{2}|yekt|...|gulf daylight time|gt|gst|greenwich mean time|gmt-12:00|gmt-11:00|gmt-10:00|gmt-09:00|gmt-08:00|gmt-07:00|gmt-06:00|gmt-05:00|gmt-04:00|gmt-03:00|gmt-02:00|gmt-01:00|gmt+14:00|gmt+13:00|gmt+12:00|gmt+11:00|gmt+10:00|gmt+09:00|gmt+08:00|gmt+07:00|gmt+06:00|gmt+05:00|gmt+04:00|gmt+03:00|gmt+02:00|gmt+01:00|gmt|gilt|....|acre standard time|acdt)
```