Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
1497d82e
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看板
提交
1497d82e
编写于
4月 06, 2009
作者:
A
alanb
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
66db0733
1d0ccdf3
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
753 addition
and
448 deletion
+753
-448
.hgtags
.hgtags
+2
-0
make/common/Defs.gmk
make/common/Defs.gmk
+9
-0
make/common/shared/Platform.gmk
make/common/shared/Platform.gmk
+14
-4
make/common/shared/Sanity-Settings.gmk
make/common/shared/Sanity-Settings.gmk
+1
-0
make/common/shared/Sanity.gmk
make/common/shared/Sanity.gmk
+4
-2
make/java/redist/Makefile
make/java/redist/Makefile
+4
-2
make/jdk_generic_profile.sh
make/jdk_generic_profile.sh
+2
-1
make/jprt.config
make/jprt.config
+0
-363
src/share/classes/java/util/zip/ZipConstants64.java
src/share/classes/java/util/zip/ZipConstants64.java
+77
-0
src/share/classes/java/util/zip/ZipEntry.java
src/share/classes/java/util/zip/ZipEntry.java
+5
-3
src/share/classes/java/util/zip/ZipInputStream.java
src/share/classes/java/util/zip/ZipInputStream.java
+63
-13
src/share/classes/java/util/zip/ZipOutputStream.java
src/share/classes/java/util/zip/ZipOutputStream.java
+149
-25
src/share/classes/java/util/zip/package.html
src/share/classes/java/util/zip/package.html
+7
-1
src/share/classes/sun/security/tools/KeyTool.java
src/share/classes/sun/security/tools/KeyTool.java
+19
-22
src/share/native/java/util/zip/zip_util.c
src/share/native/java/util/zip/zip_util.c
+97
-7
src/share/native/java/util/zip/zip_util.h
src/share/native/java/util/zip/zip_util.h
+36
-2
src/share/native/java/util/zip/zlib-1.1.3/zlib.h
src/share/native/java/util/zip/zlib-1.1.3/zlib.h
+2
-2
test/java/util/zip/LargeZip.java
test/java/util/zip/LargeZip.java
+193
-0
test/java/util/zip/ZipFile/LargeZipFile.java
test/java/util/zip/ZipFile/LargeZipFile.java
+0
-1
test/sun/security/tools/keytool/selfissued.sh
test/sun/security/tools/keytool/selfissued.sh
+69
-0
未找到文件。
.hgtags
浏览文件 @
1497d82e
...
@@ -26,3 +26,5 @@ b4ac413b1f129eeef0acab3f31081c1b7dfe3b27 jdk7-b47
...
@@ -26,3 +26,5 @@ b4ac413b1f129eeef0acab3f31081c1b7dfe3b27 jdk7-b47
8311105ea7a3db7bcbcb2b696459127c7f2297a4 jdk7-b49
8311105ea7a3db7bcbcb2b696459127c7f2297a4 jdk7-b49
58ba2cd5a25053684ec53205d95edeeaa0006f13 jdk7-b50
58ba2cd5a25053684ec53205d95edeeaa0006f13 jdk7-b50
fea0898259ae41c73620b1815aa48f036216155c jdk7-b51
fea0898259ae41c73620b1815aa48f036216155c jdk7-b51
bcbeadb4a5d759b29e876ee2c83401e91ff22f60 jdk7-b52
a2033addca678f9e4c0d92ffa1e389171cc9321d jdk7-b53
make/common/Defs.gmk
浏览文件 @
1497d82e
...
@@ -145,6 +145,11 @@ endif
...
@@ -145,6 +145,11 @@ endif
# 2. ALT_BINARY_PLUGS_PATH overrides all locations of classes and libraries
# 2. ALT_BINARY_PLUGS_PATH overrides all locations of classes and libraries
# 3. ALT_BUILD_BINARY_PLUGS_PATH is used to find a ALT_BINARY_PLUGS_PATH
# 3. ALT_BUILD_BINARY_PLUGS_PATH is used to find a ALT_BINARY_PLUGS_PATH
# 4. ALT_CLOSED_JDK_IMPORT_PATH is used to locate classes and libraries
# 4. ALT_CLOSED_JDK_IMPORT_PATH is used to locate classes and libraries
# Note: If any of the ALT_ variables are modified here, it is assumed
# that the build should be done with IMPORT_BINARY_PLUGS=true as
# well. Otherwise the default will be IMPORT_BINARY_PLUGS=false.
# Lastly, setting IMPORT_BINARY_PLUGS=false on the command line
# will override this logic, and plugs will not be imported.
#
#
# Always needed, defines the name of the imported/exported jarfile
# Always needed, defines the name of the imported/exported jarfile
...
@@ -155,9 +160,11 @@ ifdef OPENJDK
...
@@ -155,9 +160,11 @@ ifdef OPENJDK
CLOSED_JDK_IMPORT_PATH = $(ALT_CLOSED_JDK_IMPORT_PATH)
CLOSED_JDK_IMPORT_PATH = $(ALT_CLOSED_JDK_IMPORT_PATH)
BINARY_PLUGS_PATH = $(CLOSED_JDK_IMPORT_PATH)
BINARY_PLUGS_PATH = $(CLOSED_JDK_IMPORT_PATH)
BINARY_PLUGS_JARFILE = $(CLOSED_JDK_IMPORT_PATH)/jre/lib/rt.jar
BINARY_PLUGS_JARFILE = $(CLOSED_JDK_IMPORT_PATH)/jre/lib/rt.jar
IMPORT_BINARY_PLUGS=true
endif
endif
ifdef ALT_BUILD_BINARY_PLUGS_PATH
ifdef ALT_BUILD_BINARY_PLUGS_PATH
BUILD_BINARY_PLUGS_PATH = $(ALT_BUILD_BINARY_PLUGS_PATH)
BUILD_BINARY_PLUGS_PATH = $(ALT_BUILD_BINARY_PLUGS_PATH)
IMPORT_BINARY_PLUGS=true
else
else
BUILD_BINARY_PLUGS_PATH = $(SLASH_JAVA)/re/jdk/$(JDK_VERSION)/promoted/latest/openjdk/binaryplugs
BUILD_BINARY_PLUGS_PATH = $(SLASH_JAVA)/re/jdk/$(JDK_VERSION)/promoted/latest/openjdk/binaryplugs
endif
endif
...
@@ -166,9 +173,11 @@ ifdef OPENJDK
...
@@ -166,9 +173,11 @@ ifdef OPENJDK
ifdef ALT_BINARY_PLUGS_PATH
ifdef ALT_BINARY_PLUGS_PATH
BINARY_PLUGS_PATH = $(ALT_BINARY_PLUGS_PATH)
BINARY_PLUGS_PATH = $(ALT_BINARY_PLUGS_PATH)
BINARY_PLUGS_JARFILE = $(BINARY_PLUGS_PATH)/jre/lib/$(BINARY_PLUGS_JARNAME)
BINARY_PLUGS_JARFILE = $(BINARY_PLUGS_PATH)/jre/lib/$(BINARY_PLUGS_JARNAME)
IMPORT_BINARY_PLUGS=true
endif
endif
ifdef ALT_BINARY_PLUGS_JARFILE
ifdef ALT_BINARY_PLUGS_JARFILE
BINARY_PLUGS_JARFILE = $(ALT_BINARY_PLUGS_JARFILE)
BINARY_PLUGS_JARFILE = $(ALT_BINARY_PLUGS_JARFILE)
IMPORT_BINARY_PLUGS=true
endif
endif
endif # OPENJDK
endif # OPENJDK
...
...
make/common/shared/Platform.gmk
浏览文件 @
1497d82e
...
@@ -229,11 +229,19 @@ ifeq ($(PLATFORM), windows)
...
@@ -229,11 +229,19 @@ ifeq ($(PLATFORM), windows)
TEMP_DISK=C:/temp
TEMP_DISK=C:/temp
# GNU Make or MKS overrides $(PROCESSOR_ARCHITECTURE) to always
# GNU Make or MKS overrides $(PROCESSOR_ARCHITECTURE) to always
# return "x86". Use the first word of $(PROCESSOR_IDENTIFIER) instead.
# return "x86". Use the first word of $(PROCESSOR_IDENTIFIER) instead.
PROC_ARCH:=$(word 1, $(PROCESSOR_IDENTIFIER))
PROC_ARCH:=$(subst x86,X86,$(PROC_ARCH))
PROC_ARCH:=$(subst Intel64,X64,$(PROC_ARCH))
PROC_ARCH:=$(subst em64t,X64,$(PROC_ARCH))
PROC_ARCH:=$(subst EM64T,X64,$(PROC_ARCH))
PROC_ARCH:=$(subst amd64,X64,$(PROC_ARCH))
PROC_ARCH:=$(subst AMD64,X64,$(PROC_ARCH))
PROC_ARCH:=$(subst ia64,IA64,$(PROC_ARCH))
ifndef ARCH_DATA_MODEL
ifndef ARCH_DATA_MODEL
ifeq ($(
word 1, $(PROCESSOR_IDENTIFIER)),ia
64)
ifeq ($(
PROC_ARCH),IA
64)
ARCH_DATA_MODEL=64
ARCH_DATA_MODEL=64
else
else
ifeq ($(
word 1, $(PROCESSOR_IDENTIFIER)),AMD
64)
ifeq ($(
PROC_ARCH),X
64)
ARCH_DATA_MODEL=64
ARCH_DATA_MODEL=64
else
else
ARCH_DATA_MODEL=32
ARCH_DATA_MODEL=32
...
@@ -245,10 +253,12 @@ ifeq ($(PLATFORM), windows)
...
@@ -245,10 +253,12 @@ ifeq ($(PLATFORM), windows)
# If the user wants to perform a cross compile build then they must
# If the user wants to perform a cross compile build then they must
# - set ARCH_DATA_MODEL=64 and either
# - set ARCH_DATA_MODEL=64 and either
# + set ARCH to ia64 or amd64, or
# + set ARCH to ia64 or amd64, or
ifeq ($(
word 1, $(PROCESSOR_IDENTIFIER)), AMD
64)
ifeq ($(
PROC_ARCH),X
64)
ARCH=amd64
ARCH=amd64
else
else
ARCH=ia64
ifeq ($(PROC_ARCH),IA64)
ARCH=ia64
endif
endif
endif
LIBARCH=$(ARCH)
LIBARCH=$(ARCH)
# Value of Java os.arch property
# Value of Java os.arch property
...
...
make/common/shared/Sanity-Settings.gmk
浏览文件 @
1497d82e
...
@@ -245,6 +245,7 @@ ifdef OPENJDK
...
@@ -245,6 +245,7 @@ ifdef OPENJDK
ALL_SETTINGS+=$(call addAltSetting,FREETYPE_HEADERS_PATH)
ALL_SETTINGS+=$(call addAltSetting,FREETYPE_HEADERS_PATH)
ALL_SETTINGS+=$(call addAltSetting,FREETYPE_LIB_PATH)
ALL_SETTINGS+=$(call addAltSetting,FREETYPE_LIB_PATH)
ALL_SETTINGS+=$(call addHeading,OPENJDK Import Binary Plug Settings)
ALL_SETTINGS+=$(call addHeading,OPENJDK Import Binary Plug Settings)
ALL_SETTINGS+=$(call addOptionalSetting,IMPORT_BINARY_PLUGS)
ALL_SETTINGS+=$(call addAltSetting,BINARY_PLUGS_JARFILE)
ALL_SETTINGS+=$(call addAltSetting,BINARY_PLUGS_JARFILE)
ALL_SETTINGS+=$(call addAltSetting,BINARY_PLUGS_PATH)
ALL_SETTINGS+=$(call addAltSetting,BINARY_PLUGS_PATH)
ALL_SETTINGS+=$(call addAltSetting,BUILD_BINARY_PLUGS_PATH)
ALL_SETTINGS+=$(call addAltSetting,BUILD_BINARY_PLUGS_PATH)
...
...
make/common/shared/Sanity.gmk
浏览文件 @
1497d82e
...
@@ -502,13 +502,15 @@ endif
...
@@ -502,13 +502,15 @@ endif
######################################################
######################################################
ifdef OPENJDK
ifdef OPENJDK
sane-binary-plugs:
sane-binary-plugs:
ifeq ($(IMPORT_BINARY_PLUGS),true)
@if [ ! -d "$(BINARY_PLUGS_PATH)" ]; then \
@if [ ! -d "$(BINARY_PLUGS_PATH)" ]; then \
$(ECHO) "
ERROR
: Can't locate pre-built libraries. \n" \
$(ECHO) "
WARNING
: Can't locate pre-built libraries. \n" \
" Please check your access to \n" \
" Please check your access to \n" \
" $(BINARY_PLUGS_PATH) \n" \
" $(BINARY_PLUGS_PATH) \n" \
" and/or check your value of ALT_BINARY_PLUGS_PATH. \n" \
" and/or check your value of ALT_BINARY_PLUGS_PATH. \n" \
"" >> $(
ERROR
_FILE); \
"" >> $(
WARNING
_FILE); \
fi
fi
endif
endif
endif
######################################################
######################################################
...
...
make/java/redist/Makefile
浏览文件 @
1497d82e
...
@@ -251,9 +251,11 @@ endif # INCLUDE_SA
...
@@ -251,9 +251,11 @@ endif # INCLUDE_SA
#
#
ifdef
OPENJDK
ifdef
OPENJDK
include
$(BUILDDIR)/common/internal/BinaryPlugs.gmk
ifeq
($(IMPORT_BINARY_PLUGS),true)
include
$(BUILDDIR)/common/internal/BinaryPlugs.gmk
build
:
import-binary-plugs
build
:
import-binary-plugs
endif
else
# !OPENJDK
else
# !OPENJDK
...
...
make/jdk_generic_profile.sh
浏览文件 @
1497d82e
...
@@ -174,7 +174,8 @@ else
...
@@ -174,7 +174,8 @@ else
# Check CYGWIN (should have already been done)
# Check CYGWIN (should have already been done)
# Assumption here is that you are in a shell window via cygwin.
# Assumption here is that you are in a shell window via cygwin.
if
[
"
$(
echo
${
PROCESSOR_IDENTIFIER
}
| fgrep AMD64
)
"
!=
""
]
;
then
proc_arch
=
`
echo
"
$(
PROCESSOR_IDENTIFIER
)
"
|
expand
|
cut
-d
' '
-f1
|
sed
-e
's@x86@X86@g'
-e
's@Intel64@X64@g'
-e
's@em64t@X64@g'
-e
's@EM64T@X64@g'
-e
's@amd64@X64@g'
-e
's@AMD64@X64@g'
-e
's@ia64@IA64@g'
`
if
[
"
${
proc_arch
}
"
=
"X64"
]
;
then
windows_arch
=
amd64
windows_arch
=
amd64
else
else
windows_arch
=
i586
windows_arch
=
i586
...
...
make/jprt.config
已删除
100644 → 0
浏览文件 @
66db0733
#!echo "This is not a shell script"
#############################################################################
#
# Copyright 2006-2008 Sun Microsystems, Inc. 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. Sun designates this
# particular file as subject to the "Classpath" exception as provided
# by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
#############################################################################
#
# JPRT shell configuration for building.
#
# Input environment variables:
# ALT_BOOTDIR
# ALT_SLASH_JAVA
# ALT_JDK_IMPORT_PATH
# OPENJDK
# Windows Only:
# PATH
# VS71COMNTOOLS
# PROCESSOR_IDENTIFIER
# ROOTDIR
#
# Output variable settings:
# make Full path to GNU make
# compiler_path Path to compiler bin directory
# compiler_name Unique name of this compiler
#
# Output environment variables:
# PATH
# ALT_COMPILER_PATH
# OPENJDK only:
# ALT_CLOSED_JDK_IMPORT_PATH
# ALT_JDK_DEVTOOLS_DIR
# Windows Only:
# ALT_MSDEVTOOLS_PATH
# ALT_DEVTOOLS_PATH (To avoid the C:/UTILS default)
# LIB
# INCLUDE
#
# After JDK6, most settings will be found via ALT_SLASH_JAVA or
# by way of other system environment variables. If this was JDK5
# or an older JDK, you might need to export more ALT_* variables.
#
# On Windows AMD64, if MSSDK is not set, assumes Platform SDK is installed at:
# C:/Program Files/Microsoft Platform SDK
#
#############################################################################
#############################################################################
# Error
error
()
# message
{
echo
"ERROR: $1"
exit
6
}
# Directory must exist
dirMustExist
()
# dir name
{
if
[ ! -
d
"$1"
] ;
then
error
"Directory for $2 does not exist: $1"
fi
}
# File must exist
fileMustExist
()
# dir name
{
if
[ ! -
f
"$1"
] ;
then
error
"File for $2 does not exist: $1"
fi
}
#############################################################################
# Should be set by JPRT as the 3 basic inputs
bootdir
=
"${ALT_BOOTDIR}"
slashjava
=
"${ALT_SLASH_JAVA}"
jdk_import
=
"${ALT_JDK_IMPORT_PATH}"
# The /java/devtools items
jdk_devtools
=
"${slashjava}/devtools"
share
=
"${jdk_devtools}/share"
# Needed for langtools, maybe other parts of the build
ANT_HOME
=
"${share}/ant/latest"
export
ANT_HOME
# The 3 bin directories in common to all platforms
sharebin
=
"${share}/bin"
antbin
=
"${ANT_HOME}/bin"
# Check input
dirMustExist
"${bootdir}"
ALT_BOOTDIR
dirMustExist
"${slashjava}"
ALT_SLASH_JAVA
dirMustExist
"${jdk_import}"
ALT_JDK_IMPORT_PATH
dirMustExist
"${ANT_HOME}"
ANT_HOME
# Use the JDK import for now (FIXME: use the binary plugs?)
if
[
"${OPENJDK}"
=
true
] ;
then
ALT_CLOSED_JDK_IMPORT_PATH
=
"${jdk_import}"
export
ALT_CLOSED_JDK_IMPORT_PATH
fi
# Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise.
osname
=`
uname
-
s
`
if
[
"${osname}"
=
SunOS
] ;
then
# SOLARIS: Sparc or X86
osarch
=`
uname
-
p
`
if
[
"${osarch}"
=
sparc
] ;
then
solaris_arch
=
sparc
else
solaris_arch
=
i386
fi
# Get the compilers into path (make sure it matches ALT setting)
if
[
"${JPRT_SOLARIS_COMPILER_NAME}"
!=
""
] ;
then
compiler_name
=${
JPRT_SOLARIS_COMPILER_NAME
}
else
compiler_name
=
SS12
fi
compiler_path
=${
jdk_devtools
}/${
solaris_arch
}/
SUNWspro
/${
compiler_name
}/
bin
ALT_COMPILER_PATH
=
"${compiler_path}"
export
ALT_COMPILER_PATH
dirMustExist
"${compiler_path}"
ALT_COMPILER_PATH
path4sdk
=${
compiler_path
}:${
sharebin
}:${
antbin
}
# Add basic solaris system paths
path4sdk
=${
path4sdk
}:/
usr
/
ccs
/
bin
:/
usr
/
ccs
/
lib
:/
usr
/
bin
:/
bin
:/
usr
/
sfw
/
bin
# Get the previous JDK to be used to bootstrap the build
path4sdk
=${
bootdir
}/
bin
:${
path4sdk
}
# Find GNU make
make
=/
usr
/
sfw
/
bin
/
gmake
if
[ ! -
f
${
make
} ] ;
then
make
=/
opt
/
sfw
/
bin
/
gmake
if
[ ! -
f
${
make
} ] ;
then
make
=${
jdk_devtools
}/${
solaris_arch
}/
bin
/
gnumake
fi
fi
fileMustExist
"${make}"
make
# File creation mask
umask
002
elif
[
"${osname}"
=
Linux
] ;
then
# LINUX: X86, AMD64
osarch
=`
uname
-
m
`
if
[
"${osarch}"
=
i686
] ;
then
linux_arch
=
i586
elif
[
"${osarch}"
=
x86_64
] ;
then
linux_arch
=
amd64
fi
# Get the compilers into path (make sure it matches ALT setting)
compiler_path
=/
usr
/
bin
compiler_name
=
usr_bin
ALT_COMPILER_PATH
=
"${compiler_path}"
export
ALT_COMPILER_PATH
dirMustExist
"${compiler_path}"
ALT_COMPILER_PATH
path4sdk
=${
compiler_path
}:${
sharebin
}:${
antbin
}
# Add basic paths
path4sdk
=${
path4sdk
}:/
usr
/
bin
:/
bin
:/
usr
/
sbin
:/
sbin
# Get the previous JDK to be used to bootstrap the build
path4sdk
=${
bootdir
}/
bin
:${
path4sdk
}
# Find GNU make
make
=/
usr
/
bin
/
make
fileMustExist
"${make}"
make
umask
002
# Linux platform may be old, use motif files from the devtools area
if
[
"${OPENJDK}"
=
true
] ;
then
ALT_JDK_DEVTOOLS_DIR
=
"${jdk_devtools}"
export
ALT_JDK_DEVTOOLS_DIR
fi
else
# Windows: Differs on CYGWIN vs. MKS, and the compiler available.
# Also, blanks in pathnames gives GNU make headaches, so anything placed
# in any ALT_* variable should be the short windows dosname.
# WINDOWS: Install and use MKS or CYGWIN (should have already been done)
# Assumption here is that you are in a shell window via MKS or cygwin.
# MKS install should have defined the environment variable ROOTDIR.
# We also need to figure out which one we have: X86, AMD64
if
[
"`echo ${PROCESSOR_IDENTIFIER} | fgrep AMD64`"
!=
""
] ;
then
windows_arch
=
amd64
else
windows_arch
=
i586
fi
# We need to determine if we are running a CYGWIN shell or an MKS shell
# (if uname isn't available, then it will be unix_toolset=unknown)
unix_toolset
=
unknown
if
[
"`uname -a | fgrep Cygwin`"
=
""
-
a
-
d
"${ROOTDIR}"
] ;
then
# We kind of assume ROOTDIR is where MKS is and it's ok
unix_toolset
=
MKS
mkshome
=`
dosname
-
s
"${ROOTDIR}"
`
# Utility to convert to short pathnames without spaces
dosname
=
"${mkshome}/mksnt/dosname -s"
# Most unix utilities are in the mksnt directory of ROOTDIR
unixcommand_path
=
"${mkshome}/mksnt"
path4sdk
=
"${sharebin};${antbin};${unixcommand_path}"
dirMustExist
"${unixcommand_path}"
ALT_UNIXCOMMAND_PATH
devtools_path
=
"${jdk_devtools}/win32/bin"
path4sdk
=
"${devtools_path};${path4sdk}"
# Normally this need not be set, but on Windows it's default is C:/UTILS
ALT_DEVTOOLS_PATH
=
"${devtools_path}"
export
ALT_DEVTOOLS_PATH
dirMustExist
"${devtools_path}"
ALT_DEVTOOLS_PATH
# Find GNU make
make
=
"${devtools_path}/gnumake.exe"
fileMustExist
"${make}"
make
elif
[
"`uname -a | fgrep Cygwin`"
!=
""
-
a
-
f
/
bin
/
cygpath
] ;
then
# For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist
unix_toolset
=
CYGWIN
# Utility to convert to short pathnames without spaces
dosname
=
"/usr/bin/cygpath -a -m -s"
# Most unix utilities are in the /usr/bin
unixcommand_path
=
"/usr/bin"
path4sdk
=
"${sharebin};${antbin};${unixcommand_path}"
dirMustExist
"${unixcommand_path}"
ALT_UNIXCOMMAND_PATH
# Find GNU make
make
=
"${unixcommand_path}/make.exe"
fileMustExist
"${make}"
make
else
echo
"WARNING: Cannot figure out if this is MKS or CYGWIN"
fi
# WINDOWS: Compiler setup (nasty part)
# NOTE: You can use vcvars32.bat to set PATH, LIB, and INCLUDE.
# NOTE: CYGWIN has a link.exe too, make sure the compilers are first
if
[
"${windows_arch}"
=
i586
] ;
then
# 32bit Windows compiler settings
# VisualStudio .NET 2003 VC++ 7.1 (VS71COMNTOOLS should be defined)
vs_root
=`${
dosname
}
"${VS71COMNTOOLS}/../.."
`
# Fill in PATH, LIB, and INCLUDE (unset all others to make sure)
msdev_root
=
"${vs_root}/Common7/Tools"
msdevtools_path
=
"${msdev_root}/bin"
vc7_root
=
"${vs_root}/Vc7"
compiler_path
=
"${vc7_root}/bin"
compiler_name
=
VS2003
platform_sdk
=
"${vc7_root}/PlatformSDK"
# LIB and INCLUDE must use ; as a separator
include4sdk
=
"${vc7_root}/atlmfc/include"
include4sdk
=
"${include4sdk};${vc7_root}/include"
include4sdk
=
"${include4sdk};${platform_sdk}/include/prerelease"
include4sdk
=
"${include4sdk};${platform_sdk}/include"
include4sdk
=
"${include4sdk};${vs_root}/SDK/v1.1/include"
lib4sdk
=
"${vc7_root}/atlmfc/lib"
lib4sdk
=
"${lib4sdk};${vc7_root}/lib"
lib4sdk
=
"${lib4sdk};${platform_sdk}/lib/prerelease"
lib4sdk
=
"${lib4sdk};${platform_sdk}/lib"
lib4sdk
=
"${lib4sdk};${vs_root}/SDK/v1.1/lib"
# Search path and DLL locating path
# WARNING: CYGWIN has a link.exe too, make sure compilers are first
path4sdk
=
"${vs_root}/Common7/Tools/bin;${path4sdk}"
path4sdk
=
"${vs_root}/SDK/v1.1/bin;${path4sdk}"
path4sdk
=
"${vs_root}/Common7/Tools;${path4sdk}"
path4sdk
=
"${vs_root}/Common7/Tools/bin/prerelease;${path4sdk}"
path4sdk
=
"${vs_root}/Common7/IDE;${path4sdk}"
path4sdk
=
"${compiler_path};${path4sdk}"
elif
[
"${windows_arch}"
=
amd64
] ;
then
# AMD64 64bit Windows compiler settings
if
[
"${MSSDK}"
!=
""
] ;
then
platform_sdk
=
"${MSSDK}"
else
platform_sdk
=`${
dosname
}
"C:/Program Files/Microsoft Platform SDK/"
`
fi
compiler_path
=
"${platform_sdk}/Bin/win64/x86/AMD64"
compiler_name
=
VS2005_PSDK
msdevtools_path
=
"${platform_sdk}/Bin"
# LIB and INCLUDE must use ; as a separator
include4sdk
=
"${platform_sdk}/Include"
include4sdk
=
"${include4sdk};${platform_sdk}/Include/crt/sys"
include4sdk
=
"${include4sdk};${platform_sdk}/Include/mfc"
include4sdk
=
"${include4sdk};${platform_sdk}/Include/atl"
include4sdk
=
"${include4sdk};${platform_sdk}/Include/crt"
lib4sdk
=
"${platform_sdk}/Lib/AMD64"
lib4sdk
=
"${lib4sdk};${platform_sdk}/Lib/AMD64/atlmfc"
# Search path and DLL locating path
# WARNING: CYGWIN has a link.exe too, make sure compilers are first
path4sdk
=
"${platform_sdk}/bin;${path4sdk}"
path4sdk
=
"${compiler_path};${path4sdk}"
fi
# Export LIB and INCLUDE
unset
lib
unset
Lib
LIB
=
"${lib4sdk}"
export
LIB
unset
include
unset
Include
INCLUDE
=
"${include4sdk}"
export
INCLUDE
# Set the ALT variable
ALT_COMPILER_PATH
=`${
dosname
}
"${compiler_path}"
`
export
ALT_COMPILER_PATH
dirMustExist
"${compiler_path}"
ALT_COMPILER_PATH
ALT_MSDEVTOOLS_PATH
=`${
dosname
}
"${msdevtools_path}"
`
export
ALT_MSDEVTOOLS_PATH
dirMustExist
"${msdevtools_path}"
ALT_MSDEVTOOLS_PATH
# WINDOWS: Get the previous JDK to be used to bootstrap the build
path4sdk
=
"${bootdir}/bin;${path4sdk}"
# Turn all \\ into /, remove duplicates and trailing /
slash_path
=
"`echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g'`"
# For windows, it's hard to know where the system is, so we just add this
# to PATH.
path4sdk
=
"${slash_path};${PATH}"
# Convert path4sdk to cygwin style
if
[
"${unix_toolset}"
=
CYGWIN
] ;
then
path4sdk
=
"`/usr/bin/cygpath -p ${path4sdk}`"
fi
# Set special windows ALT variables
ALT_ISHIELDDIR
=
"C:/ishield802"
export
ALT_ISHIELDDIR
# Sponsors binaries
ALT_SPONSOR1DIR
=
C
:/
sponsor_binaries
export
ALT_SPONSOR1DIR
ALT_SPONSOR2DIR
=
C
:/
sponsor_binaries
export
ALT_SPONSOR2DIR
fi
# Export PATH setting
PATH
=
"${path4sdk}"
export
PATH
# Things we need to unset
unset
LD_LIBRARY_PATH
unset
LD_LIBRARY_PATH_32
unset
LD_LIBRARY_PATH_64
unset
JAVA_HOME
src/share/classes/java/util/zip/ZipConstants64.java
0 → 100644
浏览文件 @
1497d82e
/*
* Copyright 1995-1996 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package
java.util.zip
;
/*
* This class defines the constants that are used by the classes
* which manipulate Zip64 files.
*/
class
ZipConstants64
{
/*
* ZIP64 constants
*/
static
final
long
ZIP64_ENDSIG
=
0x06064b50
L
;
// "PK\006\006"
static
final
long
ZIP64_LOCSIG
=
0x07064b50
L
;
// "PK\006\007"
static
final
int
ZIP64_ENDHDR
=
56
;
// ZIP64 end header size
static
final
int
ZIP64_LOCHDR
=
20
;
// ZIP64 end loc header size
static
final
int
ZIP64_EXTHDR
=
24
;
// EXT header size
static
final
int
ZIP64_EXTID
=
0x0001
;
// Extra field Zip64 header ID
static
final
int
ZIP64_MAGICCOUNT
=
0xFFFF
;
static
final
long
ZIP64_MAGICVAL
=
0xFFFFFFFF
L
;
/*
* Zip64 End of central directory (END) header field offsets
*/
static
final
int
ZIP64_ENDLEN
=
4
;
// size of zip64 end of central dir
static
final
int
ZIP64_ENDVEM
=
12
;
// version made by
static
final
int
ZIP64_ENDVER
=
14
;
// version needed to extract
static
final
int
ZIP64_ENDNMD
=
16
;
// number of this disk
static
final
int
ZIP64_ENDDSK
=
20
;
// disk number of start
static
final
int
ZIP64_ENDTOD
=
24
;
// total number of entries on this disk
static
final
int
ZIP64_ENDTOT
=
32
;
// total number of entries
static
final
int
ZIP64_ENDSIZ
=
40
;
// central directory size in bytes
static
final
int
ZIP64_ENDOFF
=
48
;
// offset of first CEN header
static
final
int
ZIP64_ENDEXT
=
56
;
// zip64 extensible data sector
/*
* Zip64 End of central directory locator field offsets
*/
static
final
int
ZIP64_LOCDSK
=
4
;
// disk number start
static
final
int
ZIP64_LOCOFF
=
8
;
// offset of zip64 end
static
final
int
ZIP64_LOCTOT
=
16
;
// total number of disks
/*
* Zip64 Extra local (EXT) header field offsets
*/
static
final
int
ZIP64_EXTCRC
=
4
;
// uncompressed file crc-32 value
static
final
int
ZIP64_EXTSIZ
=
8
;
// compressed size, 8-byte
static
final
int
ZIP64_EXTLEN
=
16
;
// uncompressed size, 8-byte
private
ZipConstants64
()
{}
}
src/share/classes/java/util/zip/ZipEntry.java
浏览文件 @
1497d82e
/*
/*
* Copyright 1995-200
5
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1995-200
9
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -144,11 +144,13 @@ class ZipEntry implements ZipConstants, Cloneable {
...
@@ -144,11 +144,13 @@ class ZipEntry implements ZipConstants, Cloneable {
* Sets the uncompressed size of the entry data.
* Sets the uncompressed size of the entry data.
* @param size the uncompressed size in bytes
* @param size the uncompressed size in bytes
* @exception IllegalArgumentException if the specified size is less
* @exception IllegalArgumentException if the specified size is less
* than 0 or greater than 0xFFFFFFFF bytes
* than 0, is greater than 0xFFFFFFFF when
* <a href="package-summary.html#zip64">ZIP64 format</a> is not supported,
* or is less than 0 when ZIP64 is supported
* @see #getSize()
* @see #getSize()
*/
*/
public
void
setSize
(
long
size
)
{
public
void
setSize
(
long
size
)
{
if
(
size
<
0
||
size
>
0xFFFFFFFF
L
)
{
if
(
size
<
0
)
{
throw
new
IllegalArgumentException
(
"invalid entry size"
);
throw
new
IllegalArgumentException
(
"invalid entry size"
);
}
}
this
.
size
=
size
;
this
.
size
=
size
;
...
...
src/share/classes/java/util/zip/ZipInputStream.java
浏览文件 @
1497d82e
/*
/*
* Copyright 1996-200
6
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1996-200
9
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -29,6 +29,7 @@ import java.io.InputStream;
...
@@ -29,6 +29,7 @@ import java.io.InputStream;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.EOFException
;
import
java.io.EOFException
;
import
java.io.PushbackInputStream
;
import
java.io.PushbackInputStream
;
import
static
java
.
util
.
zip
.
ZipConstants64
.*;
/**
/**
* This class implements an input stream filter for reading files in the
* This class implements an input stream filter for reading files in the
...
@@ -285,6 +286,29 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants {
...
@@ -285,6 +286,29 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants {
byte
[]
bb
=
new
byte
[
len
];
byte
[]
bb
=
new
byte
[
len
];
readFully
(
bb
,
0
,
len
);
readFully
(
bb
,
0
,
len
);
e
.
setExtra
(
bb
);
e
.
setExtra
(
bb
);
// extra fields are in "HeaderID(2)DataSize(2)Data... format
if
(
e
.
csize
==
ZIP64_MAGICVAL
||
e
.
size
==
ZIP64_MAGICVAL
)
{
int
off
=
0
;
while
(
off
+
4
<
len
)
{
int
sz
=
get16
(
bb
,
off
+
2
);
if
(
get16
(
bb
,
off
)
==
ZIP64_EXTID
)
{
off
+=
4
;
// LOC extra zip64 entry MUST include BOTH original and
// compressed file size fields
if
(
sz
<
16
||
(
off
+
sz
)
>
len
)
{
// Invalid zip64 extra fields, simply skip. Even it's
// rare, it's possible the entry size happens to be
// the magic value and it "accidnetly" has some bytes
// in extra match the id.
return
e
;
}
e
.
size
=
get64
(
bb
,
off
);
e
.
csize
=
get64
(
bb
,
off
+
8
);
break
;
}
off
+=
(
sz
+
4
);
}
}
}
}
return
e
;
return
e
;
}
}
...
@@ -375,18 +399,36 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants {
...
@@ -375,18 +399,36 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants {
}
}
if
((
flag
&
8
)
==
8
)
{
if
((
flag
&
8
)
==
8
)
{
/* "Data Descriptor" present */
/* "Data Descriptor" present */
readFully
(
tmpbuf
,
0
,
EXTHDR
);
if
(
inf
.
getBytesWritten
()
>
ZIP64_MAGICVAL
||
long
sig
=
get32
(
tmpbuf
,
0
);
inf
.
getBytesRead
()
>
ZIP64_MAGICVAL
)
{
if
(
sig
!=
EXTSIG
)
{
// no EXTSIG present
// ZIP64 format
e
.
crc
=
sig
;
readFully
(
tmpbuf
,
0
,
ZIP64_EXTHDR
);
e
.
csize
=
get32
(
tmpbuf
,
EXTSIZ
-
EXTCRC
);
long
sig
=
get32
(
tmpbuf
,
0
);
e
.
size
=
get32
(
tmpbuf
,
EXTLEN
-
EXTCRC
);
if
(
sig
!=
EXTSIG
)
{
// no EXTSIG present
((
PushbackInputStream
)
in
).
unread
(
e
.
crc
=
sig
;
tmpbuf
,
EXTHDR
-
EXTCRC
-
1
,
EXTCRC
);
e
.
csize
=
get64
(
tmpbuf
,
ZIP64_EXTSIZ
-
ZIP64_EXTCRC
);
e
.
size
=
get64
(
tmpbuf
,
ZIP64_EXTLEN
-
ZIP64_EXTCRC
);
((
PushbackInputStream
)
in
).
unread
(
tmpbuf
,
ZIP64_EXTHDR
-
ZIP64_EXTCRC
-
1
,
ZIP64_EXTCRC
);
}
else
{
e
.
crc
=
get32
(
tmpbuf
,
ZIP64_EXTCRC
);
e
.
csize
=
get64
(
tmpbuf
,
ZIP64_EXTSIZ
);
e
.
size
=
get64
(
tmpbuf
,
ZIP64_EXTLEN
);
}
}
else
{
}
else
{
e
.
crc
=
get32
(
tmpbuf
,
EXTCRC
);
readFully
(
tmpbuf
,
0
,
EXTHDR
);
e
.
csize
=
get32
(
tmpbuf
,
EXTSIZ
);
long
sig
=
get32
(
tmpbuf
,
0
);
e
.
size
=
get32
(
tmpbuf
,
EXTLEN
);
if
(
sig
!=
EXTSIG
)
{
// no EXTSIG present
e
.
crc
=
sig
;
e
.
csize
=
get32
(
tmpbuf
,
EXTSIZ
-
EXTCRC
);
e
.
size
=
get32
(
tmpbuf
,
EXTLEN
-
EXTCRC
);
((
PushbackInputStream
)
in
).
unread
(
tmpbuf
,
EXTHDR
-
EXTCRC
-
1
,
EXTCRC
);
}
else
{
e
.
crc
=
get32
(
tmpbuf
,
EXTCRC
);
e
.
csize
=
get32
(
tmpbuf
,
EXTSIZ
);
e
.
size
=
get32
(
tmpbuf
,
EXTLEN
);
}
}
}
}
}
if
(
e
.
size
!=
inf
.
getBytesWritten
())
{
if
(
e
.
size
!=
inf
.
getBytesWritten
())
{
...
@@ -433,6 +475,14 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants {
...
@@ -433,6 +475,14 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants {
* The bytes are assumed to be in Intel (little-endian) byte order.
* The bytes are assumed to be in Intel (little-endian) byte order.
*/
*/
private
static
final
long
get32
(
byte
b
[],
int
off
)
{
private
static
final
long
get32
(
byte
b
[],
int
off
)
{
return
get16
(
b
,
off
)
|
((
long
)
get16
(
b
,
off
+
2
)
<<
16
);
return
(
get16
(
b
,
off
)
|
((
long
)
get16
(
b
,
off
+
2
)
<<
16
))
&
0xffffffff
L
;
}
/*
* Fetches signed 64-bit value from byte array at specified offset.
* The bytes are assumed to be in Intel (little-endian) byte order.
*/
private
static
final
long
get64
(
byte
b
[],
int
off
)
{
return
get32
(
b
,
off
)
|
(
get32
(
b
,
off
+
4
)
<<
32
);
}
}
}
}
src/share/classes/java/util/zip/ZipOutputStream.java
浏览文件 @
1497d82e
/*
/*
* Copyright 1996-200
8
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1996-200
9
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -29,6 +29,7 @@ import java.io.OutputStream;
...
@@ -29,6 +29,7 @@ import java.io.OutputStream;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Vector
;
import
java.util.Vector
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
static
java
.
util
.
zip
.
ZipConstants64
.*;
/**
/**
* This class implements an output stream filter for writing files in the
* This class implements an output stream filter for writing files in the
...
@@ -343,26 +344,52 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
...
@@ -343,26 +344,52 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
private
void
writeLOC
(
XEntry
xentry
)
throws
IOException
{
private
void
writeLOC
(
XEntry
xentry
)
throws
IOException
{
ZipEntry
e
=
xentry
.
entry
;
ZipEntry
e
=
xentry
.
entry
;
int
flag
=
xentry
.
flag
;
int
flag
=
xentry
.
flag
;
int
elen
=
(
e
.
extra
!=
null
)
?
e
.
extra
.
length
:
0
;
boolean
hasZip64
=
false
;
writeInt
(
LOCSIG
);
// LOC header signature
writeInt
(
LOCSIG
);
// LOC header signature
writeShort
(
version
(
e
));
// version needed to extract
writeShort
(
flag
);
// general purpose bit flag
writeShort
(
e
.
method
);
// compression method
writeInt
(
e
.
time
);
// last modification time
if
((
flag
&
8
)
==
8
)
{
if
((
flag
&
8
)
==
8
)
{
writeShort
(
version
(
e
));
// version needed to extract
writeShort
(
flag
);
// general purpose bit flag
writeShort
(
e
.
method
);
// compression method
writeInt
(
e
.
time
);
// last modification time
// store size, uncompressed size, and crc-32 in data descriptor
// store size, uncompressed size, and crc-32 in data descriptor
// immediately following compressed entry data
// immediately following compressed entry data
writeInt
(
0
);
writeInt
(
0
);
writeInt
(
0
);
writeInt
(
0
);
writeInt
(
0
);
writeInt
(
0
);
}
else
{
}
else
{
writeInt
(
e
.
crc
);
// crc-32
if
(
e
.
csize
>=
ZIP64_MAGICVAL
||
e
.
size
>=
ZIP64_MAGICVAL
)
{
writeInt
(
e
.
csize
);
// compressed size
hasZip64
=
true
;
writeInt
(
e
.
size
);
// uncompressed size
writeShort
(
45
);
// ver 4.5 for zip64
}
else
{
writeShort
(
version
(
e
));
// version needed to extract
}
writeShort
(
flag
);
// general purpose bit flag
writeShort
(
e
.
method
);
// compression method
writeInt
(
e
.
time
);
// last modification time
writeInt
(
e
.
crc
);
// crc-32
if
(
hasZip64
)
{
writeInt
(
ZIP64_MAGICVAL
);
writeInt
(
ZIP64_MAGICVAL
);
elen
+=
20
;
//headid(2) + size(2) + size(8) + csize(8)
}
else
{
writeInt
(
e
.
csize
);
// compressed size
writeInt
(
e
.
size
);
// uncompressed size
}
}
}
byte
[]
nameBytes
=
getUTF8Bytes
(
e
.
name
);
byte
[]
nameBytes
=
getUTF8Bytes
(
e
.
name
);
writeShort
(
nameBytes
.
length
);
writeShort
(
nameBytes
.
length
);
writeShort
(
e
.
extra
!=
null
?
e
.
extra
.
length
:
0
);
writeShort
(
e
len
);
writeBytes
(
nameBytes
,
0
,
nameBytes
.
length
);
writeBytes
(
nameBytes
,
0
,
nameBytes
.
length
);
if
(
hasZip64
)
{
writeShort
(
ZIP64_EXTID
);
writeShort
(
16
);
writeLong
(
e
.
size
);
writeLong
(
e
.
csize
);
}
if
(
e
.
extra
!=
null
)
{
if
(
e
.
extra
!=
null
)
{
writeBytes
(
e
.
extra
,
0
,
e
.
extra
.
length
);
writeBytes
(
e
.
extra
,
0
,
e
.
extra
.
length
);
}
}
...
@@ -375,8 +402,13 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
...
@@ -375,8 +402,13 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
private
void
writeEXT
(
ZipEntry
e
)
throws
IOException
{
private
void
writeEXT
(
ZipEntry
e
)
throws
IOException
{
writeInt
(
EXTSIG
);
// EXT header signature
writeInt
(
EXTSIG
);
// EXT header signature
writeInt
(
e
.
crc
);
// crc-32
writeInt
(
e
.
crc
);
// crc-32
writeInt
(
e
.
csize
);
// compressed size
if
(
e
.
csize
>=
ZIP64_MAGICVAL
||
e
.
size
>=
ZIP64_MAGICVAL
)
{
writeInt
(
e
.
size
);
// uncompressed size
writeLong
(
e
.
csize
);
writeLong
(
e
.
size
);
}
else
{
writeInt
(
e
.
csize
);
// compressed size
writeInt
(
e
.
size
);
// uncompressed size
}
}
}
/*
/*
...
@@ -387,18 +419,49 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
...
@@ -387,18 +419,49 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
ZipEntry
e
=
xentry
.
entry
;
ZipEntry
e
=
xentry
.
entry
;
int
flag
=
xentry
.
flag
;
int
flag
=
xentry
.
flag
;
int
version
=
version
(
e
);
int
version
=
version
(
e
);
long
csize
=
e
.
csize
;
long
size
=
e
.
size
;
long
offset
=
xentry
.
offset
;
int
e64len
=
0
;
boolean
hasZip64
=
false
;
if
(
e
.
csize
>=
ZIP64_MAGICVAL
)
{
csize
=
ZIP64_MAGICVAL
;
e64len
+=
8
;
// csize(8)
hasZip64
=
true
;
}
if
(
e
.
size
>=
ZIP64_MAGICVAL
)
{
size
=
ZIP64_MAGICVAL
;
// size(8)
e64len
+=
8
;
hasZip64
=
true
;
}
if
(
xentry
.
offset
>=
ZIP64_MAGICVAL
)
{
offset
=
ZIP64_MAGICVAL
;
e64len
+=
8
;
// offset(8)
hasZip64
=
true
;
}
writeInt
(
CENSIG
);
// CEN header signature
writeInt
(
CENSIG
);
// CEN header signature
writeShort
(
version
);
// version made by
if
(
hasZip64
)
{
writeShort
(
version
);
// version needed to extract
writeShort
(
45
);
// ver 4.5 for zip64
writeShort
(
45
);
}
else
{
writeShort
(
version
);
// version made by
writeShort
(
version
);
// version needed to extract
}
writeShort
(
flag
);
// general purpose bit flag
writeShort
(
flag
);
// general purpose bit flag
writeShort
(
e
.
method
);
// compression method
writeShort
(
e
.
method
);
// compression method
writeInt
(
e
.
time
);
// last modification time
writeInt
(
e
.
time
);
// last modification time
writeInt
(
e
.
crc
);
// crc-32
writeInt
(
e
.
crc
);
// crc-32
writeInt
(
e
.
csize
);
// compressed size
writeInt
(
csize
);
// compressed size
writeInt
(
e
.
size
);
// uncompressed size
writeInt
(
size
);
// uncompressed size
byte
[]
nameBytes
=
getUTF8Bytes
(
e
.
name
);
byte
[]
nameBytes
=
getUTF8Bytes
(
e
.
name
);
writeShort
(
nameBytes
.
length
);
writeShort
(
nameBytes
.
length
);
writeShort
(
e
.
extra
!=
null
?
e
.
extra
.
length
:
0
);
if
(
hasZip64
)
{
// + headid(2) + datasize(2)
writeShort
(
e64len
+
4
+
(
e
.
extra
!=
null
?
e
.
extra
.
length
:
0
));
}
else
{
writeShort
(
e
.
extra
!=
null
?
e
.
extra
.
length
:
0
);
}
byte
[]
commentBytes
;
byte
[]
commentBytes
;
if
(
e
.
comment
!=
null
)
{
if
(
e
.
comment
!=
null
)
{
commentBytes
=
getUTF8Bytes
(
e
.
comment
);
commentBytes
=
getUTF8Bytes
(
e
.
comment
);
...
@@ -410,8 +473,18 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
...
@@ -410,8 +473,18 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
writeShort
(
0
);
// starting disk number
writeShort
(
0
);
// starting disk number
writeShort
(
0
);
// internal file attributes (unused)
writeShort
(
0
);
// internal file attributes (unused)
writeInt
(
0
);
// external file attributes (unused)
writeInt
(
0
);
// external file attributes (unused)
writeInt
(
xentry
.
offset
);
// relative offset of local header
writeInt
(
offset
);
// relative offset of local header
writeBytes
(
nameBytes
,
0
,
nameBytes
.
length
);
writeBytes
(
nameBytes
,
0
,
nameBytes
.
length
);
if
(
hasZip64
)
{
writeShort
(
ZIP64_EXTID
);
// Zip64 extra
writeShort
(
e64len
);
if
(
size
==
ZIP64_MAGICVAL
)
writeLong
(
e
.
size
);
if
(
csize
==
ZIP64_MAGICVAL
)
writeLong
(
e
.
csize
);
if
(
offset
==
ZIP64_MAGICVAL
)
writeLong
(
xentry
.
offset
);
}
if
(
e
.
extra
!=
null
)
{
if
(
e
.
extra
!=
null
)
{
writeBytes
(
e
.
extra
,
0
,
e
.
extra
.
length
);
writeBytes
(
e
.
extra
,
0
,
e
.
extra
.
length
);
}
}
...
@@ -424,15 +497,50 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
...
@@ -424,15 +497,50 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
* Writes end of central directory (END) header.
* Writes end of central directory (END) header.
*/
*/
private
void
writeEND
(
long
off
,
long
len
)
throws
IOException
{
private
void
writeEND
(
long
off
,
long
len
)
throws
IOException
{
boolean
hasZip64
=
false
;
long
xlen
=
len
;
long
xoff
=
off
;
if
(
xlen
>=
ZIP64_MAGICVAL
)
{
xlen
=
ZIP64_MAGICVAL
;
hasZip64
=
true
;
}
if
(
xoff
>=
ZIP64_MAGICVAL
)
{
xoff
=
ZIP64_MAGICVAL
;
hasZip64
=
true
;
}
int
count
=
xentries
.
size
();
int
count
=
xentries
.
size
();
writeInt
(
ENDSIG
);
// END record signature
if
(
count
>=
ZIP64_MAGICCOUNT
)
{
writeShort
(
0
);
// number of this disk
count
=
ZIP64_MAGICCOUNT
;
writeShort
(
0
);
// central directory start disk
hasZip64
=
true
;
writeShort
(
count
);
// number of directory entries on disk
}
writeShort
(
count
);
// total number of directory entries
if
(
hasZip64
)
{
writeInt
(
len
);
// length of central directory
long
off64
=
written
;
writeInt
(
off
);
// offset of central directory
//zip64 end of central directory record
if
(
comment
!=
null
)
{
// zip file comment
writeInt
(
ZIP64_ENDSIG
);
// zip64 END record signature
writeLong
(
ZIP64_ENDHDR
-
12
);
// size of zip64 end
writeShort
(
45
);
// version made by
writeShort
(
45
);
// version needed to extract
writeInt
(
0
);
// number of this disk
writeInt
(
0
);
// central directory start disk
writeLong
(
xentries
.
size
());
// number of directory entires on disk
writeLong
(
xentries
.
size
());
// number of directory entires
writeLong
(
len
);
// length of central directory
writeLong
(
off
);
// offset of central directory
//zip64 end of central directory locator
writeInt
(
ZIP64_LOCSIG
);
// zip64 END locator signature
writeInt
(
0
);
// zip64 END start disk
writeLong
(
off64
);
// offset of zip64 END
writeInt
(
1
);
// total number of disks (?)
}
writeInt
(
ENDSIG
);
// END record signature
writeShort
(
0
);
// number of this disk
writeShort
(
0
);
// central directory start disk
writeShort
(
count
);
// number of directory entries on disk
writeShort
(
count
);
// total number of directory entries
writeInt
(
xlen
);
// length of central directory
writeInt
(
xoff
);
// offset of central directory
if
(
comment
!=
null
)
{
// zip file comment
byte
[]
b
=
getUTF8Bytes
(
comment
);
byte
[]
b
=
getUTF8Bytes
(
comment
);
writeShort
(
b
.
length
);
writeShort
(
b
.
length
);
writeBytes
(
b
,
0
,
b
.
length
);
writeBytes
(
b
,
0
,
b
.
length
);
...
@@ -463,6 +571,22 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
...
@@ -463,6 +571,22 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
written
+=
4
;
written
+=
4
;
}
}
/*
* Writes a 64-bit int to the output stream in little-endian byte order.
*/
private
void
writeLong
(
long
v
)
throws
IOException
{
OutputStream
out
=
this
.
out
;
out
.
write
((
int
)((
v
>>>
0
)
&
0xff
));
out
.
write
((
int
)((
v
>>>
8
)
&
0xff
));
out
.
write
((
int
)((
v
>>>
16
)
&
0xff
));
out
.
write
((
int
)((
v
>>>
24
)
&
0xff
));
out
.
write
((
int
)((
v
>>>
32
)
&
0xff
));
out
.
write
((
int
)((
v
>>>
40
)
&
0xff
));
out
.
write
((
int
)((
v
>>>
48
)
&
0xff
));
out
.
write
((
int
)((
v
>>>
56
)
&
0xff
));
written
+=
8
;
}
/*
/*
* Writes an array of bytes to the output stream.
* Writes an array of bytes to the output stream.
*/
*/
...
...
src/share/classes/java/util/zip/package.html
浏览文件 @
1497d82e
...
@@ -45,6 +45,13 @@ input streams.
...
@@ -45,6 +45,13 @@ input streams.
Info-ZIP Application Note 970311
Info-ZIP Application Note 970311
</a>
- a detailed description of the Info-ZIP format upon which
</a>
- a detailed description of the Info-ZIP format upon which
the
<code>
java.util.zip
</code>
classes are based.
the
<code>
java.util.zip
</code>
classes are based.
<p>
<a
name=
"zip64"
>
<li>
An implementation may optionally support the ZIP64(tm) format extensions
defined by the
<a
href=
"http://www.pkware.com/documents/casestudies/APPNOTE.TXT"
>
PKWARE ZIP File Format Specification
</a>
. The ZIP64(tm) format extensions
are used to overcome the size limitations of the original ZIP format.
<p>
<p>
<li><a
href=
"http://www.isi.edu/in-notes/rfc1950.txt"
>
<li><a
href=
"http://www.isi.edu/in-notes/rfc1950.txt"
>
ZLIB Compressed Data Format Specification version 3.3
</a>
ZLIB Compressed Data Format Specification version 3.3
</a>
...
@@ -70,7 +77,6 @@ input streams.
...
@@ -70,7 +77,6 @@ input streams.
<li>
CRC-32 checksum is described in RFC 1952 (above)
<li>
CRC-32 checksum is described in RFC 1952 (above)
<p>
<p>
<li>
Adler-32 checksum is described in RFC 1950 (above)
<li>
Adler-32 checksum is described in RFC 1950 (above)
</ul>
</ul>
...
...
src/share/classes/sun/security/tools/KeyTool.java
浏览文件 @
1497d82e
...
@@ -2545,7 +2545,19 @@ public final class KeyTool {
...
@@ -2545,7 +2545,19 @@ public final class KeyTool {
* Returns true if the certificate is self-signed, false otherwise.
* Returns true if the certificate is self-signed, false otherwise.
*/
*/
private
boolean
isSelfSigned
(
X509Certificate
cert
)
{
private
boolean
isSelfSigned
(
X509Certificate
cert
)
{
return
cert
.
getSubjectDN
().
equals
(
cert
.
getIssuerDN
());
return
signedBy
(
cert
,
cert
);
}
private
boolean
signedBy
(
X509Certificate
end
,
X509Certificate
ca
)
{
if
(!
ca
.
getSubjectDN
().
equals
(
end
.
getIssuerDN
()))
{
return
false
;
}
try
{
end
.
verify
(
ca
.
getPublicKey
());
return
true
;
}
catch
(
Exception
e
)
{
return
false
;
}
}
}
/**
/**
...
@@ -2869,20 +2881,18 @@ public final class KeyTool {
...
@@ -2869,20 +2881,18 @@ public final class KeyTool {
Certificate
tmpCert
=
replyCerts
[
0
];
Certificate
tmpCert
=
replyCerts
[
0
];
replyCerts
[
0
]
=
replyCerts
[
i
];
replyCerts
[
0
]
=
replyCerts
[
i
];
replyCerts
[
i
]
=
tmpCert
;
replyCerts
[
i
]
=
tmpCert
;
Principal
issuer
=
((
X509Certificate
)
replyCerts
[
0
]).
getIssuerDN
();
X509Certificate
thisCert
=
(
X509Certificate
)
replyCerts
[
0
];
for
(
i
=
1
;
i
<
replyCerts
.
length
-
1
;
i
++)
{
for
(
i
=
1
;
i
<
replyCerts
.
length
-
1
;
i
++)
{
// find a cert in the reply whose "subject" is the same as the
// find a cert in the reply who signs thisCert
// given "issuer"
int
j
;
int
j
;
for
(
j
=
i
;
j
<
replyCerts
.
length
;
j
++)
{
for
(
j
=
i
;
j
<
replyCerts
.
length
;
j
++)
{
Principal
subject
;
if
(
signedBy
(
thisCert
,
(
X509Certificate
)
replyCerts
[
j
]))
{
subject
=
((
X509Certificate
)
replyCerts
[
j
]).
getSubjectDN
();
if
(
subject
.
equals
(
issuer
))
{
tmpCert
=
replyCerts
[
i
];
tmpCert
=
replyCerts
[
i
];
replyCerts
[
i
]
=
replyCerts
[
j
];
replyCerts
[
i
]
=
replyCerts
[
j
];
replyCerts
[
j
]
=
tmpCert
;
replyCerts
[
j
]
=
tmpCert
;
issuer
=
((
X509Certificate
)
replyCerts
[
i
]).
getIssuerDN
()
;
thisCert
=
(
X509Certificate
)
replyCerts
[
i
]
;
break
;
break
;
}
}
}
}
...
@@ -2892,18 +2902,6 @@ public final class KeyTool {
...
@@ -2892,18 +2902,6 @@ public final class KeyTool {
}
}
}
}
// now verify each cert in the ordered chain
for
(
i
=
0
;
i
<
replyCerts
.
length
-
1
;
i
++)
{
PublicKey
pubKey
=
replyCerts
[
i
+
1
].
getPublicKey
();
try
{
replyCerts
[
i
].
verify
(
pubKey
);
}
catch
(
Exception
e
)
{
throw
new
Exception
(
rb
.
getString
(
"Certificate chain in reply does not verify: "
)
+
e
.
getMessage
());
}
}
if
(
noprompt
)
{
if
(
noprompt
)
{
return
replyCerts
;
return
replyCerts
;
}
}
...
@@ -3035,9 +3033,8 @@ public final class KeyTool {
...
@@ -3035,9 +3033,8 @@ public final class KeyTool {
private
boolean
buildChain
(
X509Certificate
certToVerify
,
private
boolean
buildChain
(
X509Certificate
certToVerify
,
Vector
<
Certificate
>
chain
,
Vector
<
Certificate
>
chain
,
Hashtable
<
Principal
,
Vector
<
Certificate
>>
certs
)
{
Hashtable
<
Principal
,
Vector
<
Certificate
>>
certs
)
{
Principal
subject
=
certToVerify
.
getSubjectDN
();
Principal
issuer
=
certToVerify
.
getIssuerDN
();
Principal
issuer
=
certToVerify
.
getIssuerDN
();
if
(
subject
.
equals
(
issuer
))
{
if
(
isSelfSigned
(
certToVerify
))
{
// reached self-signed root cert;
// reached self-signed root cert;
// no verification needed because it's trusted.
// no verification needed because it's trusted.
chain
.
addElement
(
certToVerify
);
chain
.
addElement
(
certToVerify
);
...
...
src/share/native/java/util/zip/zip_util.c
浏览文件 @
1497d82e
...
@@ -312,6 +312,38 @@ findEND(jzfile *zip, void *endbuf)
...
@@ -312,6 +312,38 @@ findEND(jzfile *zip, void *endbuf)
return
-
1
;
/* END header not found */
return
-
1
;
/* END header not found */
}
}
/*
* Searches for the ZIP64 end of central directory (END) header. The
* contents of the ZIP64 END header will be read and placed in end64buf.
* Returns the file position of the ZIP64 END header, otherwise returns
* -1 if the END header was not found or an error occurred.
*
* The ZIP format specifies the "position" of each related record as
* ...
* [central directory]
* [zip64 end of central directory record]
* [zip64 end of central directory locator]
* [end of central directory record]
*
* The offset of zip64 end locator can be calculated from endpos as
* "endpos - ZIP64_LOCHDR".
* The "offset" of zip64 end record is stored in zip64 end locator.
*/
static
jlong
findEND64
(
jzfile
*
zip
,
void
*
end64buf
,
jlong
endpos
)
{
char
loc64
[
ZIP64_LOCHDR
];
jlong
end64pos
;
if
(
readFullyAt
(
zip
->
zfd
,
loc64
,
ZIP64_LOCHDR
,
endpos
-
ZIP64_LOCHDR
)
==
-
1
)
{
return
-
1
;
// end64 locator not found
}
end64pos
=
ZIP64_LOCOFF
(
loc64
);
if
(
readFullyAt
(
zip
->
zfd
,
end64buf
,
ZIP64_ENDHDR
,
end64pos
)
==
-
1
)
{
return
-
1
;
// end64 record not found
}
return
end64pos
;
}
/*
/*
* Returns a hash code value for a C-style NUL-terminated string.
* Returns a hash code value for a C-style NUL-terminated string.
*/
*/
...
@@ -463,7 +495,7 @@ static jlong
...
@@ -463,7 +495,7 @@ static jlong
readCEN
(
jzfile
*
zip
,
jint
knownTotal
)
readCEN
(
jzfile
*
zip
,
jint
knownTotal
)
{
{
/* Following are unsigned 32-bit */
/* Following are unsigned 32-bit */
jlong
endpos
,
cenpos
,
cenlen
;
jlong
endpos
,
end64pos
,
cenpos
,
cenlen
,
cenoff
;
/* Following are unsigned 16-bit */
/* Following are unsigned 16-bit */
jint
total
,
tablelen
,
i
,
j
;
jint
total
,
tablelen
,
i
,
j
;
unsigned
char
*
cenbuf
=
NULL
;
unsigned
char
*
cenbuf
=
NULL
;
...
@@ -474,6 +506,7 @@ readCEN(jzfile *zip, jint knownTotal)
...
@@ -474,6 +506,7 @@ readCEN(jzfile *zip, jint knownTotal)
jlong
offset
;
jlong
offset
;
#endif
#endif
unsigned
char
endbuf
[
ENDHDR
];
unsigned
char
endbuf
[
ENDHDR
];
jint
endhdrlen
=
ENDHDR
;
jzcell
*
entries
;
jzcell
*
entries
;
jint
*
table
;
jint
*
table
;
...
@@ -490,13 +523,27 @@ readCEN(jzfile *zip, jint knownTotal)
...
@@ -490,13 +523,27 @@ readCEN(jzfile *zip, jint knownTotal)
/* Get position and length of central directory */
/* Get position and length of central directory */
cenlen
=
ENDSIZ
(
endbuf
);
cenlen
=
ENDSIZ
(
endbuf
);
cenoff
=
ENDOFF
(
endbuf
);
total
=
ENDTOT
(
endbuf
);
if
(
cenlen
==
ZIP64_MAGICVAL
||
cenoff
==
ZIP64_MAGICVAL
||
total
==
ZIP64_MAGICCOUNT
)
{
unsigned
char
end64buf
[
ZIP64_ENDHDR
];
if
((
end64pos
=
findEND64
(
zip
,
end64buf
,
endpos
))
!=
-
1
)
{
cenlen
=
ZIP64_ENDSIZ
(
end64buf
);
cenoff
=
ZIP64_ENDOFF
(
end64buf
);
total
=
(
jint
)
ZIP64_ENDTOT
(
end64buf
);
endpos
=
end64pos
;
endhdrlen
=
ZIP64_ENDHDR
;
}
}
if
(
cenlen
>
endpos
)
if
(
cenlen
>
endpos
)
ZIP_FORMAT_ERROR
(
"invalid END header (bad central directory size)"
);
ZIP_FORMAT_ERROR
(
"invalid END header (bad central directory size)"
);
cenpos
=
endpos
-
cenlen
;
cenpos
=
endpos
-
cenlen
;
/* Get position of first local file (LOC) header, taking into
/* Get position of first local file (LOC) header, taking into
* account that there may be a stub prefixed to the zip file. */
* account that there may be a stub prefixed to the zip file. */
zip
->
locpos
=
cenpos
-
ENDOFF
(
endbuf
)
;
zip
->
locpos
=
cenpos
-
cenoff
;
if
(
zip
->
locpos
<
0
)
if
(
zip
->
locpos
<
0
)
ZIP_FORMAT_ERROR
(
"invalid END header (bad central directory offset)"
);
ZIP_FORMAT_ERROR
(
"invalid END header (bad central directory offset)"
);
...
@@ -527,7 +574,7 @@ readCEN(jzfile *zip, jint knownTotal)
...
@@ -527,7 +574,7 @@ readCEN(jzfile *zip, jint knownTotal)
out the page size in order to make offset to be multiples of
out the page size in order to make offset to be multiples of
page size.
page size.
*/
*/
zip
->
mlen
=
cenpos
-
offset
+
cenlen
+
ENDHDR
;
zip
->
mlen
=
cenpos
-
offset
+
cenlen
+
endhdrlen
;
zip
->
offset
=
offset
;
zip
->
offset
=
offset
;
mappedAddr
=
mmap64
(
0
,
zip
->
mlen
,
PROT_READ
,
MAP_SHARED
,
zip
->
zfd
,
(
off64_t
)
offset
);
mappedAddr
=
mmap64
(
0
,
zip
->
mlen
,
PROT_READ
,
MAP_SHARED
,
zip
->
zfd
,
(
off64_t
)
offset
);
zip
->
maddr
=
(
mappedAddr
==
(
void
*
)
MAP_FAILED
)
?
NULL
:
zip
->
maddr
=
(
mappedAddr
==
(
void
*
)
MAP_FAILED
)
?
NULL
:
...
@@ -551,8 +598,13 @@ readCEN(jzfile *zip, jint knownTotal)
...
@@ -551,8 +598,13 @@ readCEN(jzfile *zip, jint knownTotal)
* is a 2-byte field, but we (and other zip implementations)
* is a 2-byte field, but we (and other zip implementations)
* support approx. 2**31 entries, we do not trust ENDTOT, but
* support approx. 2**31 entries, we do not trust ENDTOT, but
* treat it only as a strong hint. When we call ourselves
* treat it only as a strong hint. When we call ourselves
* recursively, knownTotal will have the "true" value. */
* recursively, knownTotal will have the "true" value.
total
=
(
knownTotal
!=
-
1
)
?
knownTotal
:
ENDTOT
(
endbuf
);
*
* Keep this path alive even with the Zip64 END support added, just
* for zip files that have more than 0xffff entries but don't have
* the Zip64 enabled.
*/
total
=
(
knownTotal
!=
-
1
)
?
knownTotal
:
total
;
entries
=
zip
->
entries
=
calloc
(
total
,
sizeof
(
entries
[
0
]));
entries
=
zip
->
entries
=
calloc
(
total
,
sizeof
(
entries
[
0
]));
tablelen
=
zip
->
tablelen
=
((
total
/
2
)
|
1
);
// Odd -> fewer collisions
tablelen
=
zip
->
tablelen
=
((
total
/
2
)
|
1
);
// Odd -> fewer collisions
table
=
zip
->
table
=
malloc
(
tablelen
*
sizeof
(
table
[
0
]));
table
=
zip
->
table
=
malloc
(
tablelen
*
sizeof
(
table
[
0
]));
...
@@ -854,6 +906,7 @@ typedef enum { ACCESS_RANDOM, ACCESS_SEQUENTIAL } AccessHint;
...
@@ -854,6 +906,7 @@ typedef enum { ACCESS_RANDOM, ACCESS_SEQUENTIAL } AccessHint;
static
jzentry
*
static
jzentry
*
newEntry
(
jzfile
*
zip
,
jzcell
*
zc
,
AccessHint
accessHint
)
newEntry
(
jzfile
*
zip
,
jzcell
*
zc
,
AccessHint
accessHint
)
{
{
jlong
locoff
;
jint
nlen
,
elen
,
clen
;
jint
nlen
,
elen
,
clen
;
jzentry
*
ze
;
jzentry
*
ze
;
char
*
cen
;
char
*
cen
;
...
@@ -880,18 +933,55 @@ newEntry(jzfile *zip, jzcell *zc, AccessHint accessHint)
...
@@ -880,18 +933,55 @@ newEntry(jzfile *zip, jzcell *zc, AccessHint accessHint)
ze
->
size
=
CENLEN
(
cen
);
ze
->
size
=
CENLEN
(
cen
);
ze
->
csize
=
(
CENHOW
(
cen
)
==
STORED
)
?
0
:
CENSIZ
(
cen
);
ze
->
csize
=
(
CENHOW
(
cen
)
==
STORED
)
?
0
:
CENSIZ
(
cen
);
ze
->
crc
=
CENCRC
(
cen
);
ze
->
crc
=
CENCRC
(
cen
);
ze
->
pos
=
-
(
zip
->
locpos
+
CENOFF
(
cen
));
locoff
=
CENOFF
(
cen
);
ze
->
pos
=
-
(
zip
->
locpos
+
locoff
);
if
((
ze
->
name
=
malloc
(
nlen
+
1
))
==
NULL
)
goto
Catch
;
if
((
ze
->
name
=
malloc
(
nlen
+
1
))
==
NULL
)
goto
Catch
;
memcpy
(
ze
->
name
,
cen
+
CENHDR
,
nlen
);
memcpy
(
ze
->
name
,
cen
+
CENHDR
,
nlen
);
ze
->
name
[
nlen
]
=
'\0'
;
ze
->
name
[
nlen
]
=
'\0'
;
if
(
elen
>
0
)
{
if
(
elen
>
0
)
{
char
*
extra
=
cen
+
CENHDR
+
nlen
;
/* This entry has "extra" data */
/* This entry has "extra" data */
if
((
ze
->
extra
=
malloc
(
elen
+
2
))
==
NULL
)
goto
Catch
;
if
((
ze
->
extra
=
malloc
(
elen
+
2
))
==
NULL
)
goto
Catch
;
ze
->
extra
[
0
]
=
(
unsigned
char
)
elen
;
ze
->
extra
[
0
]
=
(
unsigned
char
)
elen
;
ze
->
extra
[
1
]
=
(
unsigned
char
)
(
elen
>>
8
);
ze
->
extra
[
1
]
=
(
unsigned
char
)
(
elen
>>
8
);
memcpy
(
ze
->
extra
+
2
,
cen
+
CENHDR
+
nlen
,
elen
);
memcpy
(
ze
->
extra
+
2
,
extra
,
elen
);
if
(
ze
->
csize
==
ZIP64_MAGICVAL
||
ze
->
size
==
ZIP64_MAGICVAL
||
locoff
==
ZIP64_MAGICVAL
)
{
jint
off
=
0
;
while
((
off
+
4
)
<
elen
)
{
// spec: HeaderID+DataSize+Data
jint
sz
=
SH
(
extra
,
off
+
2
);
if
(
SH
(
extra
,
off
)
==
ZIP64_EXTID
)
{
off
+=
4
;
if
(
ze
->
size
==
ZIP64_MAGICVAL
)
{
// if invalid zip64 extra fields, just skip
if
(
sz
<
8
||
(
off
+
8
)
>
elen
)
break
;
ze
->
size
=
LL
(
extra
,
off
);
sz
-=
8
;
off
+=
8
;
}
if
(
ze
->
csize
==
ZIP64_MAGICVAL
)
{
if
(
sz
<
8
||
(
off
+
8
)
>
elen
)
break
;
ze
->
csize
=
LL
(
extra
,
off
);
sz
-=
8
;
off
+=
8
;
}
if
(
locoff
==
ZIP64_MAGICVAL
)
{
if
(
sz
<
8
||
(
off
+
8
)
>
elen
)
break
;
ze
->
pos
=
-
(
zip
->
locpos
+
LL
(
extra
,
off
));
sz
-=
8
;
off
+=
8
;
}
break
;
}
off
+=
(
sz
+
4
);
}
}
}
}
if
(
clen
>
0
)
{
if
(
clen
>
0
)
{
...
...
src/share/native/java/util/zip/zip_util.h
浏览文件 @
1497d82e
...
@@ -38,9 +38,13 @@
...
@@ -38,9 +38,13 @@
#define CENSIG 0x02014b50L
/* "PK\001\002" */
#define CENSIG 0x02014b50L
/* "PK\001\002" */
#define ENDSIG 0x06054b50L
/* "PK\005\006" */
#define ENDSIG 0x06054b50L
/* "PK\005\006" */
#define ZIP64_ENDSIG 0x06064b50L
/* "PK\006\006" */
#define ZIP64_LOCSIG 0x07064b50L
/* "PK\006\007" */
/*
/*
* Header sizes including signatures
* Header sizes including signatures
*/
*/
#ifdef USE_MMAP
#ifdef USE_MMAP
#define SIGSIZ 4
#define SIGSIZ 4
#endif
#endif
...
@@ -49,12 +53,22 @@
...
@@ -49,12 +53,22 @@
#define CENHDR 46
#define CENHDR 46
#define ENDHDR 22
#define ENDHDR 22
#define ZIP64_ENDHDR 56 // ZIP64 end header size
#define ZIP64_LOCHDR 20 // ZIP64 end loc header size
#define ZIP64_EXTHDR 24 // EXT header size
#define ZIP64_EXTID 1 // Extra field Zip64 header ID
#define ZIP64_MAGICVAL 0xffffffffLL
#define ZIP64_MAGICCOUNT 0xffff
/*
/*
* Header field access macros
* Header field access macros
*/
*/
#define CH(b, n) (((unsigned char *)(b))[n])
#define CH(b, n) (((unsigned char *)(b))[n])
#define SH(b, n) (CH(b, n) | (CH(b, n+1) << 8))
#define SH(b, n) (CH(b, n) | (CH(b, n+1) << 8))
#define LG(b, n) (SH(b, n) | (SH(b, n+2) << 16))
#define LG(b, n) ((SH(b, n) | (SH(b, n+2) << 16)) &0xffffffffUL)
#define LL(b, n) (((jlong)LG(b, n)) | (((jlong)LG(b, n+4)) << 32))
#define GETSIG(b) LG(b, 0)
#define GETSIG(b) LG(b, 0)
/*
/*
...
@@ -105,6 +119,26 @@
...
@@ -105,6 +119,26 @@
#define ENDOFF(b) LG(b, 16)
/* central directory offset */
#define ENDOFF(b) LG(b, 16)
/* central directory offset */
#define ENDCOM(b) SH(b, 20)
/* size of zip file comment */
#define ENDCOM(b) SH(b, 20)
/* size of zip file comment */
/*
* Macros for getting Zip64 end of central directory header fields
*/
#define ZIP64_ENDLEN(b) LL(b, 4)
/* size of zip64 end of central dir */
#define ZIP64_ENDVEM(b) SH(b, 12)
/* version made by */
#define ZIP64_ENDVER(b) SH(b, 14)
/* version needed to extract */
#define ZIP64_ENDNMD(b) LG(b, 16)
/* number of this disk */
#define ZIP64_ENDDSK(b) LG(b, 20)
/* disk number of start */
#define ZIP64_ENDTOD(b) LL(b, 24)
/* total number of entries on this disk */
#define ZIP64_ENDTOT(b) LL(b, 32)
/* total number of entries */
#define ZIP64_ENDSIZ(b) LL(b, 40)
/* central directory size in bytes */
#define ZIP64_ENDOFF(b) LL(b, 48)
/* offset of first CEN header */
/*
* Macros for getting Zip64 end of central directory locator fields
*/
#define ZIP64_LOCDSK(b) LG(b, 4)
/* disk number start */
#define ZIP64_LOCOFF(b) LL(b, 8)
/* offset of zip64 end */
#define ZIP64_LOCTOT(b) LG(b, 16)
/* total number of disks */
/*
/*
* Supported compression methods
* Supported compression methods
*/
*/
...
@@ -145,7 +179,7 @@ typedef struct jzentry { /* Zip file entry */
...
@@ -145,7 +179,7 @@ typedef struct jzentry { /* Zip file entry */
*/
*/
typedef
struct
jzcell
{
typedef
struct
jzcell
{
unsigned
int
hash
;
/* 32 bit hashcode on name */
unsigned
int
hash
;
/* 32 bit hashcode on name */
unsigned
int
cenpos
;
/* Offset of central directory file header */
jlong
cenpos
;
/* Offset of central directory file header */
unsigned
int
next
;
/* hash chain: index into jzfile->entries */
unsigned
int
next
;
/* hash chain: index into jzfile->entries */
}
jzcell
;
}
jzcell
;
...
...
src/share/native/java/util/zip/zlib-1.1.3/zlib.h
浏览文件 @
1497d82e
...
@@ -106,11 +106,11 @@ struct internal_state;
...
@@ -106,11 +106,11 @@ struct internal_state;
typedef
struct
z_stream_s
{
typedef
struct
z_stream_s
{
Bytef
*
next_in
;
/* next input byte */
Bytef
*
next_in
;
/* next input byte */
uInt
avail_in
;
/* number of bytes available at next_in */
uInt
avail_in
;
/* number of bytes available at next_in */
uLong
total_in
;
/* total nb of input bytes read so far */
long
long
total_in
;
/* total nb of input bytes read so far */
Bytef
*
next_out
;
/* next output byte should be put there */
Bytef
*
next_out
;
/* next output byte should be put there */
uInt
avail_out
;
/* remaining free space at next_out */
uInt
avail_out
;
/* remaining free space at next_out */
uLong
total_out
;
/* total nb of bytes output so far */
long
long
total_out
;
/* total nb of bytes output so far */
char
*
msg
;
/* last error message, NULL if no error */
char
*
msg
;
/* last error message, NULL if no error */
struct
internal_state
FAR
*
state
;
/* not visible by applications */
struct
internal_state
FAR
*
state
;
/* not visible by applications */
...
...
test/java/util/zip/LargeZip.java
0 → 100644
浏览文件 @
1497d82e
/*
* Copyright 2009 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
import
java.io.*
;
import
java.nio.*
;
import
java.util.*
;
import
java.util.zip.*
;
public
class
LargeZip
{
// If true, don't delete large ZIP file created for test.
static
final
boolean
debug
=
System
.
getProperty
(
"debug"
)
!=
null
;
//static final int DATA_LEN = 1024 * 1024;
static
final
int
DATA_LEN
=
80
*
1024
;
static
final
int
DATA_SIZE
=
8
;
static
long
fileSize
=
6L
*
1024L
*
1024L
*
1024L
;
// 6GB
static
boolean
userFile
=
false
;
static
byte
[]
data
;
static
File
largeFile
;
static
String
lastEntryName
;
/* args can be empty, in which case check a 3 GB file which is created for
* this test (and then deleted). Or it can be a number, in which case
* that designates the size of the file that's created for this test (and
* then deleted). Or it can be the name of a file to use for the test, in
* which case it is *not* deleted. Note that in this last case, the data
* comparison might fail.
*/
static
void
realMain
(
String
[]
args
)
throws
Throwable
{
if
(
args
.
length
>
0
)
{
try
{
fileSize
=
Long
.
parseLong
(
args
[
0
]);
System
.
out
.
println
(
"Testing with file of size "
+
fileSize
);
}
catch
(
NumberFormatException
ex
)
{
largeFile
=
new
File
(
args
[
0
]);
if
(!
largeFile
.
exists
())
{
throw
new
Exception
(
"Specified file "
+
args
[
0
]
+
" does not exist"
);
}
userFile
=
true
;
System
.
out
.
println
(
"Testing with user-provided file "
+
largeFile
);
}
}
File
testDir
=
null
;
if
(
largeFile
==
null
)
{
testDir
=
new
File
(
System
.
getProperty
(
"test.scratch"
,
"."
),
"LargeZip"
);
if
(
testDir
.
exists
())
{
if
(!
testDir
.
delete
())
{
throw
new
Exception
(
"Cannot delete already-existing test directory"
);
}
}
check
(!
testDir
.
exists
()
&&
testDir
.
mkdirs
());
largeFile
=
new
File
(
testDir
,
"largezip.zip"
);
createLargeZip
();
}
readLargeZip1
();
readLargeZip2
();
if
(!
userFile
&&
!
debug
)
{
check
(
largeFile
.
delete
());
check
(
testDir
.
delete
());
}
}
static
void
createLargeZip
()
throws
Throwable
{
int
iterations
=
DATA_LEN
/
DATA_SIZE
;
ByteBuffer
bb
=
ByteBuffer
.
allocate
(
DATA_SIZE
);
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
for
(
int
i
=
0
;
i
<
iterations
;
i
++)
{
bb
.
putDouble
(
0
,
Math
.
random
());
baos
.
write
(
bb
.
array
(),
0
,
DATA_SIZE
);
}
data
=
baos
.
toByteArray
();
ZipOutputStream
zos
=
new
ZipOutputStream
(
new
BufferedOutputStream
(
new
FileOutputStream
(
largeFile
)));
long
length
=
0
;
while
(
length
<
fileSize
)
{
ZipEntry
ze
=
new
ZipEntry
(
"entry-"
+
length
);
lastEntryName
=
ze
.
getName
();
zos
.
putNextEntry
(
ze
);
zos
.
write
(
data
,
0
,
data
.
length
);
zos
.
closeEntry
();
length
=
largeFile
.
length
();
}
System
.
out
.
println
(
"Last entry written is "
+
lastEntryName
);
zos
.
close
();
}
static
void
readLargeZip1
()
throws
Throwable
{
ZipFile
zipFile
=
new
ZipFile
(
largeFile
);
ZipEntry
entry
=
null
;
String
entryName
=
null
;
int
count
=
0
;
Enumeration
<?
extends
ZipEntry
>
entries
=
zipFile
.
entries
();
while
(
entries
.
hasMoreElements
())
{
entry
=
entries
.
nextElement
();
entryName
=
entry
.
getName
();
count
++;
}
System
.
out
.
println
(
"Number of entries read: "
+
count
);
System
.
out
.
println
(
"Last entry read is "
+
entryName
);
check
(!
entry
.
isDirectory
());
if
(
check
(
entryName
.
equals
(
lastEntryName
)))
{
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
InputStream
is
=
zipFile
.
getInputStream
(
entry
);
byte
buf
[]
=
new
byte
[
4096
];
int
len
;
while
((
len
=
is
.
read
(
buf
))
>=
0
)
{
baos
.
write
(
buf
,
0
,
len
);
}
baos
.
close
();
is
.
close
();
check
(
Arrays
.
equals
(
data
,
baos
.
toByteArray
()));
}
}
static
void
readLargeZip2
()
throws
Throwable
{
ZipInputStream
zis
=
new
ZipInputStream
(
new
BufferedInputStream
(
new
FileInputStream
(
largeFile
)));
ZipEntry
entry
=
null
;
String
entryName
=
null
;
int
count
=
0
;
while
((
entry
=
zis
.
getNextEntry
())
!=
null
)
{
entryName
=
entry
.
getName
();
if
(
entryName
.
equals
(
lastEntryName
))
{
break
;
}
count
++;
}
System
.
out
.
println
(
"Number of entries read: "
+
count
);
System
.
out
.
println
(
"Last entry read is "
+
entryName
);
check
(!
entry
.
isDirectory
());
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
byte
buf
[]
=
new
byte
[
4096
];
int
len
;
while
((
len
=
zis
.
read
(
buf
))
>=
0
)
{
baos
.
write
(
buf
,
0
,
len
);
}
baos
.
close
();
check
(
Arrays
.
equals
(
data
,
baos
.
toByteArray
()));
check
(
zis
.
getNextEntry
()
==
null
);
zis
.
close
();
}
//--------------------- Infrastructure ---------------------------
static
volatile
int
passed
=
0
,
failed
=
0
;
static
void
pass
()
{
passed
++;}
static
void
pass
(
String
msg
)
{
System
.
out
.
println
(
msg
);
passed
++;}
static
void
fail
()
{
failed
++;
Thread
.
dumpStack
();}
static
void
fail
(
String
msg
)
{
System
.
out
.
println
(
msg
);
fail
();}
static
void
unexpected
(
Throwable
t
)
{
failed
++;
t
.
printStackTrace
();}
static
void
unexpected
(
Throwable
t
,
String
msg
)
{
System
.
out
.
println
(
msg
);
failed
++;
t
.
printStackTrace
();}
static
boolean
check
(
boolean
cond
)
{
if
(
cond
)
pass
();
else
fail
();
return
cond
;}
static
void
equal
(
Object
x
,
Object
y
)
{
if
(
x
==
null
?
y
==
null
:
x
.
equals
(
y
))
pass
();
else
fail
(
x
+
" not equal to "
+
y
);}
public
static
void
main
(
String
[]
args
)
throws
Throwable
{
try
{
realMain
(
args
);}
catch
(
Throwable
t
)
{
unexpected
(
t
);}
System
.
out
.
println
(
"\nPassed = "
+
passed
+
" failed = "
+
failed
);
if
(
failed
>
0
)
throw
new
AssertionError
(
"Some tests failed"
);}
}
test/java/util/zip/ZipFile/LargeZipFile.java
浏览文件 @
1497d82e
...
@@ -158,4 +158,3 @@ public class LargeZipFile {
...
@@ -158,4 +158,3 @@ public class LargeZipFile {
System
.
out
.
println
(
"\nPassed = "
+
passed
+
" failed = "
+
failed
);
System
.
out
.
println
(
"\nPassed = "
+
passed
+
" failed = "
+
failed
);
if
(
failed
>
0
)
throw
new
AssertionError
(
"Some tests failed"
);}
if
(
failed
>
0
)
throw
new
AssertionError
(
"Some tests failed"
);}
}
}
test/sun/security/tools/keytool/selfissued.sh
0 → 100644
浏览文件 @
1497d82e
#
# Copyright 2009 Sun Microsystems, Inc. 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.
#
# 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# @test
# @bug 6825352
# @summary support self-issued certificate in keytool
#
# @run shell selfissued.sh
#
if
[
"
${
TESTJAVA
}
"
=
""
]
;
then
JAVAC_CMD
=
`
which javac
`
TESTJAVA
=
`
dirname
$JAVAC_CMD
`
/..
fi
# set platform-dependent variables
OS
=
`
uname
-s
`
case
"
$OS
"
in
Windows_
*
)
FS
=
"
\\
"
;;
*
)
FS
=
"/"
;;
esac
KS
=
selfsigned.jks
KT
=
"
$TESTJAVA
${
FS
}
bin
${
FS
}
keytool -storepass changeit -keypass changeit -keystore
$KS
"
rm
$KS
$KT
-alias
ca
-dname
CN
=
CA
-genkeypair
$KT
-alias
me
-dname
CN
=
CA
-genkeypair
$KT
-alias
e1
-dname
CN
=
E1
-genkeypair
$KT
-alias
e2
-dname
CN
=
E2
-genkeypair
# me signed by ca, self-issued
$KT
-alias
me
-certreq
|
$KT
-alias
ca
-gencert
|
$KT
-alias
me
-importcert
# Import e1 signed by me, should add me and ca
$KT
-alias
e1
-certreq
|
$KT
-alias
me
-gencert
|
$KT
-alias
e1
-importcert
$KT
-alias
e1
-list
-v
|
grep
'\[3\]'
||
{
echo
Bad E1
;
exit
1
;
}
# Import (e2 signed by me,ca,me), should reorder to (e2,me,ca)
(
$KT
-alias
e2
-certreq
|
$KT
-alias
me
-gencert
;
$KT
-exportcert
-alias
ca
;
$KT
-exportcert
-alias
me
)
|
$KT
-alias
e2
-importcert
$KT
-alias
e2
-list
-v
|
grep
'\[3\]'
||
{
echo
Bad E2
;
exit
1
;
}
echo
Good
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录