Skip to content
Permalink
Browse files
8273924: ArrayIndexOutOfBoundsException thrown in java.util.JapaneseI…
…mperialCalendar.add()

Reviewed-by: rriggs, iris, joehw
  • Loading branch information
naotoj committed Sep 22, 2021
1 parent c9de806 commit d39aad92308fbc28bd2de164e331062ebf62da85
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -277,6 +277,10 @@ void normalizeMonth(CalendarDate date) {
long xm = 1L - month;
year -= (int)((xm / 12) + 1);
month = 13 - (xm % 12);
if (month == 13) {
year++;
month = 1;
}
bdate.setNormalizedYear(year);
bdate.setMonth((int) month);
} else if (month > DECEMBER) {
@@ -24,7 +24,7 @@
/*
* @test
* @summary tests Japanese Calendar.
* @bug 4609228 8187649
* @bug 4609228 8187649 8273924
* @modules java.base/sun.util
* java.base/sun.util.calendar
* @compile
@@ -354,6 +354,26 @@ test add MONTH
# check date Heisei $max Aug 16
# check timeofday 23 59 59 999

# JDK-8273924
set date Reiwa 2 Mar 1
add month -10
check date Reiwa 1 May 1
set date Reiwa 2 Mar 1
add month -11
check date Heisei 31 Apr 1
set date Reiwa 2 Mar 1
add month -12
check date Heisei 31 Mar 1
set date Reiwa 2 Mar 1
add month -13
check date Heisei 31 Feb 1
set date Reiwa 2 Mar 1
add month -14
check date Heisei 31 Jan 1
set date Reiwa 2 Mar 1
add month -15
check date Heisei 30 Dec 1

test add WEEK_OF_YEAR
use jcal
clear all

3 comments on commit d39aad9

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot replied Sep 22, 2021

@TheRealMDoerr

This comment has been minimized.

Copy link
Contributor

@TheRealMDoerr TheRealMDoerr replied Oct 5, 2021

/backport jdk11u-dev

@openjdk

This comment has been minimized.

Copy link

@openjdk openjdk bot replied Oct 5, 2021

@TheRealMDoerr the backport was successfully created on the branch TheRealMDoerr-backport-d39aad92 in my personal fork of openjdk/jdk11u-dev. To create a pull request with this backport targeting openjdk/jdk11u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

this pull request contains a backport of commit d39aad92 from the openjdk/jdk repository.

The commit being backported was authored by Naoto Sato on 22 Sep 2021 and was reviewed by Roger Riggs, Iris Clark and Joe Wang.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk11u-dev:

$ git fetch https://github.com/openjdk-bots/jdk11u-dev TheRealMDoerr-backport-d39aad92:TheRealMDoerr-backport-d39aad92
$ git checkout TheRealMDoerr-backport-d39aad92
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk11u-dev TheRealMDoerr-backport-d39aad92
Please sign in to comment.