Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
f4cb8698
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看板
提交
f4cb8698
编写于
8月 03, 2014
作者:
O
okutsu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8032650: [parfait] warning from b124 for jdk/src/share/native/java/util: jni exception pending
Reviewed-by: naoto
上级
272dd1ae
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
32 addition
and
61 deletion
+32
-61
src/share/classes/java/util/TimeZone.java
src/share/classes/java/util/TimeZone.java
+3
-6
src/share/native/java/util/TimeZone.c
src/share/native/java/util/TimeZone.c
+10
-24
src/solaris/native/java/util/TimeZone_md.c
src/solaris/native/java/util/TimeZone_md.c
+2
-2
src/solaris/native/java/util/TimeZone_md.h
src/solaris/native/java/util/TimeZone_md.h
+2
-2
src/windows/native/java/util/TimeZone_md.c
src/windows/native/java/util/TimeZone_md.c
+13
-25
src/windows/native/java/util/TimeZone_md.h
src/windows/native/java/util/TimeZone_md.h
+2
-2
未找到文件。
src/share/classes/java/util/TimeZone.java
浏览文件 @
f4cb8698
/*
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
4
, 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
...
...
@@ -591,8 +591,7 @@ abstract public class TimeZone implements Serializable, Cloneable {
/**
* Gets the platform defined TimeZone ID.
**/
private
static
native
String
getSystemTimeZoneID
(
String
javaHome
,
String
country
);
private
static
native
String
getSystemTimeZoneID
(
String
javaHome
);
/**
* Gets the custom time zone ID based on the GMT offset of the
...
...
@@ -650,12 +649,10 @@ abstract public class TimeZone implements Serializable, Cloneable {
// if the time zone ID is not set (yet), perform the
// platform to Java time zone ID mapping.
if
(
zoneID
==
null
||
zoneID
.
isEmpty
())
{
String
country
=
AccessController
.
doPrivileged
(
new
GetPropertyAction
(
"user.country"
));
String
javaHome
=
AccessController
.
doPrivileged
(
new
GetPropertyAction
(
"java.home"
));
try
{
zoneID
=
getSystemTimeZoneID
(
javaHome
,
country
);
zoneID
=
getSystemTimeZoneID
(
javaHome
);
if
(
zoneID
==
null
)
{
zoneID
=
GMT_ID
;
}
...
...
src/share/native/java/util/TimeZone.c
浏览文件 @
f4cb8698
/*
* Copyright (c) 1999, 20
0
4, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
1
4, 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
...
...
@@ -38,42 +38,28 @@
*/
JNIEXPORT
jstring
JNICALL
Java_java_util_TimeZone_getSystemTimeZoneID
(
JNIEnv
*
env
,
jclass
ign
,
jstring
java_home
,
jstring
country
)
jstring
java_home
)
{
const
char
*
cname
;
const
char
*
java_home_dir
;
char
*
javaTZ
;
jstring
jstrJavaTZ
=
NULL
;
if
(
java_home
==
NULL
)
return
NULL
;
CHECK_NULL_RETURN
(
java_home
,
NULL
);
java_home_dir
=
JNU_GetStringPlatformChars
(
env
,
java_home
,
0
);
if
(
java_home_dir
==
NULL
)
return
NULL
;
if
(
country
!=
NULL
)
{
cname
=
JNU_GetStringPlatformChars
(
env
,
country
,
0
);
/* ignore error cases for cname */
}
else
{
cname
=
NULL
;
}
CHECK_NULL_RETURN
(
java_home_dir
,
NULL
);
/*
* Invoke platform dependent mapping function
*/
javaTZ
=
findJavaTZ_md
(
java_home_dir
,
cname
);
free
((
void
*
)
java_home_dir
);
if
(
cname
!=
NULL
)
{
free
((
void
*
)
cname
);
}
javaTZ
=
findJavaTZ_md
(
java_home_dir
);
if
(
javaTZ
!=
NULL
)
{
jstr
ing
jstr
JavaTZ
=
JNU_NewStringPlatform
(
env
,
javaTZ
);
jstrJavaTZ
=
JNU_NewStringPlatform
(
env
,
javaTZ
);
free
((
void
*
)
javaTZ
);
return
jstrJavaTZ
;
}
return
NULL
;
JNU_ReleaseStringPlatformChars
(
env
,
java_home
,
java_home_dir
);
return
jstrJavaTZ
;
}
/*
...
...
src/solaris/native/java/util/TimeZone_md.c
浏览文件 @
f4cb8698
...
...
@@ -652,11 +652,11 @@ static char *mapPlatformToJavaTimezone(const char *java_home_dir, const char *tz
* using <java_home>/lib/tzmappings. If the TZ value is not found, it
* trys some libc implementation dependent mappings. If it still
* can't map to a Java time zone ID, it falls back to the GMT+/-hh:mm
* form.
`country', which can be null, is not used for UNIX platforms.
* form.
*/
/*ARGSUSED1*/
char
*
findJavaTZ_md
(
const
char
*
java_home_dir
,
const
char
*
country
)
findJavaTZ_md
(
const
char
*
java_home_dir
)
{
char
*
tz
;
char
*
javatz
=
NULL
;
...
...
src/solaris/native/java/util/TimeZone_md.h
浏览文件 @
f4cb8698
/*
* Copyright (c) 1999, 20
01
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
14
, 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
...
...
@@ -26,7 +26,7 @@
#ifndef _TIMEZONE_MD_H
#define _TIMEZONE_MD_H
char
*
findJavaTZ_md
(
const
char
*
java_home_dir
,
const
char
*
region
);
char
*
findJavaTZ_md
(
const
char
*
java_home_dir
);
char
*
getGMTOffsetID
();
#endif
src/windows/native/java/util/TimeZone_md.c
浏览文件 @
f4cb8698
/*
* Copyright (c) 1999, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
4
, 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
...
...
@@ -394,31 +394,34 @@ static int getWinTimeZone(char *winZoneName, char *winMapID)
*
* value_type is one of the following values:
* VALUE_KEY for exact key matching
* VALUE_MAPID for MapID
and country-based mapping
(this is
* VALUE_MAPID for MapID (this is
* required for the old Windows, such as NT 4.0 SP3).
*/
static
char
*
matchJavaTZ
(
const
char
*
java_home_dir
,
int
value_type
,
char
*
tzName
,
char
*
mapID
,
const
char
*
country
)
char
*
mapID
)
{
int
line
;
int
IDmatched
=
0
;
FILE
*
fp
;
char
*
javaTZName
=
NULL
;
char
*
items
[
TZ_NITEMS
];
char
mapFileName
[
_MAX_PATH
+
1
]
;
char
*
mapFileName
;
char
lineBuffer
[
MAX_ZONE_CHAR
*
4
];
char
bestMatch
[
MAX_ZONE_CHAR
];
int
noMapID
=
*
mapID
==
'\0'
;
/* no mapID on Vista */
bestMatch
[
0
]
=
'\0'
;
int
noMapID
=
*
mapID
==
'\0'
;
/* no mapID on Vista and later */
mapFileName
=
malloc
(
strlen
(
java_home_dir
)
+
strlen
(
MAPPINGS_FILE
)
+
1
);
if
(
mapFileName
==
NULL
)
{
return
NULL
;
}
strcpy
(
mapFileName
,
java_home_dir
);
strcat
(
mapFileName
,
MAPPINGS_FILE
);
if
((
fp
=
fopen
(
mapFileName
,
"r"
))
==
NULL
)
{
jio_fprintf
(
stderr
,
"can't open %s.
\n
"
,
mapFileName
);
free
((
void
*
)
mapFileName
);
return
NULL
;
}
free
((
void
*
)
mapFileName
);
line
=
0
;
while
(
fgets
(
lineBuffer
,
sizeof
(
lineBuffer
),
fp
)
!=
NULL
)
{
...
...
@@ -469,18 +472,6 @@ static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName
javaTZName
=
_strdup
(
items
[
TZ_JAVA_NAME
]);
break
;
}
/*
* Try to find the most likely time zone.
*/
if
(
*
items
[
TZ_REGION
]
==
'\0'
)
{
strncpy
(
bestMatch
,
items
[
TZ_JAVA_NAME
],
MAX_ZONE_CHAR
);
}
else
if
(
country
!=
NULL
&&
strcmp
(
items
[
TZ_REGION
],
country
)
==
0
)
{
if
(
value_type
==
VALUE_MAPID
)
{
javaTZName
=
_strdup
(
items
[
TZ_JAVA_NAME
]);
break
;
}
strncpy
(
bestMatch
,
items
[
TZ_JAVA_NAME
],
MAX_ZONE_CHAR
);
}
}
else
{
if
(
IDmatched
==
1
)
{
/*
...
...
@@ -492,9 +483,6 @@ static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName
}
fclose
(
fp
);
if
(
javaTZName
==
NULL
&&
bestMatch
[
0
]
!=
'\0'
)
{
javaTZName
=
_strdup
(
bestMatch
);
}
return
javaTZName
;
illegal_format:
...
...
@@ -506,7 +494,7 @@ static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName
/*
* Detects the platform time zone which maps to a Java time zone ID.
*/
char
*
findJavaTZ_md
(
const
char
*
java_home_dir
,
const
char
*
country
)
char
*
findJavaTZ_md
(
const
char
*
java_home_dir
)
{
char
winZoneName
[
MAX_ZONE_CHAR
];
char
winMapID
[
MAX_MAPID_LENGTH
];
...
...
@@ -521,7 +509,7 @@ char *findJavaTZ_md(const char *java_home_dir, const char *country)
std_timezone
=
_strdup
(
winZoneName
);
}
else
{
std_timezone
=
matchJavaTZ
(
java_home_dir
,
result
,
winZoneName
,
winMapID
,
country
);
winZoneName
,
winMapID
);
}
}
...
...
src/windows/native/java/util/TimeZone_md.h
浏览文件 @
f4cb8698
/*
* Copyright (c) 1999, 20
01
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
14
, 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
...
...
@@ -26,7 +26,7 @@
#ifndef _TIMEZONE_MD_H
#define _TIMEZONE_MD_H
char
*
findJavaTZ_md
(
const
char
*
java_home_dir
,
const
char
*
region
);
char
*
findJavaTZ_md
(
const
char
*
java_home_dir
);
char
*
getGMTOffsetID
();
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录