Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
9bb6aa63
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看板
提交
9bb6aa63
编写于
9月 08, 2015
作者:
C
coffeys
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8029020: Check src/share/native/java/util/zip code for JNI pending exceptions
Reviewed-by: alanb, chegar
上级
df383657
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
30 addition
and
13 deletion
+30
-13
src/share/native/java/util/zip/Deflater.c
src/share/native/java/util/zip/Deflater.c
+12
-4
src/share/native/java/util/zip/Inflater.c
src/share/native/java/util/zip/Inflater.c
+9
-4
src/share/native/java/util/zip/ZipFile.c
src/share/native/java/util/zip/ZipFile.c
+9
-5
未找到文件。
src/share/native/java/util/zip/Deflater.c
浏览文件 @
9bb6aa63
/*
* Copyright (c) 1997, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
...
...
@@ -49,13 +49,21 @@ JNIEXPORT void JNICALL
Java_java_util_zip_Deflater_initIDs
(
JNIEnv
*
env
,
jclass
cls
)
{
levelID
=
(
*
env
)
->
GetFieldID
(
env
,
cls
,
"level"
,
"I"
);
CHECK_NULL
(
levelID
);
strategyID
=
(
*
env
)
->
GetFieldID
(
env
,
cls
,
"strategy"
,
"I"
);
CHECK_NULL
(
strategyID
);
setParamsID
=
(
*
env
)
->
GetFieldID
(
env
,
cls
,
"setParams"
,
"Z"
);
CHECK_NULL
(
setParamsID
);
finishID
=
(
*
env
)
->
GetFieldID
(
env
,
cls
,
"finish"
,
"Z"
);
CHECK_NULL
(
finishID
);
finishedID
=
(
*
env
)
->
GetFieldID
(
env
,
cls
,
"finished"
,
"Z"
);
CHECK_NULL
(
finishedID
);
bufID
=
(
*
env
)
->
GetFieldID
(
env
,
cls
,
"buf"
,
"[B"
);
CHECK_NULL
(
bufID
);
offID
=
(
*
env
)
->
GetFieldID
(
env
,
cls
,
"off"
,
"I"
);
CHECK_NULL
(
offID
);
lenID
=
(
*
env
)
->
GetFieldID
(
env
,
cls
,
"len"
,
"I"
);
CHECK_NULL
(
lenID
);
}
JNIEXPORT
jlong
JNICALL
...
...
@@ -137,14 +145,14 @@ Java_java_util_zip_Deflater_deflateBytes(JNIEnv *env, jobject this, jlong addr,
in_buf
=
(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
this_buf
,
0
);
if
(
in_buf
==
NULL
)
{
// Throw OOME only when length is not zero
if
(
this_len
!=
0
)
if
(
this_len
!=
0
&&
(
*
env
)
->
ExceptionOccurred
(
env
)
==
NULL
)
JNU_ThrowOutOfMemoryError
(
env
,
0
);
return
0
;
}
out_buf
=
(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
b
,
0
);
if
(
out_buf
==
NULL
)
{
(
*
env
)
->
ReleasePrimitiveArrayCritical
(
env
,
this_buf
,
in_buf
,
0
);
if
(
len
!=
0
)
if
(
len
!=
0
&&
(
*
env
)
->
ExceptionOccurred
(
env
)
==
NULL
)
JNU_ThrowOutOfMemoryError
(
env
,
0
);
return
0
;
}
...
...
@@ -163,7 +171,7 @@ Java_java_util_zip_Deflater_deflateBytes(JNIEnv *env, jobject this, jlong addr,
this_off
+=
this_len
-
strm
->
avail_in
;
(
*
env
)
->
SetIntField
(
env
,
this
,
offID
,
this_off
);
(
*
env
)
->
SetIntField
(
env
,
this
,
lenID
,
strm
->
avail_in
);
return
len
-
strm
->
avail_out
;
return
(
jint
)
(
len
-
strm
->
avail_out
)
;
case
Z_BUF_ERROR
:
(
*
env
)
->
SetBooleanField
(
env
,
this
,
setParamsID
,
JNI_FALSE
);
return
0
;
...
...
src/share/native/java/util/zip/Inflater.c
浏览文件 @
9bb6aa63
/*
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
5
, 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
...
...
@@ -50,10 +50,15 @@ JNIEXPORT void JNICALL
Java_java_util_zip_Inflater_initIDs
(
JNIEnv
*
env
,
jclass
cls
)
{
needDictID
=
(
*
env
)
->
GetFieldID
(
env
,
cls
,
"needDict"
,
"Z"
);
CHECK_NULL
(
needDictID
);
finishedID
=
(
*
env
)
->
GetFieldID
(
env
,
cls
,
"finished"
,
"Z"
);
CHECK_NULL
(
finishedID
);
bufID
=
(
*
env
)
->
GetFieldID
(
env
,
cls
,
"buf"
,
"[B"
);
CHECK_NULL
(
bufID
);
offID
=
(
*
env
)
->
GetFieldID
(
env
,
cls
,
"off"
,
"I"
);
CHECK_NULL
(
offID
);
lenID
=
(
*
env
)
->
GetFieldID
(
env
,
cls
,
"len"
,
"I"
);
CHECK_NULL
(
lenID
);
}
JNIEXPORT
jlong
JNICALL
...
...
@@ -127,14 +132,14 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr,
in_buf
=
(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
this_buf
,
0
);
if
(
in_buf
==
NULL
)
{
if
(
this_len
!=
0
)
if
(
this_len
!=
0
&&
(
*
env
)
->
ExceptionOccurred
(
env
)
==
NULL
)
JNU_ThrowOutOfMemoryError
(
env
,
0
);
return
0
;
}
out_buf
=
(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
b
,
0
);
if
(
out_buf
==
NULL
)
{
(
*
env
)
->
ReleasePrimitiveArrayCritical
(
env
,
this_buf
,
in_buf
,
0
);
if
(
len
!=
0
)
if
(
len
!=
0
&&
(
*
env
)
->
ExceptionOccurred
(
env
)
==
NULL
)
JNU_ThrowOutOfMemoryError
(
env
,
0
);
return
0
;
}
...
...
@@ -154,7 +159,7 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr,
this_off
+=
this_len
-
strm
->
avail_in
;
(
*
env
)
->
SetIntField
(
env
,
this
,
offID
,
this_off
);
(
*
env
)
->
SetIntField
(
env
,
this
,
lenID
,
strm
->
avail_in
);
return
len
-
strm
->
avail_out
;
return
(
jint
)
(
len
-
strm
->
avail_out
)
;
case
Z_NEED_DICT
:
(
*
env
)
->
SetBooleanField
(
env
,
this
,
needDictID
,
JNI_TRUE
);
/* Might have consumed some input here! */
...
...
src/share/native/java/util/zip/ZipFile.c
浏览文件 @
9bb6aa63
/*
* Copyright (c) 1998, 201
4
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 201
5
, 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
...
...
@@ -71,12 +71,14 @@ ThrowZipException(JNIEnv *env, const char *msg)
if
(
msg
!=
NULL
)
{
s
=
JNU_NewStringPlatform
(
env
,
msg
);
}
if
(
s
!=
NULL
)
{
x
=
JNU_NewObjectByName
(
env
,
"java/util/zip/ZipException"
,
"(Ljava/lang/String;)V"
,
s
);
if
(
x
!=
NULL
)
{
(
*
env
)
->
Throw
(
env
,
x
);
}
}
}
JNIEXPORT
jlong
JNICALL
...
...
@@ -363,8 +365,10 @@ Java_java_util_jar_JarFile_getMetaInfEntryNames(JNIEnv *env, jobject obj)
/* If some names were found then build array of java strings */
if
(
count
>
0
)
{
jclass
cls
=
(
*
env
)
->
FindClass
(
env
,
"java/lang/String"
);
jclass
cls
=
JNU_ClassString
(
env
);
CHECK_NULL_RETURN
(
cls
,
NULL
);
result
=
(
*
env
)
->
NewObjectArray
(
env
,
count
,
cls
,
0
);
CHECK_NULL_RETURN
(
result
,
NULL
);
if
(
result
!=
0
)
{
for
(
i
=
0
;
i
<
count
;
i
++
)
{
jstring
str
=
(
*
env
)
->
NewStringUTF
(
env
,
zip
->
metanames
[
i
]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录