Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
d9fa6e79
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d9fa6e79
编写于
12月 04, 2015
作者:
R
robm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8067800: Clarify java.time.chrono.Chronology.isLeapYear for out of range years
Reviewed-by: rriggs
上级
129aa67a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
3 deletion
+22
-3
src/share/classes/java/time/chrono/HijrahChronology.java
src/share/classes/java/time/chrono/HijrahChronology.java
+2
-3
test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java
...a/time/test/java/time/chrono/TestUmmAlQuraChronology.java
+20
-0
未找到文件。
src/share/classes/java/time/chrono/HijrahChronology.java
浏览文件 @
d9fa6e79
...
@@ -545,9 +545,8 @@ public final class HijrahChronology extends AbstractChronology implements Serial
...
@@ -545,9 +545,8 @@ public final class HijrahChronology extends AbstractChronology implements Serial
@Override
@Override
public
boolean
isLeapYear
(
long
prolepticYear
)
{
public
boolean
isLeapYear
(
long
prolepticYear
)
{
checkCalendarInit
();
checkCalendarInit
();
int
epochMonth
=
yearToEpochMonth
((
int
)
prolepticYear
);
if
(
prolepticYear
<
getMinimumYear
()
||
prolepticYear
>
getMaximumYear
())
{
if
(
epochMonth
<
0
||
epochMonth
>
maxEpochDay
)
{
return
false
;
throw
new
DateTimeException
(
"Hijrah date out of range"
);
}
}
int
len
=
getYearLength
((
int
)
prolepticYear
);
int
len
=
getYearLength
((
int
)
prolepticYear
);
return
(
len
>
354
);
return
(
len
>
354
);
...
...
test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java
浏览文件 @
d9fa6e79
...
@@ -30,6 +30,7 @@ import static java.time.temporal.ChronoField.DAY_OF_YEAR;
...
@@ -30,6 +30,7 @@ import static java.time.temporal.ChronoField.DAY_OF_YEAR;
import
static
java
.
time
.
temporal
.
ChronoField
.
MONTH_OF_YEAR
;
import
static
java
.
time
.
temporal
.
ChronoField
.
MONTH_OF_YEAR
;
import
static
java
.
time
.
temporal
.
ChronoField
.
YEAR
;
import
static
java
.
time
.
temporal
.
ChronoField
.
YEAR
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertFalse
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
static
org
.
testng
.
Assert
.
fail
;
import
static
org
.
testng
.
Assert
.
fail
;
...
@@ -71,6 +72,7 @@ import org.testng.annotations.Test;
...
@@ -71,6 +72,7 @@ import org.testng.annotations.Test;
/**
/**
* Tests for the Umm alQura chronology and data.
* Tests for the Umm alQura chronology and data.
* Note: The dates used for testing are just a sample of calendar data.
* Note: The dates used for testing are just a sample of calendar data.
* @bug 8067800
*/
*/
@Test
@Test
public
class
TestUmmAlQuraChronology
{
public
class
TestUmmAlQuraChronology
{
...
@@ -530,6 +532,24 @@ public class TestUmmAlQuraChronology {
...
@@ -530,6 +532,24 @@ public class TestUmmAlQuraChronology {
assertEquals
(
date
.
isLeapYear
(),
leapyear
);
assertEquals
(
date
.
isLeapYear
(),
leapyear
);
}
}
// Data provider to verify that a given hijrah year is outside the range of supported years
// The values are dependent on the currently configured UmmAlQura calendar data
@DataProvider
(
name
=
"OutOfRangeLeapYears"
)
Object
[][]
data_invalid_leapyears
()
{
return
new
Object
[][]
{
{
1299
},
{
1601
},
{
Integer
.
MAX_VALUE
},
{
Integer
.
MIN_VALUE
},
};
}
@Test
(
dataProvider
=
"OutOfRangeLeapYears"
)
public
void
test_notLeapYears
(
int
y
)
{
assertFalse
(
HijrahChronology
.
INSTANCE
.
isLeapYear
(
y
),
"Out of range leap year"
);
}
// Date samples to convert HijrahDate to LocalDate and vice versa
// Date samples to convert HijrahDate to LocalDate and vice versa
@DataProvider
(
name
=
"samples"
)
@DataProvider
(
name
=
"samples"
)
Object
[][]
data_samples
()
{
Object
[][]
data_samples
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录