Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
5c89aa59
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看板
提交
5c89aa59
编写于
4月 08, 2013
作者:
C
chegar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8008593: Better URLClassLoader resource management
Reviewed-by: alanb, sherman, hawtin
上级
104c1e52
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
110 addition
and
6 deletion
+110
-6
make/java/zip/mapfile-vers
make/java/zip/mapfile-vers
+1
-0
make/java/zip/reorder-i586
make/java/zip/reorder-i586
+1
-0
make/java/zip/reorder-sparc
make/java/zip/reorder-sparc
+1
-0
make/java/zip/reorder-sparcv9
make/java/zip/reorder-sparcv9
+1
-0
makefiles/mapfiles/libzip/mapfile-vers
makefiles/mapfiles/libzip/mapfile-vers
+1
-0
makefiles/mapfiles/libzip/reorder-sparc
makefiles/mapfiles/libzip/reorder-sparc
+1
-0
makefiles/mapfiles/libzip/reorder-sparcv9
makefiles/mapfiles/libzip/reorder-sparcv9
+1
-0
makefiles/mapfiles/libzip/reorder-x86
makefiles/mapfiles/libzip/reorder-x86
+1
-0
src/share/classes/java/util/zip/ZipFile.java
src/share/classes/java/util/zip/ZipFile.java
+23
-3
src/share/classes/sun/misc/JavaUtilZipFileAccess.java
src/share/classes/sun/misc/JavaUtilZipFileAccess.java
+33
-0
src/share/classes/sun/misc/SharedSecrets.java
src/share/classes/sun/misc/SharedSecrets.java
+11
-0
src/share/classes/sun/misc/URLClassPath.java
src/share/classes/sun/misc/URLClassPath.java
+18
-3
src/share/native/java/util/zip/ZipFile.c
src/share/native/java/util/zip/ZipFile.c
+8
-0
src/share/native/java/util/zip/zip_util.c
src/share/native/java/util/zip/zip_util.c
+8
-0
src/share/native/java/util/zip/zip_util.h
src/share/native/java/util/zip/zip_util.h
+1
-0
未找到文件。
make/java/zip/mapfile-vers
浏览文件 @
5c89aa59
...
...
@@ -65,6 +65,7 @@ SUNWprivate_1.1 {
Java_java_util_zip_ZipFile_initIDs;
Java_java_util_zip_ZipFile_open;
Java_java_util_zip_ZipFile_read;
Java_java_util_zip_ZipFile_startsWithLOC;
ZIP_Close;
ZIP_CRC32;
...
...
make/java/zip/reorder-i586
浏览文件 @
5c89aa59
...
...
@@ -19,6 +19,7 @@ text: .text%ZIP_FreeEntry;
text: .text%Java_java_util_zip_ZipFile_initIDs;
text: .text%Java_java_util_zip_ZipFile_open;
text: .text%Java_java_util_zip_ZipFile_getTotal;
text: .text%Java_java_util_zip_ZipFile_startsWithLOC;
text: .text%Java_java_util_zip_ZipFile_getEntry;
text: .text%Java_java_util_zip_ZipFile_freeEntry;
text: .text%Java_java_util_zip_ZipFile_getEntryTime;
...
...
make/java/zip/reorder-sparc
浏览文件 @
5c89aa59
...
...
@@ -18,6 +18,7 @@ text: .text%ZIP_FreeEntry;
text: .text%Java_java_util_zip_ZipFile_initIDs;
text: .text%Java_java_util_zip_ZipFile_open;
text: .text%Java_java_util_zip_ZipFile_getTotal;
text: .text%Java_java_util_zip_ZipFile_startsWithLOC;
text: .text%Java_java_util_zip_ZipFile_getEntry;
text: .text%Java_java_util_zip_ZipFile_freeEntry;
text: .text%Java_java_util_zip_ZipFile_getEntryTime;
...
...
make/java/zip/reorder-sparcv9
浏览文件 @
5c89aa59
...
...
@@ -18,6 +18,7 @@ text: .text%ZIP_FreeEntry;
text: .text%Java_java_util_zip_ZipFile_initIDs;
text: .text%Java_java_util_zip_ZipFile_open;
text: .text%Java_java_util_zip_ZipFile_getTotal;
text: .text%Java_java_util_zip_ZipFile_startsWithLOC;
text: .text%Java_java_util_zip_ZipFile_getEntry;
text: .text%Java_java_util_zip_ZipFile_freeEntry;
text: .text%Java_java_util_zip_ZipFile_getEntryTime;
...
...
makefiles/mapfiles/libzip/mapfile-vers
浏览文件 @
5c89aa59
...
...
@@ -65,6 +65,7 @@ SUNWprivate_1.1 {
Java_java_util_zip_ZipFile_initIDs;
Java_java_util_zip_ZipFile_open;
Java_java_util_zip_ZipFile_read;
Java_java_util_zip_ZipFile_startsWithLOC;
ZIP_Close;
ZIP_CRC32;
...
...
makefiles/mapfiles/libzip/reorder-sparc
浏览文件 @
5c89aa59
...
...
@@ -18,6 +18,7 @@ text: .text%ZIP_FreeEntry;
text: .text%Java_java_util_zip_ZipFile_initIDs;
text: .text%Java_java_util_zip_ZipFile_open;
text: .text%Java_java_util_zip_ZipFile_getTotal;
text: .text%Java_java_util_zip_ZipFile_startsWithLOC;
text: .text%Java_java_util_zip_ZipFile_getEntry;
text: .text%Java_java_util_zip_ZipFile_freeEntry;
text: .text%Java_java_util_zip_ZipFile_getEntryTime;
...
...
makefiles/mapfiles/libzip/reorder-sparcv9
浏览文件 @
5c89aa59
...
...
@@ -18,6 +18,7 @@ text: .text%ZIP_FreeEntry;
text: .text%Java_java_util_zip_ZipFile_initIDs;
text: .text%Java_java_util_zip_ZipFile_open;
text: .text%Java_java_util_zip_ZipFile_getTotal;
text: .text%Java_java_util_zip_ZipFile_startsWithLOC;
text: .text%Java_java_util_zip_ZipFile_getEntry;
text: .text%Java_java_util_zip_ZipFile_freeEntry;
text: .text%Java_java_util_zip_ZipFile_getEntryTime;
...
...
makefiles/mapfiles/libzip/reorder-x86
浏览文件 @
5c89aa59
...
...
@@ -19,6 +19,7 @@ text: .text%ZIP_FreeEntry;
text: .text%Java_java_util_zip_ZipFile_initIDs;
text: .text%Java_java_util_zip_ZipFile_open;
text: .text%Java_java_util_zip_ZipFile_getTotal;
text: .text%Java_java_util_zip_ZipFile_startsWithLOC;
text: .text%Java_java_util_zip_ZipFile_getEntry;
text: .text%Java_java_util_zip_ZipFile_freeEntry;
text: .text%Java_java_util_zip_ZipFile_getEntryTime;
...
...
src/share/classes/java/util/zip/ZipFile.java
浏览文件 @
5c89aa59
...
...
@@ -55,8 +55,9 @@ import static java.util.zip.ZipConstants64.*;
public
class
ZipFile
implements
ZipConstants
,
Closeable
{
private
long
jzfile
;
// address of jzfile data
private
String
name
;
// zip file name
private
int
total
;
// total number of entries
private
final
String
name
;
// zip file name
private
final
int
total
;
// total number of entries
private
final
boolean
locsig
;
// if zip file starts with LOCSIG (usually true)
private
volatile
boolean
closeRequested
=
false
;
private
static
final
int
STORED
=
ZipEntry
.
STORED
;
...
...
@@ -216,6 +217,7 @@ class ZipFile implements ZipConstants, Closeable {
sun
.
misc
.
PerfCounter
.
getZipFileCount
().
increment
();
this
.
name
=
name
;
this
.
total
=
getTotal
(
jzfile
);
this
.
locsig
=
startsWithLOC
(
jzfile
);
}
/**
...
...
@@ -737,10 +739,28 @@ class ZipFile implements ZipConstants, Closeable {
}
}
static
{
sun
.
misc
.
SharedSecrets
.
setJavaUtilZipFileAccess
(
new
sun
.
misc
.
JavaUtilZipFileAccess
()
{
public
boolean
startsWithLocHeader
(
ZipFile
zip
)
{
return
zip
.
startsWithLocHeader
();
}
}
);
}
/**
* Returns {@code true} if, and only if, the zip file begins with {@code
* LOCSIG}.
*/
private
boolean
startsWithLocHeader
()
{
return
locsig
;
}
private
static
native
long
open
(
String
name
,
int
mode
,
long
lastModified
,
boolean
usemmap
)
throws
IOException
;
private
static
native
int
getTotal
(
long
jzfile
);
private
static
native
boolean
startsWithLOC
(
long
jzfile
);
private
static
native
int
read
(
long
jzfile
,
long
jzentry
,
long
pos
,
byte
[]
b
,
int
off
,
int
len
);
...
...
src/share/classes/sun/misc/JavaUtilZipFileAccess.java
0 → 100644
浏览文件 @
5c89aa59
/*
* Copyright (c) 2013, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
sun.misc
;
import
java.util.zip.ZipFile
;
public
interface
JavaUtilZipFileAccess
{
public
boolean
startsWithLocHeader
(
ZipFile
zip
);
}
src/share/classes/sun/misc/SharedSecrets.java
浏览文件 @
5c89aa59
...
...
@@ -52,6 +52,7 @@ public class SharedSecrets {
private
static
JavaIOFileDescriptorAccess
javaIOFileDescriptorAccess
;
private
static
JavaSecurityProtectionDomainAccess
javaSecurityProtectionDomainAccess
;
private
static
JavaSecurityAccess
javaSecurityAccess
;
private
static
JavaUtilZipFileAccess
javaUtilZipFileAccess
;
private
static
JavaAWTAccess
javaAWTAccess
;
public
static
JavaUtilJarAccess
javaUtilJarAccess
()
{
...
...
@@ -152,6 +153,16 @@ public class SharedSecrets {
return
javaSecurityAccess
;
}
public
static
JavaUtilZipFileAccess
getJavaUtilZipFileAccess
()
{
if
(
javaUtilZipFileAccess
==
null
)
unsafe
.
ensureClassInitialized
(
java
.
util
.
zip
.
ZipFile
.
class
);
return
javaUtilZipFileAccess
;
}
public
static
void
setJavaUtilZipFileAccess
(
JavaUtilZipFileAccess
access
)
{
javaUtilZipFileAccess
=
access
;
}
public
static
void
setJavaAWTAccess
(
JavaAWTAccess
jaa
)
{
javaAWTAccess
=
jaa
;
}
...
...
src/share/classes/sun/misc/URLClassPath.java
浏览文件 @
5c89aa59
...
...
@@ -64,6 +64,7 @@ public class URLClassPath {
final
static
String
USER_AGENT_JAVA_VERSION
=
"UA-Java-Version"
;
final
static
String
JAVA_VERSION
;
private
static
final
boolean
DEBUG
;
private
static
final
boolean
DISABLE_JAR_CHECKING
;
/**
* Used by launcher to indicate that checking of the JAR file "Profile"
...
...
@@ -76,6 +77,9 @@ public class URLClassPath {
new
sun
.
security
.
action
.
GetPropertyAction
(
"java.version"
));
DEBUG
=
(
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetPropertyAction
(
"sun.misc.URLClassPath.debug"
))
!=
null
);
String
p
=
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetPropertyAction
(
"sun.misc.URLClassPath.disableJarChecking"
));
DISABLE_JAR_CHECKING
=
p
!=
null
?
p
.
equals
(
"true"
)
||
p
.
equals
(
""
)
:
false
;
}
/* The original search path of URLs. */
...
...
@@ -544,7 +548,7 @@ public class URLClassPath {
* in a hurry.
*/
JarURLConnection
juc
=
(
JarURLConnection
)
uc
;
jarfile
=
juc
.
getJarFile
(
);
jarfile
=
JarLoader
.
checkJar
(
juc
.
getJarFile
()
);
}
}
catch
(
Exception
e
)
{
return
null
;
...
...
@@ -609,6 +613,8 @@ public class URLClassPath {
private
URLStreamHandler
handler
;
private
HashMap
<
String
,
Loader
>
lmap
;
private
boolean
closed
=
false
;
private
static
final
sun
.
misc
.
JavaUtilZipFileAccess
zipAccess
=
sun
.
misc
.
SharedSecrets
.
getJavaUtilZipFileAccess
();
/*
* Creates a new JarLoader for the specified URL referring to
...
...
@@ -713,6 +719,14 @@ public class URLClassPath {
}
}
/* Throws if the given jar file is does not start with the correct LOC */
static
JarFile
checkJar
(
JarFile
jar
)
throws
IOException
{
if
(
System
.
getSecurityManager
()
!=
null
&&
!
DISABLE_JAR_CHECKING
&&
!
zipAccess
.
startsWithLocHeader
(
jar
))
throw
new
IOException
(
"Invalid Jar file"
);
return
jar
;
}
private
JarFile
getJarFile
(
URL
url
)
throws
IOException
{
// Optimize case where url refers to a local jar file
if
(
isOptimizable
(
url
))
{
...
...
@@ -720,11 +734,12 @@ public class URLClassPath {
if
(!
p
.
exists
())
{
throw
new
FileNotFoundException
(
p
.
getPath
());
}
return
new
JarFile
(
p
.
getPath
(
));
return
checkJar
(
new
JarFile
(
p
.
getPath
()
));
}
URLConnection
uc
=
getBaseURL
().
openConnection
();
uc
.
setRequestProperty
(
USER_AGENT_JAVA_VERSION
,
JAVA_VERSION
);
return
((
JarURLConnection
)
uc
).
getJarFile
();
JarFile
jarFile
=
((
JarURLConnection
)
uc
).
getJarFile
();
return
checkJar
(
jarFile
);
}
/*
...
...
src/share/native/java/util/zip/ZipFile.c
浏览文件 @
5c89aa59
...
...
@@ -137,6 +137,14 @@ Java_java_util_zip_ZipFile_getTotal(JNIEnv *env, jclass cls, jlong zfile)
return
zip
->
total
;
}
JNIEXPORT
jboolean
JNICALL
Java_java_util_zip_ZipFile_startsWithLOC
(
JNIEnv
*
env
,
jclass
cls
,
jlong
zfile
)
{
jzfile
*
zip
=
jlong_to_ptr
(
zfile
);
return
zip
->
locsig
;
}
JNIEXPORT
void
JNICALL
Java_java_util_zip_ZipFile_close
(
JNIEnv
*
env
,
jclass
cls
,
jlong
zfile
)
{
...
...
src/share/native/java/util/zip/zip_util.c
浏览文件 @
5c89aa59
...
...
@@ -831,6 +831,14 @@ ZIP_Put_In_Cache0(const char *name, ZFILE zfd, char **pmsg, jlong lastModified,
return
NULL
;
}
// Assumption, zfd refers to start of file. Trivially, reuse errbuf.
if
(
readFully
(
zfd
,
errbuf
,
4
)
!=
-
1
)
{
// errors will be handled later
if
(
GETSIG
(
errbuf
)
==
LOCSIG
)
zip
->
locsig
=
JNI_TRUE
;
else
zip
->
locsig
=
JNI_FALSE
;
}
len
=
zip
->
len
=
IO_Lseek
(
zfd
,
0
,
SEEK_END
);
if
(
len
<=
0
)
{
if
(
len
==
0
)
{
/* zip file is empty */
...
...
src/share/native/java/util/zip/zip_util.h
浏览文件 @
5c89aa59
...
...
@@ -210,6 +210,7 @@ typedef struct jzfile { /* Zip file */
start of the file. */
jboolean
usemmap
;
/* if mmap is used. */
#endif
jboolean
locsig
;
/* if zip file starts with LOCSIG */
cencache
cencache
;
/* CEN header cache */
ZFILE
zfd
;
/* open file descriptor */
void
*
lock
;
/* read lock */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录