Integrated: 8278137: JFR: PrettyWriter uses incorrect year specifier
Aleksey Shipilev
shade at openjdk.java.net
Fri Dec 3 15:45:20 UTC 2021
On Thu, 2 Dec 2021 11:10:39 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> Found by SonarCloud, actually. For this commit: https://github.com/openjdk/jdk/commit/ee3576a48b700df3d8ad4bd447346d4102b20818 -- it says:
>
>> Week Year ("YYYY") should not be used for date formatting
>>
>> Few developers are aware of the difference between Y for "Week year" and y for Year when formatting and parsing a date with SimpleDateFormat or DateTimeFormatter. That's likely because for most dates, Week year and Year are the same, so testing at any time other than the first or last week of the year will yield the same value for both y and Y. But in the last week of December and the first week of January, you may get unexpected results.
>
> See also ErrorProne rule: https://errorprone.info/bugpattern/MisusedWeekYear
>
> A nice end-of-the-year time-bomb, that :)
>
> Additional testing:
> - [x] Linux x86_64 fastdebug `jdk_jfr`
This pull request has now been integrated.
Changeset: 53a43427
Author: Aleksey Shipilev <shade at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/53a4342783d94cead4d26e5b29d286421b9432c3
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
8278137: JFR: PrettyWriter uses incorrect year specifier
Reviewed-by: egahlin
-------------
PR: https://git.openjdk.java.net/jdk/pull/6665
More information about the hotspot-jfr-dev
mailing list