Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
3ad70dbe
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看板
提交
3ad70dbe
编写于
7月 28, 2016
作者:
M
msheppar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8157749: Improve handling of DNS error replies
Reviewed-by: chegar, rriggs, coffeys
上级
8f7d719c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
67 addition
and
7 deletion
+67
-7
make/mapfiles/libjava/mapfile-vers
make/mapfiles/libjava/mapfile-vers
+1
-0
src/share/native/common/jni_util.c
src/share/native/common/jni_util.c
+55
-0
src/share/native/common/jni_util.h
src/share/native/common/jni_util.h
+7
-0
src/solaris/native/java/net/net_util_md.c
src/solaris/native/java/net/net_util_md.c
+3
-4
src/windows/native/java/net/net_util_md.c
src/windows/native/java/net/net_util_md.c
+1
-3
未找到文件。
make/mapfiles/libjava/mapfile-vers
浏览文件 @
3ad70dbe
...
...
@@ -56,6 +56,7 @@ SUNWprivate_1.1 {
JNU_ThrowArrayIndexOutOfBoundsException;
JNU_ThrowByName;
JNU_ThrowByNameWithLastError;
JNU_ThrowByNameWithMessageAndLastError;
JNU_ThrowClassNotFoundException;
JNU_ThrowIllegalAccessError;
JNU_ThrowIllegalAccessException;
...
...
src/share/native/common/jni_util.c
浏览文件 @
3ad70dbe
...
...
@@ -148,6 +148,61 @@ JNU_ThrowInstantiationException(JNIEnv *env, const char *msg)
}
/*
* Throw an exception by name, using a given message and the string
* returned by getLastErrorString to construct the detail string.
*/
JNIEXPORT
void
JNICALL
JNU_ThrowByNameWithMessageAndLastError
(
JNIEnv
*
env
,
const
char
*
name
,
const
char
*
message
)
{
char
buf
[
256
];
size_t
n
=
getLastErrorString
(
buf
,
sizeof
(
buf
));
size_t
messagelen
=
message
==
NULL
?
0
:
strlen
(
message
);
if
(
n
>
0
)
{
jstring
s
=
JNU_NewStringPlatform
(
env
,
buf
);
if
(
s
!=
NULL
)
{
jobject
x
=
NULL
;
if
(
messagelen
)
{
jstring
s2
=
NULL
;
size_t
messageextlen
=
messagelen
+
4
;
char
*
str1
=
(
char
*
)
malloc
((
messageextlen
)
*
sizeof
(
char
));
if
(
str1
==
0
)
{
JNU_ThrowOutOfMemoryError
(
env
,
0
);
return
;
}
jio_snprintf
(
str1
,
messageextlen
,
" (%s)"
,
message
);
s2
=
(
*
env
)
->
NewStringUTF
(
env
,
str1
);
free
(
str1
);
if
(
s2
!=
NULL
)
{
jstring
s3
=
JNU_CallMethodByName
(
env
,
NULL
,
s
,
"concat"
,
"(Ljava/lang/String;)Ljava/lang/String;"
,
s2
).
l
;
(
*
env
)
->
DeleteLocalRef
(
env
,
s2
);
if
(
s3
!=
NULL
)
{
(
*
env
)
->
DeleteLocalRef
(
env
,
s
);
s
=
s3
;
}
}
}
x
=
JNU_NewObjectByName
(
env
,
name
,
"(Ljava/lang/String;)V"
,
s
);
if
(
x
!=
NULL
)
{
(
*
env
)
->
Throw
(
env
,
x
);
}
}
}
if
(
!
(
*
env
)
->
ExceptionOccurred
(
env
))
{
if
(
messagelen
)
{
JNU_ThrowByName
(
env
,
name
,
message
);
}
else
{
JNU_ThrowByName
(
env
,
name
,
"no further information"
);
}
}
}
/* Throw an exception by name, using the string returned by
* JVM_LastErrorString for the detail string. If the last-error
* string is NULL, use the given default detail string.
...
...
src/share/native/common/jni_util.h
浏览文件 @
3ad70dbe
...
...
@@ -105,6 +105,13 @@ JNIEXPORT void JNICALL
JNU_ThrowByNameWithLastError
(
JNIEnv
*
env
,
const
char
*
name
,
const
char
*
defaultMessage
);
/* Throw an exception by name, using a given message and the string
* returned by getLastErrorString to construct the detail string.
*/
JNIEXPORT
void
JNICALL
JNU_ThrowByNameWithMessageAndLastError
(
JNIEnv
*
env
,
const
char
*
name
,
const
char
*
message
);
/* Throw an IOException, using the last-error string for the detail
* string. If the last-error string is NULL, use the given default
* detail string.
...
...
src/solaris/native/java/net/net_util_md.c
浏览文件 @
3ad70dbe
...
...
@@ -106,6 +106,8 @@ void setDefaultScopeID(JNIEnv *env, struct sockaddr *him)
int
getDefaultScopeID
(
JNIEnv
*
env
)
{
static
jclass
ni_class
=
NULL
;
static
jfieldID
ni_defaultIndexID
;
int
defaultIndex
=
0
;
if
(
ni_class
==
NULL
)
{
jclass
c
=
(
*
env
)
->
FindClass
(
env
,
"java/net/NetworkInterface"
);
CHECK_NULL_RETURN
(
c
,
0
);
...
...
@@ -116,7 +118,6 @@ int getDefaultScopeID(JNIEnv *env) {
CHECK_NULL_RETURN
(
ni_defaultIndexID
,
0
);
ni_class
=
c
;
}
int
defaultIndex
=
0
;
defaultIndex
=
(
*
env
)
->
GetStaticIntField
(
env
,
ni_class
,
ni_defaultIndexID
);
return
defaultIndex
;
...
...
@@ -257,9 +258,7 @@ int cmpScopeID (unsigned int scope, struct sockaddr *him) {
void
NET_ThrowByNameWithLastError
(
JNIEnv
*
env
,
const
char
*
name
,
const
char
*
defaultDetail
)
{
char
errmsg
[
255
];
sprintf
(
errmsg
,
"errno: %d, error: %s
\n
"
,
errno
,
defaultDetail
);
JNU_ThrowByNameWithLastError
(
env
,
name
,
errmsg
);
JNU_ThrowByNameWithMessageAndLastError
(
env
,
name
,
defaultDetail
);
}
void
...
...
src/windows/native/java/net/net_util_md.c
浏览文件 @
3ad70dbe
...
...
@@ -218,9 +218,7 @@ NET_ThrowSocketException(JNIEnv *env, char* msg)
void
NET_ThrowByNameWithLastError
(
JNIEnv
*
env
,
const
char
*
name
,
const
char
*
defaultDetail
)
{
char
errmsg
[
255
];
sprintf
(
errmsg
,
"errno: %d, error: %s
\n
"
,
WSAGetLastError
(),
defaultDetail
);
JNU_ThrowByNameWithLastError
(
env
,
name
,
errmsg
);
JNU_ThrowByNameWithMessageAndLastError
(
env
,
name
,
defaultDetail
);
}
jfieldID
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录