Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
Dragonwell11
提交
18c0efe5
D
Dragonwell11
项目概览
LinuxSuRen
/
Dragonwell11
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
18c0efe5
编写于
2月 11, 2020
作者:
M
mullan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8234032: Improve basic calendar services
Reviewed-by: weijun, rhalade, mschoene
上级
c58a6da3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
26 deletion
+38
-26
src/java.base/share/classes/sun/security/util/DerInputBuffer.java
....base/share/classes/sun/security/util/DerInputBuffer.java
+38
-26
未找到文件。
src/java.base/share/classes/sun/security/util/DerInputBuffer.java
浏览文件 @
18c0efe5
/*
* Copyright (c) 1996, 20
17
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 20
20
, 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
...
...
@@ -312,15 +312,15 @@ class DerInputBuffer extends ByteArrayInputStream implements Cloneable {
if
(
generalized
)
{
type
=
"Generalized"
;
year
=
1000
*
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
year
+=
100
*
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
year
+=
10
*
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
year
+=
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
year
=
1000
*
toDigit
(
buf
[
pos
++],
type
);
year
+=
100
*
toDigit
(
buf
[
pos
++],
type
);
year
+=
10
*
toDigit
(
buf
[
pos
++],
type
);
year
+=
toDigit
(
buf
[
pos
++],
type
);
len
-=
2
;
// For the two extra YY
}
else
{
type
=
"UTC"
;
year
=
10
*
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
year
+=
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
year
=
10
*
toDigit
(
buf
[
pos
++],
type
);
year
+=
toDigit
(
buf
[
pos
++],
type
);
if
(
year
<
50
)
// origin 2000
year
+=
2000
;
...
...
@@ -328,17 +328,17 @@ class DerInputBuffer extends ByteArrayInputStream implements Cloneable {
year
+=
1900
;
// origin 1900
}
month
=
10
*
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
month
+=
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
month
=
10
*
toDigit
(
buf
[
pos
++],
type
);
month
+=
toDigit
(
buf
[
pos
++],
type
);
day
=
10
*
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
day
+=
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
day
=
10
*
toDigit
(
buf
[
pos
++],
type
);
day
+=
toDigit
(
buf
[
pos
++],
type
);
hour
=
10
*
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
hour
+=
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
hour
=
10
*
toDigit
(
buf
[
pos
++],
type
);
hour
+=
toDigit
(
buf
[
pos
++],
type
);
minute
=
10
*
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
minute
+=
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
minute
=
10
*
toDigit
(
buf
[
pos
++],
type
);
minute
+=
toDigit
(
buf
[
pos
++],
type
);
len
-=
10
;
// YYMMDDhhmm
...
...
@@ -350,8 +350,8 @@ class DerInputBuffer extends ByteArrayInputStream implements Cloneable {
millis
=
0
;
if
(
len
>
2
)
{
second
=
10
*
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
second
+=
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
second
=
10
*
toDigit
(
buf
[
pos
++],
type
);
second
+=
toDigit
(
buf
[
pos
++],
type
);
len
-=
2
;
// handle fractional seconds (if present)
if
(
buf
[
pos
]
==
'.'
||
buf
[
pos
]
==
','
)
{
...
...
@@ -363,7 +363,7 @@ class DerInputBuffer extends ByteArrayInputStream implements Cloneable {
buf
[
pos
]
!=
'-'
)
{
// Validate all digits in the fractional part but
// store millisecond precision only
int
thisDigit
=
Character
.
digit
((
char
)
buf
[
pos
],
10
);
int
thisDigit
=
toDigit
(
buf
[
pos
],
type
);
precision
++;
pos
++;
switch
(
precision
)
{
...
...
@@ -412,10 +412,10 @@ class DerInputBuffer extends ByteArrayInputStream implements Cloneable {
switch
(
buf
[
pos
++])
{
case
'+'
:
hr
=
10
*
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
hr
+=
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
min
=
10
*
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
min
+=
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
hr
=
10
*
toDigit
(
buf
[
pos
++],
type
);
hr
+=
toDigit
(
buf
[
pos
++],
type
);
min
=
10
*
toDigit
(
buf
[
pos
++],
type
);
min
+=
toDigit
(
buf
[
pos
++],
type
);
if
(
hr
>=
24
||
min
>=
60
)
throw
new
IOException
(
"Parse "
+
type
+
" time, +hhmm"
);
...
...
@@ -424,10 +424,10 @@ class DerInputBuffer extends ByteArrayInputStream implements Cloneable {
break
;
case
'-'
:
hr
=
10
*
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
hr
+=
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
min
=
10
*
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
min
+=
Character
.
digit
((
char
)
buf
[
pos
++],
10
);
hr
=
10
*
toDigit
(
buf
[
pos
++],
type
);
hr
+=
toDigit
(
buf
[
pos
++],
type
);
min
=
10
*
toDigit
(
buf
[
pos
++],
type
);
min
+=
toDigit
(
buf
[
pos
++],
type
);
if
(
hr
>=
24
||
min
>=
60
)
throw
new
IOException
(
"Parse "
+
type
+
" time, -hhmm"
);
...
...
@@ -443,4 +443,16 @@ class DerInputBuffer extends ByteArrayInputStream implements Cloneable {
}
return
new
Date
(
time
);
}
/**
* Converts byte (represented as a char) to int.
* @throws IOException if integer is not a valid digit in the specified
* radix (10)
*/
private
static
int
toDigit
(
byte
b
,
String
type
)
throws
IOException
{
if
(
b
<
'0'
||
b
>
'9'
)
{
throw
new
IOException
(
"Parse "
+
type
+
" time, invalid format"
);
}
return
b
-
'0'
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录