提交 7ff0de35 编写于 作者: R rriggs

Merge

...@@ -38,31 +38,31 @@ FILES_compiled_properties_orig := $(FILES_compiled_properties) ...@@ -38,31 +38,31 @@ FILES_compiled_properties_orig := $(FILES_compiled_properties)
# only FILES_java and FILES_compiled_properties variables will be picked up # only FILES_java and FILES_compiled_properties variables will be picked up
# #
# $(BUILDDIR)/java/util/FILES_java.gmk & $(BUILDDIR)/java/util/FILES_properties.gmk # $(BUILDDIR)/java/util/FILES_java.gmk & $(BUILDDIR)/java/util/FILES_properties.gmk
# contain "sun.util.resources" for US language support # contain "sun.util.resources" for EN language support
include $(BUILDDIR)/java/util/FILES_java.gmk include $(BUILDDIR)/java/util/FILES_java.gmk
include $(BUILDDIR)/java/util/FILES_properties.gmk include $(BUILDDIR)/java/util/FILES_properties.gmk
US_Resources_java := $(FILES_java) EN_Resources_java := $(FILES_java)
US_Resources_properties := $(FILES_compiled_properties) EN_Resources_properties := $(FILES_compiled_properties)
# $(BUILDDIR)/java/text/FILES_java.gmk contains the "sun.text.resources" for # $(BUILDDIR)/java/text/FILES_java.gmk contains the "sun.text.resources" for
# US language support # EN language support
include $(BUILDDIR)/java/text/base/FILES_java.gmk include $(BUILDDIR)/java/text/base/FILES_java.gmk
US_Resources_java += $(FILES_java) EN_Resources_java += $(FILES_java)
FILES_compiled_properties= FILES_compiled_properties=
# $(BUILDDIR)/sun/text/FILES_java.gmk & $(BUILDDIR)/sun/text/FILES_properties.gmk # $(BUILDDIR)/sun/text/FILES_java.gmk & $(BUILDDIR)/sun/text/FILES_properties.gmk
# contain both resources for Non-US language support # contain both resources for Non-EN language support
include $(BUILDDIR)/sun/text/FILES_java.gmk include $(BUILDDIR)/sun/text/FILES_java.gmk
include $(BUILDDIR)/sun/text/FILES_properties.gmk include $(BUILDDIR)/sun/text/FILES_properties.gmk
NonUS_Resources_java := $(FILES_java) NonEN_Resources_java := $(FILES_java)
NonUS_Resources_properties := $(FILES_compiled_properties) NonEN_Resources_properties := $(FILES_compiled_properties)
# Restore the orignal FILES_java & FILES_compiled_properties variables # Restore the orignal FILES_java & FILES_compiled_properties variables
FILES_java := $(FILES_java_orig) FILES_java := $(FILES_java_orig)
...@@ -80,30 +80,30 @@ RESOURCE_NAMES="FormatData CollationData TimeZoneNames LocaleNames CurrencyNames ...@@ -80,30 +80,30 @@ RESOURCE_NAMES="FormatData CollationData TimeZoneNames LocaleNames CurrencyNames
ifeq ($(PLATFORM), macosx) ifeq ($(PLATFORM), macosx)
$(LocaleDataMetaInfo_Dest):$(LocaleDataMetaInfo_Src) $(LOCALEGEN_SH) $(LocaleDataMetaInfo_Dest):$(LocaleDataMetaInfo_Src) $(LOCALEGEN_SH)
@$(RM) $@.tmp.us $@.tmp.nonus; @$(RM) $@.tmp.en $@.tmp.nonen;
@$(prep-target) @$(prep-target)
@$(ECHO) $(US_Resources_properties) | $(NAWK) 'gsub(/.properties/,"\n") {print}' > $@.tmp.us; @$(ECHO) $(EN_Resources_properties) | $(NAWK) 'gsub(/.properties/,"\n") {print}' > $@.tmp.en;
@$(ECHO) $(US_Resources_java) | $(NAWK) 'gsub(/.java/,"\n") {print}' >> $@.tmp.us; @$(ECHO) $(EN_Resources_java) | $(NAWK) 'gsub(/.java/,"\n") {print}' >> $@.tmp.en;
@$(ECHO) $(NonUS_Resources_properties) | $(NAWK) 'gsub(/.properties/,"\n") {print}' > $@.tmp.nonus; @$(ECHO) $(NonEN_Resources_properties) | $(NAWK) 'gsub(/.properties/,"\n") {print}' > $@.tmp.nonen;
@$(ECHO) $(NonUS_Resources_java) | $(NAWK) 'gsub(/.java/,"\n") {print}' >> $@.tmp.nonus; @$(ECHO) $(NonEN_Resources_java) | $(NAWK) 'gsub(/.java/,"\n") {print}' >> $@.tmp.nonen;
NAWK="$(NAWK)" SED="$(SED)" SORT="$(SORT)" \ NAWK="$(NAWK)" SED="$(SED)" SORT="$(SORT)" \
$(SH) $(LOCALEGEN_SH) $(RESOURCE_NAMES) $@.tmp.us \ $(SH) $(LOCALEGEN_SH) $(RESOURCE_NAMES) $@.tmp.en \
$@.tmp.nonus $< $@ $@.tmp.nonen $< $@
@$(RM) $@.tmp.us $@.tmp.nonus; @$(RM) $@.tmp.en $@.tmp.nonen;
else else
$(LocaleDataMetaInfo_Dest):$(LocaleDataMetaInfo_Src) $(LOCALEGEN_SH) $(LocaleDataMetaInfo_Dest):$(LocaleDataMetaInfo_Src) $(LOCALEGEN_SH)
@$(RM) $@.tmp.us $@.tmp.nonus; @$(RM) $@.tmp.en $@.tmp.nonen;
@$(prep-target) @$(prep-target)
@$(ECHO) $(subst .properties,'\n',$(US_Resources_properties)) > $@.tmp.us; @$(ECHO) $(subst .properties,'\n',$(EN_Resources_properties)) > $@.tmp.en;
@$(ECHO) $(subst .java,'\n',$(US_Resources_java)) >> $@.tmp.us; @$(ECHO) $(subst .java,'\n',$(EN_Resources_java)) >> $@.tmp.en;
@$(ECHO) $(subst .properties,'\n',$(NonUS_Resources_properties)) > $@.tmp.nonus; @$(ECHO) $(subst .properties,'\n',$(NonEN_Resources_properties)) > $@.tmp.nonen;
@$(ECHO) $(subst .java,'\n',$(NonUS_Resources_java)) >> $@.tmp.nonus; @$(ECHO) $(subst .java,'\n',$(NonEN_Resources_java)) >> $@.tmp.nonen;
NAWK="$(NAWK)" SED="$(SED)" SORT="$(SORT)" \ NAWK="$(NAWK)" SED="$(SED)" SORT="$(SORT)" \
$(SH) $(LOCALEGEN_SH) $(RESOURCE_NAMES) $@.tmp.us \ $(SH) $(LOCALEGEN_SH) $(RESOURCE_NAMES) $@.tmp.en \
$@.tmp.nonus $< $@ $@.tmp.nonen $< $@
@$(RM) $@.tmp.us $@.tmp.nonus; @$(RM) $@.tmp.en $@.tmp.nonen;
endif endif
genlocales : $(LocaleDataMetaInfo_Dest) genlocales : $(LocaleDataMetaInfo_Dest)
......
...@@ -35,11 +35,11 @@ ...@@ -35,11 +35,11 @@
# A list of resource base name list; # A list of resource base name list;
RESOURCE_NAMES=$1 RESOURCE_NAMES=$1
# A list of US resources; # A list of EN resources;
US_FILES_LIST=$2 EN_FILES_LIST=$2
# A list of non-US resources; # A list of non-EN resources;
NONUS_FILES_LIST=$3 NONEN_FILES_LIST=$3
INPUT_FILE=$4 INPUT_FILE=$4
OUTPUT_FILE=$5 OUTPUT_FILE=$5
...@@ -53,23 +53,23 @@ getlocalelist() { ...@@ -53,23 +53,23 @@ getlocalelist() {
sed_script="$SED -e \"s@^#warn .*@// -- This file was mechanically generated: Do not edit! -- //@\" " sed_script="$SED -e \"s@^#warn .*@// -- This file was mechanically generated: Do not edit! -- //@\" "
# ja-JP-JP and th-TH-TH need to be manually added, as they don't have any resource files. # ja-JP-JP and th-TH-TH need to be manually added, as they don't have any resource files.
nonusall=" ja-JP-JP th-TH-TH " nonenall=" ja-JP-JP th-TH-TH "
for FILE in $RESOURCE_NAMES for FILE in $RESOURCE_NAMES
do do
getlocalelist $FILE $US_FILES_LIST getlocalelist $FILE $EN_FILES_LIST
sed_script=$sed_script"-e \"s@#"$FILE"_USLocales#@$localelist@g\" " sed_script=$sed_script"-e \"s@#"$FILE"_ENLocales#@$localelist@g\" "
usall=$usall" "$localelist enall=$enall" "$localelist
getlocalelist $FILE $NONUS_FILES_LIST getlocalelist $FILE $NONEN_FILES_LIST
sed_script=$sed_script"-e \"s@#"$FILE"_NonUSLocales#@$localelist@g\" " sed_script=$sed_script"-e \"s@#"$FILE"_NonENLocales#@$localelist@g\" "
nonusall=$nonusall" "$localelist nonenall=$nonenall" "$localelist
done done
usall=`(for LOC in $usall; do echo $LOC;done) |$SORT -u` enall=`(for LOC in $enall; do echo $LOC;done) |$SORT -u`
nonusall=`(for LOC in $nonusall; do echo $LOC;done) |$SORT -u` nonenall=`(for LOC in $nonenall; do echo $LOC;done) |$SORT -u`
sed_script=$sed_script"-e \"s@#AvailableLocales_USLocales#@$usall@g\" " sed_script=$sed_script"-e \"s@#AvailableLocales_ENLocales#@$enall@g\" "
sed_script=$sed_script"-e \"s@#AvailableLocales_NonUSLocales#@$nonusall@g\" " sed_script=$sed_script"-e \"s@#AvailableLocales_NonENLocales#@$nonenall@g\" "
sed_script=$sed_script"$INPUT_FILE > $OUTPUT_FILE" sed_script=$sed_script"$INPUT_FILE > $OUTPUT_FILE"
eval $sed_script eval $sed_script
...@@ -107,5 +107,17 @@ FILES_java = \ ...@@ -107,5 +107,17 @@ FILES_java = \
sun/text/resources/FormatData.java \ sun/text/resources/FormatData.java \
sun/text/resources/JavaTimeSupplementary.java \ sun/text/resources/JavaTimeSupplementary.java \
sun/text/resources/en/FormatData_en.java \ sun/text/resources/en/FormatData_en.java \
sun/text/resources/en/FormatData_en_AU.java \
sun/text/resources/en/FormatData_en_CA.java \
sun/text/resources/en/FormatData_en_GB.java \
sun/text/resources/en/FormatData_en_IE.java \
sun/text/resources/en/FormatData_en_IN.java \
sun/text/resources/en/FormatData_en_MT.java \
sun/text/resources/en/FormatData_en_NZ.java \
sun/text/resources/en/FormatData_en_PH.java \
sun/text/resources/en/FormatData_en_SG.java \
sun/text/resources/en/FormatData_en_US.java \ sun/text/resources/en/FormatData_en_US.java \
sun/text/resources/en/FormatData_en_ZA.java \
sun/text/resources/en/JavaTimeSupplementary_en.java \ sun/text/resources/en/JavaTimeSupplementary_en.java \
sun/text/resources/en/JavaTimeSupplementary_en_GB.java \
sun/text/resources/en/JavaTimeSupplementary_en_SG.java
...@@ -30,4 +30,7 @@ FILES_java = \ ...@@ -30,4 +30,7 @@ FILES_java = \
sun/util/resources/LocaleNamesBundle.java \ sun/util/resources/LocaleNamesBundle.java \
sun/util/resources/TimeZoneNamesBundle.java \ sun/util/resources/TimeZoneNamesBundle.java \
sun/util/resources/TimeZoneNames.java \ sun/util/resources/TimeZoneNames.java \
sun/util/resources/en/TimeZoneNames_en.java sun/util/resources/en/TimeZoneNames_en.java \
sun/util/resources/en/TimeZoneNames_en_CA.java \
sun/util/resources/en/TimeZoneNames_en_GB.java \
sun/util/resources/en/TimeZoneNames_en_IE.java
...@@ -26,9 +26,25 @@ ...@@ -26,9 +26,25 @@
FILES_compiled_properties = \ FILES_compiled_properties = \
sun/util/resources/LocaleNames.properties \ sun/util/resources/LocaleNames.properties \
sun/util/resources/en/LocaleNames_en.properties \ sun/util/resources/en/LocaleNames_en.properties \
sun/util/resources/en/LocaleNames_en_MT.properties \
sun/util/resources/en/LocaleNames_en_PH.properties \
sun/util/resources/en/LocaleNames_en_SG.properties \
\ \
sun/util/resources/CalendarData.properties \ sun/util/resources/CalendarData.properties \
sun/util/resources/en/CalendarData_en.properties \ sun/util/resources/en/CalendarData_en.properties \
sun/util/resources/en/CalendarData_en_GB.properties \
sun/util/resources/en/CalendarData_en_IE.properties \
sun/util/resources/en/CalendarData_en_MT.properties \
\ \
sun/util/resources/CurrencyNames.properties \ sun/util/resources/CurrencyNames.properties \
sun/util/resources/en/CurrencyNames_en_US.properties sun/util/resources/en/CurrencyNames_en_AU.properties \
sun/util/resources/en/CurrencyNames_en_CA.properties \
sun/util/resources/en/CurrencyNames_en_GB.properties \
sun/util/resources/en/CurrencyNames_en_IE.properties \
sun/util/resources/en/CurrencyNames_en_IN.properties \
sun/util/resources/en/CurrencyNames_en_MT.properties \
sun/util/resources/en/CurrencyNames_en_NZ.properties \
sun/util/resources/en/CurrencyNames_en_PH.properties \
sun/util/resources/en/CurrencyNames_en_SG.properties \
sun/util/resources/en/CurrencyNames_en_US.properties \
sun/util/resources/en/CurrencyNames_en_ZA.properties
...@@ -96,16 +96,6 @@ FILES_java = \ ...@@ -96,16 +96,6 @@ FILES_java = \
sun/text/resources/el/FormatData_el.java \ sun/text/resources/el/FormatData_el.java \
sun/text/resources/el/FormatData_el_CY.java \ sun/text/resources/el/FormatData_el_CY.java \
sun/text/resources/el/FormatData_el_GR.java \ sun/text/resources/el/FormatData_el_GR.java \
sun/text/resources/en/FormatData_en_AU.java \
sun/text/resources/en/FormatData_en_CA.java \
sun/text/resources/en/FormatData_en_GB.java \
sun/text/resources/en/FormatData_en_IE.java \
sun/text/resources/en/FormatData_en_IN.java \
sun/text/resources/en/FormatData_en_MT.java \
sun/text/resources/en/FormatData_en_NZ.java \
sun/text/resources/en/FormatData_en_PH.java \
sun/text/resources/en/FormatData_en_SG.java \
sun/text/resources/en/FormatData_en_ZA.java \
sun/text/resources/es/FormatData_es.java \ sun/text/resources/es/FormatData_es.java \
sun/text/resources/es/FormatData_es_BO.java \ sun/text/resources/es/FormatData_es_BO.java \
sun/text/resources/es/FormatData_es_AR.java \ sun/text/resources/es/FormatData_es_AR.java \
...@@ -214,9 +204,6 @@ FILES_java = \ ...@@ -214,9 +204,6 @@ FILES_java = \
sun/util/resources/zh/CurrencyNames_zh_SG.java \ sun/util/resources/zh/CurrencyNames_zh_SG.java \
sun/util/resources/zh/LocaleNames_zh_HK.java \ sun/util/resources/zh/LocaleNames_zh_HK.java \
sun/util/resources/de/TimeZoneNames_de.java \ sun/util/resources/de/TimeZoneNames_de.java \
sun/util/resources/en/TimeZoneNames_en_CA.java \
sun/util/resources/en/TimeZoneNames_en_GB.java \
sun/util/resources/en/TimeZoneNames_en_IE.java \
sun/util/resources/es/TimeZoneNames_es.java \ sun/util/resources/es/TimeZoneNames_es.java \
sun/util/resources/fr/TimeZoneNames_fr.java \ sun/util/resources/fr/TimeZoneNames_fr.java \
sun/util/resources/hi/TimeZoneNames_hi.java \ sun/util/resources/hi/TimeZoneNames_hi.java \
...@@ -237,8 +224,6 @@ FILES_java = \ ...@@ -237,8 +224,6 @@ FILES_java = \
sun/text/resources/da/JavaTimeSupplementary_da.java \ sun/text/resources/da/JavaTimeSupplementary_da.java \
sun/text/resources/de/JavaTimeSupplementary_de.java \ sun/text/resources/de/JavaTimeSupplementary_de.java \
sun/text/resources/el/JavaTimeSupplementary_el.java \ sun/text/resources/el/JavaTimeSupplementary_el.java \
sun/text/resources/en/JavaTimeSupplementary_en_GB.java \
sun/text/resources/en/JavaTimeSupplementary_en_SG.java \
sun/text/resources/es/JavaTimeSupplementary_es.java \ sun/text/resources/es/JavaTimeSupplementary_es.java \
sun/text/resources/et/JavaTimeSupplementary_et.java \ sun/text/resources/et/JavaTimeSupplementary_et.java \
sun/text/resources/fi/JavaTimeSupplementary_fi.java \ sun/text/resources/fi/JavaTimeSupplementary_fi.java \
......
...@@ -33,9 +33,6 @@ FILES_compiled_properties = \ ...@@ -33,9 +33,6 @@ FILES_compiled_properties = \
sun/util/resources/de/LocaleNames_de.properties \ sun/util/resources/de/LocaleNames_de.properties \
sun/util/resources/el/LocaleNames_el.properties \ sun/util/resources/el/LocaleNames_el.properties \
sun/util/resources/el/LocaleNames_el_CY.properties \ sun/util/resources/el/LocaleNames_el_CY.properties \
sun/util/resources/en/LocaleNames_en_MT.properties \
sun/util/resources/en/LocaleNames_en_PH.properties \
sun/util/resources/en/LocaleNames_en_SG.properties \
sun/util/resources/es/LocaleNames_es.properties \ sun/util/resources/es/LocaleNames_es.properties \
sun/util/resources/es/LocaleNames_es_US.properties \ sun/util/resources/es/LocaleNames_es_US.properties \
sun/util/resources/et/LocaleNames_et.properties \ sun/util/resources/et/LocaleNames_et.properties \
...@@ -88,9 +85,6 @@ FILES_compiled_properties = \ ...@@ -88,9 +85,6 @@ FILES_compiled_properties = \
sun/util/resources/de/CalendarData_de.properties \ sun/util/resources/de/CalendarData_de.properties \
sun/util/resources/el/CalendarData_el.properties \ sun/util/resources/el/CalendarData_el.properties \
sun/util/resources/el/CalendarData_el_CY.properties \ sun/util/resources/el/CalendarData_el_CY.properties \
sun/util/resources/en/CalendarData_en_GB.properties \
sun/util/resources/en/CalendarData_en_IE.properties \
sun/util/resources/en/CalendarData_en_MT.properties \
sun/util/resources/es/CalendarData_es.properties \ sun/util/resources/es/CalendarData_es.properties \
sun/util/resources/es/CalendarData_es_ES.properties \ sun/util/resources/es/CalendarData_es_ES.properties \
sun/util/resources/es/CalendarData_es_US.properties \ sun/util/resources/es/CalendarData_es_US.properties \
...@@ -164,16 +158,6 @@ FILES_compiled_properties = \ ...@@ -164,16 +158,6 @@ FILES_compiled_properties = \
sun/util/resources/de/CurrencyNames_de_LU.properties \ sun/util/resources/de/CurrencyNames_de_LU.properties \
sun/util/resources/el/CurrencyNames_el_CY.properties \ sun/util/resources/el/CurrencyNames_el_CY.properties \
sun/util/resources/el/CurrencyNames_el_GR.properties \ sun/util/resources/el/CurrencyNames_el_GR.properties \
sun/util/resources/en/CurrencyNames_en_AU.properties \
sun/util/resources/en/CurrencyNames_en_CA.properties \
sun/util/resources/en/CurrencyNames_en_GB.properties \
sun/util/resources/en/CurrencyNames_en_IE.properties \
sun/util/resources/en/CurrencyNames_en_IN.properties \
sun/util/resources/en/CurrencyNames_en_MT.properties \
sun/util/resources/en/CurrencyNames_en_NZ.properties \
sun/util/resources/en/CurrencyNames_en_PH.properties \
sun/util/resources/en/CurrencyNames_en_SG.properties \
sun/util/resources/en/CurrencyNames_en_ZA.properties \
sun/util/resources/es/CurrencyNames_es.properties \ sun/util/resources/es/CurrencyNames_es.properties \
sun/util/resources/es/CurrencyNames_es_AR.properties \ sun/util/resources/es/CurrencyNames_es_AR.properties \
sun/util/resources/es/CurrencyNames_es_BO.properties \ sun/util/resources/es/CurrencyNames_es_BO.properties \
......
...@@ -80,39 +80,6 @@ LOCALEDATA_INCLUDE_LOCALES := ar be bg ca cs da de el es et fi fr ga hi hr hu in ...@@ -80,39 +80,6 @@ LOCALEDATA_INCLUDE_LOCALES := ar be bg ca cs da de el es et fi fr ga hi hr hu in
LOCALEDATA_INCLUDES := $(addprefix sun/text/resources/,$(LOCALEDATA_INCLUDE_LOCALES)) \ LOCALEDATA_INCLUDES := $(addprefix sun/text/resources/,$(LOCALEDATA_INCLUDE_LOCALES)) \
$(addprefix sun/util/resources/,$(LOCALEDATA_INCLUDE_LOCALES)) $(addprefix sun/util/resources/,$(LOCALEDATA_INCLUDE_LOCALES))
# For non-US English locale data
LOCALEDATA_INCLUDES += \
sun/text/resources/en/FormatData_en_AU.class \
sun/text/resources/en/FormatData_en_CA.class \
sun/text/resources/en/FormatData_en_GB.class \
sun/text/resources/en/FormatData_en_IE.class \
sun/text/resources/en/FormatData_en_IN.class \
sun/text/resources/en/FormatData_en_MT.class \
sun/text/resources/en/FormatData_en_NZ.class \
sun/text/resources/en/FormatData_en_PH.class \
sun/text/resources/en/FormatData_en_SG.class \
sun/text/resources/en/FormatData_en_ZA.class \
sun/util/resources/en/CalendarData_en_GB.class \
sun/util/resources/en/CalendarData_en_IE.class \
sun/util/resources/en/CalendarData_en_MT.class \
sun/util/resources/en/CurrencyNames_en_AU.class \
sun/util/resources/en/CurrencyNames_en_CA.class \
sun/util/resources/en/CurrencyNames_en_GB.class \
sun/util/resources/en/CurrencyNames_en_IE.class \
sun/util/resources/en/CurrencyNames_en_IN.class \
sun/util/resources/en/CurrencyNames_en_MT.class \
sun/util/resources/en/CurrencyNames_en_NZ.class \
sun/util/resources/en/CurrencyNames_en_PH.class \
sun/util/resources/en/CurrencyNames_en_SG.class \
sun/util/resources/en/CurrencyNames_en_ZA.class \
sun/util/resources/en/LocaleNames_en_MT.class \
sun/util/resources/en/LocaleNames_en_PH.class \
sun/util/resources/en/LocaleNames_en_SG.class \
sun/util/resources/en/TimeZoneNames_en_CA.class \
sun/util/resources/en/TimeZoneNames_en_GB.class \
sun/util/resources/en/TimeZoneNames_en_IE.class
$(eval $(call SetupArchive,BUILD_LOCALEDATA_JAR,,\ $(eval $(call SetupArchive,BUILD_LOCALEDATA_JAR,,\
SRCS:=$(JDK_OUTPUTDIR)/classes,\ SRCS:=$(JDK_OUTPUTDIR)/classes,\
SUFFIXES:=.class _dict _th,\ SUFFIXES:=.class _dict _th,\
......
...@@ -50,27 +50,27 @@ ifneq (,$(MISSING_RESOURCES)$(NEW_RESOURCES)) ...@@ -50,27 +50,27 @@ ifneq (,$(MISSING_RESOURCES)$(NEW_RESOURCES))
$(shell $(RM) $(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java) $(shell $(RM) $(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java)
endif endif
# The US locales # The EN locales
US_LOCALES:=en en-US EN_LOCALES:=en%
# ja-JP-JP and th-TH-TH need to be manually added, as they don't have any resource files. # ja-JP-JP and th-TH-TH need to be manually added, as they don't have any resource files.
ALL_NON_US_LOCALES:=ja-JP-JP th-TH-TH ALL_NON_EN_LOCALES:=ja-JP-JP th-TH-TH
SED_ARGS:=-e 's|$(HASH)warn This file is preprocessed before being compiled|// -- This file was mechanically generated: Do not edit! -- //|g' SED_ARGS:=-e 's|$(HASH)warn This file is preprocessed before being compiled|// -- This file was mechanically generated: Do not edit! -- //|g'
# This macro creates a sed expression that substitues for example: # This macro creates a sed expression that substitues for example:
# #FormatData_USLocales# with: en and/or en_US. # #FormatData_ENLocales# with: en% locales.
define CaptureLocale define CaptureLocale
$1_LOCALES := $$(subst _,-,$$(filter-out $1,$$(subst $1_,,$$(filter $1_%,$(LOCALE_RESOURCES))))) $1_LOCALES := $$(subst _,-,$$(filter-out $1,$$(subst $1_,,$$(filter $1_%,$(LOCALE_RESOURCES)))))
$1_US_LOCALES := $$(filter $(US_LOCALES),$$($1_LOCALES)) $1_EN_LOCALES := $$(filter $(EN_LOCALES),$$($1_LOCALES))
$1_NON_US_LOCALES := $$(filter-out $(US_LOCALES),$$($1_LOCALES)) $1_NON_EN_LOCALES := $$(filter-out $(EN_LOCALES),$$($1_LOCALES))
ALL_US_LOCALES += $$($1_US_LOCALES) ALL_EN_LOCALES += $$($1_EN_LOCALES)
ALL_NON_US_LOCALES += $$($1_NON_US_LOCALES) ALL_NON_EN_LOCALES += $$($1_NON_EN_LOCALES)
# Don't sed in a space if there are no locales. # Don't sed in a space if there are no locales.
SED_ARGS+= -e 's/$$(HASH)$1_USLocales$$(HASH)/$$(if $$($1_US_LOCALES),$$(SPACE)$$($1_US_LOCALES),)/g' SED_ARGS+= -e 's/$$(HASH)$1_ENLocales$$(HASH)/$$(if $$($1_EN_LOCALES),$$(SPACE)$$($1_EN_LOCALES),)/g'
SED_ARGS+= -e 's/$$(HASH)$1_NonUSLocales$$(HASH)/$$(if $$($1_NON_US_LOCALES),$$(SPACE)$$($1_NON_US_LOCALES),)/g' SED_ARGS+= -e 's/$$(HASH)$1_NonENLocales$$(HASH)/$$(if $$($1_NON_EN_LOCALES),$$(SPACE)$$($1_NON_EN_LOCALES),)/g'
endef endef
#sun.text.resources.FormatData #sun.text.resources.FormatData
...@@ -91,8 +91,8 @@ $(eval $(call CaptureLocale,CurrencyNames)) ...@@ -91,8 +91,8 @@ $(eval $(call CaptureLocale,CurrencyNames))
#sun.util.resources.CalendarData #sun.util.resources.CalendarData
$(eval $(call CaptureLocale,CalendarData)) $(eval $(call CaptureLocale,CalendarData))
SED_ARGS+= -e 's/$(HASH)AvailableLocales_USLocales$(HASH)/$(sort $(ALL_US_LOCALES))/g' SED_ARGS+= -e 's/$(HASH)AvailableLocales_ENLocales$(HASH)/$(sort $(ALL_EN_LOCALES))/g'
SED_ARGS+= -e 's/$(HASH)AvailableLocales_NonUSLocales$(HASH)/$(sort $(ALL_NON_US_LOCALES))/g' SED_ARGS+= -e 's/$(HASH)AvailableLocales_NonENLocales$(HASH)/$(sort $(ALL_NON_EN_LOCALES))/g'
$(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java: \ $(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java: \
$(JDK_TOPDIR)/src/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template $(JDK_TOPDIR)/src/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
......
...@@ -58,6 +58,13 @@ public class Association { ...@@ -58,6 +58,13 @@ public class Association {
/** /**
* Initializes a new instance of this class. * Initializes a new instance of this class.
*
* @param associationID
* The association ID
* @param maxInStreams
* The maximum number of inbound streams
* @param maxOutStreams
* The maximum number of outbound streams
*/ */
protected Association(int associationID, protected Association(int associationID,
int maxInStreams, int maxInStreams,
......
...@@ -41,6 +41,9 @@ public class IllegalReceiveException extends IllegalStateException { ...@@ -41,6 +41,9 @@ public class IllegalReceiveException extends IllegalStateException {
/** /**
* Constructs an instance of this class with the specified message. * Constructs an instance of this class with the specified message.
*
* @param msg
* The String that contains a detailed message
*/ */
public IllegalReceiveException(String msg) { public IllegalReceiveException(String msg) {
super(msg); super(msg);
......
...@@ -41,6 +41,9 @@ public class IllegalUnbindException extends IllegalStateException { ...@@ -41,6 +41,9 @@ public class IllegalUnbindException extends IllegalStateException {
/** /**
* Constructs an instance of this class with the specified detailed message. * Constructs an instance of this class with the specified detailed message.
*
* @param msg
* The String that contains a detailed message
*/ */
public IllegalUnbindException(String msg) { public IllegalUnbindException(String msg) {
super(msg); super(msg);
......
...@@ -40,6 +40,9 @@ public class InvalidStreamException extends IllegalArgumentException { ...@@ -40,6 +40,9 @@ public class InvalidStreamException extends IllegalArgumentException {
/** /**
* Constructs an instance of this class with the specified detailed message. * Constructs an instance of this class with the specified detailed message.
*
* @param msg
* The String that contains a detailed message
*/ */
public InvalidStreamException(String msg) { public InvalidStreamException(String msg) {
super(msg); super(msg);
......
...@@ -48,7 +48,7 @@ import java.net.SocketAddress; ...@@ -48,7 +48,7 @@ import java.net.SocketAddress;
* longer required to be sent after the time period expires. It is not a hard * longer required to be sent after the time period expires. It is not a hard
* timeout and may be influenced by whether the association supports the partial * timeout and may be influenced by whether the association supports the partial
* reliability extension, <a href=http://www.ietf.org/rfc/rfc3758.txt>RFC 3758 * reliability extension, <a href=http://www.ietf.org/rfc/rfc3758.txt>RFC 3758
* <a> * </a>.
* *
* <P> {@code MessageInfo} instances are not safe for use by multiple concurrent * <P> {@code MessageInfo} instances are not safe for use by multiple concurrent
* threads. If a MessageInfo is to be used by more than one thread then access * threads. If a MessageInfo is to be used by more than one thread then access
......
...@@ -40,6 +40,8 @@ package com.sun.nio.sctp; ...@@ -40,6 +40,8 @@ package com.sun.nio.sctp;
public interface Notification { public interface Notification {
/** /**
* Returns the association that this notification is applicable to. * Returns the association that this notification is applicable to.
*
* @return The association
*/ */
public Association association(); public Association association();
} }
...@@ -59,7 +59,7 @@ import java.nio.channels.SelectionKey; ...@@ -59,7 +59,7 @@ import java.nio.channels.SelectionKey;
* {@link #setOption(SctpSocketOption,Object) setOption} method. An SCTP * {@link #setOption(SctpSocketOption,Object) setOption} method. An SCTP
* channel support the following options: * channel support the following options:
* <blockquote> * <blockquote>
* <table border> * <table border summary="Socket options">
* <tr> * <tr>
* <th>Option Name</th> * <th>Option Name</th>
* <th>Description</th> * <th>Description</th>
...@@ -636,6 +636,9 @@ public abstract class SctpChannel ...@@ -636,6 +636,9 @@ public abstract class SctpChannel
/** /**
* Returns the value of a socket option. * Returns the value of a socket option.
* *
* @param <T>
* The type of the socket option value
*
* @param name * @param name
* The socket option * The socket option
* *
...@@ -659,6 +662,9 @@ public abstract class SctpChannel ...@@ -659,6 +662,9 @@ public abstract class SctpChannel
/** /**
* Sets the value of a socket option. * Sets the value of a socket option.
* *
* @param <T>
* The type of the socket option value
*
* @param name * @param name
* The socket option * The socket option
* *
...@@ -752,6 +758,9 @@ public abstract class SctpChannel ...@@ -752,6 +758,9 @@ public abstract class SctpChannel
* the {@code receive} method of this channel, if it does an * the {@code receive} method of this channel, if it does an
* {@link IllegalReceiveException} will be thrown. * {@link IllegalReceiveException} will be thrown.
* *
* @param <T>
* The type of the attachment
*
* @param dst * @param dst
* The buffer into which message bytes are to be transferred * The buffer into which message bytes are to be transferred
* *
...@@ -831,7 +840,7 @@ public abstract class SctpChannel ...@@ -831,7 +840,7 @@ public abstract class SctpChannel
* there was insufficient room for the message in the underlying * there was insufficient room for the message in the underlying
* output buffer * output buffer
* *
* @throws InvalidStreamExcepton * @throws InvalidStreamException
* If {@code streamNumner} is negative or greater than or equal to * If {@code streamNumner} is negative or greater than or equal to
* the maximum number of outgoing streams * the maximum number of outgoing streams
* *
......
...@@ -63,7 +63,7 @@ import java.nio.channels.SelectionKey; ...@@ -63,7 +63,7 @@ import java.nio.channels.SelectionKey;
* {@link #setOption(SctpSocketOption,Object,Association) setOption} method. An * {@link #setOption(SctpSocketOption,Object,Association) setOption} method. An
* {@code SctpMultiChannel} supports the following options: * {@code SctpMultiChannel} supports the following options:
* <blockquote> * <blockquote>
* <table border> * <table border summary="Socket options">
* <tr> * <tr>
* <th>Option Name</th> * <th>Option Name</th>
* <th>Description</th> * <th>Description</th>
...@@ -394,6 +394,9 @@ public abstract class SctpMultiChannel ...@@ -394,6 +394,9 @@ public abstract class SctpMultiChannel
* Returns all of the remote addresses to which the given association on * Returns all of the remote addresses to which the given association on
* this channel's socket is connected. * this channel's socket is connected.
* *
* @param association
* The association
*
* @return All of the remote addresses for the given association, or * @return All of the remote addresses for the given association, or
* an empty {@code Set} if the association has been shutdown * an empty {@code Set} if the association has been shutdown
* *
...@@ -431,6 +434,9 @@ public abstract class SctpMultiChannel ...@@ -431,6 +434,9 @@ public abstract class SctpMultiChannel
* ignored if given. However, if the option is association specific then the * ignored if given. However, if the option is association specific then the
* association must be given. * association must be given.
* *
* @param <T>
* The type of the socket option value
*
* @param name * @param name
* The socket option * The socket option
* *
...@@ -464,6 +470,9 @@ public abstract class SctpMultiChannel ...@@ -464,6 +470,9 @@ public abstract class SctpMultiChannel
* ignored if given. However, if the option is association specific then the * ignored if given. However, if the option is association specific then the
* association must be given. * association must be given.
* *
* @param <T>
* The type of the socket option value
*
* @param name * @param name
* The socket option * The socket option
* *
...@@ -567,6 +576,9 @@ public abstract class SctpMultiChannel ...@@ -567,6 +576,9 @@ public abstract class SctpMultiChannel
* the {@code receive} method of this channel, if it does an * the {@code receive} method of this channel, if it does an
* {@link IllegalReceiveException} will be thrown. * {@link IllegalReceiveException} will be thrown.
* *
* @param <T>
* The type of the attachment
*
* @param buffer * @param buffer
* The buffer into which bytes are to be transferred * The buffer into which bytes are to be transferred
* *
...@@ -673,7 +685,7 @@ public abstract class SctpMultiChannel ...@@ -673,7 +685,7 @@ public abstract class SctpMultiChannel
* there was insufficient room for the message in the underlying * there was insufficient room for the message in the underlying
* output buffer * output buffer
* *
* @throws InvalidStreamExcepton * @throws InvalidStreamException
* If {@code streamNumber} is negative, or if an association already * If {@code streamNumber} is negative, or if an association already
* exists and {@code streamNumber} is greater than the maximum number * exists and {@code streamNumber} is greater than the maximum number
* of outgoing streams * of outgoing streams
......
...@@ -47,7 +47,7 @@ import java.nio.channels.spi.AbstractSelectableChannel; ...@@ -47,7 +47,7 @@ import java.nio.channels.spi.AbstractSelectableChannel;
* {@link #setOption(SctpSocketOption,Object) setOption} method. SCTP server socket * {@link #setOption(SctpSocketOption,Object) setOption} method. SCTP server socket
* channels support the following options: * channels support the following options:
* <blockquote> * <blockquote>
* <table border> * <table border summary="Socket options">
* <tr> * <tr>
* <th>Option Name</th> * <th>Option Name</th>
* <th>Description</th> * <th>Description</th>
...@@ -345,6 +345,9 @@ public abstract class SctpServerChannel ...@@ -345,6 +345,9 @@ public abstract class SctpServerChannel
/** /**
* Returns the value of a socket option. * Returns the value of a socket option.
* *
* @param <T>
* The type of the socket option value
*
* @param name * @param name
* The socket option * The socket option
* *
...@@ -367,6 +370,9 @@ public abstract class SctpServerChannel ...@@ -367,6 +370,9 @@ public abstract class SctpServerChannel
/** /**
* Sets the value of a socket option. * Sets the value of a socket option.
* *
* @param <T>
* The type of the socket option value
*
* @param name * @param name
* The socket option * The socket option
* *
......
...@@ -821,6 +821,10 @@ public final class Class<T> implements java.io.Serializable, ...@@ -821,6 +821,10 @@ public final class Class<T> implements java.io.Serializable,
* <p> If this object represents a primitive type or void, the method * <p> If this object represents a primitive type or void, the method
* returns an array of length 0. * returns an array of length 0.
* *
* <p> If this {@code Class} object represents an array type, the
* interfaces {@code Cloneable} and {@code java.io.Serializable} are
* returned in that order.
*
* @return an array of interfaces implemented by this class. * @return an array of interfaces implemented by this class.
*/ */
public Class<?>[] getInterfaces() { public Class<?>[] getInterfaces() {
...@@ -1500,7 +1504,7 @@ public final class Class<T> implements java.io.Serializable, ...@@ -1500,7 +1504,7 @@ public final class Class<T> implements java.io.Serializable,
* <p> If this {@code Class} object represents an array type, a primitive * <p> If this {@code Class} object represents an array type, a primitive
* type, or void, then this method returns an array of length 0. * type, or void, then this method returns an array of length 0.
* *
* <p> The elements in the array returned are not sorted and are not in any * <p> The elements in the returned array are not sorted and are not in any
* particular order. * particular order.
* *
* @return the array of {@code Field} objects representing the * @return the array of {@code Field} objects representing the
...@@ -1525,23 +1529,33 @@ public final class Class<T> implements java.io.Serializable, ...@@ -1525,23 +1529,33 @@ public final class Class<T> implements java.io.Serializable,
/** /**
* Returns an array containing {@code Method} objects reflecting all * Returns an array containing {@code Method} objects reflecting all the
* the public <em>member</em> methods of the class or interface represented * public methods of the class or interface represented by this {@code
* by this {@code Class} object, including those declared by the class * Class} object, including those declared by the class or interface and
* or interface and those inherited from superclasses and * those inherited from superclasses and superinterfaces.
* superinterfaces. Array classes return all the (public) member methods
* inherited from the {@code Object} class. The elements in the array
* returned are not sorted and are not in any particular order. This
* method returns an array of length 0 if this {@code Class} object
* represents a class or interface that has no public member methods, or if
* this {@code Class} object represents a primitive type or void.
* *
* <p> The class initialization method {@code <clinit>} is not * <p> If this {@code Class} object represents a type that has multiple
* included in the returned array. If the class declares multiple public * public methods with the same name and parameter types, but different
* member methods with the same parameter types, they are all included in * return types, then the returned array has a {@code Method} object for
* the returned array. * each such method.
* *
* <p> See <em>The Java Language Specification</em>, sections 8.2 and 8.4. * <p> If this {@code Class} object represents a type with a class
* initialization method {@code <clinit>}, then the returned array does
* <em>not</em> have a corresponding {@code Method} object.
*
* <p> If this {@code Class} object represents an array type, then the
* returned array has a {@code Method} object for each of the public
* methods inherited by the array type from {@code Object}. It does not
* contain a {@code Method} object for {@code clone()}.
*
* <p> If this {@code Class} object represents a class or interface with no
* public methods, then the returned array has length 0.
*
* <p> If this {@code Class} object represents a primitive type or void,
* then the returned array has length 0.
*
* <p> The elements in the returned array are not sorted and are not in any
* particular order.
* *
* @return the array of {@code Method} objects representing the * @return the array of {@code Method} objects representing the
* public methods of this class * public methods of this class
...@@ -1553,6 +1567,8 @@ public final class Class<T> implements java.io.Serializable, ...@@ -1553,6 +1567,8 @@ public final class Class<T> implements java.io.Serializable,
* s.checkPackageAccess()} denies access to the package * s.checkPackageAccess()} denies access to the package
* of this class. * of this class.
* *
* @jls 8.2 Class Members
* @jls 8.4 Method Declarations
* @since JDK1.1 * @since JDK1.1
*/ */
@CallerSensitive @CallerSensitive
...@@ -1693,7 +1709,8 @@ public final class Class<T> implements java.io.Serializable, ...@@ -1693,7 +1709,8 @@ public final class Class<T> implements java.io.Serializable,
* method and the method being overridden would have the same * method and the method being overridden would have the same
* signature but different return types. * signature but different return types.
* *
* <p> See <em>The Java Language Specification</em>, sections 8.2 and 8.4. * <p> If this {@code Class} object represents an array type, then this
* method does not find the {@code clone()} method.
* *
* @param name the name of the method * @param name the name of the method
* @param parameterTypes the list of parameters * @param parameterTypes the list of parameters
...@@ -1710,6 +1727,8 @@ public final class Class<T> implements java.io.Serializable, ...@@ -1710,6 +1727,8 @@ public final class Class<T> implements java.io.Serializable,
* s.checkPackageAccess()} denies access to the package * s.checkPackageAccess()} denies access to the package
* of this class. * of this class.
* *
* @jls 8.2 Class Members
* @jls 8.4 Method Declarations
* @since JDK1.1 * @since JDK1.1
*/ */
@CallerSensitive @CallerSensitive
...@@ -1815,7 +1834,7 @@ public final class Class<T> implements java.io.Serializable, ...@@ -1815,7 +1834,7 @@ public final class Class<T> implements java.io.Serializable,
* <p> If this {@code Class} object represents an array type, a primitive * <p> If this {@code Class} object represents an array type, a primitive
* type, or void, then this method returns an array of length 0. * type, or void, then this method returns an array of length 0.
* *
* <p> The elements in the array returned are not sorted and are not in any * <p> The elements in the returned array are not sorted and are not in any
* particular order. * particular order.
* *
* @return the array of {@code Field} objects representing all the * @return the array of {@code Field} objects representing all the
...@@ -1853,20 +1872,29 @@ public final class Class<T> implements java.io.Serializable, ...@@ -1853,20 +1872,29 @@ public final class Class<T> implements java.io.Serializable,
/** /**
* Returns an array of {@code Method} objects reflecting all the
* methods declared by the class or interface represented by this
* {@code Class} object. This includes public, protected, default
* (package) access, and private methods, but excludes inherited methods.
* The elements in the array returned are not sorted and are not in any
* particular order. This method returns an array of length 0 if the class
* or interface declares no methods, or if this {@code Class} object
* represents a primitive type, an array class, or void. The class
* initialization method {@code <clinit>} is not included in the
* returned array. If the class declares multiple public member methods
* with the same parameter types, they are all included in the returned
* array.
* *
* <p> See <em>The Java Language Specification</em>, section 8.2. * Returns an array containing {@code Method} objects reflecting all the
* declared methods of the class or interface represented by this {@code
* Class} object, including public, protected, default (package)
* access, and private methods, but excluding inherited methods.
*
* <p> If this {@code Class} object represents a type that has multiple
* declared methods with the same name and parameter types, but different
* return types, then the returned array has a {@code Method} object for
* each such method.
*
* <p> If this {@code Class} object represents a type that has a class
* initialization method {@code <clinit>}, then the returned array does
* <em>not</em> have a corresponding {@code Method} object.
*
* <p> If this {@code Class} object represents a class or interface with no
* declared methods, then the returned array has length 0.
*
* <p> If this {@code Class} object represents an array type, a primitive
* type, or void, then the returned array has length 0.
*
* <p> The elements in the returned array are not sorted and are not in any
* particular order.
* *
* @return the array of {@code Method} objects representing all the * @return the array of {@code Method} objects representing all the
* declared methods of this class * declared methods of this class
...@@ -1891,6 +1919,8 @@ public final class Class<T> implements java.io.Serializable, ...@@ -1891,6 +1919,8 @@ public final class Class<T> implements java.io.Serializable,
* *
* </ul> * </ul>
* *
* @jls 8.2 Class Members
* @jls 8.4 Method Declarations
* @since JDK1.1 * @since JDK1.1
*/ */
@CallerSensitive @CallerSensitive
...@@ -2011,6 +2041,9 @@ public final class Class<T> implements java.io.Serializable, ...@@ -2011,6 +2041,9 @@ public final class Class<T> implements java.io.Serializable,
* name is "&lt;init&gt;"or "&lt;clinit&gt;" a {@code NoSuchMethodException} * name is "&lt;init&gt;"or "&lt;clinit&gt;" a {@code NoSuchMethodException}
* is raised. * is raised.
* *
* <p> If this {@code Class} object represents an array type, then this
* method does not find the {@code clone()} method.
*
* @param name the name of the method * @param name the name of the method
* @param parameterTypes the parameter array * @param parameterTypes the parameter array
* @return the {@code Method} object for the method of this class * @return the {@code Method} object for the method of this class
...@@ -2038,6 +2071,8 @@ public final class Class<T> implements java.io.Serializable, ...@@ -2038,6 +2071,8 @@ public final class Class<T> implements java.io.Serializable,
* *
* </ul> * </ul>
* *
* @jls 8.2 Class Members
* @jls 8.4 Method Declarations
* @since JDK1.1 * @since JDK1.1
*/ */
@CallerSensitive @CallerSensitive
......
...@@ -428,20 +428,32 @@ public abstract class Executable extends AccessibleObject ...@@ -428,20 +428,32 @@ public abstract class Executable extends AccessibleObject
} }
/** /**
* Returns an array of arrays that represent the annotations on * Returns an array of arrays of {@code Annotation}s that
* the formal parameters, in declaration order, of the executable * represent the annotations on the formal parameters, in
* represented by this object. (Returns an array of length zero if * declaration order, of the {@code Executable} represented by
* the underlying executable is parameterless. If the executable has * this object. Synthetic and mandated parameters (see
* one or more parameters, a nested array of length zero is * explanation below), such as the outer "this" parameter to an
* returned for each parameter with no annotations.) The * inner class constructor will be represented in the returned
* annotation objects contained in the returned arrays are * array. If the executable has no parameters (meaning no formal,
* serializable. The caller of this method is free to modify the * no synthetic, and no mandated parameters), a zero-length array
* returned arrays; it will have no effect on the arrays returned * will be returned. If the {@code Executable} has one or more
* to other callers. * parameters, a nested array of length zero is returned for each
* * parameter with no annotations. The annotation objects contained
* @return an array of arrays that represent the annotations on the formal * in the returned arrays are serializable. The caller of this
* parameters, in declaration order, of the executable represented by this * method is free to modify the returned arrays; it will have no
* object * effect on the arrays returned to other callers.
*
* A compiler may add extra parameters that are implicitly
* declared in source ("mandated"), as well as parameters that
* are neither implicitly nor explicitly declared in source
* ("synthetic") to the parameter list for a method. See {@link
* java.lang.reflect.Parameter} for more information.
*
* @see java.lang.reflect.Parameter
* @see java.lang.reflect.Parameter#getAnnotations
* @return an array of arrays that represent the annotations on
* the formal and implicit parameters, in declaration order, of
* the executable represented by this object
*/ */
public abstract Annotation[][] getParameterAnnotations(); public abstract Annotation[][] getParameterAnnotations();
......
...@@ -719,7 +719,3 @@ abstract class AbstractPlainSocketImpl extends SocketImpl ...@@ -719,7 +719,3 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
public final static int SHUT_RD = 0; public final static int SHUT_RD = 0;
public final static int SHUT_WR = 1; public final static int SHUT_WR = 1;
} }
class InetAddressContainer {
InetAddress addr;
}
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.net;
class InetAddressContainer {
InetAddress addr;
}
/* /*
* Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, 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
...@@ -93,6 +93,8 @@ public abstract class Activatable extends RemoteServer { ...@@ -93,6 +93,8 @@ public abstract class Activatable extends RemoteServer {
* @exception RemoteException if either of the following fails: * @exception RemoteException if either of the following fails:
* a) registering the object with the activation system or b) exporting * a) registering the object with the activation system or b) exporting
* the object to the RMI runtime. * the object to the RMI runtime.
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation.
* @since 1.2 * @since 1.2
**/ **/
protected Activatable(String location, protected Activatable(String location,
...@@ -143,6 +145,8 @@ public abstract class Activatable extends RemoteServer { ...@@ -143,6 +145,8 @@ public abstract class Activatable extends RemoteServer {
* @exception RemoteException if either of the following fails: * @exception RemoteException if either of the following fails:
* a) registering the object with the activation system or b) exporting * a) registering the object with the activation system or b) exporting
* the object to the RMI runtime. * the object to the RMI runtime.
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation.
* @since 1.2 * @since 1.2
**/ **/
protected Activatable(String location, protected Activatable(String location,
...@@ -175,6 +179,8 @@ public abstract class Activatable extends RemoteServer { ...@@ -175,6 +179,8 @@ public abstract class Activatable extends RemoteServer {
* @param port the port number on which the object is exported * @param port the port number on which the object is exported
* @exception RemoteException if exporting the object to the RMI * @exception RemoteException if exporting the object to the RMI
* runtime fails * runtime fails
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @since 1.2 * @since 1.2
*/ */
protected Activatable(ActivationID id, int port) protected Activatable(ActivationID id, int port)
...@@ -206,6 +212,8 @@ public abstract class Activatable extends RemoteServer { ...@@ -206,6 +212,8 @@ public abstract class Activatable extends RemoteServer {
* @param ssf the server-side socket factory for receiving remote calls * @param ssf the server-side socket factory for receiving remote calls
* @exception RemoteException if exporting the object to the RMI * @exception RemoteException if exporting the object to the RMI
* runtime fails * runtime fails
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @since 1.2 * @since 1.2
*/ */
protected Activatable(ActivationID id, int port, protected Activatable(ActivationID id, int port,
...@@ -239,6 +247,8 @@ public abstract class Activatable extends RemoteServer { ...@@ -239,6 +247,8 @@ public abstract class Activatable extends RemoteServer {
* is not registered with the activation system * is not registered with the activation system
* @exception ActivationException if activation system is not running * @exception ActivationException if activation system is not running
* @exception RemoteException if remote call fails * @exception RemoteException if remote call fails
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @since 1.2 * @since 1.2
*/ */
public static Remote register(ActivationDesc desc) public static Remote register(ActivationDesc desc)
...@@ -273,6 +283,8 @@ public abstract class Activatable extends RemoteServer { ...@@ -273,6 +283,8 @@ public abstract class Activatable extends RemoteServer {
* already be inactive) * already be inactive)
* @exception ActivationException if group is not active * @exception ActivationException if group is not active
* @exception RemoteException if call informing monitor fails * @exception RemoteException if call informing monitor fails
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @since 1.2 * @since 1.2
*/ */
public static boolean inactive(ActivationID id) public static boolean inactive(ActivationID id)
...@@ -290,6 +302,8 @@ public abstract class Activatable extends RemoteServer { ...@@ -290,6 +302,8 @@ public abstract class Activatable extends RemoteServer {
* @exception UnknownObjectException if object (<code>id</code>) is unknown * @exception UnknownObjectException if object (<code>id</code>) is unknown
* @exception ActivationException if activation system is not running * @exception ActivationException if activation system is not running
* @exception RemoteException if remote call to activation system fails * @exception RemoteException if remote call to activation system fails
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @since 1.2 * @since 1.2
*/ */
public static void unregister(ActivationID id) public static void unregister(ActivationID id)
...@@ -334,6 +348,8 @@ public abstract class Activatable extends RemoteServer { ...@@ -334,6 +348,8 @@ public abstract class Activatable extends RemoteServer {
* the wrong group * the wrong group
* @exception ActivationException if activation group is not active * @exception ActivationException if activation group is not active
* @exception RemoteException if object registration or export fails * @exception RemoteException if object registration or export fails
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @since 1.2 * @since 1.2
**/ **/
public static ActivationID exportObject(Remote obj, public static ActivationID exportObject(Remote obj,
...@@ -407,6 +423,8 @@ public abstract class Activatable extends RemoteServer { ...@@ -407,6 +423,8 @@ public abstract class Activatable extends RemoteServer {
* descriptor with the activation system * descriptor with the activation system
* @exception ActivationException if activation group is not active * @exception ActivationException if activation group is not active
* @exception RemoteException if object registration or export fails * @exception RemoteException if object registration or export fails
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @since 1.2 * @since 1.2
**/ **/
public static ActivationID exportObject(Remote obj, public static ActivationID exportObject(Remote obj,
...@@ -473,6 +491,8 @@ public abstract class Activatable extends RemoteServer { ...@@ -473,6 +491,8 @@ public abstract class Activatable extends RemoteServer {
* @param port the port on which the object is exported (an anonymous * @param port the port on which the object is exported (an anonymous
* port is used if port=0) * port is used if port=0)
* @exception RemoteException if object export fails * @exception RemoteException if object export fails
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @since 1.2 * @since 1.2
*/ */
public static Remote exportObject(Remote obj, public static Remote exportObject(Remote obj,
...@@ -503,6 +523,8 @@ public abstract class Activatable extends RemoteServer { ...@@ -503,6 +523,8 @@ public abstract class Activatable extends RemoteServer {
* remote object * remote object
* @param ssf the server-side socket factory for receiving remote calls * @param ssf the server-side socket factory for receiving remote calls
* @exception RemoteException if object export fails * @exception RemoteException if object export fails
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @since 1.2 * @since 1.2
*/ */
public static Remote exportObject(Remote obj, public static Remote exportObject(Remote obj,
...@@ -531,6 +553,8 @@ public abstract class Activatable extends RemoteServer { ...@@ -531,6 +553,8 @@ public abstract class Activatable extends RemoteServer {
* @return true if operation is successful, false otherwise * @return true if operation is successful, false otherwise
* @exception NoSuchObjectException if the remote object is not * @exception NoSuchObjectException if the remote object is not
* currently exported * currently exported
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @since 1.2 * @since 1.2
*/ */
public static boolean unexportObject(Remote obj, boolean force) public static boolean unexportObject(Remote obj, boolean force)
......
/* /*
* Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, 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
...@@ -105,6 +105,8 @@ public final class ActivationDesc implements Serializable { ...@@ -105,6 +105,8 @@ public final class ActivationDesc implements Serializable {
* @param data the object's initialization (activation) data contained * @param data the object's initialization (activation) data contained
* in marshalled form. * in marshalled form.
* @exception ActivationException if the current group is nonexistent * @exception ActivationException if the current group is nonexistent
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @since 1.2 * @since 1.2
*/ */
public ActivationDesc(String className, public ActivationDesc(String className,
...@@ -142,6 +144,8 @@ public final class ActivationDesc implements Serializable { ...@@ -142,6 +144,8 @@ public final class ActivationDesc implements Serializable {
* <code>true</code> does not force an initial immediate activation of * <code>true</code> does not force an initial immediate activation of
* a newly registered object; initial activation is lazy. * a newly registered object; initial activation is lazy.
* @exception ActivationException if the current group is nonexistent * @exception ActivationException if the current group is nonexistent
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @since 1.2 * @since 1.2
*/ */
public ActivationDesc(String className, public ActivationDesc(String className,
...@@ -176,6 +180,8 @@ public final class ActivationDesc implements Serializable { ...@@ -176,6 +180,8 @@ public final class ActivationDesc implements Serializable {
* @param data the object's initialization (activation) data contained * @param data the object's initialization (activation) data contained
* in marshalled form. * in marshalled form.
* @exception IllegalArgumentException if <code>groupID</code> is null * @exception IllegalArgumentException if <code>groupID</code> is null
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @since 1.2 * @since 1.2
*/ */
public ActivationDesc(ActivationGroupID groupID, public ActivationDesc(ActivationGroupID groupID,
...@@ -208,6 +214,8 @@ public final class ActivationDesc implements Serializable { ...@@ -208,6 +214,8 @@ public final class ActivationDesc implements Serializable {
* <code>true</code> does not force an initial immediate activation of * <code>true</code> does not force an initial immediate activation of
* a newly registered object; initial activation is lazy. * a newly registered object; initial activation is lazy.
* @exception IllegalArgumentException if <code>groupID</code> is null * @exception IllegalArgumentException if <code>groupID</code> is null
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @since 1.2 * @since 1.2
*/ */
public ActivationDesc(ActivationGroupID groupID, public ActivationDesc(ActivationGroupID groupID,
......
/* /*
* Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, 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
...@@ -133,6 +133,8 @@ public abstract class ActivationGroup ...@@ -133,6 +133,8 @@ public abstract class ActivationGroup
* *
* @param groupID the group's identifier * @param groupID the group's identifier
* @throws RemoteException if this group could not be exported * @throws RemoteException if this group could not be exported
* @throws UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @since 1.2 * @since 1.2
*/ */
protected ActivationGroup(ActivationGroupID groupID) protected ActivationGroup(ActivationGroupID groupID)
...@@ -267,6 +269,8 @@ public abstract class ActivationGroup ...@@ -267,6 +269,8 @@ public abstract class ActivationGroup
* (Note: The default implementation of the security manager * (Note: The default implementation of the security manager
* <code>checkSetFactory</code> * <code>checkSetFactory</code>
* method requires the RuntimePermission "setFactory") * method requires the RuntimePermission "setFactory")
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @see SecurityManager#checkSetFactory * @see SecurityManager#checkSetFactory
* @since 1.2 * @since 1.2
*/ */
...@@ -345,6 +349,8 @@ public abstract class ActivationGroup ...@@ -345,6 +349,8 @@ public abstract class ActivationGroup
/** /**
* Returns the current activation group's identifier. Returns null * Returns the current activation group's identifier. Returns null
* if no group is currently active for this VM. * if no group is currently active for this VM.
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @return the activation group's identifier * @return the activation group's identifier
* @since 1.2 * @since 1.2
*/ */
...@@ -394,6 +400,8 @@ public abstract class ActivationGroup ...@@ -394,6 +400,8 @@ public abstract class ActivationGroup
* (Note: The default implementation of the security manager * (Note: The default implementation of the security manager
* <code>checkSetFactory</code> * <code>checkSetFactory</code>
* method requires the RuntimePermission "setFactory") * method requires the RuntimePermission "setFactory")
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @see #getSystem * @see #getSystem
* @see SecurityManager#checkSetFactory * @see SecurityManager#checkSetFactory
* @since 1.2 * @since 1.2
...@@ -428,6 +436,8 @@ public abstract class ActivationGroup ...@@ -428,6 +436,8 @@ public abstract class ActivationGroup
* @exception ActivationException if activation system cannot be * @exception ActivationException if activation system cannot be
* obtained or is not bound * obtained or is not bound
* (means that it is not running) * (means that it is not running)
* @exception UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @see #setSystem * @see #setSystem
* @since 1.2 * @since 1.2
*/ */
......
/* /*
* Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, 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
...@@ -63,6 +63,8 @@ public class ActivationGroupID implements java.io.Serializable { ...@@ -63,6 +63,8 @@ public class ActivationGroupID implements java.io.Serializable {
* Constructs a unique group id. * Constructs a unique group id.
* *
* @param system the group's activation system * @param system the group's activation system
* @throws UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @since 1.2 * @since 1.2
*/ */
public ActivationGroupID(ActivationSystem system) { public ActivationGroupID(ActivationSystem system) {
......
/* /*
* Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, 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
...@@ -90,6 +90,8 @@ public class ActivationID implements Serializable { ...@@ -90,6 +90,8 @@ public class ActivationID implements Serializable {
* *
* @param activator reference to the activator responsible for * @param activator reference to the activator responsible for
* activating the object * activating the object
* @throws UnsupportedOperationException if and only if activation is
* not supported by this implementation
* @since 1.2 * @since 1.2
*/ */
public ActivationID(Activator activator) { public ActivationID(Activator activator) {
......
<!-- <!--
Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. Copyright (c) 1998, 2013, 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
...@@ -31,6 +31,15 @@ Provides support for RMI Object Activation. A remote ...@@ -31,6 +31,15 @@ Provides support for RMI Object Activation. A remote
object's reference can be made ``persistent'' and later activated into a object's reference can be made ``persistent'' and later activated into a
``live'' object using the RMI activation mechanism. ``live'' object using the RMI activation mechanism.
<p>Implementations are not required to support the activation
mechanism. If activation is not supported by this implementation,
several specific activation API methods are all required to throw
{@code UnsupportedOperationException}. If activation is supported by this
implementation, these methods must never throw {@code
UnsupportedOperationException}. These methods are denoted by the
presence of an entry for {@code UnsupportedOperationException} in the
<strong>Throws</strong> section of each method's specification.
<!-- <!--
<h2>Package Specification</h2> <h2>Package Specification</h2>
......
...@@ -279,6 +279,9 @@ public final class AccessController { ...@@ -279,6 +279,9 @@ public final class AccessController {
* <p> Note that any DomainCombiner associated with the current * <p> Note that any DomainCombiner associated with the current
* AccessControlContext will be ignored while the action is performed. * AccessControlContext will be ignored while the action is performed.
* *
* @param <T> the type of the value returned by the PrivilegedAction's
* {@code run} method.
*
* @param action the action to be performed. * @param action the action to be performed.
* *
* @return the value returned by the action's {@code run} method. * @return the value returned by the action's {@code run} method.
...@@ -305,6 +308,9 @@ public final class AccessController { ...@@ -305,6 +308,9 @@ public final class AccessController {
* <p> This method preserves the current AccessControlContext's * <p> This method preserves the current AccessControlContext's
* DomainCombiner (which may be null) while the action is performed. * DomainCombiner (which may be null) while the action is performed.
* *
* @param <T> the type of the value returned by the PrivilegedAction's
* {@code run} method.
*
* @param action the action to be performed. * @param action the action to be performed.
* *
* @return the value returned by the action's {@code run} method. * @return the value returned by the action's {@code run} method.
...@@ -344,6 +350,8 @@ public final class AccessController { ...@@ -344,6 +350,8 @@ public final class AccessController {
* {@link java.security.SecurityPermission}, then the action is performed * {@link java.security.SecurityPermission}, then the action is performed
* with no permissions. * with no permissions.
* *
* @param <T> the type of the value returned by the PrivilegedAction's
* {@code run} method.
* @param action the action to be performed. * @param action the action to be performed.
* @param context an <i>access control context</i> * @param context an <i>access control context</i>
* representing the restriction to be applied to the * representing the restriction to be applied to the
...@@ -377,6 +385,8 @@ public final class AccessController { ...@@ -377,6 +385,8 @@ public final class AccessController {
* If the action's {@code run} method throws an (unchecked) exception, * If the action's {@code run} method throws an (unchecked) exception,
* it will propagate through this method. * it will propagate through this method.
* *
* @param <T> the type of the value returned by the PrivilegedAction's
* {@code run} method.
* @param action the action to be performed. * @param action the action to be performed.
* @param context an <i>access control context</i> * @param context an <i>access control context</i>
* representing the restriction to be applied to the * representing the restriction to be applied to the
...@@ -429,6 +439,8 @@ public final class AccessController { ...@@ -429,6 +439,8 @@ public final class AccessController {
* <p> This method preserves the current AccessControlContext's * <p> This method preserves the current AccessControlContext's
* DomainCombiner (which may be null) while the action is performed. * DomainCombiner (which may be null) while the action is performed.
* *
* @param <T> the type of the value returned by the PrivilegedAction's
* {@code run} method.
* @param action the action to be performed. * @param action the action to be performed.
* @param context an <i>access control context</i> * @param context an <i>access control context</i>
* representing the restriction to be applied to the * representing the restriction to be applied to the
...@@ -479,6 +491,9 @@ public final class AccessController { ...@@ -479,6 +491,9 @@ public final class AccessController {
* <p> Note that any DomainCombiner associated with the current * <p> Note that any DomainCombiner associated with the current
* AccessControlContext will be ignored while the action is performed. * AccessControlContext will be ignored while the action is performed.
* *
* @param <T> the type of the value returned by the
* PrivilegedExceptionAction's {@code run} method.
*
* @param action the action to be performed * @param action the action to be performed
* *
* @return the value returned by the action's {@code run} method * @return the value returned by the action's {@code run} method
...@@ -509,6 +524,9 @@ public final class AccessController { ...@@ -509,6 +524,9 @@ public final class AccessController {
* <p> This method preserves the current AccessControlContext's * <p> This method preserves the current AccessControlContext's
* DomainCombiner (which may be null) while the action is performed. * DomainCombiner (which may be null) while the action is performed.
* *
* @param <T> the type of the value returned by the
* PrivilegedExceptionAction's {@code run} method.
*
* @param action the action to be performed. * @param action the action to be performed.
* *
* @return the value returned by the action's {@code run} method * @return the value returned by the action's {@code run} method
...@@ -585,6 +603,8 @@ public final class AccessController { ...@@ -585,6 +603,8 @@ public final class AccessController {
* {@link java.security.SecurityPermission}, then the action is performed * {@link java.security.SecurityPermission}, then the action is performed
* with no permissions. * with no permissions.
* *
* @param <T> the type of the value returned by the
* PrivilegedExceptionAction's {@code run} method.
* @param action the action to be performed * @param action the action to be performed
* @param context an <i>access control context</i> * @param context an <i>access control context</i>
* representing the restriction to be applied to the * representing the restriction to be applied to the
...@@ -622,6 +642,8 @@ public final class AccessController { ...@@ -622,6 +642,8 @@ public final class AccessController {
* If the action's {@code run} method throws an (unchecked) exception, * If the action's {@code run} method throws an (unchecked) exception,
* it will propagate through this method. * it will propagate through this method.
* *
* @param <T> the type of the value returned by the
* PrivilegedExceptionAction's {@code run} method.
* @param action the action to be performed. * @param action the action to be performed.
* @param context an <i>access control context</i> * @param context an <i>access control context</i>
* representing the restriction to be applied to the * representing the restriction to be applied to the
...@@ -676,6 +698,8 @@ public final class AccessController { ...@@ -676,6 +698,8 @@ public final class AccessController {
* <p> This method preserves the current AccessControlContext's * <p> This method preserves the current AccessControlContext's
* DomainCombiner (which may be null) while the action is performed. * DomainCombiner (which may be null) while the action is performed.
* *
* @param <T> the type of the value returned by the
* PrivilegedExceptionAction's {@code run} method.
* @param action the action to be performed. * @param action the action to be performed.
* @param context an <i>access control context</i> * @param context an <i>access control context</i>
* representing the restriction to be applied to the * representing the restriction to be applied to the
......
...@@ -324,6 +324,7 @@ public class AlgorithmParameters { ...@@ -324,6 +324,7 @@ public class AlgorithmParameters {
* parameters should be returned in an instance of the * parameters should be returned in an instance of the
* {@code DSAParameterSpec} class. * {@code DSAParameterSpec} class.
* *
* @param <T> the type of the parameter specification to be returrned
* @param paramSpec the specification class in which * @param paramSpec the specification class in which
* the parameters should be returned. * the parameters should be returned.
* *
......
...@@ -102,6 +102,8 @@ public abstract class AlgorithmParametersSpi { ...@@ -102,6 +102,8 @@ public abstract class AlgorithmParametersSpi {
* parameters should be returned in an instance of the * parameters should be returned in an instance of the
* {@code DSAParameterSpec} class. * {@code DSAParameterSpec} class.
* *
* @param <T> the type of the parameter specification to be returned
*
* @param paramSpec the specification class in which * @param paramSpec the specification class in which
* the parameters should be returned. * the parameters should be returned.
* *
......
...@@ -395,6 +395,8 @@ public class KeyFactory { ...@@ -395,6 +395,8 @@ public class KeyFactory {
* key material should be returned in an instance of the * key material should be returned in an instance of the
* {@code DSAPublicKeySpec} class. * {@code DSAPublicKeySpec} class.
* *
* @param <T> the type of the key specification to be returned
*
* @param key the key. * @param key the key.
* *
* @param keySpec the specification class in which * @param keySpec the specification class in which
......
...@@ -106,6 +106,8 @@ public abstract class KeyFactorySpi { ...@@ -106,6 +106,8 @@ public abstract class KeyFactorySpi {
* key material should be returned in an instance of the * key material should be returned in an instance of the
* {@code DSAPublicKeySpec} class. * {@code DSAPublicKeySpec} class.
* *
* @param <T> the type of the key specification to be returned
*
* @param key the key. * @param key the key.
* *
* @param keySpec the specification class in which * @param keySpec the specification class in which
......
...@@ -1753,6 +1753,7 @@ public class KeyStore { ...@@ -1753,6 +1753,7 @@ public class KeyStore {
/** /**
* Returns the KeyStore described by this object. * Returns the KeyStore described by this object.
* *
* @return the {@code KeyStore} described by this object
* @exception KeyStoreException if an error occured during the * @exception KeyStoreException if an error occured during the
* operation, for example if the KeyStore could not be * operation, for example if the KeyStore could not be
* instantiated or loaded * instantiated or loaded
......
/* /*
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2013, 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
...@@ -81,6 +81,7 @@ public interface Principal { ...@@ -81,6 +81,7 @@ public interface Principal {
* <p>Subclasses may override this with a different implementation, if * <p>Subclasses may override this with a different implementation, if
* necessary. * necessary.
* *
* @param subject the {@code Subject}
* @return true if {@code subject} is non-null and is * @return true if {@code subject} is non-null and is
* implied by this principal, or false otherwise. * implied by this principal, or false otherwise.
* @since 1.8 * @since 1.8
......
...@@ -87,6 +87,8 @@ public abstract class CertPathBuilderSpi { ...@@ -87,6 +87,8 @@ public abstract class CertPathBuilderSpi {
* service providers, this method cannot be abstract and by default throws * service providers, this method cannot be abstract and by default throws
* an {@code UnsupportedOperationException}. * an {@code UnsupportedOperationException}.
* *
* @return a {@code CertPathChecker} that this implementation uses to
* check the revocation status of certificates
* @throws UnsupportedOperationException if this method is not supported * @throws UnsupportedOperationException if this method is not supported
* @since 1.8 * @since 1.8
*/ */
......
...@@ -97,6 +97,8 @@ public abstract class CertPathValidatorSpi { ...@@ -97,6 +97,8 @@ public abstract class CertPathValidatorSpi {
* service providers, this method cannot be abstract and by default throws * service providers, this method cannot be abstract and by default throws
* an {@code UnsupportedOperationException}. * an {@code UnsupportedOperationException}.
* *
* @return a {@code CertPathChecker} that this implementation uses to
* check the revocation status of certificates
* @throws UnsupportedOperationException if this method is not supported * @throws UnsupportedOperationException if this method is not supported
* @since 1.8 * @since 1.8
*/ */
......
...@@ -103,6 +103,9 @@ public abstract class PKIXRevocationChecker extends PKIXCertPathChecker { ...@@ -103,6 +103,9 @@ public abstract class PKIXRevocationChecker extends PKIXCertPathChecker {
private Map<X509Certificate, byte[]> ocspResponses = Collections.emptyMap(); private Map<X509Certificate, byte[]> ocspResponses = Collections.emptyMap();
private Set<Option> options = Collections.emptySet(); private Set<Option> options = Collections.emptySet();
/**
* Default constructor.
*/
protected PKIXRevocationChecker() {} protected PKIXRevocationChecker() {}
/** /**
......
/* /*
* Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2013, 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,6 +46,11 @@ import java.security.spec.RSAOtherPrimeInfo; ...@@ -46,6 +46,11 @@ import java.security.spec.RSAOtherPrimeInfo;
public interface RSAMultiPrimePrivateCrtKey extends RSAPrivateKey { public interface RSAMultiPrimePrivateCrtKey extends RSAPrivateKey {
/**
* The type fingerprint that is set to indicate
* serialization compatibility with a previous
* version of the type.
*/
static final long serialVersionUID = 618058533534628008L; static final long serialVersionUID = 618058533534628008L;
/** /**
......
/* /*
* Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, 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
...@@ -39,6 +39,11 @@ import java.math.BigInteger; ...@@ -39,6 +39,11 @@ import java.math.BigInteger;
public interface RSAPrivateCrtKey extends RSAPrivateKey { public interface RSAPrivateCrtKey extends RSAPrivateKey {
/**
* The type fingerprint that is set to indicate
* serialization compatibility with a previous
* version of the type.
*/
static final long serialVersionUID = -5682214253527700368L; static final long serialVersionUID = -5682214253527700368L;
/** /**
......
/* /*
* Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, 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
...@@ -39,6 +39,11 @@ import java.math.BigInteger; ...@@ -39,6 +39,11 @@ import java.math.BigInteger;
public interface RSAPrivateKey extends java.security.PrivateKey, RSAKey public interface RSAPrivateKey extends java.security.PrivateKey, RSAKey
{ {
/**
* The type fingerprint that is set to indicate
* serialization compatibility with a previous
* version of the type.
*/
static final long serialVersionUID = 5187144804936595022L; static final long serialVersionUID = 5187144804936595022L;
/** /**
......
/* /*
* Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, 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
...@@ -36,6 +36,11 @@ import java.math.BigInteger; ...@@ -36,6 +36,11 @@ import java.math.BigInteger;
public interface RSAPublicKey extends java.security.PublicKey, RSAKey public interface RSAPublicKey extends java.security.PublicKey, RSAKey
{ {
/**
* The type fingerprint that is set to indicate
* serialization compatibility with a previous
* version of the type.
*/
static final long serialVersionUID = -8727434096241101194L; static final long serialVersionUID = -8727434096241101194L;
/** /**
......
...@@ -144,7 +144,7 @@ import sun.misc.SharedSecrets; ...@@ -144,7 +144,7 @@ import sun.misc.SharedSecrets;
public class LogManager { public class LogManager {
// The global LogManager object // The global LogManager object
private static LogManager manager; private static final LogManager manager;
private Properties props = new Properties(); private Properties props = new Properties();
private final static Level defaultLevel = Level.INFO; private final static Level defaultLevel = Level.INFO;
...@@ -156,8 +156,10 @@ public class LogManager { ...@@ -156,8 +156,10 @@ public class LogManager {
// LoggerContext for system loggers and user loggers // LoggerContext for system loggers and user loggers
private final LoggerContext systemContext = new SystemLoggerContext(); private final LoggerContext systemContext = new SystemLoggerContext();
private final LoggerContext userContext = new LoggerContext(); private final LoggerContext userContext = new LoggerContext();
private Logger rootLogger; // non final field - make it volatile to make sure that other threads
// will see the new value once ensureLogManagerInitialized() has finished
// executing.
private volatile Logger rootLogger;
// Have we done the primordial reading of the configuration file? // Have we done the primordial reading of the configuration file?
// (Must be done after a suitable amount of java.lang.System // (Must be done after a suitable amount of java.lang.System
// initialization has been done) // initialization has been done)
...@@ -169,56 +171,33 @@ public class LogManager { ...@@ -169,56 +171,33 @@ public class LogManager {
private boolean deathImminent; private boolean deathImminent;
static { static {
AccessController.doPrivileged(new PrivilegedAction<Object>() { manager = AccessController.doPrivileged(new PrivilegedAction<LogManager>() {
public Object run() { @Override
public LogManager run() {
LogManager mgr = null;
String cname = null; String cname = null;
try { try {
cname = System.getProperty("java.util.logging.manager"); cname = System.getProperty("java.util.logging.manager");
if (cname != null) { if (cname != null) {
try { try {
Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(cname); Class<?> clz = ClassLoader.getSystemClassLoader()
manager = (LogManager) clz.newInstance(); .loadClass(cname);
mgr = (LogManager) clz.newInstance();
} catch (ClassNotFoundException ex) { } catch (ClassNotFoundException ex) {
Class<?> clz = Thread.currentThread().getContextClassLoader().loadClass(cname); Class<?> clz = Thread.currentThread()
manager = (LogManager) clz.newInstance(); .getContextClassLoader().loadClass(cname);
mgr = (LogManager) clz.newInstance();
} }
} }
} catch (Exception ex) { } catch (Exception ex) {
System.err.println("Could not load Logmanager \"" + cname + "\""); System.err.println("Could not load Logmanager \"" + cname + "\"");
ex.printStackTrace(); ex.printStackTrace();
} }
if (manager == null) { if (mgr == null) {
manager = new LogManager(); mgr = new LogManager();
} }
return mgr;
// Create and retain Logger for the root of the namespace.
manager.rootLogger = manager.new RootLogger();
// since by design the global manager's userContext and
// systemContext don't have their requiresDefaultLoggers
// flag set - we make sure to add the root logger to
// the global manager's default contexts here.
manager.addLogger(manager.rootLogger);
manager.systemContext.addLocalLogger(manager.rootLogger, false);
manager.userContext.addLocalLogger(manager.rootLogger, false);
// Adding the global Logger. Doing so in the Logger.<clinit>
// would deadlock with the LogManager.<clinit>.
// Do not call Logger.getGlobal() here as this might trigger
// the deadlock too.
@SuppressWarnings("deprecation")
final Logger global = Logger.global;
global.setLogManager(manager);
// Make sure the global logger will be registered in the
// global manager's default contexts.
manager.addLogger(global);
manager.systemContext.addLocalLogger(global, false);
manager.userContext.addLocalLogger(global, false);
// We don't call readConfiguration() here, as we may be running
// very early in the JVM startup sequence. Instead readConfiguration
// will be called lazily in getLogManager().
return null;
} }
}); });
} }
...@@ -235,6 +214,7 @@ public class LogManager { ...@@ -235,6 +214,7 @@ public class LogManager {
this.setContextClassLoader(null); this.setContextClassLoader(null);
} }
@Override
public void run() { public void run() {
// This is to ensure the LogManager.<clinit> is completed // This is to ensure the LogManager.<clinit> is completed
// before synchronized block. Otherwise deadlocks are possible. // before synchronized block. Otherwise deadlocks are possible.
...@@ -270,13 +250,104 @@ public class LogManager { ...@@ -270,13 +250,104 @@ public class LogManager {
} }
} }
/**
* Lazy initialization: if this instance of manager is the global
* manager then this method will read the initial configuration and
* add the root logger and global logger by calling addLogger().
*
* Note that it is subtly different from what we do in LoggerContext.
* In LoggerContext we're patching up the logger context tree in order to add
* the root and global logger *to the context tree*.
*
* For this to work, addLogger() must have already have been called
* once on the LogManager instance for the default logger being
* added.
*
* This is why ensureLogManagerInitialized() needs to be called before
* any logger is added to any logger context.
*
*/
private boolean initializedCalled = false;
private volatile boolean initializationDone = false;
final void ensureLogManagerInitialized() {
final LogManager owner = this;
if (initializationDone || owner != manager) {
// we don't want to do this twice, and we don't want to do
// this on private manager instances.
return;
}
// Maybe another thread has called ensureLogManagerInitialized()
// before us and is still executing it. If so we will block until
// the log manager has finished initialized, then acquire the monitor,
// notice that initializationDone is now true and return.
// Otherwise - we have come here first! We will acquire the monitor,
// see that initializationDone is still false, and perform the
// initialization.
//
synchronized(this) {
// If initializedCalled is true it means that we're already in
// the process of initializing the LogManager in this thread.
// There has been a recursive call to ensureLogManagerInitialized().
final boolean isRecursiveInitialization = (initializedCalled == true);
assert initializedCalled || !initializationDone
: "Initialization can't be done if initialized has not been called!";
if (isRecursiveInitialization || initializationDone) {
// If isRecursiveInitialization is true it means that we're
// already in the process of initializing the LogManager in
// this thread. There has been a recursive call to
// ensureLogManagerInitialized(). We should not proceed as
// it would lead to infinite recursion.
//
// If initializationDone is true then it means the manager
// has finished initializing; just return: we're done.
return;
}
// Calling addLogger below will in turn call requiresDefaultLogger()
// which will call ensureLogManagerInitialized().
// We use initializedCalled to break the recursion.
initializedCalled = true;
try {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
assert rootLogger == null;
assert initializedCalled && !initializationDone;
// Read configuration.
owner.readPrimordialConfiguration();
// Create and retain Logger for the root of the namespace.
owner.rootLogger = owner.new RootLogger();
owner.addLogger(owner.rootLogger);
// Adding the global Logger.
// Do not call Logger.getGlobal() here as this might trigger
// subtle inter-dependency issues.
@SuppressWarnings("deprecation")
final Logger global = Logger.global;
// Make sure the global logger will be registered in the
// global manager
owner.addLogger(global);
return null;
}
});
} finally {
initializationDone = true;
}
}
}
/** /**
* Returns the global LogManager object. * Returns the global LogManager object.
* @return the global LogManager object * @return the global LogManager object
*/ */
public static LogManager getLogManager() { public static LogManager getLogManager() {
if (manager != null) { if (manager != null) {
manager.readPrimordialConfiguration(); manager.ensureLogManagerInitialized();
} }
return manager; return manager;
} }
...@@ -295,6 +366,7 @@ public class LogManager { ...@@ -295,6 +366,7 @@ public class LogManager {
try { try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception { public Void run() throws Exception {
readConfiguration(); readConfiguration();
...@@ -304,8 +376,7 @@ public class LogManager { ...@@ -304,8 +376,7 @@ public class LogManager {
} }
}); });
} catch (Exception ex) { } catch (Exception ex) {
// System.err.println("Can't read logging configuration:"); assert false : "Exception raised while reading logging configuration: " + ex;
// ex.printStackTrace();
} }
} }
} }
...@@ -392,7 +463,7 @@ public class LogManager { ...@@ -392,7 +463,7 @@ public class LogManager {
} }
// LoggerContext maps from AppContext // LoggerContext maps from AppContext
private static WeakHashMap<Object, LoggerContext> contextsMap = null; private WeakHashMap<Object, LoggerContext> contextsMap = null;
// Returns the LoggerContext for the user code (i.e. application or AppContext). // Returns the LoggerContext for the user code (i.e. application or AppContext).
// Loggers are isolated from each AppContext. // Loggers are isolated from each AppContext.
...@@ -414,10 +485,7 @@ public class LogManager { ...@@ -414,10 +485,7 @@ public class LogManager {
context = contextsMap.get(ecx); context = contextsMap.get(ecx);
if (context == null) { if (context == null) {
// Create a new LoggerContext for the applet. // Create a new LoggerContext for the applet.
// The new logger context has its requiresDefaultLoggers context = new LoggerContext();
// flag set to true - so that these loggers will be
// lazily added when the context is firt accessed.
context = new LoggerContext(true);
contextsMap.put(ecx, context); contextsMap.put(ecx, context);
} }
} }
...@@ -427,9 +495,14 @@ public class LogManager { ...@@ -427,9 +495,14 @@ public class LogManager {
return context != null ? context : userContext; return context != null ? context : userContext;
} }
// The system context.
final LoggerContext getSystemContext() {
return systemContext;
}
private List<LoggerContext> contexts() { private List<LoggerContext> contexts() {
List<LoggerContext> cxs = new ArrayList<>(); List<LoggerContext> cxs = new ArrayList<>();
cxs.add(systemContext); cxs.add(getSystemContext());
cxs.add(getUserContext()); cxs.add(getUserContext());
return cxs; return cxs;
} }
...@@ -450,7 +523,7 @@ public class LogManager { ...@@ -450,7 +523,7 @@ public class LogManager {
Logger result = getLogger(name); Logger result = getLogger(name);
if (result == null) { if (result == null) {
// only allocate the new logger once // only allocate the new logger once
Logger newLogger = new Logger(name, resourceBundleName, caller); Logger newLogger = new Logger(name, resourceBundleName, caller, this);
do { do {
if (addLogger(newLogger)) { if (addLogger(newLogger)) {
// We successfully added the new Logger that we // We successfully added the new Logger that we
...@@ -477,7 +550,7 @@ public class LogManager { ...@@ -477,7 +550,7 @@ public class LogManager {
Logger demandSystemLogger(String name, String resourceBundleName) { Logger demandSystemLogger(String name, String resourceBundleName) {
// Add a system logger in the system context's namespace // Add a system logger in the system context's namespace
final Logger sysLogger = systemContext.demandLogger(name, resourceBundleName); final Logger sysLogger = getSystemContext().demandLogger(name, resourceBundleName);
// Add the system logger to the LogManager's namespace if not exist // Add the system logger to the LogManager's namespace if not exist
// so that there is only one single logger of the given name. // so that there is only one single logger of the given name.
...@@ -501,6 +574,7 @@ public class LogManager { ...@@ -501,6 +574,7 @@ public class LogManager {
// if logger already exists but handlers not set // if logger already exists but handlers not set
final Logger l = logger; final Logger l = logger;
AccessController.doPrivileged(new PrivilegedAction<Void>() { AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() { public Void run() {
for (Handler hdl : l.getHandlers()) { for (Handler hdl : l.getHandlers()) {
sysLogger.addHandler(hdl); sysLogger.addHandler(hdl);
...@@ -519,24 +593,52 @@ public class LogManager { ...@@ -519,24 +593,52 @@ public class LogManager {
// doesn't exist in the user context, it'll also be added to the user context. // doesn't exist in the user context, it'll also be added to the user context.
// The user context is queried by the user code and all other loggers are // The user context is queried by the user code and all other loggers are
// added in the user context. // added in the user context.
static class LoggerContext { class LoggerContext {
// Table of named Loggers that maps names to Loggers. // Table of named Loggers that maps names to Loggers.
private final Hashtable<String,LoggerWeakRef> namedLoggers = new Hashtable<>(); private final Hashtable<String,LoggerWeakRef> namedLoggers = new Hashtable<>();
// Tree of named Loggers // Tree of named Loggers
private final LogNode root; private final LogNode root;
private final boolean requiresDefaultLoggers;
private LoggerContext() { private LoggerContext() {
this(false);
}
private LoggerContext(boolean requiresDefaultLoggers) {
this.root = new LogNode(null, this); this.root = new LogNode(null, this);
this.requiresDefaultLoggers = requiresDefaultLoggers; }
// Tells whether default loggers are required in this context.
// If true, the default loggers will be lazily added.
final boolean requiresDefaultLoggers() {
final boolean requiresDefaultLoggers = (getOwner() == manager);
if (requiresDefaultLoggers) {
getOwner().ensureLogManagerInitialized();
}
return requiresDefaultLoggers;
}
// This context's LogManager.
final LogManager getOwner() {
return LogManager.this;
}
// This context owner's root logger, which if not null, and if
// the context requires default loggers, will be added to the context
// logger's tree.
final Logger getRootLogger() {
return getOwner().rootLogger;
}
// The global logger, which if not null, and if
// the context requires default loggers, will be added to the context
// logger's tree.
final Logger getGlobalLogger() {
@SuppressWarnings("deprecated") // avoids initialization cycles.
final Logger global = Logger.global;
return global;
} }
Logger demandLogger(String name, String resourceBundleName) { Logger demandLogger(String name, String resourceBundleName) {
// a LogManager subclass may have its own implementation to add and // a LogManager subclass may have its own implementation to add and
// get a Logger. So delegate to the LogManager to do the work. // get a Logger. So delegate to the LogManager to do the work.
return manager.demandLogger(name, resourceBundleName, null); final LogManager owner = getOwner();
return owner.demandLogger(name, resourceBundleName, null);
} }
...@@ -548,10 +650,10 @@ public class LogManager { ...@@ -548,10 +650,10 @@ public class LogManager {
// or getLoggerNames() // or getLoggerNames()
// //
private void ensureInitialized() { private void ensureInitialized() {
if (requiresDefaultLoggers) { if (requiresDefaultLoggers()) {
// Ensure that the root and global loggers are set. // Ensure that the root and global loggers are set.
ensureDefaultLogger(manager.rootLogger); ensureDefaultLogger(getRootLogger());
ensureDefaultLogger(Logger.global); ensureDefaultLogger(getGlobalLogger());
} }
} }
...@@ -580,13 +682,13 @@ public class LogManager { ...@@ -580,13 +682,13 @@ public class LogManager {
// before adding 'logger'. // before adding 'logger'.
// //
private void ensureAllDefaultLoggers(Logger logger) { private void ensureAllDefaultLoggers(Logger logger) {
if (requiresDefaultLoggers) { if (requiresDefaultLoggers()) {
final String name = logger.getName(); final String name = logger.getName();
if (!name.isEmpty()) { if (!name.isEmpty()) {
ensureDefaultLogger(manager.rootLogger); ensureDefaultLogger(getRootLogger());
}
if (!Logger.GLOBAL_LOGGER_NAME.equals(name)) { if (!Logger.GLOBAL_LOGGER_NAME.equals(name)) {
ensureDefaultLogger(Logger.global); ensureDefaultLogger(getGlobalLogger());
}
} }
} }
} }
...@@ -598,8 +700,8 @@ public class LogManager { ...@@ -598,8 +700,8 @@ public class LogManager {
// This check is simple sanity: we do not want that this // This check is simple sanity: we do not want that this
// method be called for anything else than Logger.global // method be called for anything else than Logger.global
// or owner.rootLogger. // or owner.rootLogger.
if (!requiresDefaultLoggers || logger == null if (!requiresDefaultLoggers() || logger == null
|| logger != Logger.global && logger != manager.rootLogger) { || logger != Logger.global && logger != LogManager.this.rootLogger) {
// the case where we have a non null logger which is neither // the case where we have a non null logger which is neither
// Logger.global nor manager.rootLogger indicates a serious // Logger.global nor manager.rootLogger indicates a serious
...@@ -625,7 +727,7 @@ public class LogManager { ...@@ -625,7 +727,7 @@ public class LogManager {
boolean addLocalLogger(Logger logger) { boolean addLocalLogger(Logger logger) {
// no need to add default loggers if it's not required // no need to add default loggers if it's not required
return addLocalLogger(logger, requiresDefaultLoggers); return addLocalLogger(logger, requiresDefaultLoggers());
} }
// Add a logger to this context. This method will only set its level // Add a logger to this context. This method will only set its level
...@@ -663,11 +765,13 @@ public class LogManager { ...@@ -663,11 +765,13 @@ public class LogManager {
// We're adding a new logger. // We're adding a new logger.
// Note that we are creating a weak reference here. // Note that we are creating a weak reference here.
ref = manager.new LoggerWeakRef(logger); final LogManager owner = getOwner();
logger.setLogManager(owner);
ref = owner.new LoggerWeakRef(logger);
namedLoggers.put(name, ref); namedLoggers.put(name, ref);
// Apply any initial level defined for the new logger. // Apply any initial level defined for the new logger.
Level level = manager.getLevelProperty(name + ".level", null); Level level = owner.getLevelProperty(name + ".level", null);
if (level != null) { if (level != null) {
doSetLevel(logger, level); doSetLevel(logger, level);
} }
...@@ -719,10 +823,12 @@ public class LogManager { ...@@ -719,10 +823,12 @@ public class LogManager {
// If logger.getUseParentHandlers() returns 'true' and any of the logger's // If logger.getUseParentHandlers() returns 'true' and any of the logger's
// parents have levels or handlers defined, make sure they are instantiated. // parents have levels or handlers defined, make sure they are instantiated.
private void processParentHandlers(final Logger logger, final String name) { private void processParentHandlers(final Logger logger, final String name) {
final LogManager owner = getOwner();
AccessController.doPrivileged(new PrivilegedAction<Void>() { AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() { public Void run() {
if (logger != manager.rootLogger) { if (logger != owner.rootLogger) {
boolean useParent = manager.getBooleanProperty(name + ".useParentHandlers", true); boolean useParent = owner.getBooleanProperty(name + ".useParentHandlers", true);
if (!useParent) { if (!useParent) {
logger.setUseParentHandlers(false); logger.setUseParentHandlers(false);
} }
...@@ -738,8 +844,8 @@ public class LogManager { ...@@ -738,8 +844,8 @@ public class LogManager {
break; break;
} }
String pname = name.substring(0, ix2); String pname = name.substring(0, ix2);
if (manager.getProperty(pname + ".level") != null || if (owner.getProperty(pname + ".level") != null ||
manager.getProperty(pname + ".handlers") != null) { owner.getProperty(pname + ".handlers") != null) {
// This pname has a level/handlers definition. // This pname has a level/handlers definition.
// Make sure it exists. // Make sure it exists.
demandLogger(pname, null); demandLogger(pname, null);
...@@ -779,16 +885,17 @@ public class LogManager { ...@@ -779,16 +885,17 @@ public class LogManager {
} }
} }
static class SystemLoggerContext extends LoggerContext { final class SystemLoggerContext extends LoggerContext {
// Add a system logger in the system context's namespace as well as // Add a system logger in the system context's namespace as well as
// in the LogManager's namespace if not exist so that there is only // in the LogManager's namespace if not exist so that there is only
// one single logger of the given name. System loggers are visible // one single logger of the given name. System loggers are visible
// to applications unless a logger of the same name has been added. // to applications unless a logger of the same name has been added.
@Override
Logger demandLogger(String name, String resourceBundleName) { Logger demandLogger(String name, String resourceBundleName) {
Logger result = findLogger(name); Logger result = findLogger(name);
if (result == null) { if (result == null) {
// only allocate the new system logger once // only allocate the new system logger once
Logger newLogger = new Logger(name, resourceBundleName); Logger newLogger = new Logger(name, resourceBundleName, null, getOwner());
do { do {
if (addLocalLogger(newLogger)) { if (addLocalLogger(newLogger)) {
// We successfully added the new Logger that we // We successfully added the new Logger that we
...@@ -822,6 +929,7 @@ public class LogManager { ...@@ -822,6 +929,7 @@ public class LogManager {
final String handlersPropertyName) final String handlersPropertyName)
{ {
AccessController.doPrivileged(new PrivilegedAction<Object>() { AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() { public Object run() {
String names[] = parseClassNames(handlersPropertyName); String names[] = parseClassNames(handlersPropertyName);
for (int i = 0; i < names.length; i++) { for (int i = 0; i < names.length; i++) {
...@@ -1014,6 +1122,7 @@ public class LogManager { ...@@ -1014,6 +1122,7 @@ public class LogManager {
// There is a security manager. Raise privilege before // There is a security manager. Raise privilege before
// calling setLevel. // calling setLevel.
AccessController.doPrivileged(new PrivilegedAction<Object>() { AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() { public Object run() {
logger.setLevel(level); logger.setLevel(level);
return null; return null;
...@@ -1032,6 +1141,7 @@ public class LogManager { ...@@ -1032,6 +1141,7 @@ public class LogManager {
// There is a security manager. Raise privilege before // There is a security manager. Raise privilege before
// calling setParent. // calling setParent.
AccessController.doPrivileged(new PrivilegedAction<Object>() { AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() { public Object run() {
logger.setParent(parent); logger.setParent(parent);
return null; return null;
...@@ -1129,14 +1239,9 @@ public class LogManager { ...@@ -1129,14 +1239,9 @@ public class LogManager {
f = new File(f, "logging.properties"); f = new File(f, "logging.properties");
fname = f.getCanonicalPath(); fname = f.getCanonicalPath();
} }
InputStream in = new FileInputStream(fname); try (final InputStream in = new FileInputStream(fname)) {
BufferedInputStream bin = new BufferedInputStream(in); final BufferedInputStream bin = new BufferedInputStream(in);
try {
readConfiguration(bin); readConfiguration(bin);
} finally {
if (in != null) {
in.close();
}
} }
} }
...@@ -1201,7 +1306,7 @@ public class LogManager { ...@@ -1201,7 +1306,7 @@ public class LogManager {
} }
hands = hands.trim(); hands = hands.trim();
int ix = 0; int ix = 0;
Vector<String> result = new Vector<>(); final List<String> result = new ArrayList<>();
while (ix < hands.length()) { while (ix < hands.length()) {
int end = ix; int end = ix;
while (end < hands.length()) { while (end < hands.length()) {
...@@ -1471,28 +1576,35 @@ public class LogManager { ...@@ -1471,28 +1576,35 @@ public class LogManager {
// We use a subclass of Logger for the root logger, so // We use a subclass of Logger for the root logger, so
// that we only instantiate the global handlers when they // that we only instantiate the global handlers when they
// are first needed. // are first needed.
private class RootLogger extends Logger { private final class RootLogger extends Logger {
private RootLogger() { private RootLogger() {
super("", null); // We do not call the protected Logger two args constructor here,
// to avoid calling LogManager.getLogManager() from within the
// RootLogger constructor.
super("", null, null, LogManager.this);
setLevel(defaultLevel); setLevel(defaultLevel);
} }
@Override
public void log(LogRecord record) { public void log(LogRecord record) {
// Make sure that the global handlers have been instantiated. // Make sure that the global handlers have been instantiated.
initializeGlobalHandlers(); initializeGlobalHandlers();
super.log(record); super.log(record);
} }
@Override
public void addHandler(Handler h) { public void addHandler(Handler h) {
initializeGlobalHandlers(); initializeGlobalHandlers();
super.addHandler(h); super.addHandler(h);
} }
@Override
public void removeHandler(Handler h) { public void removeHandler(Handler h) {
initializeGlobalHandlers(); initializeGlobalHandlers();
super.removeHandler(h); super.removeHandler(h);
} }
@Override
public Handler[] getHandlers() { public Handler[] getHandlers() {
initializeGlobalHandlers(); initializeGlobalHandlers();
return super.getHandlers(); return super.getHandlers();
......
...@@ -245,14 +245,26 @@ public class Logger { ...@@ -245,14 +245,26 @@ public class Logger {
// In order to finish the initialization of the global logger, we // In order to finish the initialization of the global logger, we
// will therefore call LogManager.getLogManager() here. // will therefore call LogManager.getLogManager() here.
// //
// Care must be taken *not* to call Logger.getGlobal() in // To prevent race conditions we also need to call
// LogManager static initializers in order to avoid such // LogManager.getLogManager() unconditionally here.
// deadlocks. // Indeed we cannot rely on the observed value of global.manager,
// // because global.manager will become not null somewhere during
if (global != null && global.manager == null) { // the initialization of LogManager.
// Complete initialization of the global Logger. // If two threads are calling getGlobal() concurrently, one thread
global.manager = LogManager.getLogManager(); // will see global.manager null and call LogManager.getLogManager(),
} // but the other thread could come in at a time when global.manager
// is already set although ensureLogManagerInitialized is not finished
// yet...
// Calling LogManager.getLogManager() unconditionally will fix that.
LogManager.getLogManager();
// Now the global LogManager should be initialized,
// and the global logger should have been added to
// it, unless we were called within the constructor of a LogManager
// subclass installed as LogManager, in which case global.manager
// would still be null, and global will be lazily initialized later on.
return global; return global;
} }
...@@ -298,11 +310,11 @@ public class Logger { ...@@ -298,11 +310,11 @@ public class Logger {
* no corresponding resource can be found. * no corresponding resource can be found.
*/ */
protected Logger(String name, String resourceBundleName) { protected Logger(String name, String resourceBundleName) {
this(name, resourceBundleName, null); this(name, resourceBundleName, null, LogManager.getLogManager());
} }
Logger(String name, String resourceBundleName, Class<?> caller) { Logger(String name, String resourceBundleName, Class<?> caller, LogManager manager) {
this.manager = LogManager.getLogManager(); this.manager = manager;
setupResourceInfo(resourceBundleName, caller); setupResourceInfo(resourceBundleName, caller);
this.name = name; this.name = name;
levelValue = Level.INFO.intValue(); levelValue = Level.INFO.intValue();
...@@ -332,8 +344,8 @@ public class Logger { ...@@ -332,8 +344,8 @@ public class Logger {
levelValue = Level.INFO.intValue(); levelValue = Level.INFO.intValue();
} }
// It is called from the LogManager.<clinit> to complete // It is called from LoggerContext.addLocalLogger() when the logger
// initialization of the global Logger. // is actually added to a LogManager.
void setLogManager(LogManager manager) { void setLogManager(LogManager manager) {
this.manager = manager; this.manager = manager;
} }
...@@ -558,7 +570,7 @@ public class Logger { ...@@ -558,7 +570,7 @@ public class Logger {
// cleanup some Loggers that have been GC'ed // cleanup some Loggers that have been GC'ed
manager.drainLoggerRefQueueBounded(); manager.drainLoggerRefQueueBounded();
Logger result = new Logger(null, resourceBundleName, Logger result = new Logger(null, resourceBundleName,
Reflection.getCallerClass()); Reflection.getCallerClass(), manager);
result.anonymous = true; result.anonymous = true;
Logger root = manager.getLogger(""); Logger root = manager.getLogger("");
result.doSetParent(root); result.doSetParent(root);
...@@ -1798,7 +1810,7 @@ public class Logger { ...@@ -1798,7 +1810,7 @@ public class Logger {
if (parent == null) { if (parent == null) {
throw new NullPointerException(); throw new NullPointerException();
} }
manager.checkPermission(); checkPermission();
doSetParent(parent); doSetParent(parent);
} }
......
/* /*
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2013, 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
...@@ -40,7 +40,7 @@ import java.util.LinkedHashMap; ...@@ -40,7 +40,7 @@ import java.util.LinkedHashMap;
* the list of protocols to be allowed, the endpoint identification * the list of protocols to be allowed, the endpoint identification
* algorithm during SSL/TLS handshaking, the Server Name Indication (SNI), * algorithm during SSL/TLS handshaking, the Server Name Indication (SNI),
* the algorithm constraints and whether SSL/TLS servers should request * the algorithm constraints and whether SSL/TLS servers should request
* or require client authentication. * or require client authentication, etc.
* <p> * <p>
* SSLParameters can be created via the constructors in this class. * SSLParameters can be created via the constructors in this class.
* Objects can also be obtained using the <code>getSSLParameters()</code> * Objects can also be obtained using the <code>getSSLParameters()</code>
...@@ -73,13 +73,14 @@ public class SSLParameters { ...@@ -73,13 +73,14 @@ public class SSLParameters {
private AlgorithmConstraints algorithmConstraints; private AlgorithmConstraints algorithmConstraints;
private Map<Integer, SNIServerName> sniNames = null; private Map<Integer, SNIServerName> sniNames = null;
private Map<Integer, SNIMatcher> sniMatchers = null; private Map<Integer, SNIMatcher> sniMatchers = null;
private boolean preferLocalCipherSuites;
/** /**
* Constructs SSLParameters. * Constructs SSLParameters.
* <p> * <p>
* The values of cipherSuites, protocols, cryptographic algorithm * The values of cipherSuites, protocols, cryptographic algorithm
* constraints, endpoint identification algorithm, server names and * constraints, endpoint identification algorithm, server names and
* server name matchers are set to <code>null</code>, * server name matchers are set to <code>null</code>, useCipherSuitesOrder,
* wantClientAuth and needClientAuth are set to <code>false</code>. * wantClientAuth and needClientAuth are set to <code>false</code>.
*/ */
public SSLParameters() { public SSLParameters() {
...@@ -434,5 +435,34 @@ public class SSLParameters { ...@@ -434,5 +435,34 @@ public class SSLParameters {
return null; return null;
} }
/**
* Sets whether the local cipher suites preference should be honored.
*
* @param honorOrder whether local cipher suites order in
* {@code #getCipherSuites} should be honored during
* SSL/TLS handshaking.
*
* @see #getUseCipherSuitesOrder()
*
* @since 1.8
*/
public final void setUseCipherSuitesOrder(boolean honorOrder) {
this.preferLocalCipherSuites = honorOrder;
}
/**
* Returns whether the local cipher suites preference should be honored.
*
* @return whether local cipher suites order in {@code #getCipherSuites}
* should be honored during SSL/TLS handshaking.
*
* @see #setUseCipherSuitesOrder(boolean)
*
* @since 1.8
*/
public final boolean getUseCipherSuitesOrder() {
return preferLocalCipherSuites;
}
} }
...@@ -145,6 +145,14 @@ abstract class Handshaker { ...@@ -145,6 +145,14 @@ abstract class Handshaker {
/* True if it's OK to start a new SSL session */ /* True if it's OK to start a new SSL session */
boolean enableNewSession; boolean enableNewSession;
// Whether local cipher suites preference should be honored during
// handshaking?
//
// Note that in this provider, this option only applies to server side.
// Local cipher suites preference is always honored in client side in
// this provider.
boolean preferLocalCipherSuites = false;
// Temporary storage for the individual keys. Set by // Temporary storage for the individual keys. Set by
// calculateConnectionKeys() and cleared once the ciphers are // calculateConnectionKeys() and cleared once the ciphers are
// activated. // activated.
...@@ -462,6 +470,13 @@ abstract class Handshaker { ...@@ -462,6 +470,13 @@ abstract class Handshaker {
this.sniMatchers = sniMatchers; this.sniMatchers = sniMatchers;
} }
/**
* Sets the cipher suites preference.
*/
void setUseCipherSuitesOrder(boolean on) {
this.preferLocalCipherSuites = on;
}
/** /**
* Prior to handshaking, activate the handshake and initialize the version, * Prior to handshaking, activate the handshake and initialize the version,
* input stream and output stream. * input stream and output stream.
...@@ -533,7 +548,9 @@ abstract class Handshaker { ...@@ -533,7 +548,9 @@ abstract class Handshaker {
} }
/** /**
* Check if the given ciphersuite is enabled and available. * Check if the given ciphersuite is enabled and available within the
* current active cipher suites.
*
* Does not check if the required server certificates are available. * Does not check if the required server certificates are available.
*/ */
boolean isNegotiable(CipherSuite s) { boolean isNegotiable(CipherSuite s) {
...@@ -541,7 +558,17 @@ abstract class Handshaker { ...@@ -541,7 +558,17 @@ abstract class Handshaker {
activeCipherSuites = getActiveCipherSuites(); activeCipherSuites = getActiveCipherSuites();
} }
return activeCipherSuites.contains(s) && s.isNegotiable(); return isNegotiable(activeCipherSuites, s);
}
/**
* Check if the given ciphersuite is enabled and available within the
* proposed cipher suite list.
*
* Does not check if the required server certificates are available.
*/
final static boolean isNegotiable(CipherSuiteList proposed, CipherSuite s) {
return proposed.contains(s) && s.isNegotiable();
} }
/** /**
......
...@@ -319,6 +319,12 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -319,6 +319,12 @@ final public class SSLEngineImpl extends SSLEngine {
*/ */
private boolean isFirstAppOutputRecord = true; private boolean isFirstAppOutputRecord = true;
/*
* Whether local cipher suites preference in server side should be
* honored during handshaking?
*/
private boolean preferLocalCipherSuites = false;
/* /*
* Class and subclass dynamic debugging support * Class and subclass dynamic debugging support
*/ */
...@@ -470,6 +476,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -470,6 +476,7 @@ final public class SSLEngineImpl extends SSLEngine {
protocolVersion, connectionState == cs_HANDSHAKE, protocolVersion, connectionState == cs_HANDSHAKE,
secureRenegotiation, clientVerifyData, serverVerifyData); secureRenegotiation, clientVerifyData, serverVerifyData);
handshaker.setSNIMatchers(sniMatchers); handshaker.setSNIMatchers(sniMatchers);
handshaker.setUseCipherSuitesOrder(preferLocalCipherSuites);
} else { } else {
handshaker = new ClientHandshaker(this, sslContext, handshaker = new ClientHandshaker(this, sslContext,
enabledProtocols, enabledProtocols,
...@@ -2074,6 +2081,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -2074,6 +2081,7 @@ final public class SSLEngineImpl extends SSLEngine {
params.setAlgorithmConstraints(algorithmConstraints); params.setAlgorithmConstraints(algorithmConstraints);
params.setSNIMatchers(sniMatchers); params.setSNIMatchers(sniMatchers);
params.setServerNames(serverNames); params.setServerNames(serverNames);
params.setUseCipherSuitesOrder(preferLocalCipherSuites);
return params; return params;
} }
...@@ -2088,6 +2096,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -2088,6 +2096,7 @@ final public class SSLEngineImpl extends SSLEngine {
// the super implementation does not handle the following parameters // the super implementation does not handle the following parameters
identificationProtocol = params.getEndpointIdentificationAlgorithm(); identificationProtocol = params.getEndpointIdentificationAlgorithm();
algorithmConstraints = params.getAlgorithmConstraints(); algorithmConstraints = params.getAlgorithmConstraints();
preferLocalCipherSuites = params.getUseCipherSuitesOrder();
List<SNIServerName> sniNames = params.getServerNames(); List<SNIServerName> sniNames = params.getServerNames();
if (sniNames != null) { if (sniNames != null) {
...@@ -2104,6 +2113,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -2104,6 +2113,7 @@ final public class SSLEngineImpl extends SSLEngine {
handshaker.setAlgorithmConstraints(algorithmConstraints); handshaker.setAlgorithmConstraints(algorithmConstraints);
if (roleIsServer) { if (roleIsServer) {
handshaker.setSNIMatchers(sniMatchers); handshaker.setSNIMatchers(sniMatchers);
handshaker.setUseCipherSuitesOrder(preferLocalCipherSuites);
} else { } else {
handshaker.setSNIServerNames(serverNames); handshaker.setSNIServerNames(serverNames);
} }
......
/* /*
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2013, 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
...@@ -92,6 +92,12 @@ class SSLServerSocketImpl extends SSLServerSocket ...@@ -92,6 +92,12 @@ class SSLServerSocketImpl extends SSLServerSocket
Collection<SNIMatcher> sniMatchers = Collection<SNIMatcher> sniMatchers =
Collections.<SNIMatcher>emptyList(); Collections.<SNIMatcher>emptyList();
/*
* Whether local cipher suites preference in server side should be
* honored during handshaking?
*/
private boolean preferLocalCipherSuites = false;
/** /**
* Create an SSL server socket on a port, using a non-default * Create an SSL server socket on a port, using a non-default
* authentication context and a specified connection backlog. * authentication context and a specified connection backlog.
...@@ -304,6 +310,8 @@ class SSLServerSocketImpl extends SSLServerSocket ...@@ -304,6 +310,8 @@ class SSLServerSocketImpl extends SSLServerSocket
params.setEndpointIdentificationAlgorithm(identificationProtocol); params.setEndpointIdentificationAlgorithm(identificationProtocol);
params.setAlgorithmConstraints(algorithmConstraints); params.setAlgorithmConstraints(algorithmConstraints);
params.setSNIMatchers(sniMatchers); params.setSNIMatchers(sniMatchers);
params.setUseCipherSuitesOrder(preferLocalCipherSuites);
return params; return params;
} }
...@@ -318,6 +326,7 @@ class SSLServerSocketImpl extends SSLServerSocket ...@@ -318,6 +326,7 @@ class SSLServerSocketImpl extends SSLServerSocket
// the super implementation does not handle the following parameters // the super implementation does not handle the following parameters
identificationProtocol = params.getEndpointIdentificationAlgorithm(); identificationProtocol = params.getEndpointIdentificationAlgorithm();
algorithmConstraints = params.getAlgorithmConstraints(); algorithmConstraints = params.getAlgorithmConstraints();
preferLocalCipherSuites = params.getUseCipherSuitesOrder();
Collection<SNIMatcher> matchers = params.getSNIMatchers(); Collection<SNIMatcher> matchers = params.getSNIMatchers();
if (matchers != null) { if (matchers != null) {
sniMatchers = params.getSNIMatchers(); sniMatchers = params.getSNIMatchers();
...@@ -334,7 +343,7 @@ class SSLServerSocketImpl extends SSLServerSocket ...@@ -334,7 +343,7 @@ class SSLServerSocketImpl extends SSLServerSocket
SSLSocketImpl s = new SSLSocketImpl(sslContext, useServerMode, SSLSocketImpl s = new SSLSocketImpl(sslContext, useServerMode,
enabledCipherSuites, doClientAuth, enableSessionCreation, enabledCipherSuites, doClientAuth, enableSessionCreation,
enabledProtocols, identificationProtocol, algorithmConstraints, enabledProtocols, identificationProtocol, algorithmConstraints,
sniMatchers); sniMatchers, preferLocalCipherSuites);
implAccept(s); implAccept(s);
s.doneConnect(); s.doneConnect();
......
...@@ -377,6 +377,12 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -377,6 +377,12 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
*/ */
private ByteArrayOutputStream heldRecordBuffer = null; private ByteArrayOutputStream heldRecordBuffer = null;
/*
* Whether local cipher suites preference in server side should be
* honored during handshaking?
*/
private boolean preferLocalCipherSuites = false;
// //
// CONSTRUCTORS AND INITIALIZATION CODE // CONSTRUCTORS AND INITIALIZATION CODE
// //
...@@ -482,7 +488,8 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -482,7 +488,8 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
boolean sessionCreation, ProtocolList protocols, boolean sessionCreation, ProtocolList protocols,
String identificationProtocol, String identificationProtocol,
AlgorithmConstraints algorithmConstraints, AlgorithmConstraints algorithmConstraints,
Collection<SNIMatcher> sniMatchers) throws IOException { Collection<SNIMatcher> sniMatchers,
boolean preferLocalCipherSuites) throws IOException {
super(); super();
doClientAuth = clientAuth; doClientAuth = clientAuth;
...@@ -490,6 +497,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -490,6 +497,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
this.identificationProtocol = identificationProtocol; this.identificationProtocol = identificationProtocol;
this.algorithmConstraints = algorithmConstraints; this.algorithmConstraints = algorithmConstraints;
this.sniMatchers = sniMatchers; this.sniMatchers = sniMatchers;
this.preferLocalCipherSuites = preferLocalCipherSuites;
init(context, serverMode); init(context, serverMode);
/* /*
...@@ -1284,6 +1292,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -1284,6 +1292,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
protocolVersion, connectionState == cs_HANDSHAKE, protocolVersion, connectionState == cs_HANDSHAKE,
secureRenegotiation, clientVerifyData, serverVerifyData); secureRenegotiation, clientVerifyData, serverVerifyData);
handshaker.setSNIMatchers(sniMatchers); handshaker.setSNIMatchers(sniMatchers);
handshaker.setUseCipherSuitesOrder(preferLocalCipherSuites);
} else { } else {
handshaker = new ClientHandshaker(this, sslContext, handshaker = new ClientHandshaker(this, sslContext,
enabledProtocols, enabledProtocols,
...@@ -2502,6 +2511,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2502,6 +2511,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
params.setAlgorithmConstraints(algorithmConstraints); params.setAlgorithmConstraints(algorithmConstraints);
params.setSNIMatchers(sniMatchers); params.setSNIMatchers(sniMatchers);
params.setServerNames(serverNames); params.setServerNames(serverNames);
params.setUseCipherSuitesOrder(preferLocalCipherSuites);
return params; return params;
} }
...@@ -2516,6 +2526,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2516,6 +2526,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
// the super implementation does not handle the following parameters // the super implementation does not handle the following parameters
identificationProtocol = params.getEndpointIdentificationAlgorithm(); identificationProtocol = params.getEndpointIdentificationAlgorithm();
algorithmConstraints = params.getAlgorithmConstraints(); algorithmConstraints = params.getAlgorithmConstraints();
preferLocalCipherSuites = params.getUseCipherSuitesOrder();
List<SNIServerName> sniNames = params.getServerNames(); List<SNIServerName> sniNames = params.getServerNames();
if (sniNames != null) { if (sniNames != null) {
...@@ -2532,6 +2543,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2532,6 +2543,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
handshaker.setAlgorithmConstraints(algorithmConstraints); handshaker.setAlgorithmConstraints(algorithmConstraints);
if (roleIsServer) { if (roleIsServer) {
handshaker.setSNIMatchers(sniMatchers); handshaker.setSNIMatchers(sniMatchers);
handshaker.setUseCipherSuitesOrder(preferLocalCipherSuites);
} else { } else {
handshaker.setSNIServerNames(serverNames); handshaker.setSNIServerNames(serverNames);
} }
......
...@@ -932,8 +932,18 @@ final class ServerHandshaker extends Handshaker { ...@@ -932,8 +932,18 @@ final class ServerHandshaker extends Handshaker {
* the cipherSuite and keyExchange variables. * the cipherSuite and keyExchange variables.
*/ */
private void chooseCipherSuite(ClientHello mesg) throws IOException { private void chooseCipherSuite(ClientHello mesg) throws IOException {
for (CipherSuite suite : mesg.getCipherSuites().collection()) { CipherSuiteList prefered;
if (isNegotiable(suite) == false) { CipherSuiteList proposed;
if (preferLocalCipherSuites) {
prefered = getActiveCipherSuites();
proposed = mesg.getCipherSuites();
} else {
prefered = mesg.getCipherSuites();
proposed = getActiveCipherSuites();
}
for (CipherSuite suite : prefered.collection()) {
if (isNegotiable(proposed, suite) == false) {
continue; continue;
} }
...@@ -948,8 +958,7 @@ final class ServerHandshaker extends Handshaker { ...@@ -948,8 +958,7 @@ final class ServerHandshaker extends Handshaker {
} }
return; return;
} }
fatalSE(Alerts.alert_handshake_failure, fatalSE(Alerts.alert_handshake_failure, "no cipher suites in common");
"no cipher suites in common");
} }
/** /**
......
...@@ -361,7 +361,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R ...@@ -361,7 +361,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
while (tokens.hasMoreTokens()) { while (tokens.hasMoreTokens()) {
String token = tokens.nextToken(); String token = tokens.nextToken();
if (token.equals("|")) { if (token.equals("|")) {
if (isNonUSLangSupported()) { if (isNonENLangSupported()) {
continue; continue;
} }
break; break;
...@@ -398,7 +398,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R ...@@ -398,7 +398,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
*/ */
int barIndex = supportedLocaleString.indexOf('|'); int barIndex = supportedLocaleString.indexOf('|');
StringTokenizer localeStringTokenizer; StringTokenizer localeStringTokenizer;
if (isNonUSLangSupported()) { if (isNonENLangSupported()) {
localeStringTokenizer = new StringTokenizer(supportedLocaleString.substring(0, barIndex) localeStringTokenizer = new StringTokenizer(supportedLocaleString.substring(0, barIndex)
+ supportedLocaleString.substring(barIndex + 1)); + supportedLocaleString.substring(barIndex + 1));
} else { } else {
...@@ -427,17 +427,17 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R ...@@ -427,17 +427,17 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
return locales; return locales;
} }
private static volatile Boolean isNonUSSupported = null; private static volatile Boolean isNonENSupported = null;
/* /*
* Returns true if the non US resources jar file exists in jre * Returns true if the non EN resources jar file exists in jre
* extension directory. @returns true if the jar file is there. Otherwise, * extension directory. @returns true if the jar file is there. Otherwise,
* returns false. * returns false.
*/ */
private static boolean isNonUSLangSupported() { private static boolean isNonENLangSupported() {
if (isNonUSSupported == null) { if (isNonENSupported == null) {
synchronized (JRELocaleProviderAdapter.class) { synchronized (JRELocaleProviderAdapter.class) {
if (isNonUSSupported == null) { if (isNonENSupported == null) {
final String sep = File.separator; final String sep = File.separator;
String localeDataJar = String localeDataJar =
java.security.AccessController.doPrivileged( java.security.AccessController.doPrivileged(
...@@ -449,7 +449,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R ...@@ -449,7 +449,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
* localedata.jar is installed or not. * localedata.jar is installed or not.
*/ */
final File f = new File(localeDataJar); final File f = new File(localeDataJar);
isNonUSSupported = isNonENSupported =
AccessController.doPrivileged(new PrivilegedAction<Boolean>() { AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
@Override @Override
public Boolean run() { public Boolean run() {
...@@ -459,6 +459,6 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R ...@@ -459,6 +459,6 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
} }
} }
} }
return isNonUSSupported; return isNonENSupported;
} }
} }
...@@ -52,25 +52,25 @@ public class LocaleDataMetaInfo { ...@@ -52,25 +52,25 @@ public class LocaleDataMetaInfo {
look up locale string such as "en" could be based on if it contains " en ". look up locale string such as "en" could be based on if it contains " en ".
*/ */
resourceNameToLocales.put("FormatData", resourceNameToLocales.put("FormatData",
" #FormatData_USLocales# | #FormatData_NonUSLocales# "); " #FormatData_ENLocales# | #FormatData_NonENLocales# ");
resourceNameToLocales.put("CollationData", resourceNameToLocales.put("CollationData",
" #CollationData_USLocales# | #CollationData_NonUSLocales# "); " #CollationData_ENLocales# | #CollationData_NonENLocales# ");
resourceNameToLocales.put("TimeZoneNames", resourceNameToLocales.put("TimeZoneNames",
" #TimeZoneNames_USLocales# | #TimeZoneNames_NonUSLocales# "); " #TimeZoneNames_ENLocales# | #TimeZoneNames_NonENLocales# ");
resourceNameToLocales.put("LocaleNames", resourceNameToLocales.put("LocaleNames",
" #LocaleNames_USLocales# | #LocaleNames_NonUSLocales# "); " #LocaleNames_ENLocales# | #LocaleNames_NonENLocales# ");
resourceNameToLocales.put("CurrencyNames", resourceNameToLocales.put("CurrencyNames",
" #CurrencyNames_USLocales# | #CurrencyNames_NonUSLocales# "); " #CurrencyNames_ENLocales# | #CurrencyNames_NonENLocales# ");
resourceNameToLocales.put("CalendarData", resourceNameToLocales.put("CalendarData",
" #CalendarData_USLocales# | #CalendarData_NonUSLocales# "); " #CalendarData_ENLocales# | #CalendarData_NonENLocales# ");
resourceNameToLocales.put("AvailableLocales", resourceNameToLocales.put("AvailableLocales",
" #AvailableLocales_USLocales# | #AvailableLocales_NonUSLocales# "); " #AvailableLocales_ENLocales# | #AvailableLocales_NonENLocales# ");
} }
/* /*
......
...@@ -252,7 +252,7 @@ public class LocaleResources { ...@@ -252,7 +252,7 @@ public class LocaleResources {
String[] getTimeZoneNames(String key, int size) { String[] getTimeZoneNames(String key, int size) {
String[] names = null; String[] names = null;
String cacheKey = TIME_ZONE_NAMES + key; String cacheKey = TIME_ZONE_NAMES + size + '.' + key;
removeEmptyReferences(); removeEmptyReferences();
ResourceReference data = cache.get(cacheKey); ResourceReference data = cache.get(cacheKey);
......
/* /*
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2013, 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
...@@ -39,6 +39,7 @@ import sun.security.util.Length; ...@@ -39,6 +39,7 @@ import sun.security.util.Length;
*/ */
abstract class Key implements java.security.Key, Length abstract class Key implements java.security.Key, Length
{ {
private static final long serialVersionUID = -1088859394025049194L;
// Native handle // Native handle
protected long hCryptProv = 0; protected long hCryptProv = 0;
......
/* /*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, 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
...@@ -82,7 +82,6 @@ static int getAdapters (JNIEnv *env, IP_ADAPTER_ADDRESSES **adapters) { ...@@ -82,7 +82,6 @@ static int getAdapters (JNIEnv *env, IP_ADAPTER_ADDRESSES **adapters) {
IP_ADAPTER_ADDRESSES *adapterInfo; IP_ADAPTER_ADDRESSES *adapterInfo;
ULONG len; ULONG len;
adapterInfo = (IP_ADAPTER_ADDRESSES *)malloc (bufsize); adapterInfo = (IP_ADAPTER_ADDRESSES *)malloc (bufsize);
if (adapterInfo == NULL) { if (adapterInfo == NULL) {
JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure"); JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure");
return -1; return -1;
...@@ -160,8 +159,12 @@ IP_ADAPTER_ADDRESSES *getAdapter (JNIEnv *env, jint index) { ...@@ -160,8 +159,12 @@ IP_ADAPTER_ADDRESSES *getAdapter (JNIEnv *env, jint index) {
ptr = adapterInfo; ptr = adapterInfo;
ret = NULL; ret = NULL;
while (ptr != NULL) { while (ptr != NULL) {
// IPv4 interface // in theory the IPv4 index and the IPv6 index can be the same
if (ptr->Ipv6IfIndex == index) { // where an interface is enabled for v4 and v6
// IfIndex == 0 IPv4 not available on this interface
// Ipv6IfIndex == 0 IPv6 not available on this interface
if (((ptr->IfIndex != 0)&&(ptr->IfIndex == index)) ||
((ptr->Ipv6IfIndex !=0) && (ptr->Ipv6IfIndex == index))) {
ret = (IP_ADAPTER_ADDRESSES *) malloc(sizeof(IP_ADAPTER_ADDRESSES)); ret = (IP_ADAPTER_ADDRESSES *) malloc(sizeof(IP_ADAPTER_ADDRESSES));
if (ret == NULL) { if (ret == NULL) {
free(adapterInfo); free(adapterInfo);
...@@ -172,6 +175,7 @@ IP_ADAPTER_ADDRESSES *getAdapter (JNIEnv *env, jint index) { ...@@ -172,6 +175,7 @@ IP_ADAPTER_ADDRESSES *getAdapter (JNIEnv *env, jint index) {
//copy the memory and break out of the while loop. //copy the memory and break out of the while loop.
memcpy(ret, ptr, sizeof(IP_ADAPTER_ADDRESSES)); memcpy(ret, ptr, sizeof(IP_ADAPTER_ADDRESSES));
break; break;
} }
ptr=ptr->Next; ptr=ptr->Next;
} }
...@@ -192,7 +196,6 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP) ...@@ -192,7 +196,6 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP)
int tun=0, net=0; int tun=0, net=0;
*netifPP = NULL; *netifPP = NULL;
/* /*
* Get the IPv4 interfaces. This information is the same * Get the IPv4 interfaces. This information is the same
* as what previous JDK versions would return. * as what previous JDK versions would return.
...@@ -264,7 +267,7 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP) ...@@ -264,7 +267,7 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP)
* set the index to the IPv6 index and add the * set the index to the IPv6 index and add the
* IPv6 addresses * IPv6 addresses
*/ */
nif->index = ptr->Ipv6IfIndex; nif->ipv6Index = ptr->Ipv6IfIndex;
c = getAddrsFromAdapter(ptr, &nif->addrs); c = getAddrsFromAdapter(ptr, &nif->addrs);
nif->naddrs += c; nif->naddrs += c;
break; break;
...@@ -309,6 +312,9 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP) ...@@ -309,6 +312,9 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP)
strcpy (nif->name, newname); strcpy (nif->name, newname);
wcscpy ((PWCHAR)nif->displayName, ptr->FriendlyName); wcscpy ((PWCHAR)nif->displayName, ptr->FriendlyName);
nif->dNameIsUnicode = TRUE; nif->dNameIsUnicode = TRUE;
// the java.net.NetworkInterface abstraction only has index
// so the Ipv6IfIndex needs to map onto index
nif->index = ptr->Ipv6IfIndex; nif->index = ptr->Ipv6IfIndex;
nif->ipv6Index = ptr->Ipv6IfIndex; nif->ipv6Index = ptr->Ipv6IfIndex;
nif->hasIpv6Address = TRUE; nif->hasIpv6Address = TRUE;
...@@ -487,7 +493,6 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs) ...@@ -487,7 +493,6 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs)
(*env)->SetObjectField(env, netifObj, ni_nameID, name); (*env)->SetObjectField(env, netifObj, ni_nameID, name);
(*env)->SetObjectField(env, netifObj, ni_displayNameID, displayName); (*env)->SetObjectField(env, netifObj, ni_displayNameID, displayName);
(*env)->SetIntField(env, netifObj, ni_indexID, ifs->index); (*env)->SetIntField(env, netifObj, ni_indexID, ifs->index);
/* /*
* Get the IP addresses for this interface if necessary * Get the IP addresses for this interface if necessary
* Note that 0 is a valid number of addresses. * Note that 0 is a valid number of addresses.
......
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* 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.
*/
/* @test
* @bug 4987375
* @summary make sure clone() isn't reflected and that Cloneable and
* Serializable are found
*/
import java.lang.reflect.*;
import java.util.Arrays;
public class ArrayMethods {
public int failed = 0;
public static void main(String[] args) throws Exception {
ArrayMethods m = new ArrayMethods();
m.testGetMethod();
m.testGetMethods();
m.testGetDeclaredMethod();
m.testGetDeclaredMethods();
m.testGetInterfaces();
if (m.failed != 0)
throw new RuntimeException("Test failed, check log for details");
}
public void testGetMethod() {
try {
Method m = new String[0].getClass().getMethod("clone", (Class<?>[])null);
failed++;
System.out.println("getMethod(\"clone\", null) Should not find clone()");
} catch (NoSuchMethodException e) {
; //all good
}
}
public void testGetMethods() {
Method[] m = new Integer[0][0][0].getClass().getMethods();
for (Method mm : m)
if(mm.getName().contentEquals("clone")) {
failed++;
System.out.println("getMethods() Should not find clone()");
}
}
public void testGetDeclaredMethod() {
try {
Method m = new Object[0][0].getClass().getDeclaredMethod("clone", (Class<?>[])null);
failed++;
System.out.println("getDeclaredMethod(\"clone\", null) Should not find clone()");
} catch (NoSuchMethodException e) {
; //all good
}
}
public void testGetDeclaredMethods() {
Method[] m = new Throwable[0][0][0][0].getClass().getDeclaredMethods();
if (m.length != 0) {
failed++;
System.out.println("getDeclaredMethods().length should be 0");
}
}
public void testGetInterfaces() {
Class<?>[] is = new Integer[0].getClass().getInterfaces();
boolean thisFailed = false;
if (is.length != 2)
thisFailed = true;
if (!is[0].getCanonicalName().equals("java.lang.Cloneable"))
thisFailed = true;
if (!is[1].getCanonicalName().equals("java.io.Serializable"))
thisFailed = true;
if (thisFailed) {
failed++;
System.out.println(Arrays.asList(is));
System.out.println("Should contain exactly Cloneable, Serializable in that order.");
}
}
}
...@@ -72,9 +72,11 @@ public class LocalHostCookie { ...@@ -72,9 +72,11 @@ public class LocalHostCookie {
} }
} }
} finally { } finally {
if (s != null) {
s.stopServer(); s.stopServer();
} }
} }
}
class Server { class Server {
HttpServer server; HttpServer server;
...@@ -96,9 +98,11 @@ public class LocalHostCookie { ...@@ -96,9 +98,11 @@ public class LocalHostCookie {
} }
public void stopServer() { public void stopServer() {
if (server != null) {
server.stop(0); server.stop(0);
} }
} }
}
class MyCookieHandler implements HttpHandler { class MyCookieHandler implements HttpHandler {
......
...@@ -25,41 +25,83 @@ ...@@ -25,41 +25,83 @@
* @bug 7003398 * @bug 7003398
* @run main/othervm Equals * @run main/othervm Equals
*/ */
import java.net.NetworkInterface;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
public class Equals { public class Equals {
public static void main(String args[]) throws Exception { public static void main(String args[]) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream bufferedOut = new PrintStream(baos);
Enumeration nifs1 = NetworkInterface.getNetworkInterfaces(); Enumeration<NetworkInterface> nifs1 = NetworkInterface.getNetworkInterfaces();
HashMap<String,Integer> hashes = new HashMap<>(); HashMap<String,Integer> hashes = new HashMap<>();
HashMap<String,NetworkInterface> nicMap = new HashMap<>(); HashMap<String,NetworkInterface> nicMap = new HashMap<>();
while (nifs1.hasMoreElements()) { while (nifs1.hasMoreElements()) {
NetworkInterface ni = (NetworkInterface)nifs1.nextElement(); NetworkInterface ni = nifs1.nextElement();
hashes.put(ni.getName(),ni.hashCode()); hashes.put(ni.getName(),ni.hashCode());
nicMap.put(ni.getName(),ni); nicMap.put(ni.getName(),ni);
displayInterfaceInformation(ni, bufferedOut);
bufferedOut.flush();
} }
System.setSecurityManager(new SecurityManager()); System.setSecurityManager(new SecurityManager());
Enumeration nifs2 = NetworkInterface.getNetworkInterfaces(); Enumeration<NetworkInterface> nifs2 = NetworkInterface.getNetworkInterfaces();
while (nifs2.hasMoreElements()) { while (nifs2.hasMoreElements()) {
NetworkInterface ni = (NetworkInterface)nifs2.nextElement(); NetworkInterface ni = nifs2.nextElement();
NetworkInterface niOrig = nicMap.get(ni.getName()); NetworkInterface niOrig = nicMap.get(ni.getName());
int h = hashes.get(ni.getName()); int h = ni.hashCode();
if (h != ni.hashCode()) { if (h != hashes.get(ni.getName())) {
throw new RuntimeException ("Hashcodes different for " + System.out.printf("%nSystem information:%n");
System.out.printf("%s", baos.toString("UTF8"));
System.out.printf("%nni.hashCode() returned %d, expected %d, for:%n",
h, hashes.get(ni.getName()));
displayInterfaceInformation(ni, System.out);
throw new RuntimeException("Hashcodes different for " +
ni.getName()); ni.getName());
} }
if (!ni.equals(niOrig)) { if (!ni.equals(niOrig)) {
throw new RuntimeException ("equality different for " + System.out.printf("%nSystem information:%n");
System.out.printf("%s", baos.toString("UTF8"));
System.out.printf("%nExpected the following interfaces to be the same:%n");
displayInterfaceInformation(niOrig, System.out);
displayInterfaceInformation(ni, System.out);
throw new RuntimeException("equality different for " +
ni.getName()); ni.getName());
} }
} }
} }
static void displayInterfaceInformation(NetworkInterface netint,
PrintStream out) throws SocketException {
out.printf("Display name: %s%n", netint.getDisplayName());
out.printf("Name: %s%n", netint.getName());
Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();
for (InetAddress inetAddress : Collections.list(inetAddresses))
out.printf("InetAddress: %s%n", inetAddress);
out.printf("Up? %s%n", netint.isUp());
out.printf("Loopback? %s%n", netint.isLoopback());
out.printf("PointToPoint? %s%n", netint.isPointToPoint());
out.printf("Supports multicast? %s%n", netint.supportsMulticast());
out.printf("Virtual? %s%n", netint.isVirtual());
out.printf("Hardware address: %s%n",
Arrays.toString(netint.getHardwareAddress()));
out.printf("MTU: %s%n", netint.getMTU());
out.printf("Index: %s%n", netint.getIndex());
out.printf("%n");
}
} }
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* 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.
*/
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.List;
/*
* @test
* @bug 8021372
* @summary Tests that the MAC addresses returned by NetworkInterface.getNetworkInterfaces are unique for each adapter.
*
*/
public class UniqueMacAddressesTest {
public static void main(String[] args) throws Exception {
new UniqueMacAddressesTest().execute();
System.out.println("UniqueMacAddressesTest: OK");
}
public UniqueMacAddressesTest() {
System.out.println("UniqueMacAddressesTest: start ");
}
public void execute() throws Exception {
Enumeration<NetworkInterface> networkInterfaces;
boolean areMacAddressesUnique = false;
List<NetworkInterface> networkInterfaceList = new ArrayList<NetworkInterface>();
networkInterfaces = NetworkInterface.getNetworkInterfaces();
// build a list of NetworkInterface objects to test MAC address
// uniqueness
createNetworkInterfaceList(networkInterfaces, networkInterfaceList);
areMacAddressesUnique = checkMacAddressesAreUnique(networkInterfaceList);
if (!areMacAddressesUnique) {
throw new RuntimeException("mac address uniqueness test failed");
}
}
private boolean checkMacAddressesAreUnique (
List<NetworkInterface> networkInterfaces) throws Exception {
boolean uniqueMacAddresses = true;
for (NetworkInterface networkInterface : networkInterfaces) {
for (NetworkInterface comparisonNetIf : networkInterfaces) {
System.out.println("Comparing netif "
+ networkInterface.getName() + " and netif "
+ comparisonNetIf.getName());
if (testMacAddressesEqual(networkInterface, comparisonNetIf)) {
uniqueMacAddresses = false;
break;
}
}
if (uniqueMacAddresses != true)
break;
}
return uniqueMacAddresses;
}
private boolean testMacAddressesEqual(NetworkInterface netIf1,
NetworkInterface netIf2) throws Exception {
byte[] rawMacAddress1 = null;
byte[] rawMacAddress2 = null;
boolean macAddressesEqual = false;
if (!netIf1.getName().equals(netIf2.getName())) {
System.out.println("compare hardware addresses "
+ createMacAddressString(netIf1) + " and " + createMacAddressString(netIf2));
rawMacAddress1 = netIf1.getHardwareAddress();
rawMacAddress2 = netIf2.getHardwareAddress();
macAddressesEqual = Arrays.equals(rawMacAddress1, rawMacAddress2);
} else {
// same interface
macAddressesEqual = false;
}
return macAddressesEqual;
}
private String createMacAddressString (NetworkInterface netIf) throws Exception {
byte[] macAddr = netIf.getHardwareAddress();
StringBuilder sb = new StringBuilder();
if (macAddr != null) {
for (int i = 0; i < macAddr.length; i++) {
sb.append(String.format("%02X%s", macAddr[i],
(i < macAddr.length - 1) ? "-" : ""));
}
}
return sb.toString();
}
private void createNetworkInterfaceList(Enumeration<NetworkInterface> nis,
List<NetworkInterface> networkInterfaceList) throws Exception {
byte[] macAddr = null;
NetworkInterface netIf = null;
while (nis.hasMoreElements()) {
netIf = (NetworkInterface) nis.nextElement();
macAddr = netIf.getHardwareAddress();
if (macAddr != null) {
System.out
.println("Adding NetworkInterface " + netIf.getName());
networkInterfaceList.add(netIf);
}
}
}
}
...@@ -100,7 +100,7 @@ public class SensitivityModifier { ...@@ -100,7 +100,7 @@ public class SensitivityModifier {
} }
key.reset(); key.reset();
key = watcher.poll(1, TimeUnit.SECONDS); key = watcher.poll(1, TimeUnit.SECONDS);
} while (key != null && !eventReceived); } while (key != null);
// we should have received at least one ENTRY_MODIFY event // we should have received at least one ENTRY_MODIFY event
if (eventReceived) { if (eventReceived) {
......
...@@ -57,6 +57,12 @@ public class TestGetGlobal { ...@@ -57,6 +57,12 @@ public class TestGetGlobal {
} }
public static void main(String... args) { public static void main(String... args) {
final String manager = System.getProperty("java.util.logging.manager", null);
final String description = "TestGetGlobal"
+ (System.getSecurityManager() == null ? " " :
" -Djava.security.manager ")
+ (manager == null ? "" : "-Djava.util.logging.manager=" + manager);
Logger.global.info(messages[0]); // at this point LogManager is not Logger.global.info(messages[0]); // at this point LogManager is not
// initialized yet, so this message should not appear. // initialized yet, so this message should not appear.
...@@ -67,7 +73,9 @@ public class TestGetGlobal { ...@@ -67,7 +73,9 @@ public class TestGetGlobal {
final List<String> expected = Arrays.asList(Arrays.copyOfRange(messages, 1, messages.length)); final List<String> expected = Arrays.asList(Arrays.copyOfRange(messages, 1, messages.length));
if (!testgetglobal.HandlerImpl.received.equals(expected)) { if (!testgetglobal.HandlerImpl.received.equals(expected)) {
throw new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected); System.err.println("Test case failed: " + description);
throw new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected
+ "\n\t"+description);
} }
} }
} }
...@@ -22,17 +22,18 @@ ...@@ -22,17 +22,18 @@
*/ */
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
/** /**
* @test * @test
* @bug 7184195 * @bug 7184195 8021003
* @summary checks that java.util.logging.Logger.getGlobal().info() logs without configuration * @summary Test that the global logger can log with no configuration when accessed from multiple threads.
* @build TestGetGlobalConcurrent testgetglobal.HandlerImpl testgetglobal.LogManagerImpl1 testgetglobal.LogManagerImpl2 testgetglobal.LogManagerImpl3 testgetglobal.BadLogManagerImpl testgetglobal.DummyLogManagerImpl * @build TestGetGlobalConcurrent testgetglobal.HandlerImpl testgetglobal.LogManagerImpl1 testgetglobal.LogManagerImpl2 testgetglobal.LogManagerImpl3 testgetglobal.BadLogManagerImpl testgetglobal.DummyLogManagerImpl
* @run main/othervm/timeout=10 TestGetGlobalConcurrent * @run main/othervm/timeout=10 TestGetGlobalConcurrent
* @run main/othervm/timeout=10/policy=policy -Djava.security.manager TestGetGlobalConcurrent * @run main/othervm/timeout=10/policy=policy -Djava.security.manager TestGetGlobalConcurrent
* @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl TestGetGlobalConcurrent * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl1 TestGetGlobalConcurrent
* @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl TestGetGlobalConcurrent * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl1 TestGetGlobalConcurrent
* @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalConcurrent * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalConcurrent
* @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalConcurrent * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalConcurrent
* @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobalConcurrent * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobalConcurrent
...@@ -69,7 +70,6 @@ public class TestGetGlobalConcurrent { ...@@ -69,7 +70,6 @@ public class TestGetGlobalConcurrent {
// initialize the LogManager - and thus this message should appear. // initialize the LogManager - and thus this message should appear.
Logger.global.info(messages[i+1]); // Now that the LogManager is Logger.global.info(messages[i+1]); // Now that the LogManager is
// initialized, this message should appear too. // initialized, this message should appear too.
final List<String> expected = Arrays.asList(Arrays.copyOfRange(messages, i, i+2)); final List<String> expected = Arrays.asList(Arrays.copyOfRange(messages, i, i+2));
if (!testgetglobal.HandlerImpl.received.containsAll(expected)) { if (!testgetglobal.HandlerImpl.received.containsAll(expected)) {
fail(new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected)); fail(new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected));
...@@ -82,7 +82,6 @@ public class TestGetGlobalConcurrent { ...@@ -82,7 +82,6 @@ public class TestGetGlobalConcurrent {
// initialize the LogManager - and thus this message should appear. // initialize the LogManager - and thus this message should appear.
Logger.global.info(messages[i+1]); // Now that the LogManager is Logger.global.info(messages[i+1]); // Now that the LogManager is
// initialized, this message should appear too. // initialized, this message should appear too.
final List<String> expected = Arrays.asList(Arrays.copyOfRange(messages, i, i+2)); final List<String> expected = Arrays.asList(Arrays.copyOfRange(messages, i, i+2));
if (!testgetglobal.HandlerImpl.received.containsAll(expected)) { if (!testgetglobal.HandlerImpl.received.containsAll(expected)) {
fail(new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected)); fail(new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected));
...@@ -96,7 +95,6 @@ public class TestGetGlobalConcurrent { ...@@ -96,7 +95,6 @@ public class TestGetGlobalConcurrent {
// initialize the LogManager - and thus this message should appear. // initialize the LogManager - and thus this message should appear.
Logger.global.info(messages[i+1]); // Now that the LogManager is Logger.global.info(messages[i+1]); // Now that the LogManager is
// initialized, this message should appear too. // initialized, this message should appear too.
final List<String> expected = Arrays.asList(Arrays.copyOfRange(messages, i, i+2)); final List<String> expected = Arrays.asList(Arrays.copyOfRange(messages, i, i+2));
if (!testgetglobal.HandlerImpl.received.containsAll(expected)) { if (!testgetglobal.HandlerImpl.received.containsAll(expected)) {
fail(new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected)); fail(new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected));
...@@ -150,8 +148,17 @@ public class TestGetGlobalConcurrent { ...@@ -150,8 +148,17 @@ public class TestGetGlobalConcurrent {
public void run() { test4(); } public void run() { test4(); }
} }
static String description = "Unknown";
public static void main(String... args) throws Exception { public static void main(String... args) throws Exception {
final String manager = System.getProperty("java.util.logging.manager", null);
description = "TestGetGlobalConcurrent"
+ (System.getSecurityManager() == null ? " " :
" -Djava.security.manager ")
+ (manager == null ? "" : "-Djava.util.logging.manager=" + manager);
final Thread t1 = new Thread(new WaitAndRun(new Run1()), "test1"); final Thread t1 = new Thread(new WaitAndRun(new Run1()), "test1");
final Thread t2 = new Thread(new WaitAndRun(new Run2()), "test2"); final Thread t2 = new Thread(new WaitAndRun(new Run2()), "test2");
final Thread t3 = new Thread(new WaitAndRun(new Run3()), "test3"); final Thread t3 = new Thread(new WaitAndRun(new Run3()), "test3");
...@@ -169,14 +176,13 @@ public class TestGetGlobalConcurrent { ...@@ -169,14 +176,13 @@ public class TestGetGlobalConcurrent {
final List<String> expected = Arrays.asList(Arrays.copyOfRange(messages, 1, 3)); final List<String> expected = Arrays.asList(Arrays.copyOfRange(messages, 1, 3));
if (!testgetglobal.HandlerImpl.received.containsAll(expected)) { if (!testgetglobal.HandlerImpl.received.containsAll(expected)) {
throw new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected); fail(new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected));
} }
t1.join(); t2.join(); t3.join(); t4.join(); t1.join(); t2.join(); t3.join(); t4.join();
if (failed != null) { if (failed != null) {
throw new Error("Test failed.", failed); throw new Error("Test failed: "+description, failed);
} }
System.out.println("Test passed"); System.out.println("Test passed");
......
grant { grant {
permission java.util.PropertyPermission "java.util.logging.config.file", "write"; permission java.util.PropertyPermission "java.util.logging.config.file", "write";
permission java.util.PropertyPermission "test.src", "read"; permission java.util.PropertyPermission "test.src", "read";
permission java.util.PropertyPermission "java.util.logging.manager", "read";
permission java.lang.RuntimePermission "setContextClassLoader"; permission java.lang.RuntimePermission "setContextClassLoader";
permission java.lang.RuntimePermission "shutdownHooks"; permission java.lang.RuntimePermission "shutdownHooks";
permission java.util.logging.LoggingPermission "control"; permission java.util.logging.LoggingPermission "control";
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* @author ss45998 * @author ss45998
* *
* @build ParentLoggersTest * @build ParentLoggersTest
* @run main/othervm ParentLoggersTest * @run main ParentLoggersTest
*/ */
/* /*
......
...@@ -38,7 +38,7 @@ import sun.misc.SharedSecrets; ...@@ -38,7 +38,7 @@ import sun.misc.SharedSecrets;
/* /*
* @test * @test
* @bug 8017174 8010727 * @bug 8017174 8010727 8019945
* @summary NPE when using Logger.getAnonymousLogger or * @summary NPE when using Logger.getAnonymousLogger or
* LogManager.getLogManager().getLogger * LogManager.getLogManager().getLogger
* *
...@@ -432,45 +432,36 @@ public class TestAppletLoggerContext { ...@@ -432,45 +432,36 @@ public class TestAppletLoggerContext {
assertNull(manager.getLogger("")); assertNull(manager.getLogger(""));
assertNull(manager.getLogger("")); assertNull(manager.getLogger(""));
for (int j = 0; j<3; j++) {
Bridge.changeContext(); Bridge.changeContext();
// this is not a supported configuration: // this is not a supported configuration:
// We are in an applet context with several log managers. // We are in an applet context with several log managers.
// We however need to check our assumptions... // We however need to check our assumptions...
// Applet context => root logger and global logger are not null. // Applet context => root logger and global logger should also be null.
// root == LogManager.getLogManager().rootLogger
// global == Logger.global
Logger expected = (System.getSecurityManager() == null ? global : null);
Logger logger3 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); Logger logger3 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
Logger logger3b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); Logger logger3b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
assertNotNull(logger3); assertEquals(expected, logger3);
assertNotNull(logger3b); assertEquals(expected, logger3b);
Logger expected = (System.getSecurityManager() != null
? Logger.getGlobal()
: global);
assertEquals(logger3, expected); // in applet context, we will not see
// the LogManager's custom global logger added above...
assertEquals(logger3b, expected); // in applet context, we will not see
// the LogManager's custom global logger added above...
Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME); Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
manager.addLogger(global2); // adding a global logger will not work in applet context manager.addLogger(global2);
// we will always get back the global logger.
// this could be considered as a bug...
Logger logger4 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); Logger logger4 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
Logger logger4b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); Logger logger4b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
assertNotNull(logger4); assertNotNull(logger4);
assertNotNull(logger4b); assertNotNull(logger4b);
assertEquals(logger4, expected); // adding a global logger will not work in applet context expected = (System.getSecurityManager() == null ? global : global2);;
assertEquals(logger4b, expected); // adding a global logger will not work in applet context assertEquals(logger4, expected);
assertEquals(logger4b, expected);
Logger logger5 = manager.getLogger(""); Logger logger5 = manager.getLogger("");
Logger logger5b = manager.getLogger(""); Logger logger5b = manager.getLogger("");
Logger expectedRoot = (System.getSecurityManager() != null Logger expectedRoot = null;
? LogManager.getLogManager().getLogger("")
: null);
assertEquals(logger5, expectedRoot); assertEquals(logger5, expectedRoot);
assertEquals(logger5b, expectedRoot); assertEquals(logger5b, expectedRoot);
}
} }
} }
...@@ -511,57 +502,53 @@ public class TestAppletLoggerContext { ...@@ -511,57 +502,53 @@ public class TestAppletLoggerContext {
assertEquals(logger4, root); assertEquals(logger4, root);
assertEquals(logger4b, root); assertEquals(logger4b, root);
for (int j = 0 ; j < 3 ; j++) {
Bridge.changeContext(); Bridge.changeContext();
// this is not a supported configuration: // this is not a supported configuration:
// We are in an applet context with several log managers. // We are in an applet context with several log managers.
// We haowever need to check our assumptions... // We however need to check our assumptions...
// Applet context => root logger and global logger are not null. // Applet context => root logger and global logger should also be null.
// root == LogManager.getLogManager().rootLogger
// global == Logger.global
Logger logger5 = manager.getLogger(""); Logger logger5 = manager.getLogger("");
Logger logger5b = manager.getLogger(""); Logger logger5b = manager.getLogger("");
Logger expectedRoot = (System.getSecurityManager() != null Logger expectedRoot = (System.getSecurityManager() == null ? root : null);
? LogManager.getLogManager().getLogger("")
: root);
assertNotNull(logger5);
assertNotNull(logger5b);
assertEquals(logger5, expectedRoot); assertEquals(logger5, expectedRoot);
assertEquals(logger5b, expectedRoot); assertEquals(logger5b, expectedRoot);
if (System.getSecurityManager() != null) { if (System.getSecurityManager() != null) {
assertNotEquals(logger5, root); assertNull(manager.getLogger(Logger.GLOBAL_LOGGER_NAME));
assertNotEquals(logger5b, root); } else {
assertEquals(global, manager.getLogger(Logger.GLOBAL_LOGGER_NAME));
} }
Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME); Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
manager.addLogger(global2); // adding a global logger will not work in applet context manager.addLogger(global2);
// we will always get back the global logger.
// this could be considered as a bug...
Logger logger6 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); Logger logger6 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
Logger logger6b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); Logger logger6b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
Logger expectedGlobal = (System.getSecurityManager() != null Logger expectedGlobal = (System.getSecurityManager() == null ? global : global2);
? Logger.getGlobal()
: global);
assertNotNull(logger6); assertNotNull(logger6);
assertNotNull(logger6b); assertNotNull(logger6b);
assertEquals(logger6, expectedGlobal); // adding a global logger will not work in applet context assertEquals(logger6, expectedGlobal);
assertEquals(logger6b, expectedGlobal); // adding a global logger will not work in applet context assertEquals(logger6b, expectedGlobal);
if (System.getSecurityManager() != null) {
assertNull(manager.getLogger(""));
} else {
assertEquals(root, manager.getLogger(""));
}
Logger root2 = new Bridge.CustomLogger(""); Logger root2 = new Bridge.CustomLogger("");
manager.addLogger(root2); // adding a root logger will not work in applet context manager.addLogger(root2);
// we will always get back the default manager's root logger. expectedRoot = (System.getSecurityManager() == null ? root : root2);
// this could be considered as a bug...
Logger logger7 = manager.getLogger(""); Logger logger7 = manager.getLogger("");
Logger logger7b = manager.getLogger(""); Logger logger7b = manager.getLogger("");
assertNotNull(logger7); assertNotNull(logger7);
assertNotNull(logger7b); assertNotNull(logger7b);
assertEquals(logger7, expectedRoot); // adding a global logger will not work in applet context assertEquals(logger7, expectedRoot);
assertEquals(logger7b, expectedRoot); // adding a global logger will not work in applet context assertEquals(logger7b, expectedRoot);
assertNotEquals(logger7, root2); }
assertNotEquals(logger7b, root2);
} }
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
# #
# @test # @test
# @bug 6317711 6944847 # @bug 6317711 6944847 8024046
# @summary Ensure the GSSName has the correct impl which respects # @summary Ensure the GSSName has the correct impl which respects
# the contract for equals and hashCode across different configurations. # the contract for equals and hashCode across different configurations.
...@@ -56,6 +56,15 @@ case "$OS" in ...@@ -56,6 +56,15 @@ case "$OS" in
PATHSEP=":" PATHSEP=":"
FILESEP="/" FILESEP="/"
NATIVE=true NATIVE=true
# Not all *nix has native GSS libs installed
krb5-config --libs gssapi 2> /dev/null
if [ $? != 0 ]; then
# Fedora has a different path
/usr/kerberos/bin/krb5-config --libs gssapi 2> /dev/null
if [ $? != 0 ]; then
NATIVE=false
fi
fi
;; ;;
CYGWIN* ) CYGWIN* )
PATHSEP=";" PATHSEP=";"
......
...@@ -21,17 +21,24 @@ ...@@ -21,17 +21,24 @@
* questions. * questions.
*/ */
//
// SunJSSE does not support dynamic system properties, no way to re-use
// system properties in samevm/agentvm mode.
//
/* /*
* @test * @test
* @bug 4969799 * @bug 4969799
* @summary javax.net.ssl.SSLSocket.SSLSocket(InetAddress,int) shouldn't * @summary javax.net.ssl.SSLSocket.SSLSocket(InetAddress,int) shouldn't
* throw exception * throw exception
* * @run main/othervm CloseEngineException
* This is making sure that starting a new handshake throws the right
* exception. There is a similar test for SSLSocket.
*
*/ */
//
// This is making sure that starting a new handshake throws the right
// exception. There is a similar test for SSLSocket.
//
import javax.net.ssl.*; import javax.net.ssl.*;
import javax.net.ssl.SSLEngineResult.*; import javax.net.ssl.SSLEngineResult.*;
import java.io.*; import java.io.*;
......
...@@ -21,11 +21,17 @@ ...@@ -21,11 +21,17 @@
* questions. * questions.
*/ */
//
// SunJSSE does not support dynamic system properties, no way to re-use
// system properties in samevm/agentvm mode.
//
/* /*
* @test * @test
* @bug 4931274 * @bug 4931274
* @summary closeInbound does not signal when a close_notify has not * @summary closeInbound does not signal when a close_notify has not
* been received. * been received.
* @run main/othervm CloseInboundException
* @author Brad Wetmore * @author Brad Wetmore
*/ */
......
...@@ -21,15 +21,22 @@ ...@@ -21,15 +21,22 @@
* questions. * questions.
*/ */
//
// SunJSSE does not support dynamic system properties, no way to re-use
// system properties in samevm/agentvm mode.
//
/* /*
* @test * @test
* @bug 5019096 * @bug 5019096
* @summary Add scatter/gather APIs for SSLEngine * @summary Add scatter/gather APIs for SSLEngine
* * @run main/othervm CloseStart
* Check to see if the args are being parsed properly.
*
*/ */
//
// Check to see if the args are being parsed properly.
//
import javax.net.ssl.*; import javax.net.ssl.*;
import javax.net.ssl.SSLEngineResult.*; import javax.net.ssl.SSLEngineResult.*;
import java.io.*; import java.io.*;
......
...@@ -21,11 +21,16 @@ ...@@ -21,11 +21,16 @@
* questions. * questions.
*/ */
//
// SunJSSE does not support dynamic system properties, no way to re-use
// system properties in samevm/agentvm mode.
//
/* /*
* @test * @test
* @bug 4969459 * @bug 4969459
* @summary Delegated tasks are not reflecting the subclasses of SSLException * @summary Delegated tasks are not reflecting the subclasses of SSLException
* * @run main/othervm DelegatedTaskWrongException
*/ */
import javax.net.ssl.*; import javax.net.ssl.*;
......
...@@ -21,10 +21,16 @@ ...@@ -21,10 +21,16 @@
* questions. * questions.
*/ */
//
// SunJSSE does not support dynamic system properties, no way to re-use
// system properties in samevm/agentvm mode.
//
/* /*
* @test * @test
* @bug 6728126 * @bug 6728126
* @summary Parsing Extensions in Client Hello message is done in a wrong way * @summary Parsing Extensions in Client Hello message is done in a wrong way
* @run main/othervm EmptyExtensionData
*/ */
import javax.net.ssl.*; import javax.net.ssl.*;
......
...@@ -21,11 +21,16 @@ ...@@ -21,11 +21,16 @@
* questions. * questions.
*/ */
//
// SunJSSE does not support dynamic system properties, no way to re-use
// system properties in samevm/agentvm mode.
//
/* /*
* @test * @test
* @bug 4980882 * @bug 4980882
* @summary SSLEngine should enforce setUseClientMode * @summary SSLEngine should enforce setUseClientMode
* * @run main/othervm EngineEnforceUseClientMode
* @author Brad R. Wetmore * @author Brad R. Wetmore
*/ */
......
...@@ -21,16 +21,21 @@ ...@@ -21,16 +21,21 @@
* questions. * questions.
*/ */
//
// SunJSSE does not support dynamic system properties, no way to re-use
// system properties in samevm/agentvm mode.
//
/* /*
* @test * @test
* @bug 6207322 * @bug 6207322
* @summary SSLEngine is returning a premature FINISHED message when doing * @summary SSLEngine is returning a premature FINISHED message when doing
* an abbreviated handshake. * an abbreviated handshake.
* @run main/othervm RehandshakeFinished * @run main/othervm RehandshakeFinished
* * @author Brad Wetmore
* SunJSSE does not support dynamic system properties, no way to re-use */
* system properties in samevm/agentvm mode.
* /*
* This test may need some updating if the messages change order. * This test may need some updating if the messages change order.
* Currently I'm expecting that there is a simple renegotiation, with * Currently I'm expecting that there is a simple renegotiation, with
* each message being contained in a single SSL packet. * each message being contained in a single SSL packet.
...@@ -41,8 +46,6 @@ ...@@ -41,8 +46,6 @@
* FINISHED * FINISHED
* CCS * CCS
* FINISHED * FINISHED
*
* @author Brad Wetmore
*/ */
/** /**
......
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* 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.
*/
//
// SunJSSE does not support dynamic system properties, no way to re-use
// system properties in samevm/agentvm mode.
//
/*
* @test
* @bug 7188657
* @summary There should be a way to reorder the JSSE ciphers
* @run main/othervm UseCipherSuitesOrder
* TLS_RSA_WITH_AES_128_CBC_SHA,SSL_RSA_WITH_RC4_128_SHA
*/
import java.io.*;
import java.net.*;
import javax.net.ssl.*;
import java.util.Arrays;
public class UseCipherSuitesOrder {
/*
* =============================================================
* Set the various variables needed for the tests, then
* specify what tests to run on each side.
*/
/*
* Should we run the client or server in a separate thread?
* Both sides can throw exceptions, but do you have a preference
* as to which side should be the main thread.
*/
static boolean separateServerThread = false;
/*
* Where do we find the keystores?
*/
static String pathToStores = "../../../../etc";
static String keyStoreFile = "keystore";
static String trustStoreFile = "truststore";
static String passwd = "passphrase";
/*
* Is the server ready to serve?
*/
volatile static boolean serverReady = false;
/*
* Turn on SSL debugging?
*/
static boolean debug = false;
/*
* If the client or server is doing some kind of object creation
* that the other side depends on, and that thread prematurely
* exits, you may experience a hang. The test harness will
* terminate all hung threads after its timeout has expired,
* currently 3 minutes by default, but you might try to be
* smart about it....
*/
/*
* Define the server side of the test.
*
* If the server prematurely exits, serverReady will be set to true
* to avoid infinite hangs.
*/
void doServerSide() throws Exception {
SSLServerSocketFactory sslssf =
(SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
SSLServerSocket sslServerSocket =
(SSLServerSocket) sslssf.createServerSocket(serverPort);
serverPort = sslServerSocket.getLocalPort();
// use local cipher suites preference
SSLParameters params = sslServerSocket.getSSLParameters();
params.setUseCipherSuitesOrder(true);
params.setCipherSuites(srvEnabledCipherSuites);
sslServerSocket.setSSLParameters(params);
/*
* Signal Client, we're ready for his connect.
*/
serverReady = true;
SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
InputStream sslIS = sslSocket.getInputStream();
OutputStream sslOS = sslSocket.getOutputStream();
sslIS.read();
sslOS.write(85);
sslOS.flush();
SSLSession session = sslSocket.getSession();
if (!srvEnabledCipherSuites[0].equals(session.getCipherSuite())) {
throw new Exception(
"Expected to negotiate " + srvEnabledCipherSuites[0] +
" , but not " + session.getCipherSuite());
}
sslSocket.close();
}
/*
* Define the client side of the test.
*
* If the server prematurely exits, serverReady will be set to true
* to avoid infinite hangs.
*/
void doClientSide() throws Exception {
/*
* Wait for server to get started.
*/
while (!serverReady) {
Thread.sleep(50);
}
SSLSocketFactory sslsf =
(SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket sslSocket = (SSLSocket)
sslsf.createSocket("localhost", serverPort);
sslSocket.setEnabledCipherSuites(cliEnabledCipherSuites);
InputStream sslIS = sslSocket.getInputStream();
OutputStream sslOS = sslSocket.getOutputStream();
sslOS.write(280);
sslOS.flush();
sslIS.read();
sslSocket.close();
}
// client enabled cipher suites
private static String[] cliEnabledCipherSuites;
// server enabled cipher suites
private static String[] srvEnabledCipherSuites;
private static void parseArguments(String[] args) throws Exception {
if (args.length != 1) {
System.out.println("Usage: java UseCipherSuitesOrder ciphersuites");
System.out.println("\tciphersuites: " +
"a list of enabled cipher suites, separated with comma");
throw new Exception("Incorrect usage");
}
cliEnabledCipherSuites = args[0].split(",");
if (cliEnabledCipherSuites.length < 2) {
throw new Exception("Need to enable at least two cipher suites");
}
// Only need to use 2 cipher suites in server side.
srvEnabledCipherSuites = Arrays.<String>copyOf(
cliEnabledCipherSuites, 2);
// Reverse the cipher suite preference in server side.
srvEnabledCipherSuites[0] = cliEnabledCipherSuites[1];
srvEnabledCipherSuites[1] = cliEnabledCipherSuites[0];
}
/*
* =============================================================
* The remainder is just support stuff
*/
// use any free port by default
volatile int serverPort = 0;
volatile Exception serverException = null;
volatile Exception clientException = null;
public static void main(String[] args) throws Exception {
// parse the arguments
parseArguments(args);
String keyFilename =
System.getProperty("test.src", ".") + "/" + pathToStores +
"/" + keyStoreFile;
String trustFilename =
System.getProperty("test.src", ".") + "/" + pathToStores +
"/" + trustStoreFile;
System.setProperty("javax.net.ssl.keyStore", keyFilename);
System.setProperty("javax.net.ssl.keyStorePassword", passwd);
System.setProperty("javax.net.ssl.trustStore", trustFilename);
System.setProperty("javax.net.ssl.trustStorePassword", passwd);
if (debug)
System.setProperty("javax.net.debug", "all");
/*
* Start the tests.
*/
new UseCipherSuitesOrder();
}
Thread clientThread = null;
Thread serverThread = null;
/*
* Primary constructor, used to drive remainder of the test.
*
* Fork off the other side, then do your work.
*/
UseCipherSuitesOrder() throws Exception {
Exception startException = null;
try {
if (separateServerThread) {
startServer(true);
startClient(false);
} else {
startClient(true);
startServer(false);
}
} catch (Exception e) {
startException = e;
}
/*
* Wait for other side to close down.
*/
if (separateServerThread) {
if (serverThread != null) {
serverThread.join();
}
} else {
if (clientThread != null) {
clientThread.join();
}
}
/*
* When we get here, the test is pretty much over.
* Which side threw the error?
*/
Exception local;
Exception remote;
if (separateServerThread) {
remote = serverException;
local = clientException;
} else {
remote = clientException;
local = serverException;
}
Exception exception = null;
/*
* Check various exception conditions.
*/
if ((local != null) && (remote != null)) {
// If both failed, return the curthread's exception.
local.initCause(remote);
exception = local;
} else if (local != null) {
exception = local;
} else if (remote != null) {
exception = remote;
} else if (startException != null) {
exception = startException;
}
/*
* If there was an exception *AND* a startException,
* output it.
*/
if (exception != null) {
if (exception != startException && startException != null) {
exception.addSuppressed(startException);
}
throw exception;
}
// Fall-through: no exception to throw!
}
void startServer(boolean newThread) throws Exception {
if (newThread) {
serverThread = new Thread() {
public void run() {
try {
doServerSide();
} catch (Exception e) {
/*
* Our server thread just died.
*
* Release the client, if not active already...
*/
System.err.println("Server died...");
serverReady = true;
serverException = e;
}
}
};
serverThread.start();
} else {
try {
doServerSide();
} catch (Exception e) {
serverException = e;
} finally {
serverReady = true;
}
}
}
void startClient(boolean newThread) throws Exception {
if (newThread) {
clientThread = new Thread() {
public void run() {
try {
doClientSide();
} catch (Exception e) {
/*
* Our client thread just died.
*/
System.err.println("Client died...");
clientException = e;
}
}
};
clientThread.start();
} else {
try {
doClientSide();
} catch (Exception e) {
clientException = e;
}
}
}
}
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* 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.
*/
/*
* @test
* @bug 8024141
* @summary Test for cache support of sun.util.locale.provider.LocaleResources.getTimeZoneNames
*/
import java.time.ZoneId;
import static java.util.Locale.ENGLISH;
import static java.time.format.TextStyle.FULL;
import static java.time.format.TextStyle.SHORT;
public class Bug8024141 {
// This test assumes that the two time zones are in GMT. If
// they become different zones, need to pick up another zones.
private static final String[] ZONES = {
"Africa/Abidjan",
"Africa/Bamako"
};
public static void main(String[] args) {
ZoneId gmt = ZoneId.of("GMT");
String gmtName = gmt.getDisplayName(FULL, ENGLISH);
String gmtAbbr = gmt.getDisplayName(SHORT, ENGLISH);
for (String zone : ZONES) {
ZoneId id = ZoneId.of(zone);
String name = id.getDisplayName(FULL, ENGLISH);
String abbr = id.getDisplayName(SHORT, ENGLISH);
if (!name.equals(gmtName) || !abbr.equals(gmtAbbr)) {
throw new RuntimeException("inconsistent name/abbr for " + zone + ":\n"
+ "name=" + name + ", abbr=" + abbr);
}
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册