提交 b290dd28 编写于 作者: L lana

Merge

#
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# Variable definitions for SE Embedded builds. This file should
# not contain rules.
#
ifdef JAVASE_EMBEDDED
# Compress jar files
COMPRESS_JARS = true
# Don't mmap zip files
LIBZIP_CAN_USE_MMAP = false
# Disable ALSA version check
REQUIRED_ALSA_VERSION =
# Compilation settings
OTHER_CPPFLAGS += -DJAVASE_EMBEDDED
# Product naming
PRODUCT_SUFFIX = SE Runtime Environment for Embedded
RUNTIME_NAME = $(PRODUCT_NAME) $(PRODUCT_SUFFIX)
# Reduced JRE locations
JRE_REDUCED_HEADLESS_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2re-reduced-headless-image
JRE_REDUCED_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2re-reduced-image
endif # JAVASE_EMBEDDED
...@@ -115,6 +115,12 @@ endif ...@@ -115,6 +115,12 @@ endif
include $(JDK_TOPDIR)/make/common/Defs-$(PLATFORM).gmk include $(JDK_TOPDIR)/make/common/Defs-$(PLATFORM).gmk
#
# SE-Embedded support, if enabled
#
include $(JDK_TOPDIR)/make/common/Defs-embedded.gmk
# #
# Cross-compilation Settings # Cross-compilation Settings
# #
...@@ -144,7 +150,6 @@ ifdef BUILD_CLIENT_ONLY ...@@ -144,7 +150,6 @@ ifdef BUILD_CLIENT_ONLY
VM_NAME = client VM_NAME = client
endif endif
# #
# Freetype logic is applicable to OpenJDK only # Freetype logic is applicable to OpenJDK only
# #
......
# #
# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -78,7 +78,7 @@ LINKER=$(LINK.c) ...@@ -78,7 +78,7 @@ LINKER=$(LINK.c)
endif endif
$(ACTUAL_LIBRARY):: $(INIT) $(TEMPDIR) $(LIBDIR) $(BINDIR) $(EXTDIR) classheaders $(ACTUAL_LIBRARY):: $(INIT) $(TEMPDIR) $(LIBDIR) $(BINDIR) $(EXTDIR) classheaders
@$(ECHO) Building lib:$(ACTUAL_LIBRARY)
# #
# COMPILE_APPROACH: Different approaches to compile up the native object # COMPILE_APPROACH: Different approaches to compile up the native object
# files as quickly as possible. # files as quickly as possible.
......
#
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# SE-Embedded Reduced JRE targets
#
ifdef JAVASE_EMBEDDED
reduced-image-jre reduced-headless-image-jre ::
@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
# Add the reduced-jre images as pre-reqs. These will be processed last
images:: reduced-image-jre reduced-headless-image-jre
######################################################
# Create the headless rt.jar
######################################################
NOT_HEADLESS_RT_JAR_LIST = $(ABS_TEMPDIR)/not_hl_rt_jar.list
HEADLESS_RT_JAR_FILELIST=$(JARFILELISTS_TEMPDIR)/hl_rt_jar_list
TOTAL_HEADLESS_JAR_FILELIST=$(REORDER_TEMPDIR)/hl_file_list
HEADLESS_CLASSLIST=$(ABS_TEMPDIR)/headless_classlist
# Add the jar file directories that we don't want in the
# headless JRE. If you want to remove most classes in a
# directory, put the directory in the NOT_HEADLESS_RT_JAR_LIST
# and put the individual classes you want to keep in the
# HEADLESS_CLASSLIST file.
$(NOT_HEADLESS_RT_JAR_LIST): $(NOT_RT_JAR_LIST)
$(RM) $(HEADLESS_CLASSLIST)
$(RM) $(NOT_HEADLESS_RT_JAR_LIST)
$(CP) $(NOT_RT_JAR_LIST) $(NOT_HEADLESS_RT_JAR_LIST)
$(ECHO) "sun/awt/motif/" >> $@
$(ECHO) "sun/awt/X11/" >> $@
$(ECHO) "sun/applet/" >> $@
$(ECHO) "sun/java2d/opengl/" >> $@
$(ECHO) "com/sun/java/swing/plaf/" >> $@
$(ECHO) "sun/awt/motif/MFontConfiguration" >$(HEADLESS_CLASSLIST)
$(ECHO) "sun/applet/AppContextCreator" >>$(HEADLESS_CLASSLIST)
$(ECHO) "sun/applet/AppletAudioClip" >>$(HEADLESS_CLASSLIST)
$(ECHO) "sun/java2d/opengl/GLXSurfaceData" >>$(HEADLESS_CLASSLIST)
$(ECHO) "sun/java2d/opengl/GLXSurfaceData"\$$"GLXOffScreenSurfaceData" >>$(HEADLESS_CLASSLIST)
$(ECHO) "sun/java2d/opengl/GLXVolatileSurfaceManager" >>$(HEADLESS_CLASSLIST)
$(ECHO) "sun/java2d/opengl/OGLSurfaceData" >>$(HEADLESS_CLASSLIST)
$(TOTAL_HEADLESS_JAR_FILELIST): $(JARREORDER_JARFILE) $(NOT_HEADLESS_RT_JAR_LIST)
$(prep-target)
$(RM) $@.temp
$(CD) $(CLASSBINDIR) ; \
$(BOOT_JAVA_CMD) -jar $(JARREORDER_JARFILE) \
-o $@.temp $(HEADLESS_CLASSLIST) $(NOT_HEADLESS_RT_JAR_LIST) .
$(MV) $@.temp $@
@$(CD) $(CLASSBINDIR); $(java-vm-cleanup)
# Create the headless rt.jar file list & non-class files list
MakeHeadlessJarFileList: $(TOTAL_HEADLESS_JAR_FILELIST) $(JARSPLIT_JARFILE)
@$(RM) $(HEADLESS_RT_JAR_FILELIST) $(RES_JAR_FILELIST)
$(BOOT_JAVA_CMD) -jar $(JARSPLIT_JARFILE) $(TOTAL_HEADLESS_JAR_FILELIST) \
-o $(HEADLESS_RT_JAR_FILELIST) $(RES_JAR_FILELIST)
@$(java-vm-cleanup)
# Create headless rt.jar
HL_RT_JAR=$(ABS_TEMPDIR)/rt-hl-orig.jar
$(HL_RT_JAR): MakeHeadlessJarFileList $(JAR_MANIFEST_FILE)
$(prep-target)
$(CD) $(CLASSBINDIR) ; \
$(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(JAR_MANIFEST_FILE) $@ @$(HEADLESS_RT_JAR_FILELIST) \
$(JAR_JFLAGS)
@$(CD) $(CLASSBINDIR); $(java-vm-cleanup)
#
# Produce a reduced Headful JRE for Embedded Devices
#
# The deployment binaries are added during the deployment build process
#
# Binaries that don't get included in reduced jre image bin directory
NOT_REDUCEDJRE_BIN = \
java_vm \
kinit \
klist \
ktab \
orbd \
policytool \
rmid \
rmiregistry \
servertool \
tnameserv \
pack200 \
unpack200
# jars/resources/libs that don't get included in reduced jre image lib directory
NOT_REDUCEDJRE_LIB = \
charsets.jar \
ext/dnsns.jar \
ext/localedata.jar \
$(LIBARCH)/client/classes.jsa \
$(LIBARCH)/libjavaplugin_jni.so \
$(LIBARCH)/libjavaplugin_nscp_gcc29.so \
$(LIBARCH)/libjavaplugin_nscp.so \
$(LIBARCH)/libjavaplugin_oji.so
ifeq ($(PLATFORM), linux)
STRIP_OPTS = --strip-unneeded
else
STRIP_OPTS = -x
endif
reduced-image-jre::
@$(ECHO) Starting to Produce Reduced JRE
@#
@# First make a copy of the full JRE
@#
$(RM) -r $(JRE_REDUCED_IMAGE_DIR)
$(MKDIR) -p $(JRE_REDUCED_IMAGE_DIR)
$(CD) $(JRE_IMAGE_DIR); \
$(TAR) cf - . | ($(CD) $(JRE_REDUCED_IMAGE_DIR); $(TAR) xf - );
@# strip the main .so files
$(STRIP) $(STRIP_OPTS) $(JRE_REDUCED_IMAGE_DIR)/lib/$(LIBARCH)/client/libjvm.so
ifndef BUILD_CLIENT_ONLY
$(STRIP) $(STRIP_OPTS) $(JRE_REDUCED_IMAGE_DIR)/lib/$(LIBARCH)/server/libjvm.so
endif
@#
@# Remove all of the files that are not needed for the
@# reduced JRE
@#
for l in $(NOT_REDUCEDJRE_BIN) ; do \
$(RM) $(JRE_REDUCED_IMAGE_DIR)/bin/$$l ; \
done
for l in $(NOT_REDUCEDJRE_LIB) ; do \
$(RM) $(JRE_REDUCED_IMAGE_DIR)/lib/$$l ; \
done
@# Remove misc. other files
$(RM) -r $(JRE_REDUCED_IMAGE_DIR)/man
$(RM) -f $(JRE_REDUCED_IMAGE_DIR)/CHANGES
@$(ECHO) Done Creating Reduced JRE
#
# Produce a reduced Headless JRE
#
reduced-headless-image-jre:: $(RT_JAR) $(RESOURCES_JAR) $(BUILD_META_INDEX) $(HL_RT_JAR)
@$(ECHO) Starting to Produce Reduced Headless JRE
@#
@# First make a copy of the reduced JRE we just built
@#
$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)
$(MKDIR) -p $(JRE_REDUCED_HEADLESS_IMAGE_DIR)
$(CD) $(JRE_REDUCED_IMAGE_DIR); \
$(TAR) cf - . | ($(CD) $(JRE_REDUCED_HEADLESS_IMAGE_DIR); $(TAR) xf - );
@# Replace the full rt.jar with the headless rt.jar
$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/rt.jar
$(CP) $(HL_RT_JAR) $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/rt.jar
@#
@# Remove all of the files that are not needed for the
@# reduced Headless JRE
@#
$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/gtkhelper
$(RM) $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/libjsoundalsa.so
$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/audio
$(RM) -fr $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/applet
$(RM) $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/awt_robot
$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/xawt
$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/libsplashscreen.so
@# Remove oblique fonts and reduce font support to LucidaSansRegular only
$(RM) -fr $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/oblique-fonts
$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightDemiBold.ttf
$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightDemiItalic.ttf
$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightItalic.ttf
$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightRegular.ttf
$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaSansDemiBold.ttf
$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaTypewriterBold.ttf
$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaTypewriterRegular.ttf
ifeq ($(PLATFORM), linux)
# put out minimal fonts.dir file for the remaining font
$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
$(ECHO) 6>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-1">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-2">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-4">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-5">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-7">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-9">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
endif # Linux
@#
@# all done with JRE reduced headless image
@#
@$(ECHO) Done Creating Reduced Headless JRE
images-clobber::
$(RM) -r $(JRE_REDUCED_IMAGE_DIR)
$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)
.PHONY: reduced-image-jre reduced-headless-image-jre
endif # JAVASE_EMBEDDED
...@@ -38,7 +38,7 @@ THIS_JDK_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSIO ...@@ -38,7 +38,7 @@ THIS_JDK_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSIO
IMAGE_BINDIR = bin IMAGE_BINDIR = bin
# The compiler should not issue a "Sun Propietary" warning when compiling # The compiler should not issue a "Proprietary" warning when compiling
# classes in the com.sun.java.swing.plaf packages, since we've always # classes in the com.sun.java.swing.plaf packages, since we've always
# allowed, and even advocated, extending them (see bug 6476749). # allowed, and even advocated, extending them (see bug 6476749).
# #
...@@ -195,6 +195,16 @@ if [ "$(JA_DIRNAME)" != "" ] ; then \ ...@@ -195,6 +195,16 @@ if [ "$(JA_DIRNAME)" != "" ] ; then \
fi fi
endef endef
# no compression unless requested
ifndef COMPRESS_JARS
CREATE_JAR_OPTS = c0mf
CREATE_JAR_OPTS_NOMANIFEST = c0f
else
CREATE_JAR_OPTS = cmf
CREATE_JAR_OPTS_NOMANIFEST = cf
endif
# #
# Targets. # Targets.
# #
...@@ -613,7 +623,7 @@ RESOURCES_JAR=$(ABS_TEMPDIR)/resources-orig.jar ...@@ -613,7 +623,7 @@ RESOURCES_JAR=$(ABS_TEMPDIR)/resources-orig.jar
$(RESOURCES_JAR): $(RES_JAR_FILELIST) $(JAR_MANIFEST_FILE) $(RESOURCES_JAR): $(RES_JAR_FILELIST) $(JAR_MANIFEST_FILE)
$(prep-target) $(prep-target)
$(CD) $(CLASSBINDIR) && \ $(CD) $(CLASSBINDIR) && \
$(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \ $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(JAR_MANIFEST_FILE) $@ \
@$(RES_JAR_FILELIST) $(BOOT_JAR_JFLAGS) @$(RES_JAR_FILELIST) $(BOOT_JAR_JFLAGS)
@$(CD) $(CLASSBINDIR) && $(java-vm-cleanup) @$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
...@@ -622,7 +632,7 @@ JSSE_JAR=$(ABS_TEMPDIR)/jsse-orig.jar ...@@ -622,7 +632,7 @@ JSSE_JAR=$(ABS_TEMPDIR)/jsse-orig.jar
$(JSSE_JAR): $(JAR_MANIFEST_FILE) $(JSSE_JAR): $(JAR_MANIFEST_FILE)
$(prep-target) $(prep-target)
$(CD) $(CLASSBINDIR) && \ $(CD) $(CLASSBINDIR) && \
$(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \ $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(JAR_MANIFEST_FILE) $@ \
$(JSSE_CLASSES_DIRS) $(BOOT_JAR_JFLAGS) $(JSSE_CLASSES_DIRS) $(BOOT_JAR_JFLAGS)
@$(CD) $(CLASSBINDIR) && $(java-vm-cleanup) @$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
...@@ -669,7 +679,7 @@ RT_JAR=$(ABS_TEMPDIR)/rt-orig.jar ...@@ -669,7 +679,7 @@ RT_JAR=$(ABS_TEMPDIR)/rt-orig.jar
$(RT_JAR): $(RT_JAR_FILELIST) $(JAR_MANIFEST_FILE) $(RT_JAR): $(RT_JAR_FILELIST) $(JAR_MANIFEST_FILE)
$(prep-target) $(prep-target)
$(CD) $(CLASSBINDIR) && \ $(CD) $(CLASSBINDIR) && \
$(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \ $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(JAR_MANIFEST_FILE) $@ \
@$(RT_JAR_FILELIST) $(BOOT_JAR_JFLAGS) @$(RT_JAR_FILELIST) $(BOOT_JAR_JFLAGS)
@$(CD) $(CLASSBINDIR) && $(java-vm-cleanup) @$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
...@@ -677,6 +687,10 @@ $(RT_JAR): $(RT_JAR_FILELIST) $(JAR_MANIFEST_FILE) ...@@ -677,6 +687,10 @@ $(RT_JAR): $(RT_JAR_FILELIST) $(JAR_MANIFEST_FILE)
BUILDMETAINDEX_JARFILE = $(ABS_BUILDTOOLJARDIR)/buildmetaindex.jar BUILDMETAINDEX_JARFILE = $(ABS_BUILDTOOLJARDIR)/buildmetaindex.jar
# SE-Embedded targets if enabled
include $(JDK_TOPDIR)/make/common/Release-embedded.gmk
###################################################### ######################################################
# JRE Image # JRE Image
###################################################### ######################################################
...@@ -924,7 +938,7 @@ initial-image-jdk:: initial-image-jdk-setup \ ...@@ -924,7 +938,7 @@ initial-image-jdk:: initial-image-jdk-setup \
@# lib/tools.jar @# lib/tools.jar
@# @#
$(CD) $(CLASSBINDIR) && \ $(CD) $(CLASSBINDIR) && \
$(BOOT_JAR_CMD) c0f $(ABS_LIBDIR)/tools.jar \ $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS_NOMANIFEST) $(ABS_LIBDIR)/tools.jar \
$(TOOLS) $(BOOT_JAR_JFLAGS) $(TOOLS) $(BOOT_JAR_JFLAGS)
@$(CD) $(CLASSBINDIR) && $(java-vm-cleanup) @$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
$(CP) $(LIBDIR)/tools.jar $(JDK_IMAGE_DIR)/lib/tools.jar $(CP) $(LIBDIR)/tools.jar $(JDK_IMAGE_DIR)/lib/tools.jar
...@@ -937,7 +951,7 @@ initial-image-jdk:: initial-image-jdk-setup \ ...@@ -937,7 +951,7 @@ initial-image-jdk:: initial-image-jdk-setup \
-Acom.sun.tools.javac.sym.Jar=$(RT_JAR) \ -Acom.sun.tools.javac.sym.Jar=$(RT_JAR) \
-Acom.sun.tools.javac.sym.Dest=$(OUTPUTDIR)/symbols/META-INF/sym/rt.jar \ -Acom.sun.tools.javac.sym.Dest=$(OUTPUTDIR)/symbols/META-INF/sym/rt.jar \
$(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) $(EXPORTED_PRIVATE_PKGS) $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) $(EXPORTED_PRIVATE_PKGS)
$(BOOT_JAR_CMD) c0f $(LIBDIR)/ct.sym \ $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS_NOMANIFEST) $(LIBDIR)/ct.sym \
-C $(OUTPUTDIR)/symbols META-INF $(BOOT_JAR_JFLAGS) -C $(OUTPUTDIR)/symbols META-INF $(BOOT_JAR_JFLAGS)
@$(java-vm-cleanup) @$(java-vm-cleanup)
$(CP) $(LIBDIR)/ct.sym $(JDK_IMAGE_DIR)/lib/ct.sym $(CP) $(LIBDIR)/ct.sym $(JDK_IMAGE_DIR)/lib/ct.sym
......
...@@ -185,7 +185,9 @@ ifeq ($(PLATFORM),windows) ...@@ -185,7 +185,9 @@ ifeq ($(PLATFORM),windows)
endif endif
endif endif
ifeq ($(PLATFORM),linux) ifeq ($(PLATFORM),linux)
ifdef REQUIRED_ALSA_VERSION
ALL_SETTINGS+=$(call addRequiredSetting,ALSA_VERSION) ALL_SETTINGS+=$(call addRequiredSetting,ALSA_VERSION)
endif
endif endif
ALL_SETTINGS+=$(call addRequiredVersionSetting,OS_VERSION) ALL_SETTINGS+=$(call addRequiredVersionSetting,OS_VERSION)
ALL_SETTINGS+=$(call addOptionalSetting,OS_VARIANT_NAME) ALL_SETTINGS+=$(call addOptionalSetting,OS_VARIANT_NAME)
......
...@@ -198,10 +198,12 @@ INSTALL_DOT_LIB = true ...@@ -198,10 +198,12 @@ INSTALL_DOT_LIB = true
# #
# What to link? # What to link?
# On Windows, shell32 is not normally required and so it is delay loaded.
# #
ifeq ($(PLATFORM),windows) ifeq ($(PLATFORM),windows)
OTHER_LDLIBS += $(JVMLIB) -libpath:$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) fdlibm.lib \ OTHER_LDLIBS += $(JVMLIB) -libpath:$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) fdlibm.lib \
-libpath:$(OBJDIR)/../../../verify/$(OBJDIRNAME) verify.lib -libpath:$(OBJDIR)/../../../verify/$(OBJDIRNAME) verify.lib \
shell32.lib delayimp.lib /DELAYLOAD:shell32.dll
else else
OTHER_LDLIBS += $(JVMLIB) -lverify $(LIBSOCKET) $(LIBNSL) -ldl \ OTHER_LDLIBS += $(JVMLIB) -lverify $(LIBSOCKET) $(LIBNSL) -ldl \
-L$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) -lfdlibm.$(ARCH) -L$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) -lfdlibm.$(ARCH)
......
...@@ -86,7 +86,8 @@ OTHER_INCLUDES += \ ...@@ -86,7 +86,8 @@ OTHER_INCLUDES += \
-I$(SHARE_SRC)/native/sun/management -I$(SHARE_SRC)/native/sun/management
ifeq ($(PLATFORM),windows) ifeq ($(PLATFORM),windows)
OTHER_LDLIBS += $(JVMLIB) # Need process status helper API (psapi) on Windows
OTHER_LDLIBS += $(JVMLIB) psapi.lib
endif endif
# #
......
...@@ -37,10 +37,6 @@ include FILES_c.gmk ...@@ -37,10 +37,6 @@ include FILES_c.gmk
AUTO_FILES_JAVA_DIRS = java/net AUTO_FILES_JAVA_DIRS = java/net
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
# Windows 9x module only needed on 32-bit build
ifeq ($(ARCH_DATA_MODEL), 32)
FILES_c += NetworkInterface_win9x.c
endif
FILES_c += NTLMAuthSequence.c FILES_c += NTLMAuthSequence.c
FILES_c += NetworkInterface_winXP.c FILES_c += NetworkInterface_winXP.c
else else
...@@ -96,7 +92,9 @@ include $(BUILDDIR)/common/Mapfile-vers.gmk ...@@ -96,7 +92,9 @@ include $(BUILDDIR)/common/Mapfile-vers.gmk
include $(BUILDDIR)/common/Library.gmk include $(BUILDDIR)/common/Library.gmk
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
OTHER_LDLIBS = ws2_32.lib $(JVMLIB) OTHER_LDLIBS = ws2_32.lib $(JVMLIB) \
secur32.lib iphlpapi.lib delayimp.lib \
/DELAYLOAD:secur32.dll /DELAYLOAD:iphlpapi.dll
else else
OTHER_LDLIBS = $(LIBSOCKET) $(LIBNSL) -ldl $(JVMLIB) OTHER_LDLIBS = $(LIBSOCKET) $(LIBNSL) -ldl $(JVMLIB)
endif endif
......
# #
# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -50,7 +50,10 @@ FILES_export = \ ...@@ -50,7 +50,10 @@ FILES_export = \
java/util/jar/JarFile.java java/util/jar/JarFile.java
ifneq ($(PLATFORM), windows) ifneq ($(PLATFORM), windows)
OTHER_CFLAGS += -DUSE_MMAP # Use mmap unless explicitly disallowed
ifneq ($(LIBZIP_CAN_USE_MMAP),false)
OTHER_CFLAGS += -DUSE_MMAP
endif
endif endif
# #
......
...@@ -52,8 +52,11 @@ jprt.build.targets= \ ...@@ -52,8 +52,11 @@ jprt.build.targets= \
${jprt.my.windows.i586}-{product|fastdebug}, \ ${jprt.my.windows.i586}-{product|fastdebug}, \
windows_x64_5.2-{product|fastdebug} windows_x64_5.2-{product|fastdebug}
# User can select the test set with jprt submit "-testset name" option
jprt.my.test.set=${jprt.test.set}
# Standard vm test target # Standard vm test target
jprt.test.targets= \ jprt.vm.default.test.targets= \
solaris_sparc_5.10-product-c1-jvm98, \ solaris_sparc_5.10-product-c1-jvm98, \
solaris_sparcv9_5.10-product-c2-jvm98, \ solaris_sparcv9_5.10-product-c2-jvm98, \
solaris_i586_5.10-product-c1-jvm98, \ solaris_i586_5.10-product-c1-jvm98, \
...@@ -63,8 +66,10 @@ jprt.test.targets= \ ...@@ -63,8 +66,10 @@ jprt.test.targets= \
${jprt.my.windows.i586}-product-c1-jvm98, \ ${jprt.my.windows.i586}-product-c1-jvm98, \
windows_x64_5.2-product-c2-jvm98 windows_x64_5.2-product-c2-jvm98
# User can select the test set with jprt submit "-testset name" option # Select vm testlist to use (allow for testset to be empty too)
jprt.my.test.set=${jprt.test.set} jprt.vm.all.test.targets=${jprt.vm.default.test.targets}
jprt.vm..test.targets=${jprt.vm.default.test.targets}
jprt.test.targets=${jprt.vm.${jprt.my.test.set}.test.targets}
# Default jdk test targets in test/Makefile (no fastdebug & limited c2) # Default jdk test targets in test/Makefile (no fastdebug & limited c2)
jprt.make.rule.default.test.targets= \ jprt.make.rule.default.test.targets= \
...@@ -281,6 +286,21 @@ jprt.make.rule.all.test.targets= \ ...@@ -281,6 +286,21 @@ jprt.make.rule.all.test.targets= \
${jprt.my.windows.i586}-product-c1-jdk_tools2, \ ${jprt.my.windows.i586}-product-c1-jdk_tools2, \
windows_x64_5.2-product-c2-jdk_tools2 windows_x64_5.2-product-c2-jdk_tools2
# JCK test targets in test/Makefile (no fastdebug & limited c2, windows broken)
jprt.my.jck.test.target.set= \
solaris_sparc_5.10-product-c1-JCK7TESTRULE, \
solaris_sparcv9_5.10-product-c2-JCK7TESTRULE, \
solaris_i586_5.10-product-c1-JCK7TESTRULE, \
solaris_x64_5.10-product-c2-JCK7TESTRULE, \
linux_i586_2.6-product-c1-JCK7TESTRULE, \
linux_x64_2.6-product-c2-JCK7TESTRULE
# JCK testset targets (e.g. jprt submit -testset jck ... )
jprt.make.rule.jck.test.targets= \
${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7devtools}, \
${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7runtime}, \
${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7compiler}
# Select list to use (allow for testset to be empty too) # Select list to use (allow for testset to be empty too)
jprt.make.rule..test.targets=${jprt.make.rule.default.test.targets} jprt.make.rule..test.targets=${jprt.make.rule.default.test.targets}
jprt.make.rule.test.targets=${jprt.make.rule.${jprt.my.test.set}.test.targets} jprt.make.rule.test.targets=${jprt.make.rule.${jprt.my.test.set}.test.targets}
......
# #
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -44,8 +44,17 @@ $(MAKE) -f Makefile.launcher \ ...@@ -44,8 +44,17 @@ $(MAKE) -f Makefile.launcher \
endef endef
# Run MAKE $@ for all generic launchers # Run MAKE $@ for all generic launchers
define make-all-launchers ifndef BUILD_HEADLESS_ONLY
define make-appletviewer
$(call make-launcher, appletviewer, sun.applet.Main, , ) $(call make-launcher, appletviewer, sun.applet.Main, , )
endef
else
define make-appletviewer
endef
endif
define make-all-launchers
$(make-appletviewer)
$(call make-launcher, apt, com.sun.tools.apt.Main, , ) $(call make-launcher, apt, com.sun.tools.apt.Main, , )
$(call make-launcher, extcheck, com.sun.tools.extcheck.Main, , ) $(call make-launcher, extcheck, com.sun.tools.extcheck.Main, , )
$(call make-launcher, idlj, com.sun.tools.corba.se.idl.toJavaPortable.Compile, , ) $(call make-launcher, idlj, com.sun.tools.corba.se.idl.toJavaPortable.Compile, , )
......
...@@ -39,7 +39,8 @@ SUBDIRS = \ ...@@ -39,7 +39,8 @@ SUBDIRS = \
Notepad \ Notepad \
SampleTree \ SampleTree \
SwingApplet \ SwingApplet \
TableExample TableExample \
TransparentRuler
# Some demos aren't currently included in OpenJDK # Some demos aren't currently included in OpenJDK
ifndef OPENJDK ifndef OPENJDK
......
#
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# Makefile to build the TransparentRuler demo.
#
BUILDDIR = ../../..
PRODUCT = demo/jfc
DEMONAME = TransparentRuler
include $(BUILDDIR)/common/Defs.gmk
DEMO_ROOT = $(SHARE_SRC)/demo/jfc/$(DEMONAME)
DEMO_TOPFILES = ./README.txt
DEMO_MAINCLASS = transparentruler.Ruler
DEMO_DESTDIR = $(DEMODIR)/jfc/$(DEMONAME)
#
# Demo jar building rules.
#
include $(BUILDDIR)/common/Demo.gmk
# #
# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -69,10 +69,17 @@ endif ...@@ -69,10 +69,17 @@ endif
# nio need to be compiled before awt to have all charsets ready # nio need to be compiled before awt to have all charsets ready
SUBDIRS = jar security javazic misc net nio text launcher SUBDIRS = jar security javazic misc net nio text launcher
ifdef BUILD_HEADLESS_ONLY
DISPLAY_LIBS = awt $(HEADLESS_SUBDIR)
DISPLAY_TOOLS =
else
DISPLAY_LIBS = awt splashscreen $(XAWT_SUBDIR) $(HEADLESS_SUBDIR)
DISPLAY_TOOLS = applet
endif
SUBDIRS_desktop = audio $(RENDER_SUBDIR) image \ SUBDIRS_desktop = audio $(RENDER_SUBDIR) image \
awt splashscreen $(XAWT_SUBDIR) \ $(DISPLAY_LIBS) $(DGA_SUBDIR) \
$(HEADLESS_SUBDIR) $(DGA_SUBDIR) \ jawt font jpeg cmm $(DISPLAY_TOOLS) beans
jawt font jpeg cmm applet beans
SUBDIRS_management = management SUBDIRS_management = management
SUBDIRS_misc = $(ORG_SUBDIR) rmi $(JDBC_SUBDIR) tracing SUBDIRS_misc = $(ORG_SUBDIR) rmi $(JDBC_SUBDIR) tracing
SUBDIRS_tools = native2ascii serialver tools jconsole SUBDIRS_tools = native2ascii serialver tools jconsole
......
# #
# Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -149,13 +149,13 @@ ifeq ($(PLATFORM), linux) ...@@ -149,13 +149,13 @@ ifeq ($(PLATFORM), linux)
LIBXT = -lXt LIBXT = -lXt
else else
# Allows for builds on Debian GNU Linux, X11 is in a different place # Allows for builds on Debian GNU Linux, X11 is in a different place
LIBXT = $(firstword $(wildcard /usr/X11R6/lib/libXt.a) \ LIBXT = $(firstword $(wildcard $(OPENWIN_LIB)/libXt.a) \
$(wildcard /usr/lib/libXt.a)) $(wildcard /usr/lib/libXt.a))
LIBSM = $(firstword $(wildcard /usr/X11R6/lib/libSM.a) \ LIBSM = $(firstword $(wildcard $(OPENWIN_LIB)/libSM.a) \
$(wildcard /usr/lib/libSM.a)) $(wildcard /usr/lib/libSM.a))
LIBICE = $(firstword $(wildcard /usr/X11R6/lib/libICE.a) \ LIBICE = $(firstword $(wildcard $(OPENWIN_LIB)/libICE.a) \
$(wildcard /usr/lib/libICE.a)) $(wildcard /usr/lib/libICE.a))
LIBXTST = $(firstword $(wildcard /usr/X11R6/lib/libXtst.a) \ LIBXTST = $(firstword $(wildcard $(OPENWIN_LIB)/libXtst.a) \
$(wildcard /usr/lib/libXtst.a)) $(wildcard /usr/lib/libXtst.a))
endif endif
endif endif
...@@ -224,9 +224,9 @@ CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/debug \ ...@@ -224,9 +224,9 @@ CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/debug \
$(EVENT_MODEL) $(EVENT_MODEL)
ifeq ($(PLATFORM), linux) ifeq ($(PLATFORM), linux)
# Checking for the X11/extensions headers at the additional location # Checking for the X11/extensions headers at the additional location
CPPFLAGS += -I/X11R6/include/X11/extensions \ CPPFLAGS += -I$(firstword $(wildcard $(OPENWIN_HOME)/include/X11/extensions) \
-I/usr/include/X11/extensions $(wildcard /usr/include/X11/extensions))
endif endif
ifeq ($(PLATFORM), solaris) ifeq ($(PLATFORM), solaris)
......
...@@ -21,4 +21,4 @@ ...@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any # or visit www.oracle.com if you need additional information or have any
# questions. # questions.
# #
tzdata2011d tzdata2011e
...@@ -734,6 +734,48 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou ...@@ -734,6 +734,48 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou
# http://www.timeanddate.com/news/time/morocco-starts-dst-2010.html # http://www.timeanddate.com/news/time/morocco-starts-dst-2010.html
# </a> # </a>
# From Dan Abitol (2011-03-30):
# ...Rules for Africa/Casablanca are the following (24h format)
# The 3rd april 2011 at 00:00:00, [it] will be 3rd april 1:00:00
# The 31th july 2011 at 00:59:59, [it] will be 31th July 00:00:00
# ...Official links of change in morocco
# The change was broadcast on the FM Radio
# I ve called ANRT (telecom regulations in Morocco) at
# +212.537.71.84.00
# <a href="http://www.anrt.net.ma/fr/">
# http://www.anrt.net.ma/fr/
# </a>
# They said that
# <a href="http://www.map.ma/fr/sections/accueil/l_heure_legale_au_ma/view">
# http://www.map.ma/fr/sections/accueil/l_heure_legale_au_ma/view
# </a>
# is the official publication to look at.
# They said that the decision was already taken.
#
# More articles in the press
# <a href="http://www.yabiladi.com/articles/details/5058/secret-l-heure-d-ete-maroc-lev">
# http://www.yabiladi.com/articles/details/5058/secret-l-heure-d-ete-maroc-lev
# </a>
# e.html
# <a href="http://www.lematin.ma/Actualite/Express/Article.asp?id=148923">
# http://www.lematin.ma/Actualite/Express/Article.asp?id=148923
# </a>
# <a href="http://www.lavieeco.com/actualite/Le-Maroc-passe-sur-GMT%2B1-a-partir-de-dim">
# http://www.lavieeco.com/actualite/Le-Maroc-passe-sur-GMT%2B1-a-partir-de-dim
# anche-prochain-5538.html
# </a>
# From Petr Machata (2011-03-30):
# They have it written in English here:
# <a href="http://www.map.ma/eng/sections/home/morocco_to_spring_fo/view">
# http://www.map.ma/eng/sections/home/morocco_to_spring_fo/view
# </a>
#
# It says there that "Morocco will resume its standard time on July 31,
# 2011 at midnight." Now they don't say whether they mean midnight of
# wall clock time (i.e. 11pm UTC), but that's what I would assume. It has
# also been like that in the past.
# RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S # RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Morocco 1939 only - Sep 12 0:00 1:00 S Rule Morocco 1939 only - Sep 12 0:00 1:00 S
...@@ -757,6 +799,8 @@ Rule Morocco 2009 only - Jun 1 0:00 1:00 S ...@@ -757,6 +799,8 @@ Rule Morocco 2009 only - Jun 1 0:00 1:00 S
Rule Morocco 2009 only - Aug 21 0:00 0 - Rule Morocco 2009 only - Aug 21 0:00 0 -
Rule Morocco 2010 only - May 2 0:00 1:00 S Rule Morocco 2010 only - May 2 0:00 1:00 S
Rule Morocco 2010 only - Aug 8 0:00 0 - Rule Morocco 2010 only - Aug 8 0:00 0 -
Rule Morocco 2011 only - Apr 3 0:00 1:00 S
Rule Morocco 2011 only - Jul 31 0 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26 Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26
0:00 Morocco WE%sT 1984 Mar 16 0:00 Morocco WE%sT 1984 Mar 16
......
...@@ -1193,6 +1193,19 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914 ...@@ -1193,6 +1193,19 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914
# From Arthur David Olson (2011-03-02): # From Arthur David Olson (2011-03-02):
# The emol.com article mentions a water shortage as the cause of the # The emol.com article mentions a water shortage as the cause of the
# postponement, which may mean that it's not a permanent change. # postponement, which may mean that it's not a permanent change.
# From Glenn Eychaner (2011-03-28):
# The article:
# <a href="http://diario.elmercurio.com/2011/03/28/_portada/_portada/noticias/7565897A-CA86-49E6-9E03-660B21A4883E.htm?id=3D{7565897A-CA86-49E6-9E03-660B21A4883E}">
# http://diario.elmercurio.com/2011/03/28/_portada/_portada/noticias/7565897A-CA86-49E6-9E03-660B21A4883E.htm?id=3D{7565897A-CA86-49E6-9E03-660B21A4883E}
# </a>
#
# In English:
# Chile's clocks will go back an hour this year on the 7th of May instead
# of this Saturday. They will go forward again the 3rd Saturday in
# August, not in October as they have since 1968. This is a pilot plan
# which will be reevaluated in 2012.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Chile 1927 1932 - Sep 1 0:00 1:00 S Rule Chile 1927 1932 - Sep 1 0:00 1:00 S
Rule Chile 1928 1932 - Apr 1 0:00 0 - Rule Chile 1928 1932 - Apr 1 0:00 0 -
...@@ -1222,13 +1235,16 @@ Rule Chile 1997 only - Mar 30 3:00u 0 - ...@@ -1222,13 +1235,16 @@ Rule Chile 1997 only - Mar 30 3:00u 0 -
Rule Chile 1998 only - Mar Sun>=9 3:00u 0 - Rule Chile 1998 only - Mar Sun>=9 3:00u 0 -
Rule Chile 1998 only - Sep 27 4:00u 1:00 S Rule Chile 1998 only - Sep 27 4:00u 1:00 S
Rule Chile 1999 only - Apr 4 3:00u 0 - Rule Chile 1999 only - Apr 4 3:00u 0 -
Rule Chile 1999 max - Oct Sun>=9 4:00u 1:00 S Rule Chile 1999 2010 - Oct Sun>=9 4:00u 1:00 S
Rule Chile 2011 only - Aug Sun>=16 4:00u 1:00 S
Rule Chile 2012 max - Oct Sun>=9 4:00u 1:00 S
Rule Chile 2000 2007 - Mar Sun>=9 3:00u 0 - Rule Chile 2000 2007 - Mar Sun>=9 3:00u 0 -
# N.B.: the end of March 29 in Chile is March 30 in Universal time, # N.B.: the end of March 29 in Chile is March 30 in Universal time,
# which is used below in specifying the transition. # which is used below in specifying the transition.
Rule Chile 2008 only - Mar 30 3:00u 0 - Rule Chile 2008 only - Mar 30 3:00u 0 -
Rule Chile 2009 only - Mar Sun>=9 3:00u 0 - Rule Chile 2009 only - Mar Sun>=9 3:00u 0 -
Rule Chile 2010 2011 - Apr Sun>=1 3:00u 0 - Rule Chile 2010 only - Apr Sun>=1 3:00u 0 -
Rule Chile 2011 only - May Sun>=2 3:00u 0 -
Rule Chile 2012 max - Mar Sun>=9 3:00u 0 - Rule Chile 2012 max - Mar Sun>=9 3:00u 0 -
# IATA SSIM anomalies: (1992-02) says 1992-03-14; # IATA SSIM anomalies: (1992-02) says 1992-03-14;
# (1996-09) says 1998-03-08. Ignore these. # (1996-09) says 1998-03-08. Ignore these.
......
# #
# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -112,11 +112,20 @@ CPPFLAGS += -I$(OPENWIN_HOME)/include \ ...@@ -112,11 +112,20 @@ CPPFLAGS += -I$(OPENWIN_HOME)/include \
# Libraries to link in. # Libraries to link in.
# #
ifeq ($(PLATFORM), solaris) ifeq ($(PLATFORM), solaris)
OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -L$(OPENWIN_LIB) -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt -L/usr/openwin/sfw/lib$(ISA_DIR) -lXrender ifndef BUILD_HEADLESS_ONLY
OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -L$(OPENWIN_LIB) -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt -L/usr/openwin/sfw/lib$(ISA_DIR) -lXrender
else
OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -L$(OPENWIN_LIB) -L$(LIBDIR)/$(LIBARCH)/headless -lmawt -L/usr/openwin/sfw/lib$(ISA_DIR) -lXrender
endif
endif # PLATFORM endif # PLATFORM
ifeq ($(PLATFORM), linux) ifeq ($(PLATFORM), linux)
OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -lawt -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt ifndef BUILD_HEADLESS_ONLY
OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -lawt -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt
else
OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -lawt -L$(LIBDIR)/$(LIBARCH)/headless -lmawt
CFLAGS += -DHEADLESS
endif
endif # PLATFORM endif # PLATFORM
endif # PLATFORM endif # PLATFORM
......
...@@ -73,9 +73,10 @@ ifeq ($(PLATFORM), linux) ...@@ -73,9 +73,10 @@ ifeq ($(PLATFORM), linux)
# Recommended way to avoid such warning is to declare the variable as # Recommended way to avoid such warning is to declare the variable as
# volatile to prevent the optimization. However, this approach does not # volatile to prevent the optimization. However, this approach does not
# work because we have to declare all variables as volatile in result. # work because we have to declare all variables as volatile in result.
ifndef CROSS_COMPILE_ARCH
OTHER_CFLAGS += -Wno-clobbered OTHER_CFLAGS += -Wno-clobbered
endif endif
endif
include $(BUILDDIR)/common/Mapfile-vers.gmk include $(BUILDDIR)/common/Mapfile-vers.gmk
include $(BUILDDIR)/common/Library.gmk include $(BUILDDIR)/common/Library.gmk
......
# #
# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -120,8 +120,15 @@ $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH): \ ...@@ -120,8 +120,15 @@ $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH): \
$(SHARE_SRC)/classes/sun/nio/cs/ext/$(SERVICE_DESCRIPTION_PATH) $(SHARE_SRC)/classes/sun/nio/cs/ext/$(SERVICE_DESCRIPTION_PATH)
$(install-file) $(install-file)
# no compression unless requested
ifndef COMPRESS_JARS
CREATE_JAR_OPTS_NOMANIFEST = cf0
else
CREATE_JAR_OPTS_NOMANIFEST = cf
endif
$(CHARSETS_JAR): $(FILES_class) $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH) $(FILES_DAT) $(CHARSETS_JAR): $(FILES_class) $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH) $(FILES_DAT)
$(BOOT_JAR_CMD) cf0 $(CHARSETS_JAR) \ $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS_NOMANIFEST) $(CHARSETS_JAR) \
-C $(CLASSDESTDIR) sun \ -C $(CLASSDESTDIR) sun \
-C $(CLASSDESTDIR) $(SERVICE_DESCRIPTION_PATH) \ -C $(CLASSDESTDIR) $(SERVICE_DESCRIPTION_PATH) \
$(BOOT_JAR_JFLAGS) $(BOOT_JAR_JFLAGS)
......
# #
# Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -46,5 +46,7 @@ include $(BUILDDIR)/common/Classes.gmk ...@@ -46,5 +46,7 @@ include $(BUILDDIR)/common/Classes.gmk
build: build:
$(call make-launcher, keytool, sun.security.tools.KeyTool, , ) $(call make-launcher, keytool, sun.security.tools.KeyTool, , )
ifndef BUILD_HEADLESS_ONLY
$(call make-launcher, policytool, sun.security.tools.policytool.PolicyTool, , ) $(call make-launcher, policytool, sun.security.tools.policytool.PolicyTool, , )
endif
# #
# Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -129,10 +129,17 @@ CPPFLAGS += -DXAWT -DXAWT_HACK \ ...@@ -129,10 +129,17 @@ CPPFLAGS += -DXAWT -DXAWT_HACK \
-I$(PLATFORM_SRC)/native/sun/awt -I$(PLATFORM_SRC)/native/sun/awt
ifeq ($(PLATFORM), linux) ifeq ($(PLATFORM), linux)
# Allows for builds on Debian GNU Linux, X11 is in a different place ifndef CROSS_COMPILE_ARCH
# Allows for builds on Debian GNU Linux, X11 is in a different place
# This should really be handled at a higher-level so we don't have to
# work-around this when cross-compiling
CPPFLAGS += -I/usr/X11R6/include/X11/extensions \ CPPFLAGS += -I/usr/X11R6/include/X11/extensions \
-I/usr/include/X11/extensions \ -I/usr/include/X11/extensions \
-I$(OPENWIN_HOME)/include -I$(OPENWIN_HOME)/include
else
CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions \
-I$(OPENWIN_HOME)/include
endif
endif endif
# We have some odd logic here because some Solaris 10 updates # We have some odd logic here because some Solaris 10 updates
...@@ -245,7 +252,11 @@ XLIBTYPES=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/xlibtypes.txt ...@@ -245,7 +252,11 @@ XLIBTYPES=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/xlibtypes.txt
$(SIZERS): $(SIZERS_C) $(SIZERS): $(SIZERS_C)
$(prep-target) $(prep-target)
ifndef CROSS_COMPILE_ARCH
$(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c $(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c
else
$(HOST_CC) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c
endif
$(WRAPPER_GENERATOR_CLASS): $(WRAPPER_GENERATOR_JAVA) $(WRAPPER_GENERATOR_CLASS): $(WRAPPER_GENERATOR_JAVA)
$(prep-target) $(prep-target)
......
# #
# Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -158,6 +158,7 @@ SUNWprivate_1.1 { ...@@ -158,6 +158,7 @@ SUNWprivate_1.1 {
Java_sun_awt_X11_XRobotPeer_mouseReleaseImpl; Java_sun_awt_X11_XRobotPeer_mouseReleaseImpl;
Java_sun_awt_X11_XRobotPeer_mouseWheelImpl; Java_sun_awt_X11_XRobotPeer_mouseWheelImpl;
Java_sun_awt_X11_XRobotPeer_setup; Java_sun_awt_X11_XRobotPeer_setup;
Java_sun_awt_X11_XRobotPeer__1dispose;
Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl; Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl;
Java_java_awt_Component_initIDs; Java_java_awt_Component_initIDs;
Java_java_awt_Container_initIDs; Java_java_awt_Container_initIDs;
...@@ -225,6 +226,7 @@ SUNWprivate_1.1 { ...@@ -225,6 +226,7 @@ SUNWprivate_1.1 {
Java_sun_awt_X11GraphicsConfig_destroyBackBuffer; Java_sun_awt_X11GraphicsConfig_destroyBackBuffer;
Java_sun_awt_X11GraphicsConfig_swapBuffers; Java_sun_awt_X11GraphicsConfig_swapBuffers;
Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable; Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable;
Java_sun_awt_X11_XToolkit_getTrayIconDisplayTimeout;
Java_java_awt_Insets_initIDs; Java_java_awt_Insets_initIDs;
Java_java_awt_KeyboardFocusManager_initIDs; Java_java_awt_KeyboardFocusManager_initIDs;
Java_java_awt_Font_initIDs; Java_java_awt_Font_initIDs;
......
/* /*
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -30,13 +30,14 @@ import java.lang.RuntimePermission; ...@@ -30,13 +30,14 @@ import java.lang.RuntimePermission;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.SocketPermission; import java.net.SocketPermission;
import java.net.URL; import java.net.URL;
import java.security.GeneralSecurityException;
import java.text.MessageFormat;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.ListIterator; import java.util.ListIterator;
import java.util.Vector; import java.util.Vector;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.security.GeneralSecurityException;
import sun.security.util.PropertyExpander; import sun.security.util.PropertyExpander;
/** /**
...@@ -368,8 +369,8 @@ class PolicyParser { ...@@ -368,8 +369,8 @@ class PolicyParser {
"WILDCARD class but no WILDCARD name"); "WILDCARD class but no WILDCARD name");
throw new ParsingException throw new ParsingException
(st.lineno(), (st.lineno(),
rb.getString("can.not.specify.Principal.with.a.") + rb.getString("can.not.specify.Principal.with.a." +
rb.getString("wildcard.class.without.a.wildcard.name")); "wildcard.class.without.a.wildcard.name"));
} }
try { try {
...@@ -525,9 +526,10 @@ class PolicyParser { ...@@ -525,9 +526,10 @@ class PolicyParser {
rb.getString("number.") + rb.getString("number.") +
String.valueOf(st.nval)); String.valueOf(st.nval));
case StreamTokenizer.TT_EOF: case StreamTokenizer.TT_EOF:
throw new ParsingException MessageFormat form = new MessageFormat(
(rb.getString("expected.") + expect + rb.getString("expected.expect.read.end.of.file."));
rb.getString(".read.end.of.file")); Object[] source = {expect};
throw new ParsingException(form.format(source));
case StreamTokenizer.TT_WORD: case StreamTokenizer.TT_WORD:
if (expect.equalsIgnoreCase(st.sval)) { if (expect.equalsIgnoreCase(st.sval)) {
lookahead = st.nextToken(); lookahead = st.nextToken();
......
...@@ -5821,7 +5821,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -5821,7 +5821,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* <code>InputMethodRequests</code> instance. * <code>InputMethodRequests</code> instance.
* If listener <code>l</code> is <code>null</code>, * If listener <code>l</code> is <code>null</code>,
* no exception is thrown and no action is performed. * no exception is thrown and no action is performed.
* <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads" * <p>Refer to <a href="{@docRoot}/java/awt/doc-files/AWTThreadIssues.html#ListenersThreads"
* >AWT Threading Issues</a> for details on AWT's threading model. * >AWT Threading Issues</a> for details on AWT's threading model.
* *
* @param l the input method listener * @param l the input method listener
......
...@@ -43,7 +43,7 @@ import java.awt.geom.Rectangle2D; ...@@ -43,7 +43,7 @@ import java.awt.geom.Rectangle2D;
* object that describes the trajectory path of the <code>Shape</code> * object that describes the trajectory path of the <code>Shape</code>
* outline. * outline.
* <p> * <p>
* <b>Definition of insideness:</b> * <a name="def_insideness"><b>Definition of insideness:</b></a>
* A point is considered to lie inside a * A point is considered to lie inside a
* <code>Shape</code> if and only if: * <code>Shape</code> if and only if:
* <ul> * <ul>
...@@ -88,6 +88,32 @@ public interface Shape { ...@@ -88,6 +88,32 @@ public interface Shape {
* <code>getBounds2D</code> method generally returns a * <code>getBounds2D</code> method generally returns a
* tighter bounding box due to its greater flexibility in * tighter bounding box due to its greater flexibility in
* representation. * representation.
*
* <p>
* Note that the <a href="{@docRoot}/java/awt/Shape.html#def_insideness">
* definition of insideness</a> can lead to situations where points
* on the defining outline of the {@code shape} may not be considered
* contained in the returned {@code bounds} object, but only in cases
* where those points are also not considered contained in the original
* {@code shape}.
* </p>
* <p>
* If a {@code point} is inside the {@code shape} according to the
* {@link #contains(double x, double y) contains(point)} method, then
* it must be inside the returned {@code Rectangle} bounds object
* according to the {@link #contains(double x, double y) contains(point)}
* method of the {@code bounds}. Specifically:
* </p>
* <p>
* {@code shape.contains(x,y)} requires {@code bounds.contains(x,y)}
* </p>
* <p>
* If a {@code point} is not inside the {@code shape}, then it might
* still be contained in the {@code bounds} object:
* </p>
* <p>
* {@code bounds.contains(x,y)} does not imply {@code shape.contains(x,y)}
* </p>
* @return an integer <code>Rectangle</code> that completely encloses * @return an integer <code>Rectangle</code> that completely encloses
* the <code>Shape</code>. * the <code>Shape</code>.
* @see #getBounds2D * @see #getBounds2D
...@@ -107,6 +133,32 @@ public interface Shape { ...@@ -107,6 +133,32 @@ public interface Shape {
* to overflow problems since the return value can be an instance of * to overflow problems since the return value can be an instance of
* the <code>Rectangle2D</code> that uses double precision values to * the <code>Rectangle2D</code> that uses double precision values to
* store the dimensions. * store the dimensions.
*
* <p>
* Note that the <a href="{@docRoot}/java/awt/Shape.html#def_insideness">
* definition of insideness</a> can lead to situations where points
* on the defining outline of the {@code shape} may not be considered
* contained in the returned {@code bounds} object, but only in cases
* where those points are also not considered contained in the original
* {@code shape}.
* </p>
* <p>
* If a {@code point} is inside the {@code shape} according to the
* {@link #contains(Point2D p) contains(point)} method, then it must
* be inside the returned {@code Rectangle2D} bounds object according
* to the {@link #contains(Point2D p) contains(point)} method of the
* {@code bounds}. Specifically:
* </p>
* <p>
* {@code shape.contains(p)} requires {@code bounds.contains(p)}
* </p>
* <p>
* If a {@code point} is not inside the {@code shape}, then it might
* still be contained in the {@code bounds} object:
* </p>
* <p>
* {@code bounds.contains(p)} does not imply {@code shape.contains(p)}
* </p>
* @return an instance of <code>Rectangle2D</code> that is a * @return an instance of <code>Rectangle2D</code> that is a
* high-precision bounding box of the <code>Shape</code>. * high-precision bounding box of the <code>Shape</code>.
* @see #getBounds * @see #getBounds
...@@ -116,7 +168,9 @@ public interface Shape { ...@@ -116,7 +168,9 @@ public interface Shape {
/** /**
* Tests if the specified coordinates are inside the boundary of the * Tests if the specified coordinates are inside the boundary of the
* <code>Shape</code>. * <code>Shape</code>, as described by the
* <a href="{@docRoot}/java/awt/Shape.html#def_insideness">
* definition of insideness</a>.
* @param x the specified X coordinate to be tested * @param x the specified X coordinate to be tested
* @param y the specified Y coordinate to be tested * @param y the specified Y coordinate to be tested
* @return <code>true</code> if the specified coordinates are inside * @return <code>true</code> if the specified coordinates are inside
...@@ -128,7 +182,9 @@ public interface Shape { ...@@ -128,7 +182,9 @@ public interface Shape {
/** /**
* Tests if a specified {@link Point2D} is inside the boundary * Tests if a specified {@link Point2D} is inside the boundary
* of the <code>Shape</code>. * of the <code>Shape</code>, as described by the
* <a href="{@docRoot}/java/awt/Shape.html#def_insideness">
* definition of insideness</a>.
* @param p the specified <code>Point2D</code> to be tested * @param p the specified <code>Point2D</code> to be tested
* @return <code>true</code> if the specified <code>Point2D</code> is * @return <code>true</code> if the specified <code>Point2D</code> is
* inside the boundary of the <code>Shape</code>; * inside the boundary of the <code>Shape</code>;
......
/* /*
* Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -858,7 +858,7 @@ public abstract class Toolkit { ...@@ -858,7 +858,7 @@ public abstract class Toolkit {
String nm = null; String nm = null;
Class cls = null; Class cls = null;
try { try {
nm = System.getProperty("awt.toolkit", "sun.awt.X11.XToolkit"); nm = System.getProperty("awt.toolkit");
try { try {
cls = Class.forName(nm); cls = Class.forName(nm);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
...@@ -1157,12 +1157,9 @@ public abstract class Toolkit { ...@@ -1157,12 +1157,9 @@ public abstract class Toolkit {
* takes JobAttributes and PageAttributes objects. This object * takes JobAttributes and PageAttributes objects. This object
* may be updated to reflect the user's job choices on exit. May * may be updated to reflect the user's job choices on exit. May
* be null. * be null.
*
* @return a <code>PrintJob</code> object, or <code>null</code> if the * @return a <code>PrintJob</code> object, or <code>null</code> if the
* user cancelled the print job. * user cancelled the print job.
* @throws NullPointerException if frame is null. This exception is * @throws NullPointerException if frame is null
* always thrown when GraphicsEnvironment.isHeadless() returns
* true.
* @throws SecurityException if this thread is not allowed to initiate a * @throws SecurityException if this thread is not allowed to initiate a
* print job request * print job request
* @see java.awt.GraphicsEnvironment#isHeadless * @see java.awt.GraphicsEnvironment#isHeadless
...@@ -1201,12 +1198,9 @@ public abstract class Toolkit { ...@@ -1201,12 +1198,9 @@ public abstract class Toolkit {
* job. The attributes will be updated to reflect the user's * job. The attributes will be updated to reflect the user's
* choices as outlined in the PageAttributes documentation. May be * choices as outlined in the PageAttributes documentation. May be
* null. * null.
*
* @return a <code>PrintJob</code> object, or <code>null</code> if the * @return a <code>PrintJob</code> object, or <code>null</code> if the
* user cancelled the print job. * user cancelled the print job.
* @throws NullPointerException if frame is null and either jobAttributes * @throws NullPointerException if frame is null
* is null or jobAttributes.getDialog() returns
* JobAttributes.DialogType.NATIVE.
* @throws IllegalArgumentException if pageAttributes specifies differing * @throws IllegalArgumentException if pageAttributes specifies differing
* cross feed and feed resolutions. Also if this thread has * cross feed and feed resolutions. Also if this thread has
* access to the file system and jobAttributes specifies * access to the file system and jobAttributes specifies
...@@ -1218,9 +1212,6 @@ public abstract class Toolkit { ...@@ -1218,9 +1212,6 @@ public abstract class Toolkit {
* opportunity to select a file and proceed with printing. * opportunity to select a file and proceed with printing.
* The dialog will ensure that the selected output file * The dialog will ensure that the selected output file
* is valid before returning from this method. * is valid before returning from this method.
* <p>
* This exception is always thrown when GraphicsEnvironment.isHeadless()
* returns true.
* @throws SecurityException if this thread is not allowed to initiate a * @throws SecurityException if this thread is not allowed to initiate a
* print job request, or if jobAttributes specifies print to file, * print job request, or if jobAttributes specifies print to file,
* and this thread is not allowed to access the file system * and this thread is not allowed to access the file system
...@@ -1236,10 +1227,6 @@ public abstract class Toolkit { ...@@ -1236,10 +1227,6 @@ public abstract class Toolkit {
PageAttributes pageAttributes) { PageAttributes pageAttributes) {
// Override to add printing support with new job/page control classes // Override to add printing support with new job/page control classes
if (GraphicsEnvironment.isHeadless()) {
throw new IllegalArgumentException();
}
if (this != Toolkit.getDefaultToolkit()) { if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().getPrintJob(frame, jobtitle, return Toolkit.getDefaultToolkit().getPrintJob(frame, jobtitle,
jobAttributes, jobAttributes,
......
...@@ -408,7 +408,12 @@ public final class BandedSampleModel extends ComponentSampleModel ...@@ -408,7 +408,12 @@ public final class BandedSampleModel extends ComponentSampleModel
*/ */
public int[] getPixels(int x, int y, int w, int h, public int[] getPixels(int x, int y, int w, int h,
int iArray[], DataBuffer data) { int iArray[], DataBuffer data) {
if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) { int x1 = x + w;
int y1 = y + h;
if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
{
throw new ArrayIndexOutOfBoundsException throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!"); ("Coordinate out of bounds!");
} }
...@@ -690,7 +695,12 @@ public final class BandedSampleModel extends ComponentSampleModel ...@@ -690,7 +695,12 @@ public final class BandedSampleModel extends ComponentSampleModel
*/ */
public void setPixels(int x, int y, int w, int h, public void setPixels(int x, int y, int w, int h,
int iArray[], DataBuffer data) { int iArray[], DataBuffer data) {
if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) { int x1 = x + w;
int y1 = y + h;
if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
{
throw new ArrayIndexOutOfBoundsException throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!"); ("Coordinate out of bounds!");
} }
......
...@@ -739,7 +739,12 @@ public class ComponentSampleModel extends SampleModel ...@@ -739,7 +739,12 @@ public class ComponentSampleModel extends SampleModel
*/ */
public int[] getPixels(int x, int y, int w, int h, public int[] getPixels(int x, int y, int w, int h,
int iArray[], DataBuffer data) { int iArray[], DataBuffer data) {
if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) { int x1 = x + w;
int y1 = y + h;
if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
y < 0 || y >= height || y > height || y1 < 0 || y1 > height)
{
throw new ArrayIndexOutOfBoundsException throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!"); ("Coordinate out of bounds!");
} }
...@@ -1025,7 +1030,12 @@ public class ComponentSampleModel extends SampleModel ...@@ -1025,7 +1030,12 @@ public class ComponentSampleModel extends SampleModel
*/ */
public void setPixels(int x, int y, int w, int h, public void setPixels(int x, int y, int w, int h,
int iArray[], DataBuffer data) { int iArray[], DataBuffer data) {
if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) { int x1 = x + w;
int y1 = y + h;
if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
{
throw new ArrayIndexOutOfBoundsException throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!"); ("Coordinate out of bounds!");
} }
......
...@@ -361,8 +361,8 @@ public abstract class SampleModel ...@@ -361,8 +361,8 @@ public abstract class SampleModel
int x1 = x + w; int x1 = x + w;
int y1 = y + h; int y1 = y + h;
if (x < 0 || x1 < x || x1 > width || if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
y < 0 || y1 < y || y1 > height) y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
{ {
throw new ArrayIndexOutOfBoundsException("Invalid coordinates."); throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
} }
...@@ -588,6 +588,15 @@ public abstract class SampleModel ...@@ -588,6 +588,15 @@ public abstract class SampleModel
int type = getTransferType(); int type = getTransferType();
int numDataElems = getNumDataElements(); int numDataElems = getNumDataElements();
int x1 = x + w;
int y1 = y + h;
if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
{
throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
}
switch(type) { switch(type) {
case DataBuffer.TYPE_BYTE: case DataBuffer.TYPE_BYTE:
...@@ -595,8 +604,8 @@ public abstract class SampleModel ...@@ -595,8 +604,8 @@ public abstract class SampleModel
byte[] barray = (byte[])obj; byte[] barray = (byte[])obj;
byte[] btemp = new byte[numDataElems]; byte[] btemp = new byte[numDataElems];
for (int i=y; i<y+h; i++) { for (int i=y; i<y1; i++) {
for (int j=x; j<x+w; j++) { for (int j=x; j<x1; j++) {
for (int k=0; k<numDataElems; k++) { for (int k=0; k<numDataElems; k++) {
btemp[k] = barray[cnt++]; btemp[k] = barray[cnt++];
} }
...@@ -612,8 +621,8 @@ public abstract class SampleModel ...@@ -612,8 +621,8 @@ public abstract class SampleModel
short[] sarray = (short[])obj; short[] sarray = (short[])obj;
short[] stemp = new short[numDataElems]; short[] stemp = new short[numDataElems];
for (int i=y; i<y+h; i++) { for (int i=y; i<y1; i++) {
for (int j=x; j<x+w; j++) { for (int j=x; j<x1; j++) {
for (int k=0; k<numDataElems; k++) { for (int k=0; k<numDataElems; k++) {
stemp[k] = sarray[cnt++]; stemp[k] = sarray[cnt++];
} }
...@@ -628,8 +637,8 @@ public abstract class SampleModel ...@@ -628,8 +637,8 @@ public abstract class SampleModel
int[] iArray = (int[])obj; int[] iArray = (int[])obj;
int[] itemp = new int[numDataElems]; int[] itemp = new int[numDataElems];
for (int i=y; i<y+h; i++) { for (int i=y; i<y1; i++) {
for (int j=x; j<x+w; j++) { for (int j=x; j<x1; j++) {
for (int k=0; k<numDataElems; k++) { for (int k=0; k<numDataElems; k++) {
itemp[k] = iArray[cnt++]; itemp[k] = iArray[cnt++];
} }
...@@ -644,8 +653,8 @@ public abstract class SampleModel ...@@ -644,8 +653,8 @@ public abstract class SampleModel
float[] fArray = (float[])obj; float[] fArray = (float[])obj;
float[] ftemp = new float[numDataElems]; float[] ftemp = new float[numDataElems];
for (int i=y; i<y+h; i++) { for (int i=y; i<y1; i++) {
for (int j=x; j<x+w; j++) { for (int j=x; j<x1; j++) {
for (int k=0; k<numDataElems; k++) { for (int k=0; k<numDataElems; k++) {
ftemp[k] = fArray[cnt++]; ftemp[k] = fArray[cnt++];
} }
...@@ -660,8 +669,8 @@ public abstract class SampleModel ...@@ -660,8 +669,8 @@ public abstract class SampleModel
double[] dArray = (double[])obj; double[] dArray = (double[])obj;
double[] dtemp = new double[numDataElems]; double[] dtemp = new double[numDataElems];
for (int i=y; i<y+h; i++) { for (int i=y; i<y1; i++) {
for (int j=x; j<x+w; j++) { for (int j=x; j<x1; j++) {
for (int k=0; k<numDataElems; k++) { for (int k=0; k<numDataElems; k++) {
dtemp[k] = dArray[cnt++]; dtemp[k] = dArray[cnt++];
} }
...@@ -759,14 +768,22 @@ public abstract class SampleModel ...@@ -759,14 +768,22 @@ public abstract class SampleModel
int pixels[]; int pixels[];
int Offset=0; int Offset=0;
int x1 = x + w;
int y1 = y + h;
if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
{
throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
}
if (iArray != null) if (iArray != null)
pixels = iArray; pixels = iArray;
else else
pixels = new int[numBands * w * h]; pixels = new int[numBands * w * h];
for (int i=y; i<(h+y); i++) { for (int i=y; i<y1; i++) {
for (int j=x; j<(w+x); j++) { for (int j=x; j<x1; j++) {
for(int k=0; k<numBands; k++) { for(int k=0; k<numBands; k++) {
pixels[Offset++] = getSample(j, i, k, data); pixels[Offset++] = getSample(j, i, k, data);
} }
...@@ -799,14 +816,22 @@ public abstract class SampleModel ...@@ -799,14 +816,22 @@ public abstract class SampleModel
float pixels[]; float pixels[];
int Offset = 0; int Offset = 0;
int x1 = x + w;
int y1 = y + h;
if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
{
throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
}
if (fArray != null) if (fArray != null)
pixels = fArray; pixels = fArray;
else else
pixels = new float[numBands * w * h]; pixels = new float[numBands * w * h];
for (int i=y; i<(h+y); i++) { for (int i=y; i<y1; i++) {
for(int j=x; j<(w+x); j++) { for(int j=x; j<x1; j++) {
for(int k=0; k<numBands; k++) { for(int k=0; k<numBands; k++) {
pixels[Offset++] = getSampleFloat(j, i, k, data); pixels[Offset++] = getSampleFloat(j, i, k, data);
} }
...@@ -838,6 +863,14 @@ public abstract class SampleModel ...@@ -838,6 +863,14 @@ public abstract class SampleModel
double dArray[], DataBuffer data) { double dArray[], DataBuffer data) {
double pixels[]; double pixels[];
int Offset = 0; int Offset = 0;
int x1 = x + w;
int y1 = y + h;
if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
{
throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
}
if (dArray != null) if (dArray != null)
pixels = dArray; pixels = dArray;
...@@ -845,8 +878,8 @@ public abstract class SampleModel ...@@ -845,8 +878,8 @@ public abstract class SampleModel
pixels = new double[numBands * w * h]; pixels = new double[numBands * w * h];
// Fix 4217412 // Fix 4217412
for (int i=y; i<(h+y); i++) { for (int i=y; i<y1; i++) {
for (int j=x; j<(w+x); j++) { for (int j=x; j<x1; j++) {
for (int k=0; k<numBands; k++) { for (int k=0; k<numBands; k++) {
pixels[Offset++] = getSampleDouble(j, i, k, data); pixels[Offset++] = getSampleDouble(j, i, k, data);
} }
...@@ -1146,9 +1179,17 @@ public abstract class SampleModel ...@@ -1146,9 +1179,17 @@ public abstract class SampleModel
public void setPixels(int x, int y, int w, int h, public void setPixels(int x, int y, int w, int h,
int iArray[], DataBuffer data) { int iArray[], DataBuffer data) {
int Offset=0; int Offset=0;
int x1 = x + w;
int y1 = y + h;
if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
{
throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
}
for (int i=y; i<(y+h); i++) { for (int i=y; i<y1; i++) {
for (int j=x; j<(x+w); j++) { for (int j=x; j<x1; j++) {
for (int k=0; k<numBands; k++) { for (int k=0; k<numBands; k++) {
setSample(j, i, k, iArray[Offset++], data); setSample(j, i, k, iArray[Offset++], data);
} }
...@@ -1176,9 +1217,17 @@ public abstract class SampleModel ...@@ -1176,9 +1217,17 @@ public abstract class SampleModel
public void setPixels(int x, int y, int w, int h, public void setPixels(int x, int y, int w, int h,
float fArray[], DataBuffer data) { float fArray[], DataBuffer data) {
int Offset=0; int Offset=0;
int x1 = x + w;
int y1 = y + h;
if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width||
y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
{
throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
}
for (int i=y; i<(y+h); i++) { for (int i=y; i<y1; i++) {
for (int j=x; j<(x+w); j++) { for (int j=x; j<x1; j++) {
for(int k=0; k<numBands; k++) { for(int k=0; k<numBands; k++) {
setSample(j, i, k, fArray[Offset++], data); setSample(j, i, k, fArray[Offset++], data);
} }
...@@ -1206,9 +1255,17 @@ public abstract class SampleModel ...@@ -1206,9 +1255,17 @@ public abstract class SampleModel
public void setPixels(int x, int y, int w, int h, public void setPixels(int x, int y, int w, int h,
double dArray[], DataBuffer data) { double dArray[], DataBuffer data) {
int Offset=0; int Offset=0;
int x1 = x + w;
int y1 = y + h;
for (int i=y; i<(y+h); i++) { if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
for (int j=x; j<(x+w); j++) { y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
{
throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
}
for (int i=y; i<y1; i++) {
for (int j=x; j<x1; j++) {
for (int k=0; k<numBands; k++) { for (int k=0; k<numBands; k++) {
setSample(j, i, k, dArray[Offset++], data); setSample(j, i, k, dArray[Offset++], data);
} }
...@@ -1315,9 +1372,16 @@ public abstract class SampleModel ...@@ -1315,9 +1372,16 @@ public abstract class SampleModel
int iArray[], DataBuffer data) { int iArray[], DataBuffer data) {
int Offset=0; int Offset=0;
int x1 = x + w;
int y1 = y + h;
if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
{
throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
}
for (int i=y; i<(y+h); i++) { for (int i=y; i<y1; i++) {
for (int j=x; j<(x+w); j++) { for (int j=x; j<x1; j++) {
setSample(j, i, b, iArray[Offset++], data); setSample(j, i, b, iArray[Offset++], data);
} }
} }
...@@ -1345,9 +1409,17 @@ public abstract class SampleModel ...@@ -1345,9 +1409,17 @@ public abstract class SampleModel
public void setSamples(int x, int y, int w, int h, int b, public void setSamples(int x, int y, int w, int h, int b,
float fArray[], DataBuffer data) { float fArray[], DataBuffer data) {
int Offset=0; int Offset=0;
int x1 = x + w;
int y1 = y + h;
if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
{
throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
}
for (int i=y; i<(y+h); i++) { for (int i=y; i<y1; i++) {
for (int j=x; j<(x+w); j++) { for (int j=x; j<x1; j++) {
setSample(j, i, b, fArray[Offset++], data); setSample(j, i, b, fArray[Offset++], data);
} }
} }
...@@ -1375,9 +1447,18 @@ public abstract class SampleModel ...@@ -1375,9 +1447,18 @@ public abstract class SampleModel
public void setSamples(int x, int y, int w, int h, int b, public void setSamples(int x, int y, int w, int h, int b,
double dArray[], DataBuffer data) { double dArray[], DataBuffer data) {
int Offset=0; int Offset=0;
int x1 = x + w;
int y1 = y + h;
for (int i=y; i<(y+h); i++) { if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
for (int j=x; j<(x+w); j++) { y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
{
throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
}
for (int i=y; i<y1; i++) {
for (int j=x; j<x1; j++) {
setSample(j, i, b, dArray[Offset++], data); setSample(j, i, b, dArray[Offset++], data);
} }
} }
......
...@@ -461,7 +461,12 @@ public class SinglePixelPackedSampleModel extends SampleModel ...@@ -461,7 +461,12 @@ public class SinglePixelPackedSampleModel extends SampleModel
*/ */
public int[] getPixels(int x, int y, int w, int h, public int[] getPixels(int x, int y, int w, int h,
int iArray[], DataBuffer data) { int iArray[], DataBuffer data) {
if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) { int x1 = x + w;
int y1 = y + h;
if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
{
throw new ArrayIndexOutOfBoundsException throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!"); ("Coordinate out of bounds!");
} }
...@@ -659,7 +664,12 @@ public class SinglePixelPackedSampleModel extends SampleModel ...@@ -659,7 +664,12 @@ public class SinglePixelPackedSampleModel extends SampleModel
*/ */
public void setPixels(int x, int y, int w, int h, public void setPixels(int x, int y, int w, int h,
int iArray[], DataBuffer data) { int iArray[], DataBuffer data) {
if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) { int x1 = x + w;
int y1 = y + h;
if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
{
throw new ArrayIndexOutOfBoundsException throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!"); ("Coordinate out of bounds!");
} }
......
/* /*
* Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -30,15 +30,18 @@ package java.lang; ...@@ -30,15 +30,18 @@ package java.lang;
* example, an integer "divide by zero" throws an * example, an integer "divide by zero" throws an
* instance of this class. * instance of this class.
* *
* {@code ArithmeticException} objects may be constructed by the
* virtual machine as if {@linkplain Throwable#Throwable(String,
* Throwable, boolean) suppression were disabled}.
*
* @author unascribed * @author unascribed
* @since JDK1.0 * @since JDK1.0
*/ */
public public class ArithmeticException extends RuntimeException {
class ArithmeticException extends RuntimeException {
private static final long serialVersionUID = 2256477558314496007L; private static final long serialVersionUID = 2256477558314496007L;
/** /**
* Constructs an <code>ArithmeticException</code> with no detail * Constructs an {@code ArithmeticException} with no detail
* message. * message.
*/ */
public ArithmeticException() { public ArithmeticException() {
...@@ -46,7 +49,7 @@ class ArithmeticException extends RuntimeException { ...@@ -46,7 +49,7 @@ class ArithmeticException extends RuntimeException {
} }
/** /**
* Constructs an <code>ArithmeticException</code> with the specified * Constructs an {@code ArithmeticException} with the specified
* detail message. * detail message.
* *
* @param s the detail message. * @param s the detail message.
......
...@@ -66,7 +66,7 @@ public interface CharSequence { ...@@ -66,7 +66,7 @@ public interface CharSequence {
* indexing. </p> * indexing. </p>
* *
* <p>If the <code>char</code> value specified by the index is a * <p>If the <code>char</code> value specified by the index is a
* <a href="Character.html#unicode">surrogate</a>, the surrogate * <a href="{@docRoot}/java/lang/Character.html#unicode">surrogate</a>, the surrogate
* value is returned. * value is returned.
* *
* @param index the index of the <code>char</code> value to be returned * @param index the index of the <code>char</code> value to be returned
......
/* /*
* Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -26,20 +26,24 @@ ...@@ -26,20 +26,24 @@
package java.lang; package java.lang;
/** /**
* Thrown when an application attempts to use <code>null</code> in a * Thrown when an application attempts to use {@code null} in a
* case where an object is required. These include: * case where an object is required. These include:
* <ul> * <ul>
* <li>Calling the instance method of a <code>null</code> object. * <li>Calling the instance method of a {@code null} object.
* <li>Accessing or modifying the field of a <code>null</code> object. * <li>Accessing or modifying the field of a {@code null} object.
* <li>Taking the length of <code>null</code> as if it were an array. * <li>Taking the length of {@code null} as if it were an array.
* <li>Accessing or modifying the slots of <code>null</code> as if it * <li>Accessing or modifying the slots of {@code null} as if it
* were an array. * were an array.
* <li>Throwing <code>null</code> as if it were a <code>Throwable</code> * <li>Throwing {@code null} as if it were a {@code Throwable}
* value. * value.
* </ul> * </ul>
* <p> * <p>
* Applications should throw instances of this class to indicate * Applications should throw instances of this class to indicate
* other illegal uses of the <code>null</code> object. * other illegal uses of the {@code null} object.
*
* {@code NullPointerException} objects may be constructed by the
* virtual machine as if {@linkplain Throwable#Throwable(String,
* Throwable, boolean) suppression were disabled}.
* *
* @author unascribed * @author unascribed
* @since JDK1.0 * @since JDK1.0
...@@ -49,14 +53,14 @@ class NullPointerException extends RuntimeException { ...@@ -49,14 +53,14 @@ class NullPointerException extends RuntimeException {
private static final long serialVersionUID = 5162710183389028792L; private static final long serialVersionUID = 5162710183389028792L;
/** /**
* Constructs a <code>NullPointerException</code> with no detail message. * Constructs a {@code NullPointerException} with no detail message.
*/ */
public NullPointerException() { public NullPointerException() {
super(); super();
} }
/** /**
* Constructs a <code>NullPointerException</code> with the specified * Constructs a {@code NullPointerException} with the specified
* detail message. * detail message.
* *
* @param s the detail message. * @param s the detail message.
......
/* /*
* Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -30,22 +30,25 @@ package java.lang; ...@@ -30,22 +30,25 @@ package java.lang;
* because it is out of memory, and no more memory could be made * because it is out of memory, and no more memory could be made
* available by the garbage collector. * available by the garbage collector.
* *
* {@code OutOfMemoryError} objects may be constructed by the virtual
* machine as if {@linkplain Throwable#Throwable(String, Throwable,
* boolean) suppression were disabled}.
*
* @author unascribed * @author unascribed
* @since JDK1.0 * @since JDK1.0
*/ */
public public class OutOfMemoryError extends VirtualMachineError {
class OutOfMemoryError extends VirtualMachineError {
private static final long serialVersionUID = 8228564086184010517L; private static final long serialVersionUID = 8228564086184010517L;
/** /**
* Constructs an <code>OutOfMemoryError</code> with no detail message. * Constructs an {@code OutOfMemoryError} with no detail message.
*/ */
public OutOfMemoryError() { public OutOfMemoryError() {
super(); super();
} }
/** /**
* Constructs an <code>OutOfMemoryError</code> with the specified * Constructs an {@code OutOfMemoryError} with the specified
* detail message. * detail message.
* *
* @param s the detail message. * @param s the detail message.
......
...@@ -46,13 +46,16 @@ import java.util.*; ...@@ -46,13 +46,16 @@ import java.util.*;
* are freshly created in the context of the exceptional situation so * are freshly created in the context of the exceptional situation so
* as to include relevant information (such as stack trace data). * as to include relevant information (such as stack trace data).
* *
* <p>A throwable contains a snapshot of the execution stack of its thread at * <p>A throwable contains a snapshot of the execution stack of its
* the time it was created. It can also contain a message string that gives * thread at the time it was created. It can also contain a message
* more information about the error. Finally, it can contain a <i>cause</i>: * string that gives more information about the error. Over time, a
* another throwable that caused this throwable to get thrown. The cause * throwable can {@linkplain Throwable#addSuppressed suppress} other
* facility is new in release 1.4. It is also known as the <i>chained * throwables from being propagated. Finally, the throwable can also
* exception</i> facility, as the cause can, itself, have a cause, and so on, * contain a <i>cause</i>: another throwable that caused this
* leading to a "chain" of exceptions, each caused by another. * throwable to be constructed. The recording of this causal information
* is referred to as the <i>chained exception</i> facility, as the
* cause can, itself, have a cause, and so on, leading to a "chain" of
* exceptions, each caused by another.
* *
* <p>One reason that a throwable may have a cause is that the class that * <p>One reason that a throwable may have a cause is that the class that
* throws it is built atop a lower layered abstraction, and an operation on * throws it is built atop a lower layered abstraction, and an operation on
...@@ -86,47 +89,12 @@ import java.util.*; ...@@ -86,47 +89,12 @@ import java.util.*;
* {@link #initCause(Throwable)} method. New throwable classes that * {@link #initCause(Throwable)} method. New throwable classes that
* wish to allow causes to be associated with them should provide constructors * wish to allow causes to be associated with them should provide constructors
* that take a cause and delegate (perhaps indirectly) to one of the * that take a cause and delegate (perhaps indirectly) to one of the
* {@code Throwable} constructors that takes a cause. For example: * {@code Throwable} constructors that takes a cause.
* <pre> *
* try {
* lowLevelOp();
* } catch (LowLevelException le) {
* throw new HighLevelException(le); // Chaining-aware constructor
* }
* </pre>
* Because the {@code initCause} method is public, it allows a cause to be * Because the {@code initCause} method is public, it allows a cause to be
* associated with any throwable, even a "legacy throwable" whose * associated with any throwable, even a "legacy throwable" whose
* implementation predates the addition of the exception chaining mechanism to * implementation predates the addition of the exception chaining mechanism to
* {@code Throwable}. For example: * {@code Throwable}.
* <pre>
* try {
* lowLevelOp();
* } catch (LowLevelException le) {
* throw (HighLevelException)
* new HighLevelException().initCause(le); // Legacy constructor
* }
* </pre>
*
* <p>Prior to release 1.4, there were many throwables that had their own
* non-standard exception chaining mechanisms (
* {@link ExceptionInInitializerError}, {@link ClassNotFoundException},
* {@link java.lang.reflect.UndeclaredThrowableException},
* {@link java.lang.reflect.InvocationTargetException},
* {@link java.io.WriteAbortedException},
* {@link java.security.PrivilegedActionException},
* {@link java.awt.print.PrinterIOException},
* {@link java.rmi.RemoteException} and
* {@link javax.naming.NamingException}).
* All of these throwables have been retrofitted to
* use the standard exception chaining mechanism, while continuing to
* implement their "legacy" chaining mechanisms for compatibility.
*
* <p>Further, as of release 1.4, many general purpose {@code Throwable}
* classes (for example {@link Exception}, {@link RuntimeException},
* {@link Error}) have been retrofitted with constructors that take
* a cause. This was not strictly necessary, due to the existence of the
* {@code initCause} method, but it is more convenient and expressive to
* delegate to a constructor that takes a cause.
* *
* <p>By convention, class {@code Throwable} and its subclasses have two * <p>By convention, class {@code Throwable} and its subclasses have two
* constructors, one that takes no arguments and one that takes a * constructors, one that takes no arguments and one that takes a
...@@ -137,14 +105,6 @@ import java.util.*; ...@@ -137,14 +105,6 @@ import java.util.*;
* {@code String} (the detail message) and a {@code Throwable} (the * {@code String} (the detail message) and a {@code Throwable} (the
* cause). * cause).
* *
* <p>Also introduced in release 1.4 is the {@link #getStackTrace()} method,
* which allows programmatic access to the stack trace information that was
* previously available only in text form, via the various forms of the
* {@link #printStackTrace()} method. This information has been added to the
* <i>serialized representation</i> of this class so {@code getStackTrace}
* and {@code printStackTrace} will operate properly on a throwable that
* was obtained by deserialization.
*
* @author unascribed * @author unascribed
* @author Josh Bloch (Added exception chaining and programmatic access to * @author Josh Bloch (Added exception chaining and programmatic access to
* stack trace in 1.4.) * stack trace in 1.4.)
...@@ -322,6 +282,41 @@ public class Throwable implements Serializable { ...@@ -322,6 +282,41 @@ public class Throwable implements Serializable {
this.cause = cause; this.cause = cause;
} }
/**
* Constructs a new throwable with the specified detail message,
* cause, and {@linkplain #addSuppressed suppression} enabled or
* disabled. If suppression is disabled, {@link #getSuppressed}
* for this object will return a zero-length array and calls to
* {@link #addSuppressed} that would otherwise append an exception
* to the suppressed list will have no effect.
*
* <p>Note that the other constructors of {@code Throwable} treat
* suppression as being enabled. Subclasses of {@code Throwable}
* should document any conditions under which suppression is
* disabled. Disabling of suppression should only occur in
* exceptional circumstances where special requirements exist,
* such as a virtual machine reusing exception objects under
* low-memory situations.
*
* @param message the detail message.
* @param cause the cause. (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @param enableSuppression whether or not suppression is enabled or disabled
*
* @see OutOfMemoryError
* @see NullPointerException
* @see ArithmeticException
* @since 1.7
*/
protected Throwable(String message, Throwable cause,
boolean enableSuppression) {
fillInStackTrace();
detailMessage = message;
this.cause = cause;
if (!enableSuppression)
suppressedExceptions = null;
}
/** /**
* Returns the detail message string of this throwable. * Returns the detail message string of this throwable.
* *
...@@ -870,43 +865,56 @@ public class Throwable implements Serializable { ...@@ -870,43 +865,56 @@ public class Throwable implements Serializable {
* typically called (automatically and implicitly) by the {@code * typically called (automatically and implicitly) by the {@code
* try}-with-resources statement. * try}-with-resources statement.
* *
* If the first exception to be suppressed is {@code null}, that * <p>The suppression behavior is enabled <em>unless</em> disabled
* indicates suppressed exception information will <em>not</em> be * {@linkplain #Throwable(String, Throwable, boolean) via a
* recorded for this exception. Subsequent calls to this method * constructor}. When suppression is disabled, this method does
* will not record any suppressed exceptions. Otherwise, * nothing other than to validate its argument.
* attempting to suppress {@code null} after an exception has
* already been successfully suppressed results in a {@code
* NullPointerException}.
* *
* <p>Note that when one exception {@linkplain * <p>Note that when one exception {@linkplain
* #initCause(Throwable) causes} another exception, the first * #initCause(Throwable) causes} another exception, the first
* exception is usually caught and then the second exception is * exception is usually caught and then the second exception is
* thrown in response. In contrast, when one exception suppresses * thrown in response. In other words, there is a causal
* another, two exceptions are thrown in sibling code blocks, such * connection between the two exceptions.
* as in a {@code try} block and in its {@code finally} block, and *
* control flow can only continue with one exception so the second * In contrast, there are situations where two independent
* is recorded as a suppressed exception of the first. * exceptions can be thrown in sibling code blocks, in particular
* in the {@code try} block of a {@code try}-with-resources
* statement and the compiler-generated {@code finally} block
* which closes the resource.
*
* In these situations, only one of the thrown exceptions can be
* propagated. In the {@code try}-with-resources statement, when
* there are two such exceptions, the exception originating from
* the {@code try} block is propagated and the exception from the
* {@code finally} block is added to the list of exceptions
* suppressed by the exception from the {@code try} block. As an
* exception unwinds the stack, it can accumulate multiple
* suppressed exceptions.
*
* <p>An exception may have suppressed exceptions while also being
* caused by another exception. Whether or not an exception has a
* cause is semantically known at the time of its creation, unlike
* whether or not an exception will suppress other exceptions
* which is typically only determined after an exception is
* thrown.
*
* <p>Note that programmer written code is also able to take
* advantage of calling this method in situations where there are
* multiple sibling exceptions and only one can be propagated.
* *
* @param exception the exception to be added to the list of * @param exception the exception to be added to the list of
* suppressed exceptions * suppressed exceptions
* @throws IllegalArgumentException if {@code exception} is this * @throws IllegalArgumentException if {@code exception} is this
* throwable; a throwable cannot suppress itself. * throwable; a throwable cannot suppress itself.
* @throws NullPointerException if {@code exception} is null and * @throws NullPointerException if {@code exception} is {@code null}
* an exception has already been suppressed by this exception
* @since 1.7 * @since 1.7
*/ */
public final synchronized void addSuppressed(Throwable exception) { public final synchronized void addSuppressed(Throwable exception) {
if (exception == this) if (exception == this)
throw new IllegalArgumentException(SELF_SUPPRESSION_MESSAGE); throw new IllegalArgumentException(SELF_SUPPRESSION_MESSAGE);
if (exception == null) { if (exception == null)
if (suppressedExceptions == SUPPRESSED_SENTINEL) {
suppressedExceptions = null; // No suppression information recorded
return;
} else
throw new NullPointerException(NULL_CAUSE_MESSAGE); throw new NullPointerException(NULL_CAUSE_MESSAGE);
} else {
assert exception != null && exception != this;
if (suppressedExceptions == null) // Suppressed exceptions not recorded if (suppressedExceptions == null) // Suppressed exceptions not recorded
return; return;
...@@ -914,11 +922,8 @@ public class Throwable implements Serializable { ...@@ -914,11 +922,8 @@ public class Throwable implements Serializable {
if (suppressedExceptions == SUPPRESSED_SENTINEL) if (suppressedExceptions == SUPPRESSED_SENTINEL)
suppressedExceptions = new ArrayList<>(1); suppressedExceptions = new ArrayList<>(1);
assert suppressedExceptions != SUPPRESSED_SENTINEL;
suppressedExceptions.add(exception); suppressedExceptions.add(exception);
} }
}
private static final Throwable[] EMPTY_THROWABLE_ARRAY = new Throwable[0]; private static final Throwable[] EMPTY_THROWABLE_ARRAY = new Throwable[0];
...@@ -927,7 +932,9 @@ public class Throwable implements Serializable { ...@@ -927,7 +932,9 @@ public class Throwable implements Serializable {
* suppressed, typically by the {@code try}-with-resources * suppressed, typically by the {@code try}-with-resources
* statement, in order to deliver this exception. * statement, in order to deliver this exception.
* *
* If no exceptions were suppressed, an empty array is returned. * If no exceptions were suppressed or {@linkplain
* Throwable(String, Throwable, boolean) suppression is disabled},
* an empty array is returned.
* *
* @return an array containing all of the exceptions that were * @return an array containing all of the exceptions that were
* suppressed to deliver this exception. * suppressed to deliver this exception.
......
...@@ -23,15 +23,15 @@ ...@@ -23,15 +23,15 @@
* questions. * questions.
*/ */
package java.nio; package java.lang.management;
import java.lang.management.PlatformManagedObject;
/** /**
* The management interface for a buffer pool. * The management interface for a buffer pool, for example a pool of
* {@link java.nio.ByteBuffer#allocateDirect direct} or {@link
* java.nio.MappedByteBuffer mapped} buffers.
* *
* <p> A class implementing this interface is an <a href= * <p> A class implementing this interface is an
* "java.lang.management.ManagementFactory.html#MXBean">MXBean</a>. A Java * {@link javax.management.MXBean}. A Java
* virtual machine has one or more implementations of this interface. The {@link * virtual machine has one or more implementations of this interface. The {@link
* java.lang.management.ManagementFactory#getPlatformMXBeans getPlatformMXBeans} * java.lang.management.ManagementFactory#getPlatformMXBeans getPlatformMXBeans}
* method can be used to obtain the list of {@code BufferPoolMXBean} objects * method can be used to obtain the list of {@code BufferPoolMXBean} objects
...@@ -44,14 +44,13 @@ import java.lang.management.PlatformManagedObject; ...@@ -44,14 +44,13 @@ import java.lang.management.PlatformManagedObject;
* javax.management.MBeanServer MBeanServer}. The {@link * javax.management.MBeanServer MBeanServer}. The {@link
* javax.management.ObjectName ObjectName} that uniquely identifies the * javax.management.ObjectName ObjectName} that uniquely identifies the
* management interface within the {@code MBeanServer} takes the form: * management interface within the {@code MBeanServer} takes the form:
* <blockquote> * <pre>
* <tt>java.nio:type=BufferPool</tt><tt>,name=</tt><i>pool name</i> * java.nio:type=BufferPool,name=<i>pool name</i>
* </blockquote> * </pre>
* where <em>pool name</em> is the {@link #getName name} of the buffer pool. * where <em>pool name</em> is the {@link #getName name} of the buffer pool.
* *
* @since 1.7 * @since 1.7
*/ */
public interface BufferPoolMXBean extends PlatformManagedObject { public interface BufferPoolMXBean extends PlatformManagedObject {
/** /**
......
...@@ -29,9 +29,9 @@ import java.util.ArrayList; ...@@ -29,9 +29,9 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.HashSet; import java.util.HashSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.logging.PlatformLoggingMXBean;
import java.nio.BufferPoolMXBean;
import javax.management.MBeanServerConnection; import javax.management.MBeanServerConnection;
import javax.management.ObjectName; import javax.management.ObjectName;
...@@ -66,6 +66,7 @@ enum PlatformComponent { ...@@ -66,6 +66,7 @@ enum PlatformComponent {
CLASS_LOADING( CLASS_LOADING(
"java.lang.management.ClassLoadingMXBean", "java.lang.management.ClassLoadingMXBean",
"java.lang", "ClassLoading", defaultKeyProperties(), "java.lang", "ClassLoading", defaultKeyProperties(),
true, // singleton
new MXBeanFetcher<ClassLoadingMXBean>() { new MXBeanFetcher<ClassLoadingMXBean>() {
public List<ClassLoadingMXBean> getMXBeans() { public List<ClassLoadingMXBean> getMXBeans() {
return Collections.singletonList(ManagementFactoryHelper.getClassLoadingMXBean()); return Collections.singletonList(ManagementFactoryHelper.getClassLoadingMXBean());
...@@ -78,6 +79,7 @@ enum PlatformComponent { ...@@ -78,6 +79,7 @@ enum PlatformComponent {
COMPILATION( COMPILATION(
"java.lang.management.CompilationMXBean", "java.lang.management.CompilationMXBean",
"java.lang", "Compilation", defaultKeyProperties(), "java.lang", "Compilation", defaultKeyProperties(),
true, // singleton
new MXBeanFetcher<CompilationMXBean>() { new MXBeanFetcher<CompilationMXBean>() {
public List<CompilationMXBean> getMXBeans() { public List<CompilationMXBean> getMXBeans() {
CompilationMXBean m = ManagementFactoryHelper.getCompilationMXBean(); CompilationMXBean m = ManagementFactoryHelper.getCompilationMXBean();
...@@ -95,6 +97,7 @@ enum PlatformComponent { ...@@ -95,6 +97,7 @@ enum PlatformComponent {
MEMORY( MEMORY(
"java.lang.management.MemoryMXBean", "java.lang.management.MemoryMXBean",
"java.lang", "Memory", defaultKeyProperties(), "java.lang", "Memory", defaultKeyProperties(),
true, // singleton
new MXBeanFetcher<MemoryMXBean>() { new MXBeanFetcher<MemoryMXBean>() {
public List<MemoryMXBean> getMXBeans() { public List<MemoryMXBean> getMXBeans() {
return Collections.singletonList(ManagementFactoryHelper.getMemoryMXBean()); return Collections.singletonList(ManagementFactoryHelper.getMemoryMXBean());
...@@ -107,6 +110,7 @@ enum PlatformComponent { ...@@ -107,6 +110,7 @@ enum PlatformComponent {
GARBAGE_COLLECTOR( GARBAGE_COLLECTOR(
"java.lang.management.GarbageCollectorMXBean", "java.lang.management.GarbageCollectorMXBean",
"java.lang", "GarbageCollector", keyProperties("name"), "java.lang", "GarbageCollector", keyProperties("name"),
false, // zero or more instances
new MXBeanFetcher<GarbageCollectorMXBean>() { new MXBeanFetcher<GarbageCollectorMXBean>() {
public List<GarbageCollectorMXBean> getMXBeans() { public List<GarbageCollectorMXBean> getMXBeans() {
return ManagementFactoryHelper. return ManagementFactoryHelper.
...@@ -120,6 +124,7 @@ enum PlatformComponent { ...@@ -120,6 +124,7 @@ enum PlatformComponent {
MEMORY_MANAGER( MEMORY_MANAGER(
"java.lang.management.MemoryManagerMXBean", "java.lang.management.MemoryManagerMXBean",
"java.lang", "MemoryManager", keyProperties("name"), "java.lang", "MemoryManager", keyProperties("name"),
false, // zero or more instances
new MXBeanFetcher<MemoryManagerMXBean>() { new MXBeanFetcher<MemoryManagerMXBean>() {
public List<MemoryManagerMXBean> getMXBeans() { public List<MemoryManagerMXBean> getMXBeans() {
return ManagementFactoryHelper.getMemoryManagerMXBeans(); return ManagementFactoryHelper.getMemoryManagerMXBeans();
...@@ -133,6 +138,7 @@ enum PlatformComponent { ...@@ -133,6 +138,7 @@ enum PlatformComponent {
MEMORY_POOL( MEMORY_POOL(
"java.lang.management.MemoryPoolMXBean", "java.lang.management.MemoryPoolMXBean",
"java.lang", "MemoryPool", keyProperties("name"), "java.lang", "MemoryPool", keyProperties("name"),
false, // zero or more instances
new MXBeanFetcher<MemoryPoolMXBean>() { new MXBeanFetcher<MemoryPoolMXBean>() {
public List<MemoryPoolMXBean> getMXBeans() { public List<MemoryPoolMXBean> getMXBeans() {
return ManagementFactoryHelper.getMemoryPoolMXBeans(); return ManagementFactoryHelper.getMemoryPoolMXBeans();
...@@ -145,6 +151,7 @@ enum PlatformComponent { ...@@ -145,6 +151,7 @@ enum PlatformComponent {
OPERATING_SYSTEM( OPERATING_SYSTEM(
"java.lang.management.OperatingSystemMXBean", "java.lang.management.OperatingSystemMXBean",
"java.lang", "OperatingSystem", defaultKeyProperties(), "java.lang", "OperatingSystem", defaultKeyProperties(),
true, // singleton
new MXBeanFetcher<OperatingSystemMXBean>() { new MXBeanFetcher<OperatingSystemMXBean>() {
public List<OperatingSystemMXBean> getMXBeans() { public List<OperatingSystemMXBean> getMXBeans() {
return Collections.singletonList(ManagementFactoryHelper.getOperatingSystemMXBean()); return Collections.singletonList(ManagementFactoryHelper.getOperatingSystemMXBean());
...@@ -157,6 +164,7 @@ enum PlatformComponent { ...@@ -157,6 +164,7 @@ enum PlatformComponent {
RUNTIME( RUNTIME(
"java.lang.management.RuntimeMXBean", "java.lang.management.RuntimeMXBean",
"java.lang", "Runtime", defaultKeyProperties(), "java.lang", "Runtime", defaultKeyProperties(),
true, // singleton
new MXBeanFetcher<RuntimeMXBean>() { new MXBeanFetcher<RuntimeMXBean>() {
public List<RuntimeMXBean> getMXBeans() { public List<RuntimeMXBean> getMXBeans() {
return Collections.singletonList(ManagementFactoryHelper.getRuntimeMXBean()); return Collections.singletonList(ManagementFactoryHelper.getRuntimeMXBean());
...@@ -169,6 +177,7 @@ enum PlatformComponent { ...@@ -169,6 +177,7 @@ enum PlatformComponent {
THREADING( THREADING(
"java.lang.management.ThreadMXBean", "java.lang.management.ThreadMXBean",
"java.lang", "Threading", defaultKeyProperties(), "java.lang", "Threading", defaultKeyProperties(),
true, // singleton
new MXBeanFetcher<ThreadMXBean>() { new MXBeanFetcher<ThreadMXBean>() {
public List<ThreadMXBean> getMXBeans() { public List<ThreadMXBean> getMXBeans() {
return Collections.singletonList(ManagementFactoryHelper.getThreadMXBean()); return Collections.singletonList(ManagementFactoryHelper.getThreadMXBean());
...@@ -180,11 +189,17 @@ enum PlatformComponent { ...@@ -180,11 +189,17 @@ enum PlatformComponent {
* Logging facility. * Logging facility.
*/ */
LOGGING( LOGGING(
"java.util.logging.PlatformLoggingMXBean", "java.lang.management.PlatformLoggingMXBean",
"java.util.logging", "Logging", defaultKeyProperties(), "java.util.logging", "Logging", defaultKeyProperties(),
true, // singleton
new MXBeanFetcher<PlatformLoggingMXBean>() { new MXBeanFetcher<PlatformLoggingMXBean>() {
public List<PlatformLoggingMXBean> getMXBeans() { public List<PlatformLoggingMXBean> getMXBeans() {
return ManagementFactoryHelper.getLoggingMXBean(); PlatformLoggingMXBean m = ManagementFactoryHelper.getPlatformLoggingMXBean();
if (m == null) {
return Collections.emptyList();
} else {
return Collections.singletonList(m);
}
} }
}), }),
...@@ -192,8 +207,9 @@ enum PlatformComponent { ...@@ -192,8 +207,9 @@ enum PlatformComponent {
* Buffer pools. * Buffer pools.
*/ */
BUFFER_POOL( BUFFER_POOL(
"java.nio.BufferPoolMXBean", "java.lang.management.BufferPoolMXBean",
"java.nio", "BufferPool", keyProperties("name"), "java.nio", "BufferPool", keyProperties("name"),
false, // zero or more instances
new MXBeanFetcher<BufferPoolMXBean>() { new MXBeanFetcher<BufferPoolMXBean>() {
public List<BufferPoolMXBean> getMXBeans() { public List<BufferPoolMXBean> getMXBeans() {
return ManagementFactoryHelper.getBufferPoolMXBeans(); return ManagementFactoryHelper.getBufferPoolMXBeans();
...@@ -209,6 +225,7 @@ enum PlatformComponent { ...@@ -209,6 +225,7 @@ enum PlatformComponent {
SUN_GARBAGE_COLLECTOR( SUN_GARBAGE_COLLECTOR(
"com.sun.management.GarbageCollectorMXBean", "com.sun.management.GarbageCollectorMXBean",
"java.lang", "GarbageCollector", keyProperties("name"), "java.lang", "GarbageCollector", keyProperties("name"),
false, // zero or more instances
new MXBeanFetcher<com.sun.management.GarbageCollectorMXBean>() { new MXBeanFetcher<com.sun.management.GarbageCollectorMXBean>() {
public List<com.sun.management.GarbageCollectorMXBean> getMXBeans() { public List<com.sun.management.GarbageCollectorMXBean> getMXBeans() {
return getGcMXBeanList(com.sun.management.GarbageCollectorMXBean.class); return getGcMXBeanList(com.sun.management.GarbageCollectorMXBean.class);
...@@ -222,6 +239,7 @@ enum PlatformComponent { ...@@ -222,6 +239,7 @@ enum PlatformComponent {
SUN_OPERATING_SYSTEM( SUN_OPERATING_SYSTEM(
"com.sun.management.OperatingSystemMXBean", "com.sun.management.OperatingSystemMXBean",
"java.lang", "OperatingSystem", defaultKeyProperties(), "java.lang", "OperatingSystem", defaultKeyProperties(),
true, // singleton
new MXBeanFetcher<com.sun.management.OperatingSystemMXBean>() { new MXBeanFetcher<com.sun.management.OperatingSystemMXBean>() {
public List<com.sun.management.OperatingSystemMXBean> getMXBeans() { public List<com.sun.management.OperatingSystemMXBean> getMXBeans() {
return getOSMXBeanList(com.sun.management.OperatingSystemMXBean.class); return getOSMXBeanList(com.sun.management.OperatingSystemMXBean.class);
...@@ -234,6 +252,7 @@ enum PlatformComponent { ...@@ -234,6 +252,7 @@ enum PlatformComponent {
SUN_UNIX_OPERATING_SYSTEM( SUN_UNIX_OPERATING_SYSTEM(
"com.sun.management.UnixOperatingSystemMXBean", "com.sun.management.UnixOperatingSystemMXBean",
"java.lang", "OperatingSystem", defaultKeyProperties(), "java.lang", "OperatingSystem", defaultKeyProperties(),
true, // singleton
new MXBeanFetcher<UnixOperatingSystemMXBean>() { new MXBeanFetcher<UnixOperatingSystemMXBean>() {
public List<UnixOperatingSystemMXBean> getMXBeans() { public List<UnixOperatingSystemMXBean> getMXBeans() {
return getOSMXBeanList(com.sun.management.UnixOperatingSystemMXBean.class); return getOSMXBeanList(com.sun.management.UnixOperatingSystemMXBean.class);
...@@ -246,6 +265,7 @@ enum PlatformComponent { ...@@ -246,6 +265,7 @@ enum PlatformComponent {
HOTSPOT_DIAGNOSTIC( HOTSPOT_DIAGNOSTIC(
"com.sun.management.HotSpotDiagnosticMXBean", "com.sun.management.HotSpotDiagnosticMXBean",
"com.sun.management", "HotSpotDiagnostic", defaultKeyProperties(), "com.sun.management", "HotSpotDiagnostic", defaultKeyProperties(),
true, // singleton
new MXBeanFetcher<HotSpotDiagnosticMXBean>() { new MXBeanFetcher<HotSpotDiagnosticMXBean>() {
public List<HotSpotDiagnosticMXBean> getMXBeans() { public List<HotSpotDiagnosticMXBean> getMXBeans() {
return Collections.singletonList(ManagementFactoryHelper.getDiagnosticMXBean()); return Collections.singletonList(ManagementFactoryHelper.getDiagnosticMXBean());
...@@ -296,27 +316,19 @@ enum PlatformComponent { ...@@ -296,27 +316,19 @@ enum PlatformComponent {
private final Set<String> keyProperties; private final Set<String> keyProperties;
private final MXBeanFetcher fetcher; private final MXBeanFetcher fetcher;
private final PlatformComponent[] subComponents; private final PlatformComponent[] subComponents;
private final boolean singleton;
private PlatformComponent(String intfName, private PlatformComponent(String intfName,
String domain, String type, String domain, String type,
Set<String> keyProperties, Set<String> keyProperties,
MXBeanFetcher fetcher) { boolean singleton,
this.mxbeanInterfaceName = intfName;
this.domain = domain;
this.type = type;
this.keyProperties = keyProperties;
this.fetcher = fetcher;
this.subComponents = new PlatformComponent[0];
}
private PlatformComponent(String intfName,
String domain, String type,
Set<String> keyProperties,
MXBeanFetcher fetcher, MXBeanFetcher fetcher,
PlatformComponent... subComponents) { PlatformComponent... subComponents) {
this.mxbeanInterfaceName = intfName; this.mxbeanInterfaceName = intfName;
this.domain = domain; this.domain = domain;
this.type = type; this.type = type;
this.keyProperties = keyProperties; this.keyProperties = keyProperties;
this.singleton = singleton;
this.fetcher = fetcher; this.fetcher = fetcher;
this.subComponents = subComponents; this.subComponents = subComponents;
} }
...@@ -338,6 +350,10 @@ enum PlatformComponent { ...@@ -338,6 +350,10 @@ enum PlatformComponent {
return set; return set;
} }
boolean isSingleton() {
return singleton;
}
String getMXBeanInterfaceName() { String getMXBeanInterfaceName() {
return mxbeanInterfaceName; return mxbeanInterfaceName;
} }
...@@ -360,6 +376,33 @@ enum PlatformComponent { ...@@ -360,6 +376,33 @@ enum PlatformComponent {
return fetcher.getMXBeans(); return fetcher.getMXBeans();
} }
<T extends PlatformManagedObject> T getSingletonMXBean(Class<T> mxbeanInterface)
{
if (!singleton)
throw new IllegalArgumentException(mxbeanInterfaceName +
" can have zero or more than one instances");
List<T> list = fetcher.getMXBeans();
assert list.size() == 1;
return list.isEmpty() ? null : list.get(0);
}
<T extends PlatformManagedObject>
T getSingletonMXBean(MBeanServerConnection mbs, Class<T> mxbeanInterface)
throws java.io.IOException
{
if (!singleton)
throw new IllegalArgumentException(mxbeanInterfaceName +
" can have zero or more than one instances");
// ObjectName of a singleton MXBean contains only domain and type
assert keyProperties.size() == 1;
String on = domain + ":type=" + type;
return ManagementFactory.newPlatformMXBeanProxy(mbs,
on,
mxbeanInterface);
}
<T extends PlatformManagedObject> <T extends PlatformManagedObject>
List<T> getMXBeans(MBeanServerConnection mbs, Class<T> mxbeanInterface) List<T> getMXBeans(MBeanServerConnection mbs, Class<T> mxbeanInterface)
throws java.io.IOException throws java.io.IOException
...@@ -391,5 +434,34 @@ enum PlatformComponent { ...@@ -391,5 +434,34 @@ enum PlatformComponent {
return set; return set;
} }
// a map from MXBean interface name to PlatformComponent
private static Map<String, PlatformComponent> enumMap;
private static synchronized void ensureInitialized() {
if (enumMap == null) {
enumMap = new HashMap<>();
for (PlatformComponent pc: PlatformComponent.values()) {
// Use String as the key rather than Class<?> to avoid
// causing unnecessary class loading of management interface
enumMap.put(pc.getMXBeanInterfaceName(), pc);
}
}
}
static boolean isPlatformMXBean(String cn) {
ensureInitialized();
return enumMap.containsKey(cn);
}
static <T extends PlatformManagedObject>
PlatformComponent getPlatformComponent(Class<T> mxbeanInterface)
{
ensureInitialized();
String cn = mxbeanInterface.getName();
PlatformComponent pc = enumMap.get(cn);
if (pc != null && pc.getMXBeanInterface() == mxbeanInterface)
return pc;
return null;
}
private static final long serialVersionUID = 6992337162326171013L; private static final long serialVersionUID = 6992337162326171013L;
} }
/*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.lang.management;
/**
* The management interface for the {@linkplain java.util.logging logging} facility.
*
* <p>There is a single global instance of the <tt>PlatformLoggingMXBean</tt>.
* The {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
* ManagementFactory.getPlatformMXBean} method can be used to obtain
* the {@code PlatformLoggingMXBean} object as follows:
* <pre>
* PlatformLoggingMXBean logging = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class);
* </pre>
* The {@code PlatformLoggingMXBean} object is also registered with the
* platform {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer
* MBeanServer}.
* The {@link javax.management.ObjectName ObjectName} for uniquely
* identifying the {@code PlatformLoggingMXBean} within an MBeanServer is:
* <pre>
* {@link java.util.logging.LogManager#LOGGING_MXBEAN_NAME java.util.logging:type=Logging}
* </pre>
*
* <p>The instance registered in the platform <tt>MBeanServer</tt> with
* this {@code ObjectName} implements all attributes defined by
* {@link java.util.logging.LoggingMXBean}.
*
* @since 1.7
*/
public interface PlatformLoggingMXBean extends PlatformManagedObject {
/**
* Returns the list of the currently registered
* {@linkplain java.util.logging.Logger logger} names. This method
* calls {@link java.util.logging.LogManager#getLoggerNames} and
* returns a list of the logger names.
*
* @return A list of {@code String} each of which is a
* currently registered {@code Logger} name.
*/
java.util.List<String> getLoggerNames();
/**
* Gets the name of the log {@linkplain java.util.logging.Logger#getLevel
* level} associated with the specified logger.
* If the specified logger does not exist, {@code null}
* is returned.
* This method first finds the logger of the given name and
* then returns the name of the log level by calling:
* <blockquote>
* {@link java.util.logging.Logger#getLevel
* Logger.getLevel()}.{@link java.util.logging.Level#getName getName()};
* </blockquote>
*
* <p>
* If the {@code Level} of the specified logger is {@code null},
* which means that this logger's effective level is inherited
* from its parent, an empty string will be returned.
*
* @param loggerName The name of the {@code Logger} to be retrieved.
*
* @return The name of the log level of the specified logger; or
* an empty string if the log level of the specified logger
* is {@code null}. If the specified logger does not
* exist, {@code null} is returned.
*
* @see java.util.logging.Logger#getLevel
*/
String getLoggerLevel(String loggerName);
/**
* Sets the specified logger to the specified new
* {@linkplain java.util.logging.Logger#setLevel level}.
* If the {@code levelName} is not {@code null}, the level
* of the specified logger is set to the parsed
* {@link java.util.logging.Level Level}
* matching the {@code levelName}.
* If the {@code levelName} is {@code null}, the level
* of the specified logger is set to {@code null} and
* the effective level of the logger is inherited from
* its nearest ancestor with a specific (non-null) level value.
*
* @param loggerName The name of the {@code Logger} to be set.
* Must be non-null.
* @param levelName The name of the level to set on the specified logger,
* or {@code null} if setting the level to inherit
* from its nearest ancestor.
*
* @throws IllegalArgumentException if the specified logger
* does not exist, or {@code levelName} is not a valid level name.
*
* @throws SecurityException if a security manager exists and if
* the caller does not have LoggingPermission("control").
*
* @see java.util.logging.Logger#setLevel
*/
void setLoggerLevel(String loggerName, String levelName);
/**
* Returns the name of the
* {@linkplain java.util.logging.Logger#getParent parent}
* for the specified logger.
* If the specified logger does not exist, {@code null} is returned.
* If the specified logger is the root {@code Logger} in the namespace,
* the result will be an empty string.
*
* @param loggerName The name of a {@code Logger}.
*
* @return the name of the nearest existing parent logger;
* an empty string if the specified logger is the root logger.
* If the specified logger does not exist, {@code null}
* is returned.
*/
String getParentLoggerName(String loggerName);
}
...@@ -46,7 +46,7 @@ import javax.management.ObjectName; ...@@ -46,7 +46,7 @@ import javax.management.ObjectName;
* intended for the management interfaces for the platform to extend but * intended for the management interfaces for the platform to extend but
* not for applications. * not for applications.
* *
* @see <a href="ManagementFactory.html#MXBean">Platform MXBeans</a> * @see ManagementFactory
* @since 1.7 * @since 1.7
*/ */
public interface PlatformManagedObject { public interface PlatformManagedObject {
......
...@@ -2067,7 +2067,7 @@ public final class Files { ...@@ -2067,7 +2067,7 @@ public final class Files {
* *
* @return {@code true} if the file is a symbolic link; {@code false} if * @return {@code true} if the file is a symbolic link; {@code false} if
* the file does not exist, is not a symbolic link, or it cannot * the file does not exist, is not a symbolic link, or it cannot
* be determined if the file is symbolic link or not. * be determined if the file is a symbolic link or not.
* *
* @throws SecurityException * @throws SecurityException
* In the case of the default provider, and a security manager is * In the case of the default provider, and a security manager is
...@@ -2106,7 +2106,7 @@ public final class Files { ...@@ -2106,7 +2106,7 @@ public final class Files {
* *
* @return {@code true} if the file is a directory; {@code false} if * @return {@code true} if the file is a directory; {@code false} if
* the file does not exist, is not a directory, or it cannot * the file does not exist, is not a directory, or it cannot
* be determined if the file is directory or not. * be determined if the file is a directory or not.
* *
* @throws SecurityException * @throws SecurityException
* In the case of the default provider, and a security manager is * In the case of the default provider, and a security manager is
...@@ -2142,8 +2142,8 @@ public final class Files { ...@@ -2142,8 +2142,8 @@ public final class Files {
* options indicating how symbolic links are handled * options indicating how symbolic links are handled
* *
* @return {@code true} if the file is a regular file; {@code false} if * @return {@code true} if the file is a regular file; {@code false} if
* the file does not exist, is not a direcregular filetory, or it * the file does not exist, is not a regular file, or it
* cannot be determined if the file is regular file or not. * cannot be determined if the file is a regular file or not.
* *
* @throws SecurityException * @throws SecurityException
* In the case of the default provider, and a security manager is * In the case of the default provider, and a security manager is
......
...@@ -241,7 +241,7 @@ class ComparableTimSort { ...@@ -241,7 +241,7 @@ class ComparableTimSort {
* pivot < all in [left, start), so pivot belongs at left. Note * pivot < all in [left, start), so pivot belongs at left. Note
* that if there are elements equal to pivot, left points to the * that if there are elements equal to pivot, left points to the
* first slot after them -- that's why this sort is stable. * first slot after them -- that's why this sort is stable.
* Slide elements over to make room to make room for pivot. * Slide elements over to make room for pivot.
*/ */
int n = start - left; // The number of elements to move int n = start - left; // The number of elements to move
// Switch is just an optimization for arraycopy in default case // Switch is just an optimization for arraycopy in default case
......
此差异已折叠。
...@@ -60,4 +60,7 @@ public interface LoggingProxy { ...@@ -60,4 +60,7 @@ public interface LoggingProxy {
public Object parseLevel(String levelName); public Object parseLevel(String levelName);
public String getLevelName(Object level); public String getLevelName(Object level);
// return the logging property
public String getProperty(String key);
} }
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册