--- a/.hgtags Tue Jun 30 17:12:32 2009 -0700
+++ b/.hgtags Thu Jul 23 11:29:49 2009 -0700
@@ -36,3 +36,5 @@ 2a5a1b269e89f27ebe419ef4cf6e66a3face0df1
2a5a1b269e89f27ebe419ef4cf6e66a3face0df1 jdk7-b59
0c3ef2d612a47667829eb17a192decef23f1c536 jdk7-b60
f72c0dc047b9b2e797beee68ae0b50decb1f020d jdk7-b61
+12e11fab9a839a9666a996a8f9a02fd8fa03aab6 jdk7-b62
+2ed6ed6b5bfc7dd724925b90dbb31223df59c25d jdk7-b63
--- a/make/com/sun/java/pack/Makefile Tue Jun 30 17:12:32 2009 -0700
+++ b/make/com/sun/java/pack/Makefile Thu Jul 23 11:29:49 2009 -0700
@@ -91,10 +91,10 @@ ifeq ($(PLATFORM), windows)
CXXFLAGS_COMMON += $(MS_RUNTIME_OPTION)
LDOUTPUT = -Fe
- # J2SE name required here
- RC_FLAGS += /D "J2SE_FNAME=$(PGRM).exe" \
- /D "J2SE_INTERNAL_NAME=$(PGRM)" \
- /D "J2SE_FTYPE=0x1L"
+ # JDK name required here
+ RC_FLAGS += /D "JDK_FNAME=$(PGRM).exe" \
+ /D "JDK_INTERNAL_NAME=$(PGRM)" \
+ /D "JDK_FTYPE=0x1L"
RES = $(OBJDIR)/$(PGRM).res
else
@@ -133,13 +133,19 @@ unpacker:
$(MAKE) $(UNPACK_EXE) STANDALONE=true LDMAPFLAGS_OPT= LDMAPFLAGS_DBG=
ifeq ($(PLATFORM), windows)
+IMVERSIONVALUE=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VER).$(COOKED_BUILD_NUMBER)
+SED_ALL_MANIFEST=$(SED) -e 's%IMVERSION%$(IMVERSIONVALUE)%g'
+updatefiles::
+ $(CAT) $(TOPDIR)/src/windows/resource/unpack200_proto.exe.manifest | $(SED_ALL_MANIFEST) > $(OBJDIR)/unpack200.exe.manifest
winres:: $(RES)
else
+updatefiles::
+ $(ECHO) "Manifest not required for Unix"
winres::
$(ECHO) "Resource files not required for Unix"
endif
-$(UNPACK_EXE): $(UNPACK_EXE_FILES_o) winres
+$(UNPACK_EXE): $(UNPACK_EXE_FILES_o) updatefiles winres
$(prep-target)
$(LINKER) $(LDDFLAGS) $(UNPACK_EXE_FILES_o) $(RES) $(LIBCXX) $(LDOUTPUT)$(TEMPDIR)/unpack200$(EXE_SUFFIX)
ifdef MT
--- a/make/com/sun/nio/sctp/mapfile-vers Tue Jun 30 17:12:32 2009 -0700
+++ b/make/com/sun/nio/sctp/mapfile-vers Thu Jul 23 11:29:49 2009 -0700
@@ -27,6 +27,7 @@ SUNWprivate_1.1 {
global:
Java_sun_nio_ch_SctpNet_socket0;
Java_sun_nio_ch_SctpNet_bindx;
+ Java_sun_nio_ch_SctpNet_branch0;
Java_sun_nio_ch_SctpNet_getLocalAddresses0;
Java_sun_nio_ch_SctpNet_getRemoteAddresses0;
Java_sun_nio_ch_SctpNet_getPrimAddrOption0;
--- a/make/common/Defs-windows.gmk Tue Jun 30 17:12:32 2009 -0700
+++ b/make/common/Defs-windows.gmk Thu Jul 23 11:29:49 2009 -0700
@@ -1,5 +1,5 @@
#
-# Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved.
+# Copyright 1999-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
@@ -464,11 +464,48 @@ JDK_RC_FVER = \
JDK_RC_FVER = \
$(JDK_MINOR_VERSION),$(JDK_MICRO_VERSION),$(JDK_UPDATE_VER),$(COOKED_BUILD_NUMBER)
-# J2SE name required here
-RC_FLAGS += -d "J2SE_BUILD_ID=$(JDK_RC_BUILD_ID)" \
- -d "J2SE_COMPANY=$(JDK_RC_COMPANY)" \
- -d "J2SE_COMPONENT=$(JDK_RC_COMPONENT)" \
- -d "J2SE_VER=$(JDK_RC_VER)" \
- -d "J2SE_COPYRIGHT=$(JDK_RC_COPYRIGHT)" \
- -d "J2SE_NAME=$(JDK_RC_NAME)" \
- -d "J2SE_FVER=$(JDK_RC_FVER)"
+# JDK name required here
+RC_FLAGS += -d "JDK_BUILD_ID=$(JDK_RC_BUILD_ID)" \
+ -d "JDK_COMPANY=$(JDK_RC_COMPANY)" \
+ -d "JDK_COMPONENT=$(JDK_RC_COMPONENT)" \
+ -d "JDK_VER=$(JDK_RC_VER)" \
+ -d "JDK_COPYRIGHT=$(JDK_RC_COPYRIGHT)" \
+ -d "JDK_NAME=$(JDK_RC_NAME)" \
+ -d "JDK_FVER=$(JDK_RC_FVER)"
+
+# Enable 7-Zip LZMA file (de)compression for Java Kernel if it is available
+ifeq ($(ARCH_DATA_MODEL), 32)
+ ifneq ($(KERNEL), off)
+ # This is a hack to use until 7-Zip (and UPX) bundles can be put
+ # under /java/devtools.
+ ifndef DEPLOY_TOPDIR
+ DEPLOY_TOPDIR=$(JDK_TOPDIR)/../deploy
+ endif
+ # Uncomment this block to cause build failure if above assumption false
+ #DCHK = $(shell if [ ! -d $(DEPLOY_TOPDIR) ] ; then \
+ # $(ECHO) deploy_not_a_peer_of_j2se ; \
+ #fi )
+ #ifeq ($(DCHK), deploy_not_a_peer_of_j2se)
+ # If a build failure points to control coming here it means
+ # it means deploy is not in the same directory
+ # as j2se. Java Kernel can't tolerate that for the time being.
+ #endif
+ EC_TMP = $(shell if [ -d $(DEPLOY_TOPDIR)/make/lzma ] ; then \
+ $(ECHO) true ; \
+ else \
+ $(ECHO) false ; \
+ fi )
+ ifeq ($(EC_TMP), true)
+ EXTRA_COMP_INSTALL_PATH = lib\\\\deploy\\\\lzma.dll
+ # Crazy but true: deploy/make/plugin/jinstall/Makefile.jkernel does
+ # not include deploy/make/common/Defs-windows.gmk, either directly
+ # or indirectly. But it does include this file, so redundantly declare
+ # these variables that are in deploy/make/common/Defs-windows.gmk for
+ # the sake of the Java Kernel part of the deploy build. Whew!
+ EXTRA_COMP_LIB_NAME = lzma.dll
+ EXTRA_COMP_PATH = $(OUTPUTDIR)/tmp/deploy/lzma/win32/obj
+ EXTRA_COMP_CMD_PATH = $(EXTRA_COMP_PATH)/lzma.exe
+ EXTRA_COMP_LIB_PATH = $(EXTRA_COMP_PATH)/$(EXTRA_COMP_LIB_NAME)
+ endif
+ endif
+endif
--- a/make/common/Library.gmk Tue Jun 30 17:12:32 2009 -0700
+++ b/make/common/Library.gmk Thu Jul 23 11:29:49 2009 -0700
@@ -207,10 +207,10 @@ endif
endif
@$(ECHO) Created $@
-# J2SE name required here
-RC_FLAGS += /D "J2SE_FNAME=$(LIBRARY).dll" \
- /D "J2SE_INTERNAL_NAME=$(LIBRARY)" \
- /D "J2SE_FTYPE=0x2L"
+# JDK name required here
+RC_FLAGS += /D "JDK_FNAME=$(LIBRARY).dll" \
+ /D "JDK_INTERNAL_NAME=$(LIBRARY)" \
+ /D "JDK_FTYPE=0x2L"
$(OBJDIR)/$(LIBRARY).res: $(VERSIONINFO_RESOURCE)
ifndef LOCAL_RESOURCE_FILE
--- a/make/common/Program.gmk Tue Jun 30 17:12:32 2009 -0700
+++ b/make/common/Program.gmk Thu Jul 23 11:29:49 2009 -0700
@@ -123,10 +123,10 @@ ifeq ($(COMPILE_IT),true)
#
ifeq ($(PLATFORM), windows)
-# J2SE name required here
-RC_FLAGS += /D "J2SE_FNAME=$(PROGRAM)$(EXE_SUFFIX)" \
- /D "J2SE_INTERNAL_NAME=$(PROGRAM)" \
- /D "J2SE_FTYPE=0x1L"
+# JDK name required here
+RC_FLAGS += /D "JDK_FNAME=$(PROGRAM)$(EXE_SUFFIX)" \
+ /D "JDK_INTERNAL_NAME=$(PROGRAM)" \
+ /D "JDK_FTYPE=0x1L"
$(OBJDIR)/$(PROGRAM).res: $(VERSIONINFO_RESOURCE)
@$(prep-target)
--- a/make/common/Release.gmk Tue Jun 30 17:12:32 2009 -0700
+++ b/make/common/Release.gmk Thu Jul 23 11:29:49 2009 -0700
@@ -97,7 +97,7 @@ else
ifeq ($(PLATFORM), windows)
LICENSE_DOCLIST_JDK = $(subst $(LICENSE_VERSION),,\
$(shell $(CD) $(SHARE_JDK_DOC_SRC) && \
- $(LS) *LICENSE*$(LICENSE_VERSION)))
+ $(LS) *LICENSE*$(LICENSE_VERSION)))
LICENSE_DOCLIST_JRE = $(subst $(LICENSE_VERSION),,\
$(shell $(CD) $(SHARE_JRE_DOC_SRC) && \
$(LS) *LICENSE*$(LICENSE_VERSION)))
@@ -401,7 +401,7 @@ TOOLS = \
sun/tools/jstack \
sun/tools/jinfo \
sun/tools/jmap
-
+
# classes that go into jsse.jar
JSSE_CLASSES_DIRS = \
sun/security/provider/Sun.class \
@@ -645,7 +645,7 @@ JARSPLIT_JARFILE = $(BUILDTOOLJARDIR)/ja
@$(java-vm-cleanup)
# Create the manifest file.
-JAR_MANIFEST_FILE=$(TEMPDIR)/manifest.tmp
+JAR_MANIFEST_FILE=$(ABS_TEMPDIR)/manifest.tmp
$(JAR_MANIFEST_FILE): $(MAINMANIFEST) $(BEANMANIFEST)
$(prep-target)
$(SED) -e "s/@@RELEASE@@/$(RELEASE)/" $(MAINMANIFEST) >> $@
@@ -653,25 +653,22 @@ JAR_MANIFEST_FILE=$(TEMPDIR)/manifest.tm
$(CAT) $(BEANMANIFEST) >> $@
# Create resources.jar containing non-class files
-RESOURCES_JAR=$(TEMPDIR)/resources-orig.jar
-RES_JAR_ARGLIST=$(RES_JAR_FILELIST)_args
-$(RES_JAR_ARGLIST): $(RES_JAR_FILELIST)
+RESOURCES_JAR=$(ABS_TEMPDIR)/resources-orig.jar
+$(RESOURCES_JAR): $(RES_JAR_FILELIST) $(JAR_MANIFEST_FILE)
$(prep-target)
- $(SED) -e "s@^@-C $(CLASSBINDIR) @" $< > $@
-$(RESOURCES_JAR): $(RES_JAR_ARGLIST) $(JAR_MANIFEST_FILE)
- $(prep-target)
- $(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \
- @$(RES_JAR_ARGLIST) $(BOOT_JAR_JFLAGS)
- @$(java-vm-cleanup)
+ $(CD) $(CLASSBINDIR) && \
+ $(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \
+ @$(RES_JAR_FILELIST) $(BOOT_JAR_JFLAGS)
+ @$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
# Create jsse.jar containing SunJSSE implementation classes
-JSSE_JAR=$(TEMPDIR)/jsse-orig.jar
+JSSE_JAR=$(ABS_TEMPDIR)/jsse-orig.jar
$(JSSE_JAR): $(JAR_MANIFEST_FILE)
$(prep-target)
- $(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \
- $(JSSE_CLASSES_DIRS:%=-C $(CLASSBINDIR) %) \
- $(BOOT_JAR_JFLAGS)
- @$(java-vm-cleanup)
+ $(CD) $(CLASSBINDIR) && \
+ $(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \
+ $(JSSE_CLASSES_DIRS) $(BOOT_JAR_JFLAGS)
+ @$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
# Create sec-bin.zip
SEC_FILES_ZIP=$(ABS_TEMPDIR)/sec-bin.zip
@@ -713,15 +710,12 @@ endif
# Create rt.jar
RT_JAR=$(ABS_TEMPDIR)/rt-orig.jar
-RT_JAR_ARGLIST=$(RT_JAR_FILELIST)_args
-$(RT_JAR_ARGLIST): $(RT_JAR_FILELIST)
+$(RT_JAR): $(RT_JAR_FILELIST) $(JAR_MANIFEST_FILE)
$(prep-target)
- $(SED) -e "s@^@-C $(CLASSBINDIR) @" $< > $@
-$(RT_JAR): $(RT_JAR_ARGLIST) $(JAR_MANIFEST_FILE)
- $(prep-target)
- $(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \
- @$(RT_JAR_ARGLIST) $(BOOT_JAR_JFLAGS)
- @$(java-vm-cleanup)
+ $(CD) $(CLASSBINDIR) && \
+ $(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \
+ @$(RT_JAR_FILELIST) $(BOOT_JAR_JFLAGS)
+ @$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
# Meta-index construction to make core class loaders lazier
@@ -795,6 +789,11 @@ ifeq ($(PLATFORM), windows)
$(CD) $(JRE_IMAGE_DIR)/lib && \
$(RM) java.$(LIB_SUFFIX) jvm.$(LIB_SUFFIX) \
hpi.$(LIB_SUFFIX) awt.$(LIB_SUFFIX) jawt.$(LIB_SUFFIX)
+ ifeq ($(ARCH_DATA_MODEL), 32)
+ @# The Java Kernel JRE image ships with a special VM. It is not included
+ @# in the full JRE image, so remove it. Also, is it only for 32-bit windows.
+ $(CD) $(JRE_IMAGE_DIR)/bin && $(RM) -r kernel
+ endif
endif # Windows
ifneq ($(PLATFORM), windows)
$(call copy-man-pages,$(JRE_IMAGE_DIR),$(JRE_MAN_PAGES))
@@ -944,10 +943,10 @@ initial-image-jdk:: initial-image-jdk-se
@#
@# lib/tools.jar
@#
- $(BOOT_JAR_CMD) c0f $(LIBDIR)/tools.jar $(addprefix \
- -C $(CLASSBINDIR) , $(TOOLS)) \
- $(BOOT_JAR_JFLAGS)
- @$(java-vm-cleanup)
+ $(CD) $(CLASSBINDIR) && \
+ $(BOOT_JAR_CMD) c0f $(ABS_LIBDIR)/tools.jar \
+ $(TOOLS) $(BOOT_JAR_JFLAGS)
+ @$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
$(CP) $(LIBDIR)/tools.jar $(JDK_IMAGE_DIR)/lib/tools.jar
@#
@# lib/ct.sym
--- a/make/common/shared/Compiler-msvc.gmk Tue Jun 30 17:12:32 2009 -0700
+++ b/make/common/shared/Compiler-msvc.gmk Thu Jul 23 11:29:49 2009 -0700
@@ -35,8 +35,8 @@ ifeq ($(PLATFORM), windows)
LIBEXE = $(COMPILER_PATH)lib
LINK = $(COMPILER_PATH)link
RC = $(MSDEVTOOLS_PATH)rc
+ RSC = $(MSDEVTOOLS_PATH)rc
LINK32 = $(LINK)
- RSC = $(RC)
# Fill in unknown values
COMPILER_NAME=Unknown MSVC Compiler
@@ -98,6 +98,9 @@ ifeq ($(PLATFORM), windows)
endif
ifeq ($(CC_MAJORVER), 14)
ifeq ($(ARCH), amd64)
+ #rebase and midl moved out of Visual Studio into the SDK:
+ REBASE = $(MSDEVTOOLS_PATH)/rebase
+ MTL = $(MSDEVTOOLS_PATH)/midl.exe
ifeq ($(CC_MICROVER), 30701)
# This should be: CC_VER=14.00.30701 LINK_VER=8.00.30701
# WARNING: it says 14, but it is such an early build it doesn't
@@ -110,6 +113,8 @@ ifeq ($(PLATFORM), windows)
COMPILER_NAME=Microsoft Platform SDK - April 2005 Edition (3790.1830)
COMPILER_VERSION=VS2005
endif
+ else
+ REBASE = $(COMPILER_PATH)../rebase
endif
endif
ifeq ($(CC_MAJORVER), 15)
@@ -120,7 +125,6 @@ ifeq ($(PLATFORM), windows)
endif
# This will cause problems if ALT_COMPILER_PATH is defined to ""
# which is a directive to use the PATH.
- REBASE = $(COMPILER_PATH)../REBASE
ifndef COMPILER_PATH
COMPILER_PATH := $(error COMPILER_PATH cannot be empty here)
endif
--- a/make/common/shared/Defs-utils.gmk Tue Jun 30 17:12:32 2009 -0700
+++ b/make/common/shared/Defs-utils.gmk Thu Jul 23 11:29:49 2009 -0700
@@ -72,6 +72,7 @@ AR = $(UTILS_CCS_BIN_PATH)ar
AR = $(UTILS_CCS_BIN_PATH)ar
AS = $(UTILS_CCS_BIN_PATH)as
BASENAME = $(UTILS_COMMAND_PATH)basename
+BZIP2 = $(UTILS_COMMAND_PATH)bzip2
CAT = $(UTILS_COMMAND_PATH)cat
CHMOD = $(UTILS_COMMAND_PATH)chmod
CMP = $(UTILS_USR_BIN_PATH)cmp
@@ -157,6 +158,7 @@ ifeq ($(PLATFORM),windows)
endif
# Re-define some utilities
LEX =# override GNU Make intrinsic: no lex on windows
+ SHA1SUM = $(UNIXCOMMAND_PATH)openssl sha1
endif
# Linux specific
--- a/make/common/shared/Defs-windows.gmk Tue Jun 30 17:12:32 2009 -0700
+++ b/make/common/shared/Defs-windows.gmk Thu Jul 23 11:29:49 2009 -0700
@@ -520,7 +520,7 @@ ifdef ALT_INSTALL_MSSDK
xALT_INSTALL_MSSDK :="$(subst \,/,$(ALT_INSTALL_MSSDK))"
INSTALL_MSSDK :=$(call FullPath,$(xALT_INSTALL_MSSDK))
else
- INSTALL_MSSDK :=$(_psdk)
+ INSTALL_MSSDK :=$(_ms_sdk)
endif
INSTALL_MSSDK:=$(call AltCheckSpaces,INSTALL_MSSDK)
@@ -631,7 +631,12 @@ ifdef ALT_HOTSPOT_IMPORT_PATH
ifdef ALT_HOTSPOT_IMPORT_PATH
HOTSPOT_IMPORT_PATH :=$(call FullPath,$(ALT_HOTSPOT_IMPORT_PATH))
else
- HOTSPOT_IMPORT_PATH =$(JDK_IMPORT_PATH)
+ # Default locations include the current $OUTPUTDIR, RE Promotions,
+ # and a JDK. Please be aware the JDK does not include a Kernel VM.
+ _HOTSPOT_IMPORT_PATH1 = $(OUTPUTDIR)/hotspot/import
+ _HOTSPOT_IMPORT_PATH2 = $(PROMOTED_BUILD_DISTDIR)/hotspot/import
+ _HOTSPOT_IMPORT_PATH3 = $(JDK_IMPORT_PATH)
+ HOTSPOT_IMPORT_PATH := $(call DirExists,$(_HOTSPOT_IMPORT_PATH1),$(_HOTSPOT_IMPORT_PATH2),$(_HOTSPOT_IMPORT_PATH3))
endif
HOTSPOT_IMPORT_PATH:=$(call AltCheckSpaces,HOTSPOT_IMPORT_PATH)
HOTSPOT_IMPORT_PATH:=$(call AltCheckValue,HOTSPOT_IMPORT_PATH)
@@ -665,4 +670,3 @@ endif
endif
HOTSPOT_LIB_PATH:=$(call AltCheckSpaces,HOTSPOT_LIB_PATH)
HOTSPOT_LIB_PATH:=$(call AltCheckValue,HOTSPOT_LIB_PATH)
-
--- a/make/common/shared/Defs.gmk Tue Jun 30 17:12:32 2009 -0700
+++ b/make/common/shared/Defs.gmk Thu Jul 23 11:29:49 2009 -0700
@@ -292,6 +292,7 @@ PROMOTED_RE_AREA = $(SLASH_JAVA)/re/jdk/
PROMOTED_RE_AREA = $(SLASH_JAVA)/re/jdk/$(JDK_VERSION)/promoted
PROMOTED_BUILD_LATEST = latest
PROMOTED_BUILD_BASEDIR = $(PROMOTED_RE_AREA)/$(PROMOTED_BUILD_LATEST)
+PROMOTED_BUILD_DISTDIR = $(PROMOTED_BUILD_BASEDIR)/dist/$(PLATFORM)-$(ARCH)
PROMOTED_BUILD_BINARIES = $(PROMOTED_BUILD_BASEDIR)/binaries
# PARALLEL_COMPILE_JOBS: is the number of compiles done in parallel.
--- a/make/common/shared/Sanity.gmk Tue Jun 30 17:12:32 2009 -0700
+++ b/make/common/shared/Sanity.gmk Thu Jul 23 11:29:49 2009 -0700
@@ -1568,8 +1568,48 @@ ifeq ($(ARCH_DATA_MODEL), 32)
"" >> $(ERROR_FILE) ; \
fi
endif
-endif
-
+ @#
+ @# Check for presence of headers required for new Java Plug-In ("plugin2")
+ @#
+ @if [ ! -r $(subst \,/,$(MOZILLA_HEADERS_PATH))/plugin2_mozilla_headers/npapi.h ]; then \
+ $(ECHO) "ERROR: You do not have access to valid Mozilla header files for the new Java Plug-In. \n" \
+ " Please check your access to \n" \
+ " $(subst \,/,$(MOZILLA_HEADERS_PATH))/plugin2_mozilla_headers/npapi.h \n" \
+ " and/or check your value of ALT_JDK_DEVTOOLS_DIR, ALT_MOZILLA_HEADERS_PATH, \n" \
+ "" >> $(ERROR_FILE) ; \
+ fi
+endif
+
+
+######################################################
+# Make sure Java Kernel VM is accessible
+######################################################
+sane-kernel-vm:
+ifeq ($(PLATFORM), windows)
+ ifeq ($(ARCH_DATA_MODEL), 32)
+ @if [ ! -r $(HOTSPOT_KERNEL_PATH)/jvm.dll ]; then \
+ $(ECHO) "WARNING: Your HOTSPOT_IMPORT_PATH does not include a Kernel VM... \n" \
+ " The kernel installer may not be built (unless hotspot is also). \n" \
+ " $(HOTSPOT_KERNEL_PATH)/jvm.dll \n" \
+ " Please check the value of ALT_HOTSPOT_IMPORT_PATH. \n" \
+ >> $(WARNING_FILE) ; \
+ fi
+ endif
+endif
+
+
+######################################################
+# SECURITY_BASELINE_131 test
+######################################################
+security_baseline_131:
+ifeq ($(PLATFORM), windows)
+ @if [ -z "$(SECURITY_BASELINE_131)" ]; then \
+ $(ECHO) "WARNING: Your SECURITY_BASELINE_131 setting is empty.\n" \
+ " Setting it to the default value of 1.3.1_20.\n" \
+ " It is recommended to set SECURITY_BASELINE_131.\n" \
+ "" >> $(WARNING_FILE) ; \
+ fi
+endif
######################################################
# SECURITY_BASELINE_142 test
@@ -1593,6 +1633,19 @@ ifeq ($(PLATFORM), windows)
$(ECHO) "WARNING: Your SECURITY_BASELINE_150 setting is empty.\n" \
" Setting it to the default value of 1.5.0_07.\n" \
" It is recommended to set SECURITY_BASELINE_150.\n" \
+ "" >> $(WARNING_FILE) ; \
+ fi
+endif
+
+######################################################
+# SECURITY_BASELINE_160 test
+######################################################
+security_baseline_160:
+ifeq ($(PLATFORM), windows)
+ @if [ -z "$(SECURITY_BASELINE_160)" ]; then \
+ $(ECHO) "WARNING: Your SECURITY_BASELINE_160 setting is empty.\n" \
+ " Setting it to the default value of 1.6.0_11.\n" \
+ " It is recommended to set SECURITY_BASELINE_160.\n" \
"" >> $(WARNING_FILE) ; \
fi
endif
--- a/make/java/java/FILES_c.gmk Tue Jun 30 17:12:32 2009 -0700
+++ b/make/java/java/FILES_c.gmk Thu Jul 23 11:29:49 2009 -0700
@@ -64,6 +64,7 @@ FILES_c = \
jio.c \
logging.c \
jni_util.c \
+ jni_util_md.c \
jdk_util.c \
jdk_util_md.c \
check_version.c \
--- a/make/java/java/FILES_java.gmk Tue Jun 30 17:12:32 2009 -0700
+++ b/make/java/java/FILES_java.gmk Thu Jul 23 11:29:49 2009 -0700
@@ -412,6 +412,7 @@ JAVA_JAVA_java = \
java/io/FileReader.java \
java/io/PipedReader.java \
java/io/StringReader.java \
+ java/io/TempFileHelper.java \
java/io/Writer.java \
java/io/BufferedWriter.java \
java/io/PrintWriter.java \
--- a/make/java/java/mapfile-vers Tue Jun 30 17:12:32 2009 -0700
+++ b/make/java/java/mapfile-vers Thu Jul 23 11:29:49 2009 -0700
@@ -280,6 +280,9 @@ SUNWprivate_1.1 {
Java_sun_misc_VM_initialize;
Java_sun_misc_VMSupport_initAgentProperties;
+ # ZipFile.c needs this one
+ throwFileNotFoundException;
+
# Java_sun_misc_VM_getState; threads.c
# Java_sun_misc_VM_threadsSuspended; threads.c
# Java_sun_misc_VM_unsuspendSomeThreads; threads.c
--- a/make/java/nio/FILES_java.gmk Tue Jun 30 17:12:32 2009 -0700
+++ b/make/java/nio/FILES_java.gmk Thu Jul 23 11:29:49 2009 -0700
@@ -86,8 +86,6 @@ FILES_src = \
java/nio/file/CopyOption.java \
java/nio/file/DirectoryNotEmptyException.java \
java/nio/file/DirectoryStream.java \
- java/nio/file/DirectoryStreamFilters.java \
- java/nio/file/FileAction.java \
java/nio/file/FileAlreadyExistsException.java \
java/nio/file/FileRef.java \
java/nio/file/FileStore.java \
@@ -141,6 +139,7 @@ FILES_src = \
java/nio/file/attribute/FileStoreAttributeView.java \
java/nio/file/attribute/FileStoreSpaceAttributeView.java \
java/nio/file/attribute/FileStoreSpaceAttributes.java \
+ java/nio/file/attribute/FileTime.java \
java/nio/file/attribute/GroupPrincipal.java \
java/nio/file/attribute/UserDefinedFileAttributeView.java \
java/nio/file/attribute/PosixFileAttributeView.java \
@@ -151,7 +150,6 @@ FILES_src = \
java/nio/file/attribute/UserPrincipalLookupService.java \
java/nio/file/attribute/UserPrincipalNotFoundException.java \
\
- java/nio/file/spi/AbstractPath.java \
java/nio/file/spi/FileSystemProvider.java \
java/nio/file/spi/FileTypeDetector.java \
\
@@ -248,8 +246,8 @@ FILES_src = \
\
sun/nio/fs/AbstractAclFileAttributeView.java \
sun/nio/fs/AbstractBasicFileAttributeView.java \
- sun/nio/fs/AbstractFileStoreSpaceAttributeView.java \
sun/nio/fs/AbstractFileTypeDetector.java \
+ sun/nio/fs/AbstractPath.java \
sun/nio/fs/AbstractPoller.java \
sun/nio/fs/AbstractUserDefinedFileAttributeView.java \
sun/nio/fs/AbstractWatchKey.java \
@@ -258,12 +256,13 @@ FILES_src = \
sun/nio/fs/Cancellable.java \
sun/nio/fs/DefaultFileSystemProvider.java \
sun/nio/fs/DefaultFileTypeDetector.java \
+ sun/nio/fs/DynamicFileAttributeView.java \
sun/nio/fs/FileOwnerAttributeViewImpl.java \
sun/nio/fs/Globs.java \
- sun/nio/fs/MimeType.java \
sun/nio/fs/NativeBuffer.java \
sun/nio/fs/NativeBuffers.java \
sun/nio/fs/Reflect.java \
+ sun/nio/fs/Util.java \
\
java/net/DatagramSocket.java \
java/net/DatagramSocketImpl.java \
--- a/make/java/nio/mapfile-linux Tue Jun 30 17:12:32 2009 -0700
+++ b/make/java/nio/mapfile-linux Thu Jul 23 11:29:49 2009 -0700
@@ -142,7 +142,7 @@ SUNWprivate_1.1 {
Java_sun_nio_fs_LinuxNativeDispatcher_fremovexattr0;
Java_sun_nio_fs_LinuxNativeDispatcher_setmntent0;
Java_sun_nio_fs_LinuxNativeDispatcher_endmntent;
- Java_sun_nio_fs_UnixNativeDispatcher_initIDs;
+ Java_sun_nio_fs_UnixNativeDispatcher_init;
Java_sun_nio_fs_UnixNativeDispatcher_getcwd;
Java_sun_nio_fs_UnixNativeDispatcher_strerror;
Java_sun_nio_fs_UnixNativeDispatcher_dup;
--- a/make/java/nio/mapfile-solaris Tue Jun 30 17:12:32 2009 -0700
+++ b/make/java/nio/mapfile-solaris Thu Jul 23 11:29:49 2009 -0700
@@ -120,7 +120,7 @@ SUNWprivate_1.1 {
Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGio;
Java_sun_nio_fs_GnomeFileTypeDetector_initializeGnomeVfs;
Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGnomeVfs;
- Java_sun_nio_fs_UnixNativeDispatcher_initIDs;
+ Java_sun_nio_fs_UnixNativeDispatcher_init;
Java_sun_nio_fs_UnixNativeDispatcher_getcwd;
Java_sun_nio_fs_UnixNativeDispatcher_strerror;
Java_sun_nio_fs_UnixNativeDispatcher_dup;
--- a/make/java/redist/Makefile Tue Jun 30 17:12:32 2009 -0700
+++ b/make/java/redist/Makefile Thu Jul 23 11:29:49 2009 -0700
@@ -119,10 +119,15 @@ IMPORT_LIST += \
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMMAP_NAME) \
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMPDB_NAME)
-# Hotspot client is only available on 32-bit builds
+# Add .map and .pdb files to the import path for client and kernel VMs.
+# These are only available on 32-bit windows builds.
ifeq ($(ARCH_DATA_MODEL), 32)
IMPORT_LIST += $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMMAP_NAME) \
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMPDB_NAME)
+ ifeq ($(DO_KERNEL), true)
+ IMPORT_LIST += $(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVMMAP_NAME) \
+ $(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVMPDB_NAME)
+ endif
endif
$(LIBDIR)/$(JVMLIB_NAME): $(HOTSPOT_LIB_PATH)/$(JVMLIB_NAME)
@@ -134,6 +139,10 @@ endif
@$(prep-target)
-$(CP) $(HOTSPOT_CLIENT_PATH)/$(JVMMAP_NAME) $@
+$(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVMMAP_NAME):
+ @$(prep-target)
+ -$(CP) $(HOTSPOT_KERNEL_PATH)/$(JVMMAP_NAME) $@
+
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMMAP_NAME):
@$(prep-target)
-$(CP) $(HOTSPOT_SERVER_PATH)/$(JVMMAP_NAME) $@
@@ -141,6 +150,10 @@ endif
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMPDB_NAME):
@$(prep-target)
-$(CP) $(HOTSPOT_CLIENT_PATH)/$(JVMPDB_NAME) $@
+
+$(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVMPDB_NAME):
+ @$(prep-target)
+ -$(CP) $(HOTSPOT_KERNEL_PATH)/$(JVMPDB_NAME) $@
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMPDB_NAME):
@$(prep-target)
@@ -195,6 +208,9 @@ endif # PLATFORM
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVM_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVM_NAME)
$(install-import-file)
+$(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVM_NAME): $(HOTSPOT_KERNEL_PATH)/$(JVM_NAME)
+ $(install-file)
+
$(LIB_LOCATION)/$(LIBJSIG_NAME): $(HOTSPOT_SERVER_PATH)/$(LIBJSIG_NAME)
$(install-import-file)
@@ -223,6 +239,9 @@ endif # PLATFORM
$(LIB_LOCATION)/$(CLIENT_LOCATION)/Xusage.txt : $(HOTSPOT_CLIENT_PATH)/Xusage.txt
$(install-import-file)
+
+$(LIB_LOCATION)/$(KERNEL_LOCATION)/Xusage.txt : $(HOTSPOT_KERNEL_PATH)/Xusage.txt
+ $(install-file)
ifeq ($(INCLUDE_SA), true)
# The Serviceability Agent is built in the Hotspot workspace.
--- a/make/java/zip/mapfile-vers Tue Jun 30 17:12:32 2009 -0700
+++ b/make/java/zip/mapfile-vers Thu Jul 23 11:29:49 2009 -0700
@@ -51,6 +51,7 @@ SUNWprivate_1.1 {
Java_java_util_zip_Inflater_reset;
Java_java_util_zip_Inflater_setDictionary;
Java_java_util_zip_ZipFile_close;
+ Java_java_util_zip_ZipFile_getCommentBytes;
Java_java_util_zip_ZipFile_freeEntry;
Java_java_util_zip_ZipFile_getEntry;
Java_java_util_zip_ZipFile_getEntryBytes;
--- a/make/jpda/tty/Makefile Tue Jun 30 17:12:32 2009 -0700
+++ b/make/jpda/tty/Makefile Thu Jul 23 11:29:49 2009 -0700
@@ -33,6 +33,12 @@ PROGRAM = jdb
PROGRAM = jdb
include $(BUILDDIR)/common/Defs.gmk
+# This program must contain a manifest that defines the execution level
+# needed to follow standard Vista User Access Control Guidelines
+# This must be set before Program.gmk is included
+#
+BUILD_MANIFEST=true
+
#
# Java Files to compile are found automatically.
#
--- a/make/sun/Makefile Tue Jun 30 17:12:32 2009 -0700
+++ b/make/sun/Makefile Thu Jul 23 11:29:49 2009 -0700
@@ -59,7 +59,7 @@ else
RENDER_SUBDIR = dcpr
endif
# nio need to be compiled before awt to have all charsets ready
-SUBDIRS = jar security javazic misc net audio $(RENDER_SUBDIR) image \
+SUBDIRS = jar security javazic misc jkernel net audio $(RENDER_SUBDIR) image \
nio awt splashscreen $(XAWT_SUBDIR) \
$(HEADLESS_SUBDIR) $(DGA_SUBDIR) \
font jpeg cmm applet rmi beans $(JDBC_SUBDIR) \
--- a/make/sun/applet/Makefile Tue Jun 30 17:12:32 2009 -0700
+++ b/make/sun/applet/Makefile Thu Jul 23 11:29:49 2009 -0700
@@ -32,6 +32,12 @@ PRODUCT = sun
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
+# This program must contain a manifest that defines the execution level
+# needed to follow standard Vista User Access Control Guidelines
+# This must be set before Program.gmk is included
+#
+BUILD_MANIFEST=true
+
#
# Files to compile.
#
--- a/make/sun/jar/Makefile Tue Jun 30 17:12:32 2009 -0700
+++ b/make/sun/jar/Makefile Thu Jul 23 11:29:49 2009 -0700
@@ -32,6 +32,13 @@ PRODUCT = sun
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
+# This program must contain a manifest that defines the execution level
+# needed to follow standard Vista User Access Control Guidelines
+# This must be set before Program.gmk is included
+#
+BUILD_MANIFEST=true
+
+
#
# Files
#
--- a/make/sun/javazic/tzdata_jdk/jdk11_full_backward Tue Jun 30 17:12:32 2009 -0700
+++ b/make/sun/javazic/tzdata_jdk/jdk11_full_backward Thu Jul 23 11:29:49 2009 -0700
@@ -54,9 +54,9 @@ Link Pacific/Guadalcanal SST
Link Pacific/Guadalcanal SST
Link Asia/Saigon VST
-# The follwong link is required to generate J2SE 1.2.x and 1.3.x
+# The follwong link is required to generate JDK 1.2.x and 1.3.x
# compatible zones. In the Olson public source, MET is defined as
-# GMT+1:00 with the C-Eur rules. In J2SE, MET is defined as an alias
+# GMT+1:00 with the C-Eur rules. In JDK, MET is defined as an alias
# of Asia/Tehran. This line must be removed if a full set of Olson
# zones is generated. Otherwise, MET appears twice in the
# ZoneInfoMappings.IDs table.
--- a/make/sun/jconsole/Makefile Tue Jun 30 17:12:32 2009 -0700
+++ b/make/sun/jconsole/Makefile Thu Jul 23 11:29:49 2009 -0700
@@ -31,6 +31,13 @@ PACKAGE = sun.tools.jconsole
PACKAGE = sun.tools.jconsole
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
+
+# This program must contain a manifest that defines the execution level
+# needed to follow standard Vista User Access Control Guidelines
+# This must be set before Program.gmk is included
+#
+BUILD_MANIFEST=true
+
JARFILE = $(LIBDIR)/jconsole.jar
--- a/make/sun/native2ascii/Makefile Tue Jun 30 17:12:32 2009 -0700
+++ b/make/sun/native2ascii/Makefile Thu Jul 23 11:29:49 2009 -0700
@@ -33,6 +33,13 @@ OTHER_JAVACFLAGS += -Xlint:serial -Werro
OTHER_JAVACFLAGS += -Xlint:serial -Werror
include $(BUILDDIR)/common/Defs.gmk
+# This program must contain a manifest that defines the execution level
+# needed to follow standard Vista User Access Control Guidelines
+# This must be set before Program.gmk is included
+#
+BUILD_MANIFEST=true
+
+
#
# Files
#
--- a/make/sun/net/FILES_java.gmk Tue Jun 30 17:12:32 2009 -0700
+++ b/make/sun/net/FILES_java.gmk Thu Jul 23 11:29:49 2009 -0700
@@ -66,6 +66,9 @@ FILES_java = \
sun/net/www/protocol/file/Handler.java \
sun/net/www/protocol/file/FileURLConnection.java \
sun/net/www/http/HttpClient.java \
+ sun/net/www/http/HttpCapture.java \
+ sun/net/www/http/HttpCaptureInputStream.java \
+ sun/net/www/http/HttpCaptureOutputStream.java \
sun/net/www/http/PosterOutputStream.java \
sun/net/www/http/ChunkedInputStream.java \
sun/net/www/http/ChunkedOutputStream.java \
@@ -75,6 +78,7 @@ FILES_java = \
sun/net/www/http/Hurryable.java \
sun/net/www/protocol/http/Handler.java \
sun/net/www/protocol/http/HttpURLConnection.java \
+ sun/net/www/protocol/http/HttpLogFormatter.java \
sun/net/www/protocol/http/HttpAuthenticator.java \
sun/net/www/protocol/http/AuthenticationHeader.java \
sun/net/www/protocol/http/AuthenticationInfo.java \
--- a/make/sun/nio/FILES_java.gmk Tue Jun 30 17:12:32 2009 -0700
+++ b/make/sun/nio/FILES_java.gmk Thu Jul 23 11:29:49 2009 -0700
@@ -151,7 +151,6 @@ FILES_src = \
sun/io/ByteToCharJISAutoDetect.java \
sun/io/ByteToCharJohab.java \
sun/io/ByteToCharMS874.java \
- sun/io/ByteToCharMS932DB.java \
sun/io/ByteToCharMS932.java \
sun/io/ByteToCharMS936.java \
sun/io/ByteToCharMS949.java \
@@ -283,7 +282,6 @@ FILES_src = \
sun/io/CharToByteISO8859_8.java \
sun/io/CharToByteJohab.java \
sun/io/CharToByteMS874.java \
- sun/io/CharToByteMS932DB.java \
sun/io/CharToByteMS932.java \
sun/io/CharToByteMS936.java \
sun/io/CharToByteMS949.java \
@@ -388,7 +386,15 @@ FILES_gen_extcs = \
sun/nio/cs/ext/IBM948.java \
sun/nio/cs/ext/IBM949.java \
sun/nio/cs/ext/IBM950.java \
- sun/nio/cs/ext/IBM970.java
+ sun/nio/cs/ext/IBM970.java \
+ sun/nio/cs/ext/EUC_CN.java \
+ sun/nio/cs/ext/EUC_KR.java \
+ sun/nio/cs/ext/Johab.java \
+ sun/nio/cs/ext/MS932.java \
+ sun/nio/cs/ext/MS936.java \
+ sun/nio/cs/ext/MS949.java \
+ sun/nio/cs/ext/MS950.java \
+ sun/nio/cs/ext/GBK.java
FILES_java = $(FILES_src) $(FILES_gen_extcs)
--- a/make/sun/nio/Makefile Tue Jun 30 17:12:32 2009 -0700
+++ b/make/sun/nio/Makefile Thu Jul 23 11:29:49 2009 -0700
@@ -105,7 +105,7 @@ CHARSETMAPPING_JARFILE = $(BUILDTOOLJARD
$(install-file)
$(CHARSETS_JAR): $(FILES_class) $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH) $(FILES_DAT)
- $(BOOT_JAR_CMD) cf $(CHARSETS_JAR) \
+ $(BOOT_JAR_CMD) cf0 $(CHARSETS_JAR) \
-C $(CLASSDESTDIR) sun \
-C $(CLASSDESTDIR) $(SERVICE_DESCRIPTION_PATH) \
$(BOOT_JAR_JFLAGS)
--- a/make/sun/rmi/rmic/Makefile Tue Jun 30 17:12:32 2009 -0700
+++ b/make/sun/rmi/rmic/Makefile Thu Jul 23 11:29:49 2009 -0700
@@ -33,6 +33,13 @@ include $(BUILDDIR)/common/Defs.gmk
include $(BUILDDIR)/common/Defs.gmk
#
+# This program must contain a manifest that defines the execution level
+# needed to follow standard Vista User Access Control Guidelines
+# This must be set before Program.gmk is included
+#
+BUILD_MANIFEST=true
+
+#
# Files
#
include FILES.gmk
--- a/make/sun/serialver/Makefile Tue Jun 30 17:12:32 2009 -0700
+++ b/make/sun/serialver/Makefile Thu Jul 23 11:29:49 2009 -0700
@@ -33,6 +33,14 @@ include $(BUILDDIR)/common/Defs.gmk
include $(BUILDDIR)/common/Defs.gmk
#
+# This program must contain a manifest that defines the execution level
+# needed to follow standard Vista User Access Control Guidelines
+# This must be set before Program.gmk is included
+#
+BUILD_MANIFEST=true
+
+
+#
# Files
#
AUTO_FILES_JAVA_DIRS = sun/tools/serialver
--- a/make/sun/xawt/mapfile-vers Tue Jun 30 17:12:32 2009 -0700
+++ b/make/sun/xawt/mapfile-vers Thu Jul 23 11:29:49 2009 -0700
@@ -125,6 +125,7 @@ SUNWprivate_1.1 {
Java_sun_awt_X11_XlibWrapper_XFree;
Java_sun_awt_X11_XlibWrapper_ServerVendor;
Java_sun_awt_X11_XlibWrapper_VendorRelease;
+ Java_sun_awt_X11_XlibWrapper_IsXsunKPBehavior;
Java_sun_awt_X11_XlibWrapper_SetToolkitErrorHandler;
Java_sun_awt_X11_XlibWrapper_XSetErrorHandler;
Java_sun_awt_X11_XlibWrapper_CallErrorHandler;
--- a/make/tools/CharsetMapping/dbcs Tue Jun 30 17:12:32 2009 -0700
+++ b/make/tools/CharsetMapping/dbcs Thu Jul 23 11:29:49 2009 -0700
@@ -1,6 +1,14 @@
#
#clzName csName hisName dbtype pkg ascii b1min b1max b2min b2max
#
+Johab x-Johab x-Johab basic sun.nio.cs.ext true 0x84 0xf9 0x31 0xfe
+EUC_CN GB2312 EUC_CN basic sun.nio.cs.ext true 0xa1 0xf7 0xa1 0xfe
+EUC_KR EUC-KR EUC_KR basic sun.nio.cs.ext true 0xa1 0xfd 0xa1 0xfe
+MS932 windows-31j MS932 basic sun.nio.cs.ext true 0x81 0xfc 0x40 0xfc
+MS936 x-mswin-936 MS936 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
+MS949 x-windows-949 MS949 basic sun.nio.cs.ext true 0x81 0xfe 0x41 0xfe
+MS950 x-windows-950 MS950 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
+GBK GBK GBK basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
IBM1381 x-IBM1381 Cp1381 basic sun.nio.cs.ext true 0x8c 0xf7 0xa1 0xfe
IBM1383 x-IBM1383 Cp1383 euc_sim sun.nio.cs.ext true 0xa1 0xfe 0xa1 0xfe
IBM930 x-IBM930 Cp930 ebcdic sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
--- a/make/tools/src/build/tools/charsetmapping/GenerateDBCS.java Tue Jun 30 17:12:32 2009 -0700
+++ b/make/tools/src/build/tools/charsetmapping/GenerateDBCS.java Thu Jul 23 11:29:49 2009 -0700
@@ -35,7 +35,7 @@ import static build.tools.charsetmapping
public class GenerateDBCS {
// pattern used by this class to read in mapping table
- static Pattern mPattern = Pattern.compile("(\\p{XDigit}++)\\s++(\\p{XDigit}++)(\\s++#.*)?");
+ static Pattern mPattern = Pattern.compile("(?:0x)?(\\p{XDigit}++)\\s++(?:0x)?(\\p{XDigit}++)(?:\\s++#.*)?");
public static void genDBCS(String args[]) throws Exception {
Scanner s = new Scanner(new File(args[0], args[2]));
@@ -260,10 +260,12 @@ public class GenerateDBCS {
"StandardCharsets.aliases_" + clzName :
"ExtendedCharsets.aliasesFor(\"" + csName + "\")")
.replace("$NAME_CS$" , csName)
- .replace("$CONTAINS$", isASCII ?
- " return ((cs.name().equals(\"US-ASCII\")) || (cs instanceof "
- + clzName + "));":
- " return (cs instanceof " + clzName + ");")
+ .replace("$CONTAINS$",
+ "MS932".equals(clzName)?
+ "return ((cs.name().equals(\"US-ASCII\")) || (cs instanceof JIS_X_0201) || (cs instanceof " + clzName + "));":
+ (isASCII ?
+ "return ((cs.name().equals(\"US-ASCII\")) || (cs instanceof " + clzName + "));":
+ "return (cs instanceof " + clzName + ");"))
.replace("$HISTORICALNAME$",
(hisName == null)? "" :
" public String historicalName() { return \"" + hisName + "\"; }")
--- a/src/share/bin/java.c Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/bin/java.c Thu Jul 23 11:29:49 2009 -0700
@@ -683,10 +683,16 @@ SetClassPath(const char *s)
SetClassPath(const char *s)
{
char *def;
+ const char *orig = s;
+ static const char format[] = "-Djava.class.path=%s";
s = JLI_WildcardExpandClasspath(s);
- def = JLI_MemAlloc(JLI_StrLen(s) + 40);
- sprintf(def, "-Djava.class.path=%s", s);
+ def = JLI_MemAlloc(sizeof(format)
+ - 2 /* strlen("%s") */
+ + JLI_StrLen(s));
+ sprintf(def, format, s);
AddOption(def, NULL);
+ if (s != orig)
+ JLI_MemFree((char *) s);
}
/*
--- a/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java Thu Jul 23 11:29:49 2009 -0700
@@ -506,6 +506,19 @@ public class BMPImageWriter extends Imag
writeFileHeader(fileSize, offset);
+ /* According to MSDN description, the top-down image layout
+ * is allowed only if compression type is BI_RGB or BI_BITFIELDS.
+ * Images with any other compression type must be wrote in the
+ * bottom-up layout.
+ */
+ if (compressionType == BMPConstants.BI_RGB ||
+ compressionType == BMPConstants.BI_BITFIELDS)
+ {
+ isTopDown = bmpParam.isTopDown();
+ } else {
+ isTopDown = false;
+ }
+
writeInfoHeader(headerSize, bitsPerPixel);
// compression
@@ -587,8 +600,6 @@ public class BMPImageWriter extends Imag
return;
}
-
- isTopDown = bmpParam.isTopDown();
int maxBandOffset = bandOffsets[0];
for (int i = 1; i < bandOffsets.length; i++)
@@ -1299,7 +1310,7 @@ public class BMPImageWriter extends Imag
stream.writeInt(w);
// height
- stream.writeInt(h);
+ stream.writeInt(isTopDown ? -h : h);
// number of planes
stream.writeShort(1);
--- a/src/share/classes/com/sun/imageio/plugins/common/ReaderUtil.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/common/ReaderUtil.java Thu Jul 23 11:29:49 2009 -0700
@@ -27,6 +27,8 @@ package com.sun.imageio.plugins.common;
import java.awt.Point;
import java.awt.Rectangle;
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
/**
* This class contains utility methods that may be useful to ImageReader
@@ -198,4 +200,17 @@ public class ReaderUtil {
vals, 1);
return vals;
}
+
+ public static int readMultiByteInteger(ImageInputStream iis)
+ throws IOException
+ {
+ int value = iis.readByte();
+ int result = value & 0x7f;
+ while((value & 0x80) == 0x80) {
+ result <<= 7;
+ value = iis.readByte();
+ result |= (value & 0x7f);
+ }
+ return result;
+ }
}
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEG.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEG.java Thu Jul 23 11:29:49 2009 -0700
@@ -215,17 +215,21 @@ public class JPEG {
public static class JCS {
public static final ColorSpace sRGB =
ColorSpace.getInstance(ColorSpace.CS_sRGB);
- public static final ColorSpace YCC;
-
- static {
- ColorSpace cs = null;
- try {
- cs = ColorSpace.getInstance(ColorSpace.CS_PYCC);
- } catch (IllegalArgumentException e) {
- // PYCC.pf may not always be installed
- } finally {
- YCC = cs;
+
+ private static ColorSpace YCC = null;
+ private static boolean yccInited = false;
+
+ public static ColorSpace getYCC() {
+ if (!yccInited) {
+ try {
+ YCC = ColorSpace.getInstance(ColorSpace.CS_PYCC);
+ } catch (IllegalArgumentException e) {
+ // PYCC.pf may not always be installed
+ } finally {
+ yccInited = true;
+ }
}
+ return YCC;
}
}
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java Thu Jul 23 11:29:49 2009 -0700
@@ -41,6 +41,7 @@ import java.awt.color.ColorSpace;
import java.awt.color.ColorSpace;
import java.awt.color.ICC_Profile;
import java.awt.color.ICC_ColorSpace;
+import java.awt.color.CMMException;
import java.awt.image.BufferedImage;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
@@ -53,6 +54,7 @@ import java.util.List;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;
+import java.util.NoSuchElementException;
import sun.java2d.Disposer;
import sun.java2d.DisposerRecord;
@@ -214,51 +216,6 @@ public class JPEGImageReader extends Ima
/** The DisposerRecord that handles the actual disposal of this reader. */
private DisposerRecord disposerRecord;
-
- /**
- * Maintain an array of the default image types corresponding to the
- * various supported IJG colorspace codes.
- */
- private static final ImageTypeSpecifier [] defaultTypes =
- new ImageTypeSpecifier [JPEG.NUM_JCS_CODES];
-
- static {
- defaultTypes[JPEG.JCS_GRAYSCALE] =
- ImageTypeSpecifier.createFromBufferedImageType
- (BufferedImage.TYPE_BYTE_GRAY);
- defaultTypes[JPEG.JCS_RGB] =
- ImageTypeSpecifier.createInterleaved
- (JPEG.JCS.sRGB,
- JPEG.bOffsRGB,
- DataBuffer.TYPE_BYTE,
- false,
- false);
- defaultTypes[JPEG.JCS_RGBA] =
- ImageTypeSpecifier.createPacked
- (JPEG.JCS.sRGB,
- 0xff000000,
- 0x00ff0000,
- 0x0000ff00,
- 0x000000ff,
- DataBuffer.TYPE_INT,
- false);
- if (JPEG.JCS.YCC != null) {
- defaultTypes[JPEG.JCS_YCC] =
- ImageTypeSpecifier.createInterleaved
- (JPEG.JCS.YCC,
- JPEG.bandOffsets[2],
- DataBuffer.TYPE_BYTE,
- false,
- false);
- defaultTypes[JPEG.JCS_YCCA] =
- ImageTypeSpecifier.createInterleaved
- (JPEG.JCS.YCC,
- JPEG.bandOffsets[3],
- DataBuffer.TYPE_BYTE,
- true,
- false);
- }
- }
/** Sets up static C structures. */
private static native void initReaderIDs(Class iisClass,
@@ -673,6 +630,17 @@ public class JPEGImageReader extends Ima
!java.util.Arrays.equals(oldData, newData))
{
iccCS = new ICC_ColorSpace(newProfile);
+ // verify new color space
+ try {
+ float[] colors = iccCS.fromRGB(new float[] {1f, 0f, 0f});
+ } catch (CMMException e) {
+ /*
+ * Embedded profile seems to be corrupted.
+ * Ignore this profile.
+ */
+ iccCS = null;
+ warningOccurred(WARNING_IGNORE_INVALID_ICC);
+ }
}
}
@@ -706,11 +674,11 @@ public class JPEGImageReader extends Ima
* Return an ImageTypeSpecifier corresponding to the given
* color space code, or null if the color space is unsupported.
*/
- private ImageTypeSpecifier getImageType(int code) {
- ImageTypeSpecifier ret = null;
+ private ImageTypeProducer getImageType(int code) {
+ ImageTypeProducer ret = null;
if ((code > 0) && (code < JPEG.NUM_JCS_CODES)) {
- ret = defaultTypes[code];
+ ret = ImageTypeProducer.getTypeProducer(code);
}
return ret;
}
@@ -724,7 +692,7 @@ public class JPEGImageReader extends Ima
}
// Returns null if it can't be represented
- return getImageType(colorSpaceCode);
+ return getImageType(colorSpaceCode).getType();
} finally {
clearThreadLock();
}
@@ -758,13 +726,13 @@ public class JPEGImageReader extends Ima
// Get the raw ITS, if there is one. Note that this
// won't always be the same as the default.
- ImageTypeSpecifier raw = getImageType(colorSpaceCode);
+ ImageTypeProducer raw = getImageType(colorSpaceCode);
// Given the encoded colorspace, build a list of ITS's
// representing outputs you could handle starting
// with the default.
- ArrayList list = new ArrayList(1);
+ ArrayList<ImageTypeProducer> list = new ArrayList<ImageTypeProducer>(1);
switch (colorSpaceCode) {
case JPEG.JCS_GRAYSCALE:
@@ -774,9 +742,7 @@ public class JPEGImageReader extends Ima
case JPEG.JCS_RGB:
list.add(raw);
list.add(getImageType(JPEG.JCS_GRAYSCALE));
- if (JPEG.JCS.YCC != null) {
- list.add(getImageType(JPEG.JCS_YCC));
- }
+ list.add(getImageType(JPEG.JCS_YCC));
break;
case JPEG.JCS_RGBA:
list.add(raw);
@@ -801,19 +767,21 @@ public class JPEGImageReader extends Ima
list.add(getImageType(JPEG.JCS_RGB));
if (iccCS != null) {
- list.add(ImageTypeSpecifier.createInterleaved
+ list.add(new ImageTypeProducer() {
+ protected ImageTypeSpecifier produce() {
+ return ImageTypeSpecifier.createInterleaved
(iccCS,
JPEG.bOffsRGB, // Assume it's for RGB
DataBuffer.TYPE_BYTE,
false,
- false));
+ false);
+ }
+ });
}
list.add(getImageType(JPEG.JCS_GRAYSCALE));
- if (JPEG.JCS.YCC != null) { // Might be null if PYCC.pf not installed
- list.add(getImageType(JPEG.JCS_YCC));
- }
+ list.add(getImageType(JPEG.JCS_YCC));
break;
case JPEG.JCS_YCbCrA: // Default is to convert to RGBA
// As there is no YCbCr ColorSpace, we can't support
@@ -822,7 +790,7 @@ public class JPEGImageReader extends Ima
break;
}
- return list.iterator();
+ return new ImageTypeIterator(list.iterator());
}
/**
@@ -872,6 +840,10 @@ public class JPEGImageReader extends Ima
if (csType == ColorSpace.TYPE_RGB) { // We want RGB
// IJG can do this for us more efficiently
setOutColorSpace(structPointer, JPEG.JCS_RGB);
+ // Update java state according to changes
+ // in the native part of decoder.
+ outColorSpaceCode = JPEG.JCS_RGB;
+ numComponents = 3;
} else if (csType != ColorSpace.TYPE_GRAY) {
throw new IIOException("Incompatible color conversion");
}
@@ -881,6 +853,10 @@ public class JPEGImageReader extends Ima
if (colorSpaceCode == JPEG.JCS_YCbCr) {
// If the jpeg space is YCbCr, IJG can do it
setOutColorSpace(structPointer, JPEG.JCS_GRAYSCALE);
+ // Update java state according to changes
+ // in the native part of decoder.
+ outColorSpaceCode = JPEG.JCS_GRAYSCALE;
+ numComponents = 1;
}
} else if ((iccCS != null) &&
(cm.getNumComponents() == numComponents) &&
@@ -906,20 +882,26 @@ public class JPEGImageReader extends Ima
}
break;
case JPEG.JCS_YCC:
- if (JPEG.JCS.YCC == null) { // We can't do YCC at all
- throw new IIOException("Incompatible color conversion");
- }
- if ((cs != JPEG.JCS.YCC) &&
- (cm.getNumComponents() == numComponents)) {
- convert = new ColorConvertOp(JPEG.JCS.YCC, cs, null);
+ {
+ ColorSpace YCC = JPEG.JCS.getYCC();
+ if (YCC == null) { // We can't do YCC at all
+ throw new IIOException("Incompatible color conversion");
+ }
+ if ((cs != YCC) &&
+ (cm.getNumComponents() == numComponents)) {
+ convert = new ColorConvertOp(YCC, cs, null);
+ }
}
break;
case JPEG.JCS_YCCA:
- // No conversions available; image must be YCCA
- if ((JPEG.JCS.YCC == null) || // We can't do YCC at all
- (cs != JPEG.JCS.YCC) ||
- (cm.getNumComponents() != numComponents)) {
- throw new IIOException("Incompatible color conversion");
+ {
+ ColorSpace YCC = JPEG.JCS.getYCC();
+ // No conversions available; image must be YCCA
+ if ((YCC == null) || // We can't do YCC at all
+ (cs != YCC) ||
+ (cm.getNumComponents() != numComponents)) {
+ throw new IIOException("Incompatible color conversion");
+ }
}
break;
default:
@@ -1554,3 +1536,140 @@ public class JPEGImageReader extends Ima
}
}
}
+
+/**
+ * An internal helper class that wraps producer's iterator
+ * and extracts specifier instances on demand.
+ */
+class ImageTypeIterator implements Iterator<ImageTypeSpecifier> {
+ private Iterator<ImageTypeProducer> producers;
+ private ImageTypeSpecifier theNext = null;
+
+ public ImageTypeIterator(Iterator<ImageTypeProducer> producers) {
+ this.producers = producers;
+ }
+
+ public boolean hasNext() {
+ if (theNext != null) {
+ return true;
+ }
+ if (!producers.hasNext()) {
+ return false;
+ }
+ do {
+ theNext = producers.next().getType();
+ } while (theNext == null && producers.hasNext());
+
+ return (theNext != null);
+ }
+
+ public ImageTypeSpecifier next() {
+ if (theNext != null || hasNext()) {
+ ImageTypeSpecifier t = theNext;
+ theNext = null;
+ return t;
+ } else {
+ throw new NoSuchElementException();
+ }
+ }
+
+ public void remove() {
+ producers.remove();
+ }
+}
+
+/**
+ * An internal helper class that provides means for deferred creation
+ * of ImageTypeSpecifier instance required to describe available
+ * destination types.
+ *
+ * This implementation only supports standard
+ * jpeg color spaces (defined by corresponding JCS color space code).
+ *
+ * To support other color spaces one can override produce() method to
+ * return custom instance of ImageTypeSpecifier.
+ */
+class ImageTypeProducer {
+
+ private ImageTypeSpecifier type = null;
+ boolean failed = false;
+ private int csCode;
+
+ public ImageTypeProducer(int csCode) {
+ this.csCode = csCode;
+ }
+
+ public ImageTypeProducer() {
+ csCode = -1; // undefined
+ }
+
+ public synchronized ImageTypeSpecifier getType() {
+ if (!failed && type == null) {
+ try {
+ type = produce();
+ } catch (Throwable e) {
+ failed = true;
+ }
+ }
+ return type;
+ }
+
+ private static final ImageTypeProducer [] defaultTypes =
+ new ImageTypeProducer [JPEG.NUM_JCS_CODES];
+
+ public synchronized static ImageTypeProducer getTypeProducer(int csCode) {
+ if (csCode < 0 || csCode >= JPEG.NUM_JCS_CODES) {
+ return null;
+ }
+ if (defaultTypes[csCode] == null) {
+ defaultTypes[csCode] = new ImageTypeProducer(csCode);
+ }
+ return defaultTypes[csCode];
+ }
+
+ protected ImageTypeSpecifier produce() {
+ switch (csCode) {
+ case JPEG.JCS_GRAYSCALE:
+ return ImageTypeSpecifier.createFromBufferedImageType
+ (BufferedImage.TYPE_BYTE_GRAY);
+ case JPEG.JCS_RGB:
+ return ImageTypeSpecifier.createInterleaved(JPEG.JCS.sRGB,
+ JPEG.bOffsRGB,
+ DataBuffer.TYPE_BYTE,
+ false,
+ false);
+ case JPEG.JCS_RGBA:
+ return ImageTypeSpecifier.createPacked(JPEG.JCS.sRGB,
+ 0xff000000,
+ 0x00ff0000,
+ 0x0000ff00,
+ 0x000000ff,
+ DataBuffer.TYPE_INT,
+ false);
+ case JPEG.JCS_YCC:
+ if (JPEG.JCS.getYCC() != null) {
+ return ImageTypeSpecifier.createInterleaved(
+ JPEG.JCS.getYCC(),
+ JPEG.bandOffsets[2],
+ DataBuffer.TYPE_BYTE,
+ false,
+ false);
+ } else {
+ return null;
+ }
+ case JPEG.JCS_YCCA:
+ if (JPEG.JCS.getYCC() != null) {
+ return ImageTypeSpecifier.createInterleaved(
+ JPEG.JCS.getYCC(),
+ JPEG.bandOffsets[3],
+ DataBuffer.TYPE_BYTE,
+ true,
+ false);
+ } else {
+ return null;
+ }
+ default:
+ return null;
+ }
+ }
+}
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java Thu Jul 23 11:29:49 2009 -0700
@@ -812,7 +812,7 @@ public class JPEGImageWriter extends Ima
}
break;
case ColorSpace.TYPE_3CLR:
- if (cs == JPEG.JCS.YCC) {
+ if (cs == JPEG.JCS.getYCC()) {
if (!alpha) {
if (jfif != null) {
convertTosRGB = true;
@@ -1494,7 +1494,7 @@ public class JPEGImageWriter extends Ima
}
break;
case ColorSpace.TYPE_3CLR:
- if (cs == JPEG.JCS.YCC) {
+ if (cs == JPEG.JCS.getYCC()) {
if (alpha) {
retval = JPEG.JCS_YCCA;
} else {
@@ -1533,7 +1533,7 @@ public class JPEGImageWriter extends Ima
}
break;
case ColorSpace.TYPE_3CLR:
- if (cs == JPEG.JCS.YCC) {
+ if (cs == JPEG.JCS.getYCC()) {
if (alpha) {
retval = JPEG.JCS_YCCA;
} else {
@@ -1579,7 +1579,7 @@ public class JPEGImageWriter extends Ima
}
break;
case ColorSpace.TYPE_3CLR:
- if (cs == JPEG.JCS.YCC) {
+ if (cs == JPEG.JCS.getYCC()) {
if (alpha) {
retval = JPEG.JCS_YCCA;
} else {
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java Thu Jul 23 11:29:49 2009 -0700
@@ -490,7 +490,7 @@ public class JPEGMetadata extends IIOMet
}
break;
case ColorSpace.TYPE_3CLR:
- if (cs == JPEG.JCS.YCC) {
+ if (cs == JPEG.JCS.getYCC()) {
wantJFIF = false;
componentIDs[0] = (byte) 'Y';
componentIDs[1] = (byte) 'C';
--- a/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReader.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReader.java Thu Jul 23 11:29:49 2009 -0700
@@ -45,6 +45,7 @@ import java.util.Iterator;
import java.util.Iterator;
import com.sun.imageio.plugins.common.I18N;
+import com.sun.imageio.plugins.common.ReaderUtil;
/** This class is the Java Image IO plugin reader for WBMP images.
* It may subsample the image, clip the image,
@@ -141,11 +142,11 @@ public class WBMPImageReader extends Ima
metadata.wbmpType = wbmpType;
// Read image width
- width = readMultiByteInteger();
+ width = ReaderUtil.readMultiByteInteger(iis);
metadata.width = width;
// Read image height
- height = readMultiByteInteger();
+ height = ReaderUtil.readMultiByteInteger(iis);
metadata.height = height;
gotHeader = true;
@@ -311,17 +312,6 @@ public class WBMPImageReader extends Ima
gotHeader = false;
}
- private int readMultiByteInteger() throws IOException {
- int value = iis.readByte();
- int result = value & 0x7f;
- while((value & 0x80) == 0x80) {
- result <<= 7;
- value = iis.readByte();
- result |= (value & 0x7f);
- }
- return result;
- }
-
/*
* This method verifies that given byte is valid wbmp type marker.
* At the moment only 0x0 marker is described by wbmp spec.
--- a/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReaderSpi.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReaderSpi.java Thu Jul 23 11:29:49 2009 -0700
@@ -33,8 +33,12 @@ import java.io.IOException;
import java.io.IOException;
import javax.imageio.ImageReader;
import javax.imageio.IIOException;
+import com.sun.imageio.plugins.common.ReaderUtil;
public class WBMPImageReaderSpi extends ImageReaderSpi {
+
+ private static final int MAX_WBMP_WIDTH = 1024;
+ private static final int MAX_WBMP_HEIGHT = 768;
private static String [] writerSpiNames =
{"com.sun.imageio.plugins.wbmp.WBMPImageWriterSpi"};
@@ -79,16 +83,44 @@ public class WBMPImageReaderSpi extends
}
ImageInputStream stream = (ImageInputStream)source;
- byte[] b = new byte[3];
stream.mark();
- stream.readFully(b);
+ int type = stream.readByte(); // TypeField
+ int fixHeaderField = stream.readByte();
+ // check WBMP "header"
+ if (type != 0 || fixHeaderField != 0) {
+ // while WBMP reader does not support ext WBMP headers
+ stream.reset();
+ return false;
+ }
+
+ int width = ReaderUtil.readMultiByteInteger(stream);
+ int height = ReaderUtil.readMultiByteInteger(stream);
+ // check image dimension
+ if (width <= 0 || height <= 0) {
+ stream.reset();
+ return false;
+ }
+
+ long dataLength = stream.length();
+ if (dataLength == -1) {
+ // We can't verify that amount of data in the stream
+ // corresponds to image dimension because we do not know
+ // the length of the data stream.
+ // Assuming that wbmp image are used for mobile devices,
+ // let's introduce an upper limit for image dimension.
+ // In case if exact amount of raster data is unknown,
+ // let's reject images with dimension above the limit.
+ stream.reset();
+ return (width < MAX_WBMP_WIDTH) && (height < MAX_WBMP_HEIGHT);
+ }
+
+ dataLength -= stream.getStreamPosition();
stream.reset();
- return ((b[0] == (byte)0) && // TypeField == 0
- b[1] == 0 && // FixHeaderField == 0xxx00000; not support ext header
- ((b[2] & 0x8f) != 0 || (b[2] & 0x7f) != 0)); // First width byte
- //XXX: b[2] & 0x8f) != 0 for the bug in Sony Ericsson encoder.
+ long scanSize = (width / 8) + ((width % 8) == 0 ? 0 : 1);
+
+ return (dataLength == scanSize * height);
}
public ImageReader createReaderInstance(Object extension)
--- a/src/share/classes/java/awt/AWTEvent.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/awt/AWTEvent.java Thu Jul 23 11:29:49 2009 -0700
@@ -32,6 +32,7 @@ import java.lang.reflect.Field;
import java.lang.reflect.Field;
import java.util.logging.Logger;
import java.util.logging.Level;
+import sun.awt.AWTAccessor;
/**
* The root event class for all AWT events.
@@ -230,6 +231,12 @@ public abstract class AWTEvent extends E
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
+ AWTAccessor.setAWTEventAccessor(
+ new AWTAccessor.AWTEventAccessor() {
+ public void setPosted(AWTEvent ev) {
+ ev.isPosted = true;
+ }
+ });
}
private static synchronized Field get_InputEvent_CanAccessSystemClipboard() {
--- a/src/share/classes/java/awt/Component.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/awt/Component.java Thu Jul 23 11:29:49 2009 -0700
@@ -861,6 +861,17 @@ public abstract class Component implemen
public boolean isVisible_NoClientCode(Component comp) {
return comp.isVisible_NoClientCode();
}
+ public void setRequestFocusController
+ (RequestFocusController requestController)
+ {
+ Component.setRequestFocusController(requestController);
+ }
+ public AppContext getAppContext(Component comp) {
+ return comp.appContext;
+ }
+ public void setAppContext(Component comp, AppContext appContext) {
+ comp.appContext = appContext;
+ }
});
}
@@ -9824,31 +9835,6 @@ public abstract class Component implemen
// ****************** END OF MIXING CODE ********************************
- private static boolean doesClassImplement(Class cls, String interfaceName) {
- if (cls == null) return false;
-
- for (Class c : cls.getInterfaces()) {
- if (c.getName().equals(interfaceName)) {
- return true;
- }
- }
- return doesClassImplement(cls.getSuperclass(), interfaceName);
- }
-
- /**
- * Checks that the given object implements the given interface.
- * @param obj Object to be checked
- * @param interfaceName The name of the interface. Must be fully-qualified interface name.
- * @return true, if this object implements the given interface,
- * false, otherwise, or if obj or interfaceName is null
- */
- static boolean doesImplement(Object obj, String interfaceName) {
- if (obj == null) return false;
- if (interfaceName == null) return false;
-
- return doesClassImplement(obj.getClass(), interfaceName);
- }
-
// Note that the method is overriden in the Window class,
// a window doesn't need to be updated in the Z-order.
void updateZOrder() {
--- a/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java Thu Jul 23 11:29:49 2009 -0700
@@ -425,15 +425,13 @@ public class ContainerOrderFocusTraversa
}
if (log.isLoggable(Level.FINE)) log.fine("### Cycle is " + cycle);
- for (int i = 0; i < cycle.size(); i++) {
- Component comp = cycle.get(i);
+ for (Component comp : cycle) {
if (accept(comp)) {
return comp;
- } else if (comp instanceof Container && comp != aContainer) {
- Container cont = (Container)comp;
- if (cont.isFocusTraversalPolicyProvider()) {
- return cont.getFocusTraversalPolicy().getDefaultComponent(cont);
- }
+ } else if (comp != aContainer &&
+ (comp = getComponentDownCycle(comp, FORWARD_TRAVERSAL)) != null)
+ {
+ return comp;
}
}
}
--- a/src/share/classes/java/awt/Dialog.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/awt/Dialog.java Thu Jul 23 11:29:49 2009 -0700
@@ -262,12 +262,6 @@ public class Dialog extends Window {
TOOLKIT_EXCLUDE
};
- /**
- * @since 1.6
- */
- private final static ModalExclusionType DEFAULT_MODAL_EXCLUSION_TYPE =
- ModalExclusionType.APPLICATION_EXCLUDE;
-
/* operations with this list should be synchronized on tree lock*/
transient static IdentityArrayList<Dialog> modalDialogs = new IdentityArrayList<Dialog>();
--- a/src/share/classes/java/awt/EventQueue.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/awt/EventQueue.java Thu Jul 23 11:29:49 2009 -0700
@@ -43,6 +43,7 @@ import sun.awt.PeerEvent;
import sun.awt.PeerEvent;
import sun.awt.SunToolkit;
import sun.awt.EventQueueItem;
+import sun.awt.AWTAccessor;
/**
* <code>EventQueue</code> is a platform-independent class
@@ -154,6 +155,18 @@ public class EventQueue {
private static final Logger eventLog = Logger.getLogger("java.awt.event.EventQueue");
+ static {
+ AWTAccessor.setEventQueueAccessor(
+ new AWTAccessor.EventQueueAccessor() {
+ public EventQueue getNextQueue(EventQueue eventQueue) {
+ return eventQueue.nextQueue;
+ }
+ public Thread getDispatchThread(EventQueue eventQueue) {
+ return eventQueue.dispatchThread;
+ }
+ });
+ }
+
public EventQueue() {
for (int i = 0; i < NUM_PRIORITIES; i++) {
queues[i] = new Queue();
--- a/src/share/classes/java/awt/Font.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/awt/Font.java Thu Jul 23 11:29:49 2009 -0700
@@ -445,18 +445,19 @@ public class Font implements java.io.Ser
*/
private AttributeValues getAttributeValues() {
if (values == null) {
- values = new AttributeValues();
- values.setFamily(name);
- values.setSize(pointSize); // expects the float value.
+ AttributeValues valuesTmp = new AttributeValues();
+ valuesTmp.setFamily(name);
+ valuesTmp.setSize(pointSize); // expects the float value.
if ((style & BOLD) != 0) {
- values.setWeight(2); // WEIGHT_BOLD
+ valuesTmp.setWeight(2); // WEIGHT_BOLD
}
if ((style & ITALIC) != 0) {
- values.setPosture(.2f); // POSTURE_OBLIQUE
+ valuesTmp.setPosture(.2f); // POSTURE_OBLIQUE
}
- values.defineAll(PRIMARY_MASK); // for streaming compatibility
+ valuesTmp.defineAll(PRIMARY_MASK); // for streaming compatibility
+ values = valuesTmp;
}
return values;
--- a/src/share/classes/java/awt/GraphicsEnvironment.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/awt/GraphicsEnvironment.java Thu Jul 23 11:29:49 2009 -0700
@@ -79,8 +79,9 @@ public abstract class GraphicsEnvironmen
try {
// long t0 = System.currentTimeMillis();
- localEnv =
- (GraphicsEnvironment) Class.forName(nm).newInstance();
+ ClassLoader cl = ClassLoader.getSystemClassLoader();
+ Class geCls = Class.forName(nm, true, cl);
+ localEnv = (GraphicsEnvironment)geCls.newInstance();
// long t1 = System.currentTimeMillis();
// System.out.println("GE creation took " + (t1-t0)+ "ms.");
if (isHeadless()) {
--- a/src/share/classes/java/awt/MenuComponent.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/awt/MenuComponent.java Thu Jul 23 11:29:49 2009 -0700
@@ -30,6 +30,7 @@ import java.io.ObjectInputStream;
import java.io.ObjectInputStream;
import sun.awt.AppContext;
import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
import javax.accessibility.*;
/**
@@ -109,6 +110,22 @@ public abstract class MenuComponent impl
*/
private static final long serialVersionUID = -4536902356223894379L;
+ static {
+ AWTAccessor.setMenuComponentAccessor(
+ new AWTAccessor.MenuComponentAccessor() {
+ public AppContext getAppContext(MenuComponent menuComp) {
+ return menuComp.appContext;
+ }
+ public void setAppContext(MenuComponent menuComp,
+ AppContext appContext) {
+ menuComp.appContext = appContext;
+ }
+ public MenuContainer getParent(MenuComponent menuComp) {
+ return menuComp.parent;
+ }
+ });
+ }
+
/**
* Creates a <code>MenuComponent</code>.
* @exception HeadlessException if
--- a/src/share/classes/java/awt/PopupMenu.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/awt/PopupMenu.java Thu Jul 23 11:29:49 2009 -0700
@@ -28,6 +28,7 @@ import java.awt.peer.PopupMenuPeer;
import java.awt.peer.PopupMenuPeer;
import javax.accessibility.*;
+import sun.awt.AWTAccessor;
/**
* A class that implements a menu which can be dynamically popped up
@@ -47,6 +48,15 @@ public class PopupMenu extends Menu {
static int nameCounter = 0;
transient boolean isTrayIconPopup = false;
+
+ static {
+ AWTAccessor.setPopupMenuAccessor(
+ new AWTAccessor.PopupMenuAccessor() {
+ public boolean isTrayIconPopup(PopupMenu popupMenu) {
+ return popupMenu.isTrayIconPopup;
+ }
+ });
+ }
/*
* JDK 1.1 serialVersionUID
--- a/src/share/classes/java/awt/Window.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/awt/Window.java Thu Jul 23 11:29:49 2009 -0700
@@ -3658,7 +3658,7 @@ public class Window extends Container im
private static void setLayersOpaque(Component component, boolean isOpaque) {
// Shouldn't use instanceof to avoid loading Swing classes
// if it's a pure AWT application.
- if (Component.doesImplement(component, "javax.swing.RootPaneContainer")) {
+ if (SunToolkit.isInstanceOf(component, "javax.swing.RootPaneContainer")) {
javax.swing.RootPaneContainer rpc = (javax.swing.RootPaneContainer)component;
javax.swing.JRootPane root = rpc.getRootPane();
javax.swing.JLayeredPane lp = root.getLayeredPane();
@@ -3797,6 +3797,10 @@ public class Window extends Container im
{
return window.calculateSecurityWarningPosition(x, y, w, h);
}
+
+ public void setLWRequestStatus(Window changed, boolean status) {
+ changed.syncLWRequests = status;
+ }
}); // WindowAccessor
} // static
--- a/src/share/classes/java/awt/color/ICC_Profile.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/awt/color/ICC_Profile.java Thu Jul 23 11:29:49 2009 -0700
@@ -863,11 +863,16 @@ public class ICC_Profile implements Seri
case ColorSpace.CS_PYCC:
synchronized(ICC_Profile.class) {
if (PYCCprofile == null) {
- ProfileDeferralInfo pInfo =
- new ProfileDeferralInfo("PYCC.pf",
- ColorSpace.TYPE_3CLR, 3,
- CLASS_DISPLAY);
- PYCCprofile = getDeferredInstance(pInfo);
+ if (getProfileFile("PYCC.pf") != null) {
+ ProfileDeferralInfo pInfo =
+ new ProfileDeferralInfo("PYCC.pf",
+ ColorSpace.TYPE_3CLR, 3,
+ CLASS_DISPLAY);
+ PYCCprofile = getDeferredInstance(pInfo);
+ } else {
+ throw new IllegalArgumentException(
+ "Can't load standard profile: PYCC.pf");
+ }
}
thisProfile = PYCCprofile;
}
@@ -1783,17 +1788,33 @@ public class ICC_Profile implements Seri
return (FileInputStream)java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
public Object run() {
- return privilegedOpenProfile(fileName);
+ File f = privilegedGetProfileFile(fileName);
+ if (f != null) {
+ try {
+ return new FileInputStream(f);
+ } catch (FileNotFoundException e) {
+ }
+ }
+ return null;
}
});
}
+ private static File getProfileFile(final String fileName) {
+ return (File)java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Object run() {
+ return privilegedGetProfileFile(fileName);
+ }
+ });
+ }
+
/*
- * this version is called from doPrivileged in privilegedOpenProfile.
- * the whole method is privileged!
- */
- private static FileInputStream privilegedOpenProfile(String fileName) {
- FileInputStream fis = null;
+ * this version is called from doPrivileged in openProfile
+ * or getProfileFile, so the whole method is privileged!
+ */
+
+ private static File privilegedGetProfileFile(String fileName) {
String path, dir, fullPath;
File f = new File(fileName); /* try absolute file name */
@@ -1823,19 +1844,24 @@ public class ICC_Profile implements Seri
}
if (!f.isFile()) { /* try the directory of built-in profiles */
- dir = System.getProperty("java.home") +
- File.separatorChar + "lib" + File.separatorChar + "cmm";
- fullPath = dir + File.separatorChar + fileName;
+ dir = System.getProperty("java.home") +
+ File.separatorChar + "lib" + File.separatorChar + "cmm";
+ fullPath = dir + File.separatorChar + fileName;
f = new File(fullPath);
+ if (!f.isFile()) {
+ //make sure file was installed in the kernel mode
+ try {
+ //kernel uses platform independent paths =>
+ // should not use platform separator char
+ sun.jkernel.DownloadManager.downloadFile("lib/cmm/"+fileName);
+ } catch (IOException ioe) {}
+ }
}
if (f.isFile()) {
- try {
- fis = new FileInputStream(f);
- } catch (FileNotFoundException e) {
- }
- }
- return fis;
+ return f;
+ }
+ return null;
}
--- a/src/share/classes/java/beans/Encoder.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/beans/Encoder.java Thu Jul 23 11:29:49 2009 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2000-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
@@ -24,7 +24,8 @@
*/
package java.beans;
-import java.util.Collections;
+import com.sun.beans.finder.PersistenceDelegateFinder;
+
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Map;
@@ -45,8 +46,7 @@ import java.util.Map;
*/
public class Encoder {
- private final Map<Class<?>, PersistenceDelegate> delegates
- = Collections.synchronizedMap(new HashMap<Class<?>, PersistenceDelegate>());
+ private final PersistenceDelegateFinder finder = new PersistenceDelegateFinder();
private Map bindings = new IdentityHashMap();
private ExceptionListener exceptionListener;
boolean executeStatements = true;
@@ -166,8 +166,13 @@ public class Encoder {
* @see java.beans.BeanInfo#getBeanDescriptor
*/
public PersistenceDelegate getPersistenceDelegate(Class<?> type) {
- PersistenceDelegate pd = this.delegates.get(type);
- return (pd != null) ? pd : MetaData.getPersistenceDelegate(type);
+ synchronized (this.finder) {
+ PersistenceDelegate pd = this.finder.find(type);
+ if (pd != null) {
+ return pd;
+ }
+ }
+ return MetaData.getPersistenceDelegate(type);
}
/**
@@ -184,10 +189,8 @@ public class Encoder {
public void setPersistenceDelegate(Class<?> type,
PersistenceDelegate persistenceDelegate)
{
- if (persistenceDelegate != null) {
- this.delegates.put(type, persistenceDelegate);
- } else {
- this.delegates.remove(type);
+ synchronized (this.finder) {
+ this.finder.register(type, persistenceDelegate);
}
}
@@ -243,12 +246,11 @@ public class Encoder {
for (int i = 0; i < oldArgs.length; i++) {
newArgs[i] = writeObject1(oldArgs[i]);
}
- if (oldExp.getClass() == Statement.class) {
- return new Statement(newTarget, oldExp.getMethodName(), newArgs);
- }
- else {
- return new Expression(newTarget, oldExp.getMethodName(), newArgs);
- }
+ Statement newExp = Statement.class.equals(oldExp.getClass())
+ ? new Statement(newTarget, oldExp.getMethodName(), newArgs)
+ : new Expression(newTarget, oldExp.getMethodName(), newArgs);
+ newExp.loader = oldExp.loader;
+ return newExp;
}
/**
--- a/src/share/classes/java/beans/IndexedPropertyDescriptor.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/beans/IndexedPropertyDescriptor.java Thu Jul 23 11:29:49 2009 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -274,6 +274,11 @@ perty.
}
indexedWriteMethod = Introspector.findMethod(cls, indexedWriteMethodName,
2, (type == null) ? null : new Class[] { int.class, type });
+ if (indexedWriteMethod != null) {
+ if (!indexedWriteMethod.getReturnType().equals(void.class)) {
+ indexedWriteMethod = null;
+ }
+ }
setIndexedWriteMethod0(indexedWriteMethod);
}
return indexedWriteMethod;
--- a/src/share/classes/java/beans/Introspector.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/beans/Introspector.java Thu Jul 23 11:29:49 2009 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -25,6 +25,7 @@
package java.beans;
+import com.sun.beans.finder.BeanInfoFinder;
import com.sun.beans.finder.ClassFinder;
import java.lang.ref.Reference;
@@ -45,6 +46,8 @@ import java.util.List;
import java.util.List;
import java.util.WeakHashMap;
import java.util.TreeMap;
+
+import sun.awt.AppContext;
import sun.reflect.misc.ReflectUtil;
/**
@@ -137,10 +140,6 @@ public class Introspector {
// events maps from String names to EventSetDescriptors
private Map events;
- private final static String DEFAULT_INFO_PATH = "sun.beans.infos";
-
- private static String[] searchPath = { DEFAULT_INFO_PATH };
-
private final static EventSetDescriptor[] EMPTY_EVENTSETDESCRIPTORS = new EventSetDescriptor[0];
static final String ADD_PREFIX = "add";
@@ -149,7 +148,7 @@ public class Introspector {
static final String SET_PREFIX = "set";
static final String IS_PREFIX = "is";
- private static final String BEANINFO_SUFFIX = "BeanInfo";
+ private static final Object FINDER_KEY = new Object();
//======================================================================
// Public methods
@@ -309,13 +308,11 @@ public class Introspector {
* Sun implementation initially sets to {"sun.beans.infos"}.
*/
- public static synchronized String[] getBeanInfoSearchPath() {
- // Return a copy of the searchPath.
- String result[] = new String[searchPath.length];
- for (int i = 0; i < searchPath.length; i++) {
- result[i] = searchPath[i];
- }
- return result;
+ public static String[] getBeanInfoSearchPath() {
+ BeanInfoFinder finder = getFinder();
+ synchronized (finder) {
+ return finder.getPackages();
+ }
}
/**
@@ -334,12 +331,15 @@ public class Introspector {
* @see SecurityManager#checkPropertiesAccess
*/
- public static synchronized void setBeanInfoSearchPath(String path[]) {
+ public static void setBeanInfoSearchPath(String[] path) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPropertiesAccess();
}
- searchPath = path;
+ BeanInfoFinder finder = getFinder();
+ synchronized (finder) {
+ finder.setPackages(path);
+ }
}
@@ -447,67 +447,14 @@ public class Introspector {
* then it checks to see if the class is its own BeanInfo. Finally,
* the BeanInfo search path is prepended to the class and searched.
*
+ * @param beanClass the class type of the bean
* @return Instance of an explicit BeanInfo class or null if one isn't found.
*/
- private static synchronized BeanInfo findExplicitBeanInfo(Class beanClass) {
- String name = beanClass.getName() + BEANINFO_SUFFIX;
- try {
- return (java.beans.BeanInfo)instantiate(beanClass, name);
- } catch (Exception ex) {
- // Just drop through
-
- }
- // Now try checking if the bean is its own BeanInfo.
- try {
- if (isSubclass(beanClass, java.beans.BeanInfo.class)) {
- return (java.beans.BeanInfo)beanClass.newInstance();
- }
- } catch (Exception ex) {
- // Just drop through
- }
- // Now try looking for <searchPath>.fooBeanInfo
- name = name.substring(name.lastIndexOf('.')+1);
-
- for (int i = 0; i < searchPath.length; i++) {
- // This optimization will only use the BeanInfo search path if is has changed
- // from the original or trying to get the ComponentBeanInfo.
- if (!DEFAULT_INFO_PATH.equals(searchPath[i]) ||
- DEFAULT_INFO_PATH.equals(searchPath[i]) && "ComponentBeanInfo".equals(name)) {
- try {
- String fullName = searchPath[i] + "." + name;
- java.beans.BeanInfo bi = (java.beans.BeanInfo)instantiate(beanClass, fullName);
-
- // Make sure that the returned BeanInfo matches the class.
- if (bi.getBeanDescriptor() != null) {
- if (bi.getBeanDescriptor().getBeanClass() == beanClass) {
- return bi;
- }
- } else if (bi.getPropertyDescriptors() != null) {
- PropertyDescriptor[] pds = bi.getPropertyDescriptors();
- for (int j = 0; j < pds.length; j++) {
- Method method = pds[j].getReadMethod();
- if (method == null) {
- method = pds[j].getWriteMethod();
- }
- if (method != null && method.getDeclaringClass() == beanClass) {
- return bi;
- }
- }
- } else if (bi.getMethodDescriptors() != null) {
- MethodDescriptor[] mds = bi.getMethodDescriptors();
- for (int j = 0; j < mds.length; j++) {
- Method method = mds[j].getMethod();
- if (method != null && method.getDeclaringClass() == beanClass) {
- return bi;
- }
- }
- }
- } catch (Exception ex) {
- // Silently ignore any errors.
- }
- }
- }
- return null;
+ private static BeanInfo findExplicitBeanInfo(Class beanClass) {
+ BeanInfoFinder finder = getFinder();
+ synchronized (finder) {
+ return finder.find(beanClass);
+ }
}
/**
@@ -577,9 +524,9 @@ public class Introspector {
pd = new PropertyDescriptor(this.beanClass, name.substring(2), method, null);
}
} else if (argCount == 1) {
- if (argTypes[0] == int.class && name.startsWith(GET_PREFIX)) {
+ if (int.class.equals(argTypes[0]) && name.startsWith(GET_PREFIX)) {
pd = new IndexedPropertyDescriptor(this.beanClass, name.substring(3), null, null, method, null);
- } else if (resultType == void.class && name.startsWith(SET_PREFIX)) {
+ } else if (void.class.equals(resultType) && name.startsWith(SET_PREFIX)) {
// Simple setter
pd = new PropertyDescriptor(this.beanClass, name.substring(3), null, method);
if (throwsException(method, PropertyVetoException.class)) {
@@ -587,7 +534,7 @@ public class Introspector {
}
}
} else if (argCount == 2) {
- if (argTypes[0] == int.class && name.startsWith(SET_PREFIX)) {
+ if (void.class.equals(resultType) && int.class.equals(argTypes[0]) && name.startsWith(SET_PREFIX)) {
pd = new IndexedPropertyDescriptor(this.beanClass, name.substring(3), null, null, null, method);
if (throwsException(method, PropertyVetoException.class)) {
pd.setConstrained(true);
@@ -1483,6 +1430,16 @@ public class Introspector {
return false;
}
+ private static BeanInfoFinder getFinder() {
+ AppContext context = AppContext.getAppContext();
+ Object object = context.get(FINDER_KEY);
+ if (object instanceof BeanInfoFinder) {
+ return (BeanInfoFinder) object;
+ }
+ BeanInfoFinder finder = new BeanInfoFinder();
+ context.put(FINDER_KEY, finder);
+ return finder;
+ }
/**
* Try to create an instance of a named class.
--- a/src/share/classes/java/beans/MetaData.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/beans/MetaData.java Thu Jul 23 11:29:49 2009 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2000-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
@@ -219,7 +219,9 @@ class java_lang_Class_PersistenceDelegat
return new Expression(oldInstance, String.class, "getClass", new Object[]{});
}
else {
- return new Expression(oldInstance, Class.class, "forName", new Object[]{c.getName()});
+ Expression newInstance = new Expression(oldInstance, Class.class, "forName", new Object[] { c.getName() });
+ newInstance.loader = c.getClassLoader();
+ return newInstance;
}
}
}
--- a/src/share/classes/java/beans/PropertyDescriptor.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/beans/PropertyDescriptor.java Thu Jul 23 11:29:49 2009 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -294,6 +294,11 @@ public class PropertyDescriptor extends
writeMethod = Introspector.findMethod(cls, writeMethodName, 1,
(type == null) ? null : new Class[] { type });
+ if (writeMethod != null) {
+ if (!writeMethod.getReturnType().equals(void.class)) {
+ writeMethod = null;
+ }
+ }
try {
setWriteMethod(writeMethod);
} catch (IntrospectionException ex) {
--- a/src/share/classes/java/beans/PropertyEditorManager.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/beans/PropertyEditorManager.java Thu Jul 23 11:29:49 2009 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -25,8 +25,8 @@
package java.beans;
-import com.sun.beans.WeakCache;
-import sun.beans.editors.*;
+import com.sun.beans.finder.PropertyEditorFinder;
+import sun.awt.AppContext;
/**
* The PropertyEditorManager can be used to locate a property editor for
@@ -55,6 +55,8 @@ import sun.beans.editors.*;
public class PropertyEditorManager {
+ private static final Object FINDER_KEY = new Object();
+
/**
* Registers an editor class to edit values of the given target class.
* If the editor class is {@code null},
@@ -74,12 +76,15 @@ public class PropertyEditorManager {
*
* @see SecurityManager#checkPropertiesAccess
*/
- public static synchronized void registerEditor(Class<?> targetType, Class<?> editorClass) {
+ public static void registerEditor(Class<?> targetType, Class<?> editorClass) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPropertiesAccess();
}
- registry.put(targetType, editorClass);
+ PropertyEditorFinder finder = getFinder();
+ synchronized (finder) {
+ finder.register(targetType, editorClass);
+ }
}
/**
@@ -89,46 +94,11 @@ public class PropertyEditorManager {
* @return An editor object for the given target class.
* The result is null if no suitable editor can be found.
*/
- public static synchronized PropertyEditor findEditor(Class<?> targetType) {
- Class editorClass = registry.get(targetType);
- if (editorClass != null) {
- try {
- Object o = editorClass.newInstance();
- return (PropertyEditor)o;
- } catch (Exception ex) {
- System.err.println("Couldn't instantiate type editor \"" +
- editorClass.getName() + "\" : " + ex);
- }
+ public static PropertyEditor findEditor(Class<?> targetType) {
+ PropertyEditorFinder finder = getFinder();
+ synchronized (finder) {
+ return finder.find(targetType);
}
-
- // Now try adding "Editor" to the class name.
-
- String editorName = targetType.getName() + "Editor";
- try {
- return (PropertyEditor) Introspector.instantiate(targetType, editorName);
- } catch (Exception ex) {
- // Silently ignore any errors.
- }
-
- // Now try looking for <searchPath>.fooEditor
- int index = editorName.lastIndexOf('.') + 1;
- if (index > 0) {
- editorName = editorName.substring(index);
- }
- for (String path : searchPath) {
- String name = path + '.' + editorName;
- try {
- return (PropertyEditor) Introspector.instantiate(targetType, name);
- } catch (Exception ex) {
- // Silently ignore any errors.
- }
- }
-
- if (null != targetType.getEnumConstants()) {
- return new EnumEditor(targetType);
- }
- // We couldn't find a suitable Editor.
- return null;
}
/**
@@ -139,8 +109,11 @@ public class PropertyEditorManager {
* <p> The default value for this array is implementation-dependent,
* e.g. Sun implementation initially sets to {"sun.beans.editors"}.
*/
- public static synchronized String[] getEditorSearchPath() {
- return searchPath.clone();
+ public static String[] getEditorSearchPath() {
+ PropertyEditorFinder finder = getFinder();
+ synchronized (finder) {
+ return finder.getPackages();
+ }
}
/**
@@ -156,28 +129,25 @@ public class PropertyEditorManager {
* of system properties.
* @see SecurityManager#checkPropertiesAccess
*/
- public static synchronized void setEditorSearchPath(String[] path) {
+ public static void setEditorSearchPath(String[] path) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPropertiesAccess();
}
- searchPath = (path != null)
- ? path.clone()
- : EMPTY;
+ PropertyEditorFinder finder = getFinder();
+ synchronized (finder) {
+ finder.setPackages(path);
+ }
}
- private static String[] searchPath = { "sun.beans.editors" };
- private static final String[] EMPTY = {};
- private static final WeakCache<Class<?>, Class<?>> registry;
-
- static {
- registry = new WeakCache<Class<?>, Class<?>>();
- registry.put(Byte.TYPE, ByteEditor.class);
- registry.put(Short.TYPE, ShortEditor.class);
- registry.put(Integer.TYPE, IntegerEditor.class);
- registry.put(Long.TYPE, LongEditor.class);
- registry.put(Boolean.TYPE, BooleanEditor.class);
- registry.put(Float.TYPE, FloatEditor.class);
- registry.put(Double.TYPE, DoubleEditor.class);
+ private static PropertyEditorFinder getFinder() {
+ AppContext context = AppContext.getAppContext();
+ Object object = context.get(FINDER_KEY);
+ if (object instanceof PropertyEditorFinder) {
+ return (PropertyEditorFinder) object;
+ }
+ PropertyEditorFinder finder = new PropertyEditorFinder();
+ context.put(FINDER_KEY, finder);
+ return finder;
}
}
--- a/src/share/classes/java/beans/Statement.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/beans/Statement.java Thu Jul 23 11:29:49 2009 -0700
@@ -66,6 +66,7 @@ public class Statement {
Object target;
String methodName;
Object[] arguments;
+ ClassLoader loader;
/**
* Creates a new <code>Statement</code> object with a <code>target</code>,
@@ -157,7 +158,7 @@ public class Statement {
// of core from a class inside core. Special
// case this method.
if (target == Class.class && methodName.equals("forName")) {
- return ClassFinder.resolveClass((String)arguments[0]);
+ return ClassFinder.resolveClass((String)arguments[0], this.loader);
}
Class[] argClasses = new Class[arguments.length];
for(int i = 0; i < arguments.length; i++) {
--- a/src/share/classes/java/io/File.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/io/File.java Thu Jul 23 11:29:49 2009 -0700
@@ -30,14 +30,14 @@ import java.net.URL;
import java.net.URL;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
-import java.util.*;
-import java.nio.file.*;
-import java.nio.file.attribute.*;
+import java.util.List;
+import java.util.ArrayList;
import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.security.SecureRandom;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.FileAttribute;
import sun.security.action.GetPropertyAction;
-
/**
* An abstract representation of file and directory pathnames.
@@ -787,7 +787,7 @@ public class File
* java.lang.SecurityManager#checkRead(java.lang.String)}</code>
* method denies read access to the file
*
- * @see Attributes#readBasicFileAttributes
+ * @see java.nio.file.attribute.Attributes#readBasicFileAttributes
*/
public boolean isDirectory() {
SecurityManager security = System.getSecurityManager();
@@ -813,7 +813,7 @@ public class File
* java.lang.SecurityManager#checkRead(java.lang.String)}</code>
* method denies read access to the file
*
- * @see Attributes#readBasicFileAttributes
+ * @see java.nio.file.attribute.Attributes#readBasicFileAttributes
*/
public boolean isFile() {
SecurityManager security = System.getSecurityManager();
@@ -863,7 +863,7 @@ public class File
* java.lang.SecurityManager#checkRead(java.lang.String)}</code>
* method denies read access to the file
*
- * @see Attributes#readBasicFileAttributes
+ * @see java.nio.file.attribute.Attributes#readBasicFileAttributes
*/
public long lastModified() {
SecurityManager security = System.getSecurityManager();
@@ -887,7 +887,7 @@ public class File
* java.lang.SecurityManager#checkRead(java.lang.String)}</code>
* method denies read access to the file
*
- * @see Attributes#readBasicFileAttributes
+ * @see java.nio.file.attribute.Attributes#readBasicFileAttributes
*/
public long length() {
SecurityManager security = System.getSecurityManager();
@@ -1369,9 +1369,10 @@ public class File
* Sets the owner's or everybody's write permission for this abstract
* pathname.
*
- * <p> The {@link Attributes Attributes} class defines methods that operate
- * on file attributes including file permissions. This may be used when
- * finer manipulation of file permissions is required.
+ * <p> The {@link java.nio.file.attribute.Attributes Attributes} class
+ * defines methods that operate on file attributes including file
+ * permissions. This may be used when finer manipulation of file permissions
+ * is required.
*
* @param writable
* If <code>true</code>, sets the access permission to allow write
@@ -1436,9 +1437,10 @@ public class File
* Sets the owner's or everybody's read permission for this abstract
* pathname.
*
- * <p> The {@link Attributes Attributes} class defines methods that operate
- * on file attributes including file permissions. This may be used when
- * finer manipulation of file permissions is required.
+ * <p> The {@link java.nio.file.attribute.Attributes Attributes} class
+ * defines methods that operate on file attributes including file
+ * permissions. This may be used when finer manipulation of file permissions
+ * is required.
*
* @param readable
* If <code>true</code>, sets the access permission to allow read
@@ -1509,9 +1511,10 @@ public class File
* Sets the owner's or everybody's execute permission for this abstract
* pathname.
*
- * <p> The {@link Attributes Attributes} class defines methods that operate
- * on file attributes including file permissions. This may be used when
- * finer manipulation of file permissions is required.
+ * <p> The {@link java.nio.file.attribute.Attributes Attributes} class
+ * defines methods that operate on file attributes including file
+ * permissions. This may be used when finer manipulation of file permissions
+ * is required.
*
* @param executable
* If <code>true</code>, sets the access permission to allow execute
@@ -1748,16 +1751,17 @@ public class File
return fs.getSpace(this, FileSystem.SPACE_USABLE);
}
-
/* -- Temporary files -- */
- private static class TemporaryDirectory {
- private TemporaryDirectory() { }
-
- static final String valueAsString = fs.normalize(
- AccessController.doPrivileged(new GetPropertyAction("java.io.tmpdir")));
- static final File valueAsFile =
- new File(valueAsString, fs.prefixLength(valueAsString));
+ static class TempDirectory {
+ private TempDirectory() { }
+
+ // temporary directory location
+ private static final File tmpdir = new File(fs.normalize(AccessController
+ .doPrivileged(new GetPropertyAction("java.io.tmpdir"))));
+ static File location() {
+ return tmpdir;
+ }
// file name generation
private static final SecureRandom random = new SecureRandom();
@@ -1770,25 +1774,6 @@ public class File
}
return new File(dir, prefix + Long.toString(n) + suffix);
}
-
- // default file permissions
- static final FileAttribute<Set<PosixFilePermission>> defaultPosixFilePermissions =
- PosixFilePermissions.asFileAttribute(EnumSet
- .of(PosixFilePermission.OWNER_READ, PosixFilePermission.OWNER_WRITE));
- static final boolean isPosix = isPosix();
- static boolean isPosix() {
- return AccessController.doPrivileged(
- new PrivilegedAction<Boolean>() {
- public Boolean run() {
- try {
- return FileSystems.getDefault().getPath(valueAsString)
- .getFileStore().supportsFileAttributeView("posix");
- } catch (IOException e) {
- throw new IOError(e);
- }
- }
- });
- }
}
/**
@@ -1869,12 +1854,11 @@ public class File
if (suffix == null)
suffix = ".tmp";
- File tmpdir = (directory != null) ?
- directory : TemporaryDirectory.valueAsFile;
+ File tmpdir = (directory != null) ? directory : TempDirectory.location();
SecurityManager sm = System.getSecurityManager();
File f;
do {
- f = TemporaryDirectory.generateFile(prefix, suffix, tmpdir);
+ f = TempDirectory.generateFile(prefix, suffix, tmpdir);
if (sm != null) {
try {
sm.checkWrite(f.getPath());
@@ -1891,10 +1875,16 @@ public class File
/**
* Creates an empty file in the default temporary-file directory, using
- * the given prefix and suffix to generate its name. Invoking this method
+ * the given prefix and suffix to generate its name. Invoking this method
* is equivalent to invoking <code>{@link #createTempFile(java.lang.String,
* java.lang.String, java.io.File)
* createTempFile(prefix, suffix, null)}</code>.
+ *
+ * <p> The {@link #createTemporaryFile(String,String,FileAttribute[])} method
+ * provides an alternative method to create an empty file in the
+ * temporary-file directory. Files created by that method may have more
+ * restrictive access permissions to files created by this method and so
+ * may be more suited to security-sensitive applications.
*
* @param prefix The prefix string to be used in generating the file's
* name; must be at least three characters long
@@ -1926,23 +1916,19 @@ public class File
/**
* Creates an empty file in the default temporary-file directory, using
- * the given prefix and suffix to generate its name. This method is
- * equivalent to invoking the {@link #createTempFile(String,String)
- * createTempFile(prefix, suffix)} method with the addition that the
- * resulting pathname may be requested to be deleted when the Java virtual
- * machine terminates, and the initial file attributes to set atomically
- * when creating the file may be specified.
- *
- * <p> When the value of the {@code deleteOnExit} method is {@code true}
- * then the resulting file is requested to be deleted when the Java virtual
- * machine terminates as if by invoking the {@link #deleteOnExit deleteOnExit}
- * method.
+ * the given prefix and suffix to generate its name.
*
* <p> The {@code attrs} parameter is an optional array of {@link FileAttribute
* attributes} to set atomically when creating the file. Each attribute is
* identified by its {@link FileAttribute#name name}. If more than one attribute
* of the same name is included in the array then all but the last occurrence
* is ignored.
+ *
+ * <p> Where the {@code attrs} parameter does not specify <i>access
+ * permissions</i> to set atomically when creating the file, then the
+ * resulting file may have more restrictive access permissions than files
+ * created by the {@link #createTempFile(java.lang.String, java.lang.String)}
+ * method.
*
* @param prefix
* The prefix string to be used in generating the file's
@@ -1951,9 +1937,6 @@ public class File
* The suffix string to be used in generating the file's
* name; may be {@code null}, in which case the suffix
* {@code ".tmp"} will be used
- * @param deleteOnExit
- * {@code true} if the file denoted by resulting pathname be
- * deleted when the Java virtual machine terminates
* @param attrs
* An optional list of file attributes to set atomically when creating
* the file
@@ -1961,7 +1944,7 @@ public class File
* @return An abstract pathname denoting a newly-created empty file
*
* @throws IllegalArgumentException
- * If the <code>prefix</code> argument contains fewer than three
+ * If the {@code prefix} argument contains fewer than three
* characters
* @throws UnsupportedOperationException
* If the array contains an attribute that cannot be set atomically
@@ -1971,74 +1954,19 @@ public class File
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
- * method does not allow a file to be created. When the {@code
- * deleteOnExit} parameter has the value {@code true} then the
- * security manager's {@link
- * java.lang.SecurityManager#checkDelete(java.lang.String)} is
- * invoked to check delete access to the file.
+ * method does not allow a file to be created.
+ *
* @since 1.7
*/
- public static File createTempFile(String prefix,
- String suffix,
- boolean deleteOnExit,
- FileAttribute<?>... attrs)
+ public static File createTemporaryFile(String prefix,
+ String suffix,
+ FileAttribute<?>... attrs)
throws IOException
{
if (prefix.length() < 3)
throw new IllegalArgumentException("Prefix string too short");
suffix = (suffix == null) ? ".tmp" : suffix;
-
- // special case POSIX environments so that 0600 is used as the file mode
- if (TemporaryDirectory.isPosix) {
- if (attrs.length == 0) {
- // no attributes so use default permissions
- attrs = new FileAttribute<?>[1];
- attrs[0] = TemporaryDirectory.defaultPosixFilePermissions;
- } else {
- // check if posix permissions given; if not use default
- boolean hasPermissions = false;
- for (int i=0; i<attrs.length; i++) {
- if (attrs[i].name().equals("posix:permissions")) {
- hasPermissions = true;
- break;
- }
- }
- if (!hasPermissions) {
- FileAttribute<?>[] copy = new FileAttribute<?>[attrs.length+1];
- System.arraycopy(attrs, 0, copy, 0, attrs.length);
- attrs = copy;
- attrs[attrs.length-1] =
- TemporaryDirectory.defaultPosixFilePermissions;
- }
- }
- }
-
- // use Path#createFile to create file
- SecurityManager sm = System.getSecurityManager();
- for (;;) {
- File f = TemporaryDirectory
- .generateFile(prefix, suffix, TemporaryDirectory.valueAsFile);
- if (sm != null && deleteOnExit)
- sm.checkDelete(f.getPath());
- try {
- f.toPath().createFile(attrs);
- if (deleteOnExit)
- DeleteOnExitHook.add(f.getPath());
- return f;
- } catch (InvalidPathException e) {
- // don't reveal temporary directory location
- if (sm != null)
- throw new IllegalArgumentException("Invalid prefix or suffix");
- throw e;
- } catch (SecurityException e) {
- // don't reveal temporary directory location
- if (sm != null)
- throw new SecurityException("Unable to create temporary file");
- throw e;
- } catch (FileAlreadyExistsException e) {
- // ignore
- }
- }
+ return TempFileHelper.createFile(prefix, suffix, attrs);
}
/* -- Basic infrastructure -- */
@@ -2153,40 +2081,45 @@ public class File
/**
* Returns a {@link Path java.nio.file.Path} object constructed from the
- * this abstract path. The first invocation of this method works as if
- * invoking it were equivalent to evaluating the expression:
+ * this abstract path. The resulting {@code Path} is associated with the
+ * {@link java.nio.file.FileSystems#getDefault default-filesystem}.
+ *
+ * <p> The first invocation of this method works as if invoking it were
+ * equivalent to evaluating the expression:
* <blockquote><pre>
- * {@link FileSystems#getDefault FileSystems.getDefault}().{@link FileSystem#getPath getPath}(this.{@link #getPath getPath}());
+ * {@link java.nio.file.FileSystems#getDefault FileSystems.getDefault}().{@link
+ * java.nio.file.FileSystem#getPath getPath}(this.{@link #getPath getPath}());
* </pre></blockquote>
* Subsequent invocations of this method return the same {@code Path}.
*
* <p> If this abstract pathname is the empty abstract pathname then this
- * method returns a {@code Path} that may be used to access to the current
+ * method returns a {@code Path} that may be used to access the current
* user directory.
*
- * @return A {@code Path} constructed from this abstract path. The resulting
- * {@code Path} is associated with the {@link FileSystems#getDefault
- * default-filesystem}.
+ * @return a {@code Path} constructed from this abstract path
*
* @throws InvalidPathException
- * If a {@code Path} object cannot be constructed from the abstract
+ * if a {@code Path} object cannot be constructed from the abstract
* path (see {@link java.nio.file.FileSystem#getPath FileSystem.getPath})
*
* @since 1.7
*/
public Path toPath() {
- if (filePath == null) {
+ Path result = filePath;
+ if (result == null) {
synchronized (this) {
- if (filePath == null) {
+ result = filePath;
+ if (result == null) {
if (path.length() == 0) {
// assume default file system treats "." as current directory
- filePath = Paths.get(".");
+ result = Paths.get(".");
} else {
- filePath = Paths.get(path);
+ result = Paths.get(path);
}
+ filePath = result;
}
}
}
- return filePath;
+ return result;
}
}
--- a/src/share/classes/java/lang/ClassLoader.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/lang/ClassLoader.java Thu Jul 23 11:29:49 2009 -0700
@@ -58,6 +58,7 @@ import sun.misc.VM;
import sun.misc.VM;
import sun.reflect.Reflection;
import sun.security.util.SecurityConstants;
+import sun.jkernel.DownloadManager;
/**
* A class loader is an object that is responsible for loading classes. The
@@ -1280,6 +1281,21 @@ public abstract class ClassLoader {
* Find resources from the VM's built-in classloader.
*/
private static URL getBootstrapResource(String name) {
+ try {
+ // If this is a known JRE resource, ensure that its bundle is
+ // downloaded. If it isn't known, we just ignore the download
+ // failure and check to see if we can find the resource anyway
+ // (which is possible if the boot class path has been modified).
+ if (sun.misc.VM.isBootedKernelVM()) {
+ sun.jkernel.DownloadManager.getBootClassPathEntryForResource(
+ name);
+ }
+ } catch (NoClassDefFoundError e) {
+ // This happens while Java itself is being compiled; DownloadManager
+ // isn't accessible when this code is first invoked. It isn't an
+ // issue, as if we can't find DownloadManager, we can safely assume
+ // that additional code is not available for download.
+ }
URLClassPath ucp = getBootstrapClassPath();
Resource res = ucp.getResource(name);
return res != null ? res.getURL() : null;
@@ -1305,13 +1321,9 @@ public abstract class ClassLoader {
// Returns the URLClassPath that is used for finding system resources.
static URLClassPath getBootstrapClassPath() {
- if (bootstrapClassPath == null) {
- bootstrapClassPath = sun.misc.Launcher.getBootstrapClassPath();
- }
- return bootstrapClassPath;
- }
-
- private static URLClassPath bootstrapClassPath;
+ return sun.misc.Launcher.getBootstrapClassPath();
+ }
+
/**
* Returns an input stream for reading the specified resource.
@@ -1800,6 +1812,24 @@ public abstract class ClassLoader {
// Invoked in the java.lang.Runtime class to implement load and loadLibrary.
static void loadLibrary(Class fromClass, String name,
boolean isAbsolute) {
+ try {
+ if (VM.isBootedKernelVM() && !DownloadManager.isJREComplete() &&
+ !DownloadManager.isCurrentThreadDownloading()) {
+ DownloadManager.downloadFile("bin/" +
+ System.mapLibraryName(name));
+ // it doesn't matter if the downloadFile call returns false --
+ // it probably just means that this is a user library, as
+ // opposed to a JRE library
+ }
+ } catch (IOException e) {
+ throw new UnsatisfiedLinkError("Error downloading library " +
+ name + ": " + e);
+ } catch (NoClassDefFoundError e) {
+ // This happens while Java itself is being compiled; DownloadManager
+ // isn't accessible when this code is first invoked. It isn't an
+ // issue, as if we can't find DownloadManager, we can safely assume
+ // that additional code is not available for download.
+ }
ClassLoader loader =
(fromClass == null) ? null : fromClass.getClassLoader();
if (sys_paths == null) {
--- a/src/share/classes/java/lang/System.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/lang/System.java Thu Jul 23 11:29:49 2009 -0700
@@ -1106,11 +1106,21 @@ public final class System {
initProperties(props);
sun.misc.Version.init();
+ // Workaround until DownloadManager initialization is revisited.
+ // Make JavaLangAccess available early enough for internal
+ // Shutdown hooks to be registered
+ setJavaLangAccess();
+
// Gets and removes system properties that configure the Integer
// cache used to support the object identity semantics of autoboxing.
// At this time, the size of the cache may be controlled by the
- // -XX:AutoBoxCacheMax=<size> option.
+ // vm option -XX:AutoBoxCacheMax=<size>.
Integer.getAndRemoveCacheProperties();
+
+ // Load the zip library now in order to keep java.util.zip.ZipFile
+ // from trying to use itself to load this library later.
+ loadLibrary("zip");
+
FileInputStream fdIn = new FileInputStream(FileDescriptor.in);
FileOutputStream fdOut = new FileOutputStream(FileDescriptor.out);
@@ -1119,10 +1129,6 @@ public final class System {
setOut0(new PrintStream(new BufferedOutputStream(fdOut, 128), true));
setErr0(new PrintStream(new BufferedOutputStream(fdErr, 128), true));
- // Load the zip library now in order to keep java.util.zip.ZipFile
- // from trying to use itself to load this library later.
- loadLibrary("zip");
-
// Setup Java signal handlers for HUP, TERM, and INT (where available).
Terminator.setup();
@@ -1152,7 +1158,9 @@ public final class System {
// way as other threads; we must do it ourselves here.
Thread current = Thread.currentThread();
current.getThreadGroup().add(current);
-
+ }
+
+ private static void setJavaLangAccess() {
// Allow privileged classes outside of java.lang
sun.misc.SharedSecrets.setJavaLangAccess(new sun.misc.JavaLangAccess(){
public sun.reflect.ConstantPool getConstantPool(Class klass) {
--- a/src/share/classes/java/lang/annotation/ElementType.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/lang/annotation/ElementType.java Thu Jul 23 11:29:49 2009 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-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
@@ -40,6 +40,12 @@ public enum ElementType {
/** Class, interface (including annotation type), or enum declaration */
TYPE,
+ /** Uses of a type */
+ TYPE_USE,
+
+ /** type parameters */
+ TYPE_PARAMETER,
+
/** Field declaration (includes enum constants) */
FIELD,
--- a/src/share/classes/java/lang/management/PlatformComponent.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/lang/management/PlatformComponent.java Thu Jul 23 11:29:49 2009 -0700
@@ -34,7 +34,6 @@ import java.util.logging.LogManager;
import java.util.logging.LogManager;
import java.nio.BufferPoolMXBean;
import javax.management.MBeanServerConnection;
-import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import com.sun.management.HotSpotDiagnosticMXBean;
@@ -198,10 +197,7 @@ enum PlatformComponent {
"java.nio", "BufferPool", keyProperties("name"),
new MXBeanFetcher<BufferPoolMXBean>() {
public List<BufferPoolMXBean> getMXBeans() {
- List<BufferPoolMXBean> pools = new ArrayList<BufferPoolMXBean>(2);
- pools.add( sun.misc.SharedSecrets.getJavaNioAccess().getDirectBufferPoolMXBean() );
- pools.add( sun.nio.ch.FileChannelImpl.getMappedBufferPoolMXBean() );
- return pools;
+ return ManagementFactoryHelper.getBufferPoolMXBeans();
}
}),
--- a/src/share/classes/java/math/BigDecimal.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/math/BigDecimal.java Thu Jul 23 11:29:49 2009 -0700
@@ -1101,7 +1101,7 @@ public class BigDecimal extends Number i
// See "Hacker's Delight" section 2-12 for explanation of
// the overflow test.
if ( (((sum ^ xs) & (sum ^ ys))) >= 0L) // not overflowed
- return new BigDecimal(null, sum, rscale, 0);
+ return BigDecimal.valueOf(sum, rscale);
}
if (fst == null)
fst = BigInteger.valueOf(xs);
@@ -1311,9 +1311,9 @@ public class BigDecimal extends Number i
* would occur since division is expensive on most CPUs.
*/
long product = x * y;
- int prec = this.precision() + multiplicand.precision();
+ long prec = this.precision() + multiplicand.precision();
if (prec < 19 || (prec < 21 && (y == 0 || product / y == x)))
- return new BigDecimal(null, product, productScale, 0);
+ return BigDecimal.valueOf(product, productScale);
return new BigDecimal(BigInteger.valueOf(x).multiply(y), INFLATED,
productScale, 0);
}
@@ -1584,7 +1584,7 @@ public class BigDecimal extends Number i
return (preferredScale >= 0 &&
preferredScale < ZERO_SCALED_BY.length) ?
ZERO_SCALED_BY[preferredScale] :
- new BigDecimal(null, 0, preferredScale, 1);
+ BigDecimal.valueOf(0, preferredScale);
else {
this.inflate();
divisor.inflate();
--- a/src/share/classes/java/net/SocksSocketImpl.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/net/SocksSocketImpl.java Thu Jul 23 11:29:49 2009 -0700
@@ -29,7 +29,6 @@ import java.io.BufferedOutputStream;
import java.io.BufferedOutputStream;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
-import java.util.prefs.Preferences;
import sun.net.www.ParseUtil;
/* import org.ietf.jgss.*; */
@@ -41,7 +40,7 @@ import sun.net.www.ParseUtil;
class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
private String server = null;
- private int port = DEFAULT_PORT;
+ private int serverPort = DEFAULT_PORT;
private InetSocketAddress external_address;
private boolean useV4 = false;
private Socket cmdsock = null;
@@ -54,7 +53,7 @@ class SocksSocketImpl extends PlainSocke
SocksSocketImpl(String server, int port) {
this.server = server;
- this.port = (port == -1 ? DEFAULT_PORT : port);
+ this.serverPort = (port == -1 ? DEFAULT_PORT : port);
}
SocksSocketImpl(Proxy proxy) {
@@ -63,7 +62,7 @@ class SocksSocketImpl extends PlainSocke
InetSocketAddress ad = (InetSocketAddress) a;
// Use getHostString() to avoid reverse lookups
server = ad.getHostString();
- port = ad.getPort();
+ serverPort = ad.getPort();
}
}
@@ -113,16 +112,12 @@ class SocksSocketImpl extends PlainSocke
*/
private boolean authenticate(byte method, InputStream in,
BufferedOutputStream out) throws IOException {
- byte[] data = null;
- int i;
// No Authentication required. We're done then!
if (method == NO_AUTH)
return true;
/**
* User/Password authentication. Try, in that order :
* - The application provided Authenticator, if any
- * - The user preferences java.net.socks.username &
- * java.net.socks.password
* - the user.name & no password (backward compatibility behavior).
*/
if (method == USER_PASSW) {
@@ -134,40 +129,15 @@ class SocksSocketImpl extends PlainSocke
new java.security.PrivilegedAction<PasswordAuthentication>() {
public PasswordAuthentication run() {
return Authenticator.requestPasswordAuthentication(
- server, addr, port, "SOCKS5", "SOCKS authentication", null);
+ server, addr, serverPort, "SOCKS5", "SOCKS authentication", null);
}
});
if (pw != null) {
userName = pw.getUserName();
password = new String(pw.getPassword());
} else {
- final Preferences prefs = Preferences.userRoot().node("/java/net/socks");
- try {
- userName = AccessController.doPrivileged(
- new java.security.PrivilegedExceptionAction<String>() {
- public String run() throws IOException {
- return prefs.get("username", null);
- }
- });
- } catch (java.security.PrivilegedActionException pae) {
- throw (IOException) pae.getException();
- }
-
- if (userName != null) {
- try {
- password = AccessController.doPrivileged(
- new java.security.PrivilegedExceptionAction<String>() {
- public String run() throws IOException {
- return prefs.get("password", null);
- }
- });
- } catch (java.security.PrivilegedActionException pae) {
- throw (IOException) pae.getException();
- }
- } else {
- userName = java.security.AccessController.doPrivileged(
+ userName = java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("user.name"));
- }
}
if (userName == null)
return false;
@@ -188,8 +158,8 @@ class SocksSocketImpl extends PlainSocke
} else
out.write(0);
out.flush();
- data = new byte[2];
- i = readSocksReply(in, data);
+ byte[] data = new byte[2];
+ int i = readSocksReply(in, data);
if (i != 2 || data[1] != 0) {
/* RFC 1929 specifies that the connection MUST be closed if
authentication fails */
@@ -322,6 +292,7 @@ class SocksSocketImpl extends PlainSocke
* @throws IllegalArgumentException if endpoint is null or a
* SocketAddress subclass not supported by this socket
*/
+ @Override
protected void connect(SocketAddress endpoint, int timeout) throws IOException {
SecurityManager security = System.getSecurityManager();
if (endpoint == null || !(endpoint instanceof InetSocketAddress))
@@ -352,7 +323,7 @@ class SocksSocketImpl extends PlainSocke
super.connect(epoint, timeout);
return;
}
- URI uri = null;
+ URI uri;
// Use getHostString() to avoid reverse lookups
String host = epoint.getHostString();
// IPv6 litteral?
@@ -365,6 +336,7 @@ class SocksSocketImpl extends PlainSocke
} catch (URISyntaxException e) {
// This shouldn't happen
assert false : e;
+ uri = null;
}
Proxy p = null;
IOException savedExc = null;
@@ -386,18 +358,18 @@ class SocksSocketImpl extends PlainSocke
throw new SocketException("Unknow address type for proxy: " + p);
// Use getHostString() to avoid reverse lookups
server = ((InetSocketAddress) p.address()).getHostString();
- port = ((InetSocketAddress) p.address()).getPort();
+ serverPort = ((InetSocketAddress) p.address()).getPort();
// Connects to the SOCKS server
try {
- privilegedConnect(server, port, timeout);
+ privilegedConnect(server, serverPort, timeout);
// Worked, let's get outta here
break;
} catch (IOException e) {
// Ooops, let's notify the ProxySelector
sel.connectFailed(uri,p.address(),e);
server = null;
- port = -1;
+ serverPort = -1;
savedExc = e;
// Will continue the while loop and try the next proxy
}
@@ -414,7 +386,7 @@ class SocksSocketImpl extends PlainSocke
} else {
// Connects to the SOCKS server
try {
- privilegedConnect(server, port, timeout);
+ privilegedConnect(server, serverPort, timeout);
} catch (IOException e) {
throw new SocketException(e.getMessage());
}
@@ -487,7 +459,7 @@ class SocksSocketImpl extends PlainSocke
if (i != 4)
throw new SocketException("Reply from SOCKS server has bad length");
SocketException ex = null;
- int nport, len;
+ int len;
byte[] addr;
switch (data[1]) {
case REQUEST_OK:
@@ -502,8 +474,6 @@ class SocksSocketImpl extends PlainSocke
i = readSocksReply(in, data);
if (i != 2)
throw new SocketException("Reply from SOCKS server badly formatted");
- nport = ((int)data[0] & 0xff) << 8;
- nport += ((int)data[1] & 0xff);
break;
case DOMAIN_NAME:
len = data[1];
@@ -515,8 +485,6 @@ class SocksSocketImpl extends PlainSocke
i = readSocksReply(in, data);
if (i != 2)
throw new SocketException("Reply from SOCKS server badly formatted");
- nport = ((int)data[0] & 0xff) << 8;
- nport += ((int)data[1] & 0xff);
break;
case IPV6:
len = data[1];
@@ -528,8 +496,6 @@ class SocksSocketImpl extends PlainSocke
i = readSocksReply(in, data);
if (i != 2)
throw new SocketException("Reply from SOCKS server badly formatted");
- nport = ((int)data[0] & 0xff) << 8;
- nport += ((int)data[1] & 0xff);
break;
default:
ex = new SocketException("Reply from SOCKS server contains wrong code");
@@ -663,7 +629,7 @@ class SocksSocketImpl extends PlainSocke
*/
return;
}
- URI uri = null;
+ URI uri;
// Use getHostString() to avoid reverse lookups
String host = saddr.getHostString();
// IPv6 litteral?
@@ -676,6 +642,7 @@ class SocksSocketImpl extends PlainSocke
} catch (URISyntaxException e) {
// This shouldn't happen
assert false : e;
+ uri = null;
}
Proxy p = null;
Exception savedExc = null;
@@ -695,7 +662,7 @@ class SocksSocketImpl extends PlainSocke
throw new SocketException("Unknow address type for proxy: " + p);
// Use getHostString() to avoid reverse lookups
server = ((InetSocketAddress) p.address()).getHostString();
- port = ((InetSocketAddress) p.address()).getPort();
+ serverPort = ((InetSocketAddress) p.address()).getPort();
// Connects to the SOCKS server
try {
@@ -703,7 +670,7 @@ class SocksSocketImpl extends PlainSocke
new PrivilegedExceptionAction<Void>() {
public Void run() throws Exception {
cmdsock = new Socket(new PlainSocketImpl());
- cmdsock.connect(new InetSocketAddress(server, port));
+ cmdsock.connect(new InetSocketAddress(server, serverPort));
cmdIn = cmdsock.getInputStream();
cmdOut = cmdsock.getOutputStream();
return null;
@@ -713,7 +680,7 @@ class SocksSocketImpl extends PlainSocke
// Ooops, let's notify the ProxySelector
sel.connectFailed(uri,p.address(),new SocketException(e.getMessage()));
server = null;
- port = -1;
+ serverPort = -1;
cmdsock = null;
savedExc = e;
// Will continue the while loop and try the next proxy
@@ -734,7 +701,7 @@ class SocksSocketImpl extends PlainSocke
new PrivilegedExceptionAction<Void>() {
public Void run() throws Exception {
cmdsock = new Socket(new PlainSocketImpl());
- cmdsock.connect(new InetSocketAddress(server, port));
+ cmdsock.connect(new InetSocketAddress(server, serverPort));
cmdIn = cmdsock.getInputStream();
cmdOut = cmdsock.getOutputStream();
return null;
@@ -809,7 +776,6 @@ class SocksSocketImpl extends PlainSocke
switch (data[1]) {
case REQUEST_OK:
// success!
- InetSocketAddress real_end = null;
switch(data[3]) {
case IPV4:
addr = new byte[4];
@@ -1016,6 +982,7 @@ class SocksSocketImpl extends PlainSocke
* @return the value of this socket's <code>address</code> field.
* @see java.net.SocketImpl#address
*/
+ @Override
protected InetAddress getInetAddress() {
if (external_address != null)
return external_address.getAddress();
@@ -1029,6 +996,7 @@ class SocksSocketImpl extends PlainSocke
* @return the value of this socket's <code>port</code> field.
* @see java.net.SocketImpl#port
*/
+ @Override
protected int getPort() {
if (external_address != null)
return external_address.getPort();
@@ -1036,6 +1004,7 @@ class SocksSocketImpl extends PlainSocke
return super.getPort();
}
+ @Override
protected int getLocalPort() {
if (socket != null)
return super.getLocalPort();
@@ -1045,6 +1014,7 @@ class SocksSocketImpl extends PlainSocke
return super.getLocalPort();
}
+ @Override
protected void close() throws IOException {
if (cmdsock != null)
cmdsock.close();
--- a/src/share/classes/java/nio/Bits.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/Bits.java Thu Jul 23 11:29:49 2009 -0700
@@ -26,11 +26,8 @@ package java.nio;
package java.nio;
import java.security.AccessController;
-import java.security.PrivilegedAction;
import sun.misc.Unsafe;
import sun.misc.VM;
-import javax.management.ObjectName;
-import javax.management.MalformedObjectNameException;
/**
* Access to bits, native and otherwise.
@@ -676,55 +673,34 @@ class Bits {
}
}
- // -- Management interface for monitoring of direct buffer usage --
+ // -- Monitoring of direct buffer usage --
static {
// setup access to this package in SharedSecrets
sun.misc.SharedSecrets.setJavaNioAccess(
new sun.misc.JavaNioAccess() {
@Override
- public BufferPoolMXBean getDirectBufferPoolMXBean() {
- return LazyInitialization.directBufferPoolMXBean;
+ public sun.misc.JavaNioAccess.BufferPool getDirectBufferPool() {
+ return new sun.misc.JavaNioAccess.BufferPool() {
+ @Override
+ public String getName() {
+ return "direct";
+ }
+ @Override
+ public long getCount() {
+ return Bits.count;
+ }
+ @Override
+ public long getTotalCapacity() {
+ return Bits.usedMemory;
+ }
+ @Override
+ public long getMemoryUsed() {
+ return Bits.reservedMemory;
+ }
+ };
}
- }
- );
- }
-
- // Lazy initialization of management interface
- private static class LazyInitialization {
- static final BufferPoolMXBean directBufferPoolMXBean = directBufferPoolMXBean();
-
- private static BufferPoolMXBean directBufferPoolMXBean() {
- final String pool = "direct";
- final ObjectName obj;
- try {
- obj = new ObjectName("java.nio:type=BufferPool,name=" + pool);
- } catch (MalformedObjectNameException x) {
- throw new AssertionError(x);
- }
- return new BufferPoolMXBean() {
- @Override
- public ObjectName getObjectName() {
- return obj;
- }
- @Override
- public String getName() {
- return pool;
- }
- @Override
- public long getCount() {
- return Bits.count;
- }
- @Override
- public long getTotalCapacity() {
- return Bits.usedMemory;
- }
- @Override
- public long getMemoryUsed() {
- return Bits.reservedMemory;
- }
- };
- }
+ });
}
// -- Bulk get/put acceleration --
--- a/src/share/classes/java/nio/Direct-X-Buffer.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/Direct-X-Buffer.java Thu Jul 23 11:29:49 2009 -0700
@@ -30,7 +30,6 @@ import sun.misc.Cleaner;
import sun.misc.Cleaner;
import sun.misc.Unsafe;
import sun.nio.ch.DirectBuffer;
-import sun.nio.ch.FileChannelImpl;
class Direct$Type$Buffer$RW$$BO$
--- a/src/share/classes/java/nio/channels/SeekableByteChannel.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/channels/SeekableByteChannel.java Thu Jul 23 11:29:49 2009 -0700
@@ -47,7 +47,7 @@ import java.io.IOException;
* so that method invocations on the implementation class can be chained.
*
* @since 1.7
- * @see java.nio.file.FileRef#newByteChannel
+ * @see java.nio.file.Path#newByteChannel
*/
public interface SeekableByteChannel
--- a/src/share/classes/java/nio/file/AccessMode.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/AccessMode.java Thu Jul 23 11:29:49 2009 -0700
@@ -30,7 +30,7 @@ package java.nio.file;
*
* @since 1.7
*
- * @see FileRef#checkAccess
+ * @see Path#checkAccess
*/
public enum AccessMode {
--- a/src/share/classes/java/nio/file/DirectoryStream.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/DirectoryStream.java Thu Jul 23 11:29:49 2009 -0700
@@ -27,6 +27,7 @@ package java.nio.file;
import java.util.Iterator;
import java.io.Closeable;
+import java.io.IOException;
/**
* An object to iterate over the entries in a directory. A directory stream
@@ -50,13 +51,10 @@ import java.io.Closeable;
*
* <p> A {@code DirectoryStream} is opened upon creation and is closed by
* invoking the {@link #close close} method. Closing the directory stream
- * releases any resources associated with the stream. The {@link
- * Files#withDirectory Files.withDirectory} utility method is useful for cases
- * where a task is performed on entries in a directory. This method automatically
- * closes the directory stream when iteration is complete (or an error occurs).
- * Once a directory stream is closed, all further method invocations on the
- * iterator throw {@link java.util.concurrent.ConcurrentModificationException}
- * with cause {@link ClosedDirectoryStreamException}.
+ * releases any resources associated with the stream. Once a directory stream
+ * is closed, all further method invocations on the iterator throw {@link
+ * java.util.concurrent.ConcurrentModificationException} with cause {@link
+ * ClosedDirectoryStreamException}.
*
* <p> A directory stream is not required to be <i>asynchronously closeable</i>.
* If a thread is blocked on the directory stream's iterator reading from the
@@ -79,7 +77,7 @@ import java.io.Closeable;
*
* <p> The iterator's {@link Iterator#remove() remove} method removes the
* directory entry for the last element returned by the iterator, as if by
- * invoking the {@link FileRef#delete delete} method. If an I/O error or
+ * invoking the {@link Path#delete delete} method. If an I/O error or
* security exception occurs then {@code ConcurrentModificationException} is
* thrown with the cause.
*
@@ -104,10 +102,6 @@ public interface DirectoryStream<T>
* newDirectoryStream} method when opening a directory to iterate over the
* entries in the directory.
*
- * <p> The {@link DirectoryStreamFilters} class defines factory methods to
- * create filters for a number of common usages and also methods to combine
- * filters.
- *
* @param <T> the type of the directory entry
*
* @since 1.7
@@ -120,8 +114,11 @@ public interface DirectoryStream<T>
* the directory entry to be tested
*
* @return {@code true} if the directory entry should be accepted
+ *
+ * @throws IOException
+ * If an I/O error occurs
*/
- boolean accept(T entry);
+ boolean accept(T entry) throws IOException;
}
/**
--- a/src/share/classes/java/nio/file/FileRef.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/FileRef.java Thu Jul 23 11:29:49 2009 -0700
@@ -26,225 +26,85 @@ package java.nio.file;
package java.nio.file;
import java.nio.file.attribute.*;
-import java.nio.channels.SeekableByteChannel;
+import java.util.Map;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.io.IOException;
/**
* A reference to a file.
*
* <p> A {@code FileRef} is an object that locates a file and defines methods to
- * access the file. The means by which the file is located depends on the
- * implementation. In many cases, a file is located by a {@link Path} but it may
- * be located by other means such as a file-system identifier.
- *
- * <p> This interface defines the following operations:
- * <ul>
- * <li><p> The {@link #newByteChannel newByteChannel} method
- * may be used to open a file and obtain a byte channel for reading or
- * writing. </p></li>
- * <li><p> The {@link #delete delete} method may be used to delete a file.
- * </p></li>
- * <li><p> The {@link #checkAccess checkAccess} method may be used to check
- * the existence or accessibility of a file. </p></li>
- * <li><p> The {@link #isSameFile isSameFile} method may be used to test if
- * two file references locate the same file. </p></li>
- * <li><p> The {@link #getFileStore getFileStore} method may be used to
- * obtain the {@link FileStore} representing the storage where a file is
- * located. </p></li>
- * </ul>
- *
- * <p> Access to associated metadata or file attributes requires an appropriate
- * {@link FileAttributeView FileAttributeView}. The {@link
- * #getFileAttributeView(Class,LinkOption[]) getFileAttributeView(Class,LinkOption[])}
- * method may be used to obtain a file attribute view that defines type-safe
- * methods to read or update file attributes. The {@link
- * #getFileAttributeView(String,LinkOption[]) getFileAttributeView(String,LinkOption[])}
- * method may be used to obtain a file attribute view where dynamic access to
- * file attributes where required.
- *
- * <p> A {@code FileRef} is immutable and safe for use by multiple concurrent
- * threads.
+ * open the file for reading or writing. It also provides access to associated
+ * metadata or file attributes.
*
* @since 1.7
+ * @see java.io.Inputs
+ * @see java.io.Outputs
+ * @see java.nio.file.attribute.Attributes
+ * @see java.io.File#toPath
*/
public interface FileRef {
/**
- * Opens the file referenced by this object, returning a seekable byte
- * channel to access the file.
+ * Opens the file referenced by this object, returning an input stream to
+ * read from the file. The stream will not be buffered, and is not required
+ * to support the {@link InputStream#mark mark} or {@link InputStream#reset
+ * reset} methods. The stream will be safe for access by multiple concurrent
+ * threads. Reading commences at the beginning of the file.
*
* <p> The {@code options} parameter determines how the file is opened.
- * The {@link StandardOpenOption#READ READ} and {@link StandardOpenOption#WRITE
- * WRITE} options determine if the file should be opened for reading and/or
- * writing. If neither option (or the {@link StandardOpenOption#APPEND APPEND}
- * option) is contained in the array then the file is opened for reading.
- * By default reading or writing commences at the beginning of the file.
- *
- * <p> In the addition to {@code READ} and {@code WRITE}, the following
- * options may be present:
- *
- * <table border=1 cellpadding=5 summary="">
- * <tr> <th>Option</th> <th>Description</th> </tr>
- * <tr>
- * <td> {@link StandardOpenOption#APPEND APPEND} </td>
- * <td> If this option is present then the file is opened for writing and
- * each invocation of the channel's {@code write} method first advances
- * the position to the end of the file and then writes the requested
- * data. Whether the advancement of the position and the writing of the
- * data are done in a single atomic operation is system-dependent and
- * therefore unspecified. This option may not be used in conjunction
- * with the {@code READ} or {@code TRUNCATE_EXISTING} options. </td>
- * </tr>
- * <tr>
- * <td> {@link StandardOpenOption#TRUNCATE_EXISTING TRUNCATE_EXISTING} </td>
- * <td> If this option is present then the existing file is truncated to
- * a size of 0 bytes. This option is ignored when the file is opened only
- * for reading. </td>
- * </tr>
- * <tr>
- * <td> {@link StandardOpenOption#SYNC SYNC} </td>
- * <td> Requires that every update to the file's content or metadata be
- * written synchronously to the underlying storage device. (see <a
- * href="package-summary.html#integrity"> Synchronized I/O file
- * integrity</a>). </td>
- * </tr>
- * <tr>
- * <td> {@link StandardOpenOption#DSYNC DSYNC} </td>
- * <td> Requires that every update to the file's content be written
- * synchronously to the underlying storage device. (see <a
- * href="package-summary.html#integrity"> Synchronized I/O file
- * integrity</a>). </td>
- * </tr>
- * </table>
- *
- * <p> An implementation of this interface may support additional options
- * defined by the {@link StandardOpenOption} enumeration type or other
+ * If no options are present then it is equivalent to opening the file with
+ * the {@link StandardOpenOption#READ READ} option. In addition to the {@code
+ * READ} option, an implementation may also support additional implementation
+ * specific options.
+ *
+ * @return an input stream to read bytes from the file
+ *
+ * @throws IllegalArgumentException
+ * if an invalid combination of options is specified
+ * @throws UnsupportedOperationException
+ * if an unsupported option is specified
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws SecurityException
+ * In the case of the default provider, and a security manager is
+ * installed, the {@link SecurityManager#checkRead(String) checkRead}
+ * method is invoked to check read access to the file.
+ */
+ InputStream newInputStream(OpenOption... options) throws IOException;
+
+ /**
+ * Opens or creates the file located by this object for writing, returning
+ * an output stream to write bytes to the file.
+ *
+ * <p> The {@code options} parameter determines how the file is opened.
+ * If no options are present then this method creates a new file for writing
+ * or truncates an existing file. In addition to the {@link StandardOpenOption
+ * standard} options, an implementation may also support additional
* implementation specific options.
*
- * <p> The {@link java.nio.channels.Channels} utility classes defines methods
- * to construct input and output streams where inter-operation with the
- * {@link java.io} package is required.
- *
- * @param options
- * Options specifying how the file is opened
- *
- * @return a new seekable byte channel
+ * <p> The resulting stream will not be buffered. The stream will be safe
+ * for access by multiple concurrent threads.
+ *
+ * @param options
+ * options specifying how the file is opened
+ *
+ * @return a new output stream
*
* @throws IllegalArgumentException
- * If an invalid combination of options is specified
- * @throws UnsupportedOperationException
- * If an unsupported open option is specified
- * @throws IOException
- * If an I/O error occurs
- * @throws SecurityException
- * In the case of the default provider, and a security manager is
- * installed, the {@link SecurityManager#checkRead(String) checkRead}
- * method is invoked to check read access to the path if the file is
- * opened for reading. The {@link SecurityManager#checkWrite(String)
- * checkWrite} method is invoked to check write access to the path
- * if the file is opened for writing.
- */
- SeekableByteChannel newByteChannel(OpenOption... options)
- throws IOException;
-
- /**
- * Returns the {@link FileStore} representing the file store where the file
- * referenced by this object is stored.
- *
- * <p> Once a reference to the {@code FileStore} is obtained it is
- * implementation specific if operations on the returned {@code FileStore},
- * or {@link FileStoreAttributeView} objects obtained from it, continue
- * to depend on the existence of the file. In particular the behavior is not
- * defined for the case that the file is deleted or moved to a different
- * file store.
- *
- * @return The file store where the file is stored
- *
- * @throws IOException
- * If an I/O error occurs
- * @throws SecurityException
- * In the case of the default provider, and a security manager is
- * installed, the {@link SecurityManager#checkRead(String) checkRead}
- * method is invoked to check read access to the file, and in
- * addition it checks {@link RuntimePermission}<tt>
- * ("getFileStoreAttributes")</tt>
- */
- FileStore getFileStore() throws IOException;
-
- /**
- * Checks the existence and optionally the accessibility of the file
- * referenced by this object.
- *
- * <p> This method checks the existence of a file and that this Java virtual
- * machine has appropriate privileges that would allow it access the file
- * according to all of access modes specified in the {@code modes} parameter
- * as follows:
- *
- * <table border=1 cellpadding=5 summary="">
- * <tr> <th>Value</th> <th>Description</th> </tr>
- * <tr>
- * <td> {@link AccessMode#READ READ} </td>
- * <td> Checks that the file exists and that the Java virtual machine has
- * permission to read the file. </td>
- * </tr>
- * <tr>
- * <td> {@link AccessMode#WRITE WRITE} </td>
- * <td> Checks that the file exists and that the Java virtual machine has
- * permission to write to the file, </td>
- * </tr>
- * <tr>
- * <td> {@link AccessMode#EXECUTE EXECUTE} </td>
- * <td> Checks that the file exists and that the Java virtual machine has
- * permission to {@link Runtime#exec execute} the file. The semantics
- * may differ when checking access to a directory. For example, on UNIX
- * systems, checking for {@code EXECUTE} access checks that the Java
- * virtual machine has permission to search the directory in order to
- * access file or subdirectories. </td>
- * </tr>
- * </table>
- *
- * <p> If the {@code modes} parameter is of length zero, then the existence
- * of the file is checked.
- *
- * <p> This method follows symbolic links if the file referenced by this
- * object is a symbolic link. Depending on the implementation, this method
- * may require to read file permissions, access control lists, or other
- * file attributes in order to check the effective access to the file. To
- * determine the effective access to a file may require access to several
- * attributes and so in some implementations this method may not be atomic
- * with respect to other file system operations. Furthermore, as the result
- * of this method is immediately outdated, there is no guarantee that a
- * subsequence access will succeed (or even that it will access the same
- * file). Care should be taken when using this method in security sensitive
- * applications.
- *
- * @param modes
- * The access modes to check; may have zero elements
- *
- * @throws UnsupportedOperationException
- * An implementation is required to support checking for
- * {@code READ}, {@code WRITE}, and {@code EXECUTE} access. This
- * exception is specified to allow for the {@code Access} enum to
- * be extended in future releases.
- * @throws NoSuchFileException
- * If a file does not exist <i>(optional specific exception)</i>
- * @throws AccessDeniedException
- * The requested access would be denied or the access cannot be
- * determined because the Java virtual machine has insufficient
- * privileges or other reasons. <i>(optional specific exception)</i>
- * @throws IOException
- * If an I/O error occurs
- * @throws SecurityException
- * In the case of the default provider, and a security manager is
- * installed, the {@link SecurityManager#checkRead(String) checkRead}
- * is invoked when checking read access to the file or only the
- * existence of the file, the {@link SecurityManager#checkWrite(String)
- * checkWrite} is invoked when checking write access to the file,
- * and {@link SecurityManager#checkExec(String) checkExec} is invoked
- * when checking execute access.
- */
- void checkAccess(AccessMode... modes) throws IOException;
+ * if {@code options} contains an invalid combination of options
+ * @throws UnsupportedOperationException
+ * if an unsupported option is specified
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws SecurityException
+ * In the case of the default provider, and a security manager is
+ * installed, the {@link SecurityManager#checkWrite(String) checkWrite}
+ * method is invoked to check write access to the file.
+ */
+ OutputStream newOutputStream(OpenOption... options) throws IOException;
/**
* Returns a file attribute view of a given type.
@@ -266,11 +126,11 @@ public interface FileRef {
* that do not support symbolic links.
*
* @param type
- * The {@code Class} object corresponding to the file attribute view
- * @param options
- * Options indicating how symbolic links are handled
- *
- * @return A file attribute view of the specified type, or {@code null} if
+ * the {@code Class} object corresponding to the file attribute view
+ * @param options
+ * options indicating how symbolic links are handled
+ *
+ * @return a file attribute view of the specified type, or {@code null} if
* the attribute view type is not available
*
* @throws UnsupportedOperationException
@@ -280,145 +140,185 @@ public interface FileRef {
*
* @see Attributes#readBasicFileAttributes
*/
- <V extends FileAttributeView> V getFileAttributeView(Class<V> type, LinkOption... options);
-
- /**
- * Returns a file attribute view of the given name.
- *
- * <p> A file attribute view provides a read-only or updatable view of a
- * set of file attributes. This method is intended to be used where
- * <em>dynamic access</em> to the file attributes is required. The {@code
- * name} parameter specifies the {@link FileAttributeView#name name} of the
- * file attribute view and this method returns an instance of that view if
- * supported. The {@link BasicFileAttributeView} type supports access to the
- * basic attributes of a file and is name {@code "basic"}. Invoking this
- * method to select a file attribute view named {@code "basic"} will always
- * return an instance of that class.
+ <V extends FileAttributeView> V getFileAttributeView(Class<V> type,
+ LinkOption... options);
+
+ /**
+ * Sets the value of a file attribute.
+ *
+ * <p> The {@code attribute} parameter identifies the attribute to be set
+ * and takes the form:
+ * <blockquote>
+ * [<i>view-name</i><b>:</b>]<i>attribute-name</i>
+ * </blockquote>
+ * where square brackets [...] delineate an optional component and the
+ * character {@code ':'} stands for itself.
+ *
+ * <p> <i>view-name</i> is the {@link FileAttributeView#name name} of a {@link
+ * FileAttributeView} that identifies a set of file attributes. If not
+ * specified then it defaults to {@code "basic"}, the name of the file
+ * attribute view that identifies the basic set of file attributes common to
+ * many file systems. <i>attribute-name</i> is the name of the attribute
+ * within the set.
+ *
+ * <p> <b>Usage Example:</b>
+ * Suppose we want to set the DOS "hidden" attribute:
+ * <pre>
+ * file.setAttribute("dos:hidden", true);
+ * </pre>
+ *
+ * @param attribute
+ * the attribute to set
+ * @param value
+ * the attribute value
+ * @param options
+ * options indicating how symbolic links are handled
+ *
+ * @throws UnsupportedOperationException
+ * if the attribute view is not available or it does not support
+ * updating the attribute
+ * @throws IllegalArgumentException
+ * if the attribute value is of the correct type but has an
+ * inappropriate value
+ * @throws ClassCastException
+ * If the attribute value is not of the expected type or is a
+ * collection containing elements that are not of the expected
+ * type
+ * @throws IOException
+ * If an I/O error occurs
+ * @throws SecurityException
+ * In the case of the default provider, and a security manager is
+ * installed, its {@link SecurityManager#checkWrite(String) checkWrite}
+ * method denies write access to the file. If this method is invoked
+ * to set security sensitive attributes then the security manager
+ * may be invoked to check for additional permissions.
+ */
+ void setAttribute(String attribute, Object value, LinkOption... options)
+ throws IOException;
+
+ /**
+ * Reads the value of a file attribute.
+ *
+ * <p> The {@code attribute} parameter identifies the attribute to be read
+ * and takes the form:
+ * <blockquote>
+ * [<i>view-name</i><b>:</b>]<i>attribute-name</i>
+ * </blockquote>
+ * where square brackets [...] delineate an optional component and the
+ * character {@code ':'} stands for itself.
+ *
+ * <p> <i>view-name</i> is the {@link FileAttributeView#name name} of a {@link
+ * FileAttributeView} that identifies a set of file attributes. If not
+ * specified then it defaults to {@code "basic"}, the name of the file
+ * attribute view that identifies the basic set of file attributes common to
+ * many file systems. <i>attribute-name</i> is the name of the attribute.
*
* <p> The {@code options} array may be used to indicate how symbolic links
- * are handled by the resulting file attribute view for the case that the
- * file is a symbolic link. By default, symbolic links are followed. If the
- * option {@link LinkOption#NOFOLLOW_LINKS NOFOLLOW_LINKS} is present then
- * symbolic links are not followed. This option is ignored by implementations
- * that do not support symbolic links.
- *
- * @param name
- * The name of the file attribute view
+ * are handled for the case that the file is a symbolic link. By default,
+ * symbolic links are followed and the file attribute of the final target
+ * of the link is read. If the option {@link LinkOption#NOFOLLOW_LINKS
+ * NOFOLLOW_LINKS} is present then symbolic links are not followed and so
+ * the method returns the file attribute of the symbolic link.
+ *
+ * <p> <b>Usage Example:</b>
+ * Suppose we require the user ID of the file owner on a system that
+ * supports a "{@code unix}" view:
+ * <pre>
+ * int uid = (Integer)file.getAttribute("unix:uid");
+ * </pre>
+ *
+ * @param attribute
+ * the attribute to read
+ * @param options
+ * options indicating how symbolic links are handled
+ * @return the attribute value or {@code null} if the attribute view
+ * is not available or it does not support reading the attribute
+ *
+ * reading the attribute
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws SecurityException
+ * In the case of the default provider, and a security manager is
+ * installed, its {@link SecurityManager#checkRead(String) checkRead}
+ * method denies read access to the file. If this method is invoked
+ * to read security sensitive attributes then the security manager
+ * may be invoked to check for additional permissions.
+ */
+ Object getAttribute(String attribute, LinkOption... options) throws IOException;
+
+ /**
+ * Reads a set of file attributes as a bulk operation.
+ *
+ * <p> The {@code attributes} parameter identifies the attributes to be read
+ * and takes the form:
+ * <blockquote>
+ * [<i>view-name</i><b>:</b>]<i>attribute-list</i>
+ * </blockquote>
+ * where square brackets [...] delineate an optional component and the
+ * character {@code ':'} stands for itself.
+ *
+ * <p> <i>view-name</i> is the {@link FileAttributeView#name name} of a {@link
+ * FileAttributeView} that identifies a set of file attributes. If not
+ * specified then it defaults to {@code "basic"}, the name of the file
+ * attribute view that identifies the basic set of file attributes common to
+ * many file systems.
+ *
+ * <p> The <i>attribute-list</i> component is a comma separated list of
+ * zero or more names of attributes to read. If the list contains the value
+ * {@code "*"} then all attributes are read. Attributes that are not supported
+ * are ignored and will not be present in the returned map. It is
+ * implementation specific if all attributes are read as an atomic operation
+ * with respect to other file system operations.
+ *
+ * <p> The following examples demonstrate possible values for the {@code
+ * attributes} parameter:
+ *
+ * <blockquote>
+ * <table border="0">
+ * <tr>
+ * <td> {@code "*"} </td>
+ * <td> Read all {@link BasicFileAttributes basic-file-attributes}. </td>
+ * </tr>
+ * <tr>
+ * <td> {@code "size,lastModifiedTime,lastAccessTime"} </td>
+ * <td> Reads the file size, last modified time, and last access time
+ * attributes. </td>
+ * </tr>
+ * <tr>
+ * <td> {@code "posix:*"} </td>
+ * <td> Read all {@link PosixFileAttributes POSIX-file-attributes}.. </td>
+ * </tr>
+ * <tr>
+ * <td> {@code "posix:permissions,owner,size"} </td>
+ * <td> Reads the POSX file permissions, owner, and file size. </td>
+ * </tr>
+ * </table>
+ * </blockquote>
+ *
+ * <p> The {@code options} array may be used to indicate how symbolic links
+ * are handled for the case that the file is a symbolic link. By default,
+ * symbolic links are followed and the file attribute of the final target
+ * of the link is read. If the option {@link LinkOption#NOFOLLOW_LINKS
+ * NOFOLLOW_LINKS} is present then symbolic links are not followed and so
+ * the method returns the file attribute of the symbolic link.
+ *
+ * @param attributes
+ * The attributes to read
* @param options
* Options indicating how symbolic links are handled
*
- * @return A file attribute view of the given name, or {@code null} if
- * the attribute view is not available
- *
- * @throws UnsupportedOperationException
- * If options contains an unsupported option. This exception is
- * specified to allow the {@code LinkOption} enum be extended
- * in future releases.
- */
- FileAttributeView getFileAttributeView(String name, LinkOption... options);
-
- /**
- * Tests if the file referenced by this object is the same file referenced
- * by another object.
- *
- * <p> If this {@code FileRef} and the given {@code FileRef} are {@link
- * #equals(Object) equal} then this method returns {@code true} without checking
- * if the file exists. If the {@code FileRef} and the given {@code FileRef}
- * are associated with different providers, or the given {@code FileRef} is
- * {@code null} then this method returns {@code false}. Otherwise, this method
- * checks if both {@code FileRefs} locate the same file, and depending on the
- * implementation, may require to open or access both files.
- *
- * <p> If the file system and files remain static, then this method implements
- * an equivalence relation for non-null {@code FileRefs}.
- * <ul>
- * <li>It is <i>reflexive</i>: for a non-null {@code FileRef} {@code f},
- * {@code f.isSameFile(f)} should return {@code true}.
- * <li>It is <i>symmetric</i>: for two non-null {@code FileRefs}
- * {@code f} and {@code g}, {@code f.isSameFile(g)} will equal
- * {@code g.isSameFile(f)}.
- * <li>It is <i>transitive</i>: for three {@code FileRefs}
- * {@code f}, {@code g}, and {@code h}, if {@code f.isSameFile(g)} returns
- * {@code true} and {@code g.isSameFile(h)} returns {@code true}, then
- * {@code f.isSameFile(h)} will return return {@code true}.
- * </ul>
- *
- * @param other
- * The other file reference
- *
- * @return {@code true} if, and only if, this object and the given object
- * locate the same file
+ * @return A map of the attributes returned; may be empty. The map's keys
+ * are the attribute names, its values are the attribute values
*
* @throws IOException
* If an I/O error occurs
* @throws SecurityException
* In the case of the default provider, and a security manager is
- * installed, the {@link SecurityManager#checkRead(String) checkRead}
- * method is invoked to check read access to both files.
- *
- * @see java.nio.file.attribute.BasicFileAttributes#fileKey
- */
- boolean isSameFile(FileRef other) throws IOException;
-
- /**
- * Deletes the file referenced by this object.
- *
- * <p> An implementation may require to examine the file to determine if the
- * file is a directory. Consequently this method may not be atomic with respect
- * to other file system operations. If the file is a symbolic-link then the
- * link is deleted and not the final target of the link.
- *
- * <p> If the file is a directory then the directory must be empty. In some
- * implementations a directory has entries for special files or links that
- * are created when the directory is created. In such implementations a
- * directory is considered empty when only the special entries exist.
- *
- * <p> On some operating systems it may not be possible to remove a file when
- * it is open and in use by this Java virtual machine or other programs.
- *
- * @throws NoSuchFileException
- * If the file does not exist <i>(optional specific exception)</i>
- * @throws DirectoryNotEmptyException
- * If the file is a directory and could not otherwise be deleted
- * because the directory is not empty <i>(optional specific
- * exception)</i>
- * @throws IOException
- * If an I/O error occurs
- * @throws SecurityException
- * In the case of the default provider, and a security manager is
- * installed, the {@link SecurityManager#checkDelete(String)} method
- * is invoked to check delete access to the file
- */
- void delete() throws IOException;
-
- /**
- * Tests this object for equality with another object.
- *
- * <p> If the given object is not a {@code FileRef} then this method
- * immediately returns {@code false}.
- *
- * <p> For two file references to be considered equal requires that they
- * are both the same type of {@code FileRef} and encapsulate components
- * to locate the same file. This method does not access the file system and
- * the file may not exist.
- *
- * <p> This method satisfies the general contract of the {@link
- * java.lang.Object#equals(Object) Object.equals} method. </p>
- *
- * @param ob The object to which this object is to be compared
- *
- * @return {@code true} if, and only if, the given object is a {@code FileRef}
- * that is identical to this {@code FileRef}
- *
- * @see #isSameFile
- */
- boolean equals(Object ob);
-
- /**
- * Returns the hash-code value for this object.
- *
- * <p> This method satisfies the general contract of the
- * {@link java.lang.Object#hashCode() Object.hashCode} method.
- */
- int hashCode();
+ * installed, its {@link SecurityManager#checkRead(String) checkRead}
+ * method denies read access to the file. If this method is invoked
+ * to read security sensitive attributes then the security manager
+ * may be invoke to check for additional permissions.
+ */
+ Map<String,?> readAttributes(String attributes, LinkOption... options)
+ throws IOException;
}
--- a/src/share/classes/java/nio/file/FileStore.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/FileStore.java Thu Jul 23 11:29:49 2009 -0700
@@ -26,12 +26,13 @@ package java.nio.file;
package java.nio.file;
import java.nio.file.attribute.*;
+import java.io.IOException;
/**
* Storage for files. A {@code FileStore} represents a storage pool, device,
* partition, volume, concrete file system or other implementation specific means
* of file storage. The {@code FileStore} for where a file is stored is obtained
- * by invoking the {@link FileRef#getFileStore getFileStore} method, or all file
+ * by invoking the {@link Path#getFileStore getFileStore} method, or all file
* stores can be enumerated by invoking the {@link FileSystem#getFileStores
* getFileStores} method.
*
@@ -146,24 +147,41 @@ public abstract class FileStore {
getFileStoreAttributeView(Class<V> type);
/**
- * Returns a {@code FileStoreAttributeView} of the given name.
+ * Reads the value of a file store attribute.
*
- * <p> This method is intended to be used where <em>dynamic access</em> to
- * file store attributes is required. The {@code name} parameter specifies
- * the {@link FileAttributeView#name name} of the file store attribute view
- * and this method returns an instance of that view if supported.
+ * <p> The {@code attribute} parameter identifies the attribute to be read
+ * and takes the form:
+ * <blockquote>
+ * <i>view-name</i><b>:</b><i>attribute-name</i>
+ * </blockquote>
+ * where the character {@code ':'} stands for itself.
+ *
+ * <p> <i>view-name</i> is the {@link FileStoreAttributeView#name name} of
+ * a {@link FileStore AttributeView} that identifies a set of file attributes.
+ * <i>attribute-name</i> is the name of the attribute.
*
* <p> For {@code FileStore} objects created by the default provider, then
* the file stores support the {@link FileStoreSpaceAttributeView} that
- * provides access to space attributes. In that case invoking this method
- * with a parameter value of {@code "space"} will always return an instance
- * of that class.
+ * provides access to space attributes.
*
- * @param name
- * the name of the attribute view
+ * <p> <b>Usage Example:</b>
+ * Suppose we want to know if ZFS compression is enabled (assuming the "zfs"
+ * view is supported):
+ * <pre>
+ * boolean compression = (Boolean)fs.getAttribute("zfs:compression");
+ * </pre>
*
- * @return a file store attribute view of the given name, or {@code null}
- * if the attribute view is not available
+ * @param attribute
+ * the attribute to read
+
+ * @return the attribute value; {@code null} may be a valid valid for some
+ * attributes
+ *
+ * @throws UnsupportedOperationException
+ * if the attribute view is not available or it does not support
+ * reading the attribute
+ * @throws IOException
+ * if an I/O error occurs
*/
- public abstract FileStoreAttributeView getFileStoreAttributeView(String name);
+ public abstract Object getAttribute(String attribute) throws IOException;
}
--- a/src/share/classes/java/nio/file/FileTreeWalker.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/FileTreeWalker.java Thu Jul 23 11:29:49 2009 -0700
@@ -50,8 +50,6 @@ class FileTreeWalker {
case FOLLOW_LINKS : fl = true; break;
case DETECT_CYCLES : dc = true; break;
default:
- if (option == null)
- throw new NullPointerException("Visit options contains 'null'");
throw new AssertionError("Should not get here");
}
}
@@ -239,13 +237,13 @@ class FileTreeWalker {
}
private static class AncestorDirectory {
- private final FileRef dir;
+ private final Path dir;
private final Object key;
- AncestorDirectory(FileRef dir, Object key) {
+ AncestorDirectory(Path dir, Object key) {
this.dir = dir;
this.key = key;
}
- FileRef file() {
+ Path file() {
return dir;
}
Object fileKey() {
--- a/src/share/classes/java/nio/file/FileVisitor.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/FileVisitor.java Thu Jul 23 11:29:49 2009 -0700
@@ -42,9 +42,9 @@ import java.io.IOException;
* @Override
* public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
* try {
- * file.delete(false);
+ * file.delete();
* } catch (IOException exc) {
- * // failed to delete
+ * // failed to delete, do error handling here
* }
* return FileVisitResult.CONTINUE;
* }
@@ -52,9 +52,9 @@ import java.io.IOException;
* public FileVisitResult postVisitDirectory(Path dir, IOException e) {
* if (e == null) {
* try {
- * dir.delete(false);
+ * dir.delete();
* } catch (IOException exc) {
- * // failed to delete
+ * // failed to delete, do error handling here
* }
* } else {
* // directory iteration failed
@@ -80,7 +80,8 @@ import java.io.IOException;
* } catch (FileAlreadyExistsException e) {
* // ignore
* } catch (IOException e) {
- * // copy failed, skip rest of directory and descendants
+ * // copy failed, do error handling here
+ * // skip rest of directory and descendants
* return SKIP_SUBTREE;
* }
* return CONTINUE;
@@ -90,7 +91,7 @@ import java.io.IOException;
* try {
* file.copyTo(target.resolve(source.relativize(file)));
* } catch (IOException e) {
- * // copy failed
+ * // copy failed, do error handling here
* }
* return CONTINUE;
* }
@@ -100,7 +101,7 @@ import java.io.IOException;
* @since 1.7
*/
-public interface FileVisitor<T extends FileRef> {
+public interface FileVisitor<T> {
/**
* Invoked for a directory before entries in the directory are visited.
--- a/src/share/classes/java/nio/file/Files.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/Files.java Thu Jul 23 11:29:49 2009 -0700
@@ -26,13 +26,15 @@ package java.nio.file;
package java.nio.file;
import java.nio.file.spi.FileTypeDetector;
+import java.nio.file.attribute.*;
import java.io.IOException;
import java.util.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
/**
- * Utility methods for files and directories.
+ * This class consists exclusively of static methods that operate on files or
+ * directories.
*
* @since 1.7
*/
@@ -109,8 +111,6 @@ public final class Files {
* @throws SecurityException
* If a security manager is installed and it denies an unspecified
* permission required by a file type detector implementation.
- *
- * @see DirectoryStreamFilters#newContentTypeFilter
*/
public static String probeContentType(FileRef file)
throws IOException
@@ -125,158 +125,6 @@ public final class Files {
// fallback to default
return DefaultFileTypeDetectorHolder.defaultFileTypeDetector
.probeContentType(file);
- }
-
- /**
- * Invokes a {@link FileAction} for each entry in a directory accepted
- * by a given {@link java.nio.file.DirectoryStream.Filter filter}.
- *
- * <p> This method opens the given directory and invokes the file action's
- * {@link FileAction#invoke invoke} method for each entry accepted by the
- * filter. When iteration is completed then the directory is closed. If the
- * {@link DirectoryStream#close close} method throws an {@code IOException}
- * then it is silently ignored.
- *
- * <p> If the {@code FileAction}'s {@code invoke} method terminates due
- * to an uncaught {@link IOException}, {@code Error} or {@code RuntimeException}
- * then the exception is propagated by this method after closing the
- * directory.
- *
- * @param dir
- * The directory
- * @param filter
- * The filter
- * @param action
- * The {@code FileAction} to invoke for each accepted entry
- *
- * @throws NotDirectoryException
- * If the {@code dir} parameter is not a directory <i>(optional
- * specific exception)</i>
- * @throws IOException
- * If an I/O error occurs or the {@code invoke} method terminates
- * due to an uncaught {@code IOException}
- * @throws SecurityException
- * In the case of the default provider, the {@link
- * SecurityManager#checkRead(String) checkRead} method is invoked
- * to check read access to the directory.
- */
- public static void withDirectory(Path dir,
- DirectoryStream.Filter<? super Path> filter,
- FileAction<? super Path> action)
- throws IOException
- {
- // explicit null check required in case directory is empty
- if (action == null)
- throw new NullPointerException();
-
- DirectoryStream<Path> stream = dir.newDirectoryStream(filter);
- try {
- // set to true when invoking the action so as to distinguish a
- // CME thrown by the iteration from a CME thrown by the invoke
- boolean inAction = false;
- try {
- for (Path entry: stream) {
- inAction = true;
- action.invoke(entry);
- inAction = false;
- }
- } catch (ConcurrentModificationException cme) {
- if (!inAction) {
- Throwable cause = cme.getCause();
- if (cause instanceof IOException)
- throw (IOException)cause;
- }
- throw cme;
- }
- } finally {
- try {
- stream.close();
- } catch (IOException x) { }
- }
- }
-
- /**
- * Invokes a {@link FileAction} for each entry in a directory with a
- * file name that matches a given pattern.
- *
- * <p> This method opens the given directory and invokes the file action's
- * {@link FileAction#invoke invoke} method for each entry that matches the
- * given pattern. When iteration is completed then the directory is closed.
- * If the {@link DirectoryStream#close close} method throws an {@code
- * IOException} then it is silently ignored.
- *
- * <p> If the {@code FileAction}'s {@code invoke} method terminates due
- * to an uncaught {@link IOException}, {@code Error} or {@code RuntimeException}
- * then the exception is propagated by this method after closing the
- * directory.
- *
- * <p> The globbing pattern language supported by this method is as
- * specified by the {@link FileSystem#getPathMatcher getPathMatcher} method.
- *
- * @param dir
- * The directory
- * @param glob
- * The globbing pattern
- * @param action
- * The {@code FileAction} to invoke for each entry
- *
- * @throws NotDirectoryException
- * If the {@code dir} parameter is not a directory <i>(optional
- * specific exception)</i>
- * @throws IOException
- * If an I/O error occurs or the {@code invoke} method terminates
- * due to an uncaught {@code IOException}
- * @throws SecurityException
- * In the case of the default provider, the {@link
- * SecurityManager#checkRead(String) checkRead} method is invoked
- * to check read access to the directory.
- */
- public static void withDirectory(Path dir,
- String glob,
- FileAction<? super Path> action)
- throws IOException
- {
- if (glob == null)
- throw new NullPointerException("'glob' is null");
- final PathMatcher matcher = dir.getFileSystem().getPathMatcher("glob:" + glob);
- DirectoryStream.Filter<Path> filter = new DirectoryStream.Filter<Path>() {
- @Override
- public boolean accept(Path entry) {
- return matcher.matches(entry.getName());
- }
- };
- withDirectory(dir, filter, action);
- }
-
- /**
- * Invokes a {@link FileAction} for all entries in a directory.
- *
- * <p> This method works as if invoking it were equivalent to evaluating the
- * expression:
- * <blockquote><pre>
- * withDirectory(dir, "*", action)
- * </pre></blockquote>
- *
- * @param dir
- * The directory
- * @param action
- * The {@code FileAction} to invoke for each entry
- *
- * @throws NotDirectoryException
- * If the {@code dir} parameter is not a directory <i>(optional
- * specific exception)</i>
- * @throws IOException
- * If an I/O error occurs or the {@code invoke} method terminates
- * due to an uncaught {@code IOException}
- * @throws SecurityException
- * In the case of the default provider, the {@link
- * SecurityManager#checkRead(String) checkRead} method is invoked
- * to check read access to the directory.
- */
- public static void withDirectory(Path dir, FileAction<? super Path> action)
- throws IOException
- {
- withDirectory(dir, "*", action);
}
/**
@@ -328,7 +176,7 @@ public final class Files {
* arises when there is an entry in a directory that is an ancestor of the
* directory. Cycle detection is done by recording the {@link
* java.nio.file.attribute.BasicFileAttributes#fileKey file-key} of directories,
- * or if file keys are not available, by invoking the {@link FileRef#isSameFile
+ * or if file keys are not available, by invoking the {@link Path#isSameFile
* isSameFile} method to test if a directory is the same file as an
* ancestor. When a cycle is detected the {@link FileVisitor#visitFile
* visitFile} is invoked with the attributes of the directory. The {@link
@@ -403,4 +251,108 @@ public final class Files {
Integer.MAX_VALUE,
visitor);
}
+
+ /**
+ * Creates a directory by creating all nonexistent parent directories first.
+ *
+ * <p> The {@code attrs} parameter is an optional array of {@link FileAttribute
+ * file-attributes} to set atomically when creating the nonexistent
+ * directories. Each file attribute is identified by its {@link
+ * FileAttribute#name name}. If more than one attribute of the same name is
+ * included in the array then all but the last occurrence is ignored.
+ *
+ * <p> If this method fails, then it may do so after creating some, but not
+ * all, of the parent directories.
+ *
+ * @param dir
+ * the directory to create
+ *
+ * @param attrs
+ * an optional list of file attributes to set atomically when
+ * creating the directory
+ *
+ * @throws UnsupportedOperationException
+ * if the array contains an attribute that cannot be set atomically
+ * when creating the directory
+ * @throws FileAlreadyExistsException
+ * if {@code dir} exists but is not a directory <i>(optional specific
+ * exception)</i>
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws SecurityException
+ * in the case of the default provider, and a security manager is
+ * installed, the {@link SecurityManager#checkWrite(String) checkWrite}
+ * method is invoked prior to attempting to create a directory and
+ * its {@link SecurityManager#checkRead(String) checkRead} is
+ * invoked for each parent directory that is checked. If {@code
+ * dir} is not an absolute path then its {@link Path#toAbsolutePath
+ * toAbsolutePath} may need to be invoked to get its absolute path.
+ * This may invoke the security manager's {@link
+ * SecurityManager#checkPropertyAccess(String) checkPropertyAccess}
+ * method to check access to the system property {@code user.dir}
+ *
+ */
+ public static void createDirectories(Path dir, FileAttribute<?>... attrs)
+ throws IOException
+ {
+ // attempt to create the directory
+ try {
+ createAndCheckIsDirectory(dir, attrs);
+ return;
+ } catch (FileAlreadyExistsException x) {
+ // file exists and is not a directory
+ throw x;
+ } catch (IOException x) {
+ // parent may not exist or other reason
+ }
+
+ // find existing parent (may require absolute path)
+ SecurityException se = null;
+ try {
+ dir = dir.toAbsolutePath();
+ } catch (SecurityException x) {
+ // don't have permission to get absolute path
+ se = x;
+ }
+ Path parent = dir.getParent();
+ while (parent != null) {
+ try {
+ parent.checkAccess();
+ break;
+ } catch (NoSuchFileException x) {
+ // does not exist
+ }
+ parent = parent.getParent();
+ }
+ if (parent == null) {
+ // unable to find existing parent
+ if (se != null)
+ throw se;
+ throw new IOException("Root directory does not exist");
+ }
+
+ // create directories
+ Path child = parent;
+ for (Path name: parent.relativize(dir)) {
+ child = child.resolve(name);
+ createAndCheckIsDirectory(child, attrs);
+ }
+ }
+
+ /**
+ * Attempts to create a directory. Does nothing if the directory already
+ * exists.
+ */
+ private static void createAndCheckIsDirectory(Path dir, FileAttribute<?>... attrs)
+ throws IOException
+ {
+ try {
+ dir.createDirectory(attrs);
+ } catch (FileAlreadyExistsException x) {
+ boolean isDirectory = Attributes
+ .readBasicFileAttributes(dir, LinkOption.NOFOLLOW_LINKS).isDirectory();
+ if (!isDirectory)
+ throw x;
+ }
+ }
}
--- a/src/share/classes/java/nio/file/LinkPermission.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/LinkPermission.java Thu Jul 23 11:29:49 2009 -0700
@@ -95,7 +95,7 @@ public final class LinkPermission extend
* {@code null}
*
* @throws IllegalArgumentException
- * if name is empty or invalid
+ * if name is empty or invalid, or actions is a non-empty string
*/
public LinkPermission(String name, String actions) {
super(name);
--- a/src/share/classes/java/nio/file/OpenOption.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/OpenOption.java Thu Jul 23 11:29:49 2009 -0700
@@ -30,7 +30,7 @@ package java.nio.file;
*
* <p> Objects of this type are used by methods such as {@link
* Path#newOutputStream(OpenOption[]) newOutputStream}, {@link
- * FileRef#newByteChannel newByteChannel}, {@link
+ * Path#newByteChannel newByteChannel}, {@link
* java.nio.channels.FileChannel#open FileChannel.open}, and {@link
* java.nio.channels.AsynchronousFileChannel#open AsynchronousFileChannel.open}
* when opening or creating a file.
--- a/src/share/classes/java/nio/file/Path.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/Path.java Thu Jul 23 11:29:49 2009 -0700
@@ -26,10 +26,12 @@ package java.nio.file;
package java.nio.file;
import java.nio.file.attribute.*;
-import java.nio.channels.*;
-import java.io.*;
+import java.nio.channels.SeekableByteChannel;
+import java.io.IOException;
+import java.io.OutputStream;
import java.net.URI;
-import java.util.*;
+import java.util.Iterator;
+import java.util.Set;
/**
* A file reference that locates a file using a system dependent path. The file
@@ -70,19 +72,27 @@ import java.util.*;
* this class defines the following operations:
*
* <ul>
+ * <li><p> The {@link #newByteChannel newByteChannel} method
+ * may be used to open a file and obtain a byte channel for reading or
+ * writing. </p></li>
* <li><p> Files may be {@link #createFile(FileAttribute[]) created}, or
* directories may be {@link #createDirectory(FileAttribute[]) created}.
* </p></li>
+ * <li><p> The {@link #delete delete} method may be used to delete a file.
+ * </p></li>
+ * <li><p> The {@link #checkAccess checkAccess} method may be used to check
+ * the existence or accessibility of a file. </p></li>
+ * <li><p> The {@link #isSameFile isSameFile} method may be used to test if
+ * two file references locate the same file. </p></li>
+ * <li><p> The {@link #getFileStore getFileStore} method may be used to
+ * obtain the {@link FileStore} representing the storage where a file is
+ * located. </p></li>
* <li><p> Directories can be {@link #newDirectoryStream opened} so as to
* iterate over the entries in the directory. </p></li>
* <li><p> Files can be {@link #copyTo(Path,CopyOption[]) copied} or
* {@link #moveTo(Path,CopyOption[]) moved}. </p></li>
* <li><p> Symbolic-links may be {@link #createSymbolicLink created}, or the
* target of a link may be {@link #readSymbolicLink read}. </p></li>
- * <li><p> {@link #newInputStream InputStream} or {@link #newOutputStream
- * OutputStream} streams can be created to allow for interoperation with the
- * <a href="../../../java/io/package-summary.html">{@code java.io}</a> package
- * where required. </li></p>
* <li><p> The {@link #toRealPath real} path of an existing file may be
* obtained. </li></p>
* </ul>
@@ -93,13 +103,14 @@ import java.util.*;
*
* <h4>File attributes</h4>
*
- * The <a href="attribute/package-summary.html">{@code java.nio.file.attribute}</a>
- * package provides access to file attributes or <em>meta-data</em> associated
- * with files. The {@link Attributes Attributes} class defines methods that
- * operate on or return file attributes. For example, the file type, size,
- * timestamps, and other <em>basic</em> meta-data are obtained, in bulk, by
- * invoking the {@link Attributes#readBasicFileAttributes
- * Attributes.readBasicFileAttributes} method:
+ * In addition to the {@link #setAttribute setAttribute} and {@link #getAttribute
+ * getAttribute} methods, the <a href="attribute/package-summary.html">{@code
+ * java.nio.file.attribute}</a> package provides type-safe and efficient access
+ * to file attributes or <em>meta-data</em> associated with files. The {@link
+ * Attributes Attributes} class defines methods that operate on or return file
+ * attributes. For example, the file type, size, timestamps, and other
+ * <em>basic</em> meta-data are obtained, in bulk, by invoking the {@link
+ * Attributes#readBasicFileAttributes Attributes.readBasicFileAttributes} method:
* <pre>
* Path file = ...
* BasicFileAttributes attrs = Attributes.readBasicFileAttributes(file);
@@ -417,12 +428,38 @@ public abstract class Path
/**
* Deletes the file located by this path.
*
- * <p> The {@code failIfNotExists} parameter determines how the method
- * behaves when the file does not exist. When {@code true}, and the file
- * does not exist, then the method fails. When {@code false} then the method
- * does not fail.
- *
- * <p> As with the {@link FileRef#delete delete()} method, an implementation
+ * <p> An implementation may require to examine the file to determine if the
+ * file is a directory. Consequently this method may not be atomic with respect
+ * to other file system operations. If the file is a symbolic-link then the
+ * link is deleted and not the final target of the link.
+ *
+ * <p> If the file is a directory then the directory must be empty. In some
+ * implementations a directory has entries for special files or links that
+ * are created when the directory is created. In such implementations a
+ * directory is considered empty when only the special entries exist.
+ *
+ * <p> On some operating systems it may not be possible to remove a file when
+ * it is open and in use by this Java virtual machine or other programs.
+ *
+ * @throws NoSuchFileException
+ * if the file does not exist <i>(optional specific exception)</i>
+ * @throws DirectoryNotEmptyException
+ * if the file is a directory and could not otherwise be deleted
+ * because the directory is not empty <i>(optional specific
+ * exception)</i>
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws SecurityException
+ * In the case of the default provider, and a security manager is
+ * installed, the {@link SecurityManager#checkDelete(String)} method
+ * is invoked to check delete access to the file
+ */
+ public abstract void delete() throws IOException;
+
+ /**
+ * Deletes the file located by this path, if it exists.
+ *
+ * <p> As with the {@link #delete delete()} method, an implementation
* may require to examine the file to determine if the file is a directory.
* Consequently this method may not be atomic with respect to other file
* system operations. If the file is a symbolic-link then the link is
@@ -436,13 +473,6 @@ public abstract class Path
* <p> On some operating systems it may not be possible to remove a file when
* it is open and in use by this Java virtual machine or other programs.
*
- * @param failIfNotExists
- * {@code true} if the method should fail when the file does not
- * exist
- *
- * @throws NoSuchFileException
- * if the value of the {@code failIfNotExists} is {@code true} and
- * the file does not exist <i>(optional specific exception)</i>
* @throws DirectoryNotEmptyException
* if the file is a directory and could not otherwise be deleted
* because the directory is not empty <i>(optional specific
@@ -454,7 +484,7 @@ public abstract class Path
* installed, the {@link SecurityManager#checkDelete(String)} method
* is invoked to check delete access to the file.
*/
- public abstract void delete(boolean failIfNotExists) throws IOException;
+ public abstract void deleteIfExists() throws IOException;
/**
* Creates a symbolic link to a target <i>(optional operation)</i>.
@@ -536,8 +566,6 @@ public abstract class Path
* or its {@link SecurityManager#checkWrite(String) checkWrite}
* method denies write access to both this path and the path of the
* existing file.
- *
- * @see BasicFileAttributes#linkCount
*/
public abstract Path createLink(Path existing) throws IOException;
@@ -608,7 +636,7 @@ public abstract class Path
*
* @return an absolute, hierarchical URI with a non-empty path component
*
- * @throws IOError
+ * @throws java.io.IOError
* if an I/O error occurs obtaining the absolute path, or where a
* file system is constructed to access the contents of a file as
* a file system, and the URI of the enclosing file system cannot be
@@ -636,8 +664,9 @@ public abstract class Path
* @throws IOError
* if an I/O error occurs
* @throws SecurityException
- * In the case of the default provider, and a security manager
- * is installed, its {@link SecurityManager#checkPropertyAccess(String)
+ * In the case of the default provider, a security manager
+ * is installed, and this path is not absolute, then the security
+ * manager's {@link SecurityManager#checkPropertyAccess(String)
* checkPropertyAccess} method is invoked to check access to the
* system property {@code user.dir}
*/
@@ -720,7 +749,9 @@ public abstract class Path
* the target file. The exact file attributes that are copied is platform
* and file system dependent and therefore unspecified. Minimally, the
* {@link BasicFileAttributes#lastModifiedTime last-modified-time} is
- * copied to the target file. </td>
+ * copied to the target file if supported by both the source and target
+ * file store. Copying of file timestamps may result in precision
+ * loss. </td>
* </tr>
* <tr>
* <td> {@link LinkOption#NOFOLLOW_LINKS NOFOLLOW_LINKS} </td>
@@ -867,10 +898,7 @@ public abstract class Path
*
* <p> The directory stream's {@code close} method should be invoked after
* iteration is completed so as to free any resources held for the open
- * directory. The {@link Files#withDirectory Files.withDirectory} utility
- * method is useful for cases where a task is performed on each accepted
- * entry in a directory. This method closes the directory when iteration is
- * complete (or an error occurs).
+ * directory.
*
* <p> When an implementation supports operations on entries in the
* directory that execute in a race-free manner then the returned directory
@@ -927,8 +955,6 @@ public abstract class Path
*
* @throws java.util.regex.PatternSyntaxException
* if the pattern is invalid
- * @throws UnsupportedOperationException
- * if the pattern syntax is not known to the implementation
* @throws NotDirectoryException
* if the file could not otherwise be opened because it is not
* a directory <i>(optional specific exception)</i>
@@ -950,19 +976,18 @@ public abstract class Path
* directory. The {@code Path} objects are obtained as if by {@link
* #resolve(Path) resolving} the name of the directory entry against this
* path. The entries returned by the iterator are filtered by the given
- * {@link DirectoryStream.Filter filter}. The {@link DirectoryStreamFilters}
- * class defines factory methods that create useful filters.
+ * {@link DirectoryStream.Filter filter}.
*
* <p> The directory stream's {@code close} method should be invoked after
* iteration is completed so as to free any resources held for the open
- * directory. The {@link Files#withDirectory Files.withDirectory} utility
- * method is useful for cases where a task is performed on each accepted
- * entry in a directory. This method closes the directory when iteration is
- * complete (or an error occurs).
+ * directory.
*
* <p> Where the filter terminates due to an uncaught error or runtime
- * exception then it propogated to the caller of the iterator's {@link
- * Iterator#hasNext() hasNext} or {@link Iterator#next() next} methods.
+ * exception then it is propogated to the iterator's {@link Iterator#hasNext()
+ * hasNext} or {@link Iterator#next() next} method. Where an {@code
+ * IOException} is thrown, it is propogated as a {@link
+ * java.util.concurrent.ConcurrentModificationException} with the {@code
+ * IOException} as the cause.
*
* <p> When an implementation supports operations on entries in the
* directory that execute in a race-free manner then the returned directory
@@ -973,14 +998,9 @@ public abstract class Path
* larger than 8K.
* <pre>
* DirectoryStream.Filter<Path> filter = new DirectoryStream.Filter<Path>() {
- * public boolean accept(Path file) {
- * try {
- * long size = Attributes.readBasicFileAttributes(file).size();
- * return (size > 8192L);
- * } catch (IOException e) {
- * // failed to get size
- * return false;
- * }
+ * public boolean accept(Path file) throws IOException {
+ * long size = Attributes.readBasicFileAttributes(file).size();
+ * return (size > 8192L);
* }
* };
* Path dir = ...
@@ -1071,6 +1091,8 @@ public abstract class Path
* In the case of the default provider, and a security manager is
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
* method is invoked to check write access to the new directory.
+ *
+ * @see Files#createDirectories
*/
public abstract Path createDirectory(FileAttribute<?>... attrs)
throws IOException;
@@ -1159,7 +1181,7 @@ public abstract class Path
* FileAttribute file-attributes} to set atomically when a new file is created.
*
* <p> In the case of the default provider, the returned seekable byte channel
- * is a {@link FileChannel}.
+ * is a {@link java.nio.channels.FileChannel}.
*
* <p> <b>Usage Examples:</b>
* <pre>
@@ -1212,12 +1234,9 @@ public abstract class Path
* Opens or creates a file, returning a seekable byte channel to access the
* file.
*
- * <p> This method extends the options defined by the {@code FileRef}
- * interface and to the options specified by the {@link
- * #newByteChannel(Set,FileAttribute[]) newByteChannel} method
- * except that the options are specified by an array. In the case of the
- * default provider, the returned seekable byte channel is a {@link
- * FileChannel}.
+ * <p> This method opens or creates a file in exactly the manner specified
+ * by the {@link Path#newByteChannel(Set,FileAttribute[]) newByteChannel}
+ * method.
*
* @param options
* options specifying how the file is opened
@@ -1232,108 +1251,40 @@ public abstract class Path
* if a file of that name already exists and the {@link
* StandardOpenOption#CREATE_NEW CREATE_NEW} option is specified
* <i>(optional specific exception)</i>
- * @throws IOException {@inheritDoc}
- * @throws SecurityException {@inheritDoc}
- */
- @Override
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws SecurityException
+ * In the case of the default provider, and a security manager is
+ * installed, the {@link SecurityManager#checkRead(String) checkRead}
+ * method is invoked to check read access to the path if the file is
+ * opened for reading. The {@link SecurityManager#checkWrite(String)
+ * checkWrite} method is invoked to check write access to the path
+ * if the file is opened for writing.
+ */
public abstract SeekableByteChannel newByteChannel(OpenOption... options)
throws IOException;
/**
- * Opens the file located by this path for reading, returning an input
- * stream to read bytes from the file. The stream will not be buffered, and
- * is not required to support the {@link InputStream#mark mark} or {@link
- * InputStream#reset reset} methods. The stream will be safe for access by
- * multiple concurrent threads. Reading commences at the beginning of the file.
- *
- * @return an input stream to read bytes from the file
- *
- * @throws IOException
- * if an I/O error occurs
- * @throws SecurityException
- * In the case of the default provider, and a security manager is
- * installed, the {@link SecurityManager#checkRead(String) checkRead}
- * method is invoked to check read access to the file.
- */
- public abstract InputStream newInputStream() throws IOException;
-
- /**
- * Opens or creates the file located by this path for writing, returning an
- * output stream to write bytes to the file.
+ * Opens or creates the file located by this object for writing, returning
+ * an output stream to write bytes to the file.
*
* <p> This method opens or creates a file in exactly the manner specified
* by the {@link Path#newByteChannel(Set,FileAttribute[]) newByteChannel}
* method except that the {@link StandardOpenOption#READ READ} option may not
- * be present in the array of open options. If no open options are present
- * then this method creates a new file for writing or truncates an existing
- * file.
- *
- * <p> The resulting stream will not be buffered. The stream will be safe
- * for access by multiple concurrent threads.
- *
- * <p> <b>Usage Example:</b>
- * Suppose we wish to open a log file for writing so that we append to the
- * file if it already exists, or create it when it doesn't exist.
- * <pre>
- * Path logfile = ...
- * OutputStream out = new BufferedOutputStream(logfile.newOutputStream(CREATE, APPEND));
- * </pre>
+ * be present in the array of open options.
*
* @param options
* options specifying how the file is opened
*
- * @return a new seekable byte channel
- *
- * @throws IllegalArgumentException
- * if {@code options} contains an invalid combination of options
- * @throws UnsupportedOperationException
- * if an unsupported open option is specified
- * @throws IOException
- * if an I/O error occurs
- * @throws SecurityException
- * In the case of the default provider, and a security manager is
- * installed, the {@link SecurityManager#checkWrite(String) checkWrite}
- * method is invoked to check write access to the file.
- */
+ * @return a new output stream
+ *
+ * @throws IllegalArgumentException {@inheritDoc}
+ * @throws UnsupportedOperationException {@inheritDoc}
+ * @throws IOException {@inheritDoc}
+ * @throws SecurityException {@inheritDoc}
+ */
+ @Override
public abstract OutputStream newOutputStream(OpenOption... options)
- throws IOException;
-
- /**
- * Opens or creates the file located by this path for writing, returning an
- * output stream to write bytes to the file.
- *
- * <p> This method opens or creates a file in exactly the manner specified
- * by the {@link Path#newByteChannel(Set,FileAttribute[]) newByteChannel}
- * method except that {@code options} parameter may not contain the {@link
- * StandardOpenOption#READ READ} option. If no open options are present
- * then this method creates a new file for writing or truncates an existing
- * file.
- *
- * <p> The resulting stream will not be buffered. The stream will be safe
- * for access by multiple concurrent threads.
- *
- * @param options
- * options specifying how the file is opened
- * @param attrs
- * an optional list of file attributes to set atomically when
- * creating the file
- *
- * @return a new output stream
- *
- * @throws IllegalArgumentException
- * if the set contains an invalid combination of options
- * @throws UnsupportedOperationException
- * if an unsupported open option is specified or the array contains
- * attributes that cannot be set atomically when creating the file
- * @throws IOException
- * if an I/O error occurs
- * @throws SecurityException
- * In the case of the default provider, and a security manager is
- * installed, the {@link SecurityManager#checkWrite(String) checkWrite}
- * method is invoked to check write access to the file.
- */
- public abstract OutputStream newOutputStream(Set<? extends OpenOption> options,
- FileAttribute<?>... attrs)
throws IOException;
/**
@@ -1357,6 +1308,80 @@ public abstract class Path
* method is invoked to check read access to the file.
*/
public abstract boolean isHidden() throws IOException;
+
+ /**
+ * Checks the existence and optionally the accessibility of the file
+ * located by this path.
+ *
+ * <p> This method checks the existence of a file and that this Java virtual
+ * machine has appropriate privileges that would allow it access the file
+ * according to all of access modes specified in the {@code modes} parameter
+ * as follows:
+ *
+ * <table border=1 cellpadding=5 summary="">
+ * <tr> <th>Value</th> <th>Description</th> </tr>
+ * <tr>
+ * <td> {@link AccessMode#READ READ} </td>
+ * <td> Checks that the file exists and that the Java virtual machine has
+ * permission to read the file. </td>
+ * </tr>
+ * <tr>
+ * <td> {@link AccessMode#WRITE WRITE} </td>
+ * <td> Checks that the file exists and that the Java virtual machine has
+ * permission to write to the file, </td>
+ * </tr>
+ * <tr>
+ * <td> {@link AccessMode#EXECUTE EXECUTE} </td>
+ * <td> Checks that the file exists and that the Java virtual machine has
+ * permission to {@link Runtime#exec execute} the file. The semantics
+ * may differ when checking access to a directory. For example, on UNIX
+ * systems, checking for {@code EXECUTE} access checks that the Java
+ * virtual machine has permission to search the directory in order to
+ * access file or subdirectories. </td>
+ * </tr>
+ * </table>
+ *
+ * <p> If the {@code modes} parameter is of length zero, then the existence
+ * of the file is checked.
+ *
+ * <p> This method follows symbolic links if the file referenced by this
+ * object is a symbolic link. Depending on the implementation, this method
+ * may require to read file permissions, access control lists, or other
+ * file attributes in order to check the effective access to the file. To
+ * determine the effective access to a file may require access to several
+ * attributes and so in some implementations this method may not be atomic
+ * with respect to other file system operations. Furthermore, as the result
+ * of this method is immediately outdated, there is no guarantee that a
+ * subsequence access will succeed (or even that it will access the same
+ * file). Care should be taken when using this method in security sensitive
+ * applications.
+ *
+ * @param modes
+ * The access modes to check; may have zero elements
+ *
+ * @throws UnsupportedOperationException
+ * an implementation is required to support checking for
+ * {@code READ}, {@code WRITE}, and {@code EXECUTE} access. This
+ * exception is specified to allow for the {@code Access} enum to
+ * be extended in future releases.
+ * @throws NoSuchFileException
+ * if a file does not exist <i>(optional specific exception)</i>
+ * @throws AccessDeniedException
+ * the requested access would be denied or the access cannot be
+ * determined because the Java virtual machine has insufficient
+ * privileges or other reasons. <i>(optional specific exception)</i>
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws SecurityException
+ * In the case of the default provider, and a security manager is
+ * installed, the {@link SecurityManager#checkRead(String) checkRead}
+ * is invoked when checking read access to the file or only the
+ * existence of the file, the {@link SecurityManager#checkWrite(String)
+ * checkWrite} is invoked when checking write access to the file,
+ * and {@link SecurityManager#checkExec(String) checkExec} is invoked
+ * when checking execute access.
+ */
+ public abstract void checkAccess(AccessMode... modes) throws IOException;
/**
* Tests whether the file located by this path exists.
@@ -1413,6 +1438,30 @@ public abstract class Path
* read access to the file.
*/
public abstract boolean notExists();
+
+ /**
+ * Returns the {@link FileStore} representing the file store where an
+ * existing file, located by this path, is stored.
+ *
+ * <p> Once a reference to the {@code FileStore} is obtained it is
+ * implementation specific if operations on the returned {@code FileStore},
+ * or {@link FileStoreAttributeView} objects obtained from it, continue
+ * to depend on the existence of the file. In particular the behavior is not
+ * defined for the case that the file is deleted or moved to a different
+ * file store.
+ *
+ * @return the file store where the file is stored
+ *
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws SecurityException
+ * In the case of the default provider, and a security manager is
+ * installed, the {@link SecurityManager#checkRead(String) checkRead}
+ * method is invoked to check read access to the file, and in
+ * addition it checks {@link RuntimePermission}<tt>
+ * ("getFileStoreAttributes")</tt>
+ */
+ public abstract FileStore getFileStore() throws IOException;
// -- watchable --
@@ -1562,6 +1611,49 @@ public abstract class Path
public abstract int compareTo(Path other);
/**
+ * Tests if the file referenced by this object is the same file referenced
+ * by another object.
+ *
+ * <p> If this {@code FileRef} and the given {@code FileRef} are {@link
+ * #equals(Object) equal} then this method returns {@code true} without checking
+ * if the file exists. If the {@code FileRef} and the given {@code FileRef}
+ * are associated with different providers, or the given {@code FileRef} is
+ * {@code null} then this method returns {@code false}. Otherwise, this method
+ * checks if both {@code FileRefs} locate the same file, and depending on the
+ * implementation, may require to open or access both files.
+ *
+ * <p> If the file system and files remain static, then this method implements
+ * an equivalence relation for non-null {@code FileRefs}.
+ * <ul>
+ * <li>It is <i>reflexive</i>: for a non-null {@code FileRef} {@code f},
+ * {@code f.isSameFile(f)} should return {@code true}.
+ * <li>It is <i>symmetric</i>: for two non-null {@code FileRefs}
+ * {@code f} and {@code g}, {@code f.isSameFile(g)} will equal
+ * {@code g.isSameFile(f)}.
+ * <li>It is <i>transitive</i>: for three {@code FileRefs}
+ * {@code f}, {@code g}, and {@code h}, if {@code f.isSameFile(g)} returns
+ * {@code true} and {@code g.isSameFile(h)} returns {@code true}, then
+ * {@code f.isSameFile(h)} will return return {@code true}.
+ * </ul>
+ *
+ * @param other
+ * the other file reference
+ *
+ * @return {@code true} if, and only if, this object and the given object
+ * locate the same file
+ *
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws SecurityException
+ * In the case of the default provider, and a security manager is
+ * installed, the {@link SecurityManager#checkRead(String) checkRead}
+ * method is invoked to check read access to both files.
+ *
+ * @see java.nio.file.attribute.BasicFileAttributes#fileKey
+ */
+ public abstract boolean isSameFile(Path other) throws IOException;
+
+ /**
* Tests this path for equality with the given object.
*
* <p> If the given object is not a Path, or is a Path associated with a
--- a/src/share/classes/java/nio/file/Paths.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/Paths.java Thu Jul 23 11:29:49 2009 -0700
@@ -35,7 +35,7 @@ import java.net.URI;
* @since 1.7
*/
-public class Paths {
+public final class Paths {
private Paths() { }
/**
@@ -106,8 +106,9 @@ public class Paths {
* if preconditions on the {@code uri} parameter do not hold. The
* format of the URI is provider specific.
* @throws FileSystemNotFoundException
- * if the file system identified by the URI does not exist or the
- * provider identified by the URI's scheme component is not installed
+ * The file system, identified by the URI, does not exist and
+ * cannot be created automatically, or the provider identified by
+ * the URI's scheme component is not installed
* @throws SecurityException
* if a security manager is installed and it denies an unspecified
* permission to access the file system
--- a/src/share/classes/java/nio/file/SecureDirectoryStream.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/SecureDirectoryStream.java Thu Jul 23 11:29:49 2009 -0700
@@ -36,7 +36,7 @@ import java.io.IOException;
* traverse file trees or otherwise operate on directories in a race-free manner.
* Race conditions can arise when a sequence of file operations cannot be
* carried out in isolation. Each of the file operations defined by this
- * interface specify a relative {@link Path}. All access to the file is relative
+ * interface specify a relative path. All access to the file is relative
* to the open directory irrespective of if the directory is moved or replaced
* by an attacker while the directory is open. A {@code SecureDirectoryStream}
* may also be used as a virtual <em>working directory</em>.
@@ -65,8 +65,8 @@ import java.io.IOException;
* @since 1.7
*/
-public abstract class SecureDirectoryStream
- implements DirectoryStream<Path>
+public abstract class SecureDirectoryStream<T>
+ implements DirectoryStream<T>
{
/**
* Initialize a new instance of this class.
@@ -78,13 +78,12 @@ public abstract class SecureDirectoryStr
* SecureDirectoryStream} to iterate over the entries in the directory.
*
* <p> This method works in exactly the manner specified by the {@link
- * Path#newDirectoryStream newDirectoryStream} method for the case that
+ * Path#newDirectoryStream() newDirectoryStream} method for the case that
* the {@code path} parameter is an {@link Path#isAbsolute absolute} path.
* When the parameter is a relative path then the directory to open is
- * relative to this open directory. The {@code followLinks} parameter
- * determines if links should be followed. If this parameter is {@code
- * false} and the file is a symbolic link then this method fails (by
- * throwing an I/O exception).
+ * relative to this open directory. The {@link
+ * LinkOption#NOFOLLOW_LINKS NOFOLLOW_LINKS} option may be used to
+ * ensure that this method fails if the file is a symbolic link.
*
* <p> The new directory stream, once created, is not dependent upon the
* directory stream used to create it. Closing this directory stream has no
@@ -92,10 +91,8 @@ public abstract class SecureDirectoryStr
*
* @param path
* the path to the directory to open
- * @param followLinks
- * {@code true} if the links should be followed
- * @param filter
- * the directory stream filter or {@code null}.
+ * @param options
+ * options indicating how symbolic links are handled
*
* @return a new and open {@code SecureDirectoryStream} object
*
@@ -111,9 +108,8 @@ public abstract class SecureDirectoryStr
* installed, the {@link SecurityManager#checkRead(String) checkRead}
* method is invoked to check read access to the directory.
*/
- public abstract SecureDirectoryStream newDirectoryStream(Path path,
- boolean followLinks,
- DirectoryStream.Filter<? super Path> filter)
+ public abstract SecureDirectoryStream<T> newDirectoryStream(T path,
+ LinkOption... options)
throws IOException;
/**
@@ -162,7 +158,7 @@ public abstract class SecureDirectoryStr
* checkWrite} method is invoked to check write access to the path
* if the file is opened for writing.
*/
- public abstract SeekableByteChannel newByteChannel(Path path,
+ public abstract SeekableByteChannel newByteChannel(T path,
Set<? extends OpenOption> options,
FileAttribute<?>... attrs)
throws IOException;
@@ -170,7 +166,7 @@ public abstract class SecureDirectoryStr
/**
* Deletes a file.
*
- * <p> Unlike the {@link FileRef#delete delete()} method, this method
+ * <p> Unlike the {@link Path#delete delete()} method, this method
* does not first examine the file to determine if the file is a directory.
* Whether a directory is deleted by this method is system dependent and
* therefore not specified. If the file is a symbolic-link then the link is
@@ -191,12 +187,12 @@ public abstract class SecureDirectoryStr
* installed, the {@link SecurityManager#checkDelete(String) checkDelete}
* method is invoked to check delete access to the file
*/
- public abstract void deleteFile(Path path) throws IOException;
+ public abstract void deleteFile(T path) throws IOException;
/**
* Deletes a directory.
*
- * <p> Unlike the {@link FileRef#delete delete()} method, this method
+ * <p> Unlike the {@link Path#delete delete()} method, this method
* does not first examine the file to determine if the file is a directory.
* Whether non-directories are deleted by this method is system dependent and
* therefore not specified. When the parameter is a relative path then the
@@ -219,7 +215,7 @@ public abstract class SecureDirectoryStr
* installed, the {@link SecurityManager#checkDelete(String) checkDelete}
* method is invoked to check delete access to the directory
*/
- public abstract void deleteDirectory(Path path) throws IOException;
+ public abstract void deleteDirectory(T path) throws IOException;
/**
* Move a file from this directory to another directory.
@@ -259,7 +255,7 @@ public abstract class SecureDirectoryStr
* method is invoked to check write access to both the source and
* target file.
*/
- public abstract void move(Path srcpath, SecureDirectoryStream targetdir, Path targetpath)
+ public abstract void move(T srcpath, SecureDirectoryStream<T> targetdir, T targetpath)
throws IOException;
/**
@@ -318,7 +314,7 @@ public abstract class SecureDirectoryStr
* type is not available
*
*/
- public abstract <V extends FileAttributeView> V getFileAttributeView(Path path,
+ public abstract <V extends FileAttributeView> V getFileAttributeView(T path,
Class<V> type,
LinkOption... options);
}
--- a/src/share/classes/java/nio/file/SimpleFileVisitor.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/SimpleFileVisitor.java Thu Jul 23 11:29:49 2009 -0700
@@ -40,7 +40,7 @@ import java.io.IOError;
* @since 1.7
*/
-public class SimpleFileVisitor<T extends FileRef> implements FileVisitor<T> {
+public class SimpleFileVisitor<T> implements FileVisitor<T> {
/**
* Initializes a new instance of this class.
*/
--- a/src/share/classes/java/nio/file/StandardWatchEventKind.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/StandardWatchEventKind.java Thu Jul 23 11:29:49 2009 -0700
@@ -31,7 +31,7 @@ package java.nio.file;
* @since 1.7
*/
-public class StandardWatchEventKind {
+public final class StandardWatchEventKind {
private StandardWatchEventKind() { }
/**
--- a/src/share/classes/java/nio/file/WatchKey.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/WatchKey.java Thu Jul 23 11:29:49 2009 -0700
@@ -103,7 +103,7 @@ public abstract class WatchKey {
*
* <p> Note that this method does not wait if there are no events pending.
*
- * @return the list of the events retrieved
+ * @return the list of the events retrieved; may be empty
*/
public abstract List<WatchEvent<?>> pollEvents();
@@ -128,7 +128,7 @@ public abstract class WatchKey {
* will be invalid. If the watch key is enqueued, waiting to be retrieved
* from the watch service, then it will remain in the queue until it is
* removed. Pending events, if any, remain pending and may be retrieved by
- * invoking the {@link #pollEvents pollEvents} method event after the key is
+ * invoking the {@link #pollEvents pollEvents} method after the key is
* cancelled.
*
* <p> If this watch key has already been cancelled then invoking this
--- a/src/share/classes/java/nio/file/attribute/AclFileAttributeView.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/attribute/AclFileAttributeView.java Thu Jul 23 11:29:49 2009 -0700
@@ -110,13 +110,13 @@ import java.io.IOException;
* </table>
* </blockquote>
*
- * <p> The {@link #getAttribute getAttribute} or {@link #readAttributes
- * readAttributes} methods may be used to read the ACL or owner attributes as if
- * by invoking the {@link #getAcl getAcl} or {@link #getOwner getOwner} methods.
- *
- * <p> The {@link #setAttribute setAttribute} method may be used to update the
- * ACL or owner attributes as if by invoking the {@link #setAcl setAcl} or {@link
- * #setOwner setOwner} methods.
+ * <p> The {@link FileRef#getAttribute getAttribute} method may be used to read
+ * the ACL or owner attributes as if by invoking the {@link #getAcl getAcl} or
+ * {@link #getOwner getOwner} methods.
+ *
+ * <p> The {@link FileRef#setAttribute setAttribute} method may be used to
+ * update the ACL or owner attributes as if by invoking the {@link #setAcl setAcl}
+ * or {@link #setOwner setOwner} methods.
*
* <h4> Setting the ACL when creating a file </h4>
*
--- a/src/share/classes/java/nio/file/attribute/AttributeView.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/attribute/AttributeView.java Thu Jul 23 11:29:49 2009 -0700
@@ -25,20 +25,12 @@
package java.nio.file.attribute;
-import java.util.*;
-import java.io.IOException;
-
/**
* An object that provides a read-only or updatable <em>view</em> of non-opaque
* values associated with an object in a filesystem. This interface is extended
* or implemented by specific attribute views that define the attributes
* supported by the view. A specific attribute view will typically define
- * type-safe methods to read or update the attributes that it supports. It also
- * provides <em>dynamic access</em> where the {@link #readAttributes
- * readAttributes}, {@link #getAttribute getAttribute} and {@link #setAttribute
- * setAttributs} methods are used to access the attributes by names defined
- * by the attribute view. Implementations must ensure that the attribute names
- * do not contain the colon (':') or comma (',') characters.
+ * type-safe methods to read or update the attributes that it supports.
*
* @since 1.7
*/
@@ -48,71 +40,4 @@ public interface AttributeView {
* Returns the name of the attribute view.
*/
String name();
-
- /**
- * Reads the value of an attribute.
- *
- * @param attribute
- * the attribute name (case sensitive)
- *
- * @return the value of the attribute, or {@code null} if the attribute is
- * not supported
- *
- * @throws IOException
- * if an I/O error occurs
- * @throws SecurityException
- * if a security manager is set and it denies access
- */
- Object getAttribute(String attribute) throws IOException;
-
- /**
- * Sets/updates the value of an attribute.
- *
- * @param attribute
- * the attribute name (case sensitive)
- * @param value
- * the attribute value
- *
- * @throws UnsupportedOperationException
- * if the attribute is not supported or this attribute view does
- * not support updating the value of the attribute
- * @throws IllegalArgumentException
- * if the attribute value is of the correct type but has an
- * inappropriate value
- * @throws ClassCastException
- * if the attribute value is not of the expected type or is a
- * collection containing elements that are not of the expected
- * type
- * @throws IOException
- * if an I/O error occurs
- * @throws SecurityException
- * if a security manager is set and it denies access
- */
- void setAttribute(String attribute, Object value) throws IOException;
-
- /**
- * Reads all, or a subset, of the attributes supported by this file attribute
- * view.
- *
- * <p> The {@code first} and {@code rest} parameters are the names of the
- * attributes to read. If any of the parameters has the value {@code "*"}
- * then all attributes are read. Attributes that are not supported are
- * ignored and will not be present in the returned map. It is implementation
- * specific if all attributes are read as an atomic operation with respect
- * to other file system operations.
- *
- * @param first
- * the name of an attribute to read (case sensitive)
- * @param rest
- * the names of other attributes to read (case sensitive)
- *
- * @return an unmodifiable map of the attributes; may be empty. Its keys are
- * the attribute names, its values are the attribute values
- *
- * @throws IOException
- * if an I/O error occurs
- * @throws SecurityException
- * if a security manager is set and it denies access
- */
- Map<String,?> readAttributes(String first, String... rest) throws IOException;
}
--- a/src/share/classes/java/nio/file/attribute/Attributes.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/attribute/Attributes.java Thu Jul 23 11:29:49 2009 -0700
@@ -28,7 +28,6 @@ import java.nio.file.*;
import java.nio.file.*;
import java.io.IOException;
import java.util.*;
-import java.util.concurrent.TimeUnit;
/**
* This class consists exclusively of static methods that operate on or return
@@ -39,245 +38,7 @@ import java.util.concurrent.TimeUnit;
*/
public final class Attributes {
- private Attributes() {
- }
-
- /**
- * Splits the given attribute name into the name of an attribute view and
- * the attribute. If the attribute view is not identified then it assumed
- * to be "basic".
- */
- private static String[] split(String attribute) {
- String[] s = new String[2];
- int pos = attribute.indexOf(':');
- if (pos == -1) {
- s[0] = "basic";
- s[1] = attribute;
- } else {
- s[0] = attribute.substring(0, pos++);
- s[1] = (pos == attribute.length()) ? "" : attribute.substring(pos);
- }
- return s;
- }
-
- /**
- * Sets the value of a file attribute.
- *
- * <p> The {@code attribute} parameter identifies the attribute to be set
- * and takes the form:
- * <blockquote>
- * [<i>view-name</i><b>:</b>]<i>attribute-name</i>
- * </blockquote>
- * where square brackets [...] delineate an optional component and the
- * character {@code ':'} stands for itself.
- *
- * <p> <i>view-name</i> is the {@link FileAttributeView#name name} of a {@link
- * FileAttributeView} that identifies a set of file attributes. If not
- * specified then it defaults to {@code "basic"}, the name of the file
- * attribute view that identifies the basic set of file attributes common to
- * many file systems. <i>attribute-name</i> is the name of the attribute
- * within the set.
- *
- * <p> <b>Usage Example:</b>
- * Suppose we want to set the DOS "hidden" attribute:
- * <pre>
- * Attributes.setAttribute(file, "dos:hidden", true);
- * </pre>
- *
- * @param file
- * A file reference that locates the file
- * @param attribute
- * The attribute to set
- * @param value
- * The attribute value
- *
- * @throws UnsupportedOperationException
- * If the attribute view is not available or it does not
- * support updating the attribute
- * @throws IllegalArgumentException
- * If the attribute value is of the correct type but has an
- * inappropriate value
- * @throws ClassCastException
- * If the attribute value is not of the expected type or is a
- * collection containing elements that are not of the expected
- * type
- * @throws IOException
- * If an I/O error occurs
- * @throws SecurityException
- * In the case of the default provider, and a security manager is
- * installed, its {@link SecurityManager#checkWrite(String) checkWrite}
- * method denies write access to the file. If this method is invoked
- * to set security sensitive attributes then the security manager
- * may be invoked to check for additional permissions.
- */
- public static void setAttribute(FileRef file, String attribute, Object value)
- throws IOException
- {
- String[] s = split(attribute);
- FileAttributeView view = file.getFileAttributeView(s[0]);
- if (view == null)
- throw new UnsupportedOperationException("View '" + s[0] + "' not available");
- view.setAttribute(s[1], value);
- }
-
- /**
- * Reads the value of a file attribute.
- *
- * <p> The {@code attribute} parameter identifies the attribute to be read
- * and takes the form:
- * <blockquote>
- * [<i>view-name</i><b>:</b>]<i>attribute-name</i>
- * </blockquote>
- * where square brackets [...] delineate an optional component and the
- * character {@code ':'} stands for itself.
- *
- * <p> <i>view-name</i> is the {@link FileAttributeView#name name} of a {@link
- * FileAttributeView} that identifies a set of file attributes. If not
- * specified then it defaults to {@code "basic"}, the name of the file
- * attribute view that identifies the basic set of file attributes common to
- * many file systems. <i>attribute-name</i> is the name of the attribute.
- *
- * <p> The {@code options} array may be used to indicate how symbolic links
- * are handled for the case that the file is a symbolic link. By default,
- * symbolic links are followed and the file attribute of the final target
- * of the link is read. If the option {@link LinkOption#NOFOLLOW_LINKS
- * NOFOLLOW_LINKS} is present then symbolic links are not followed and so
- * the method returns the file attribute of the symbolic link.
- *
- * <p> <b>Usage Example:</b>
- * Suppose we require the user ID of the file owner on a system that
- * supports a "{@code unix}" view:
- * <pre>
- * int uid = (Integer)Attributes.getAttribute(file, "unix:uid");
- * </pre>
- *
- * @param file
- * A file reference that locates the file
- * @param attribute
- * The attribute to read
- * @param options
- * Options indicating how symbolic links are handled
- *
- * @return The attribute value, or {@code null} if the attribute view
- * is not available or it does not support reading the attribute
- *
- * @throws IOException
- * If an I/O error occurs
- * @throws SecurityException
- * In the case of the default provider, and a security manager is
- * installed, its {@link SecurityManager#checkRead(String) checkRead}
- * method denies read access to the file. If this method is invoked
- * to read security sensitive attributes then the security manager
- * may be invoked to check for additional permissions.
- */
- public static Object getAttribute(FileRef file,
- String attribute,
- LinkOption... options)
- throws IOException
- {
- String[] s = split(attribute);
- FileAttributeView view = file.getFileAttributeView(s[0], options);
- if (view != null)
- return view.getAttribute(s[1]);
- // view not available
- return null;
- }
-
- /**
- * Reads a set of file attributes as a bulk operation.
- *
- * <p> The {@code attributes} parameter identifies the attributes to be read
- * and takes the form:
- * <blockquote>
- * [<i>view-name</i><b>:</b>]<i>attribute-list</i>
- * </blockquote>
- * where square brackets [...] delineate an optional component and the
- * character {@code ':'} stands for itself.
- *
- * <p> <i>view-name</i> is the {@link FileAttributeView#name name} of a {@link
- * FileAttributeView} that identifies a set of file attributes. If not
- * specified then it defaults to {@code "basic"}, the name of the file
- * attribute view that identifies the basic set of file attributes common to
- * many file systems.
- *
- * <p> The <i>attribute-list</i> component is a comma separated list of
- * zero or more names of attributes to read. If the list contains the value
- * {@code "*"} then all attributes are read. Attributes that are not supported
- * are ignored and will not be present in the returned map. It is
- * implementation specific if all attributes are read as an atomic operation
- * with respect to other file system operations.
- *
- * <p> The following examples demonstrate possible values for the {@code
- * attributes} parameter:
- *
- * <blockquote>
- * <table border="0">
- * <tr>
- * <td> {@code "*"} </td>
- * <td> Read all {@link BasicFileAttributes basic-file-attributes}. </td>
- * </tr>
- * <tr>
- * <td> {@code "size,lastModifiedTime,lastAccessTime"} </td>
- * <td> Reads the file size, last modified time, and last access time
- * attributes. </td>
- * </tr>
- * <tr>
- * <td> {@code "posix:*"} </td>
- * <td> Read all {@link PosixFileAttributes POSIX-file-attributes}.. </td>
- * </tr>
- * <tr>
- * <td> {@code "posix:permissions,owner,size"} </td>
- * <td> Reads the POSX file permissions, owner, and file size. </td>
- * </tr>
- * </table>
- * </blockquote>
- *
- * <p> The {@code options} array may be used to indicate how symbolic links
- * are handled for the case that the file is a symbolic link. By default,
- * symbolic links are followed and the file attributes of the final target
- * of the link are read. If the option {@link LinkOption#NOFOLLOW_LINKS
- * NOFOLLOW_LINKS} is present then symbolic links are not followed and so
- * the method returns the file attributes of the symbolic link.
- *
- * @param file
- * A file reference that locates the file
- * @param attributes
- * The attributes to read
- * @param options
- * Options indicating how symbolic links are handled
- *
- * @return A map of the attributes returned; may be empty. The map's keys
- * are the attribute names, its values are the attribute values
- *
- * @throws IOException
- * If an I/O error occurs
- * @throws SecurityException
- * In the case of the default provider, and a security manager is
- * installed, its {@link SecurityManager#checkRead(String) checkRead}
- * method denies read access to the file. If this method is invoked
- * to read security sensitive attributes then the security manager
- * may be invoke to check for additional permissions.
- */
- public static Map<String,?> readAttributes(FileRef file,
- String attributes,
- LinkOption... options)
- throws IOException
- {
- String[] s = split(attributes);
- FileAttributeView view = file.getFileAttributeView(s[0], options);
- if (view != null) {
- // further split attributes into the first and rest.
- String[] names = s[1].split(",");
- int rem = names.length-1;
- String first = names[0];
- String[] rest = new String[rem];
- if (rem > 0) System.arraycopy(names, 1, rest, 0, rem);
-
- return view.readAttributes(first, rest);
- }
- // view not available
- return Collections.emptyMap();
- }
+ private Attributes() { }
/**
* Reads the basic file attributes of a file.
@@ -551,29 +312,28 @@ public final class Attributes {
}
/**
- * Updates the value of a file's last modified time attribute.
- *
- * <p> The time value is measured since the epoch
- * (00:00:00 GMT, January 1, 1970) and is converted to the precision supported
- * by the file system. Converting from finer to coarser granularities result
- * in precision loss.
- *
- * <p> If the file system does not support a last modified time attribute then
- * this method has no effect.
- *
- * @param file
- * A file reference that locates the file
- *
+ * Updates a file's last modified time attribute. The file time is converted
+ * to the epoch and precision supported by the file system. Converting from
+ * finer to coarser granularities result in precision loss. The behavior of
+ * this method when attempting to set a timestamp to a value that is outside
+ * the range supported by the underlying file store is not defined. It may
+ * or not fail by throwing an {@code IOException}.
+ *
+ * <p> If the file system does not support a last modified time attribute
+ * then this method has no effect.
+ *
+ * <p> <b>Usage Example:</b>
+ * Suppose we want to set the last modified time to the current time:
+ * <pre>
+ * FileTime now = FileTime.fromMillis(System.currentTimeMillis());
+ * Attributes.setLastModifiedTime(file, now);
+ * </pre>
+ *
+ * @param file
+ * A file reference that locates the file
* @param lastModifiedTime
- * The new last modified time, or {@code -1L} to update it to
- * the current time
- * @param unit
- * A {@code TimeUnit} determining how to interpret the
- * {@code lastModifiedTime} parameter
- *
- * @throws IllegalArgumentException
- * If the {@code lastModifiedime} parameter is a negative value other
- * than {@code -1L}
+ * The new last modified time
+ *
* @throws IOException
* If an I/O error occurs
* @throws SecurityException
@@ -584,35 +344,31 @@ public final class Attributes {
* @see BasicFileAttributeView#setTimes
*/
public static void setLastModifiedTime(FileRef file,
- long lastModifiedTime,
- TimeUnit unit)
- throws IOException
- {
+ FileTime lastModifiedTime)
+ throws IOException
+ {
+ if (lastModifiedTime == null)
+ throw new NullPointerException("'lastModifiedTime' is null");
file.getFileAttributeView(BasicFileAttributeView.class)
- .setTimes(lastModifiedTime, null, null, unit);
- }
-
- /**
- * Updates the value of a file's last access time attribute.
- *
- * <p> The time value is measured since the epoch
- * (00:00:00 GMT, January 1, 1970) and is converted to the precision supported
- * by the file system. Converting from finer to coarser granularities result
- * in precision loss.
+ .setTimes(lastModifiedTime, null, null);
+ }
+
+ /**
+ * Updates a file's last access time attribute. The file time is converted
+ * to the epoch and precision supported by the file system. Converting from
+ * finer to coarser granularities result in precision loss. The behavior of
+ * this method when attempting to set a timestamp to a value that is outside
+ * the range supported by the underlying file store is not defined. It may
+ * or not fail by throwing an {@code IOException}.
*
* <p> If the file system does not support a last access time attribute then
* this method has no effect.
*
+ * @param file
+ * A file reference that locates the file
* @param lastAccessTime
- * The new last access time, or {@code -1L} to update it to
- * the current time
- * @param unit
- * A {@code TimeUnit} determining how to interpret the
- * {@code lastModifiedTime} parameter
- *
- * @throws IllegalArgumentException
- * If the {@code lastAccessTime} parameter is a negative value other
- * than {@code -1L}
+ * The new last access time
+ *
* @throws IOException
* If an I/O error occurs
* @throws SecurityException
@@ -623,12 +379,13 @@ public final class Attributes {
* @see BasicFileAttributeView#setTimes
*/
public static void setLastAccessTime(FileRef file,
- long lastAccessTime,
- TimeUnit unit)
- throws IOException
- {
+ FileTime lastAccessTime)
+ throws IOException
+ {
+ if (lastAccessTime == null)
+ throw new NullPointerException("'lastAccessTime' is null");
file.getFileAttributeView(BasicFileAttributeView.class)
- .setTimes(null, lastAccessTime, null, unit);
+ .setTimes(null, lastAccessTime, null);
}
/**
--- a/src/share/classes/java/nio/file/attribute/BasicFileAttributeView.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/attribute/BasicFileAttributeView.java Thu Jul 23 11:29:49 2009 -0700
@@ -25,7 +25,6 @@
package java.nio.file.attribute;
-import java.util.concurrent.TimeUnit;
import java.io.IOException;
/**
@@ -49,19 +48,15 @@ import java.io.IOException;
* </tr>
* <tr>
* <td> "lastModifiedTime" </td>
- * <td> {@link Long} </td>
+ * <td> {@link FileTime} </td>
* </tr>
* <tr>
* <td> "lastAccessTime" </td>
- * <td> {@link Long} </td>
+ * <td> {@link FileTime} </td>
* </tr>
* <tr>
* <td> "creationTime" </td>
- * <td> {@link Long} </td>
- * </tr>
- * <tr>
- * <td> "resolution" </td>
- * <td> {@link java.util.concurrent.TimeUnit} </td>
+ * <td> {@link FileTime} </td>
* </tr>
* <tr>
* <td> "size" </td>
@@ -84,26 +79,19 @@ import java.io.IOException;
* <td> {@link Boolean} </td>
* </tr>
* <tr>
- * <td> "linkCount" </td>
- * <td> {@link Integer} </td>
- * </tr>
- * <tr>
* <td> "fileKey" </td>
* <td> {@link Object} </td>
* </tr>
* </table>
* </blockquote>
*
- * <p> The {@link #getAttribute getAttribute} or {@link
- * #readAttributes(String,String[]) readAttributes(String,String[])} methods may
- * be used to read any of these attributes as if by invoking the {@link
+ * <p> The {@link java.nio.file.FileRef#getAttribute getAttribute} method may be
+ * used to read any of these attributes as if by invoking the {@link
* #readAttributes() readAttributes()} method.
*
- * <p> The {@link #setAttribute setAttribute} method may be used to update the
- * file's last modified time, last access time or create time attributes as if
- * by invoking the {@link #setTimes setTimes} method. In that case, the time
- * value is interpreted in {@link TimeUnit#MILLISECONDS milliseconds} and
- * converted to the precision supported by the file system.
+ * <p> The {@link java.nio.file.FileRef#setAttribute setAttribute} method may be
+ * used to update the file's last modified time, last access time or create time
+ * attributes as if by invoking the {@link #setTimes setTimes} method.
*
* @since 1.7
* @see Attributes
@@ -141,11 +129,11 @@ public interface BasicFileAttributeView
* and create time attributes.
*
* <p> This method updates the file's timestamp attributes. The values are
- * measured since the epoch (00:00:00 GMT, January 1, 1970) and converted to
- * the precision supported by the file system. Converting from finer to
- * coarser granularities result in precision loss. If a value is larger
- * than the maximum supported by the file system then the corresponding
- * timestamp is set to its maximum value.
+ * converted to the epoch and precision supported by the file system.
+ * Converting from finer to coarser granularities result in precision loss.
+ * The behavior of this method when attempting to set a timestamp to a value
+ * that is outside the range supported by the underlying file store is not
+ * defined. It may or not fail by throwing an {@code IOException}.
*
* <p> If any of the {@code lastModifiedTime}, {@code lastAccessTime},
* or {@code createTime} parameters has the value {@code null} then the
@@ -153,25 +141,19 @@ public interface BasicFileAttributeView
* read the existing values of the file attributes when only some, but not
* all, of the timestamp attributes are updated. Consequently, this method
* may not be an atomic operation with respect to other file system
- * operations. If all of the {@code lastModifiedTime}, {@code
+ * operations. Reading and re-writing existing values may also result in
+ * precision loss. If all of the {@code lastModifiedTime}, {@code
* lastAccessTime} and {@code createTime} parameters are {@code null} then
* this method has no effect.
*
* @param lastModifiedTime
- * the new last modified time, or {@code -1L} to update it to
- * the current time, or {@code null} to not change the attribute
+ * the new last modified time, or {@code null} to not change the
+ * value
* @param lastAccessTime
- * the last access time, or {@code -1L} to update it to
- * the current time, or {@code null} to not change the attribute.
+ * the last access time, or {@code null} to not change the value
* @param createTime
- * the file's create time, or {@code -1L} to update it to
- * the current time, or {@code null} to not change the attribute
- * @param unit
- * a {@code TimeUnit} determining how to interpret the time values
+ * the file's create time, or {@code null} to not change the value
*
- * @throws IllegalArgumentException
- * if any of the parameters is a negative value other than {@code
- * -1L}
* @throws IOException
* if an I/O error occurs
* @throws SecurityException
@@ -179,8 +161,7 @@ public interface BasicFileAttributeView
* installed, its {@link SecurityManager#checkWrite(String) checkWrite}
* method is invoked to check write access to the file
*/
- void setTimes(Long lastModifiedTime,
- Long lastAccessTime,
- Long createTime,
- TimeUnit unit) throws IOException;
+ void setTimes(FileTime lastModifiedTime,
+ FileTime lastAccessTime,
+ FileTime createTime) throws IOException;
}
--- a/src/share/classes/java/nio/file/attribute/BasicFileAttributes.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/attribute/BasicFileAttributes.java Thu Jul 23 11:29:49 2009 -0700
@@ -25,8 +25,6 @@
package java.nio.file.attribute;
-import java.util.concurrent.TimeUnit;
-
/**
* Basic attributes associated with a file in a file system.
*
@@ -50,47 +48,27 @@ public interface BasicFileAttributes {
/**
* Returns the time of last modification.
*
- * <p> The {@link #resolution() resolution} method returns the {@link TimeUnit}
- * to interpret the return value of this method.
- *
- * @return a <code>long</code> value representing the time the file was
- * last modified since the epoch (00:00:00 GMT, January 1, 1970),
- * or {@code -1L} if the attribute is not supported.
+ * @return a {@code FileTime} representing the time the file was last
+ * modified or {@code null} if the attribute is not supported.
*/
- long lastModifiedTime();
+ FileTime lastModifiedTime();
/**
* Returns the time of last access if supported.
*
- * <p> The {@link #resolution() resolution} method returns the {@link TimeUnit}
- * to interpret the return value of this method.
- *
- * @return a <code>long</code> value representing the time of last access
- * since the epoch (00:00:00 GMT, January 1, 1970), or {@code -1L}
- * if the attribute is not supported.
+ * @return a {@code FileTime} representing the time of last access or
+ * {@code null} if the attribute is not supported.
*/
- long lastAccessTime();
+ FileTime lastAccessTime();
/**
* Returns the creation time if supported. The creation time is the time
* that the file was created.
*
- * <p> The {@link #resolution() resolution} method returns the {@link TimeUnit}
- * to interpret the return value of this method.
- *
- * @return a <code>long</code> value representing the time the file was
- * created since the epoch (00:00:00 GMT, January 1, 1970), or
- * {@code -1L} if the attribute is not supported.
+ * @return a {@code FileTime} representing the time the file was created
+ * or {@code null} if the attribute is not supported.
*/
- long creationTime();
-
- /**
- * Returns the {@link TimeUnit} required to interpret the time of last
- * modification, time of last access, and creation time.
- *
- * @return the {@code TimeUnit} required to interpret the file time stamps
- */
- TimeUnit resolution();
+ FileTime creationTime();
/**
* Tells whether the file is a regular file with opaque content.
@@ -125,18 +103,6 @@ public interface BasicFileAttributes {
long size();
/**
- * Returns the number of <em>links</em> to this file.
- *
- * <p> On file systems where the same file may be in several directories then
- * the link count is the number of directory entries for the file. The return
- * value is {@code 1} on file systems that only allow a file to have a
- * single name in a single directory.
- *
- * @see java.nio.file.Path#createLink
- */
- int linkCount();
-
- /**
* Returns an object that uniquely identifies the given file, or {@code
* null} if a file key is not available. On some platforms or file systems
* it is possible to use an identifier, or a combination of identifiers to
@@ -154,7 +120,7 @@ public interface BasicFileAttributes {
*
* <p> File keys returned by this method can be compared for equality and are
* suitable for use in collections. If the file system and files remain static,
- * and two files are the {@link java.nio.file.FileRef#isSameFile same} with
+ * and two files are the {@link java.nio.file.Path#isSameFile same} with
* non-{@code null} file keys, then their file keys are equal.
*
* @see java.nio.file.Files#walkFileTree
--- a/src/share/classes/java/nio/file/attribute/DosFileAttributeView.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/attribute/DosFileAttributeView.java Thu Jul 23 11:29:49 2009 -0700
@@ -65,17 +65,17 @@ import java.io.IOException;
* </table>
* </blockquote>
*
- * <p> The {@link #getAttribute getAttribute} or {@link #readAttributes(String,String[])
- * readAttributes(String,String[])} methods may be used to read any of these
- * attributes, or any of the attributes defined by {@link BasicFileAttributeView}
- * as if by invoking the {@link #readAttributes readAttributes()} method.
+ * <p> The {@link java.nio.file.FileRef#getAttribute getAttribute} method may
+ * be used to read any of these attributes, or any of the attributes defined by
+ * {@link BasicFileAttributeView} as if by invoking the {@link #readAttributes
+ * readAttributes()} method.
*
- * <p> The {@link #setAttribute setAttribute} method may be used to update the
- * file's last modified time, last access time or create time attributes as
- * defined by {@link BasicFileAttributeView}. It may also be used to update
- * the DOS attributes as if by invoking the {@link #setReadOnly setReadOnly},
- * {@link #setHidden setHidden}, {@link #setSystem setSystem}, and {@link
- * #setArchive setArchive} methods respectively.
+ * <p> The {@link java.nio.file.FileRef#setAttribute setAttribute} method may
+ * be used to update the file's last modified time, last access time or create
+ * time attributes as defined by {@link BasicFileAttributeView}. It may also be
+ * used to update the DOS attributes as if by invoking the {@link #setReadOnly
+ * setReadOnly}, {@link #setHidden setHidden}, {@link #setSystem setSystem}, and
+ * {@link #setArchive setArchive} methods respectively.
*
* @since 1.7
*/
--- a/src/share/classes/java/nio/file/attribute/FileAttributeView.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/attribute/FileAttributeView.java Thu Jul 23 11:29:49 2009 -0700
@@ -34,7 +34,6 @@ package java.nio.file.attribute;
* @since 1.7
*
* @see java.nio.file.FileRef#getFileAttributeView(Class,java.nio.file.LinkOption[])
- * @see java.nio.file.FileRef#getFileAttributeView(String,java.nio.file.LinkOption[])
*/
public interface FileAttributeView
--- a/src/share/classes/java/nio/file/attribute/FileOwnerAttributeView.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/attribute/FileOwnerAttributeView.java Thu Jul 23 11:29:49 2009 -0700
@@ -37,11 +37,11 @@ import java.io.IOException;
* <p> The {@link #getOwner getOwner} or {@link #setOwner setOwner} methods may
* be used to read or update the owner of the file.
*
- * <p> Where dynamic access to file attributes is required, the owner attribute
- * is identified by the name {@code "owner"}, and the value of the attribute is
- * a {@link UserPrincipal}. The {@link #readAttributes readAttributes}, {@link
- * #getAttribute getAttribute} and {@link #setAttribute setAttributes} methods
- * may be used to read or update the file owner.
+ * <p> The {@link java.nio.file.FileRef#getAttribute getAttribute} and
+ * {@link java.nio.file.FileRef#setAttribute setAttribute} methods may also be
+ * used to read or update the owner. In that case, the owner attribute is
+ * identified by the name {@code "owner"}, and the value of the attribute is
+ * a {@link UserPrincipal}.
*
* @since 1.7
*/
--- a/src/share/classes/java/nio/file/attribute/FileStoreSpaceAttributeView.java Tue Jun 30 17:12:32 2009 -0700
+++ b/src/share/classes/java/nio/file/attribute/FileStoreSpaceAttributeView.java Thu Jul 23 11:29:49 2009 -0700
@@ -52,10 +52,8 @@ import java.io.IOException;
* </tr>
* </table>
* </blockquote>
- * <p> The {@link #getAttribute getAttribute} or {@link #readAttributes
- * readAttributes(String,String[])} methods may be used to read any of these
- * attributes as if by invoking the {@link #readAttributes readAttributes()}
- * method.