--- a/jdk/make/CompileDemos.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/CompileDemos.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -38,7 +38,8 @@
include ZipArchive.gmk
# Prepare the find cache.
-$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src))
+$(eval $(call FillCacheFind, $(wildcard $(JDK_TOPDIR)/src/demo \
+ $(JDK_TOPDIR)/src/*/demo)))
# Append demo goals to this variable.
TARGETS =
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/CompileTools.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -0,0 +1,83 @@
+#
+# Copyright (c) 2011, 2014, 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.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+include SetupJavaCompilers.gmk
+
+################################################################################
+
+JIMAGE_PKGS := \
+ jdk/internal/jimage \
+ jdk/internal/jrtfs \
+ #
+
+$(eval $(call SetupJavaCompilation,BUILD_INTERIM_JIMAGE, \
+ SETUP := GENERATE_OLDBYTECODE, \
+ SRC := $(JDK_TOPDIR)/src/java.base/share/classes, \
+ INCLUDES := $(JIMAGE_PKGS), \
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes))
+
+TARGETS += $(BUILD_INTERIM_JIMAGE)
+
+# Because of the explicit INCLUDES in the compilation setup above, the service provider
+# file will not be copied unless META-INF/services would also be added to the INCLUDES.
+# Adding META-INF/services would include all files in that directory when only the one
+# is needed, which is why this explicit copy is defined instead.
+$(eval $(call SetupCopyFiles,COPY_JIMAGE_SERVICE_PROVIDER, \
+ SRC := $(JDK_TOPDIR)/src/java.base/share/classes, \
+ DEST := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes, \
+ FILES := META-INF/services/java.nio.file.spi.FileSystemProvider))
+
+TARGETS += $(COPY_JIMAGE_SERVICE_PROVIDER)
+
+################################################################################
+
+$(eval $(call SetupJavaCompilation,BUILD_TOOLS_JDK, \
+ SETUP := GENERATE_OLDBYTECODE, \
+ ADD_JAVAC_FLAGS := -Xbootclasspath/p:$(call PathList, \
+ $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
+ $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes), \
+ SRC := $(JDK_TOPDIR)/make/src/classes $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes, \
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
+ COPY := boot.modules ext.modules))
+
+$(BUILD_TOOLS_JDK): $(BUILD_INTERIM_JIMAGE) $(COPY_JIMAGE_SERVICE_PROVIDER)
+
+TARGETS += $(BUILD_TOOLS_JDK)
+
+$(eval $(call SetupCopyFiles,COPY_NIMBUS_TEMPLATES, \
+ SRC := $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus, \
+ DEST := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes/build/tools/generatenimbus/resources, \
+ FILES := $(wildcard $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/*.template)))
+
+TARGETS += $(COPY_NIMBUS_TEMPLATES)
+
+################################################################################
+
+all: $(TARGETS)
--- a/jdk/make/CopySamples.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/CopySamples.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -28,41 +28,38 @@
include $(SPEC)
include MakeBase.gmk
+################################################################################
+
SAMPLE_TARGET_DIR := $(SUPPORT_OUTPUTDIR)/sample/image
SAMPLE_SOURCE_DIR := $(JDK_TOPDIR)/src/sample/share
-SAMPLE_CLOSED_SOURCE_DIR := $(JDK_TOPDIR)/src/closed/sample/share
SAMPLE_SOLARIS_SOURCE_DIR := $(JDK_TOPDIR)/src/sample/solaris
# Exclude the vm directory
-SAMPLE_FIND_FILTER := -name vm -prune -o
-
-SAMPLE_SOURCE := $(shell $(FIND) $(SAMPLE_SOURCE_DIR) $(SAMPLE_FIND_FILTER) -type f -print)
-SAMPLE_TARGET := $(subst $(SAMPLE_SOURCE_DIR),$(SAMPLE_TARGET_DIR),$(SAMPLE_SOURCE))
+$(eval $(call SetupCopyFiles, COPY_SHARE_SAMPLES, \
+ SRC := $(SAMPLE_SOURCE_DIR), \
+ DEST := $(SAMPLE_TARGET_DIR), \
+ FILES := $(filter-out $(SAMPLE_SOURCE_DIR)/vm/%, \
+ $(call CacheFind, $(SAMPLE_SOURCE_DIR))), \
+))
-ifndef OPENJDK
-# Exclude Main.java in EbayClient dir
- SAMPLE_CLOSED_SOURCE := $(shell $(FIND) $(SAMPLE_CLOSED_SOURCE_DIR) -type f -print | $(GREP) -v EbayClient/Main.java)
- SAMPLE_CLOSED_TARGET := $(subst $(SAMPLE_CLOSED_SOURCE_DIR),$(SAMPLE_TARGET_DIR),$(SAMPLE_CLOSED_SOURCE))
- SAMPLE_TARGET += $(SAMPLE_CLOSED_TARGET)
-endif
+TARGETS += $(COPY_SHARE_SAMPLES)
ifneq (, $(filter $(OPENJDK_TARGET_OS), solaris macosx))
- SAMPLE_SOLARIS_SOURCE := $(shell $(FIND) $(SAMPLE_SOLARIS_SOURCE_DIR) -type f -print)
- SAMPLE_SOLARIS_TARGET := $(subst $(SAMPLE_SOLARIS_SOURCE_DIR),$(SAMPLE_TARGET_DIR),$(SAMPLE_SOLARIS_SOURCE))
- SAMPLE_TARGET += $(SAMPLE_SOLARIS_TARGET)
+ $(eval $(call SetupCopyFiles, COPY_SOLARIS_SAMPLES, \
+ SRC := $(SAMPLE_SOLARIS_SOURCE_DIR), \
+ DEST := $(SAMPLE_TARGET_DIR), \
+ FILES := $(call CacheFind, $(SAMPLE_SOLARIS_SOURCE_DIR)), \
+ ))
+
+ TARGETS += $(COPY_SOLARIS_SAMPLES)
endif
-$(SAMPLE_TARGET_DIR)/dtrace/%: $(SAMPLE_SOLARIS_SOURCE_DIR)/dtrace/%
- $(call install-file)
+################################################################################
-$(SAMPLE_TARGET_DIR)/webservices/%: $(SAMPLE_CLOSED_SOURCE_DIR)/webservices/%
- $(call install-file)
+$(eval $(call IncludeCustomExtension, jdk, CopySamples.gmk))
-$(SAMPLE_TARGET_DIR)/%: $(SAMPLE_SOURCE_DIR)/%
- $(call install-file)
+################################################################################
-COPY_FILES += $(SAMPLE_TARGET)
+all: $(TARGETS)
-all: $(COPY_FILES)
-
-.PHONY: all
+.PHONY: all default
--- a/jdk/make/Import.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/Import.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -48,7 +48,7 @@
ifneq ($(STATIC_BUILD), true)
JSIG_IMPORT = jsig.*
else
- JSIG_IMPORT =
+ JSIG_IMPORT =
endif
HOTSPOT_BASE_IMPORT_FILES := \
--- a/jdk/make/Tools.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/Tools.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -26,31 +26,14 @@
ifndef _TOOLS_GMK
_TOOLS_GMK := 1
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
include JavaCompilation.gmk
-include NativeCompilation.gmk
-include SetupJavaCompilers.gmk
################################################################################
-
-$(eval $(call SetupJavaCompilation,BUILD_TOOLS_JDK, \
- SETUP := GENERATE_OLDBYTECODE, \
- ADD_JAVAC_FLAGS := -Xbootclasspath/p:$(call PathList, \
- $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
- $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes), \
- SRC := $(JDK_TOPDIR)/make/src/classes $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes, \
- BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
- COPY := boot.modules ext.modules))
-
-$(eval $(call SetupCopyFiles,COPY_NIMBUS_TEMPLATES, \
- SRC := $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus, \
- DEST := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes/build/tools/generatenimbus/resources, \
- FILES := $(wildcard $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/*.template)))
-
-BUILD_TOOLS_JDK += $(COPY_NIMBUS_TEMPLATES)
+# To avoid reevaluating the compilation setup for the tools each time this file
+# is included, the actual compilation is handled by CompileTools.gmk. The
+# following trick is used to be able to declare a dependency on the built tools.
+BUILD_TOOLS_JDK := $(call SetupJavaCompilationCompileTarget, \
+ BUILD_TOOLS_JDK, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes)
################################################################################
@@ -135,34 +118,4 @@
-cp $(call PathList, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes $(JDK_OUTPUTDIR)) \
build.tools.module.ImageBuilder
-##########################################################################################
-
-JIMAGE_PKGS := \
- jdk/internal/jimage \
- jdk/internal/jrtfs \
- #
-
-$(eval $(call SetupJavaCompilation,BUILD_INTERIM_JIMAGE, \
- SETUP := GENERATE_OLDBYTECODE, \
- SRC := $(JDK_TOPDIR)/src/java.base/share/classes, \
- INCLUDES := $(JIMAGE_PKGS), \
- BIN := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes))
-
-# Because of the explicit INCLUDES in the compilation setup above, the service provider
-# file will not be copied unless META-INF/services would also be added to the INCLUDES.
-# Adding META-INF/services would include all files in that directory when only the one
-# is needed, which is why this explicit copy is defined instead.
-$(eval $(call SetupCopyFiles,COPY_JIMAGE_SERVICE_PROVIDER, \
- SRC := $(JDK_TOPDIR)/src/java.base/share/classes, \
- DEST := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes, \
- FILES := META-INF/services/java.nio.file.spi.FileSystemProvider))
-
-##########################################################################################
-
-$(BUILD_TOOLS_JDK): $(BUILD_INTERIM_JIMAGE) $(COPY_JIMAGE_SERVICE_PROVIDER)
-
-java-tools: $(BUILD_TOOLS_JDK)
-
-all: java-tools
-
endif # _TOOLS_GMK
--- a/jdk/make/copy/Copy-java.base.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/copy/Copy-java.base.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -187,27 +187,31 @@
ifeq ($(CACERTS_FILE), )
CACERTS_FILE := $(JDK_TOPDIR)/src/java.base/share/conf/security/cacerts
endif
+
CACERTS_DST := $(LIB_DST_DIR)/security/cacerts
$(CACERTS_DST): $(CACERTS_FILE)
+ $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%, %, $@))
$(call install-file)
TARGETS += $(CACERTS_DST)
################################################################################
-$(CONF_DST_DIR)/net.properties: $(JDK_TOPDIR)/src/java.base/share/conf/net.properties
- $(ECHO) $(LOG_INFO) Copying $(@F)
- $(call install-file)
+$(eval $(call SetupCopyFiles, COPY_NET_PROPERTIES, \
+ FILES := $(JDK_TOPDIR)/src/java.base/share/conf/net.properties, \
+ DEST := $(CONF_DST_DIR), \
+))
-TARGETS += $(CONF_DST_DIR)/net.properties
+TARGETS += $(COPY_NET_PROPERTIES)
ifeq ($(OPENJDK_TARGET_OS), solaris)
- $(CONF_DST_DIR)/sdp/sdp.conf.template: $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template
- $(ECHO) $(LOG_INFO) Copying $(@F)
- $(call install-file)
+ $(eval $(call SetupCopyFiles, COPY_SDP_CONF, \
+ FILES := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template, \
+ DEST := $(CONF_DST_DIR)/sdp, \
+ ))
- TARGETS += $(CONF_DST_DIR)/sdp/sdp.conf.template
+ TARGETS += $(COPY_SDP_CONF)
endif
################################################################################
--- a/jdk/make/data/blacklistedcertsconverter/blacklisted.certs.pem Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/data/blacklistedcertsconverter/blacklisted.certs.pem Thu Jan 21 10:17:21 2016 -0800
@@ -725,3 +725,26 @@
DBabJH1vJ9Gd+KwxMCmBZ6pQPl28JDimhJhI2LNqU349uADQVV0HJosddN/ARyyI
LSIQO7BnNVKVG9Iujf33bvPNeg0qNz5qw+rKKq97Pqeum+L5oKU=
-----END CERTIFICATE-----
+
+// Subject: CN=eDellRoot
+// Issuer: CN=eDellRoot
+// Serial Number:
+// 6b:c5:7b:95:18:93:aa:97:4b:62:4a:c0:88:fc:3b:b6
+-----BEGIN CERTIFICATE-----
+MIIC8zCCAd+gAwIBAgIQa8V7lRiTqpdLYkrAiPw7tjAJBgUrDgMCHQUAMBQxEjAQ
+BgNVBAMTCWVEZWxsUm9vdDAeFw0xNTA0MDcxMDIzMjdaFw0zOTEyMzEyMzU5NTla
+MBQxEjAQBgNVBAMTCWVEZWxsUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
+AQoCggEBAL3RJg1uzVuEX0Hw4XWGzs6oI9W+o7HZdVdBMMVb4Gzb4uZjCTNjbPx4
+b8LNFL1uArUt+5VVMQDsOTY3Lg/Xe/UNukY2b+0llUOzzBYYpbsFcco4n6SsTvDh
+Ni5t+kPo7c23ZrYBPmOu82eEJ6cavs/t39u+wFOkXXwvRCiHA/lWyNWNEPh17+bC
+EP3q5N+JrV+6Ho3zQPEv5QUJYdmXsMmD2CMQojeQUj68J91P5w5BKjurG0xjivzh
+Soie9ym7VRwLFjWScRuw/9XV6CLqTyL5xrqiiDp1uTOuqNj3uxyts9ocbsoJXuxj
+5iEYkSM1nvLupEv+lgy9WqzIEFMm1l8CAwEAAaNJMEcwRQYDVR0BBD4wPIAQYA/f
+EzPwmaRcZuSaa/VZ1KEWMBQxEjAQBgNVBAMTCWVEZWxsUm9vdIIQa8V7lRiTqpdL
+YkrAiPw7tjAJBgUrDgMCHQUAA4IBAQArfdcScsezj8ooJ92UwwnPgg36noOgiUs5
+XzPLP4h0JpUYQVKB9hY1WTDwRUfTKGh7oNOowd027a/rVSb/TNeoiJIvMKn4gbvV
+CWAiHhO8u2u0RkHCDVsa7e0i4ncpueWsihjn6jBrY8T+7eDYwiFT/F03A8NJ7mK5
+lZA8SFd5CTDy3EBUU5UwzXUc5HoIRUxXSPycu3aIBWawg3sCdKiAoikScPAWj0bM
+0vmsP/8QSlTOBqO+QFQ6R82BtTvBNU3qbVICV4QObsxib++FAFL56NApPqskg7Vz
+LfNIAjKabHUcjbuZkmg6jr4BfYW7+oQDHCsYgADjjKGdKz/8U/fP
+-----END CERTIFICATE-----
--- a/jdk/make/gendata/GendataBreakIterator.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/gendata/GendataBreakIterator.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -68,8 +68,8 @@
$(BIFILES): $(BASE_DATA_PKG_DIR)/_the.bifiles
$(BASE_DATA_PKG_DIR)/_the.bifiles: JAVA_FLAGS += -Xbootclasspath/p:$(BREAK_ITERATOR_CLASSES)
$(BASE_DATA_PKG_DIR)/_the.bifiles: $(BUILD_TOOLS) $(UNICODEDATA) $(BUILD_BREAKITERATOR)
- $(ECHO) $(LOG_INFO) "Generating BreakIteratorData"
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Generating BreakIteratorData)
+ $(call MakeDir, $(@D))
$(RM) $(BIFILES)
$(TOOL_GENERATEBREAKITERATORDATA) \
-o $(@D) \
@@ -79,8 +79,8 @@
$(BIFILES_TH): $(LD_DATA_PKG_DIR)/_the.bifiles_th
$(LD_DATA_PKG_DIR)/_the.bifiles_th: JAVA_FLAGS += -Xbootclasspath/p:$(BREAK_ITERATOR_CLASSES)
$(LD_DATA_PKG_DIR)/_the.bifiles_th: $(BUILD_TOOLS) $(UNICODEDATA) $(BUILD_BREAKITERATOR)
- $(ECHO) $(LOG_INFO) "Generating BreakIteratorData_th"
- $(MKDIR) -p $(@D)/th
+ $(call LogInfo, Generating BreakIteratorData_th)
+ $(call MakeDir, $(@D)/th)
$(RM) $(BIFILES_TH)
$(TOOL_GENERATEBREAKITERATORDATA) \
-o $(@D) \
--- a/jdk/make/gendata/GendataHtml32dtd.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/gendata/GendataHtml32dtd.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -27,7 +27,7 @@
HTML32DTD = $(JDK_OUTPUTDIR)/modules/java.desktop/javax/swing/text/html/parser/html32.bdtd
$(HTML32DTD): $(BUILD_TOOLS_JDK)
- $(ECHO) "Generating HTML DTD file"
+ $(call LogInfo, Generating HTML DTD file)
$(MKDIR) -p $(@D)
$(RM) $@
($(TOOL_DTDBUILDER) $(LOG_INFO) html32 > $@) || exit 1
--- a/jdk/make/gendata/GendataPolicyJars.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/gendata/GendataPolicyJars.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -87,8 +87,7 @@
$(US_EXPORT_POLICY_JAR_LIMITED): \
$(US_EXPORT_POLICY_JAR_UNLIMITED)
- $(ECHO) $(LOG_INFO) \
- Copying unlimited $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call LogInfo, Copying unlimited $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(install-file)
TARGETS += $(US_EXPORT_POLICY_JAR_LIMITED) $(US_EXPORT_POLICY_JAR_UNLIMITED)
@@ -99,7 +98,7 @@
else
$(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_LIMITED)
$(install-file)
-endif
+endif
ifndef OPENJDK
ifneq ($(UNLIMITED_CRYPTO), true)
--- a/jdk/make/gensrc/Gensrc-jdk.charsets.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/gensrc/Gensrc-jdk.charsets.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -46,30 +46,34 @@
$(wildcard $(CHARSET_DATA_DIR)/$(CHARSET_STANDARD_OS)) \
$(CHARSET_TEMPLATES) $(CHARSET_EXTENDED_JAVA_TEMPLATES) \
$(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Generating jdk.charsets extcs)
+ $(call MakeDir, $(@D))
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) \
extcs charsets $(CHARSET_STANDARD_OS) \
$(CHARSET_EXTENDED_JAVA_TEMPLATES) \
$(CHARSET_EXTENDED_JAVA_DIR) \
$(CHARSET_COPYRIGHT_HEADER) \
- $(LOG_INFO)
+ $(LOG_DEBUG)
$(TOUCH) '$@'
$(CHARSET_DONE_CS)-hkscs: $(CHARSET_COPYRIGHT_HEADER)/HKSCS.java \
$(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Generating jdk.charsets hkscs)
+ $(call MakeDir, $(@D))
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) hkscs '$<'
$(TOUCH) '$@'
$(CHARSET_DONE_CS)-euctw: $(CHARSET_COPYRIGHT_HEADER)/EUC_TW.java \
$(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Generating jdk.charsets euctw)
+ $(call MakeDir, $(@D))
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) euctw '$<'
$(TOUCH) '$@'
$(CHARSET_GENSRC_JAVA_DIR_CS)/sjis0213.dat: $(CHARSET_DATA_DIR)/sjis0213.map \
$(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
+ $(call MakeDir, $(@D))
$(TOOL_CHARSETMAPPING) '$<' '$@' sjis0213
GENSRC_JDK_CHARSETS += \
@@ -86,4 +90,3 @@
all: jdk.charsets
.PHONY: all jdk.charsets
-
--- a/jdk/make/gensrc/Gensrc-jdk.jdi.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/gensrc/Gensrc-jdk.jdi.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -40,19 +40,18 @@
# Touch the target of this rule at the end to avoid triggering false rebuilds
$(JAVA_FILE): $(JDWP_SPEC_FILE) $(BUILD_TOOLS_JDK) $(HEADER_FILE)
- $(MKDIR) -p $(@D)
- $(MKDIR) -p $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent
+ $(call LogInfo, Creating JDWP.java and JDWPCommands.h from jdwp.spec)
+ $(call MakeDir, $(@D) $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent)
$(RM) $@ $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
- $(ECHO) $(LOG_INFO) Creating JDWP.java and JDWPCommands.h from jdwp.spec
$(TOOL_JDWPGEN) $< -jdi $@ -include \
$(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
$(TOUCH) $@
$(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html: $(JDWP_SPEC_FILE) \
$(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Creating $(@F) from jdwp.spec)
+ $(call MakeDir, $(@D))
$(RM) $@
- $(ECHO) $(LOG_INFO) Creating $(@F) from jdwp.spec
$(TOOL_JDWPGEN) $< -doc $@
GENSRC_JDWP := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java \
@@ -63,14 +62,14 @@
################################################################################
define process-provider
- $(MKDIR) -p $(@D)
+ $(call MakeDir, $(@D))
$(CAT) $^ | $(SED) -e "s/^#\[$(OPENJDK_TARGET_OS)\]//" > $@
endef
# Filter com.sun.jdi.connect.Connector
$(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector: \
$(JDK_TOPDIR)/src/jdk.jdi/share/classes/META-INF/services/com.sun.jdi.connect.Connector \
- $(HOTSPOT_TOPDIR)/agent/src/share/classes/META-INF/services/com.sun.jdi.connect.Connector
+ $(HOTSPOT_TOPDIR)/src/jdk.hotspot.agent/share/classes/META-INF/services/com.sun.jdi.connect.Connector
$(process-provider)
# Copy the same service file into jdk.hotspot.agent so that they are kept the same.
--- a/jdk/make/gensrc/GensrcBuffer.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/gensrc/GensrcBuffer.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -23,7 +23,7 @@
# questions.
#
-GENSRC_BUFFER :=
+GENSRC_BUFFER :=
GENSRC_BUFFER_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/nio
@@ -31,9 +31,9 @@
###
-$(GENSRC_BUFFER_DST)/_the.buffer.dir:
- $(ECHO) "Generating buffer classes"
- $(MKDIR) -p $(@D)
+$(GENSRC_BUFFER_DST)/_the.buffer.dir:
+ $(call LogInfo, Generating buffer classes)
+ $(call MakeDir, $(@D))
$(TOUCH) $@
define fixRw
--- a/jdk/make/gensrc/GensrcCharacterData.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/gensrc/GensrcCharacterData.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -35,8 +35,8 @@
define SetupCharacterData
$(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java: \
$(CHARACTERDATA)/$1.java.template
- $(MKDIR) -p $$(@D)
- $(ECHO) $(LOG_INFO) Generating $1.java
+ $$(call LogInfo, Generating $1.java)
+ $$(call MakeDir, $$(@D))
$(TOOL_GENERATECHARACTER) $2 \
-template $(CHARACTERDATA)/$1.java.template \
-spec $(UNICODEDATA)/UnicodeData.txt \
@@ -56,7 +56,7 @@
# Copy two Java files that need no preprocessing.
$(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/%.java: $(CHARACTERDATA)/%.java.template
- $(ECHO) $(LOG_INFO) Generating $(@F)
+ $(call LogInfo, Generating $(@F))
$(call install-file)
GENSRC_CHARACTERDATA += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/CharacterDataUndefined.java \
--- a/jdk/make/gensrc/GensrcCharsetMapping.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/gensrc/GensrcCharsetMapping.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -44,13 +44,13 @@
$(wildcard $(CHARSET_DATA_DIR)/$(CHARSET_STANDARD_OS)) \
$(CHARSET_TEMPLATES) $(CHARSET_STANDARD_JAVA_TEMPLATES) \
$(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Generating java.base charset mapping)
+ $(call MakeDir, $(@D))
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_BASE) \
stdcs charsets $(CHARSET_STANDARD_OS) \
$(CHARSET_STANDARD_JAVA_TEMPLATES) $(CHARSET_EXTSRC_DIR) \
$(CHARSET_COPYRIGHT_HEADER) \
- $(LOG_INFO)
+ $(LOG_DEBUG)
$(TOUCH) '$@'
GENSRC_JAVA_BASE += $(CHARSET_DONE_BASE)-stdcs
-
--- a/jdk/make/gensrc/GensrcExceptions.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/gensrc/GensrcExceptions.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -32,21 +32,12 @@
GENSRC_EXCEPTIONS_SRC_DIRS := . charset channels
-###
-
-$(GENSRC_EXCEPTIONS_DST)/_the.exceptions.dir:
- $(ECHO) "Generating exceptions classes"
- $(MKDIR) -p $(@D)
- $(TOUCH) $@
-
-
-###
-
$(GENSRC_EXCEPTIONS_DST)/_the.%.marker: $(GENSRC_EXCEPTIONS_SRC)/%/exceptions \
- $(GENSRC_EXCEPTIONS_CMD) \
- $(GENSRC_EXCEPTIONS_DST)/_the.exceptions.dir
- $(MKDIR) -p $(@D)/$*
- SCRIPTS="$(JDK_TOPDIR)/make/scripts" NAWK="$(NAWK)" SH="$(SH)" $(SH) $(GENSRC_EXCEPTIONS_CMD) $< $(@D)/$* $(LOG_INFO)
+ $(GENSRC_EXCEPTIONS_CMD)
+ $(call LogInfo, Generating exceptions java.nio $*)
+ $(call MakeDir, $(@D)/$*)
+ SCRIPTS="$(JDK_TOPDIR)/make/scripts" NAWK="$(NAWK)" SH="$(SH)" $(SH) \
+ $(GENSRC_EXCEPTIONS_CMD) $< $(@D)/$* $(LOG_DEBUG)
$(TOUCH) $@
GENSRC_EXCEPTIONS += $(foreach D,$(GENSRC_EXCEPTIONS_SRC_DIRS),$(GENSRC_EXCEPTIONS_DST)/_the.$(D).marker)
--- a/jdk/make/gensrc/GensrcIcons.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/gensrc/GensrcIcons.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -65,8 +65,8 @@
################################################################################
$(GENSRC_AWT_ICONS_TMP)/_the.icons.dir:
- $(ECHO) Generating icon classes
- $(MKDIR) -p $(GENSRC_AWT_ICONS_DST)
+ $(call LogInfo, Generating icon classes)
+ $(call MakeDir, $(GENSRC_AWT_ICONS_DST))
$(TOUCH) $@
################################################################################
@@ -121,8 +121,9 @@
endif
$(GENSRC_OSX_ICONS): $(GENSRC_OSX_ICONS_SRC) $(BUILD_TOOLS_JDK)
+ $(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
+ $(call MakeDir, $(@D))
$(RM) $@ $@.tmp
- $(MKDIR) -p $(dir $@)
$(ECHO) "static unsigned char sAWTIconData[] = { " >> $@.tmp
$(CAT) $< | $(TOOL_OSX_TOBIN) >> $@.tmp
$(ECHO) "};" >> $@.tmp
--- a/jdk/make/gensrc/GensrcLocaleData.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/gensrc/GensrcLocaleData.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -28,8 +28,9 @@
# into LocaleDataMetaInfo.java
# First go look for all locale files
-LOCALE_FILES := $(shell $(FIND) $(JDK_TOPDIR)/src/java.base/share/classes \
- $(JDK_TOPDIR)/src/jdk.localedata/share/classes \
+LOCALE_FILES := $(shell $(FIND) \
+ $(JDK_TOPDIR)/src/$(MODULE)/share/classes/sun/text/resources \
+ $(JDK_TOPDIR)/src/$(MODULE)/share/classes/sun/util/resources \
-name "FormatData_*.java" -o -name "FormatData_*.properties" -o \
-name "CollationData_*.java" -o -name "CollationData_*.properties" -o \
-name "TimeZoneNames_*.java" -o -name "TimeZoneNames_*.properties" -o \
@@ -42,17 +43,21 @@
LOCALE_RESOURCES := $(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES)))))
# Include the list of resources found during the previous compile.
--include $(SUPPORT_OUTPUTDIR)/gensrc/_the.locale_resources
+-include $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.locale_resources
MISSING_RESOURCES := $(filter-out $(LOCALE_RESOURCES), $(PREV_LOCALE_RESOURCES))
NEW_RESOURCES := $(filter-out $(PREV_LOCALE_RESOURCES), $(LOCALE_RESOURCES))
ifneq (, $(MISSING_RESOURCES)$(NEW_RESOURCES))
# There is a difference in the number of supported resources. Trigger a regeneration.
- $(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMetaInfo.java \
- $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java \
- $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/cldr/CLDRBaseLocaleDataMetaInfo.java \
- $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo_jdk_localedata.java)
+ ifeq ($(MODULE), java.base)
+ $(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMetaInfo.java \
+ $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/cldr/CLDRBaseLocaleDataMetaInfo.java)
+ endif
+ ifeq ($(MODULE), jdk.localedata)
+ $(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java \
+ $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo_jdk_localedata.java)
+ endif
endif
# The base locales
@@ -121,18 +126,18 @@
$(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMetaInfo.java: \
$(JDK_TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
+ $(call LogInfo, Creating sun/util/locale/provider/BaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources)
$(MKDIR) -p $(@D)
- $(ECHO) Creating sun/util/locale/provider/BaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources.
$(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \
- > $(SUPPORT_OUTPUTDIR)/gensrc/_the.locale_resources
+ > $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_the.locale_resources
$(SED) $(SED_BASEARGS) $< > $@
$(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java: \
$(JDK_TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
+ $(call LogInfo, Creating sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources)
$(MKDIR) -p $(@D)
- $(ECHO) Creating sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources.
$(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \
- > $(SUPPORT_OUTPUTDIR)/gensrc/_the.locale_resources
+ > $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/_the.locale_resources
$(SED) $(SED_NONBASEARGS) $< > $@
GENSRC_BASELOCALEDATA := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMetaInfo.java
--- a/jdk/make/gensrc/GensrcMisc.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/gensrc/GensrcMisc.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -50,7 +50,7 @@
SOR_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOR_SRC)/$(GENSRC_SOR_SRC_FILE) | \
$(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
-$(eval $(call SetupNativeCompilation,BUILD_GENSRC_SOR_EXE, \
+$(eval $(call SetupNativeCompilation, BUILD_GENSRC_SOR_EXE, \
SRC := $(GENSRC_SOR_SRC), \
INCLUDE_FILES := $(GENSRC_SOR_SRC_FILE), \
TOOLCHAIN := TOOLCHAIN_BUILD, \
@@ -86,7 +86,7 @@
UC_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_UC_SRC)/$(GENSRC_UC_SRC_FILE) | \
$(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
- $(eval $(call SetupNativeCompilation,BUILD_GENSRC_UC_EXE, \
+ $(eval $(call SetupNativeCompilation, BUILD_GENSRC_UC_EXE, \
SRC := $(GENSRC_UC_SRC), \
INCLUDE_FILES := $(GENSRC_UC_SRC_FILE), \
TOOLCHAIN := TOOLCHAIN_BUILD, \
@@ -124,7 +124,7 @@
SOL_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOL_SRC)/$(GENSRC_SOL_SRC_FILE) | \
$(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
- $(eval $(call SetupNativeCompilation,BUILD_GENSRC_SOL_EXE, \
+ $(eval $(call SetupNativeCompilation, BUILD_GENSRC_SOL_EXE, \
SRC := $(GENSRC_SOL_SRC), \
INCLUDE_FILES := $(GENSRC_SOL_SRC_FILE), \
TOOLCHAIN := TOOLCHAIN_BUILD, \
--- a/jdk/make/gensrc/GensrcProperties.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/gensrc/GensrcProperties.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -75,7 +75,7 @@
# Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
# to .../support/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
- # Strip away prefix and suffix, leaving for example only:
+ # Strip away prefix and suffix, leaving for example only:
# "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
$1_JAVAS := $$(patsubst $$($1_MODULE_PATH_ROOT)/%, \
$(SUPPORT_OUTPUTDIR)/gensrc/%, \
--- a/jdk/make/gensrc/GensrcSwing.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/gensrc/GensrcSwing.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -31,12 +31,11 @@
NIMBUS_SKIN_FILE = $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/skin.laf
$(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus: $(NIMBUS_SKIN_FILE) $(BUILD_TOOLS_JDK)
+ $(call LogInfo, Generating Nimbus source files)
$(MKDIR) -p $(@D)
- $(ECHO) "Generating Nimbus source files"
- $(TOOL_GENERATENIMBUS) $(LOG_INFO) \
+ $(TOOL_GENERATENIMBUS) $(LOG_DEBUG) \
-skinFile $(NIMBUS_SKIN_FILE) -buildDir $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop \
-packagePrefix $(NIMBUS_PACKAGE).nimbus -lafName Nimbus
- $(ECHO) $(LOG_INFO) "Finished generating Nimbus source files"
$(TOUCH) $@
GENSRC_SWING_NIMBUS := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus
--- a/jdk/make/gensrc/GensrcX11Wrappers.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/gensrc/GensrcX11Wrappers.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -63,14 +63,14 @@
# Copy only the sizes.* files that are actually needed. WrapperGenerator picks up any it finds from the
# file prefix it is given so those not needed need to be hidden.
$(GENSRC_X11WRAPPERS_TMP)/sizes.%: $(GENSRC_SIZER_DIR)/sizes.%
- $(MKDIR) -p $(@D)
+ $(call MakeDir, $(@D))
$(RM) '$@'
$(SORT) $< > $@
# Run the tool on the offset files copied from the source repository to generate several Java classes
# used in awt.
$(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated.x11: $(GENSRC_X11_SIZES_USED) $(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(GENSRC_X11WRAPPERS_DST)
+ $(call MakeDir, $(GENSRC_X11WRAPPERS_DST))
$(TOOL_WRAPPERGENERATOR) $(GENSRC_X11WRAPPERS_DST) $(GENSRC_SIZER_DIR)/xlibtypes.txt "gen" $(GENSRC_X11WRAPPERS_TMP)/sizes
$(TOUCH) $@
@@ -82,8 +82,8 @@
# Generate the C code for the program that will output the offset file.
$(GENSRC_X11WRAPPERS_TMP)/sizer.%.c: $(GENSRC_SIZER_DIR)/xlibtypes.txt $(BUILD_TOOLS_JDK)
- $(ECHO) "Generating X11 wrapper ($*-bit version)"
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Generating X11 wrapper ($*-bit version))
+ $(call MakeDir, $(@D))
$(TOOL_WRAPPERGENERATOR) $(@D) $(GENSRC_SIZER_DIR)/xlibtypes.txt "sizer" $*
# use -m32/-m64 only if the compiler supports it
@@ -103,7 +103,7 @@
# Compile the C code into an executable.
$(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe: $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c
- $(MKDIR) -p $(@D)
+ $(call MakeDir, $(@D))
(cd $(@D) && $(CC) $(MEMORY_MODEL_FLAG) -o $@ $< \
$(X_CFLAGS) \
$(X_LIBS) \
@@ -114,9 +114,9 @@
# Run the executable create the offset file and check that it is identical
# to the offset file in the source code repository.
$(GENSRC_X11WRAPPERS_TMP)/sizes.%.verification: $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Verifying X11 wrapper sizes)
+ $(call MakeDir, $(@D))
$(GENSRC_X11WRAPPERS_TMP)/sizer.$*.exe | $(SORT) > $@.tmp
- $(ECHO) Verifying $(GENSRC_X11WRAPPERS_TMP)/sizes.$*.verification.tmp to $(GENSRC_X11WRAPPERS_TMP)/sizes.$*
$(DIFF) $(GENSRC_X11WRAPPERS_TMP)/sizes.$*.verification.tmp $(GENSRC_X11WRAPPERS_TMP)/sizes.$*
mv $@.tmp $@
--- a/jdk/make/launcher/Launcher-java.base.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/launcher/Launcher-java.base.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -130,7 +130,6 @@
LDFLAGS := $(LDFLAGS_JDKEXE), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jexec_obj, \
OUTPUT_DIR := $(BUILD_JEXEC_DST_DIR), \
- DEBUG_SYMBOLS := true, \
PROGRAM := jexec))
TARGETS += $(BUILD_JEXEC)
--- a/jdk/make/launcher/Launcher-jdk.accessibility.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/launcher/Launcher-jdk.accessibility.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -45,7 +45,6 @@
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/jdk.accessibility/jabswitch, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/jdk.accessibility, \
PROGRAM := jabswitch, \
- DEBUG_SYMBOLS := true, \
VERSIONINFO_RESOURCE := $(ACCESSBRIDGE_SRC)/AccessBridgeStatusWindow.RC, \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=jabswitch.exe" \
@@ -79,7 +78,6 @@
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/jdk.accessibility/jaccessinspector$1, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/jdk.accessibility, \
PROGRAM := jaccessinspector$1, \
- DEBUG_SYMBOLS := true, \
VERSIONINFO_RESOURCE := $(TOPDIR)/jaccessinspector/jaccessinspectorWindow.rc, \
RC_FLAGS := $$(RC_FLAGS) \
-D "JDK_FNAME=jaccessinspector$1.exe" \
@@ -107,7 +105,6 @@
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/jdk.accessibility/jaccesswalker$1, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/jdk.accessibility, \
PROGRAM := jaccesswalker$1, \
- DEBUG_SYMBOLS := true, \
VERSIONINFO_RESOURCE := $(TOPDIR)/jaccesswalker/jaccesswalkerWindow.rc, \
RC_FLAGS := $$(RC_FLAGS) \
-D "JDK_FNAME=jaccesswalker$1.exe" \
--- a/jdk/make/launcher/Launcher-jdk.pack200.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/launcher/Launcher-jdk.pack200.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -100,7 +100,6 @@
-D "JDK_FNAME=unpack200.exe" \
-D "JDK_INTERNAL_NAME=unpack200" \
-D "JDK_FTYPE=0x1L", \
- DEBUG_SYMBOLS := true, \
MANIFEST := $(JDK_TOPDIR)/src/jdk.pack200/windows/native/unpack200/unpack200_proto.exe.manifest, \
MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
))
--- a/jdk/make/launcher/LauncherCommon.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/launcher/LauncherCommon.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -25,15 +25,6 @@
include NativeCompilation.gmk
-# SetupNativeCompilation now supports debug symbols on macosx for hotspot.
-# Disable it here for the jdk binaries until we decide to enable them.
-ifeq ($(OPENJDK_TARGET_OS), macosx)
- ENABLE_DEBUG_SYMBOLS := false
-endif
-
-# Prepare the find cache.
-$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/java.base/share/native/launcher))
-
ifeq ($(OPENJDK_TARGET_OS), macosx)
ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN)
else
@@ -124,7 +115,7 @@
$1_LDFLAGS += -exported_symbols_list \
$(SUPPORT_OUTPUTDIR)/build-static/exported.symbols
$1_LIBS += \
- $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/java.base -name "*.a") \
+ $$(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/java.base -name "*.a") \
$(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/libdt_socket.a \
$(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/libjdwp.a \
$(SUPPORT_OUTPUTDIR)/native/java.base/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX) \
@@ -174,8 +165,7 @@
endif
$$(eval $$(call SetupNativeCompilation, BUILD_LAUNCHER_$1, \
- SRC := $(LAUNCHER_SRC), \
- INCLUDE_FILES := main.c, \
+ EXTRA_FILES := $(LAUNCHER_SRC)/main.c, \
OPTIMIZATION := $$($1_OPTIMIZATION), \
CFLAGS := $$($1_CFLAGS) \
$(LAUNCHER_CFLAGS) \
@@ -204,7 +194,6 @@
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$1_objs, \
OUTPUT_DIR := $$($1_OUTPUT_DIR), \
PROGRAM := $1, \
- DEBUG_SYMBOLS := true, \
VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \
RC_FLAGS := $$(RC_FLAGS) \
-D "JDK_FNAME=$1$(EXE_SUFFIX)" \
--- a/jdk/make/lib/Awt2dLibraries.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Awt2dLibraries.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -69,7 +69,7 @@
-D "JDK_INTERNAL_NAME=mlib_image" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmlib_image, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBMLIB_IMAGE): $(call FindLib, java.base, java)
@@ -134,7 +134,7 @@
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS := -ljava -ljvm -lc $(BUILD_LIBMLIB_LDLIBS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmlib_image_v, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
$(BUILD_LIBMLIB_IMAGE_V): $(call FindLib, java.base, java)
@@ -279,7 +279,7 @@
-D "JDK_INTERNAL_NAME=awt" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBAWT): $(call FindLib, java.base, java)
@@ -369,7 +369,7 @@
-D "JDK_INTERNAL_NAME=xawt" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_xawt, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
$(BUILD_LIBAWT_XAWT): $(call FindLib, java.base, java)
@@ -433,7 +433,7 @@
-D "JDK_INTERNAL_NAME=lcms" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/liblcms, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
TARGETS += $(BUILD_LIBLCMS)
@@ -509,7 +509,7 @@
-D "JDK_FTYPE=0x2L", \
REORDER := $(BUILD_LIBJAVAJPEG_REORDER), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjavajpeg, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBJAVAJPEG): $(call FindLib, java.base, java)
@@ -578,7 +578,7 @@
LIBS_linux := -lm $(LIBDL), \
LIBS_solaris := -lm $(LIBDL) $(LIBCXX) -lc, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
$(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
@@ -700,7 +700,7 @@
-D "JDK_INTERNAL_NAME=fontmanager" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfontmanager, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
@@ -745,12 +745,13 @@
-D "JDK_INTERNAL_NAME=jawt" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
$(BUILD_LIBJAWT): $(BUILD_LIBAWT)
$(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX): $(BUILD_LIBJAWT)
- $(ECHO) Copying $(@F)
+ $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%, %, $@))
+ $(call MakeDir, $(@D))
$(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX) $@
TARGETS += $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)
@@ -804,7 +805,7 @@
LIBS_solaris := $(X_LIBS) -lXrender, \
LIBS_macosx := -framework Cocoa, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
ifndef BUILD_HEADLESS_ONLY
$(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT)
@@ -926,7 +927,7 @@
-D "JDK_INTERNAL_NAME=splashscreen" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsplashscreen, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBSPLASHSCREEN)
@@ -1002,7 +1003,7 @@
-framework OpenGL \
-framework QuartzCore -ljava, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_lwawt, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBAWT_LWAWT)
@@ -1044,7 +1045,7 @@
-framework JavaRuntimeSupport \
-ljava -ljvm, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxui, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBOSXUI)
--- a/jdk/make/lib/CoreLibraries.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/CoreLibraries.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -25,6 +25,10 @@
WIN_VERIFY_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify/verify.lib
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, jdk, lib/CoreLibraries.gmk))
+
+
##########################################################################################
# libfdlibm is statically linked with libjava below and not delivered into the
# product on its own.
@@ -51,7 +55,7 @@
DISABLED_WARNINGS_microsoft := 4146 4244 4018, \
ARFLAGS := $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
else
@@ -64,7 +68,7 @@
CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \
LDFLAGS := -nostdlib -r -arch x86_64, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
BUILD_LIBFDLIBM := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
$(BUILD_LIBFDLIBM): $(BUILD_LIBFDLIBM_MAC)
@@ -82,7 +86,7 @@
LIBVERIFY_OPTIMIZATION := HIGH
ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
- ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+ ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true)
LIBVERIFY_OPTIMIZATION := LOW
endif
endif
@@ -106,7 +110,7 @@
-D "JDK_FTYPE=0x2L", \
REORDER := $(BUILD_LIBVERIFY_REORDER), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify, \
- DEBUG_SYMBOLS := true))
+))
TARGETS += $(BUILD_LIBVERIFY)
@@ -119,6 +123,9 @@
-I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"'
+# Make it possible to override this variable
+LIBJAVA_MAPFILE ?= $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers
+
ifeq ($(OPENJDK_TARGET_OS), macosx)
BUILD_LIBJAVA_java_props_md.c_CFLAGS := -x objective-c
BUILD_LIBJAVA_java_props_macosx.c_CFLAGS := -x objective-c
@@ -146,7 +153,7 @@
System.c_CFLAGS := $(VERSION_CFLAGS), \
jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \
DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
- MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \
+ MAPFILE := $(LIBJAVA_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_macosx := -L$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/, \
@@ -171,7 +178,7 @@
-D "JDK_FTYPE=0x2L", \
REORDER := $(LIBJAVA_REORDER), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
TARGETS += $(BUILD_LIBJAVA)
@@ -228,8 +235,7 @@
-D "JDK_INTERNAL_NAME=zip" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libzip, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
+))
$(BUILD_LIBZIP): $(BUILD_LIBJAVA)
@@ -273,7 +279,7 @@
-D "JDK_INTERNAL_NAME=jimage" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjimage, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBJIMAGE): $(BUILD_LIBJAVA)
@@ -389,7 +395,7 @@
-D "JDK_INTERNAL_NAME=jli" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
TARGETS += $(BUILD_LIBJLI)
@@ -407,7 +413,7 @@
CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
ARFLAGS := $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBJLI_STATIC)
@@ -426,7 +432,7 @@
CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
LDFLAGS := -nostdlib -r, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
ifeq ($(STATIC_BUILD), true)
TARGETS += $(BUILD_LIBJLI_STATIC)
--- a/jdk/make/lib/Lib-java.base.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-java.base.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -49,7 +49,7 @@
JAVA_BASE_EXPORT_SYMBOL_FILE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/java.base.symbols
$(JAVA_BASE_EXPORT_SYMBOL_FILE): $(JAVA_BASE_EXPORT_SYMBOLS_SRC)
- $(ECHO) $(LOG_INFO) "Generating java.base.symbols file"
+ $(call LogInfo, Generating java.base.symbols file)
$(CAT) $^ > $@
# The individual symbol files is generated when the respective lib is built
--- a/jdk/make/lib/Lib-java.instrument.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-java.instrument.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -84,7 +84,7 @@
-D "JDK_INTERNAL_NAME=instrument" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libinstrument, \
- DEBUG_SYMBOLS := true))
+))
ifneq (, $(findstring $(OPENJDK_TARGET_OS), macosx windows aix))
$(BUILD_LIBINSTRUMENT): $(SUPPORT_OUTPUTDIR)/native/java.base/$(LIBRARY_PREFIX)jli_static$(STATIC_LIBRARY_SUFFIX)
--- a/jdk/make/lib/Lib-java.management.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-java.management.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -40,7 +40,7 @@
LIBMANAGEMENT_OPTIMIZATION := HIGH
ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
- ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+ ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true)
LIBMANAGEMENT_OPTIMIZATION := LOW
endif
endif
@@ -64,7 +64,7 @@
-D "JDK_INTERNAL_NAME=management" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmanagement, \
- DEBUG_SYMBOLS := true))
+))
$(BUILD_LIBMANAGEMENT): $(call FindLib, java.base, java)
--- a/jdk/make/lib/Lib-java.prefs.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-java.prefs.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -55,7 +55,7 @@
-D "JDK_INTERNAL_NAME=prefs" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libprefs, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBPREFS): $(call FindLib, java.base, java)
--- a/jdk/make/lib/Lib-java.security.jgss.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-java.security.jgss.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -46,7 +46,7 @@
LIBS := $(LIBDL), \
LIBS_solaris := -lc, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2gss, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBJ2GSS)
endif
@@ -92,7 +92,7 @@
-D "JDK_INTERNAL_NAME=$(BUILD_LIBKRB5_NAME)" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libkrb5, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBKRB5)
endif
--- a/jdk/make/lib/Lib-java.smartcardio.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-java.smartcardio.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -52,7 +52,7 @@
-D "JDK_INTERNAL_NAME=j2pcsc" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2pcsc, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
TARGETS += $(BUILD_LIBJ2PCSC)
--- a/jdk/make/lib/Lib-jdk.accessibility.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-jdk.accessibility.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -61,7 +61,7 @@
-D "JDK_INTERNAL_NAME=javaaccessbridge$1" \
-D "JDK_FTYPE=0x02L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjavaaccessbridge$1, \
- DEBUG_SYMBOLS := true)
+ )
$$(BUILD_JAVAACCESSBRIDGE$1): $(SUPPORT_OUTPUTDIR)/native/java.desktop/libjawt/jawt.lib
@@ -91,7 +91,7 @@
-D "JDK_INTERNAL_NAME=windowsaccessbridge$1" \
-D "JDK_FTYPE=0x02L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libwindowsaccessbridge$1, \
- DEBUG_SYMBOLS := true)
+ )
TARGETS += $$(BUILD_WINDOWSACCESSBRIDGE$1)
@@ -113,7 +113,7 @@
-D "JDK_INTERNAL_NAME=jabsysinfo" \
-D "JDK_FTYPE=0x02L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/lib/libjabsysinfo, \
- DEBUG_SYMBOLS := true)
+ )
TARGETS += $$(BUILD_ACCESSBRIDGESYSINFO)
--- a/jdk/make/lib/Lib-jdk.attach.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-jdk.attach.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -56,7 +56,7 @@
LIBS_solaris := -ldoor, \
LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib psapi.lib, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libattach, \
- DEBUG_SYMBOLS := true))
+))
$(BUILD_LIBATTACH): $(call FindLib, java.base, java)
--- a/jdk/make/lib/Lib-jdk.crypto.ec.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-jdk.crypto.ec.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -68,7 +68,7 @@
-D "JDK_INTERNAL_NAME=sunec" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsunec, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBSUNEC)
endif
--- a/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -47,7 +47,7 @@
-D "JDK_INTERNAL_NAME=sunmscapi" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsunmscapi, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBSUNMSCAPI)
endif
--- a/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -51,7 +51,7 @@
-D "JDK_INTERNAL_NAME=j2pkcs11" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2pkcs11, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
TARGETS += $(BUILD_LIBJ2PKCS11)
--- a/jdk/make/lib/Lib-jdk.crypto.ucrypto.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-jdk.crypto.ucrypto.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -44,7 +44,7 @@
LIBS := $(LIBDL), \
LIBS_solaris := -lc, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2ucrypto, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
$(BUILD_LIBJ2UCRYPTO): $(BUILD_LIBJAVA)
--- a/jdk/make/lib/Lib-jdk.deploy.osx.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-jdk.deploy.osx.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -57,7 +57,7 @@
-framework SystemConfiguration \
$(JDKLIB_LIBS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosx, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBOSX)
--- a/jdk/make/lib/Lib-jdk.internal.le.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-jdk.internal.le.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -51,7 +51,7 @@
-D "JDK_INTERNAL_NAME=le" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/lible, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBLE)
--- a/jdk/make/lib/Lib-jdk.jdi.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-jdk.jdi.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -55,7 +55,7 @@
-D "JDK_INTERNAL_NAME=dt_shmem" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libdt_shmem, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBDT_SHMEM)
--- a/jdk/make/lib/Lib-jdk.jdwp.agent.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-jdk.jdwp.agent.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -56,7 +56,7 @@
-D "JDK_INTERNAL_NAME=dt_socket" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libdt_socket, \
- DEBUG_SYMBOLS := true))
+))
$(BUILD_LIBDT_SOCKET): $(call FindLib, java.base, java)
@@ -95,7 +95,7 @@
-D "JDK_INTERNAL_NAME=jdwp" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjdwp, \
- DEBUG_SYMBOLS := true))
+))
$(BUILD_LIBJDWP): $(call FindLib, java.base, java)
@@ -111,7 +111,7 @@
JDK_JDWP_AGENT_EXPORT_SYMBOL_FILE := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/jdk.jdwp.agent.symbols
$(JDK_JDWP_AGENT_EXPORT_SYMBOL_FILE): $(JDK_JDWP_AGENT_EXPORT_SYMBOLS_SRC)
- $(ECHO) $(LOG_INFO) "Generating jdk.jdwp.agent symbols file"
+ $(call LogInfo, Generating jdk.jdwp.agent symbols file)
$(CAT) $^ > $@
# The individual symbol files is generated when the respective lib is built
--- a/jdk/make/lib/Lib-jdk.management.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-jdk.management.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -48,7 +48,7 @@
LIBMANAGEMENT_EXT_OPTIMIZATION := HIGH
ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
- ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+ ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true)
LIBMANAGEMENT_EXT_OPTIMIZATION := LOW
endif
endif
@@ -73,7 +73,7 @@
-D "JDK_INTERNAL_NAME=management_ext" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmanagement_ext, \
- DEBUG_SYMBOLS := true))
+))
$(BUILD_LIBMANAGEMENT_EXT): $(call FindLib, java.base, java)
--- a/jdk/make/lib/Lib-jdk.pack200.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-jdk.pack200.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -52,7 +52,7 @@
-D "JDK_FNAME=unpack.dll" \
-D "JDK_INTERNAL_NAME=unpack" \
-D "JDK_FTYPE=0x2L", \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBUNPACK): $(call FindLib, java.base, java)
--- a/jdk/make/lib/Lib-jdk.sctp.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-jdk.sctp.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -53,7 +53,7 @@
LIBS_linux := -lpthread $(LIBDL), \
LIBS_solaris := -lsocket -lc, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsctp, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBSCTP)
--- a/jdk/make/lib/Lib-jdk.security.auth.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/Lib-jdk.security.auth.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -55,7 +55,7 @@
-D "JDK_INTERNAL_NAME=$(LIBJAAS_NAME)" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjaas, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBJAAS): $(call FindLib, java.base, java)
--- a/jdk/make/lib/LibCommon.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/LibCommon.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -23,40 +23,24 @@
# questions.
#
-include $(SPEC)
-include MakeBase.gmk
include NativeCompilation.gmk
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, jdk, lib/LibCommon.gmk))
+
+################################################################################
+
GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
# Absolute paths to lib files on windows for use in LDFLAGS. Should figure out a more
# elegant solution to this.
WIN_JAVA_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib
-ifdef OPENJDK
- # Build everything with debugging on OpenJDK
- DEBUG_ALL_BINARIES := true
-else
- # Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but
- # not on other platforms.
- ifeq ($(OPENJDK_TARGET_OS), windows)
- DEBUG_ALL_BINARIES := true
- else
- DEBUG_ALL_BINARIES := false
- endif
-endif
-
-# SetupNativeCompilation now supports debug symbols on macosx for hotspot.
-# Disable it here for the jdk libraries until we decide to enable them.
-ifeq ($(OPENJDK_TARGET_OS), macosx)
- ENABLE_DEBUG_SYMBOLS := false
-endif
-
################################################################################
# Find the default set of src dirs for a native library.
# Param 1 - module name
# Param 2 - library name
-FindSrcDirsForLib = \
+FindSrcDirsForLib += \
$(call uniq, $(wildcard \
$(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
$(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \
@@ -87,3 +71,5 @@
else
ZLIB_CPPFLAGS := -I$(JDK_TOPDIR)/src/java.base/share/native/libzip/zlib-1.2.8
endif
+
+###############################################################################
--- a/jdk/make/lib/NetworkingLibraries.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/NetworkingLibraries.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -52,7 +52,7 @@
-D "JDK_INTERNAL_NAME=net" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnet, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBNET): $(BUILD_LIBJAVA)
--- a/jdk/make/lib/NioLibraries.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/NioLibraries.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -91,7 +91,7 @@
-D "JDK_INTERNAL_NAME=nio" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnio, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
TARGETS += $(BUILD_LIBNIO)
--- a/jdk/make/lib/PlatformLibraries.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/PlatformLibraries.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -54,7 +54,7 @@
-framework IOSurface \
-framework QuartzCore, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxapp, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBOSXAPP)
--- a/jdk/make/lib/SecurityLibraries.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/SecurityLibraries.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -54,7 +54,7 @@
-framework Security \
$(JDKLIB_LIBS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxsecurity, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
$(BUILD_LIBOSXSECURITY): $(BUILD_LIBJAVA)
--- a/jdk/make/lib/SoundLibraries.gmk Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/lib/SoundLibraries.gmk Thu Jan 21 10:17:21 2016 -0800
@@ -138,7 +138,7 @@
-D "JDK_INTERNAL_NAME=jsound" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsound, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBJSOUND): $(BUILD_LIBJAVA)
@@ -173,7 +173,7 @@
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS := $(ALSA_LIBS) -ljava -ljvm, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsoundalsa, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
$(BUILD_LIBJSOUNDALSA): $(BUILD_LIBJAVA)
@@ -204,7 +204,7 @@
-D "JDK_INTERNAL_NAME=jsoundds" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsoundds, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
$(BUILD_LIBJSOUNDDS): $(BUILD_LIBJAVA)
--- a/jdk/make/src/classes/build/tools/spp/Spp.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/src/classes/build/tools/spp/Spp.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, 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
@@ -32,9 +32,10 @@
* Spp: A simple regex-based stream preprocessor based on Mark Reinhold's
* sed-based spp.sh
*
- * Usage: java build.tools.spp.Spp [-be] [-Kkey] -Dvar=value ... <in >out
+ * Usage: java build.tools.spp.Spp [-be] [-nel] [-Kkey] -Dvar=value ... <in >out
*
- * Source-file constructs
+ * If -nel is declared then empty lines will not be substituted for lines of
+ * text in the template that do not appear in the output.
*
* Meaningful only at beginning of line, works with any number of keys:
*
@@ -64,9 +65,10 @@
public class Spp {
public static void main(String args[]) throws Exception {
- Map<String, String> vars = new HashMap<String, String>();
- Set<String> keys = new HashSet<String>();
+ Map<String, String> vars = new HashMap<>();
+ Set<String> keys = new HashSet<>();
boolean be = false;
+ boolean el = true;
for (String arg:args) {
if (arg.startsWith("-D")) {
@@ -76,8 +78,10 @@
keys.add(arg.substring(2));
} else if ("-be".equals(arg)) {
be = true;
+ } else if ("-nel".equals(arg)) {
+ el = false;
} else {
- System.err.println("Usage: java build.tools.spp.Spp [-be] [-Kkey] -Dvar=value ... <in >out");
+ System.err.println("Usage: java build.tools.spp.Spp [-be] [-nel] [-Kkey] -Dvar=value ... <in >out");
System.exit(-1);
}
}
@@ -85,7 +89,7 @@
StringBuffer out = new StringBuffer();
new Spp().spp(new Scanner(System.in),
out, "",
- keys, vars, be,
+ keys, vars, be, el,
false);
System.out.print(out.toString());
}
@@ -93,7 +97,7 @@
static final String LNSEP = System.getProperty("line.separator");
static final String KEY = "([a-zA-Z0-9]+)";
static final String VAR = "([a-zA-Z0-9_\\-]+)";
- static final String TEXT = "([a-zA-Z0-9&;,.<>/#() \\$]+)"; // $ -- hack embedded $var$
+ static final String TEXT = "([a-zA-Z0-9&;,.<>/#() \\?\\[\\]\\$]+)"; // $ -- hack embedded $var$
static final int GN_NOT = 1;
static final int GN_KEY = 2;
@@ -101,11 +105,11 @@
static final int GN_NO = 5;
static final int GN_VAR = 6;
- Matcher ifkey = Pattern.compile("^#if\\[(!)?" + KEY + "\\]").matcher("");
- Matcher elsekey = Pattern.compile("^#else\\[(!)?" + KEY + "\\]").matcher("");
- Matcher endkey = Pattern.compile("^#end\\[(!)?" + KEY + "\\]").matcher("");
- Matcher vardef = Pattern.compile("\\{#if\\[(!)?" + KEY + "\\]\\?" + TEXT + "(:"+ TEXT + ")?\\}|\\$" + VAR + "\\$").matcher("");
- Matcher vardef2 = Pattern.compile("\\$" + VAR + "\\$").matcher("");
+ final Matcher ifkey = Pattern.compile("^#if\\[(!)?" + KEY + "\\]").matcher("");
+ final Matcher elsekey = Pattern.compile("^#else\\[(!)?" + KEY + "\\]").matcher("");
+ final Matcher endkey = Pattern.compile("^#end\\[(!)?" + KEY + "\\]").matcher("");
+ final Matcher vardef = Pattern.compile("\\{#if\\[(!)?" + KEY + "\\]\\?" + TEXT + "(:"+ TEXT + ")?\\}|\\$" + VAR + "\\$").matcher("");
+ final Matcher vardef2 = Pattern.compile("\\$" + VAR + "\\$").matcher("");
void append(StringBuffer buf, String ln,
Set<String> keys, Map<String, String> vars) {
@@ -135,7 +139,7 @@
// return true if #end[key], #end or EOF reached
boolean spp(Scanner in, StringBuffer buf, String key,
Set<String> keys, Map<String, String> vars,
- boolean be, boolean skip) {
+ boolean be, boolean el, boolean skip) {
while (in.hasNextLine()) {
String ln = in.nextLine();
if (be) {
@@ -154,9 +158,9 @@
boolean test = keys.contains(k);
if (ifkey.group(GN_NOT) != null)
test = !test;
- buf.append(LNSEP);
- if (!spp(in, buf, k, keys, vars, be, skip || !test)) {
- spp(in, buf, k, keys, vars, be, skip || test);
+ if (el) buf.append(LNSEP);
+ if (!spp(in, buf, k, keys, vars, be, el, skip || !test)) {
+ spp(in, buf, k, keys, vars, be, el, skip || test);
}
continue;
}
@@ -164,14 +168,14 @@
if (!key.equals(elsekey.group(GN_KEY))) {
throw new Error("Mis-matched #if-else-end at line <" + ln + ">");
}
- buf.append(LNSEP);
+ if (el) buf.append(LNSEP);
return false;
}
if (endkey.reset(ln).find()) {
if (!key.equals(endkey.group(GN_KEY))) {
throw new Error("Mis-matched #if-else-end at line <" + ln + ">");
}
- buf.append(LNSEP);
+ if (el) buf.append(LNSEP);
return true;
}
if (ln.startsWith("#warn")) {
@@ -181,8 +185,9 @@
}
if (!skip) {
append(buf, ln, keys, vars);
+ if (!el) buf.append(LNSEP);
}
- buf.append(LNSEP);
+ if (el) buf.append(LNSEP);
}
return true;
}
--- a/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java Thu Jan 21 10:17:21 2016 -0800
@@ -60,7 +60,7 @@
* @author Stephen Colebourne
* @author Michael Nascimento Santos
*
- * @since 1.9
+ * @since 9
*/
class TzdbZoneRulesProvider {
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java Thu Jan 21 10:17:21 2016 -0800
@@ -26,7 +26,9 @@
package com.sun.crypto.provider;
import java.security.InvalidKeyException;
+import java.util.Objects;
+import jdk.internal.HotSpotIntrinsicCandidate;
/**
* This class represents ciphers in counter (CTR) mode.
@@ -138,7 +140,7 @@
* <code>cipherOffset</code>.
*
* @param in the buffer with the input data to be encrypted
- * @param inOffset the offset in <code>plain</code>
+ * @param inOff the offset in <code>plain</code>
* @param len the length of the input data
* @param out the buffer for the result
* @param outOff the offset in <code>cipher</code>
@@ -170,6 +172,15 @@
* are encrypted on demand.
*/
private int crypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
+
+ cryptBlockCheck(in, inOff, len);
+ cryptBlockCheck(out, outOff, len);
+ return implCrypt(in, inOff, len, out, outOff);
+ }
+
+ // Implementation of crpyt() method. Possibly replaced with a compiler intrinsic.
+ @HotSpotIntrinsicCandidate
+ private int implCrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
int result = len;
while (len-- > 0) {
if (used >= blockSize) {
@@ -181,4 +192,23 @@
}
return result;
}
+
+ // Used to perform all checks required by the Java semantics
+ // (i.e., null checks and bounds checks) on the input parameters to crypt().
+ // Normally, the Java Runtime performs these checks, however, as crypt() is
+ // possibly replaced with compiler intrinsic, the JDK performs the
+ // required checks instead.
+ // Does not check accesses to class-internal (private) arrays.
+ private static void cryptBlockCheck(byte[] array, int offset, int len) {
+ Objects.requireNonNull(array);
+
+ if (offset < 0 || len < 0 || offset >= array.length) {
+ throw new ArrayIndexOutOfBoundsException(offset);
+ }
+
+ int largestIndex = offset + len - 1;
+ if (largestIndex < 0 || largestIndex >= array.length) {
+ throw new ArrayIndexOutOfBoundsException(largestIndex);
+ }
+ }
}
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBES2Core.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBES2Core.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -263,7 +263,7 @@
passwdChars[i] = (char) (passwdBytes[i] & 0x7f);
PBEKeySpec pbeSpec =
- new PBEKeySpec(passwdChars, salt, iCount, blkSize * 8);
+ new PBEKeySpec(passwdChars, salt, iCount, keyLength);
// password char[] was cloned in PBEKeySpec constructor,
// so we can zero it out here
java.util.Arrays.fill(passwdChars, ' ');
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java Thu Jan 21 10:17:21 2016 -0800
@@ -76,11 +76,14 @@
"TlsRsaPremasterSecretGenerator must be initialized");
}
- if (random == null) {
- random = new SecureRandom();
+ byte[] b = spec.getEncodedSecret();
+ if (b == null) {
+ if (random == null) {
+ random = new SecureRandom();
+ }
+ b = new byte[48];
+ random.nextBytes(b);
}
- byte[] b = new byte[48];
- random.nextBytes(b);
b[0] = (byte)spec.getMajorVersion();
b[1] = (byte)spec.getMinorVersion();
--- a/jdk/src/java.base/share/classes/java/io/InputStream.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/io/InputStream.java Thu Jan 21 10:17:21 2016 -0800
@@ -228,7 +228,7 @@
* allocated. For example, if an array larger than {@code 2GB} would
* be required to store the bytes.
*
- * @since 1.9
+ * @since 9
*/
public byte[] readAllBytes() throws IOException {
byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
@@ -298,7 +298,7 @@
* @throws IndexOutOfBoundsException If {@code off} is negative, {@code len}
* is negative, or {@code len} is greater than {@code b.length - off}
*
- * @since 1.9
+ * @since 9
*/
public int readNBytes(byte[] b, int off, int len) throws IOException {
Objects.requireNonNull(b);
@@ -514,7 +514,7 @@
* @throws IOException if an I/O error occurs when reading or writing
* @throws NullPointerException if {@code out} is {@code null}
*
- * @since 1.9
+ * @since 9
*/
public long transferTo(OutputStream out) throws IOException {
Objects.requireNonNull(out, "out");
--- a/jdk/src/java.base/share/classes/java/lang/AbstractStringBuilder.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/AbstractStringBuilder.java Thu Jan 21 10:17:21 2016 -0800
@@ -1526,7 +1526,7 @@
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public IntStream chars() {
@@ -1543,7 +1543,7 @@
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public IntStream codePoints() {
--- a/jdk/src/java.base/share/classes/java/lang/Character.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Character.java Thu Jan 21 10:17:21 2016 -0800
@@ -493,25 +493,25 @@
/**
* Weak bidirectional character type "LRI" in the Unicode specification.
- * @since 1.9
+ * @since 9
*/
public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_ISOLATE = 19;
/**
* Weak bidirectional character type "RLI" in the Unicode specification.
- * @since 1.9
+ * @since 9
*/
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ISOLATE = 20;
/**
* Weak bidirectional character type "FSI" in the Unicode specification.
- * @since 1.9
+ * @since 9
*/
public static final byte DIRECTIONALITY_FIRST_STRONG_ISOLATE = 21;
/**
* Weak bidirectional character type "PDI" in the Unicode specification.
- * @since 1.9
+ * @since 9
*/
public static final byte DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE = 22;
@@ -2590,7 +2590,7 @@
/**
* Constant for the "Combining Diacritical Marks Extended" Unicode
* character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock COMBINING_DIACRITICAL_MARKS_EXTENDED =
new UnicodeBlock("COMBINING_DIACRITICAL_MARKS_EXTENDED",
@@ -2599,7 +2599,7 @@
/**
* Constant for the "Myanmar Extended-B" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock MYANMAR_EXTENDED_B =
new UnicodeBlock("MYANMAR_EXTENDED_B",
@@ -2608,7 +2608,7 @@
/**
* Constant for the "Latin Extended-E" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock LATIN_EXTENDED_E =
new UnicodeBlock("LATIN_EXTENDED_E",
@@ -2617,7 +2617,7 @@
/**
* Constant for the "Coptic Epact Numbers" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock COPTIC_EPACT_NUMBERS =
new UnicodeBlock("COPTIC_EPACT_NUMBERS",
@@ -2626,7 +2626,7 @@
/**
* Constant for the "Old Permic" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock OLD_PERMIC =
new UnicodeBlock("OLD_PERMIC",
@@ -2635,14 +2635,14 @@
/**
* Constant for the "Elbasan" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock ELBASAN =
new UnicodeBlock("ELBASAN");
/**
* Constant for the "Caucasian Albanian" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock CAUCASIAN_ALBANIAN =
new UnicodeBlock("CAUCASIAN_ALBANIAN",
@@ -2651,7 +2651,7 @@
/**
* Constant for the "Linear A" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock LINEAR_A =
new UnicodeBlock("LINEAR_A",
@@ -2660,21 +2660,21 @@
/**
* Constant for the "Palmyrene" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock PALMYRENE =
new UnicodeBlock("PALMYRENE");
/**
* Constant for the "Nabataean" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock NABATAEAN =
new UnicodeBlock("NABATAEAN");
/**
* Constant for the "Old North Arabian" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock OLD_NORTH_ARABIAN =
new UnicodeBlock("OLD_NORTH_ARABIAN",
@@ -2683,14 +2683,14 @@
/**
* Constant for the "Manichaean" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock MANICHAEAN =
new UnicodeBlock("MANICHAEAN");
/**
* Constant for the "Psalter Pahlavi" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock PSALTER_PAHLAVI =
new UnicodeBlock("PSALTER_PAHLAVI",
@@ -2699,14 +2699,14 @@
/**
* Constant for the "Mahajani" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock MAHAJANI =
new UnicodeBlock("MAHAJANI");
/**
* Constant for the "Sinhala Archaic Numbers" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock SINHALA_ARCHAIC_NUMBERS =
new UnicodeBlock("SINHALA_ARCHAIC_NUMBERS",
@@ -2715,49 +2715,49 @@
/**
* Constant for the "Khojki" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock KHOJKI =
new UnicodeBlock("KHOJKI");
/**
* Constant for the "Khudawadi" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock KHUDAWADI =
new UnicodeBlock("KHUDAWADI");
/**
* Constant for the "Grantha" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock GRANTHA =
new UnicodeBlock("GRANTHA");
/**
* Constant for the "Tirhuta" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock TIRHUTA =
new UnicodeBlock("TIRHUTA");
/**
* Constant for the "Siddham" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock SIDDHAM =
new UnicodeBlock("SIDDHAM");
/**
* Constant for the "Modi" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock MODI =
new UnicodeBlock("MODI");
/**
* Constant for the "Warang Citi" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock WARANG_CITI =
new UnicodeBlock("WARANG_CITI",
@@ -2766,7 +2766,7 @@
/**
* Constant for the "Pau Cin Hau" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock PAU_CIN_HAU =
new UnicodeBlock("PAU_CIN_HAU",
@@ -2775,14 +2775,14 @@
/**
* Constant for the "Mro" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock MRO =
new UnicodeBlock("MRO");
/**
* Constant for the "Bassa Vah" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock BASSA_VAH =
new UnicodeBlock("BASSA_VAH",
@@ -2791,7 +2791,7 @@
/**
* Constant for the "Pahawh Hmong" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock PAHAWH_HMONG =
new UnicodeBlock("PAHAWH_HMONG",
@@ -2800,14 +2800,14 @@
/**
* Constant for the "Duployan" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock DUPLOYAN =
new UnicodeBlock("DUPLOYAN");
/**
* Constant for the "Shorthand Format Controls" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock SHORTHAND_FORMAT_CONTROLS =
new UnicodeBlock("SHORTHAND_FORMAT_CONTROLS",
@@ -2816,7 +2816,7 @@
/**
* Constant for the "Mende Kikakui" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock MENDE_KIKAKUI =
new UnicodeBlock("MENDE_KIKAKUI",
@@ -2825,7 +2825,7 @@
/**
* Constant for the "Ornamental Dingbats" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock ORNAMENTAL_DINGBATS =
new UnicodeBlock("ORNAMENTAL_DINGBATS",
@@ -2834,7 +2834,7 @@
/**
* Constant for the "Geometric Shapes Extended" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock GEOMETRIC_SHAPES_EXTENDED =
new UnicodeBlock("GEOMETRIC_SHAPES_EXTENDED",
@@ -2843,7 +2843,7 @@
/**
* Constant for the "Supplemental Arrows-C" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock SUPPLEMENTAL_ARROWS_C =
new UnicodeBlock("SUPPLEMENTAL_ARROWS_C",
@@ -2852,7 +2852,7 @@
/**
* Constant for the "Cherokee Supplement" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock CHEROKEE_SUPPLEMENT =
new UnicodeBlock("CHEROKEE_SUPPLEMENT",
@@ -2861,14 +2861,14 @@
/**
* Constant for the "Hatran" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock HATRAN =
new UnicodeBlock("HATRAN");
/**
* Constant for the "Old Hungarian" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock OLD_HUNGARIAN =
new UnicodeBlock("OLD_HUNGARIAN",
@@ -2877,21 +2877,21 @@
/**
* Constant for the "Multani" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock MULTANI =
new UnicodeBlock("MULTANI");
/**
* Constant for the "Ahom" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock AHOM =
new UnicodeBlock("AHOM");
/**
* Constant for the "Early Dynastic Cuneiform" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock EARLY_DYNASTIC_CUNEIFORM =
new UnicodeBlock("EARLY_DYNASTIC_CUNEIFORM",
@@ -2900,7 +2900,7 @@
/**
* Constant for the "Anatolian Hieroglyphs" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock ANATOLIAN_HIEROGLYPHS =
new UnicodeBlock("ANATOLIAN_HIEROGLYPHS",
@@ -2909,7 +2909,7 @@
/**
* Constant for the "Sutton SignWriting" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock SUTTON_SIGNWRITING =
new UnicodeBlock("SUTTON_SIGNWRITING",
@@ -2919,7 +2919,7 @@
/**
* Constant for the "Supplemental Symbols and Pictographs" Unicode
* character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock SUPPLEMENTAL_SYMBOLS_AND_PICTOGRAPHS =
new UnicodeBlock("SUPPLEMENTAL_SYMBOLS_AND_PICTOGRAPHS",
@@ -2929,7 +2929,7 @@
/**
* Constant for the "CJK Unified Ideographs Extension E" Unicode
* character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_E =
new UnicodeBlock("CJK_UNIFIED_IDEOGRAPHS_EXTENSION_E",
@@ -4189,175 +4189,175 @@
/**
* Unicode script "Caucasian Albanian".
- * @since 1.9
+ * @since 9
*/
CAUCASIAN_ALBANIAN,
/**
* Unicode script "Bassa Vah".
- * @since 1.9
+ * @since 9
*/
BASSA_VAH,
/**
* Unicode script "Duployan".
- * @since 1.9
+ * @since 9
*/
DUPLOYAN,
/**
* Unicode script "Elbasan".
- * @since 1.9
+ * @since 9
*/
ELBASAN,
/**
* Unicode script "Grantha".
- * @since 1.9
+ * @since 9
*/
GRANTHA,
/**
* Unicode script "Pahawh Hmong".
- * @since 1.9
+ * @since 9
*/
PAHAWH_HMONG,
/**
* Unicode script "Khojki".
- * @since 1.9
+ * @since 9
*/
KHOJKI,
/**
* Unicode script "Linear A".
- * @since 1.9
+ * @since 9
*/
LINEAR_A,
/**
* Unicode script "Mahajani".
- * @since 1.9
+ * @since 9
*/
MAHAJANI,
/**
* Unicode script "Manichaean".
- * @since 1.9
+ * @since 9
*/
MANICHAEAN,
/**
* Unicode script "Mende Kikakui".
- * @since 1.9
+ * @since 9
*/
MENDE_KIKAKUI,
/**
* Unicode script "Modi".
- * @since 1.9
+ * @since 9
*/
MODI,
/**
* Unicode script "Mro".
- * @since 1.9
+ * @since 9
*/
MRO,
/**
* Unicode script "Old North Arabian".
- * @since 1.9
+ * @since 9
*/
OLD_NORTH_ARABIAN,
/**
* Unicode script "Nabataean".
- * @since 1.9
+ * @since 9
*/
NABATAEAN,
/**
* Unicode script "Palmyrene".
- * @since 1.9
+ * @since 9
*/
PALMYRENE,
/**
* Unicode script "Pau Cin Hau".
- * @since 1.9
+ * @since 9
*/
PAU_CIN_HAU,
/**
* Unicode script "Old Permic".
- * @since 1.9
+ * @since 9
*/
OLD_PERMIC,
/**
* Unicode script "Psalter Pahlavi".
- * @since 1.9
+ * @since 9
*/
PSALTER_PAHLAVI,
/**
* Unicode script "Siddham".
- * @since 1.9
+ * @since 9
*/
SIDDHAM,
/**
* Unicode script "Khudawadi".
- * @since 1.9
+ * @since 9
*/
KHUDAWADI,
/**
* Unicode script "Tirhuta".
- * @since 1.9
+ * @since 9
*/
TIRHUTA,
/**
* Unicode script "Warang Citi".
- * @since 1.9
+ * @since 9
*/
WARANG_CITI,
/**
* Unicode script "Ahom".
- * @since 1.9
+ * @since 9
*/
AHOM,
/**
* Unicode script "Anatolian Hieroglyphs".
- * @since 1.9
+ * @since 9
*/
ANATOLIAN_HIEROGLYPHS,
/**
* Unicode script "Hatran".
- * @since 1.9
+ * @since 9
*/
HATRAN,
/**
* Unicode script "Multani".
- * @since 1.9
+ * @since 9
*/
MULTANI,
/**
* Unicode script "Old Hungarian".
- * @since 1.9
+ * @since 9
*/
OLD_HUNGARIAN,
/**
* Unicode script "SignWriting".
- * @since 1.9
+ * @since 9
*/
SIGNWRITING,
--- a/jdk/src/java.base/share/classes/java/lang/Integer.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Integer.java Thu Jan 21 10:17:21 2016 -0800
@@ -716,7 +716,7 @@
* {@code radix}, or if {@code radix} is either smaller than
* {@link java.lang.Character#MIN_RADIX} or larger than
* {@link java.lang.Character#MAX_RADIX}.
- * @since 1.9
+ * @since 9
*/
public static int parseInt(CharSequence s, int beginIndex, int endIndex, int radix)
throws NumberFormatException {
@@ -899,7 +899,7 @@
* {@code radix}, or if {@code radix} is either smaller than
* {@link java.lang.Character#MIN_RADIX} or larger than
* {@link java.lang.Character#MAX_RADIX}.
- * @since 1.9
+ * @since 9
*/
public static int parseUnsignedInt(CharSequence s, int beginIndex, int endIndex, int radix)
throws NumberFormatException {
--- a/jdk/src/java.base/share/classes/java/lang/Long.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Long.java Thu Jan 21 10:17:21 2016 -0800
@@ -747,7 +747,7 @@
* {@code radix}, or if {@code radix} is either smaller than
* {@link java.lang.Character#MIN_RADIX} or larger than
* {@link java.lang.Character#MAX_RADIX}.
- * @since 1.9
+ * @since 9
*/
public static long parseLong(CharSequence s, int beginIndex, int endIndex, int radix)
throws NumberFormatException {
@@ -993,7 +993,7 @@
* {@code radix}, or if {@code radix} is either smaller than
* {@link java.lang.Character#MIN_RADIX} or larger than
* {@link java.lang.Character#MAX_RADIX}.
- * @since 1.9
+ * @since 9
*/
public static long parseUnsignedLong(CharSequence s, int beginIndex, int endIndex, int radix)
throws NumberFormatException {
--- a/jdk/src/java.base/share/classes/java/lang/Process.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Process.java Thu Jan 21 10:17:21 2016 -0800
@@ -304,7 +304,7 @@
* otherwise, {@link #destroy} forcibly terminates the process
* @throws UnsupportedOperationException if the Process implementation
* does not support this operation
- * @since 1.9
+ * @since 9
*/
public boolean supportsNormalTermination() {
throw new UnsupportedOperationException(this.getClass()
@@ -340,7 +340,7 @@
* @return the native process id of the process
* @throws UnsupportedOperationException if the Process implementation
* does not support this operation
- * @since 1.9
+ * @since 9
*/
public long getPid() {
return toHandle().getPid();
@@ -409,7 +409,7 @@
*
* @return a new {@code CompletableFuture<Process>} for the Process
*
- * @since 1.9
+ * @since 9
*/
public CompletableFuture<Process> onExit() {
return CompletableFuture.supplyAsync(this::waitForInternal);
@@ -471,7 +471,7 @@
* does not support this operation
* @throws SecurityException if a security manager has been installed and
* it denies RuntimePermission("manageProcess")
- * @since 1.9
+ * @since 9
*/
public ProcessHandle toHandle() {
throw new UnsupportedOperationException(this.getClass()
@@ -491,7 +491,7 @@
* @return a snapshot of information about the process, always non-null
* @throws UnsupportedOperationException if the Process implementation
* does not support this operation
- * @since 1.9
+ * @since 9
*/
public ProcessHandle.Info info() {
return toHandle().info();
@@ -516,7 +516,7 @@
* does not support this operation
* @throws SecurityException if a security manager has been installed and
* it denies RuntimePermission("manageProcess")
- * @since 1.9
+ * @since 9
*/
public Stream<ProcessHandle> children() {
return toHandle().children();
@@ -542,7 +542,7 @@
* does not support this operation
* @throws SecurityException if a security manager has been installed and
* it denies RuntimePermission("manageProcess")
- * @since 1.9
+ * @since 9
*/
public Stream<ProcessHandle> descendants() {
return toHandle().descendants();
--- a/jdk/src/java.base/share/classes/java/lang/ProcessHandle.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessHandle.java Thu Jan 21 10:17:21 2016 -0800
@@ -89,7 +89,7 @@
* {@link #compareTo(ProcessHandle) compareTo} methods to compare ProcessHandles.
*
* @see Process
- * @since 1.9
+ * @since 9
*/
public interface ProcessHandle extends Comparable<ProcessHandle> {
@@ -215,7 +215,7 @@
* by the operating system privileges of the process making the request.
* The return types are {@code Optional<T>} allowing explicit tests
* and actions if the value is available.
- * @since 1.9
+ * @since 9
*/
public interface Info {
/**
--- a/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java Thu Jan 21 10:17:21 2016 -0800
@@ -50,7 +50,7 @@
* ProcessHandleImpl is the implementation of ProcessHandle.
*
* @see Process
- * @since 1.9
+ * @since 9
*/
final class ProcessHandleImpl implements ProcessHandle {
/**
@@ -338,7 +338,7 @@
*
* @return {@code true} if the process represented by this
* {@code ProcessHandle} object has not yet terminated.
- * @since 1.9
+ * @since 9
*/
@Override
public boolean isAlive() {
--- a/jdk/src/java.base/share/classes/java/lang/StackWalker.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/StackWalker.java Thu Jan 21 10:17:21 2016 -0800
@@ -81,7 +81,7 @@
* will cause a {@link NullPointerException NullPointerException}
* to be thrown.
*
- * @since 1.9
+ * @since 9
*/
public final class StackWalker {
/**
@@ -92,7 +92,7 @@
* by the {@linkplain Option stack walking options} of a {@linkplain
* StackWalker stack walker}.
*
- * @since 1.9
+ * @since 9
* @jvms 2.6
*/
public static interface StackFrame {
@@ -185,7 +185,7 @@
* Stack walker option to configure the {@linkplain StackFrame stack frame}
* information obtained by a {@code StackWalker}.
*
- * @since 1.9
+ * @since 9
*/
public enum Option {
/**
--- a/jdk/src/java.base/share/classes/java/lang/String.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/String.java Thu Jan 21 10:17:21 2016 -0800
@@ -2674,7 +2674,7 @@
* point</a> is passed through uninterpreted.
*
* @return an IntStream of char values from this sequence
- * @since 1.9
+ * @since 9
*/
@Override
public IntStream chars() {
@@ -2694,7 +2694,7 @@
* {@code int} values which are then passed to the stream.
*
* @return an IntStream of Unicode code points from this sequence
- * @since 1.9
+ * @since 9
*/
@Override
public IntStream codePoints() {
--- a/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java Thu Jan 21 10:17:21 2016 -0800
@@ -25,25 +25,25 @@
package java.lang.invoke;
-import static jdk.internal.org.objectweb.asm.Opcodes.*;
-import static java.lang.invoke.LambdaForm.*;
-import static java.lang.invoke.LambdaForm.BasicType.*;
-import static java.lang.invoke.MethodHandleStatics.*;
+import jdk.internal.vm.annotation.Stable;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.FieldVisitor;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import sun.invoke.util.ValueConversions;
+import sun.invoke.util.Wrapper;
import java.lang.invoke.LambdaForm.NamedFunction;
import java.lang.invoke.MethodHandles.Lookup;
import java.lang.reflect.Field;
import java.util.Arrays;
-import java.util.function.Function;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Function;
-import jdk.internal.org.objectweb.asm.FieldVisitor;
-import sun.invoke.util.ValueConversions;
-import sun.invoke.util.Wrapper;
-
-import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.internal.org.objectweb.asm.MethodVisitor;
+import static java.lang.invoke.LambdaForm.BasicType;
+import static java.lang.invoke.LambdaForm.BasicType.*;
+import static java.lang.invoke.MethodHandleStatics.*;
+import static jdk.internal.org.objectweb.asm.Opcodes.*;
/**
* The flavor of method handle which emulates an invoke instruction
@@ -459,7 +459,7 @@
static final String BMH_SIG = "L"+BMH+";";
static final String SPECIES_DATA = "java/lang/invoke/BoundMethodHandle$SpeciesData";
static final String SPECIES_DATA_SIG = "L"+SPECIES_DATA+";";
- static final String STABLE_SIG = "Ljava/lang/invoke/Stable;";
+ static final String STABLE_SIG = "Ljdk/internal/vm/annotation/Stable;";
static final String SPECIES_PREFIX_NAME = "Species_";
static final String SPECIES_PREFIX_PATH = BMH + "$" + SPECIES_PREFIX_NAME;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java Thu Jan 21 10:17:21 2016 -0800
@@ -26,19 +26,23 @@
package java.lang.invoke;
import jdk.internal.misc.Unsafe;
+import jdk.internal.vm.annotation.ForceInline;
+import sun.invoke.util.ValueConversions;
+import sun.invoke.util.VerifyAccess;
+import sun.invoke.util.VerifyType;
+import sun.invoke.util.Wrapper;
+
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;
-import sun.invoke.util.VerifyAccess;
+import java.util.Objects;
+
+import static java.lang.invoke.LambdaForm.*;
import static java.lang.invoke.MethodHandleNatives.Constants.*;
-import static java.lang.invoke.LambdaForm.*;
+import static java.lang.invoke.MethodHandleStatics.UNSAFE;
+import static java.lang.invoke.MethodHandleStatics.newInternalError;
import static java.lang.invoke.MethodTypeForm.*;
-import static java.lang.invoke.MethodHandleStatics.*;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.Field;
-import java.util.Objects;
-import sun.invoke.util.ValueConversions;
-import sun.invoke.util.VerifyType;
-import sun.invoke.util.Wrapper;
/**
* The flavor of method handle which implements a constant reference
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DontInline.java Thu Jan 21 09:46:03 2016 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.lang.invoke;
-
-import java.lang.annotation.*;
-
-/**
- * Internal marker for some methods in the JSR 292 implementation.
- */
-/*non-public*/
-@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
-@Retention(RetentionPolicy.RUNTIME)
-@interface DontInline {
-}
--- a/jdk/src/java.base/share/classes/java/lang/invoke/ForceInline.java Thu Jan 21 09:46:03 2016 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.lang.invoke;
-
-import java.lang.annotation.*;
-
-/**
- * Internal marker for some methods in the JSR 292 implementation.
- */
-/*non-public*/
-@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
-@Retention(RetentionPolicy.RUNTIME)
-@interface ForceInline {
-}
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Thu Jan 21 10:17:21 2016 -0800
@@ -625,9 +625,9 @@
if (lambdaForm.forceInline) {
// Force inlining of this invoker method.
- mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
+ mv.visitAnnotation("Ljdk/internal/vm/annotation/ForceInline;", true);
} else {
- mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true);
+ mv.visitAnnotation("Ljdk/internal/vm/annotation/DontInline;", true);
}
if (lambdaForm.customized != null) {
@@ -1309,7 +1309,7 @@
mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
// Don't inline the interpreter entry.
- mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true);
+ mv.visitAnnotation("Ljdk/internal/vm/annotation/DontInline;", true);
// create parameter array
emitIconstInsn(invokerType.parameterCount());
@@ -1368,7 +1368,7 @@
mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
// Force inlining of this invoker method.
- mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
+ mv.visitAnnotation("Ljdk/internal/vm/annotation/ForceInline;", true);
// Load receiver
emitAloadInsn(0);
--- a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java Thu Jan 21 10:17:21 2016 -0800
@@ -25,6 +25,10 @@
package java.lang.invoke;
+import jdk.internal.vm.annotation.DontInline;
+import jdk.internal.vm.annotation.ForceInline;
+import jdk.internal.vm.annotation.Stable;
+
import java.lang.reflect.Array;
import java.util.Arrays;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java Thu Jan 21 10:17:21 2016 -0800
@@ -25,18 +25,24 @@
package java.lang.invoke;
-import java.lang.annotation.*;
+import jdk.internal.vm.annotation.DontInline;
+import jdk.internal.vm.annotation.Stable;
+import sun.invoke.util.Wrapper;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.reflect.Field;
import java.lang.reflect.Method;
-import java.util.List;
import java.util.Arrays;
import java.util.HashMap;
-
-import sun.invoke.util.Wrapper;
-import java.lang.reflect.Field;
+import java.util.List;
import static java.lang.invoke.LambdaForm.BasicType.*;
-import static java.lang.invoke.MethodHandleStatics.*;
-import static java.lang.invoke.MethodHandleNatives.Constants.*;
+import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeStatic;
+import static java.lang.invoke.MethodHandleStatics.debugEnabled;
+import static java.lang.invoke.MethodHandleStatics.newInternalError;
/**
* The symbolic, non-executable form of a method handle's invocation semantics.
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java Thu Jan 21 10:17:21 2016 -0800
@@ -33,6 +33,7 @@
import java.util.List;
import java.util.function.Function;
+import jdk.internal.vm.annotation.Stable;
import sun.invoke.empty.Empty;
import sun.invoke.util.ValueConversions;
import sun.invoke.util.VerifyType;
@@ -1487,7 +1488,7 @@
}
private static final int LEFT_ARGS = FILL_ARRAYS_COUNT - 1;
- private static final @Stable MethodHandle[] FILL_ARRAY_TO_RIGHT = new MethodHandle[MAX_ARITY+1];
+ private static final @Stable MethodHandle[] FILL_ARRAY_TO_RIGHT = new MethodHandle[MAX_ARITY + 1];
/** fill_array_to_right(N).invoke(a, argL..arg[N-1])
* fills a[L]..a[N-1] with corresponding arguments,
* and then returns a. The value L is a global constant (LEFT_ARGS).
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java Thu Jan 21 10:17:21 2016 -0800
@@ -25,6 +25,7 @@
package java.lang.invoke;
+import jdk.internal.vm.annotation.Stable;
import sun.invoke.util.Wrapper;
import java.lang.ref.WeakReference;
import java.lang.ref.Reference;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java Thu Jan 21 10:17:21 2016 -0800
@@ -25,6 +25,7 @@
package java.lang.invoke;
+import jdk.internal.vm.annotation.Stable;
import sun.invoke.util.Wrapper;
import java.lang.ref.SoftReference;
import static java.lang.invoke.MethodHandleStatics.*;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/Stable.java Thu Jan 21 09:46:03 2016 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2012, 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.lang.invoke;
-
-import java.lang.annotation.*;
-
-/**
- * A field may be annotated as stable if all of its component variables
- * changes value at most once.
- * A field's value counts as its component value.
- * If the field is typed as an array, then all the non-null components
- * of the array, of depth up to the rank of the field's array type,
- * also count as component values.
- * By extension, any variable (either array or field) which has annotated
- * as stable is called a stable variable, and its non-null or non-zero
- * value is called a stable value.
- * <p>
- * Since all fields begin with a default value of null for references
- * (resp., zero for primitives), it follows that this annotation indicates
- * that the first non-null (resp., non-zero) value stored in the field
- * will never be changed.
- * <p>
- * If the field is not of an array type, there are no array elements,
- * then the value indicated as stable is simply the value of the field.
- * If the dynamic type of the field value is an array but the static type
- * is not, the components of the array are <em>not</em> regarded as stable.
- * <p>
- * If the field is an array type, then both the field value and
- * all the components of the field value (if the field value is non-null)
- * are indicated to be stable.
- * If the field type is an array type with rank {@code N > 1},
- * then each component of the field value (if the field value is non-null),
- * is regarded as a stable array of rank {@code N-1}.
- * <p>
- * Fields which are declared {@code final} may also be annotated as stable.
- * Since final fields already behave as stable values, such an annotation
- * indicates no additional information, unless the type of the field is
- * an array type.
- * <p>
- * It is (currently) undefined what happens if a field annotated as stable
- * is given a third value. In practice, if the JVM relies on this annotation
- * to promote a field reference to a constant, it may be that the Java memory
- * model would appear to be broken, if such a constant (the second value of the field)
- * is used as the value of the field even after the field value has changed.
- */
-/* package-private */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-@interface Stable {
-}
--- a/jdk/src/java.base/share/classes/java/lang/ref/PhantomReference.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/ref/PhantomReference.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -29,23 +29,20 @@
/**
* Phantom reference objects, which are enqueued after the collector
* determines that their referents may otherwise be reclaimed. Phantom
- * references are most often used for scheduling pre-mortem cleanup actions in
- * a more flexible way than is possible with the Java finalization mechanism.
+ * references are most often used to schedule post-mortem cleanup actions.
*
- * <p> If the garbage collector determines at a certain point in time that the
- * referent of a phantom reference is <a
- * href="package-summary.html#reachability">phantom reachable</a>, then at that
- * time or at some later time it will enqueue the reference.
+ * <p> Suppose the garbage collector determines at a certain point in time
+ * that an object is <a href="package-summary.html#reachability">
+ * phantom reachable</a>. At that time it will atomically clear
+ * all phantom references to that object and all phantom references to
+ * any other phantom-reachable objects from which that object is reachable.
+ * At the same time or at some later time it will enqueue those newly-cleared
+ * phantom references that are registered with reference queues.
*
* <p> In order to ensure that a reclaimable object remains so, the referent of
* a phantom reference may not be retrieved: The {@code get} method of a
* phantom reference always returns {@code null}.
*
- * <p> Unlike soft and weak references, phantom references are not
- * automatically cleared by the garbage collector as they are enqueued. An
- * object that is reachable via phantom references will remain so until all
- * such references are cleared or themselves become unreachable.
- *
* @author Mark Reinhold
* @since 1.2
*/
@@ -69,8 +66,8 @@
*
* <p> It is possible to create a phantom reference with a {@code null}
* queue, but such a reference is completely useless: Its {@code get}
- * method will always return null and, since it does not have a queue, it
- * will never be enqueued.
+ * method will always return {@code null} and, since it does not have a queue,
+ * it will never be enqueued.
*
* @param referent the object the new phantom reference will refer to
* @param q the queue with which the reference is to be registered,
--- a/jdk/src/java.base/share/classes/java/lang/ref/Reference.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/ref/Reference.java Thu Jan 21 10:17:21 2016 -0800
@@ -25,6 +25,7 @@
package java.lang.ref;
+import jdk.internal.vm.annotation.DontInline;
import sun.misc.Cleaner;
import jdk.internal.HotSpotIntrinsicCandidate;
import jdk.internal.misc.JavaLangRefAccess;
@@ -310,4 +311,120 @@
this.queue = (queue == null) ? ReferenceQueue.NULL : queue;
}
+ /**
+ * Ensures that the object referenced by the given reference remains
+ * <a href="package-summary.html#reachability"><em>strongly reachable</em></a>,
+ * regardless of any prior actions of the program that might otherwise cause
+ * the object to become unreachable; thus, the referenced object is not
+ * reclaimable by garbage collection at least until after the invocation of
+ * this method. Invocation of this method does not itself initiate garbage
+ * collection or finalization.
+ *
+ * <p> This method establishes an ordering for
+ * <a href="package-summary.html#reachability"><em>strong reachability</em></a>
+ * with respect to garbage collection. It controls relations that are
+ * otherwise only implicit in a program -- the reachability conditions
+ * triggering garbage collection. This method is designed for use in
+ * uncommon situations of premature finalization where using
+ * {@code synchronized} blocks or methods, or using other synchronization
+ * facilities are not possible or do not provide the desired control. This
+ * method is applicable only when reclamation may have visible effects,
+ * which is possible for objects with finalizers (See
+ * <a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-12.html#jls-12.6">
+ * Section 12.6 17 of <cite>The Java™ Language Specification</cite></a>)
+ * that are implemented in ways that rely on ordering control for correctness.
+ *
+ * @apiNote
+ * Finalization may occur whenever the virtual machine detects that no
+ * reference to an object will ever be stored in the heap: The garbage
+ * collector may reclaim an object even if the fields of that object are
+ * still in use, so long as the object has otherwise become unreachable.
+ * This may have surprising and undesirable effects in cases such as the
+ * following example in which the bookkeeping associated with a class is
+ * managed through array indices. Here, method {@code action} uses a
+ * {@code reachabilityFence} to ensure that the {@code Resource} object is
+ * not reclaimed before bookkeeping on an associated
+ * {@code ExternalResource} has been performed; in particular here, to
+ * ensure that the array slot holding the {@code ExternalResource} is not
+ * nulled out in method {@link Object#finalize}, which may otherwise run
+ * concurrently.
+ *
+ * <pre> {@code
+ * class Resource {
+ * private static ExternalResource[] externalResourceArray = ...
+ *
+ * int myIndex;
+ * Resource(...) {
+ * myIndex = ...
+ * externalResourceArray[myIndex] = ...;
+ * ...
+ * }
+ * protected void finalize() {
+ * externalResourceArray[myIndex] = null;
+ * ...
+ * }
+ * public void action() {
+ * try {
+ * // ...
+ * int i = myIndex;
+ * Resource.update(externalResourceArray[i]);
+ * } finally {
+ * Reference.reachabilityFence(this);
+ * }
+ * }
+ * private static void update(ExternalResource ext) {
+ * ext.status = ...;
+ * }
+ * }}</pre>
+ *
+ * Here, the invocation of {@code reachabilityFence} is nonintuitively
+ * placed <em>after</em> the call to {@code update}, to ensure that the
+ * array slot is not nulled out by {@link Object#finalize} before the
+ * update, even if the call to {@code action} was the last use of this
+ * object. This might be the case if, for example a usage in a user program
+ * had the form {@code new Resource().action();} which retains no other
+ * reference to this {@code Resource}. While probably overkill here,
+ * {@code reachabilityFence} is placed in a {@code finally} block to ensure
+ * that it is invoked across all paths in the method. In a method with more
+ * complex control paths, you might need further precautions to ensure that
+ * {@code reachabilityFence} is encountered along all of them.
+ *
+ * <p> It is sometimes possible to better encapsulate use of
+ * {@code reachabilityFence}. Continuing the above example, if it were
+ * acceptable for the call to method {@code update} to proceed even if the
+ * finalizer had already executed (nulling out slot), then you could
+ * localize use of {@code reachabilityFence}:
+ *
+ * <pre> {@code
+ * public void action2() {
+ * // ...
+ * Resource.update(getExternalResource());
+ * }
+ * private ExternalResource getExternalResource() {
+ * ExternalResource ext = externalResourceArray[myIndex];
+ * Reference.reachabilityFence(this);
+ * return ext;
+ * }}</pre>
+ *
+ * <p> Method {@code reachabilityFence} is not required in constructions
+ * that themselves ensure reachability. For example, because objects that
+ * are locked cannot, in general, be reclaimed, it would suffice if all
+ * accesses of the object, in all methods of class {@code Resource}
+ * (including {@code finalize}) were enclosed in {@code synchronized (this)}
+ * blocks. (Further, such blocks must not include infinite loops, or
+ * themselves be unreachable, which fall into the corner case exceptions to
+ * the "in general" disclaimer.) However, method {@code reachabilityFence}
+ * remains a better option in cases where this approach is not as efficient,
+ * desirable, or possible; for example because it would encounter deadlock.
+ *
+ * @param ref the reference. If {@code null}, this method has no effect.
+ * @since 9
+ */
+ @DontInline
+ public static void reachabilityFence(Object ref) {
+ // Does nothing, because this method is annotated with @DontInline
+ // HotSpot needs to retain the ref and not GC it before a call to this
+ // method
+ }
+
}
--- a/jdk/src/java.base/share/classes/java/lang/ref/package-info.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/ref/package-info.java Thu Jan 21 10:17:21 2016 -0800
@@ -66,9 +66,9 @@
* object with a <em>reference queue</em> at the time the reference
* object is created. Some time after the garbage collector
* determines that the reachability of the referent has changed to the
- * value corresponding to the type of the reference, it will add the
- * reference to the associated queue. At this point, the reference is
- * considered to be <em>enqueued</em>. The program may remove
+ * value corresponding to the type of the reference, it will clear the
+ * reference and add it to the associated queue. At this point, the
+ * reference is considered to be <em>enqueued</em>. The program may remove
* references from a queue either by polling or by blocking until a
* reference becomes available. Reference queues are implemented by
* the {@link java.lang.ref.ReferenceQueue} class.
@@ -94,16 +94,6 @@
* structure, this check will add little overhead to the hashtable
* access methods.
*
- * <h3>Automatically-cleared references</h3>
- *
- * Soft and weak references are automatically cleared by the collector
- * before being added to the queues with which they are registered, if
- * any. Therefore soft and weak references need not be registered
- * with a queue in order to be useful, while phantom references do.
- * An object that is reachable via phantom references will remain so
- * until all such references are cleared or themselves become
- * unreachable.
- *
* <a name="reachability"></a>
* <h3>Reachability</h3>
*
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedArrayType.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedArrayType.java Thu Jan 21 10:17:21 2016 -0800
@@ -53,7 +53,7 @@
*
* @return {@code null}
*
- * @since 1.9
+ * @since 9
*/
@Override
AnnotatedType getAnnotatedOwnerType();
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedParameterizedType.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedParameterizedType.java Thu Jan 21 10:17:21 2016 -0800
@@ -59,7 +59,7 @@
* refers to a parameterized type that cannot be instantiated
* for any reason
*
- * @since 1.9
+ * @since 9
*/
@Override
AnnotatedType getAnnotatedOwnerType();
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedType.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedType.java Thu Jan 21 10:17:21 2016 -0800
@@ -60,7 +60,7 @@
* refers to a parameterized type that cannot be instantiated
* for any reason
*
- * @since 1.9
+ * @since 9
*/
default AnnotatedType getAnnotatedOwnerType() {
return null;
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedTypeVariable.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedTypeVariable.java Thu Jan 21 10:17:21 2016 -0800
@@ -54,7 +54,7 @@
*
* @return {@code null}
*
- * @since 1.9
+ * @since 9
*/
@Override
AnnotatedType getAnnotatedOwnerType();
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedWildcardType.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedWildcardType.java Thu Jan 21 10:17:21 2016 -0800
@@ -65,7 +65,7 @@
*
* @return {@code null}
*
- * @since 1.9
+ * @since 9
*/
@Override
AnnotatedType getAnnotatedOwnerType();
--- a/jdk/src/java.base/share/classes/java/math/BigInteger.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/math/BigInteger.java Thu Jan 21 10:17:21 2016 -0800
@@ -297,7 +297,7 @@
* @throws IndexOutOfBoundsException if the provided array offset and
* length would cause an index into the byte array to be
* negative or greater than or equal to the array length.
- * @since 1.9
+ * @since 9
*/
public BigInteger(byte[] val, int off, int len) {
if (val.length == 0) {
@@ -385,7 +385,7 @@
* @throws IndexOutOfBoundsException if the provided array offset and
* length would cause an index into the byte array to be
* negative or greater than or equal to the array length.
- * @since 1.9
+ * @since 9
*/
public BigInteger(int signum, byte[] magnitude, int off, int len) {
if (signum < -1 || signum > 1) {
@@ -2424,7 +2424,7 @@
* {@code (i * sqrt(-val))} where <i>i</i> is the
* <i>imaginary unit</i> and is equal to
* {@code sqrt(-1)}.)
- * @since 1.9
+ * @since 9
*/
public BigInteger sqrt() {
if (this.signum < 0) {
@@ -2447,7 +2447,7 @@
* <i>imaginary unit</i> and is equal to
* {@code sqrt(-1)}.)
* @see #sqrt()
- * @since 1.9
+ * @since 9
*/
public BigInteger[] sqrtAndRemainder() {
BigInteger s = sqrt();
--- a/jdk/src/java.base/share/classes/java/math/MutableBigInteger.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/math/MutableBigInteger.java Thu Jan 21 10:17:21 2016 -0800
@@ -1878,7 +1878,7 @@
* @throws ArithmeticException if the value returned by {@code bitLength()}
* overflows the range of {@code int}.
* @return the integer square root of {@code this}
- * @since 1.9
+ * @since 9
*/
MutableBigInteger sqrt() {
// Special cases.
--- a/jdk/src/java.base/share/classes/java/net/DatagramSocket.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/net/DatagramSocket.java Thu Jan 21 10:17:21 2016 -0800
@@ -1338,7 +1338,7 @@
*
* @throws NullPointerException if name is {@code null}
*
- * @since 1.9
+ * @since 9
*/
public <T> DatagramSocket setOption(SocketOption<T> name, T value)
throws IOException
@@ -1368,7 +1368,7 @@
* {@link java.net.StandardSocketOptions StandardSocketOptions}
* do not require any security permission.
*
- * @since 1.9
+ * @since 9
*/
public <T> T getOption(SocketOption<T> name) throws IOException {
return getImpl().getOption(name);
@@ -1386,7 +1386,7 @@
* @return A set of the socket options supported by this socket. This set
* may be empty if the socket's DatagramSocketImpl cannot be created.
*
- * @since 1.9
+ * @since 9
*/
public Set<SocketOption<?>> supportedOptions() {
synchronized(DatagramSocket.class) {
--- a/jdk/src/java.base/share/classes/java/net/DatagramSocketImpl.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/net/DatagramSocketImpl.java Thu Jan 21 10:17:21 2016 -0800
@@ -278,7 +278,7 @@
*
* @throws NullPointerException if name is {@code null}
* @throws IOException if an I/O problem occurs while attempting to set the option
- * @since 1.9
+ * @since 9
*/
protected <T> void setOption(SocketOption<T> name, T value) throws IOException {
if (name == StandardSocketOptions.SO_SNDBUF) {
@@ -319,7 +319,7 @@
* @throws NullPointerException if name is {@code null}
* @throws IOException if an I/O problem occurs while attempting to set the option
*
- * @since 1.9
+ * @since 9
*/
@SuppressWarnings("unchecked")
protected <T> T getOption(SocketOption<T> name) throws IOException {
--- a/jdk/src/java.base/share/classes/java/net/NetworkInterface.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/net/NetworkInterface.java Thu Jan 21 10:17:21 2016 -0800
@@ -130,7 +130,7 @@
*
* @return a Stream object with all or a subset of the InetAddresses
* bound to this network interface
- * @since 1.9
+ * @since 9
*/
public Stream<InetAddress> inetAddresses() {
return streamFromArray(getCheckedInetAddresses());
@@ -208,7 +208,7 @@
*
* @return a Stream object with all of the subinterfaces
* of this network interface
- * @since 1.9
+ * @since 9
*/
public Stream<NetworkInterface> subInterfaces() {
return streamFromArray(childs);
@@ -362,7 +362,7 @@
*
* @return a Stream of NetworkInterfaces found on this machine
* @exception SocketException if an I/O error occurs.
- * @since 1.9
+ * @since 9
*/
public static Stream<NetworkInterface> networkInterfaces()
throws SocketException {
--- a/jdk/src/java.base/share/classes/java/net/ServerSocket.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/net/ServerSocket.java Thu Jan 21 10:17:21 2016 -0800
@@ -946,7 +946,7 @@
* {@link java.net.StandardSocketOptions StandardSocketOptions}
* do not require any security permission.
*
- * @since 1.9
+ * @since 9
*/
public <T> ServerSocket setOption(SocketOption<T> name, T value)
throws IOException
@@ -976,7 +976,7 @@
* {@link java.net.StandardSocketOptions StandardSocketOptions}
* do not require any security permission.
*
- * @since 1.9
+ * @since 9
*/
public <T> T getOption(SocketOption<T> name) throws IOException {
return getImpl().getOption(name);
@@ -994,7 +994,7 @@
* @return A set of the socket options supported by this socket. This set
* may be empty if the socket's SocketImpl cannot be created.
*
- * @since 1.9
+ * @since 9
*/
public Set<SocketOption<?>> supportedOptions() {
synchronized (ServerSocket.class) {
--- a/jdk/src/java.base/share/classes/java/net/Socket.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/net/Socket.java Thu Jan 21 10:17:21 2016 -0800
@@ -1756,7 +1756,7 @@
* {@link java.net.StandardSocketOptions StandardSocketOptions}
* do not require any security permission.
*
- * @since 1.9
+ * @since 9
*/
public <T> Socket setOption(SocketOption<T> name, T value) throws IOException {
getImpl().setOption(name, value);
@@ -1784,7 +1784,7 @@
* {@link java.net.StandardSocketOptions StandardSocketOptions}
* do not require any security permission.
*
- * @since 1.9
+ * @since 9
*/
@SuppressWarnings("unchecked")
public <T> T getOption(SocketOption<T> name) throws IOException {
@@ -1803,7 +1803,7 @@
* @return A set of the socket options supported by this socket. This set
* may be empty if the socket's SocketImpl cannot be created.
*
- * @since 1.9
+ * @since 9
*/
public Set<SocketOption<?>> supportedOptions() {
synchronized (Socket.class) {
--- a/jdk/src/java.base/share/classes/java/net/SocketImpl.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/net/SocketImpl.java Thu Jan 21 10:17:21 2016 -0800
@@ -373,7 +373,7 @@
*
* @throws IOException if an I/O error occurs, or if the socket is closed.
*
- * @since 1.9
+ * @since 9
*/
protected <T> void setOption(SocketOption<T> name, T value) throws IOException {
if (name == StandardSocketOptions.SO_KEEPALIVE &&
@@ -412,7 +412,7 @@
*
* @throws IOException if an I/O error occurs, or if the socket is closed.
*
- * @since 1.9
+ * @since 9
*/
@SuppressWarnings("unchecked")
protected <T> T getOption(SocketOption<T> name) throws IOException {
--- a/jdk/src/java.base/share/classes/java/net/URL.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/net/URL.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, 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
@@ -31,6 +31,10 @@
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Hashtable;
+import java.io.InvalidObjectException;
+import java.io.ObjectStreamException;
+import java.io.ObjectStreamField;
+import java.io.ObjectInputStream.GetField;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.ServiceConfigurationError;
@@ -142,6 +146,7 @@
*/
public final class URL implements java.io.Serializable {
+ static final String BUILTIN_HANDLERS_PREFIX = "sun.net.www.protocol";
static final long serialVersionUID = -7627629688361524110L;
/**
@@ -226,6 +231,8 @@
*/
private int hashCode = -1;
+ private transient UrlDeserializedState tempState;
+
/**
* Creates a {@code URL} object from the specified
* {@code protocol}, {@code host}, {@code port}
@@ -1354,6 +1361,31 @@
}
/**
+ * @serialField protocol String
+ *
+ * @serialField host String
+ *
+ * @serialField port int
+ *
+ * @serialField authority String
+ *
+ * @serialField file String
+ *
+ * @serialField ref String
+ *
+ * @serialField hashCode int
+ *
+ */
+ private static final ObjectStreamField[] serialPersistentFields = {
+ new ObjectStreamField("protocol", String.class),
+ new ObjectStreamField("host", String.class),
+ new ObjectStreamField("port", int.class),
+ new ObjectStreamField("authority", String.class),
+ new ObjectStreamField("file", String.class),
+ new ObjectStreamField("ref", String.class),
+ new ObjectStreamField("hashCode", int.class), };
+
+ /**
* WriteObject is called to save the state of the URL to an
* ObjectOutputStream. The handler is not saved since it is
* specific to this system.
@@ -1375,16 +1407,67 @@
* stream handler.
*/
private synchronized void readObject(java.io.ObjectInputStream s)
- throws IOException, ClassNotFoundException
- {
- s.defaultReadObject(); // read the fields
- if ((handler = getURLStreamHandler(protocol)) == null) {
+ throws IOException, ClassNotFoundException {
+ GetField gf = s.readFields();
+ String protocol = (String)gf.get("protocol", null);
+ if (getURLStreamHandler(protocol) == null) {
throw new IOException("unknown protocol: " + protocol);
}
+ String host = (String)gf.get("host", null);
+ int port = gf.get("port", -1);
+ String authority = (String)gf.get("authority", null);
+ String file = (String)gf.get("file", null);
+ String ref = (String)gf.get("ref", null);
+ int hashCode = gf.get("hashCode", -1);
+ if (authority == null
+ && ((host != null && host.length() > 0) || port != -1)) {
+ if (host == null)
+ host = "";
+ authority = (port == -1) ? host : host + ":" + port;
+ }
+ tempState = new UrlDeserializedState(protocol, host, port, authority,
+ file, ref, hashCode);
+ }
+
+ /**
+ * Replaces the de-serialized object with an URL object.
+ *
+ * @return a newly created object from deserialized data
+ *
+ * @throws ObjectStreamException if a new object replacing this
+ * object could not be created
+ */
+
+ private Object readResolve() throws ObjectStreamException {
+
+ URLStreamHandler handler = null;
+ // already been checked in readObject
+ handler = getURLStreamHandler(tempState.getProtocol());
+
+ URL replacementURL = null;
+ if (isBuiltinStreamHandler(handler.getClass().getName())) {
+ replacementURL = fabricateNewURL();
+ } else {
+ replacementURL = setDeserializedFields(handler);
+ }
+ return replacementURL;
+ }
+
+ private URL setDeserializedFields(URLStreamHandler handler) {
+ URL replacementURL;
+ String userInfo = null;
+ String protocol = tempState.getProtocol();
+ String host = tempState.getHost();
+ int port = tempState.getPort();
+ String authority = tempState.getAuthority();
+ String file = tempState.getFile();
+ String ref = tempState.getRef();
+ int hashCode = tempState.getHashCode();
+
// Construct authority part
- if (authority == null &&
- ((host != null && host.length() > 0) || port != -1)) {
+ if (authority == null
+ && ((host != null && host.length() > 0) || port != -1)) {
if (host == null)
host = "";
authority = (port == -1) ? host : host + ":" + port;
@@ -1403,8 +1486,8 @@
}
// Construct path and query part
- path = null;
- query = null;
+ String path = null;
+ String query = null;
if (file != null) {
// Fix: only do this if hierarchical?
int q = file.lastIndexOf('?');
@@ -1414,6 +1497,67 @@
} else
path = file;
}
+
+ if (port == -1) {
+ port = 0;
+ }
+ // Set the object fields.
+ this.protocol = protocol;
+ this.host = host;
+ this.port = port;
+ this.file = file;
+ this.authority = authority;
+ this.ref = ref;
+ this.hashCode = hashCode;
+ this.handler = handler;
+ this.query = query;
+ this.path = path;
+ this.userInfo = userInfo;
+ replacementURL = this;
+ return replacementURL;
+ }
+
+ private URL fabricateNewURL()
+ throws InvalidObjectException {
+ // create URL string from deserialized object
+ URL replacementURL = null;
+ String urlString = tempState.reconstituteUrlString();
+
+ try {
+ replacementURL = new URL(urlString);
+ } catch (MalformedURLException mEx) {
+ resetState();
+ InvalidObjectException invoEx = new InvalidObjectException(
+ "Malformed URL: " + urlString);
+ invoEx.initCause(mEx);
+ throw invoEx;
+ }
+ replacementURL.setSerializedHashCode(tempState.getHashCode());
+ resetState();
+ return replacementURL;
+ }
+
+ private boolean isBuiltinStreamHandler(String handlerClassName) {
+ return (handlerClassName.startsWith(BUILTIN_HANDLERS_PREFIX));
+ }
+
+ private void resetState() {
+ this.protocol = null;
+ this.host = null;
+ this.port = -1;
+ this.file = null;
+ this.authority = null;
+ this.ref = null;
+ this.hashCode = -1;
+ this.handler = null;
+ this.query = null;
+ this.path = null;
+ this.userInfo = null;
+ this.tempState = null;
+ }
+
+ private void setSerializedHashCode(int hc) {
+ this.hashCode = hc;
}
}
@@ -1445,3 +1589,82 @@
return ref;
}
}
+
+final class UrlDeserializedState {
+ private final String protocol;
+ private final String host;
+ private final int port;
+ private final String authority;
+ private final String file;
+ private final String ref;
+ private final int hashCode;
+
+ public UrlDeserializedState(String protocol,
+ String host, int port,
+ String authority, String file,
+ String ref, int hashCode) {
+ this.protocol = protocol;
+ this.host = host;
+ this.port = port;
+ this.authority = authority;
+ this.file = file;
+ this.ref = ref;
+ this.hashCode = hashCode;
+ }
+
+ String getProtocol() {
+ return protocol;
+ }
+
+ String getHost() {
+ return host;
+ }
+
+ String getAuthority () {
+ return authority;
+ }
+
+ int getPort() {
+ return port;
+ }
+
+ String getFile () {
+ return file;
+ }
+
+ String getRef () {
+ return ref;
+ }
+
+ int getHashCode () {
+ return hashCode;
+ }
+
+ String reconstituteUrlString() {
+
+ // pre-compute length of StringBuffer
+ int len = protocol.length() + 1;
+ if (authority != null && authority.length() > 0)
+ len += 2 + authority.length();
+ if (file != null) {
+ len += file.length();
+ }
+ if (ref != null)
+ len += 1 + ref.length();
+ StringBuilder result = new StringBuilder(len);
+ result.append(protocol);
+ result.append(":");
+ if (authority != null && authority.length() > 0) {
+ result.append("//");
+ result.append(authority);
+ }
+ if (file != null) {
+ result.append(file);
+ }
+ if (ref != null) {
+ result.append("#");
+ result.append(ref);
+ }
+ return result.toString();
+ }
+}
--- a/jdk/src/java.base/share/classes/java/net/spi/URLStreamHandlerProvider.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/net/spi/URLStreamHandlerProvider.java Thu Jan 21 10:17:21 2016 -0800
@@ -44,7 +44,7 @@
* <p> URL stream handler providers are located at runtime, as specified in the
* {@linkplain java.net.URL#URL(String,String,int,String) URL constructor}.
*
- * @since 1.9
+ * @since 9
*/
public abstract class URLStreamHandlerProvider
implements URLStreamHandlerFactory
--- a/jdk/src/java.base/share/classes/java/net/spi/package-info.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/net/spi/package-info.java Thu Jan 21 10:17:21 2016 -0800
@@ -29,7 +29,7 @@
* <p> Only developers who are defining new URL stream handler providers
* should need to make direct use of this package.
*
- * @since 1.9
+ * @since 9
*/
package java.net.spi;
--- a/jdk/src/java.base/share/classes/java/nio/MappedByteBuffer.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/nio/MappedByteBuffer.java Thu Jan 21 10:17:21 2016 -0800
@@ -213,7 +213,7 @@
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public final MappedByteBuffer position(int newPosition) {
@@ -223,7 +223,7 @@
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public final MappedByteBuffer limit(int newLimit) {
@@ -233,7 +233,7 @@
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public final MappedByteBuffer mark() {
@@ -243,7 +243,7 @@
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public final MappedByteBuffer reset() {
@@ -253,7 +253,7 @@
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public final MappedByteBuffer clear() {
@@ -263,7 +263,7 @@
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public final MappedByteBuffer flip() {
@@ -273,7 +273,7 @@
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public final MappedByteBuffer rewind() {
--- a/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template Thu Jan 21 10:17:21 2016 -0800
@@ -1064,7 +1064,7 @@
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public
@@ -1078,7 +1078,7 @@
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public
@@ -1092,7 +1092,7 @@
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public
@@ -1106,7 +1106,7 @@
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public
@@ -1120,7 +1120,7 @@
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public
@@ -1134,7 +1134,7 @@
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public
@@ -1148,7 +1148,7 @@
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public
--- a/jdk/src/java.base/share/classes/java/security/KeyStore.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/security/KeyStore.java Thu Jan 21 10:17:21 2016 -0800
@@ -1666,7 +1666,7 @@
*
* @see Provider
*
- * @since 1.9
+ * @since 9
*/
public static final KeyStore getInstance(File file, char[] password)
throws KeyStoreException, IOException, NoSuchAlgorithmException,
@@ -1722,7 +1722,7 @@
*
* @see Provider
*
- * @since 1.9
+ * @since 9
*/
public static final KeyStore getInstance(File file,
LoadStoreParameter param) throws KeyStoreException, IOException,
@@ -2006,7 +2006,7 @@
* of either PasswordProtection or CallbackHandlerProtection; or
* if file does not exist or does not refer to a normal file
*
- * @since 1.9
+ * @since 9
*/
public static Builder newInstance(File file,
ProtectionParameter protection) {
--- a/jdk/src/java.base/share/classes/java/security/PermissionCollection.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/security/PermissionCollection.java Thu Jan 21 10:17:21 2016 -0800
@@ -144,7 +144,7 @@
* the enumeration returned from a call to {@link #elements()}.
*
* @return a stream of all the Permissions.
- * @since 1.9
+ * @since 9
*/
public Stream<Permission> elementsAsStream() {
int characteristics = isReadOnly()
--- a/jdk/src/java.base/share/classes/java/security/cert/URICertStoreParameters.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/security/cert/URICertStoreParameters.java Thu Jan 21 10:17:21 2016 -0800
@@ -43,7 +43,7 @@
* provide the necessary locking. Multiple threads each manipulating
* separate objects need not synchronize.
*
- * @since 1.9
+ * @since 9
* @see CertStore
* @see java.net.URI
*/
--- a/jdk/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java Thu Jan 21 10:17:21 2016 -0800
@@ -74,7 +74,7 @@
* or {@code algorithm} is null.
* @throws IllegalArgumentException if {@code algorithm} is
* the empty string {@code ""}
- * @since 1.9
+ * @since 9
*/
protected EncodedKeySpec(byte[] encodedKey, String algorithm) {
if (algorithm == null) {
@@ -93,7 +93,7 @@
* Returns the name of the algorithm of the encoded key.
*
* @return the name of the algorithm, or null if not specified
- * @since 1.9
+ * @since 9
*/
public String getAlgorithm() {
return algorithmName;
--- a/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java Thu Jan 21 10:17:21 2016 -0800
@@ -92,7 +92,7 @@
* or {@code algorithm} is null.
* @throws IllegalArgumentException if {@code algorithm} is
* the empty string {@code ""}
- * @since 1.9
+ * @since 9
*/
public PKCS8EncodedKeySpec(byte[] encodedKey, String algorithm) {
super(encodedKey, algorithm);
--- a/jdk/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java Thu Jan 21 10:17:21 2016 -0800
@@ -82,7 +82,7 @@
* or {@code algorithm} is null.
* @throws IllegalArgumentException if {@code algorithm} is
* the empty string {@code ""}
- * @since 1.9
+ * @since 9
*/
public X509EncodedKeySpec(byte[] encodedKey, String algorithm) {
super(encodedKey, algorithm);
--- a/jdk/src/java.base/share/classes/java/util/Arrays.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/Arrays.java Thu Jan 21 10:17:21 2016 -0800
@@ -110,7 +110,7 @@
* Checks that {@code fromIndex} and {@code toIndex} are in
* the range and throws an exception if they aren't.
*/
- private static void rangeCheck(int arrayLength, int fromIndex, int toIndex) {
+ static void rangeCheck(int arrayLength, int fromIndex, int toIndex) {
if (fromIndex > toIndex) {
throw new IllegalArgumentException(
"fromIndex(" + fromIndex + ") > toIndex(" + toIndex + ")");
@@ -2579,11 +2579,7 @@
if (a2.length != length)
return false;
- for (int i=0; i<length; i++)
- if (a[i] != a2[i])
- return false;
-
- return true;
+ return ArraysSupport.mismatch(a, a2, length) < 0;
}
/**
@@ -2628,11 +2624,9 @@
if (aLength != bLength)
return false;
- for (int i = 0; i < aLength; i++)
- if (a[aFromIndex++] != b[bFromIndex++])
- return false;
-
- return true;
+ return ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ aLength) < 0;
}
/**
@@ -2657,11 +2651,7 @@
if (a2.length != length)
return false;
- for (int i=0; i<length; i++)
- if (a[i] != a2[i])
- return false;
-
- return true;
+ return ArraysSupport.mismatch(a, a2, length) < 0;
}
/**
@@ -2706,11 +2696,9 @@
if (aLength != bLength)
return false;
- for (int i = 0; i < aLength; i++)
- if (a[aFromIndex++] != b[bFromIndex++])
- return false;
-
- return true;
+ return ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ aLength) < 0;
}
/**
@@ -2735,11 +2723,7 @@
if (a2.length != length)
return false;
- for (int i=0; i<length; i++)
- if (a[i] != a2[i])
- return false;
-
- return true;
+ return ArraysSupport.mismatch(a, a2, length) < 0;
}
/**
@@ -2784,11 +2768,9 @@
if (aLength != bLength)
return false;
- for (int i = 0; i < aLength; i++)
- if (a[aFromIndex++] != b[bFromIndex++])
- return false;
-
- return true;
+ return ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ aLength) < 0;
}
/**
@@ -2814,11 +2796,7 @@
if (a2.length != length)
return false;
- for (int i=0; i<length; i++)
- if (a[i] != a2[i])
- return false;
-
- return true;
+ return ArraysSupport.mismatch(a, a2, length) < 0;
}
/**
@@ -2863,11 +2841,9 @@
if (aLength != bLength)
return false;
- for (int i = 0; i < aLength; i++)
- if (a[aFromIndex++] != b[bFromIndex++])
- return false;
-
- return true;
+ return ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ aLength) < 0;
}
/**
@@ -2893,11 +2869,7 @@
if (a2.length != length)
return false;
- for (int i=0; i<length; i++)
- if (a[i] != a2[i])
- return false;
-
- return true;
+ return ArraysSupport.mismatch(a, a2, length) < 0;
}
/**
@@ -2942,11 +2914,9 @@
if (aLength != bLength)
return false;
- for (int i = 0; i < aLength; i++)
- if (a[aFromIndex++] != b[bFromIndex++])
- return false;
-
- return true;
+ return ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ aLength) < 0;
}
/**
@@ -2971,11 +2941,7 @@
if (a2.length != length)
return false;
- for (int i=0; i<length; i++)
- if (a[i] != a2[i])
- return false;
-
- return true;
+ return ArraysSupport.mismatch(a, a2, length) < 0;
}
/**
@@ -3020,11 +2986,9 @@
if (aLength != bLength)
return false;
- for (int i = 0; i < aLength; i++)
- if (a[aFromIndex++] != b[bFromIndex++])
- return false;
-
- return true;
+ return ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ aLength) < 0;
}
/**
@@ -3055,14 +3019,7 @@
if (a2.length != length)
return false;
- for (int i=0; i<length; i++) {
- double v1 = a[i], v2 = a2[i];
- if (Double.doubleToRawLongBits(v1) != Double.doubleToRawLongBits(v2))
- if (!Double.isNaN(v1) || !Double.isNaN(v2))
- return false;
- }
-
- return true;
+ return ArraysSupport.mismatch(a, a2, length) < 0;
}
/**
@@ -3113,14 +3070,8 @@
if (aLength != bLength)
return false;
- for (int i = 0; i < aLength; i++) {
- Double va = a[aFromIndex++], vb = b[bFromIndex++];
- if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb))
- if (!Double.isNaN(va) || !Double.isNaN(vb))
- return false;
- }
-
- return true;
+ return ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex, aLength) < 0;
}
/**
@@ -3151,14 +3102,7 @@
if (a2.length != length)
return false;
- for (int i=0; i<length; i++) {
- float v1 = a[i], v2 = a2[i];
- if (Float.floatToRawIntBits(v1) != Float.floatToRawIntBits(v2))
- if (!Float.isNaN(v1) || !Float.isNaN(v2))
- return false;
- }
-
- return true;
+ return ArraysSupport.mismatch(a, a2, length) < 0;
}
/**
@@ -3209,14 +3153,8 @@
if (aLength != bLength)
return false;
- for (int i = 0; i < aLength; i++) {
- float va = a[aFromIndex++], vb = b[bFromIndex++];
- if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb))
- if (!Float.isNaN(va) || !Float.isNaN(vb))
- return false;
- }
-
- return true;
+ return ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex, aLength) < 0;
}
/**
@@ -5804,9 +5742,10 @@
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Boolean.compare(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Boolean.compare(a[i], b[i]);
}
return a.length - b.length;
@@ -5880,11 +5819,11 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- boolean va = a[aFromIndex++];
- boolean vb = b[bFromIndex++];
- if (va != vb) return Boolean.compare(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Boolean.compare(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -5939,9 +5878,10 @@
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Byte.compare(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Byte.compare(a[i], b[i]);
}
return a.length - b.length;
@@ -6014,11 +5954,11 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- byte va = a[aFromIndex++];
- byte vb = b[bFromIndex++];
- if (va != vb) return Byte.compare(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Byte.compare(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -6066,9 +6006,10 @@
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Byte.compareUnsigned(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Byte.compareUnsigned(a[i], b[i]);
}
return a.length - b.length;
@@ -6133,11 +6074,11 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- byte va = a[aFromIndex++];
- byte vb = b[bFromIndex++];
- if (va != vb) return Byte.compareUnsigned(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Byte.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -6192,9 +6133,10 @@
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Short.compare(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Short.compare(a[i], b[i]);
}
return a.length - b.length;
@@ -6267,11 +6209,11 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- short va = a[aFromIndex++];
- short vb = b[bFromIndex++];
- if (va != vb) return Short.compare(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Short.compare(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -6319,9 +6261,10 @@
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Short.compareUnsigned(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Short.compareUnsigned(a[i], b[i]);
}
return a.length - b.length;
@@ -6385,11 +6328,11 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- short va = a[aFromIndex++];
- short vb = b[bFromIndex++];
- if (va != vb) return Short.compareUnsigned(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Short.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -6444,9 +6387,10 @@
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Character.compare(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Character.compare(a[i], b[i]);
}
return a.length - b.length;
@@ -6519,11 +6463,11 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- char va = a[aFromIndex++];
- char vb = b[bFromIndex++];
- if (va != vb) return Character.compare(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Character.compare(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -6578,9 +6522,10 @@
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Integer.compare(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Integer.compare(a[i], b[i]);
}
return a.length - b.length;
@@ -6653,11 +6598,11 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- int va = a[aFromIndex++];
- int vb = b[bFromIndex++];
- if (va != vb) return Integer.compare(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Integer.compare(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -6705,9 +6650,10 @@
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Integer.compareUnsigned(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Integer.compareUnsigned(a[i], b[i]);
}
return a.length - b.length;
@@ -6771,11 +6717,11 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- int va = a[aFromIndex++];
- int vb = b[bFromIndex++];
- if (va != vb) return Integer.compareUnsigned(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Integer.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -6830,9 +6776,10 @@
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Long.compare(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Long.compare(a[i], b[i]);
}
return a.length - b.length;
@@ -6905,11 +6852,11 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- long va = a[aFromIndex++];
- long vb = b[bFromIndex++];
- if (va != vb) return Long.compare(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Long.compare(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -6957,9 +6904,10 @@
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Long.compareUnsigned(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Long.compareUnsigned(a[i], b[i]);
}
return a.length - b.length;
@@ -7023,11 +6971,11 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- long va = a[aFromIndex++];
- long vb = b[bFromIndex++];
- if (va != vb) return Long.compareUnsigned(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Long.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -7082,13 +7030,10 @@
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- float va = a[i], vb = b[i];
- if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb)) {
- int c = Float.compare(va, vb);
- if (c != 0) return c;
- }
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Float.compare(a[i], b[i]);
}
return a.length - b.length;
@@ -7161,13 +7106,11 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- float va = a[aFromIndex++], vb = b[bFromIndex++];
- if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb)) {
- int c = Float.compare(va, vb);
- if (c != 0) return c;
- }
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Float.compare(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -7222,13 +7165,10 @@
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- double va = a[i], vb = b[i];
- if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb)) {
- int c = Double.compare(va, vb);
- if (c != 0) return c;
- }
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Double.compare(a[i], b[i]);
}
return a.length - b.length;
@@ -7301,13 +7241,11 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- double va = a[aFromIndex++], vb = b[bFromIndex++];
- if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb)) {
- int c = Double.compare(va, vb);
- if (c != 0) return c;
- }
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Double.compare(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -7673,11 +7611,8 @@
if (a == b)
return -1;
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return i;
- }
-
- return a.length != b.length ? length : -1;
+ int i = ArraysSupport.mismatch(a, b, length);
+ return (i < 0 && a.length != b.length) ? length : i;
}
/**
@@ -7749,11 +7684,10 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- if (a[aFromIndex++] != b[bFromIndex++]) return i;
- }
-
- return aLength != bLength ? length : -1;
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ length);
+ return (i < 0 && aLength != bLength) ? length : i;
}
// Mismatch byte
@@ -7804,11 +7738,8 @@
if (a == b)
return -1;
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return i;
- }
-
- return a.length != b.length ? length : -1;
+ int i = ArraysSupport.mismatch(a, b, length);
+ return (i < 0 && a.length != b.length) ? length : i;
}
/**
@@ -7880,11 +7811,10 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- if (a[aFromIndex++] != b[bFromIndex++]) return i;
- }
-
- return aLength != bLength ? length : -1;
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ length);
+ return (i < 0 && aLength != bLength) ? length : i;
}
// Mismatch char
@@ -7935,11 +7865,8 @@
if (a == b)
return -1;
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return i;
- }
-
- return a.length != b.length ? length : -1;
+ int i = ArraysSupport.mismatch(a, b, length);
+ return (i < 0 && a.length != b.length) ? length : i;
}
/**
@@ -8011,11 +7938,10 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- if (a[aFromIndex++] != b[bFromIndex++]) return i;
- }
-
- return aLength != bLength ? length : -1;
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ length);
+ return (i < 0 && aLength != bLength) ? length : i;
}
// Mismatch short
@@ -8066,11 +7992,8 @@
if (a == b)
return -1;
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return i;
- }
-
- return a.length != b.length ? length : -1;
+ int i = ArraysSupport.mismatch(a, b, length);
+ return (i < 0 && a.length != b.length) ? length : i;
}
/**
@@ -8142,11 +8065,10 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- if (a[aFromIndex++] != b[bFromIndex++]) return i;
- }
-
- return aLength != bLength ? length : -1;
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ length);
+ return (i < 0 && aLength != bLength) ? length : i;
}
// Mismatch int
@@ -8197,11 +8119,8 @@
if (a == b)
return -1;
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return i;
- }
-
- return a.length != b.length ? length : -1;
+ int i = ArraysSupport.mismatch(a, b, length);
+ return (i < 0 && a.length != b.length) ? length : i;
}
/**
@@ -8273,11 +8192,10 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- if (a[aFromIndex++] != b[bFromIndex++]) return i;
- }
-
- return aLength != bLength ? length : -1;
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ length);
+ return (i < 0 && aLength != bLength) ? length : i;
}
// Mismatch long
@@ -8328,11 +8246,8 @@
if (a == b)
return -1;
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return i;
- }
-
- return a.length != b.length ? length : -1;
+ int i = ArraysSupport.mismatch(a, b, length);
+ return (i < 0 && a.length != b.length) ? length : i;
}
/**
@@ -8404,11 +8319,10 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- if (a[aFromIndex++] != b[bFromIndex++]) return i;
- }
-
- return aLength != bLength ? length : -1;
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ length);
+ return (i < 0 && aLength != bLength) ? length : i;
}
// Mismatch float
@@ -8459,14 +8373,8 @@
if (a == b)
return -1;
- for (int i = 0; i < length; i++) {
- float va = a[i], vb = b[i];
- if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb))
- if (!Float.isNaN(va) || !Float.isNaN(vb))
- return i;
- }
-
- return a.length != b.length ? length : -1;
+ int i = ArraysSupport.mismatch(a, b, length);
+ return (i < 0 && a.length != b.length) ? length : i;
}
/**
@@ -8538,14 +8446,10 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- float va = a[aFromIndex++], vb = b[bFromIndex++];
- if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb))
- if (!Float.isNaN(va) || !Float.isNaN(vb))
- return i;
- }
-
- return aLength != bLength ? length : -1;
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ length);
+ return (i < 0 && aLength != bLength) ? length : i;
}
// Mismatch double
@@ -8596,14 +8500,8 @@
if (a == b)
return -1;
- for (int i = 0; i < length; i++) {
- double va = a[i], vb = b[i];
- if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb))
- if (!Double.isNaN(va) || !Double.isNaN(vb))
- return i;
- }
-
- return a.length != b.length ? length : -1;
+ int i = ArraysSupport.mismatch(a, b, length);
+ return (i < 0 && a.length != b.length) ? length : i;
}
/**
@@ -8675,14 +8573,10 @@
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- double va = a[aFromIndex++], vb = b[bFromIndex++];
- if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb))
- if (!Double.isNaN(va) || !Double.isNaN(vb))
- return i;
- }
-
- return aLength != bLength ? length : -1;
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ length);
+ return (i < 0 && aLength != bLength) ? length : i;
}
// Mismatch objects
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/util/ArraysSupport.java Thu Jan 21 10:17:21 2016 -0800
@@ -0,0 +1,545 @@
+/*
+ * Copyright (c) 2015, 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.util;
+
+import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.Unsafe;
+
+/**
+ * Utility methods to find a mismatch between two primitive arrays.
+ *
+ * <p>Array equality and lexicographical comparison can be built on top of
+ * array mismatch functionality.
+ *
+ * <p>The mismatch method implementation, {@link #vectorizedMismatch}, leverages
+ * vector-based techniques to access and compare the contents of two arrays.
+ * The Java implementation uses {@code Unsafe.getLongUnaligned} to access the
+ * content of an array, thus access is supported on platforms that do not
+ * support unaligned access. For a byte[] array, 8 bytes (64 bits) can be
+ * accessed and compared as a unit rather than individually, which increases
+ * the performance when the method is compiled by the HotSpot VM. On supported
+ * platforms the mismatch implementation is intrinsified to leverage SIMD
+ * instructions. So for a byte[] array, 16 bytes (128 bits), 32 bytes
+ * (256 bits), and perhaps in the future even 64 bytes (512 bits), platform
+ * permitting, can be accessed and compared as a unit, which further increases
+ * the performance over the Java implementation.
+ *
+ * <p>None of the mismatch methods perform array bounds checks. It is the
+ * responsibility of the caller (direct or otherwise) to perform such checks
+ * before calling this method.
+ */
+class ArraysSupport {
+ static final Unsafe U = Unsafe.getUnsafe();
+
+ private static final boolean BIG_ENDIAN = U.isBigEndian();
+
+ private static final int LOG2_ARRAY_BOOLEAN_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BOOLEAN_INDEX_SCALE);
+ private static final int LOG2_ARRAY_BYTE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BYTE_INDEX_SCALE);
+ private static final int LOG2_ARRAY_CHAR_INDEX_SCALE = exactLog2(Unsafe.ARRAY_CHAR_INDEX_SCALE);
+ private static final int LOG2_ARRAY_SHORT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_SHORT_INDEX_SCALE);
+ private static final int LOG2_ARRAY_INT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_INT_INDEX_SCALE);
+ private static final int LOG2_ARRAY_LONG_INDEX_SCALE = exactLog2(Unsafe.ARRAY_LONG_INDEX_SCALE);
+ private static final int LOG2_ARRAY_FLOAT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_FLOAT_INDEX_SCALE);
+ private static final int LOG2_ARRAY_DOUBLE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_DOUBLE_INDEX_SCALE);
+
+ private static final int LOG2_BYTE_BIT_SIZE = exactLog2(Byte.SIZE);
+
+ private static int exactLog2(int scale) {
+ if ((scale & (scale - 1)) != 0)
+ throw new Error("data type scale not a power of two");
+ return Integer.numberOfTrailingZeros(scale);
+ }
+
+ private ArraysSupport() {}
+
+ /**
+ * Find the relative index of the first mismatching pair of elements in two
+ * primitive arrays of the same component type. Pairs of elements will be
+ * tested in order relative to given offsets into both arrays.
+ *
+ * <p>This method does not perform type checks or bounds checks. It is the
+ * responsibility of the caller to perform such checks before calling this
+ * method.
+ *
+ * <p>The given offsets, in bytes, need not be aligned according to the
+ * given log<sub>2</sub> size the array elements. More specifically, an
+ * offset modulus the size need not be zero.
+ *
+ * @param a the first array to be tested for mismatch, or {@code null} for
+ * direct memory access
+ * @param aOffset the relative offset, in bytes, from the base address of
+ * the first array to test from, otherwise if the first array is
+ * {@code null}, an absolute address pointing to the first element to test.
+ * @param b the second array to be tested for mismatch, or {@code null} for
+ * direct memory access
+ * @param bOffset the relative offset, in bytes, from the base address of
+ * the second array to test from, otherwise if the second array is
+ * {@code null}, an absolute address pointing to the first element to test.
+ * @param length the number of array elements to test
+ * @param log2ArrayIndexScale log<sub>2</sub> of the array index scale, that
+ * corresponds to the size, in bytes, of an array element.
+ * @return if a mismatch is found a relative index, between 0 (inclusive)
+ * and {@code length} (exclusive), of the first mismatching pair of elements
+ * in the two arrays. Otherwise, if a mismatch is not found the bitwise
+ * compliment of the number of remaining pairs of elements to be checked in
+ * the tail of the two arrays.
+ */
+ @HotSpotIntrinsicCandidate
+ static int vectorizedMismatch(Object a, long aOffset,
+ Object b, long bOffset,
+ int length,
+ int log2ArrayIndexScale) {
+ // assert a.getClass().isArray();
+ // assert b.getClass().isArray();
+ // assert 0 <= length <= sizeOf(a)
+ // assert 0 <= length <= sizeOf(b)
+ // assert 0 <= log2ArrayIndexScale <= 3
+
+ int log2ValuesPerWidth = LOG2_ARRAY_LONG_INDEX_SCALE - log2ArrayIndexScale;
+ int wi = 0;
+ for (; wi < length >> log2ValuesPerWidth; wi++) {
+ long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE;
+ long av = U.getLongUnaligned(a, aOffset + bi);
+ long bv = U.getLongUnaligned(b, bOffset + bi);
+ if (av != bv) {
+ long x = av ^ bv;
+ int o = BIG_ENDIAN
+ ? Long.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale)
+ : Long.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale);
+ return (wi << log2ValuesPerWidth) + o;
+ }
+ }
+
+ // Calculate the tail of remaining elements to check
+ int tail = length - (wi << log2ValuesPerWidth);
+
+ if (log2ArrayIndexScale < LOG2_ARRAY_INT_INDEX_SCALE) {
+ int wordTail = 1 << (LOG2_ARRAY_INT_INDEX_SCALE - log2ArrayIndexScale);
+ // Handle 4 bytes or 2 chars in the tail using int width
+ if (tail >= wordTail) {
+ long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE;
+ int av = U.getIntUnaligned(a, aOffset + bi);
+ int bv = U.getIntUnaligned(b, bOffset + bi);
+ if (av != bv) {
+ int x = av ^ bv;
+ int o = BIG_ENDIAN
+ ? Integer.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale)
+ : Integer.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale);
+ return (wi << log2ValuesPerWidth) + o;
+ }
+ tail -= wordTail;
+ }
+ return ~tail;
+ }
+ else {
+ return ~tail;
+ }
+ }
+
+ // Booleans
+ // Each boolean element takes up one byte
+
+ static int mismatch(boolean[] a,
+ boolean[] b,
+ int length) {
+ int i = 0;
+ if (length > 7) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
+ b, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
+ length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(boolean[] a, int aFromIndex,
+ boolean[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 7) {
+ int aOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + aFromIndex;
+ int bOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + bFromIndex;
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Bytes
+
+ /**
+ * Find the index of a mismatch between two arrays.
+ *
+ * <p>This method does not perform bounds checks. It is the responsibility
+ * of the caller to perform such bounds checks before calling this method.
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param b the second array to be tested for a mismatch
+ * @param length the number of bytes from each array to check
+ * @return the index of a mismatch between the two arrays, otherwise -1 if
+ * no mismatch. The index will be within the range of (inclusive) 0 to
+ * (exclusive) the smaller of the two array lengths.
+ */
+ static int mismatch(byte[] a,
+ byte[] b,
+ int length) {
+ // ISSUE: defer to index receiving methods if performance is good
+ // assert length <= a.length
+ // assert length <= b.length
+
+ int i = 0;
+ if (length > 7) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_BYTE_BASE_OFFSET,
+ b, Unsafe.ARRAY_BYTE_BASE_OFFSET,
+ length, LOG2_ARRAY_BYTE_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ // Align to tail
+ i = length - ~i;
+// assert i >= 0 && i <= 7;
+ }
+ // Tail < 8 bytes
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ /**
+ * Find the relative index of a mismatch between two arrays starting from
+ * given indexes.
+ *
+ * <p>This method does not perform bounds checks. It is the responsibility
+ * of the caller to perform such bounds checks before calling this method.
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param aFromIndex the index of the first element (inclusive) in the first
+ * array to be compared
+ * @param b the second array to be tested for a mismatch
+ * @param bFromIndex the index of the first element (inclusive) in the
+ * second array to be compared
+ * @param length the number of bytes from each array to check
+ * @return the relative index of a mismatch between the two arrays,
+ * otherwise -1 if no mismatch. The index will be within the range of
+ * (inclusive) 0 to (exclusive) the smaller of the two array bounds.
+ */
+ static int mismatch(byte[] a, int aFromIndex,
+ byte[] b, int bFromIndex,
+ int length) {
+ // assert 0 <= aFromIndex < a.length
+ // assert 0 <= aFromIndex + length <= a.length
+ // assert 0 <= bFromIndex < b.length
+ // assert 0 <= bFromIndex + length <= b.length
+ // assert length >= 0
+
+ int i = 0;
+ if (length > 7) {
+ int aOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + aFromIndex;
+ int bOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + bFromIndex;
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_BYTE_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Chars
+
+ static int mismatch(char[] a,
+ char[] b,
+ int length) {
+ int i = 0;
+ if (length > 3) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_CHAR_BASE_OFFSET,
+ b, Unsafe.ARRAY_CHAR_BASE_OFFSET,
+ length, LOG2_ARRAY_CHAR_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(char[] a, int aFromIndex,
+ char[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 3) {
+ int aOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_CHAR_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Shorts
+
+ static int mismatch(short[] a,
+ short[] b,
+ int length) {
+ int i = 0;
+ if (length > 3) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_SHORT_BASE_OFFSET,
+ b, Unsafe.ARRAY_SHORT_BASE_OFFSET,
+ length, LOG2_ARRAY_SHORT_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(short[] a, int aFromIndex,
+ short[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 3) {
+ int aOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_SHORT_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Ints
+
+ static int mismatch(int[] a,
+ int[] b,
+ int length) {
+ int i = 0;
+ if (length > 1) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_INT_BASE_OFFSET,
+ b, Unsafe.ARRAY_INT_BASE_OFFSET,
+ length, LOG2_ARRAY_INT_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(int[] a, int aFromIndex,
+ int[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 1) {
+ int aOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_INT_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Floats
+
+ static int mismatch(float[] a,
+ float[] b,
+ int length) {
+ return mismatch(a, 0, b, 0, length);
+ }
+
+ static int mismatch(float[] a, int aFromIndex,
+ float[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 1) {
+ int aOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_FLOAT_INDEX_SCALE);
+ // Mismatched
+ if (i >= 0) {
+ // Check if mismatch is not associated with two NaN values
+ if (!Float.isNaN(a[aFromIndex + i]) || !Float.isNaN(b[bFromIndex + i]))
+ return i;
+
+ // Mismatch on two different NaN values that are normalized to match
+ // Fall back to slow mechanism
+ // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
+ // However, requires that returned value be relative to input ranges
+ i++;
+ }
+ // Matched
+ else {
+ i = length - ~i;
+ }
+ }
+ for (; i < length; i++) {
+ if (Float.floatToIntBits(a[aFromIndex + i]) != Float.floatToIntBits(b[bFromIndex + i]))
+ return i;
+ }
+ return -1;
+ }
+
+ // 64 bit sizes
+
+ // Long
+
+ static int mismatch(long[] a,
+ long[] b,
+ int length) {
+ if (length == 0) {
+ return -1;
+ }
+ int i = vectorizedMismatch(
+ a, Unsafe.ARRAY_LONG_BASE_OFFSET,
+ b, Unsafe.ARRAY_LONG_BASE_OFFSET,
+ length, LOG2_ARRAY_LONG_INDEX_SCALE);
+ return i >= 0 ? i : -1;
+ }
+
+ static int mismatch(long[] a, int aFromIndex,
+ long[] b, int bFromIndex,
+ int length) {
+ if (length == 0) {
+ return -1;
+ }
+ int aOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
+ int i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_LONG_INDEX_SCALE);
+ return i >= 0 ? i : -1;
+ }
+
+
+ // Double
+
+ static int mismatch(double[] a,
+ double[] b,
+ int length) {
+ return mismatch(a, 0, b, 0, length);
+ }
+
+ static int mismatch(double[] a, int aFromIndex,
+ double[] b, int bFromIndex,
+ int length) {
+ if (length == 0) {
+ return -1;
+ }
+ int aOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+ int i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+ if (i >= 0) {
+ // Check if mismatch is not associated with two NaN values
+ if (!Double.isNaN(a[aFromIndex + i]) || !Double.isNaN(b[bFromIndex + i]))
+ return i;
+
+ // Mismatch on two different NaN values that are normalized to match
+ // Fall back to slow mechanism
+ // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
+ // However, requires that returned value be relative to input ranges
+ i++;
+ for (; i < length; i++) {
+ if (Double.doubleToLongBits(a[aFromIndex + i]) != Double.doubleToLongBits(b[bFromIndex + i]))
+ return i;
+ }
+ }
+
+ return -1;
+ }
+}
--- a/jdk/src/java.base/share/classes/java/util/Enumeration.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/Enumeration.java Thu Jan 21 10:17:21 2016 -0800
@@ -112,7 +112,7 @@
*
* @return an Iterator representing the remaining elements of this Enumeration
*
- * @since 1.9
+ * @since 9
*/
default Iterator<E> asIterator() {
return new Iterator<>() {
--- a/jdk/src/java.base/share/classes/java/util/Scanner.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/Scanner.java Thu Jan 21 10:17:21 2016 -0800
@@ -2684,7 +2684,7 @@
*
* @return a sequential stream of token strings
* @throws IllegalStateException if this scanner is closed
- * @since 1.9
+ * @since 9
*/
public Stream<String> tokens() {
ensureOpen();
@@ -2770,7 +2770,7 @@
* @return a sequential stream of match results
* @throws NullPointerException if pattern is null
* @throws IllegalStateException if this scanner is closed
- * @since 1.9
+ * @since 9
*/
public Stream<MatchResult> findAll(Pattern pattern) {
Objects.requireNonNull(pattern);
@@ -2792,7 +2792,7 @@
* @throws NullPointerException if patString is null
* @throws IllegalStateException if this scanner is closed
* @throws PatternSyntaxException if the regular expression's syntax is invalid
- * @since 1.9
+ * @since 9
* @see java.util.regex.Pattern
*/
public Stream<MatchResult> findAll(String patString) {
--- a/jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java Thu Jan 21 10:17:21 2016 -0800
@@ -2429,7 +2429,7 @@
*
* @param <U> the type of the value
* @return a new CompletableFuture
- * @since 1.9
+ * @since 9
*/
public <U> CompletableFuture<U> newIncompleteFuture() {
return new CompletableFuture<U>();
@@ -2444,7 +2444,7 @@
* an Executor that provides at least one independent thread.
*
* @return the executor
- * @since 1.9
+ * @since 9
*/
public Executor defaultExecutor() {
return ASYNC_POOL;
@@ -2462,7 +2462,7 @@
* arrange dependent actions.
*
* @return the new CompletableFuture
- * @since 1.9
+ * @since 9
*/
public CompletableFuture<T> copy() {
return uniCopyStage();
@@ -2479,7 +2479,7 @@
* cause.
*
* @return the new CompletionStage
- * @since 1.9
+ * @since 9
*/
public CompletionStage<T> minimalCompletionStage() {
return uniAsMinimalStage();
@@ -2494,7 +2494,7 @@
* to complete this CompletableFuture
* @param executor the executor to use for asynchronous execution
* @return this CompletableFuture
- * @since 1.9
+ * @since 9
*/
public CompletableFuture<T> completeAsync(Supplier<? extends T> supplier,
Executor executor) {
@@ -2512,7 +2512,7 @@
* @param supplier a function returning the value to be used
* to complete this CompletableFuture
* @return this CompletableFuture
- * @since 1.9
+ * @since 9
*/
public CompletableFuture<T> completeAsync(Supplier<? extends T> supplier) {
return completeAsync(supplier, defaultExecutor());
@@ -2528,7 +2528,7 @@
* @param unit a {@code TimeUnit} determining how to interpret the
* {@code timeout} parameter
* @return this CompletableFuture
- * @since 1.9
+ * @since 9
*/
public CompletableFuture<T> orTimeout(long timeout, TimeUnit unit) {
if (unit == null)
@@ -2549,7 +2549,7 @@
* @param unit a {@code TimeUnit} determining how to interpret the
* {@code timeout} parameter
* @return this CompletableFuture
- * @since 1.9
+ * @since 9
*/
public CompletableFuture<T> completeOnTimeout(T value, long timeout,
TimeUnit unit) {
@@ -2573,7 +2573,7 @@
* {@code delay} parameter
* @param executor the base executor
* @return the new delayed executor
- * @since 1.9
+ * @since 9
*/
public static Executor delayedExecutor(long delay, TimeUnit unit,
Executor executor) {
@@ -2592,7 +2592,7 @@
* @param unit a {@code TimeUnit} determining how to interpret the
* {@code delay} parameter
* @return the new delayed executor
- * @since 1.9
+ * @since 9
*/
public static Executor delayedExecutor(long delay, TimeUnit unit) {
if (unit == null)
@@ -2608,7 +2608,7 @@
* @param value the value
* @param <U> the type of the value
* @return the completed CompletionStage
- * @since 1.9
+ * @since 9
*/
public static <U> CompletionStage<U> completedStage(U value) {
return new MinimalStage<U>((value == null) ? NIL : value);
@@ -2621,7 +2621,7 @@
* @param ex the exception
* @param <U> the type of the value
* @return the exceptionally completed CompletableFuture
- * @since 1.9
+ * @since 9
*/
public static <U> CompletableFuture<U> failedFuture(Throwable ex) {
if (ex == null) throw new NullPointerException();
@@ -2636,7 +2636,7 @@
* @param ex the exception
* @param <U> the type of the value
* @return the exceptionally completed CompletionStage
- * @since 1.9
+ * @since 9
*/
public static <U> CompletionStage<U> failedStage(Throwable ex) {
if (ex == null) throw new NullPointerException();
--- a/jdk/src/java.base/share/classes/java/util/concurrent/Flow.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/Flow.java Thu Jan 21 10:17:21 2016 -0800
@@ -161,7 +161,7 @@
* }}</pre>
*
* @author Doug Lea
- * @since 1.9
+ * @since 9
*/
public final class Flow {
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinTask.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinTask.java Thu Jan 21 10:17:21 2016 -0800
@@ -1301,7 +1301,7 @@
* support extensions, and is unlikely to be useful otherwise.
*
* @return a task, or {@code null} if none are available
- * @since 1.9
+ * @since 9
*/
protected static ForkJoinTask<?> pollSubmission() {
Thread t;
--- a/jdk/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java Thu Jan 21 10:17:21 2016 -0800
@@ -154,7 +154,7 @@
*
* @param <T> the published item type
* @author Doug Lea
- * @since 1.9
+ * @since 9
*/
public class SubmissionPublisher<T> implements Flow.Publisher<T>,
AutoCloseable {
--- a/jdk/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java Thu Jan 21 10:17:21 2016 -0800
@@ -39,6 +39,7 @@
import java.util.Collection;
import java.util.Date;
import java.util.concurrent.TimeUnit;
+import jdk.internal.vm.annotation.ReservedStackAccess;
/**
* Provides a framework for implementing blocking locks and related
@@ -886,6 +887,7 @@
* @param arg the acquire argument
* @return {@code true} if interrupted while waiting
*/
+ @ReservedStackAccess
final boolean acquireQueued(final Node node, int arg) {
try {
boolean interrupted = false;
@@ -1218,6 +1220,7 @@
* {@link #tryAcquire} but is otherwise uninterpreted and
* can represent anything you like.
*/
+ @ReservedStackAccess
public final void acquire(int arg) {
if (!tryAcquire(arg) &&
acquireQueued(addWaiter(Node.EXCLUSIVE), arg))
@@ -1281,6 +1284,7 @@
* can represent anything you like.
* @return the value returned from {@link #tryRelease}
*/
+ @ReservedStackAccess
public final boolean release(int arg) {
if (tryRelease(arg)) {
Node h = head;
@@ -1361,6 +1365,7 @@
* and can represent anything you like.
* @return the value returned from {@link #tryReleaseShared}
*/
+ @ReservedStackAccess
public final boolean releaseShared(int arg) {
if (tryReleaseShared(arg)) {
doReleaseShared();
--- a/jdk/src/java.base/share/classes/java/util/concurrent/locks/ReentrantLock.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/locks/ReentrantLock.java Thu Jan 21 10:17:21 2016 -0800
@@ -37,6 +37,7 @@
import java.util.Collection;
import java.util.concurrent.TimeUnit;
+import jdk.internal.vm.annotation.ReservedStackAccess;
/**
* A reentrant mutual exclusion {@link Lock} with the same basic
@@ -127,6 +128,7 @@
* Performs non-fair tryLock. tryAcquire is implemented in
* subclasses, but both need nonfair try for trylock method.
*/
+ @ReservedStackAccess
final boolean nonfairTryAcquire(int acquires) {
final Thread current = Thread.currentThread();
int c = getState();
@@ -146,6 +148,7 @@
return false;
}
+ @ReservedStackAccess
protected final boolean tryRelease(int releases) {
int c = getState() - releases;
if (Thread.currentThread() != getExclusiveOwnerThread())
@@ -203,6 +206,7 @@
* Performs lock. Try immediate barge, backing up to normal
* acquire on failure.
*/
+ @ReservedStackAccess
final void lock() {
if (compareAndSetState(0, 1))
setExclusiveOwnerThread(Thread.currentThread());
@@ -229,6 +233,7 @@
* Fair version of tryAcquire. Don't grant access unless
* recursive call or no waiters or is first.
*/
+ @ReservedStackAccess
protected final boolean tryAcquire(int acquires) {
final Thread current = Thread.currentThread();
int c = getState();
--- a/jdk/src/java.base/share/classes/java/util/regex/Matcher.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/regex/Matcher.java Thu Jan 21 10:17:21 2016 -0800
@@ -974,7 +974,7 @@
* @throws IndexOutOfBoundsException
* If the replacement string refers to a capturing group
* that does not exist in the pattern
- * @since 1.9
+ * @since 9
*/
public Matcher appendReplacement(StringBuilder sb, String replacement) {
// If no match, return error
@@ -1117,7 +1117,7 @@
*
* @return The target string builder
*
- * @since 1.9
+ * @since 9
*/
public StringBuilder appendTail(StringBuilder sb) {
sb.append(text, lastAppendPosition, getTextLength());
@@ -1229,7 +1229,7 @@
* @throws ConcurrentModificationException if it is detected, on a
* best-effort basis, that the replacer function modified this
* matcher's state
- * @since 1.9
+ * @since 9
*/
public String replaceAll(Function<MatchResult, String> replacer) {
Objects.requireNonNull(replacer);
@@ -1273,7 +1273,7 @@
* modification is detected.
*
* @return a sequential stream of match results.
- * @since 1.9
+ * @since 9
*/
public Stream<MatchResult> results() {
class MatchResultIterator implements Iterator<MatchResult> {
@@ -1451,7 +1451,7 @@
* @throws ConcurrentModificationException if it is detected, on a
* best-effort basis, that the replacer function modified this
* matcher's state
- * @since 1.9
+ * @since 9
*/
public String replaceFirst(Function<MatchResult, String> replacer) {
Objects.requireNonNull(replacer);
--- a/jdk/src/java.base/share/classes/java/util/stream/DoubleStream.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/stream/DoubleStream.java Thu Jan 21 10:17:21 2016 -0800
@@ -329,7 +329,7 @@
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
- * @since 1.9
+ * @since 9
*/
default DoubleStream takeWhile(DoublePredicate predicate) {
Objects.requireNonNull(predicate);
@@ -396,7 +396,7 @@
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
- * @since 1.9
+ * @since 9
*/
default DoubleStream dropWhile(DoublePredicate predicate) {
Objects.requireNonNull(predicate);
--- a/jdk/src/java.base/share/classes/java/util/stream/IntStream.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/stream/IntStream.java Thu Jan 21 10:17:21 2016 -0800
@@ -326,7 +326,7 @@
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
- * @since 1.9
+ * @since 9
*/
default IntStream takeWhile(IntPredicate predicate) {
Objects.requireNonNull(predicate);
@@ -392,7 +392,7 @@
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
- * @since 1.9
+ * @since 9
*/
default IntStream dropWhile(IntPredicate predicate) {
Objects.requireNonNull(predicate);
--- a/jdk/src/java.base/share/classes/java/util/stream/LongStream.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/stream/LongStream.java Thu Jan 21 10:17:21 2016 -0800
@@ -327,7 +327,7 @@
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
- * @since 1.9
+ * @since 9
*/
default LongStream takeWhile(LongPredicate predicate) {
Objects.requireNonNull(predicate);
@@ -394,7 +394,7 @@
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
- * @since 1.9
+ * @since 9
*/
default LongStream dropWhile(LongPredicate predicate) {
Objects.requireNonNull(predicate);
--- a/jdk/src/java.base/share/classes/java/util/stream/Stream.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/stream/Stream.java Thu Jan 21 10:17:21 2016 -0800
@@ -533,7 +533,7 @@
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
- * @since 1.9
+ * @since 9
*/
default Stream<T> takeWhile(Predicate<? super T> predicate) {
Objects.requireNonNull(predicate);
@@ -599,7 +599,7 @@
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
- * @since 1.9
+ * @since 9
*/
default Stream<T> dropWhile(Predicate<? super T> predicate) {
Objects.requireNonNull(predicate);
@@ -1146,7 +1146,7 @@
* @param <T> the type of stream elements
* @return a stream with a single element if the specified element
* is non-null, otherwise an empty stream
- * @since 1.9
+ * @since 9
*/
public static<T> Stream<T> ofNullable(T t) {
return t == null ? Stream.empty()
--- a/jdk/src/java.base/share/classes/java/util/stream/WhileOps.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/stream/WhileOps.java Thu Jan 21 10:17:21 2016 -0800
@@ -43,7 +43,7 @@
* Factory for instances of a takeWhile and dropWhile operations
* that produce subsequences of their input stream.
*
- * @since 1.9
+ * @since 9
*/
final class WhileOps {
--- a/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java Thu Jan 21 10:17:21 2016 -0800
@@ -44,7 +44,7 @@
* {@link NullPointerException} to be thrown.
* </p>
*
- * @since 1.9
+ * @since 9
*/
public final class CRC32C implements Checksum {
--- a/jdk/src/java.base/share/classes/java/util/zip/Checksum.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/zip/Checksum.java Thu Jan 21 10:17:21 2016 -0800
@@ -51,7 +51,7 @@
* @throws NullPointerException
* if {@code b} is {@code null}
*
- * @since 1.9
+ * @since 9
*/
default public void update(byte[] b) {
update(b, 0, b.length);
@@ -99,7 +99,7 @@
* @throws NullPointerException
* if {@code buffer} is {@code null}
*
- * @since 1.9
+ * @since 9
*/
default public void update(ByteBuffer buffer) {
int pos = buffer.position();
--- a/jdk/src/java.base/share/classes/java/util/zip/ZipEntry.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/util/zip/ZipEntry.java Thu Jan 21 10:17:21 2016 -0800
@@ -220,7 +220,7 @@
* The last modification time of the entry in local date-time
*
* @see #getTimeLocal()
- * @since 1.9
+ * @since 9
*/
public void setTimeLocal(LocalDateTime time) {
int year = time.getYear() - 1980;
@@ -259,7 +259,7 @@
* @return The last modification time of the entry in local date-time
*
* @see #setTimeLocal(LocalDateTime)
- * @since 1.9
+ * @since 9
*/
public LocalDateTime getTimeLocal() {
if (mtime != null) {
--- a/jdk/src/java.base/share/classes/jdk/internal/HotSpotIntrinsicCandidate.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/jdk/internal/HotSpotIntrinsicCandidate.java Thu Jan 21 10:17:21 2016 -0800
@@ -117,7 +117,7 @@
* and that (2) for all methods of that class annotated with
* {@code @HotSpotIntrinsicCandidate} there is an intrinsic in the list.
*
- * @since 1.9
+ * @since 9
*/
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
@Retention(RetentionPolicy.RUNTIME)
--- a/jdk/src/java.base/share/classes/jdk/internal/logger/package-info.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/jdk/internal/logger/package-info.java Thu Jan 21 10:17:21 2016 -0800
@@ -63,6 +63,6 @@
* @see sun.util.logging.PlatformLogger.Bridge
* @see sun.util.logging.internal
*
- * @since 1.9
+ * @since 9
*/
package jdk.internal.logger;
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Thu Jan 21 10:17:21 2016 -0800
@@ -1081,7 +1081,7 @@
* @return the value fetched from the indicated object
* @throws RuntimeException No defined exceptions are thrown, not even
* {@link NullPointerException}
- * @since 1.9
+ * @since 9
*/
@HotSpotIntrinsicCandidate
public final long getLongUnaligned(Object o, long offset) {
@@ -1115,7 +1115,7 @@
* @param offset The offset in bytes from the start of the object
* @param bigEndian The endianness of the value
* @return the value fetched from the indicated object
- * @since 1.9
+ * @since 9
*/
public final long getLongUnaligned(Object o, long offset, boolean bigEndian) {
return convEndian(bigEndian, getLongUnaligned(o, offset));
@@ -1193,7 +1193,7 @@
* @param x the value to store
* @throws RuntimeException No defined exceptions are thrown, not even
* {@link NullPointerException}
- * @since 1.9
+ * @since 9
*/
@HotSpotIntrinsicCandidate
public final void putLongUnaligned(Object o, long offset, long x) {
@@ -1231,7 +1231,7 @@
* @param bigEndian The endianness of the value
* @throws RuntimeException No defined exceptions are thrown, not even
* {@link NullPointerException}
- * @since 1.9
+ * @since 9
*/
public final void putLongUnaligned(Object o, long offset, long x, boolean bigEndian) {
putLongUnaligned(o, offset, convEndian(bigEndian, x));
--- a/jdk/src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java Thu Jan 21 10:17:21 2016 -0800
@@ -26,6 +26,7 @@
package jdk.internal.ref;
import java.lang.ref.Cleaner;
+import java.lang.ref.Reference;
import java.lang.ref.PhantomReference;
import java.util.Objects;
@@ -66,9 +67,9 @@
this.list = CleanerImpl.getCleanerImpl(cleaner).phantomCleanableList;
insert();
- // TODO: Replace getClass() with ReachabilityFence when it is available
- cleaner.getClass();
- referent.getClass();
+ // Ensure referent and cleaner remain accessible
+ Reference.reachabilityFence(referent);
+ Reference.reachabilityFence(cleaner);
}
/**
--- a/jdk/src/java.base/share/classes/jdk/internal/ref/SoftCleanable.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/SoftCleanable.java Thu Jan 21 10:17:21 2016 -0800
@@ -26,6 +26,7 @@
package jdk.internal.ref;
import java.lang.ref.Cleaner;
+import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
import java.util.Objects;
@@ -66,9 +67,9 @@
list = CleanerImpl.getCleanerImpl(cleaner).softCleanableList;
insert();
- // TODO: Replace getClass() with ReachabilityFence when it is available
- cleaner.getClass();
- referent.getClass();
+ // Ensure referent and cleaner remain accessible
+ Reference.reachabilityFence(referent);
+ Reference.reachabilityFence(cleaner);
}
/**
--- a/jdk/src/java.base/share/classes/jdk/internal/ref/WeakCleanable.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/WeakCleanable.java Thu Jan 21 10:17:21 2016 -0800
@@ -26,6 +26,7 @@
*/
import java.lang.ref.Cleaner;
+import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Objects;
@@ -66,9 +67,10 @@
list = CleanerImpl.getCleanerImpl(cleaner).weakCleanableList;
insert();
- // TODO: Replace getClass() with ReachabilityFence when it is available
- cleaner.getClass();
- referent.getClass();
+ // Ensure referent and cleaner remain accessible
+ Reference.reachabilityFence(referent);
+ Reference.reachabilityFence(cleaner);
+
}
/**
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/DontInline.java Thu Jan 21 10:17:21 2016 -0800
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012, 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 jdk.internal.vm.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * A method or constructor may be annotated as "don't inline" if the inlining of
+ * this method should not be performed by the HotSpot VM.
+ * <p>
+ * This annotation must be used sparingly. It is useful when the only
+ * reasonable alternative is to bind the name of a specific method or
+ * constructor into the HotSpot VM for special handling by the inlining policy.
+ * This annotation must not be relied on as an alternative to avoid tuning the
+ * VM's inlining policy. In a few cases, it may act as a temporary workaround
+ * until the profiling and inlining performed by the HotSpot VM is sufficiently
+ * improved.
+ *
+ * @implNote
+ * This annotation only takes effect for methods or constructors of classes
+ * loaded by the boot loader. Annotations on methods or constructors of classes
+ * loaded outside of the boot loader are ignored.
+ */
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface DontInline {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/ForceInline.java Thu Jan 21 10:17:21 2016 -0800
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2012, 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 jdk.internal.vm.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * A method or constructor may be annotated as "force inline" if the standard
+ * inlining metrics are to be ignored when the HotSpot VM inlines the method
+ * or constructor.
+ * <p>
+ * This annotation must be used sparingly. It is useful when the only
+ * reasonable alternative is to bind the name of a specific method or
+ * constructor into the HotSpot VM for special handling by the inlining policy.
+ * This annotation must not be relied on as an alternative to avoid tuning the
+ * VM's inlining policy. In a few cases, it may act as a temporary workaround
+ * until the profiling and inlining performed by the HotSpot VM is sufficiently
+ * improved.
+ *
+ * @implNote
+ * This annotation only takes effect for methods or constructors of classes
+ * loaded by the boot loader. Annotations on methods or constructors of classes
+ * loaded outside of the boot loader are ignored.
+ */
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ForceInline {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/ReservedStackAccess.java Thu Jan 21 10:17:21 2016 -0800
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, 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 jdk.internal.vm.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <p>An annotation expressing that a method is especially sensitive
+ * to stack overflows. This is a hint the JVM can use to grant access to
+ * extra stack space when executing this code if such feature is supported
+ * by the JVM. The JVM is free to ignore this annotation.
+ *
+ * A possible way for the JVM to improve the execution context for methods
+ * with this annotation is to reserve part of the thread's execution stack
+ * for them. Access to this section of the stack would be denied by default
+ * but could be granted if the JVM detects a possible stack overflow and
+ * the thread's call stack includes at least one annotated method. Even if
+ * access to this reserved area has been granted, the JVM might decide to
+ * throw a delayed StackOverflowError when the thread exits the annotated
+ * method.
+ *
+ * @since 1.9
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+public @interface ReservedStackAccess { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/Stable.java Thu Jan 21 10:17:21 2016 -0800
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2012, 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 jdk.internal.vm.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * A field may be annotated as stable if all of its component variables
+ * changes value at most once.
+ * A field's value counts as its component value.
+ * If the field is typed as an array, then all the non-null components
+ * of the array, of depth up to the rank of the field's array type,
+ * also count as component values.
+ * By extension, any variable (either array or field) which has annotated
+ * as stable is called a stable variable, and its non-null or non-zero
+ * value is called a stable value.
+ * <p>
+ * Since all fields begin with a default value of null for references
+ * (resp., zero for primitives), it follows that this annotation indicates
+ * that the first non-null (resp., non-zero) value stored in the field
+ * will never be changed.
+ * <p>
+ * If the field is not of an array type, there are no array elements,
+ * then the value indicated as stable is simply the value of the field.
+ * If the dynamic type of the field value is an array but the static type
+ * is not, the components of the array are <em>not</em> regarded as stable.
+ * <p>
+ * If the field is an array type, then both the field value and
+ * all the components of the field value (if the field value is non-null)
+ * are indicated to be stable.
+ * If the field type is an array type with rank {@code N > 1},
+ * then each component of the field value (if the field value is non-null),
+ * is regarded as a stable array of rank {@code N-1}.
+ * <p>
+ * Fields which are declared {@code final} may also be annotated as stable.
+ * Since final fields already behave as stable values, such an annotation
+ * conveys no additional information regarding change of the field's value, but
+ * still conveys information regarding change of additional components values if
+ * the type of the field is an array type (as described above).
+ * <p>
+ * The HotSpot VM relies on this annotation to promote a non-null (resp.,
+ * non-zero) component value to a constant, thereby enabling superior
+ * optimizations of code depending on such a value (such as constant folding).
+ * More specifically, the HotSpot VM will process non-null stable fields (final
+ * or otherwise) in a similar manner to static final fields with respect to
+ * promoting the field's value to a constant. Thus, placing aside the
+ * differences for null/non-null values and arrays, a final stable field is
+ * treated as if it is really final from both the Java language and the HotSpot
+ * VM.
+ * <p>
+ * It is (currently) undefined what happens if a field annotated as stable
+ * is given a third value (by explicitly updating a stable field, a component of
+ * a stable array, or a final stable field via reflection or other means).
+ * Since the HotSpot VM promotes a non-null component value to constant, it may
+ * be that the Java memory model would appear to be broken, if such a constant
+ * (the second value of the field) is used as the value of the field even after
+ * the field value has changed (to a third value).
+ *
+ * @implNote
+ * This annotation only takes effect for fields of classes loaded by the boot
+ * loader. Annoations on fields of classes loaded outside of the boot loader
+ * are ignored.
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Stable {
+}
--- a/jdk/src/java.base/share/classes/sun/invoke/anon/AnonymousClassLoader.java Thu Jan 21 09:46:03 2016 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,234 +0,0 @@
-/*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.invoke.anon;
-
-import java.io.EOFException;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-/**
- * Anonymous class loader. Will load any valid classfile, producing
- * a {@link Class} metaobject, without installing that class in the
- * system dictionary. Therefore, {@link Class#forName(String)} will never
- * produce a reference to an anonymous class.
- * <p>
- * The access permissions of the anonymous class are borrowed from
- * a <em>host class</em>. The new class behaves as if it were an
- * inner class of the host class. It can access the host's private
- * members, if the creator of the class loader has permission to
- * do so (or to create accessible reflective objects).
- * <p>
- * When the anonymous class is loaded, elements of its constant pool
- * can be patched to new values. This provides a hook to pre-resolve
- * named classes in the constant pool to other classes, including
- * anonymous ones. Also, string constants can be pre-resolved to
- * any reference. (The verifier treats non-string, non-class reference
- * constants as plain objects.)
- * <p>
- * Why include the patching function? It makes some use cases much easier.
- * Second, the constant pool needed some internal patching anyway,
- * to anonymize the loaded class itself. Finally, if you are going
- * to use this seriously, you'll want to build anonymous classes
- * on top of pre-existing anonymous classes, and that requires patching.
- *
- * <p>%%% TO-DO:
- * <ul>
- * <li>needs better documentation</li>
- * <li>needs more security work (for safe delegation)</li>
- * <li>needs a clearer story about error processing</li>
- * <li>patch member references also (use ';' as delimiter char)</li>
- * <li>patch method references to (conforming) method handles</li>
- * </ul>
- *
- * @author jrose
- * @author Remi Forax
- * @see <a href="http://blogs.sun.com/jrose/entry/anonymous_classes_in_the_vm">
- * http://blogs.sun.com/jrose/entry/anonymous_classes_in_the_vm</a>
- */
-
-public class AnonymousClassLoader {
- final Class<?> hostClass;
-
- // Privileged constructor.
- private AnonymousClassLoader(Class<?> hostClass) {
- this.hostClass = hostClass;
- }
-
- public static AnonymousClassLoader make(jdk.internal.misc.Unsafe unsafe, Class<?> hostClass) {
- if (unsafe == null) throw new NullPointerException();
- return new AnonymousClassLoader(hostClass);
- }
-
- public Class<?> loadClass(byte[] classFile) {
- if (defineAnonymousClass == null) {
- // no JVM support; try to fake an approximation
- try {
- return fakeLoadClass(new ConstantPoolParser(classFile).createPatch());
- } catch (InvalidConstantPoolFormatException ee) {
- throw new IllegalArgumentException(ee);
- }
- }
- return loadClass(classFile, null);
- }
-
- public Class<?> loadClass(ConstantPoolPatch classPatch) {
- if (defineAnonymousClass == null) {
- // no JVM support; try to fake an approximation
- return fakeLoadClass(classPatch);
- }
- Object[] patches = classPatch.patchArray;
- // Convert class names (this late in the game)
- // to use slash '/' instead of dot '.'.
- // Java likes dots, but the JVM likes slashes.
- for (int i = 0; i < patches.length; i++) {
- Object value = patches[i];
- if (value != null) {
- byte tag = classPatch.getTag(i);
- switch (tag) {
- case ConstantPoolVisitor.CONSTANT_Class:
- if (value instanceof String) {
- if (patches == classPatch.patchArray)
- patches = patches.clone();
- patches[i] = ((String)value).replace('.', '/');
- }
- break;
- case ConstantPoolVisitor.CONSTANT_Fieldref:
- case ConstantPoolVisitor.CONSTANT_Methodref:
- case ConstantPoolVisitor.CONSTANT_InterfaceMethodref:
- case ConstantPoolVisitor.CONSTANT_NameAndType:
- // When/if the JVM supports these patches,
- // we'll probably need to reformat them also.
- // Meanwhile, let the class loader create the error.
- break;
- }
- }
- }
- return loadClass(classPatch.outer.classFile, classPatch.patchArray);
- }
-
- private Class<?> loadClass(byte[] classFile, Object[] patchArray) {
- try {
- return (Class<?>)
- defineAnonymousClass.invoke(unsafe,
- hostClass, classFile, patchArray);
- } catch (Exception ex) {
- throwReflectedException(ex);
- throw new RuntimeException("error loading into "+hostClass, ex);
- }
- }
-
- private static void throwReflectedException(Exception ex) {
- if (ex instanceof InvocationTargetException) {
- Throwable tex = ((InvocationTargetException)ex).getTargetException();
- if (tex instanceof Error)
- throw (Error) tex;
- ex = (Exception) tex;
- }
- if (ex instanceof RuntimeException) {
- throw (RuntimeException) ex;
- }
- }
-
- private Class<?> fakeLoadClass(ConstantPoolPatch classPatch) {
- // Implementation:
- // 1. Make up a new name nobody has used yet.
- // 2. Inspect the tail-header of the class to find the this_class index.
- // 3. Patch the CONSTANT_Class for this_class to the new name.
- // 4. Add other CP entries required by (e.g.) string patches.
- // 5. Flatten Class constants down to their names, making sure that
- // the host class loader can pick them up again accurately.
- // 6. Generate the edited class file bytes.
- //
- // Potential limitations:
- // * The class won't be truly anonymous, and may interfere with others.
- // * Flattened class constants might not work, because of loader issues.
- // * Pseudo-string constants will not flatten down to real strings.
- // * Method handles will (of course) fail to flatten to linkage strings.
- if (true) throw new UnsupportedOperationException("NYI");
- Object[] cpArray;
- try {
- cpArray = classPatch.getOriginalCP();
- } catch (InvalidConstantPoolFormatException ex) {
- throw new RuntimeException(ex);
- }
- int thisClassIndex = classPatch.getParser().getThisClassIndex();
- String thisClassName = (String) cpArray[thisClassIndex];
- synchronized (AnonymousClassLoader.class) {
- thisClassName = thisClassName+"\\|"+(++fakeNameCounter);
- }
- classPatch.putUTF8(thisClassIndex, thisClassName);
- byte[] classFile = null;
- return unsafe.defineClass(null, classFile, 0, classFile.length,
- hostClass.getClassLoader(),
- hostClass.getProtectionDomain());
- }
- private static int fakeNameCounter = 99999;
-
- // ignore two warnings on this line:
- private static jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
- // preceding line requires that this class be on the boot class path
-
- private static final Method defineAnonymousClass;
- static {
- Method dac = null;
- Class<? extends jdk.internal.misc.Unsafe> unsafeClass = unsafe.getClass();
- try {
- dac = unsafeClass.getMethod("defineAnonymousClass",
- Class.class,
- byte[].class,
- Object[].class);
- } catch (Exception ee) {
- dac = null;
- }
- defineAnonymousClass = dac;
- }
-
- private static void noJVMSupport() {
- throw new UnsupportedOperationException("no JVM support for anonymous classes");
- }
-
-
- private static native Class<?> loadClassInternal(Class<?> hostClass,
- byte[] classFile,
- Object[] patchArray);
-
- public static byte[] readClassFile(Class<?> templateClass) throws IOException {
- String templateName = templateClass.getName();
- int lastDot = templateName.lastIndexOf('.');
- java.net.URL url = templateClass.getResource(templateName.substring(lastDot+1)+".class");
- java.net.URLConnection connection = url.openConnection();
- int contentLength = connection.getContentLength();
- if (contentLength < 0)
- throw new IOException("invalid content length "+contentLength);
-
- byte[] b = connection.getInputStream().readAllBytes();
- if (b.length != contentLength)
- throw new EOFException("Expected:" + contentLength + ", read:" + b.length);
-
- return b;
- }
-}
--- a/jdk/src/java.base/share/classes/sun/invoke/anon/ConstantPoolParser.java Thu Jan 21 09:46:03 2016 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,368 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.invoke.anon;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.nio.BufferUnderflowException;
-import java.nio.ByteBuffer;
-
-import static sun.invoke.anon.ConstantPoolVisitor.*;
-
-/** A constant pool parser.
- */
-public class ConstantPoolParser {
- final byte[] classFile;
- final byte[] tags;
- final char[] firstHeader; // maghi, maglo, minor, major, cplen
-
- // these are filled in on first parse:
- int endOffset;
- char[] secondHeader; // flags, this_class, super_class, intlen
-
- // used to decode UTF8 array
- private char[] charArray = new char[80];
-
- /** Creates a constant pool parser.
- * @param classFile an array of bytes containing a class.
- * @throws InvalidConstantPoolFormatException if the header of the class has errors.
- */
- public ConstantPoolParser(byte[] classFile) throws InvalidConstantPoolFormatException {
- this.classFile = classFile;
- this.firstHeader = parseHeader(classFile);
- this.tags = new byte[firstHeader[4]];
- }
-
- /** Create a constant pool parser by loading the bytecodes of the
- * class taken as argument.
- *
- * @param templateClass the class to parse.
- *
- * @throws IOException raised if an I/O occurs when loading
- * the bytecode of the template class.
- * @throws InvalidConstantPoolFormatException if the header of the class has errors.
- *
- * @see #ConstantPoolParser(byte[])
- * @see AnonymousClassLoader#readClassFile(Class)
- */
- public ConstantPoolParser(Class<?> templateClass) throws IOException, InvalidConstantPoolFormatException {
- this(AnonymousClassLoader.readClassFile(templateClass));
- }
-
- /** Creates an empty patch to patch the class file
- * used by the current parser.
- * @return a new class patch.
- */
- public ConstantPoolPatch createPatch() {
- return new ConstantPoolPatch(this);
- }
-
- /** Report the tag of the indicated CP entry.
- * @param index
- * @return one of {@link ConstantPoolVisitor#CONSTANT_Utf8}, etc.
- */
- public byte getTag(int index) {
- getEndOffset(); // trigger an exception if we haven't parsed yet
- return tags[index];
- }
-
- /** Report the length of the constant pool. */
- public int getLength() {
- return firstHeader[4];
- }
-
- /** Report the offset, within the class file, of the start of the constant pool. */
- public int getStartOffset() {
- return firstHeader.length * 2;
- }
-
- /** Report the offset, within the class file, of the end of the constant pool. */
- public int getEndOffset() {
- if (endOffset == 0)
- throw new IllegalStateException("class file has not yet been parsed");
- return endOffset;
- }
-
- /** Report the CP index of this class's own name. */
- public int getThisClassIndex() {
- getEndOffset(); // provoke exception if not yet parsed
- return secondHeader[1];
- }
-
- /** Report the total size of the class file. */
- public int getTailLength() {
- return classFile.length - getEndOffset();
- }
-
- /** Write the head (header plus constant pool)
- * of the class file to the indicated stream.
- */
- public void writeHead(OutputStream out) throws IOException {
- out.write(classFile, 0, getEndOffset());
- }
-
- /** Write the head (header plus constant pool)
- * of the class file to the indicated stream,
- * incorporating the non-null entries of the given array
- * as patches.
- */
- void writePatchedHead(OutputStream out, Object[] patchArray) {
- // this will be useful to partially emulate the class loader on old JVMs
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
- /** Write the tail (everything after the constant pool)
- * of the class file to the indicated stream.
- */
- public void writeTail(OutputStream out) throws IOException {
- out.write(classFile, getEndOffset(), getTailLength());
- }
-
- private static char[] parseHeader(byte[] classFile) throws InvalidConstantPoolFormatException {
- char[] result = new char[5];
- ByteBuffer buffer = ByteBuffer.wrap(classFile);
- for (int i = 0; i < result.length; i++)
- result[i] = (char) getUnsignedShort(buffer);
- int magic = result[0] << 16 | result[1] << 0;
- if (magic != 0xCAFEBABE)
- throw new InvalidConstantPoolFormatException("invalid magic number "+magic);
- // skip major, minor version
- int len = result[4];
- if (len < 1)
- throw new InvalidConstantPoolFormatException("constant pool length < 1");
- return result;
- }
-
- /** Parse the constant pool of the class
- * calling a method visit* each time a constant pool entry is parsed.
- *
- * The order of the calls to visit* is not guaranteed to be the same
- * than the order of the constant pool entry in the bytecode array.
- *
- * @param visitor
- * @throws InvalidConstantPoolFormatException
- */
- public void parse(ConstantPoolVisitor visitor) throws InvalidConstantPoolFormatException {
- ByteBuffer buffer = ByteBuffer.wrap(classFile);
- buffer.position(getStartOffset()); //skip header
-
- Object[] values = new Object[getLength()];
- try {
- parseConstantPool(buffer, values, visitor);
- } catch(BufferUnderflowException e) {
- throw new InvalidConstantPoolFormatException(e);
- }
- if (endOffset == 0) {
- endOffset = buffer.position();
- secondHeader = new char[4];
- for (int i = 0; i < secondHeader.length; i++) {
- secondHeader[i] = (char) getUnsignedShort(buffer);
- }
- }
- resolveConstantPool(values, visitor);
- }
-
- private char[] getCharArray(int utfLength) {
- if (utfLength <= charArray.length)
- return charArray;
- return charArray = new char[utfLength];
- }
-
- private void parseConstantPool(ByteBuffer buffer, Object[] values, ConstantPoolVisitor visitor) throws InvalidConstantPoolFormatException {
- for (int i = 1; i < tags.length; ) {
- byte tag = (byte) getUnsignedByte(buffer);
- assert(tags[i] == 0 || tags[i] == tag);
- tags[i] = tag;
- switch (tag) {
- case CONSTANT_Utf8:
- int utfLen = getUnsignedShort(buffer);
- String value = getUTF8(buffer, utfLen, getCharArray(utfLen));
- visitor.visitUTF8(i, CONSTANT_Utf8, value);
- tags[i] = tag;
- values[i++] = value;
- break;
- case CONSTANT_Integer:
- visitor.visitConstantValue(i, tag, buffer.getInt());
- i++;
- break;
- case CONSTANT_Float:
- visitor.visitConstantValue(i, tag, buffer.getFloat());
- i++;
- break;
- case CONSTANT_Long:
- visitor.visitConstantValue(i, tag, buffer.getLong());
- i+=2;
- break;
- case CONSTANT_Double:
- visitor.visitConstantValue(i, tag, buffer.getDouble());
- i+=2;
- break;
-
- case CONSTANT_Class: // fall through:
- case CONSTANT_String:
- tags[i] = tag;
- values[i++] = new int[] { getUnsignedShort(buffer) };
- break;
-
- case CONSTANT_Fieldref: // fall through:
- case CONSTANT_Methodref: // fall through:
- case CONSTANT_InterfaceMethodref: // fall through:
- case CONSTANT_NameAndType:
- tags[i] = tag;
- values[i++] = new int[] { getUnsignedShort(buffer), getUnsignedShort(buffer) };
- break;
- default:
- throw new AssertionError("invalid constant "+tag);
- }
- }
- }
-
- private void resolveConstantPool(Object[] values, ConstantPoolVisitor visitor) {
- // clean out the int[] values, which are temporary
- for (int beg = 1, end = values.length-1, beg2, end2;
- beg <= end;
- beg = beg2, end = end2) {
- beg2 = end; end2 = beg-1;
- //System.out.println("CP resolve pass: "+beg+".."+end);
- for (int i = beg; i <= end; i++) {
- Object value = values[i];
- if (!(value instanceof int[]))
- continue;
- int[] array = (int[]) value;
- byte tag = tags[i];
- switch (tag) {
- case CONSTANT_String:
- String stringBody = (String) values[array[0]];
- visitor.visitConstantString(i, tag, stringBody, array[0]);
- values[i] = null;
- break;
- case CONSTANT_Class: {
- String className = (String) values[array[0]];
- // use the external form favored by Class.forName:
- className = className.replace('/', '.');
- visitor.visitConstantString(i, tag, className, array[0]);
- values[i] = className;
- break;
- }
- case CONSTANT_NameAndType: {
- String memberName = (String) values[array[0]];
- String signature = (String) values[array[1]];
- visitor.visitDescriptor(i, tag, memberName, signature,
- array[0], array[1]);
- values[i] = new String[] {memberName, signature};
- break;
- }
- case CONSTANT_Fieldref: // fall through:
- case CONSTANT_Methodref: // fall through:
- case CONSTANT_InterfaceMethodref: {
- Object className = values[array[0]];
- Object nameAndType = values[array[1]];
- if (!(className instanceof String) ||
- !(nameAndType instanceof String[])) {
- // one more pass is needed
- if (beg2 > i) beg2 = i;
- if (end2 < i) end2 = i;
- continue;
- }
- String[] nameAndTypeArray = (String[]) nameAndType;
- visitor.visitMemberRef(i, tag,
- (String)className,
- nameAndTypeArray[0],
- nameAndTypeArray[1],
- array[0], array[1]);
- values[i] = null;
- }
- break;
- default:
- continue;
- }
- }
- }
- }
-
- private static int getUnsignedByte(ByteBuffer buffer) {
- return buffer.get() & 0xFF;
- }
-
- private static int getUnsignedShort(ByteBuffer buffer) {
- int b1 = getUnsignedByte(buffer);
- int b2 = getUnsignedByte(buffer);
- return (b1 << 8) + (b2 << 0);
- }
-
- private static String getUTF8(ByteBuffer buffer, int utfLen, char[] charArray) throws InvalidConstantPoolFormatException {
- int utfLimit = buffer.position() + utfLen;
- int index = 0;
- while (buffer.position() < utfLimit) {
- int c = buffer.get() & 0xff;
- if (c > 127) {
- buffer.position(buffer.position() - 1);
- return getUTF8Extended(buffer, utfLimit, charArray, index);
- }
- charArray[index++] = (char)c;
- }
- return new String(charArray, 0, index);
- }
-
- private static String getUTF8Extended(ByteBuffer buffer, int utfLimit, char[] charArray, int index) throws InvalidConstantPoolFormatException {
- int c, c2, c3;
- while (buffer.position() < utfLimit) {
- c = buffer.get() & 0xff;
- switch (c >> 4) {
- case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
- /* 0xxxxxxx*/
- charArray[index++] = (char)c;
- break;
- case 12: case 13:
- /* 110x xxxx 10xx xxxx*/
- c2 = buffer.get();
- if ((c2 & 0xC0) != 0x80)
- throw new InvalidConstantPoolFormatException(
- "malformed input around byte " + buffer.position());
- charArray[index++] = (char)(((c & 0x1F) << 6) |
- (c2 & 0x3F));
- break;
- case 14:
- /* 1110 xxxx 10xx xxxx 10xx xxxx */
- c2 = buffer.get();
- c3 = buffer.get();
- if (((c2 & 0xC0) != 0x80) || ((c3 & 0xC0) != 0x80))
- throw new InvalidConstantPoolFormatException(
- "malformed input around byte " + (buffer.position()));
- charArray[index++] = (char)(((c & 0x0F) << 12) |
- ((c2 & 0x3F) << 6) |
- ((c3 & 0x3F) << 0));
- break;
- default:
- /* 10xx xxxx, 1111 xxxx */
- throw new InvalidConstantPoolFormatException(
- "malformed input around byte " + buffer.position());
- }
- }
- // The number of chars produced may be less than utflen
- return new String(charArray, 0, index);
- }
-}
--- a/jdk/src/java.base/share/classes/sun/invoke/anon/ConstantPoolPatch.java Thu Jan 21 09:46:03 2016 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,503 +0,0 @@
-/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.invoke.anon;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.IdentityHashMap;
-import java.util.Map;
-
-import static sun.invoke.anon.ConstantPoolVisitor.*;
-
-/** A class and its patched constant pool.
- *
- * This class allow to modify (patch) a constant pool
- * by changing the value of its entry.
- * Entry are referenced using index that can be get
- * by parsing the constant pool using
- * {@link ConstantPoolParser#parse(ConstantPoolVisitor)}.
- *
- * @see ConstantPoolVisitor
- * @see ConstantPoolParser#createPatch()
- */
-public class ConstantPoolPatch {
- final ConstantPoolParser outer;
- final Object[] patchArray;
-
- ConstantPoolPatch(ConstantPoolParser outer) {
- this.outer = outer;
- this.patchArray = new Object[outer.getLength()];
- }
-
- /** Create a {@link ConstantPoolParser} and
- * a {@link ConstantPoolPatch} in one step.
- * Equivalent to {@code new ConstantPoolParser(classFile).createPatch()}.
- *
- * @param classFile an array of bytes containing a class.
- * @see #ConstantPoolParser(Class)
- */
- public ConstantPoolPatch(byte[] classFile) throws InvalidConstantPoolFormatException {
- this(new ConstantPoolParser(classFile));
- }
-
- /** Create a {@link ConstantPoolParser} and
- * a {@link ConstantPoolPatch} in one step.
- * Equivalent to {@code new ConstantPoolParser(templateClass).createPatch()}.
- *
- * @param templateClass the class to parse.
- * @see #ConstantPoolParser(Class)
- */
- public ConstantPoolPatch(Class<?> templateClass) throws IOException, InvalidConstantPoolFormatException {
- this(new ConstantPoolParser(templateClass));
- }
-
-
- /** Creates a patch from an existing patch.
- * All changes are copied from that patch.
- * @param patch a patch
- *
- * @see ConstantPoolParser#createPatch()
- */
- public ConstantPoolPatch(ConstantPoolPatch patch) {
- outer = patch.outer;
- patchArray = patch.patchArray.clone();
- }
-
- /** Which parser built this patch? */
- public ConstantPoolParser getParser() {
- return outer;
- }
-
- /** Report the tag at the given index in the constant pool. */
- public byte getTag(int index) {
- return outer.getTag(index);
- }
-
- /** Report the current patch at the given index of the constant pool.
- * Null means no patch will be made.
- * To observe the unpatched entry at the given index, use
- * {@link #getParser()}{@code .}@link ConstantPoolParser#parse(ConstantPoolVisitor)}
- */
- public Object getPatch(int index) {
- Object value = patchArray[index];
- if (value == null) return null;
- switch (getTag(index)) {
- case CONSTANT_Fieldref:
- case CONSTANT_Methodref:
- case CONSTANT_InterfaceMethodref:
- if (value instanceof String)
- value = stripSemis(2, (String) value);
- break;
- case CONSTANT_NameAndType:
- if (value instanceof String)
- value = stripSemis(1, (String) value);
- break;
- }
- return value;
- }
-
- /** Clear all patches. */
- public void clear() {
- Arrays.fill(patchArray, null);
- }
-
- /** Clear one patch. */
- public void clear(int index) {
- patchArray[index] = null;
- }
-
- /** Produce the patches as an array. */
- public Object[] getPatches() {
- return patchArray.clone();
- }
-
- /** Produce the original constant pool as an array. */
- public Object[] getOriginalCP() throws InvalidConstantPoolFormatException {
- return getOriginalCP(0, patchArray.length, -1);
- }
-
- /** Walk the constant pool, applying patches using the given map.
- *
- * @param utf8Map Utf8 strings to modify, if encountered
- * @param classMap Classes (or their names) to modify, if encountered
- * @param valueMap Constant values to modify, if encountered
- * @param deleteUsedEntries if true, delete map entries that are used
- */
- public void putPatches(final Map<String,String> utf8Map,
- final Map<String,Object> classMap,
- final Map<Object,Object> valueMap,
- boolean deleteUsedEntries) throws InvalidConstantPoolFormatException {
- final HashSet<String> usedUtf8Keys;
- final HashSet<String> usedClassKeys;
- final HashSet<Object> usedValueKeys;
- if (deleteUsedEntries) {
- usedUtf8Keys = (utf8Map == null) ? null : new HashSet<String>();
- usedClassKeys = (classMap == null) ? null : new HashSet<String>();
- usedValueKeys = (valueMap == null) ? null : new HashSet<Object>();
- } else {
- usedUtf8Keys = null;
- usedClassKeys = null;
- usedValueKeys = null;
- }
-
- outer.parse(new ConstantPoolVisitor() {
-
- @Override
- public void visitUTF8(int index, byte tag, String utf8) {
- putUTF8(index, utf8Map.get(utf8));
- if (usedUtf8Keys != null) usedUtf8Keys.add(utf8);
- }
-
- @Override
- public void visitConstantValue(int index, byte tag, Object value) {
- putConstantValue(index, tag, valueMap.get(value));
- if (usedValueKeys != null) usedValueKeys.add(value);
- }
-
- @Override
- public void visitConstantString(int index, byte tag, String name, int nameIndex) {
- if (tag == CONSTANT_Class) {
- putConstantValue(index, tag, classMap.get(name));
- if (usedClassKeys != null) usedClassKeys.add(name);
- } else {
- assert(tag == CONSTANT_String);
- visitConstantValue(index, tag, name);
- }
- }
- });
- if (usedUtf8Keys != null) utf8Map.keySet().removeAll(usedUtf8Keys);
- if (usedClassKeys != null) classMap.keySet().removeAll(usedClassKeys);
- if (usedValueKeys != null) valueMap.keySet().removeAll(usedValueKeys);
- }
-
- Object[] getOriginalCP(final int startIndex,
- final int endIndex,
- final int tagMask) throws InvalidConstantPoolFormatException {
- final Object[] cpArray = new Object[endIndex - startIndex];
- outer.parse(new ConstantPoolVisitor() {
-
- void show(int index, byte tag, Object value) {
- if (index < startIndex || index >= endIndex) return;
- if (((1 << tag) & tagMask) == 0) return;
- cpArray[index - startIndex] = value;
- }
-
- @Override
- public void visitUTF8(int index, byte tag, String utf8) {
- show(index, tag, utf8);
- }
-
- @Override
- public void visitConstantValue(int index, byte tag, Object value) {
- assert(tag != CONSTANT_String);
- show(index, tag, value);
- }
-
- @Override
- public void visitConstantString(int index, byte tag,
- String value, int j) {
- show(index, tag, value);
- }
-
- @Override
- public void visitMemberRef(int index, byte tag,
- String className, String memberName,
- String signature,
- int j, int k) {
- show(index, tag, new String[]{ className, memberName, signature });
- }
-
- @Override
- public void visitDescriptor(int index, byte tag,
- String memberName, String signature,
- int j, int k) {
- show(index, tag, new String[]{ memberName, signature });
- }
- });
- return cpArray;
- }
-
- /** Write the head (header plus constant pool)
- * of the patched class file to the indicated stream.
- */
- void writeHead(OutputStream out) throws IOException {
- outer.writePatchedHead(out, patchArray);
- }
-
- /** Write the tail (everything after the constant pool)
- * of the patched class file to the indicated stream.
- */
- void writeTail(OutputStream out) throws IOException {
- outer.writeTail(out);
- }
-
- private void checkConstantTag(byte tag, Object value) {
- if (value == null)
- throw new IllegalArgumentException(
- "invalid null constant value");
- if (classForTag(tag) != value.getClass())
- throw new IllegalArgumentException(
- "invalid constant value"
- + (tag == CONSTANT_None ? ""
- : " for tag "+tagName(tag))
- + " of class "+value.getClass());
- }
-
- private void checkTag(int index, byte putTag) {
- byte tag = outer.tags[index];
- if (tag != putTag)
- throw new IllegalArgumentException(
- "invalid put operation"
- + " for " + tagName(putTag)
- + " at index " + index + " found " + tagName(tag));
- }
-
- private void checkTagMask(int index, int tagBitMask) {
- byte tag = outer.tags[index];
- int tagBit = ((tag & 0x1F) == tag) ? (1 << tag) : 0;
- if ((tagBit & tagBitMask) == 0)
- throw new IllegalArgumentException(
- "invalid put operation"
- + " at index " + index + " found " + tagName(tag));
- }
-
- private static void checkMemberName(String memberName) {
- if (memberName.indexOf(';') >= 0)
- throw new IllegalArgumentException("memberName " + memberName + " contains a ';'");
- }
-
- /** Set the entry of the constant pool indexed by index to
- * a new string.
- *
- * @param index an index to a constant pool entry containing a
- * {@link ConstantPoolVisitor#CONSTANT_Utf8} value.
- * @param utf8 a string
- *
- * @see ConstantPoolVisitor#visitUTF8(int, byte, String)
- */
- public void putUTF8(int index, String utf8) {
- if (utf8 == null) { clear(index); return; }
- checkTag(index, CONSTANT_Utf8);
- patchArray[index] = utf8;
- }
-
- /** Set the entry of the constant pool indexed by index to
- * a new value, depending on its dynamic type.
- *
- * @param index an index to a constant pool entry containing a
- * one of the following structures:
- * {@link ConstantPoolVisitor#CONSTANT_Integer},
- * {@link ConstantPoolVisitor#CONSTANT_Float},
- * {@link ConstantPoolVisitor#CONSTANT_Long},
- * {@link ConstantPoolVisitor#CONSTANT_Double},
- * {@link ConstantPoolVisitor#CONSTANT_String}, or
- * {@link ConstantPoolVisitor#CONSTANT_Class}
- * @param value a boxed int, float, long or double; or a string or class object
- * @throws IllegalArgumentException if the type of the constant does not
- * match the constant pool entry type,
- * as reported by {@link #getTag(int)}
- *
- * @see #putConstantValue(int, byte, Object)
- * @see ConstantPoolVisitor#visitConstantValue(int, byte, Object)
- * @see ConstantPoolVisitor#visitConstantString(int, byte, String, int)
- */
- public void putConstantValue(int index, Object value) {
- if (value == null) { clear(index); return; }
- byte tag = tagForConstant(value.getClass());
- checkConstantTag(tag, value);
- checkTag(index, tag);
- patchArray[index] = value;
- }
-
- /** Set the entry of the constant pool indexed by index to
- * a new value.
- *
- * @param index an index to a constant pool entry matching the given tag
- * @param tag one of the following values:
- * {@link ConstantPoolVisitor#CONSTANT_Integer},
- * {@link ConstantPoolVisitor#CONSTANT_Float},
- * {@link ConstantPoolVisitor#CONSTANT_Long},
- * {@link ConstantPoolVisitor#CONSTANT_Double},
- * {@link ConstantPoolVisitor#CONSTANT_String}, or
- * {@link ConstantPoolVisitor#CONSTANT_Class}
- * @param value a boxed number, string, or class object
- * @throws IllegalArgumentException if the type of the constant does not
- * match the constant pool entry type, or if a class name contains
- * '/' or ';'
- *
- * @see #putConstantValue(int, Object)
- * @see ConstantPoolVisitor#visitConstantValue(int, byte, Object)
- * @see ConstantPoolVisitor#visitConstantString(int, byte, String, int)
- */
- public void putConstantValue(int index, byte tag, Object value) {
- if (value == null) { clear(index); return; }
- checkTag(index, tag);
- if (tag == CONSTANT_Class && value instanceof String) {
- checkClassName((String) value);
- } else if (tag == CONSTANT_String) {
- // the JVM accepts any object as a patch for a string
- } else {
- // make sure the incoming value is the right type
- checkConstantTag(tag, value);
- }
- checkTag(index, tag);
- patchArray[index] = value;
- }
-
- /** Set the entry of the constant pool indexed by index to
- * a new {@link ConstantPoolVisitor#CONSTANT_NameAndType} value.
- *
- * @param index an index to a constant pool entry containing a
- * {@link ConstantPoolVisitor#CONSTANT_NameAndType} value.
- * @param memberName a memberName
- * @param signature a signature
- * @throws IllegalArgumentException if memberName contains the character ';'
- *
- * @see ConstantPoolVisitor#visitDescriptor(int, byte, String, String, int, int)
- */
- public void putDescriptor(int index, String memberName, String signature) {
- checkTag(index, CONSTANT_NameAndType);
- checkMemberName(memberName);
- patchArray[index] = addSemis(memberName, signature);
- }
-
- /** Set the entry of the constant pool indexed by index to
- * a new {@link ConstantPoolVisitor#CONSTANT_Fieldref},
- * {@link ConstantPoolVisitor#CONSTANT_Methodref}, or
- * {@link ConstantPoolVisitor#CONSTANT_InterfaceMethodref} value.
- *
- * @param index an index to a constant pool entry containing a member reference
- * @param className a class name
- * @param memberName a field or method name
- * @param signature a field or method signature
- * @throws IllegalArgumentException if memberName contains the character ';'
- * or signature is not a correct signature
- *
- * @see ConstantPoolVisitor#visitMemberRef(int, byte, String, String, String, int, int)
- */
- public void putMemberRef(int index, byte tag,
- String className, String memberName, String signature) {
- checkTagMask(tag, CONSTANT_MemberRef_MASK);
- checkTag(index, tag);
- checkClassName(className);
- checkMemberName(memberName);
- if (signature.startsWith("(") == (tag == CONSTANT_Fieldref))
- throw new IllegalArgumentException("bad signature: "+signature);
- patchArray[index] = addSemis(className, memberName, signature);
- }
-
- private static final int CONSTANT_MemberRef_MASK =
- CONSTANT_Fieldref
- | CONSTANT_Methodref
- | CONSTANT_InterfaceMethodref;
-
- private static final Map<Class<?>, Byte> CONSTANT_VALUE_CLASS_TAG
- = new IdentityHashMap<Class<?>, Byte>(6);
- private static final Class<?>[] CONSTANT_VALUE_CLASS = new Class<?>[16];
- static {
- Object[][] values = {
- {Integer.class, CONSTANT_Integer},
- {Long.class, CONSTANT_Long},
- {Float.class, CONSTANT_Float},
- {Double.class, CONSTANT_Double},
- {String.class, CONSTANT_String},
- {Class.class, CONSTANT_Class}
- };
- for (Object[] value : values) {
- Class<?> cls = (Class<?>)value[0];
- Byte tag = (Byte) value[1];
- CONSTANT_VALUE_CLASS_TAG.put(cls, tag);
- CONSTANT_VALUE_CLASS[(byte)tag] = cls;
- }
- }
-
- static Class<?> classForTag(byte tag) {
- if ((tag & 0xFF) >= CONSTANT_VALUE_CLASS.length)
- return null;
- return CONSTANT_VALUE_CLASS[tag];
- }
-
- static byte tagForConstant(Class<?> cls) {
- Byte tag = CONSTANT_VALUE_CLASS_TAG.get(cls);
- return (tag == null) ? CONSTANT_None : (byte)tag;
- }
-
- private static void checkClassName(String className) {
- if (className.indexOf('/') >= 0 || className.indexOf(';') >= 0)
- throw new IllegalArgumentException("invalid class name " + className);
- }
-
- static String addSemis(String name, String... names) {
- StringBuilder buf = new StringBuilder(name.length() * 5);
- buf.append(name);
- for (String name2 : names) {
- buf.append(';').append(name2);
- }
- String res = buf.toString();
- assert(stripSemis(names.length, res)[0].equals(name));
- assert(stripSemis(names.length, res)[1].equals(names[0]));
- assert(names.length == 1 ||
- stripSemis(names.length, res)[2].equals(names[1]));
- return res;
- }
-
- static String[] stripSemis(int count, String string) {
- String[] res = new String[count+1];
- int pos = 0;
- for (int i = 0; i < count; i++) {
- int pos2 = string.indexOf(';', pos);
- if (pos2 < 0) pos2 = string.length(); // yuck
- res[i] = string.substring(pos, pos2);
- pos = pos2;
- }
- res[count] = string.substring(pos);
- return res;
- }
-
- public String toString() {
- StringBuilder buf = new StringBuilder(this.getClass().getName());
- buf.append("{");
- Object[] origCP = null;
- for (int i = 0; i < patchArray.length; i++) {
- if (patchArray[i] == null) continue;
- if (origCP != null) {
- buf.append(", ");
- } else {
- try {
- origCP = getOriginalCP();
- } catch (InvalidConstantPoolFormatException ee) {
- origCP = new Object[0];
- }
- }
- Object orig = (i < origCP.length) ? origCP[i] : "?";
- buf.append(orig).append("=").append(patchArray[i]);
- }
- buf.append("}");
- return buf.toString();
- }
-}
--- a/jdk/src/java.base/share/classes/sun/invoke/anon/ConstantPoolVisitor.java Thu Jan 21 09:46:03 2016 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.invoke.anon;
-
-/**
- * A visitor called by {@link ConstantPoolParser#parse(ConstantPoolVisitor)}
- * when a constant pool entry is parsed.
- * <p>
- * A visit* method is called when a constant pool entry is parsed.
- * The first argument is always the constant pool index.
- * The second argument is always the constant pool tag,
- * even for methods like {@link #visitUTF8(int, byte, String)} which only apply to one tag.
- * String arguments refer to Utf8 or NameAndType entries declared elsewhere,
- * and are always accompanied by the indexes of those entries.
- * <p>
- * The order of the calls to the visit* methods is not necessarily related
- * to the order of the entries in the constant pool.
- * If one entry has a reference to another entry, the latter (lower-level)
- * entry will be visited first.
- * <p>
- * The following table shows the relation between constant pool entry
- * types and the corresponding visit* methods:
- *
- * <table border=1 cellpadding=5 summary="constant pool visitor methods">
- * <tr><th>Tag(s)</th><th>Method</th></tr>
- * <tr>
- * <td>{@link #CONSTANT_Utf8}</td>
- * <td>{@link #visitUTF8(int, byte, String)}</td>
- * </tr><tr>
- * <td>{@link #CONSTANT_Integer}, {@link #CONSTANT_Float},
- * {@link #CONSTANT_Long}, {@link #CONSTANT_Double}</td>
- * <td>{@link #visitConstantValue(int, byte, Object)}</td>
- * </tr><tr>
- * <td>{@link #CONSTANT_String}, {@link #CONSTANT_Class}</td>
- * <td>{@link #visitConstantString(int, byte, String, int)}</td>
- * </tr><tr>
- * <td>{@link #CONSTANT_NameAndType}</td>
- * <td>{@link #visitDescriptor(int, byte, String, String, int, int)}</td>
- * </tr><tr>
- * <td>{@link #CONSTANT_Fieldref},
- * {@link #CONSTANT_Methodref},
- * {@link #CONSTANT_InterfaceMethodref}</td>
- * <td>{@link #visitMemberRef(int, byte, String, String, String, int, int)}</td>
- * </tr>
- * </table>
- *
- * @see ConstantPoolPatch
- * @author Remi Forax
- * @author jrose
- */
-public class ConstantPoolVisitor {
- /** Called each time an UTF8 constant pool entry is found.
- * @param index the constant pool index
- * @param tag always {@link #CONSTANT_Utf8}
- * @param utf8 string encoded in modified UTF-8 format passed as a {@code String}
- *
- * @see ConstantPoolPatch#putUTF8(int, String)
- */
- public void visitUTF8(int index, byte tag, String utf8) {
- // do nothing
- }
-
- /** Called for each constant pool entry that encodes an integer,
- * a float, a long, or a double.
- * Constant strings and classes are not managed by this method but
- * by {@link #visitConstantString(int, byte, String, int)}.
- *
- * @param index the constant pool index
- * @param tag one of {@link #CONSTANT_Integer},
- * {@link #CONSTANT_Float},
- * {@link #CONSTANT_Long},
- * or {@link #CONSTANT_Double}
- * @param value encoded value
- *
- * @see ConstantPoolPatch#putConstantValue(int, Object)
- */
- public void visitConstantValue(int index, byte tag, Object value) {
- // do nothing
- }
-
- /** Called for each constant pool entry that encodes a string or a class.
- * @param index the constant pool index
- * @param tag one of {@link #CONSTANT_String},
- * {@link #CONSTANT_Class},
- * @param name string body or class name (using dot separator)
- * @param nameIndex the index of the Utf8 string for the name
- *
- * @see ConstantPoolPatch#putConstantValue(int, byte, Object)
- */
- public void visitConstantString(int index, byte tag,
- String name, int nameIndex) {
- // do nothing
- }
-
- /** Called for each constant pool entry that encodes a name and type.
- * @param index the constant pool index
- * @param tag always {@link #CONSTANT_NameAndType}
- * @param memberName a field or method name
- * @param signature the member signature
- * @param memberNameIndex index of the Utf8 string for the member name
- * @param signatureIndex index of the Utf8 string for the signature
- *
- * @see ConstantPoolPatch#putDescriptor(int, String, String)
- */
- public void visitDescriptor(int index, byte tag,
- String memberName, String signature,
- int memberNameIndex, int signatureIndex) {
- // do nothing
- }
-
- /** Called for each constant pool entry that encodes a field or method.
- * @param index the constant pool index
- * @param tag one of {@link #CONSTANT_Fieldref},
- * or {@link #CONSTANT_Methodref},
- * or {@link #CONSTANT_InterfaceMethodref}
- * @param className the class name (using dot separator)
- * @param memberName name of the field or method
- * @param signature the field or method signature
- * @param classNameIndex index of the Utf8 string for the class name
- * @param descriptorIndex index of the NameAndType descriptor constant
- *
- * @see ConstantPoolPatch#putMemberRef(int, byte, String, String, String)
- */
- public void visitMemberRef(int index, byte tag,
- String className, String memberName, String signature,
- int classNameIndex, int descriptorIndex) {
- // do nothing
- }
-
- public static final byte
- CONSTANT_None = 0,
- CONSTANT_Utf8 = 1,
- //CONSTANT_Unicode = 2, /* unused */
- CONSTANT_Integer = 3,
- CONSTANT_Float = 4,
- CONSTANT_Long = 5,
- CONSTANT_Double = 6,
- CONSTANT_Class = 7,
- CONSTANT_String = 8,
- CONSTANT_Fieldref = 9,
- CONSTANT_Methodref = 10,
- CONSTANT_InterfaceMethodref = 11,
- CONSTANT_NameAndType = 12;
-
- private static String[] TAG_NAMES = {
- "Empty",
- "Utf8",
- null, //"Unicode",
- "Integer",
- "Float",
- "Long",
- "Double",
- "Class",
- "String",
- "Fieldref",
- "Methodref",
- "InterfaceMethodref",
- "NameAndType"
- };
-
- public static String tagName(byte tag) {
- String name = null;
- if ((tag & 0xFF) < TAG_NAMES.length)
- name = TAG_NAMES[tag];
- if (name == null)
- name = "Unknown#"+(tag&0xFF);
- return name;
- }
-}
--- a/jdk/src/java.base/share/classes/sun/invoke/anon/InvalidConstantPoolFormatException.java Thu Jan 21 09:46:03 2016 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.invoke.anon;
-
-/** Exception used when there is an error in the constant pool
- * format.
- */
-public class InvalidConstantPoolFormatException extends Exception {
- private static final long serialVersionUID=-6103888330523770949L;
-
- public InvalidConstantPoolFormatException(String message,Throwable cause) {
- super(message,cause);
- }
-
- public InvalidConstantPoolFormatException(String message) {
- super(message);
- }
-
- public InvalidConstantPoolFormatException(Throwable cause) {
- super(cause);
- }
-}
--- a/jdk/src/java.base/share/classes/sun/misc/ClassFileTransformer.java Thu Jan 21 09:46:03 2016 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.misc;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This is an abstract base class originally intended to be called by
- * {@code java.lang.ClassLoader} when {@code ClassFormatError} is
- * thrown inside {@code defineClass()}. It is no longer hooked into
- * {@code ClassLoader} and will be removed in a future release.
- *
- * @author Stanley Man-Kit Ho
- */
-
-@Deprecated
-public abstract class ClassFileTransformer {
-
- private static final List<ClassFileTransformer> transformers
- = new ArrayList<ClassFileTransformer>();
-
- /**
- * Add the class file transformer object.
- *
- * @param t Class file transformer instance
- */
- public static void add(ClassFileTransformer t) {
- synchronized (transformers) {
- transformers.add(t);
- }
- }
-
- /**
- * Get the array of ClassFileTransformer object.
- *
- * @return ClassFileTransformer object array
- */
- public static ClassFileTransformer[] getTransformers() {
- synchronized (transformers) {
- ClassFileTransformer[] result = new ClassFileTransformer[transformers.size()];
- return transformers.toArray(result);
- }
- }
-
-
- /**
- * Transform a byte array from one to the other.
- *
- * @param b Byte array
- * @param off Offset
- * @param len Length of byte array
- * @return Transformed byte array
- */
- public abstract byte[] transform(byte[] b, int off, int len)
- throws ClassFormatError;
-}
--- a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java Thu Jan 21 10:17:21 2016 -0800
@@ -25,14 +25,13 @@
package sun.misc;
-import java.lang.reflect.Field;
-import java.security.ProtectionDomain;
-
+import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.VM;
import sun.reflect.CallerSensitive;
import sun.reflect.Reflection;
-import jdk.internal.HotSpotIntrinsicCandidate;
-import jdk.internal.misc.VM;
+import java.lang.reflect.Field;
+import java.security.ProtectionDomain;
/**
@@ -1036,9 +1035,4 @@
private static void throwIllegalAccessError() {
throw new IllegalAccessError();
}
-
- // JVM interface methods
- private native boolean unalignedAccess0();
- private native boolean isBigEndian0();
-
}
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/http/DigestAuthentication.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/http/DigestAuthentication.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
@@ -30,7 +30,6 @@
import java.net.ProtocolException;
import java.net.PasswordAuthentication;
import java.util.Arrays;
-import java.util.StringTokenizer;
import java.util.Random;
import sun.net.www.HeaderParser;
@@ -146,9 +145,9 @@
synchronized void setQop (String qop) {
if (qop != null) {
- StringTokenizer st = new StringTokenizer (qop, " ");
- while (st.hasMoreTokens()) {
- if (st.nextToken().equalsIgnoreCase ("auth")) {
+ String items[] = qop.split(",");
+ for (String item : items) {
+ if ("auth".equalsIgnoreCase(item.trim())) {
serverQop = true;
return;
}
@@ -163,7 +162,7 @@
synchronized String getNonce () { return nonce;}
synchronized void setNonce (String s) {
- if (!s.equals(nonce)) {
+ if (nonce == null || !s.equals(nonce)) {
nonce=s;
NCcount = 0;
redoCachedHA1 = true;
--- a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java Thu Jan 21 10:17:21 2016 -0800
@@ -25,6 +25,7 @@
package sun.reflect.annotation;
+import java.io.ObjectInputStream;
import java.lang.annotation.*;
import java.lang.reflect.*;
import java.io.Serializable;
@@ -431,35 +432,72 @@
private void readObject(java.io.ObjectInputStream s)
throws java.io.IOException, ClassNotFoundException {
- s.defaultReadObject();
+ ObjectInputStream.GetField fields = s.readFields();
+
+ @SuppressWarnings("unchecked")
+ Class<? extends Annotation> t = (Class<? extends Annotation>)fields.get("type", null);
+ @SuppressWarnings("unchecked")
+ Map<String, Object> streamVals = (Map<String, Object>)fields.get("memberValues", null);
// Check to make sure that types have not evolved incompatibly
AnnotationType annotationType = null;
try {
- annotationType = AnnotationType.getInstance(type);
+ annotationType = AnnotationType.getInstance(t);
} catch(IllegalArgumentException e) {
// Class is no longer an annotation type; time to punch out
throw new java.io.InvalidObjectException("Non-annotation type in annotation serial stream");
}
Map<String, Class<?>> memberTypes = annotationType.memberTypes();
+ // consistent with runtime Map type
+ Map<String, Object> mv = new LinkedHashMap<>();
// If there are annotation members without values, that
// situation is handled by the invoke method.
- for (Map.Entry<String, Object> memberValue : memberValues.entrySet()) {
+ for (Map.Entry<String, Object> memberValue : streamVals.entrySet()) {
String name = memberValue.getKey();
+ Object value = null;
Class<?> memberType = memberTypes.get(name);
if (memberType != null) { // i.e. member still exists
- Object value = memberValue.getValue();
+ value = memberValue.getValue();
if (!(memberType.isInstance(value) ||
value instanceof ExceptionProxy)) {
- memberValue.setValue(
- new AnnotationTypeMismatchExceptionProxy(
+ value = new AnnotationTypeMismatchExceptionProxy(
value.getClass() + "[" + value + "]").setMember(
- annotationType.members().get(name)));
+ annotationType.members().get(name));
}
}
+ mv.put(name, value);
+ }
+
+ UnsafeAccessor.setType(this, t);
+ UnsafeAccessor.setMemberValues(this, mv);
+ }
+
+ private static class UnsafeAccessor {
+ private static final jdk.internal.misc.Unsafe unsafe;
+ private static final long typeOffset;
+ private static final long memberValuesOffset;
+ static {
+ try {
+ unsafe = jdk.internal.misc.Unsafe.getUnsafe();
+ typeOffset = unsafe.objectFieldOffset
+ (AnnotationInvocationHandler.class.getDeclaredField("type"));
+ memberValuesOffset = unsafe.objectFieldOffset
+ (AnnotationInvocationHandler.class.getDeclaredField("memberValues"));
+ } catch (Exception ex) {
+ throw new ExceptionInInitializerError(ex);
+ }
+ }
+ static void setType(AnnotationInvocationHandler o,
+ Class<? extends Annotation> type) {
+ unsafe.putObject(o, typeOffset, type);
+ }
+
+ static void setMemberValues(AnnotationInvocationHandler o,
+ Map<String, Object> memberValues) {
+ unsafe.putObject(o, memberValuesOffset, memberValues);
}
}
}
--- a/jdk/src/java.base/share/classes/sun/security/internal/spec/TlsRsaPremasterSecretParameterSpec.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/internal/spec/TlsRsaPremasterSecretParameterSpec.java Thu Jan 21 10:17:21 2016 -0800
@@ -43,6 +43,8 @@
public class TlsRsaPremasterSecretParameterSpec
implements AlgorithmParameterSpec {
+ private final byte[] encodedSecret;
+
/*
* The TLS spec says that the version in the RSA premaster secret must
* be the maximum version supported by the client (i.e. the version it
@@ -89,6 +91,33 @@
this.clientVersion = checkVersion(clientVersion);
this.serverVersion = checkVersion(serverVersion);
+ this.encodedSecret = null;
+ }
+
+ /**
+ * Constructs a new TlsRsaPremasterSecretParameterSpec.
+ *
+ * @param clientVersion the version of the TLS protocol by which the
+ * client wishes to communicate during this session
+ * @param serverVersion the negotiated version of the TLS protocol which
+ * contains the lower of that suggested by the client in the client
+ * hello and the highest supported by the server.
+ * @param encodedSecret the encoded secret key
+ *
+ * @throws IllegalArgumentException if clientVersion or serverVersion are
+ * negative or larger than (2^16 - 1) or if encodedSecret is not
+ * exactly 48 bytes
+ */
+ public TlsRsaPremasterSecretParameterSpec(
+ int clientVersion, int serverVersion, byte[] encodedSecret) {
+
+ this.clientVersion = checkVersion(clientVersion);
+ this.serverVersion = checkVersion(serverVersion);
+ if (encodedSecret == null || encodedSecret.length != 48) {
+ throw new IllegalArgumentException(
+ "Encoded secret is not exactly 48 bytes");
+ }
+ this.encodedSecret = encodedSecret.clone();
}
/**
@@ -147,4 +176,13 @@
}
return version;
}
+
+ /**
+ * Returns the encoded secret.
+ *
+ * @return the encoded secret, may be null if no encoded secret.
+ */
+ public byte[] getEncodedSecret() {
+ return encodedSecret == null ? null : encodedSecret.clone();
+ }
}
--- a/jdk/src/java.base/share/classes/sun/security/jca/JCAUtil.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/jca/JCAUtil.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -41,12 +41,6 @@
// no instantiation
}
- // lock to use for synchronization
- private static final Object LOCK = JCAUtil.class;
-
- // cached SecureRandom instance
- private static volatile SecureRandom secureRandom;
-
// size of the temporary arrays we use. Should fit into the CPU's 1st
// level cache and could be adjusted based on the platform
private static final int ARRAY_SIZE = 4096;
@@ -60,26 +54,19 @@
return Math.min(ARRAY_SIZE, totalSize);
}
+ // cached SecureRandom instance
+ private static class CachedSecureRandomHolder {
+ public static SecureRandom instance = new SecureRandom();
+ }
+
/**
- * Get a SecureRandom instance. This method should me used by JDK
+ * Get a SecureRandom instance. This method should be used by JDK
* internal code in favor of calling "new SecureRandom()". That needs to
* iterate through the provider table to find the default SecureRandom
* implementation, which is fairly inefficient.
*/
public static SecureRandom getSecureRandom() {
- // we use double checked locking to minimize synchronization
- // works because we use a volatile reference
- SecureRandom r = secureRandom;
- if (r == null) {
- synchronized (LOCK) {
- r = secureRandom;
- if (r == null) {
- r = new SecureRandom();
- secureRandom = r;
- }
- }
- }
- return r;
+ return CachedSecureRandomHolder.instance;
}
}
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/ResponderId.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/ResponderId.java Thu Jan 21 10:17:21 2016 -0800
@@ -49,7 +49,7 @@
* </pre>
*
* @see ResponderId.Type
- * @since 1.9
+ * @since 9
*/
public final class ResponderId {
@@ -58,7 +58,7 @@
* {@code ResponderId}.
*
* @see ResponderId
- * @since 1.9
+ * @since 9
*/
public static enum Type {
/**
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java Thu Jan 21 10:17:21 2016 -0800
@@ -333,7 +333,7 @@
input, serverKey,
clnt_random.random_bytes, svr_random.random_bytes,
messageLen,
- localSupportedSignAlgs, protocolVersion);
+ getLocalSupportedSignAlgs(), protocolVersion);
handshakeState.update(dhSrvKeyExchange, resumingSession);
this.serverKeyExchange(dhSrvKeyExchange);
} catch (GeneralSecurityException e) {
@@ -348,7 +348,7 @@
new ECDH_ServerKeyExchange
(input, serverKey, clnt_random.random_bytes,
svr_random.random_bytes,
- localSupportedSignAlgs, protocolVersion);
+ getLocalSupportedSignAlgs(), protocolVersion);
handshakeState.update(ecdhSrvKeyExchange, resumingSession);
this.serverKeyExchange(ecdhSrvKeyExchange);
} catch (GeneralSecurityException e) {
@@ -398,7 +398,7 @@
Collection<SignatureAndHashAlgorithm> supportedPeerSignAlgs =
SignatureAndHashAlgorithm.getSupportedAlgorithms(
- peerSignAlgs);
+ algorithmConstraints, peerSignAlgs);
if (supportedPeerSignAlgs.isEmpty()) {
throw new SSLHandshakeException(
"No supported signature and hash algorithm in common");
@@ -1211,8 +1211,8 @@
if (protocolVersion.useTLS12PlusSpec()) {
preferableSignatureAlgorithm =
SignatureAndHashAlgorithm.getPreferableAlgorithm(
- peerSupportedSignAlgs, signingKey.getAlgorithm(),
- signingKey);
+ getPeerSupportedSignAlgs(),
+ signingKey.getAlgorithm(), signingKey);
if (preferableSignatureAlgorithm == null) {
throw new SSLHandshakeException(
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ClientKeyExchangeService.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ClientKeyExchangeService.java Thu Jan 21 10:17:21 2016 -0800
@@ -41,7 +41,7 @@
* Models a service that provides support for a particular client key exchange
* mode. Currently used to implement Kerberos-related cipher suites.
*
- * @since 1.9
+ * @since 9
*/
public interface ClientKeyExchangeService {
--- a/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java Thu Jan 21 10:17:21 2016 -0800
@@ -1943,7 +1943,7 @@
// the signature bytes
private byte[] signature;
- // protocol version being established using this ServerKeyExchange message
+ // protocol version being established using this CertificateVerify message
ProtocolVersion protocolVersion;
// the preferable signature algorithm used by this CertificateVerify message
@@ -1996,7 +1996,7 @@
preferableSignatureAlgorithm)) {
throw new SSLHandshakeException(
"Unsupported SignatureAndHashAlgorithm in " +
- "ServerKeyExchange message");
+ "CertificateVerify message");
}
}
--- a/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java Thu Jan 21 10:17:21 2016 -0800
@@ -90,7 +90,7 @@
AlgorithmConstraints algorithmConstraints = null;
// Local supported signature and algorithms
- Collection<SignatureAndHashAlgorithm> localSupportedSignAlgs;
+ private Collection<SignatureAndHashAlgorithm> localSupportedSignAlgs;
// Peer supported signature and algorithms
Collection<SignatureAndHashAlgorithm> peerSupportedSignAlgs;
--- a/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, 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
@@ -113,14 +113,34 @@
}
}
+ byte[] encoded = null;
try {
Cipher cipher = JsseJce.getCipher(JsseJce.CIPHER_RSA_PKCS1);
- cipher.init(Cipher.UNWRAP_MODE, privateKey,
- new TlsRsaPremasterSecretParameterSpec(
- maxVersion.v, currentVersion.v),
- generator);
- preMaster = (SecretKey)cipher.unwrap(encrypted,
- "TlsRsaPremasterSecret", Cipher.SECRET_KEY);
+ boolean needFailover = !KeyUtil.isOracleJCEProvider(
+ cipher.getProvider().getName());
+ if (needFailover) {
+ cipher.init(Cipher.DECRYPT_MODE, privateKey);
+ boolean failed = false;
+ try {
+ encoded = cipher.doFinal(encrypted);
+ } catch (BadPaddingException bpe) {
+ // Note: encoded == null
+ failed = true;
+ }
+ encoded = KeyUtil.checkTlsPreMasterSecretKey(
+ maxVersion.v, currentVersion.v,
+ generator, encoded, failed);
+ preMaster = generatePreMasterSecret(
+ maxVersion.v, currentVersion.v,
+ encoded, generator);
+ } else {
+ cipher.init(Cipher.UNWRAP_MODE, privateKey,
+ new TlsRsaPremasterSecretParameterSpec(
+ maxVersion.v, currentVersion.v),
+ generator);
+ preMaster = (SecretKey)cipher.unwrap(encrypted,
+ "TlsRsaPremasterSecret", Cipher.SECRET_KEY);
+ }
} catch (InvalidKeyException ibk) {
// the message is too big to process with RSA
throw new SSLProtocolException(
@@ -135,6 +155,35 @@
}
}
+ // generate a premaster secret with the specified version number
+ @SuppressWarnings("deprecation")
+ private static SecretKey generatePreMasterSecret(
+ int clientVersion, int serverVersion,
+ byte[] encodedSecret, SecureRandom generator) {
+
+ if (debug != null && Debug.isOn("handshake")) {
+ System.out.println("Generating a premaster secret");
+ }
+
+ try {
+ String s = ((clientVersion >= ProtocolVersion.TLS12.v) ?
+ "SunTls12RsaPremasterSecret" : "SunTlsRsaPremasterSecret");
+ KeyGenerator kg = JsseJce.getKeyGenerator(s);
+ kg.init(new TlsRsaPremasterSecretParameterSpec(
+ clientVersion, serverVersion, encodedSecret),
+ generator);
+ return kg.generateKey();
+ } catch (InvalidAlgorithmParameterException |
+ NoSuchAlgorithmException iae) {
+ // unlikely to happen, otherwise, must be a provider exception
+ if (debug != null && Debug.isOn("handshake")) {
+ System.out.println("RSA premaster secret generation error:");
+ iae.printStackTrace(System.out);
+ }
+ throw new RuntimeException("Could not generate premaster secret", iae);
+ }
+ }
+
@Override
int messageType() {
return ht_client_key_exchange;
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java Thu Jan 21 10:17:21 2016 -0800
@@ -320,7 +320,7 @@
case HandshakeMessage.ht_certificate_verify:
CertificateVerify cvm =
new CertificateVerify(input,
- localSupportedSignAlgs, protocolVersion);
+ getLocalSupportedSignAlgs(), protocolVersion);
handshakeState.update(cvm, resumingSession);
this.clientCertificateVerify(cvm);
@@ -772,11 +772,10 @@
Collection<SignatureAndHashAlgorithm>
supportedPeerSignAlgs =
SignatureAndHashAlgorithm.getSupportedAlgorithms(
- peerSignAlgs);
+ algorithmConstraints, peerSignAlgs);
if (supportedPeerSignAlgs.isEmpty()) {
throw new SSLHandshakeException(
- "No supported signature and hash algorithm " +
- "in common");
+ "No signature and hash algorithm in common");
}
setPeerSupportedSignAlgs(supportedPeerSignAlgs);
@@ -1351,6 +1350,13 @@
supportedSignAlgs =
new ArrayList<SignatureAndHashAlgorithm>(1);
supportedSignAlgs.add(algorithm);
+
+ supportedSignAlgs =
+ SignatureAndHashAlgorithm.getSupportedAlgorithms(
+ algorithmConstraints, supportedSignAlgs);
+
+ // May be no default activated signature algorithm, but
+ // let the following process make the final decision.
}
// Sets the peer supported signature algorithm to use in KM
@@ -1395,6 +1401,11 @@
SignatureAndHashAlgorithm.getPreferableAlgorithm(
supportedSignAlgs, "RSA", privateKey);
if (preferableSignatureAlgorithm == null) {
+ if ((debug != null) && Debug.isOn("handshake")) {
+ System.out.println(
+ "No signature and hash algorithm for cipher " +
+ suite);
+ }
return false;
}
}
@@ -1413,6 +1424,11 @@
SignatureAndHashAlgorithm.getPreferableAlgorithm(
supportedSignAlgs, "RSA", privateKey);
if (preferableSignatureAlgorithm == null) {
+ if ((debug != null) && Debug.isOn("handshake")) {
+ System.out.println(
+ "No signature and hash algorithm for cipher " +
+ suite);
+ }
return false;
}
}
@@ -1428,6 +1444,11 @@
SignatureAndHashAlgorithm.getPreferableAlgorithm(
supportedSignAlgs, "DSA");
if (preferableSignatureAlgorithm == null) {
+ if ((debug != null) && Debug.isOn("handshake")) {
+ System.out.println(
+ "No signature and hash algorithm for cipher " +
+ suite);
+ }
return false;
}
}
@@ -1446,6 +1467,11 @@
SignatureAndHashAlgorithm.getPreferableAlgorithm(
supportedSignAlgs, "ECDSA");
if (preferableSignatureAlgorithm == null) {
+ if ((debug != null) && Debug.isOn("handshake")) {
+ System.out.println(
+ "No signature and hash algorithm for cipher " +
+ suite);
+ }
return false;
}
}
@@ -1487,7 +1513,8 @@
ClientKeyExchangeService.find(keyExchange.name);
if (p == null) {
// internal error, unknown key exchange
- throw new RuntimeException("Unrecognized cipherSuite: " + suite);
+ throw new RuntimeException(
+ "Unrecognized cipherSuite: " + suite);
}
// need service creds
if (serviceCreds == null) {
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java Thu Jan 21 10:17:21 2016 -0800
@@ -166,10 +166,13 @@
// Get supported algorithm collection from an untrusted collection
static Collection<SignatureAndHashAlgorithm> getSupportedAlgorithms(
+ AlgorithmConstraints constraints,
Collection<SignatureAndHashAlgorithm> algorithms ) {
Collection<SignatureAndHashAlgorithm> supported = new ArrayList<>();
for (SignatureAndHashAlgorithm sigAlg : algorithms) {
- if (sigAlg.priority <= SUPPORTED_ALG_PRIORITY_MAX_NUM) {
+ if (sigAlg.priority <= SUPPORTED_ALG_PRIORITY_MAX_NUM &&
+ constraints.permits(SIGNATURE_PRIMITIVE_SET,
+ sigAlg.algorithm, null)) {
supported.add(sigAlg);
}
}
@@ -233,30 +236,42 @@
}
static SignatureAndHashAlgorithm getPreferableAlgorithm(
- Collection<SignatureAndHashAlgorithm> algorithms,
- String expected, PrivateKey signingKey) {
+ Collection<SignatureAndHashAlgorithm> algorithms,
+ String expected, PrivateKey signingKey) {
- if (expected == null && !algorithms.isEmpty()) {
- for (SignatureAndHashAlgorithm sigAlg : algorithms) {
- if (sigAlg.priority <= SUPPORTED_ALG_PRIORITY_MAX_NUM) {
- return sigAlg;
+ int maxDigestLength = getMaxDigestLength(signingKey);
+ for (SignatureAndHashAlgorithm algorithm : algorithms) {
+ int signValue = algorithm.id & 0xFF;
+ if ((expected == null) ||
+ (expected.equalsIgnoreCase("rsa") &&
+ signValue == SignatureAlgorithm.RSA.value) ||
+ (expected.equalsIgnoreCase("dsa") &&
+ signValue == SignatureAlgorithm.DSA.value) ||
+ (expected.equalsIgnoreCase("ecdsa") &&
+ signValue == SignatureAlgorithm.ECDSA.value) ||
+ (expected.equalsIgnoreCase("ec") &&
+ signValue == SignatureAlgorithm.ECDSA.value)) {
+
+ if (algorithm.priority <= SUPPORTED_ALG_PRIORITY_MAX_NUM &&
+ algorithm.hash.length <= maxDigestLength) {
+
+ return algorithm;
}
}
-
- return null; // no supported algorithm
- }
-
- if (expected == null ) {
- return null; // no expected algorithm, no supported algorithm
}
- /*
- * Need to check RSA key length to match the length of hash value
- */
+ return null;
+ }
+
+ /*
+ * Need to check key length to match the length of hash value
+ */
+ private static int getMaxDigestLength(PrivateKey signingKey) {
int maxDigestLength = Integer.MAX_VALUE;
+
+ // only need to check RSA algorithm at present.
if (signingKey != null &&
- "rsa".equalsIgnoreCase(signingKey.getAlgorithm()) &&
- expected.equalsIgnoreCase("rsa")) {
+ "rsa".equalsIgnoreCase(signingKey.getAlgorithm())) {
/*
* RSA keys of 512 bits have been shown to be practically
* breakable, it does not make much sense to use the strong
@@ -284,25 +299,7 @@
// preferable hash algorithm.
}
- for (SignatureAndHashAlgorithm algorithm : algorithms) {
- int signValue = algorithm.id & 0xFF;
- if (expected.equalsIgnoreCase("rsa") &&
- signValue == SignatureAlgorithm.RSA.value) {
- if (algorithm.hash.length <= maxDigestLength) {
- return algorithm;
- }
- } else if (
- (expected.equalsIgnoreCase("dsa") &&
- signValue == SignatureAlgorithm.DSA.value) ||
- (expected.equalsIgnoreCase("ecdsa") &&
- signValue == SignatureAlgorithm.ECDSA.value) ||
- (expected.equalsIgnoreCase("ec") &&
- signValue == SignatureAlgorithm.ECDSA.value)) {
- return algorithm;
- }
- }
-
- return null;
+ return maxDigestLength;
}
static enum HashAlgorithm {
@@ -415,12 +412,14 @@
supports(HashAlgorithm.SHA1, SignatureAlgorithm.ECDSA,
"SHA1withECDSA", --p);
- supports(HashAlgorithm.SHA224, SignatureAlgorithm.DSA,
- "SHA224withDSA", --p);
- supports(HashAlgorithm.SHA224, SignatureAlgorithm.RSA,
- "SHA224withRSA", --p);
- supports(HashAlgorithm.SHA224, SignatureAlgorithm.ECDSA,
- "SHA224withECDSA", --p);
+ if (Security.getProvider("SunMSCAPI") == null) {
+ supports(HashAlgorithm.SHA224, SignatureAlgorithm.DSA,
+ "SHA224withDSA", --p);
+ supports(HashAlgorithm.SHA224, SignatureAlgorithm.RSA,
+ "SHA224withRSA", --p);
+ supports(HashAlgorithm.SHA224, SignatureAlgorithm.ECDSA,
+ "SHA224withECDSA", --p);
+ }
supports(HashAlgorithm.SHA256, SignatureAlgorithm.DSA,
"SHA256withDSA", --p);
--- a/jdk/src/java.base/share/classes/sun/security/util/KeyStoreDelegator.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/util/KeyStoreDelegator.java Thu Jan 21 10:17:21 2016 -0800
@@ -37,7 +37,7 @@
/**
* This class delegates to a primary or secondary keystore implementation.
*
- * @since 1.9
+ * @since 9
*/
public class KeyStoreDelegator extends KeyStoreSpi {
--- a/jdk/src/java.base/share/classes/sun/security/util/KeyUtil.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/util/KeyUtil.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -41,6 +41,8 @@
import javax.crypto.spec.DHPublicKeySpec;
import java.math.BigInteger;
+import sun.security.jca.JCAUtil;
+
/**
* A utility class to get key length, valiate keys, etc.
*/
@@ -143,8 +145,6 @@
/**
* Returns whether the specified provider is Oracle provider or not.
- * <P>
- * Note that this method is only apply to SunJCE and SunPKCS11 at present.
*
* @param providerName
* the provider name
@@ -152,8 +152,11 @@
* {@code providerName} is Oracle provider
*/
public static final boolean isOracleJCEProvider(String providerName) {
- return providerName != null && (providerName.equals("SunJCE") ||
- providerName.startsWith("SunPKCS11"));
+ return providerName != null &&
+ (providerName.equals("SunJCE") ||
+ providerName.equals("SunMSCAPI") ||
+ providerName.equals("OracleUcrypto") ||
+ providerName.startsWith("SunPKCS11"));
}
/**
@@ -200,7 +203,7 @@
byte[] encoded, boolean isFailOver) {
if (random == null) {
- random = new SecureRandom();
+ random = JCAUtil.getSecureRandom();
}
byte[] replacer = new byte[48];
random.nextBytes(replacer);
--- a/jdk/src/java.base/share/classes/sun/security/x509/AlgorithmId.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/AlgorithmId.java Thu Jan 21 10:17:21 2016 -0800
@@ -588,7 +588,7 @@
}
if (oidTable == null) {
- oidTable = new HashMap<>(1);
+ oidTable = Collections.<String,ObjectIdentifier>emptyMap();
}
initOidTable = true;
}
--- a/jdk/src/java.base/share/classes/sun/security/x509/CRLDistributionPointsExtension.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/CRLDistributionPointsExtension.java Thu Jan 21 10:17:21 2016 -0800
@@ -29,6 +29,7 @@
import java.io.OutputStream;
import java.util.*;
+import java.util.Collections;
import sun.security.util.DerOutputStream;
import sun.security.util.DerValue;
@@ -255,11 +256,12 @@
*/
public void delete(String name) throws IOException {
if (name.equalsIgnoreCase(POINTS)) {
- distributionPoints = new ArrayList<DistributionPoint>();
+ distributionPoints =
+ Collections.<DistributionPoint>emptyList();
} else {
throw new IOException("Attribute name [" + name +
- "] not recognized by " +
- "CertAttrSet:" + extensionName + ".");
+ "] not recognized by " +
+ "CertAttrSet:" + extensionName + '.');
}
encodeThis();
}
--- a/jdk/src/java.base/share/classes/sun/security/x509/CRLNumberExtension.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/CRLNumberExtension.java Thu Jan 21 10:17:21 2016 -0800
@@ -157,11 +157,10 @@
*/
public BigInteger get(String name) throws IOException {
if (name.equalsIgnoreCase(NUMBER)) {
- if (crlNumber == null) return null;
- else return crlNumber;
+ return crlNumber;
} else {
- throw new IOException("Attribute name not recognized by"
- + " CertAttrSet:" + extensionName + ".");
+ throw new IOException("Attribute name not recognized by" +
+ " CertAttrSet:" + extensionName + '.');
}
}
--- a/jdk/src/java.base/share/classes/sun/security/x509/DNSName.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/DNSName.java Thu Jan 21 10:17:21 2016 -0800
@@ -232,15 +232,15 @@
* @throws UnsupportedOperationException if not supported for this name type
*/
public int subtreeDepth() throws UnsupportedOperationException {
- String subtree=name;
- int i=1;
+ // subtree depth is always at least 1
+ int sum = 1;
- /* count dots */
- for (; subtree.lastIndexOf('.') >= 0; i++) {
- subtree=subtree.substring(0,subtree.lastIndexOf('.'));
+ // count dots
+ for (int i = name.indexOf('.'); i >= 0; i = name.indexOf('.', i + 1)) {
+ ++sum;
}
- return i;
+ return sum;
}
}
--- a/jdk/src/java.base/share/classes/sun/security/x509/EDIPartyName.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/EDIPartyName.java Thu Jan 21 10:17:21 2016 -0800
@@ -197,7 +197,7 @@
*/
public int hashCode() {
if (myhash == -1) {
- myhash = 37 + party.hashCode();
+ myhash = 37 + (party == null ? 1 : party.hashCode());
if (assigner != null) {
myhash = 37 * myhash + assigner.hashCode();
}
--- a/jdk/src/java.base/share/classes/sun/security/x509/GeneralSubtrees.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/GeneralSubtrees.java Thu Jan 21 10:17:21 2016 -0800
@@ -189,7 +189,7 @@
// the list: if any subsequent entry matches or widens entry n,
// remove entry n. If any subsequent entries narrow entry n, remove
// the subsequent entries.
- for (int i = 0; i < size(); i++) {
+ for (int i = 0; i < (size() - 1); i++) {
GeneralNameInterface current = getGeneralNameInterface(i);
boolean remove1 = false;
--- a/jdk/src/java.base/share/classes/sun/security/x509/IPAddressName.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/IPAddressName.java Thu Jan 21 10:17:21 2016 -0800
@@ -197,8 +197,10 @@
// append a mask corresponding to the num of prefix bits specified
int prefixLen = Integer.parseInt(name.substring(slashNdx+1));
- if (prefixLen > 128)
- throw new IOException("IPv6Address prefix is longer than 128");
+ if (prefixLen < 0 || prefixLen > 128) {
+ throw new IOException("IPv6Address prefix length (" +
+ prefixLen + ") in out of valid range [0,128]");
+ }
// create new bit array initialized to zeros
BitArray bitArray = new BitArray(MASKSIZE * 8);
@@ -317,7 +319,8 @@
if (!(obj instanceof IPAddressName))
return false;
- byte[] other = ((IPAddressName)obj).getBytes();
+ IPAddressName otherName = (IPAddressName)obj;
+ byte[] other = otherName.address;
if (other.length != address.length)
return false;
@@ -326,12 +329,10 @@
// Two subnet addresses
// Mask each and compare masked values
int maskLen = address.length/2;
- byte[] maskedThis = new byte[maskLen];
- byte[] maskedOther = new byte[maskLen];
for (int i=0; i < maskLen; i++) {
- maskedThis[i] = (byte)(address[i] & address[i+maskLen]);
- maskedOther[i] = (byte)(other[i] & other[i+maskLen]);
- if (maskedThis[i] != maskedOther[i]) {
+ byte maskedThis = (byte)(address[i] & address[i+maskLen]);
+ byte maskedOther = (byte)(other[i] & other[i+maskLen]);
+ if (maskedThis != maskedOther) {
return false;
}
}
@@ -400,7 +401,8 @@
else if (((IPAddressName)inputName).equals(this))
constraintType = NAME_MATCH;
else {
- byte[] otherAddress = ((IPAddressName)inputName).getBytes();
+ IPAddressName otherName = (IPAddressName)inputName;
+ byte[] otherAddress = otherName.address;
if (otherAddress.length == 4 && address.length == 4)
// Two host addresses
constraintType = NAME_SAME_TYPE;
--- a/jdk/src/java.base/share/classes/sun/security/x509/IssuingDistributionPointExtension.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/IssuingDistributionPointExtension.java Thu Jan 21 10:17:21 2016 -0800
@@ -261,6 +261,7 @@
throw new IOException(
"Attribute value should be of type ReasonFlags.");
}
+ revocationReasons = (ReasonFlags)obj;
} else if (name.equalsIgnoreCase(INDIRECT_CRL)) {
if (!(obj instanceof Boolean)) {
@@ -290,7 +291,6 @@
}
hasOnlyAttributeCerts = ((Boolean)obj).booleanValue();
-
} else {
throw new IOException("Attribute name [" + name +
"] not recognized by " +
--- a/jdk/src/java.base/share/classes/sun/security/x509/KeyIdentifier.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/KeyIdentifier.java Thu Jan 21 10:17:21 2016 -0800
@@ -148,7 +148,7 @@
return true;
if (!(other instanceof KeyIdentifier))
return false;
- return java.util.Arrays.equals(octetString,
- ((KeyIdentifier)other).getIdentifier());
+ byte[] otherString = ((KeyIdentifier)other).octetString;
+ return java.util.Arrays.equals(octetString, otherString);
}
}
--- a/jdk/src/java.base/share/classes/sun/security/x509/PolicyMappingsExtension.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/PolicyMappingsExtension.java Thu Jan 21 10:17:21 2016 -0800
@@ -102,7 +102,7 @@
public PolicyMappingsExtension() {
extensionId = PKIXExtensions.PolicyMappings_Id;
critical = true;
- maps = new ArrayList<CertificatePolicyMap>();
+ maps = Collections.<CertificatePolicyMap>emptyList();
}
/**
--- a/jdk/src/java.base/share/classes/sun/security/x509/PrivateKeyUsageExtension.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/PrivateKeyUsageExtension.java Thu Jan 21 10:17:21 2016 -0800
@@ -33,6 +33,7 @@
import java.security.cert.CertificateNotYetValidException;
import java.util.Date;
import java.util.Enumeration;
+import java.util.Objects;
import sun.security.util.*;
@@ -217,16 +218,17 @@
*/
public void valid(Date now)
throws CertificateNotYetValidException, CertificateExpiredException {
+ Objects.requireNonNull(now);
/*
* we use the internal Dates rather than the passed in Date
* because someone could override the Date methods after()
* and before() to do something entirely different.
*/
- if (notBefore.after(now)) {
+ if (notBefore != null && notBefore.after(now)) {
throw new CertificateNotYetValidException("NotBefore: " +
notBefore.toString());
}
- if (notAfter.before(now)) {
+ if (notAfter != null && notAfter.before(now)) {
throw new CertificateExpiredException("NotAfter: " +
notAfter.toString());
}
--- a/jdk/src/java.base/share/classes/sun/security/x509/RDN.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/RDN.java Thu Jan 21 10:17:21 2016 -0800
@@ -27,6 +27,8 @@
import java.io.IOException;
import java.io.StringReader;
+import java.util.Arrays;
+import java.util.StringJoiner;
import java.util.*;
import sun.security.util.*;
@@ -436,31 +438,19 @@
assertion[0].toRFC2253String(oidMap);
}
- StringBuilder relname = new StringBuilder();
- if (!canonical) {
- for (int i = 0; i < assertion.length; i++) {
- if (i > 0) {
- relname.append('+');
- }
- relname.append(assertion[i].toRFC2253String(oidMap));
- }
- } else {
+ AVA[] toOutput = assertion;
+ if (canonical) {
// order the string type AVA's alphabetically,
// followed by the oid type AVA's numerically
- List<AVA> avaList = new ArrayList<>(assertion.length);
- for (int i = 0; i < assertion.length; i++) {
- avaList.add(assertion[i]);
- }
- java.util.Collections.sort(avaList, AVAComparator.getInstance());
-
- for (int i = 0; i < avaList.size(); i++) {
- if (i > 0) {
- relname.append('+');
- }
- relname.append(avaList.get(i).toRFC2253CanonicalString());
- }
+ toOutput = assertion.clone();
+ Arrays.sort(toOutput, AVAComparator.getInstance());
}
- return relname.toString();
+ StringJoiner sj = new StringJoiner("+");
+ for (AVA ava : toOutput) {
+ sj.add(canonical ? ava.toRFC2253CanonicalString()
+ : ava.toRFC2253String(oidMap));
+ }
+ return sj.toString();
}
}
--- a/jdk/src/java.base/share/classes/sun/security/x509/SubjectInfoAccessExtension.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/SubjectInfoAccessExtension.java Thu Jan 21 10:17:21 2016 -0800
@@ -28,6 +28,7 @@
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Collections;
import java.util.*;
import sun.security.util.DerOutputStream;
@@ -200,7 +201,8 @@
*/
public void delete(String name) throws IOException {
if (name.equalsIgnoreCase(DESCRIPTIONS)) {
- accessDescriptions = new ArrayList<AccessDescription>();
+ accessDescriptions =
+ Collections.<AccessDescription>emptyList();
} else {
throw new IOException("Attribute name [" + name +
"] not recognized by " +
--- a/jdk/src/java.base/share/classes/sun/security/x509/URIName.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/URIName.java Thu Jan 21 10:17:21 2016 -0800
@@ -165,7 +165,7 @@
String host = uri.getSchemeSpecificPart();
try {
DNSName hostDNS;
- if (host.charAt(0) == '.') {
+ if (host.startsWith(".")) {
hostDNS = new DNSName(host.substring(1));
} else {
hostDNS = new DNSName(host);
--- a/jdk/src/java.base/share/classes/sun/security/x509/X500Name.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X500Name.java Thu Jan 21 10:17:21 2016 -0800
@@ -347,6 +347,8 @@
for (int i = 0; i < names.length; i++) {
list.addAll(names[i].avas());
}
+ list = Collections.unmodifiableList(list);
+ allAvaList = list;
}
return list;
}
@@ -365,9 +367,6 @@
*/
public boolean isEmpty() {
int n = names.length;
- if (n == 0) {
- return true;
- }
for (int i = 0; i < n; i++) {
if (names[i].assertion.length != 0) {
return false;
@@ -1103,12 +1102,8 @@
* and speed recognition of common X.500 attributes.
*/
static ObjectIdentifier intern(ObjectIdentifier oid) {
- ObjectIdentifier interned = internedOIDs.get(oid);
- if (interned != null) {
- return interned;
- }
- internedOIDs.put(oid, oid);
- return oid;
+ ObjectIdentifier interned = internedOIDs.putIfAbsent(oid, oid);
+ return (interned == null) ? oid : interned;
}
private static final Map<ObjectIdentifier,ObjectIdentifier> internedOIDs
--- a/jdk/src/java.base/share/classes/sun/security/x509/X509AttributeName.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X509AttributeName.java Thu Jan 21 10:17:21 2016 -0800
@@ -47,7 +47,7 @@
*/
public X509AttributeName(String name) {
int i = name.indexOf(SEPARATOR);
- if (i == (-1)) {
+ if (i < 0) {
prefix = name;
} else {
prefix = name.substring(0, i);
--- a/jdk/src/java.base/share/classes/sun/security/x509/X509CRLImpl.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X509CRLImpl.java Thu Jan 21 10:17:21 2016 -0800
@@ -762,9 +762,7 @@
public byte[] getTBSCertList() throws CRLException {
if (tbsCertList == null)
throw new CRLException("Uninitialized CRL");
- byte[] dup = new byte[tbsCertList.length];
- System.arraycopy(tbsCertList, 0, dup, 0, dup.length);
- return dup;
+ return tbsCertList.clone();
}
/**
@@ -775,9 +773,7 @@
public byte[] getSignature() {
if (signature == null)
return null;
- byte[] dup = new byte[signature.length];
- System.arraycopy(signature, 0, dup, 0, dup.length);
- return dup;
+ return signature.clone();
}
/**
--- a/jdk/src/java.base/share/classes/sun/security/x509/X509CertImpl.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X509CertImpl.java Thu Jan 21 10:17:21 2016 -0800
@@ -1001,9 +1001,7 @@
public byte[] getSignature() {
if (signature == null)
return null;
- byte[] dup = new byte[signature.length];
- System.arraycopy(signature, 0, dup, 0, dup.length);
- return dup;
+ return signature.clone();
}
/**
--- a/jdk/src/java.base/share/conf/security/java.security Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/conf/security/java.security Thu Jan 21 10:17:21 2016 -0800
@@ -576,7 +576,7 @@
#
# Example:
# jdk.tls.disabledAlgorithms=MD5, SSLv3, DSA, RSA keySize < 2048
-jdk.tls.disabledAlgorithms=SSLv3, RC4, DH keySize < 768
+jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize < 768
# Legacy algorithms for Secure Socket Layer/Transport Layer Security (SSL/TLS)
# processing in JSSE implementation.
--- a/jdk/src/java.base/share/native/include/jvm.h Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/native/include/jvm.h Thu Jan 21 10:17:21 2016 -0800
@@ -208,6 +208,9 @@
JNIEXPORT void JNICALL
JVM_SetMethodInfo(JNIEnv* env, jobject frame);
+JNIEXPORT jobjectArray JNICALL
+JVM_GetVmArguments(JNIEnv *env);
+
/*
* java.lang.Thread
*/
--- a/jdk/src/java.base/share/native/libjava/jni_util.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.base/share/native/libjava/jni_util.c Thu Jan 21 10:17:21 2016 -0800
@@ -660,7 +660,8 @@
*/
if ((strcmp(encname, "8859_1") == 0) ||
(strcmp(encname, "ISO8859-1") == 0) ||
- (strcmp(encname, "ISO8859_1") == 0))
+ (strcmp(encname, "ISO8859_1") == 0) ||
+ (strcmp(encname, "ISO-8859-1") == 0))
fastEncoding = FAST_8859_1;
else if (strcmp(encname, "ISO646-US") == 0)
fastEncoding = FAST_646_US;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/unix/conf/ppc64le/jvm.cfg Thu Jan 21 10:17:21 2016 -0800
@@ -0,0 +1,34 @@
+# Copyright (c) 2011, 2015, 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.
+#
+# List of JVMs that can be used as an option to java, javac, etc.
+# Order is important -- first in this list is the default JVM.
+# NOTE that this both this file and its format are UNSUPPORTED and
+# WILL GO AWAY in a future release.
+#
+# You may also select a JVM in an arbitrary location with the
+# "-XXaltjvm=<jvm_dir>" option, but that too is unsupported
+# and may not be available in a future release.
+#
+-server KNOWN
+-client IGNORE
--- a/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DataFlavorUtil.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DataFlavorUtil.java Thu Jan 21 10:17:21 2016 -0800
@@ -55,7 +55,7 @@
/**
* Utility class with different datatransfer helper functions
*
- * @since 1.9
+ * @since 9
*/
public class DataFlavorUtil {
--- a/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DesktopDatatransferService.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DesktopDatatransferService.java Thu Jan 21 10:17:21 2016 -0800
@@ -35,7 +35,7 @@
* to enrich it's functionality
*
* @author Petr Pchelko
- * @since 1.9
+ * @since 9
*/
public interface DesktopDatatransferService {
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java Thu Jan 21 10:17:21 2016 -0800
@@ -235,6 +235,11 @@
// this will not work if the user clicks on the "Preview" button
// However if the printer is a StreamPrintService, its the right path.
PrintService psvc = getPrintService();
+
+ if (psvc == null) {
+ throw new PrinterException("No print service found.");
+ }
+
if (psvc instanceof StreamPrintService) {
spoolToService(psvc, attributes);
return;
--- a/jdk/src/java.desktop/share/classes/java/awt/RenderingHints.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/RenderingHints.java Thu Jan 21 10:17:21 2016 -0800
@@ -965,7 +965,7 @@
* <li>{@link #VALUE_RESOLUTION_VARIANT_SIZE_FIT}
* <li>{@link #VALUE_RESOLUTION_VARIANT_DPI_FIT}
* </ul>
- * @since 1.9
+ * @since 9
*/
public static final Key KEY_RESOLUTION_VARIANT =
SunHints.KEY_RESOLUTION_VARIANT;
@@ -976,7 +976,7 @@
* of the platform
*
* @see #KEY_RESOLUTION_VARIANT
- * @since 1.9
+ * @since 9
*/
public static final Object VALUE_RESOLUTION_VARIANT_DEFAULT =
SunHints.VALUE_RESOLUTION_VARIANT_DEFAULT;
@@ -986,7 +986,7 @@
* is always used.
*
* @see #KEY_RESOLUTION_VARIANT
- * @since 1.9
+ * @since 9
*/
public static final Object VALUE_RESOLUTION_VARIANT_BASE =
SunHints.VALUE_RESOLUTION_VARIANT_BASE;
@@ -997,7 +997,7 @@
* context.
*
* @see #KEY_RESOLUTION_VARIANT
- * @since 1.9
+ * @since 9
*/
public static final Object VALUE_RESOLUTION_VARIANT_SIZE_FIT =
SunHints.VALUE_RESOLUTION_VARIANT_SIZE_FIT;
@@ -1007,7 +1007,7 @@
* chosen based only on the DPI of the screen.
*
* @see #KEY_RESOLUTION_VARIANT
- * @since 1.9
+ * @since 9
*/
public static final Object VALUE_RESOLUTION_VARIANT_DPI_FIT =
SunHints.VALUE_RESOLUTION_VARIANT_DPI_FIT;
--- a/jdk/src/java.desktop/share/classes/java/awt/font/NumericShaper.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/font/NumericShaper.java Thu Jan 21 10:17:21 2016 -0800
@@ -321,12 +321,12 @@
MEETEI_MAYEK ('\uabf0', '\uabc0', '\uac00'),
/**
* The Sinhala range with the Sinhala digits.
- * @since 1.9
+ * @since 9
*/
SINHALA ('\u0de6', '\u0d80', '\u0e00'),
/**
* The Myanmar Extended-B range with the Myanmar Tai Laing digits.
- * @since 1.9
+ * @since 9
*/
MYANMAR_TAI_LAING ('\ua9f0', '\ua9e0', '\uaa00');
--- a/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java Thu Jan 21 10:17:21 2016 -0800
@@ -59,7 +59,7 @@
* @see java.awt.Image
* @see java.awt.image.MultiResolutionImage
*
- * @since 1.9
+ * @since 9
*/
public abstract class AbstractMultiResolutionImage extends java.awt.Image
implements MultiResolutionImage {
@@ -96,7 +96,7 @@
*
* @return the base image of the set of multi-resolution images
*
- * @since 1.9
+ * @since 9
*/
protected abstract Image getBaseImage();
}
\ No newline at end of file
--- a/jdk/src/java.desktop/share/classes/java/awt/image/BaseMultiResolutionImage.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/BaseMultiResolutionImage.java Thu Jan 21 10:17:21 2016 -0800
@@ -50,7 +50,7 @@
* @see java.awt.image.MultiResolutionImage
* @see java.awt.image.AbstractMultiResolutionImage
*
- * @since 1.9
+ * @since 9
*/
public class BaseMultiResolutionImage extends AbstractMultiResolutionImage {
@@ -66,7 +66,7 @@
* @throws NullPointerException if the specified {@code resolutionVariants}
* contains one or more null elements
*
- * @since 1.9
+ * @since 9
*/
public BaseMultiResolutionImage(Image... resolutionVariants) {
this(0, resolutionVariants);
@@ -86,7 +86,7 @@
* negative or greater than or equal to {@code resolutionVariants}
* length.
*
- * @since 1.9
+ * @since 9
*/
public BaseMultiResolutionImage(int baseImageIndex,
Image... resolutionVariants) {
--- a/jdk/src/java.desktop/share/classes/java/awt/image/MultiResolutionImage.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/MultiResolutionImage.java Thu Jan 21 10:17:21 2016 -0800
@@ -52,7 +52,7 @@
* @see java.awt.Toolkit#getImage(java.lang.String filename)
* @see java.awt.Toolkit#getImage(java.net.URL url)
*
- * @since 1.9
+ * @since 9
*/
public interface MultiResolutionImage {
@@ -67,7 +67,7 @@
* {@code destImageHeight} is less than or equal to zero, infinity,
* or NaN.
*
- * @since 1.9
+ * @since 9
*/
Image getResolutionVariant(double destImageWidth, double destImageHeight);
@@ -78,7 +78,7 @@
* Note that many implementations might return an unmodifiable list.
* <p>
* @return list of resolution variants.
- * @since 1.9
+ * @since 9
*/
public List<Image> getResolutionVariants();
}
\ No newline at end of file
--- a/jdk/src/java.desktop/share/classes/java/beans/BeanProperty.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/java/beans/BeanProperty.java Thu Jan 21 10:17:21 2016 -0800
@@ -39,7 +39,7 @@
* which does not imply the automatic analysis.
*
* @see BeanInfo#getPropertyDescriptors
- * @since 1.9
+ * @since 9
*
* @author Sergey A. Malenkov
*/
--- a/jdk/src/java.desktop/share/classes/java/beans/IndexedPropertyDescriptor.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/java/beans/IndexedPropertyDescriptor.java Thu Jan 21 10:17:21 2016 -0800
@@ -152,7 +152,7 @@
* and the {@code value} is the automatically generated property info
* @param bound the flag indicating whether it is possible to treat this property as a bound property
*
- * @since 1.9
+ * @since 9
*/
IndexedPropertyDescriptor(Entry<String,PropertyInfo> entry, boolean bound) {
super(entry, bound);
--- a/jdk/src/java.desktop/share/classes/java/beans/JavaBean.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/java/beans/JavaBean.java Thu Jan 21 10:17:21 2016 -0800
@@ -39,7 +39,7 @@
* which does not imply the automatic analysis.
*
* @see BeanInfo#getBeanDescriptor
- * @since 1.9
+ * @since 9
*
* @author Sergey A. Malenkov
*/
--- a/jdk/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java Thu Jan 21 10:17:21 2016 -0800
@@ -150,7 +150,7 @@
* and the {@code value} is the automatically generated property info
* @param bound the flag indicating whether it is possible to treat this property as a bound property
*
- * @since 1.9
+ * @since 9
*/
PropertyDescriptor(Entry<String,PropertyInfo> entry, boolean bound) {
String base = entry.getKey();
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibilityProvider.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibilityProvider.java Thu Jan 21 10:17:21 2016 -0800
@@ -43,7 +43,7 @@
*
* @see java.awt.Toolkit#getDefaultToolkit
* @see java.util.ServiceLoader
- * @since 1.9
+ * @since 9
*/
public abstract class AccessibilityProvider {
--- a/jdk/src/java.desktop/share/classes/javax/imageio/metadata/doc-files/tiff_metadata.html Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/metadata/doc-files/tiff_metadata.html Thu Jan 21 10:17:21 2016 -0800
@@ -1194,7 +1194,7 @@
]>
</pre>
-@since 1.9
+@since 9
</body>
</html>
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/BaselineTIFFTagSet.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/BaselineTIFFTagSet.java Thu Jan 21 10:17:21 2016 -0800
@@ -55,7 +55,7 @@
* </li>
* </ul>
*
- * @since 1.9
+ * @since 9
* @see <a href="http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf"> TIFF 6.0 Specification</a>
*/
public class BaselineTIFFTagSet extends TIFFTagSet {
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifGPSTagSet.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifGPSTagSet.java Thu Jan 21 10:17:21 2016 -0800
@@ -35,7 +35,7 @@
* <p> The definitions of the data types referenced by the field
* definitions may be found in the {@link TIFFTag TIFFTag} class.
*
- * @since 1.9
+ * @since 9
* @see ExifTIFFTagSet
*/
public class ExifGPSTagSet extends TIFFTagSet {
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifInteroperabilityTagSet.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifInteroperabilityTagSet.java Thu Jan 21 10:17:21 2016 -0800
@@ -31,7 +31,7 @@
/**
* A class representing the tags found in an Exif Interoperability IFD.
*
- * @since 1.9
+ * @since 9
* @see ExifTIFFTagSet
*/
public class ExifInteroperabilityTagSet extends TIFFTagSet {
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifParentTIFFTagSet.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifParentTIFFTagSet.java Thu Jan 21 10:17:21 2016 -0800
@@ -34,7 +34,7 @@
* TIFFImageReadParam.addAllowedTagSet} method if Exif
* support is desired.
*
- * @since 1.9
+ * @since 9
*/
public class ExifParentTIFFTagSet extends TIFFTagSet {
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifTIFFTagSet.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifTIFFTagSet.java Thu Jan 21 10:17:21 2016 -0800
@@ -39,7 +39,7 @@
* <p> The definitions of the data types referenced by the field
* definitions may be found in the {@link TIFFTag TIFFTag} class.
*
- * @since 1.9
+ * @since 9
*/
public class ExifTIFFTagSet extends TIFFTagSet {
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/FaxTIFFTagSet.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/FaxTIFFTagSet.java Thu Jan 21 10:17:21 2016 -0800
@@ -31,7 +31,7 @@
* A class representing the extra tags found in a
* <a href="http://tools.ietf.org/html/rfc2306"> TIFF-F</a> (RFC 2036) file.
*
- * @since 1.9
+ * @since 9
*/
public class FaxTIFFTagSet extends TIFFTagSet {
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java Thu Jan 21 10:17:21 2016 -0800
@@ -39,7 +39,7 @@
* <p>The definitions of the data types referenced by the field
* definitions may be found in the {@link TIFFTag TIFFTag} class.</p>
*
- * @since 1.9
+ * @since 9
*/
public class GeoTIFFTagSet extends TIFFTagSet {
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java Thu Jan 21 10:17:21 2016 -0800
@@ -95,7 +95,7 @@
* or removing <code>TIFFField</code>s or <code>TIFFTagSet</code>s, it
* <i>must</i> be synchronized externally.</p>
*
- * @since 1.9
+ * @since 9
* @see IIOMetadata
* @see TIFFField
* @see TIFFTag
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java Thu Jan 21 10:17:21 2016 -0800
@@ -257,7 +257,7 @@
*
* </table>
*
- * @since 1.9
+ * @since 9
* @see TIFFDirectory
* @see TIFFTag
*/
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFImageReadParam.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFImageReadParam.java Thu Jan 21 10:17:21 2016 -0800
@@ -46,7 +46,7 @@
* <code>ExifParentTIFFTagSet</code>, and <code>GeoTIFFTagSet</code>
* are included.
*
- * @since 1.9
+ * @since 9
*/
public class TIFFImageReadParam extends ImageReadParam {
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTag.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTag.java Thu Jan 21 10:17:21 2016 -0800
@@ -40,7 +40,7 @@
* tiff stream are defined in the {@link BaselineTIFFTagSet
* BaselineTIFFTagSet} class.
*
- * @since 1.9
+ * @since 9
* @see BaselineTIFFTagSet
* @see TIFFField
* @see TIFFTagSet
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTagSet.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTagSet.java Thu Jan 21 10:17:21 2016 -0800
@@ -44,7 +44,7 @@
* name, legal data types, and mnemonic names for some or all of ts
* data values.
*
- * @since 1.9
+ * @since 9
* @see TIFFTag
*/
public class TIFFTagSet {
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/package.html Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/package.html Thu Jan 21 10:17:21 2016 -0800
@@ -46,6 +46,6 @@
<br>
<br>
-@since 1.9
+@since 9
</body>
</html>
--- a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java Thu Jan 21 10:17:21 2016 -0800
@@ -616,7 +616,7 @@
* Returns the look and feel delegate that renders this component.
*
* @return the {@code ComponentUI} object that renders this component
- * @since 1.9
+ * @since 9
*/
@Transient
public ComponentUI getUI() {
--- a/jdk/src/java.desktop/share/classes/javax/swing/SwingContainer.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/SwingContainer.java Thu Jan 21 10:17:21 2016 -0800
@@ -45,7 +45,7 @@
* with the {@code isContainer} attribute allow to directly specify
* whether a Swing component is a container or not.
*
- * @since 1.9
+ * @since 9
*
* @author Sergey A. Malenkov
*/
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/AbstractDocument.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/AbstractDocument.java Thu Jan 21 10:17:21 2016 -0800
@@ -3023,7 +3023,7 @@
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public void lockEdit() {
@@ -3032,7 +3032,7 @@
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public void unlockEdit() {
--- a/jdk/src/java.desktop/share/classes/sun/awt/datatransfer/DesktopDatatransferServiceImpl.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/awt/datatransfer/DesktopDatatransferServiceImpl.java Thu Jan 21 10:17:21 2016 -0800
@@ -39,7 +39,7 @@
* {@code DesktopDatatransferService} interface.
*
* @author Petr Pchelko
- * @since 1.9
+ * @since 9
*/
public class DesktopDatatransferServiceImpl implements DesktopDatatransferService {
--- a/jdk/src/java.desktop/share/classes/sun/swing/text/UndoableEditLockSupport.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/swing/text/UndoableEditLockSupport.java Thu Jan 21 10:17:21 2016 -0800
@@ -28,7 +28,7 @@
/**
* UndoableEdit support for undo/redo actions synchronization
- * @since 1.9
+ * @since 9
*/
public interface UndoableEditLockSupport extends UndoableEdit {
/**
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/ContextualSubstSubtables.cpp Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/ContextualSubstSubtables.cpp Thu Jan 21 10:17:21 2016 -0800
@@ -243,14 +243,14 @@
le_uint16 srSetCount = SWAPW(subRuleSetCount);
if (coverageIndex < srSetCount) {
- LEReferenceToArrayOf<Offset> subRuleSetTableOffsetArrayRef(base, success,
- &subRuleSetTableOffsetArray[coverageIndex], 1);
+ LEReferenceToArrayOf<Offset>
+ subRuleSetTableOffsetArrayRef(base, success, subRuleSetTableOffsetArray, srSetCount);
if (LE_FAILURE(success)) {
return 0;
}
Offset subRuleSetTableOffset = SWAPW(subRuleSetTableOffsetArray[coverageIndex]);
- LEReferenceTo<SubRuleSetTable>
- subRuleSetTable(base, success, (const SubRuleSetTable *) ((char *) this + subRuleSetTableOffset));
+ LEReferenceTo<SubRuleSetTable> subRuleSetTable(base, success, subRuleSetTableOffset);
+ if (LE_FAILURE(success)) { return 0; }
le_uint16 subRuleCount = SWAPW(subRuleSetTable->subRuleCount);
le_int32 position = glyphIterator->getCurrStreamPosition();
@@ -264,6 +264,7 @@
SWAPW(subRuleSetTable->subRuleTableOffsetArray[subRule]);
LEReferenceTo<SubRuleTable>
subRuleTable(subRuleSetTable, success, subRuleTableOffset);
+ if (LE_FAILURE(success)) { return 0; }
le_uint16 matchCount = SWAPW(subRuleTable->glyphCount) - 1;
le_uint16 substCount = SWAPW(subRuleTable->substCount);
LEReferenceToArrayOf<TTGlyphID> inputGlyphArray(base, success, subRuleTable->inputGlyphArray, matchCount+2);
@@ -304,8 +305,8 @@
}
if (coverageIndex >= 0) {
- LEReferenceTo<ClassDefinitionTable> classDefinitionTable(base, success,
- (const ClassDefinitionTable *) ((char *) this + SWAPW(classDefTableOffset)));
+ LEReferenceTo<ClassDefinitionTable> classDefinitionTable(base, success, SWAPW(classDefTableOffset));
+ if (LE_FAILURE(success)) { return 0; }
le_uint16 scSetCount = SWAPW(subClassSetCount);
le_int32 setClass = classDefinitionTable->getGlyphClass(classDefinitionTable,
glyphIterator->getCurrGlyphID(),
@@ -313,13 +314,13 @@
if (setClass < scSetCount) {
LEReferenceToArrayOf<Offset>
- subClassSetTableOffsetArrayRef(base, success, subClassSetTableOffsetArray, setClass);
+ subClassSetTableOffsetArrayRef(base, success, subClassSetTableOffsetArray, scSetCount);
if (LE_FAILURE(success)) { return 0; }
if (subClassSetTableOffsetArray[setClass] != 0) {
Offset subClassSetTableOffset = SWAPW(subClassSetTableOffsetArray[setClass]);
- LEReferenceTo<SubClassSetTable>
- subClassSetTable(base, success, (const SubClassSetTable *) ((char *) this + subClassSetTableOffset));
+ LEReferenceTo<SubClassSetTable> subClassSetTable(base, success, subClassSetTableOffset);
+ if (LE_FAILURE(success)) { return 0; }
le_uint16 subClassRuleCount = SWAPW(subClassSetTable->subClassRuleCount);
le_int32 position = glyphIterator->getCurrStreamPosition();
LEReferenceToArrayOf<Offset>
@@ -332,6 +333,7 @@
SWAPW(subClassSetTable->subClassRuleTableOffsetArray[scRule]);
LEReferenceTo<SubClassRuleTable>
subClassRuleTable(subClassSetTable, success, subClassRuleTableOffset);
+ if (LE_FAILURE(success)) { return 0; }
le_uint16 matchCount = SWAPW(subClassRuleTable->glyphCount) - 1;
le_uint16 substCount = SWAPW(subClassRuleTable->substCount);
@@ -463,13 +465,13 @@
if (coverageIndex < srSetCount) {
LEReferenceToArrayOf<Offset>
- chainSubRuleSetTableOffsetArrayRef(base, success, chainSubRuleSetTableOffsetArray, coverageIndex);
+ chainSubRuleSetTableOffsetArrayRef(base, success, chainSubRuleSetTableOffsetArray, srSetCount);
if (LE_FAILURE(success)) {
return 0;
}
Offset chainSubRuleSetTableOffset = SWAPW(chainSubRuleSetTableOffsetArray[coverageIndex]);
- LEReferenceTo<ChainSubRuleSetTable>
- chainSubRuleSetTable(base, success, (const ChainSubRuleSetTable *) ((char *) this + chainSubRuleSetTableOffset));
+ LEReferenceTo<ChainSubRuleSetTable> chainSubRuleSetTable(base, success, chainSubRuleSetTableOffset);
+ if (LE_FAILURE(success)) { return 0; }
le_uint16 chainSubRuleCount = SWAPW(chainSubRuleSetTable->chainSubRuleCount);
le_int32 position = glyphIterator->getCurrStreamPosition();
GlyphIterator tempIterator(*glyphIterator, emptyFeatureList);
@@ -550,17 +552,17 @@
if (coverageIndex >= 0) {
LEReferenceTo<ClassDefinitionTable>
- backtrackClassDefinitionTable(base, success, (const ClassDefinitionTable *) ((char *) this + SWAPW(backtrackClassDefTableOffset)));
+ backtrackClassDefinitionTable(base, success, SWAPW(backtrackClassDefTableOffset));
LEReferenceTo<ClassDefinitionTable>
- inputClassDefinitionTable(base, success, (const ClassDefinitionTable *) ((char *) this + SWAPW(inputClassDefTableOffset)));
+ inputClassDefinitionTable(base, success, SWAPW(inputClassDefTableOffset));
LEReferenceTo<ClassDefinitionTable>
- lookaheadClassDefinitionTable(base, success, (const ClassDefinitionTable *) ((char *) this + SWAPW(lookaheadClassDefTableOffset)));
+ lookaheadClassDefinitionTable(base, success, SWAPW(lookaheadClassDefTableOffset));
le_uint16 scSetCount = SWAPW(chainSubClassSetCount);
le_int32 setClass = inputClassDefinitionTable->getGlyphClass(inputClassDefinitionTable,
glyphIterator->getCurrGlyphID(),
success);
LEReferenceToArrayOf<Offset>
- chainSubClassSetTableOffsetArrayRef(base, success, chainSubClassSetTableOffsetArray, setClass);
+ chainSubClassSetTableOffsetArrayRef(base, success, chainSubClassSetTableOffsetArray, scSetCount);
if (LE_FAILURE(success)) {
return 0;
}
@@ -568,7 +570,8 @@
if (setClass < scSetCount && chainSubClassSetTableOffsetArray[setClass] != 0) {
Offset chainSubClassSetTableOffset = SWAPW(chainSubClassSetTableOffsetArray[setClass]);
LEReferenceTo<ChainSubClassSetTable>
- chainSubClassSetTable(base, success, (const ChainSubClassSetTable *) ((char *) this + chainSubClassSetTableOffset));
+ chainSubClassSetTable(base, success, chainSubClassSetTableOffset);
+ if (LE_FAILURE(success)) { return 0; }
le_uint16 chainSubClassRuleCount = SWAPW(chainSubClassSetTable->chainSubClassRuleCount);
le_int32 position = glyphIterator->getCurrStreamPosition();
GlyphIterator tempIterator(*glyphIterator, emptyFeatureList);
@@ -582,6 +585,7 @@
SWAPW(chainSubClassSetTable->chainSubClassRuleTableOffsetArray[scRule]);
LEReferenceTo<ChainSubClassRuleTable>
chainSubClassRuleTable(chainSubClassSetTable, success, chainSubClassRuleTableOffset);
+ if (LE_FAILURE(success)) { return 0; }
le_uint16 backtrackGlyphCount = SWAPW(chainSubClassRuleTable->backtrackGlyphCount);
LEReferenceToArrayOf<le_uint16> backtrackClassArray(base, success, chainSubClassRuleTable->backtrackClassArray, backtrackGlyphCount);
if( LE_FAILURE(success) ) { return 0; }
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/CursiveAttachmentSubtables.cpp Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/CursiveAttachmentSubtables.cpp Thu Jan 21 10:17:21 2016 -0800
@@ -46,7 +46,7 @@
le_uint16 eeCount = SWAPW(entryExitCount);
LEReferenceToArrayOf<EntryExitRecord>
- entryExitRecordsArrayRef(base, success, entryExitRecords, coverageIndex);
+ entryExitRecordsArrayRef(base, success, entryExitRecords, eeCount);
if (coverageIndex < 0 || coverageIndex >= eeCount || LE_FAILURE(success)) {
glyphIterator->setCursiveGlyph();
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/Features.cpp Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/Features.cpp Thu Jan 21 10:17:21 2016 -0800
@@ -41,11 +41,12 @@
LEReferenceTo<FeatureTable> FeatureListTable::getFeatureTable(const LETableReference &base, le_uint16 featureIndex, LETag *featureTag, LEErrorCode &success) const
{
LEReferenceToArrayOf<FeatureRecord>
- featureRecordArrayRef(base, success, featureRecordArray, featureIndex+1);
+ featureRecordArrayRef(base, success, featureRecordArray, SWAPW(featureCount));
- if (featureIndex >= SWAPW(featureCount) || LE_FAILURE(success)) {
- return LEReferenceTo<FeatureTable>();
- }
+ if (featureIndex >= SWAPW(featureCount) || LE_FAILURE(success)) {
+ success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
+ return LEReferenceTo<FeatureTable>();
+ }
Offset featureTableOffset = featureRecordArray[featureIndex].featureTableOffset;
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor.cpp Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor.cpp Thu Jan 21 10:17:21 2016 -0800
@@ -76,11 +76,11 @@
}
if (flags & irfMarkFirst) {
- firstGlyph = (le_uint32)currGlyph;
+ firstGlyph = currGlyph;
}
if (flags & irfMarkLast) {
- lastGlyph = (le_uint32)currGlyph;
+ lastGlyph = currGlyph;
}
doRearrangementAction(glyphStorage, (IndicRearrangementVerb) (flags & irfVerbMask), success);
@@ -118,7 +118,7 @@
if (firstGlyph == lastGlyph) break;
if (firstGlyph + 1 < firstGlyph) {
success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
- break;
+ break;
}
a = glyphStorage[firstGlyph];
ia = glyphStorage.getCharIndex(firstGlyph, success);
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor.h Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor.h Thu Jan 21 10:17:21 2016 -0800
@@ -76,8 +76,8 @@
static UClassID getStaticClassID();
protected:
- le_uint32 firstGlyph;
- le_uint32 lastGlyph;
+ le_int32 firstGlyph;
+ le_int32 lastGlyph;
LEReferenceTo<IndicRearrangementSubtableHeader> indicRearrangementSubtableHeader;
LEReferenceToArrayOf<IndicRearrangementStateEntry> entryTable;
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor2.cpp Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor2.cpp Thu Jan 21 10:17:21 2016 -0800
@@ -74,11 +74,11 @@
}
if (flags & irfMarkFirst) {
- firstGlyph = (le_uint32)currGlyph;
+ firstGlyph = currGlyph;
}
if (flags & irfMarkLast) {
- lastGlyph = (le_uint32)currGlyph;
+ lastGlyph = currGlyph;
}
doRearrangementAction(glyphStorage, (IndicRearrangementVerb) (flags & irfVerbMask), success);
@@ -115,7 +115,7 @@
if (firstGlyph == lastGlyph) break;
if (firstGlyph + 1 < firstGlyph) {
success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
- break;
+ break;
}
a = glyphStorage[firstGlyph];
ia = glyphStorage.getCharIndex(firstGlyph, success);
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor2.h Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor2.h Thu Jan 21 10:17:21 2016 -0800
@@ -76,8 +76,8 @@
static UClassID getStaticClassID();
protected:
- le_uint32 firstGlyph;
- le_uint32 lastGlyph;
+ le_int32 firstGlyph;
+ le_int32 lastGlyph;
LEReferenceToArrayOf<IndicRearrangementStateEntry2> entryTable;
LEReferenceTo<IndicRearrangementSubtableHeader2> indicRearrangementSubtableHeader;
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/Lookups.cpp Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/Lookups.cpp Thu Jan 21 10:17:21 2016 -0800
@@ -42,6 +42,7 @@
LEReferenceToArrayOf<Offset> lookupTableOffsetArrayRef(base, success, (const Offset*)&lookupTableOffsetArray, SWAPW(lookupCount));
if(LE_FAILURE(success) || lookupTableIndex>lookupTableOffsetArrayRef.getCount()) {
+ success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
return LEReferenceTo<LookupTable>();
} else {
return LEReferenceTo<LookupTable>(base, success, SWAPW(lookupTableOffsetArrayRef.getObject(lookupTableIndex, success)));
@@ -53,6 +54,7 @@
LEReferenceToArrayOf<Offset> subTableOffsetArrayRef(base, success, (const Offset*)&subTableOffsetArray, SWAPW(subTableCount));
if(LE_FAILURE(success) || subtableIndex>subTableOffsetArrayRef.getCount()) {
+ success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
return LEReferenceTo<LookupSubtable>();
} else {
return LEReferenceTo<LookupSubtable>(base, success, SWAPW(subTableOffsetArrayRef.getObject(subtableIndex, success)));
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/MarkToBasePosnSubtables.cpp Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/MarkToBasePosnSubtables.cpp Thu Jan 21 10:17:21 2016 -0800
@@ -93,7 +93,7 @@
}
LEReferenceTo<BaseRecord> baseRecord(base, success, &baseArray->baseRecordArray[baseCoverage * mcCount]);
if( LE_FAILURE(success) ) { return 0; }
- LEReferenceToArrayOf<Offset> baseAnchorTableOffsetArray(base, success, &(baseRecord->baseAnchorTableOffsetArray[0]), markClass+1);
+ LEReferenceToArrayOf<Offset> baseAnchorTableOffsetArray(base, success, &(baseRecord->baseAnchorTableOffsetArray[0]), mcCount);
if( LE_FAILURE(success) ) { return 0; }
Offset anchorTableOffset = SWAPW(baseRecord->baseAnchorTableOffsetArray[markClass]);
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/MarkToLigaturePosnSubtables.cpp Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/MarkToLigaturePosnSubtables.cpp Thu Jan 21 10:17:21 2016 -0800
@@ -83,6 +83,7 @@
LEGlyphID ligatureGlyph = findLigatureGlyph(&ligatureIterator);
le_int32 ligatureCoverage = getBaseCoverage(base, (LEGlyphID) ligatureGlyph, success);
LEReferenceTo<LigatureArray> ligatureArray(base, success, SWAPW(baseArrayOffset));
+ if (LE_FAILURE(success)) { return 0; }
le_uint16 ligatureCount = SWAPW(ligatureArray->ligatureCount);
if (ligatureCoverage < 0 || ligatureCoverage >= ligatureCount) {
@@ -95,6 +96,7 @@
le_int32 markPosition = glyphIterator->getCurrStreamPosition();
Offset ligatureAttachOffset = SWAPW(ligatureArray->ligatureAttachTableOffsetArray[ligatureCoverage]);
LEReferenceTo<LigatureAttachTable> ligatureAttachTable(ligatureArray, success, ligatureAttachOffset);
+ if (LE_FAILURE(success)) { return 0; }
le_int32 componentCount = SWAPW(ligatureAttachTable->componentCount);
le_int32 component = ligatureIterator.getMarkComponent(markPosition);
@@ -104,10 +106,12 @@
}
LEReferenceTo<ComponentRecord> componentRecord(base, success, &ligatureAttachTable->componentRecordArray[component * mcCount]);
- LEReferenceToArrayOf<Offset> ligatureAnchorTableOffsetArray(base, success, &(componentRecord->ligatureAnchorTableOffsetArray[0]), markClass+1);
+ if (LE_FAILURE(success)) { return 0; }
+ LEReferenceToArrayOf<Offset> ligatureAnchorTableOffsetArray(base, success, &(componentRecord->ligatureAnchorTableOffsetArray[0]), mcCount);
if( LE_FAILURE(success) ) { return 0; }
Offset anchorTableOffset = SWAPW(componentRecord->ligatureAnchorTableOffsetArray[markClass]);
LEReferenceTo<AnchorTable> anchorTable(ligatureAttachTable, success, anchorTableOffset);
+ if (LE_FAILURE(success)) { return 0; }
LEPoint ligatureAnchor, markAdvance, pixels;
anchorTable->getAnchor(anchorTable, ligatureGlyph, fontInstance, ligatureAnchor, success);
--- a/jdk/src/java.desktop/share/native/libjavajpeg/jpegdecoder.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libjavajpeg/jpegdecoder.c Thu Jan 21 10:17:21 2016 -0800
@@ -180,6 +180,7 @@
int *ip;
unsigned char *bp;
} outbuf;
+ size_t outbufSize;
jobject hOutputBuffer;
};
@@ -233,6 +234,7 @@
}
if (src->hOutputBuffer) {
assert(src->outbuf.ip == 0);
+ src->outbufSize = (*env)->GetArrayLength(env, src->hOutputBuffer);
src->outbuf.ip = (int *)(*env)->GetPrimitiveArrayCritical
(env, src->hOutputBuffer, 0);
if (src->outbuf.ip == 0) {
@@ -677,8 +679,8 @@
cinfo.output_scanline - 1);
} else {
if (hasalpha) {
- ip = jsrc.outbuf.ip + cinfo.image_width;
- bp = jsrc.outbuf.bp + cinfo.image_width * 4;
+ ip = jsrc.outbuf.ip + jsrc.outbufSize;
+ bp = jsrc.outbuf.bp + jsrc.outbufSize * 4;
while (ip > jsrc.outbuf.ip) {
pixel = (*--bp) << 24;
pixel |= (*--bp);
@@ -687,8 +689,8 @@
*--ip = pixel;
}
} else {
- ip = jsrc.outbuf.ip + cinfo.image_width;
- bp = jsrc.outbuf.bp + cinfo.image_width * 3;
+ ip = jsrc.outbuf.ip + jsrc.outbufSize;
+ bp = jsrc.outbuf.bp + jsrc.outbufSize * 3;
while (ip > jsrc.outbuf.ip) {
pixel = (*--bp);
pixel |= (*--bp) << 8;
--- a/jdk/src/java.desktop/share/native/liblcms/cmscgats.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/liblcms/cmscgats.c Thu Jan 21 10:17:21 2016 -0800
@@ -2545,9 +2545,11 @@
for (i=0; i < t->nSamples; i++) {
fld = GetDataFormat(it8, i);
+ if (fld != NULL) {
if (cmsstrcasecmp(fld, cSample) == 0)
return i;
}
+ }
return -1;
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES Thu Jan 21 10:17:21 2016 -0800
@@ -23,13 +23,17 @@
* questions.
*/
+#if 0
CHANGES - changes for libpng
-Version 0.2
+version 0.1 [March 29, 1995]
+ initial work-in-progress release
+
+version 0.2 [April 1, 1995]
added reader into png.h
fixed small problems in stub file
-Version 0.3
+version 0.3 [April 8, 1995]
added pull reader
split up pngwrite.c to several files
added pnglib.txt
@@ -38,9 +42,9 @@
fixed some bugs in writer
interfaced with zlib 0.5
added K&R support
- added check for 64 KB blocks for 16-bit machines
-
-Version 0.4
+ added check for 64 KB blocks for 16 bit machines
+
+version 0.4 [April 26, 1995]
cleaned up code and commented code
simplified time handling into png_time
created png_color_16 and png_color_8 to handle color needs
@@ -51,28 +55,29 @@
cleaned up zTXt reader and writer (using zlib's Reset functions)
split transformations into pngrtran.c and pngwtran.c
-Version 0.5
+version 0.5 [April 30, 1995]
interfaced with zlib 0.8
fixed many reading and writing bugs
saved using 3 spaces instead of tabs
-Version 0.6
+version 0.6 [May 1, 1995]
+ first beta release
added png_large_malloc() and png_large_free()
added png_size_t
cleaned up some compiler warnings
added png_start_read_image()
-Version 0.7
+version 0.7 [June 24, 1995]
cleaned up lots of bugs
finished dithering and other stuff
added test program
changed name from pnglib to libpng
-Version 0.71 [June, 1995]
+version 0.71 [June 26, 1995]
changed pngtest.png for zlib 0.93
fixed error in libpng.txt and example.c
-Version 0.8
+version 0.8 [August 20, 1995]
cleaned up some bugs
added png_set_filler()
split up pngstub.c into pngmem.c, pngio.c, and pngerror.c
@@ -115,7 +120,7 @@
cleaned up documentation
added callbacks for read/write and warning/error functions
-Version 0.89 [July, 1996]
+Version 0.89 [June 5, 1996]
Added new initialization API to make libpng work better with shared libs
we now have png_create_read_struct(), png_create_write_struct(),
png_create_info_struct(), png_destroy_read_struct(), and
@@ -142,6 +147,9 @@
New pngtest image also has interlacing and zTXt
Updated documentation to reflect new API
+Version 0.89c [June 17, 1996]
+ Bug fixes.
+
Version 0.90 [January, 1997]
Made CRC errors/warnings on critical and ancillary chunks configurable
libpng will use the zlib CRC routines by (compile-time) default
@@ -182,7 +190,7 @@
Added new pCAL chunk read/write support
Added experimental filter selection weighting (Greg Roelofs)
Removed old png_set_rgbx() and png_set_xrgb() functions that have been
- obsolete for about 2 years now (use png_set_filler() instead)
+ obsolete for about 2 years now (use png_set_filler() instead)
Added macros to read 16- and 32-bit ints directly from buffer, to be
used only on those systems that support it (namely PowerPC and 680x0)
With some testing, this may become the default for MACOS/PPC systems.
@@ -464,7 +472,7 @@
Version 1.0.3a [August 12, 1999]
Added check for PNG_READ_INTERLACE_SUPPORTED in pngread.c; issue a warning
- if an attempt is made to read an interlaced image when it's not supported.
+ if an attempt is made to read an interlaced image when it's not supported.
Added check if png_ptr->trans is defined before freeing it in pngread.c
Modified the Y2K statement to include versions back to version 0.71
Fixed a bug in the check for valid IHDR bit_depth/color_types in pngrutil.c
@@ -472,7 +480,7 @@
Replaced leading blanks with tab characters in makefile.hux
Changed "dworkin.wustl.edu" to "ccrc.wustl.edu" in various documents.
Changed (float)red and (float)green to (double)red, (double)green
- in png_set_rgb_to_gray() to avoid "promotion" problems in AIX.
+ in png_set_rgb_to_gray() to avoid "promotion" problems in AIX.
Fixed a bug in pngconf.h that omitted <stdio.h> when PNG_DEBUG==0 (K Bracey).
Reformatted libpng.3 and libpngpf.3 with proper fonts (script by J. vanZandt).
Updated documentation to refer to the PNG-1.2 specification.
@@ -515,7 +523,7 @@
Added new png_expand functions to scripts/pngdef.pas and pngos2.def
Added a demo read_user_transform_fn that examines the row filters in pngtest.c
-Version 1.0.4 [September 24, 1999]
+Version 1.0.4 [September 24, 1999, not distributed publicly]
Define PNG_ALWAYS_EXTERN in pngconf.h if __STDC__ is defined
Delete #define PNG_INTERNAL and include "png.h" from pngasmrd.h
Made several minor corrections to pngtest.c
@@ -542,6 +550,7 @@
Added a "png_check_version" function in png.c and pngtest.c that will generate
a helpful compiler error if an old png.h is found in the search path.
Changed type of png_user_transform_depth|channels from int to png_byte.
+ Added "Libpng is OSI Certified Open Source Software" statement to png.h
Version 1.0.4d [October 6, 1999]
Changed 0.45 to 0.45455 in png_set_sRGB()
@@ -928,7 +937,7 @@
Version 1.0.8beta1 [July 8, 2000]
Added png_free(png_ptr, key) two places in pngpread.c to stop memory leaks.
Changed PNG_NO_STDIO to PNG_NO_CONSOLE_IO, several places in pngrutil.c and
- pngwutil.c.
+ pngwutil.c.
Changed PNG_EXPORT_VAR to use PNG_IMPEXP, in pngconf.h.
Removed unused "#include <assert.h>" from png.c
Added WindowsCE support.
@@ -936,12 +945,12 @@
Version 1.0.8beta2 [July 10, 2000]
Added project files to the wince directory and made further revisions
- of pngtest.c, pngrio.c, and pngwio.c in support of WindowsCE.
+ of pngtest.c, pngrio.c, and pngwio.c in support of WindowsCE.
Version 1.0.8beta3 [July 11, 2000]
Only set the PNG_FLAG_FREE_TRNS or PNG_FREE_TRNS flag in png_handle_tRNS()
- for indexed-color input files to avoid potential double-freeing trans array
- under some unusual conditions; problem was introduced in version 1.0.6f.
+ for indexed-color input files to avoid potential double-freeing trans array
+ under some unusual conditions; problem was introduced in version 1.0.6f.
Further revisions to pngtest.c and files in the wince subdirectory.
Version 1.0.8beta4 [July 14, 2000]
@@ -1113,16 +1122,16 @@
Version 1.2.0beta4 [June 23, 2001]
Check for missing profile length field in iCCP chunk and free chunk_data
- in case of truncated iCCP chunk.
+ in case of truncated iCCP chunk.
Bumped shared-library number to 3 in makefile.sgi and makefile.sggcc
Bumped dll-number from 2 to 3 in makefile.cygwin
Revised contrib/gregbook/rpng*-x.c to avoid a memory leak and to exit cleanly
- if user attempts to run it on an 8-bit display.
+ if user attempts to run it on an 8-bit display.
Updated contrib/gregbook
Use png_malloc instead of png_zalloc to allocate palette in pngset.c
Updated makefile.ibmc
Added some typecasts to eliminate gcc 3.0 warnings. Changed prototypes
- of png_write_oFFS width and height from png_uint_32 to png_int_32.
+ of png_write_oFFS width and height from png_uint_32 to png_int_32.
Updated example.c
Revised prototypes for png_debug_malloc and png_debug_free in pngtest.c
@@ -1130,9 +1139,9 @@
Revised contrib/gregbook
Revised makefile.gcmmx
Revised pnggccrd.c to conditionally compile some thread-unsafe code only
- when PNG_THREAD_UNSAFE_OK is defined.
+ when PNG_THREAD_UNSAFE_OK is defined.
Added tests to prevent pngwutil.c from writing a bKGD or tRNS chunk with
- value exceeding 2^bit_depth-1
+ value exceeding 2^bit_depth-1
Revised makefile.sgi and makefile.sggcc
Replaced calls to fprintf(stderr,...) with png_warning() in pnggccrd.c
Removed restriction that do_invert_mono only operate on 1-bit opaque files
@@ -1473,8 +1482,9 @@
Use png_malloc instead of png_zalloc to allocate the pallete.
Version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004]
- Fixed buffer overflow vulnerability in png_handle_tRNS()
- Fixed integer arithmetic overflow vulnerability in png_read_png().
+ Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS().
+ Fixed NULL dereference vulnerability (CVE-2004-0598) in png_handle_iCCP().
+ Fixed integer overflow vulnerability (CVE-2004-0599) in png_read_png().
Fixed some harmless bugs in png_handle_sBIT, etc, that would cause
duplicate chunk types to go undetected.
Fixed some timestamps in the -config version
@@ -1517,7 +1527,7 @@
Version 1.0.16rc5 and 1.2.6rc5 [August 10, 2004]
Moved "PNG_HANDLE_CHUNK_*" macros out of PNG_ASSEMBLER_CODE_SUPPORTED
- section of png.h where they were inadvertently placed in version rc3.
+ section of png.h where they were inadvertently placed in version rc3.
Version 1.2.6 and 1.0.16 [August 15, 2004]
Revised pngtest so memory allocation testing is only done when PNG_DEBUG==1.
@@ -2126,7 +2136,7 @@
png_decompress_chunk(), and remove "chunkdata" from parameter list.
Put a call to png_check_chunk_name() in png_read_chunk_header().
Revised png_check_chunk_name() to reject a name with a lowercase 3rd byte.
- Removed two calls to png_check_chunk_name() occuring later in the process.
+ Removed two calls to png_check_chunk_name() occurring later in the process.
Define PNG_NO_ERROR_NUMBERS by default in pngconf.h
Version 1.4.0beta25 [July 30, 2008]
@@ -2349,7 +2359,7 @@
Version 1.4.0beta64 [June 24, 2009]
Eliminated PNG_LEGACY_SUPPORTED code.
Moved the various unknown chunk macro definitions outside of the
- PNG_READ|WRITE_ANCILLARY_CHUNK_SUPPORTED blocks.
+ PNG_READ|WRITE_ANCILLARY_CHUNK_SUPPORTED blocks.
Version 1.4.0beta65 [June 26, 2009]
Added a reference to the libpng license in each file.
@@ -3771,8 +3781,9 @@
Version 1.5.7beta05 [November 25, 2011]
Removed "zTXt" from warning in generic chunk decompression function.
- Validate time settings passed to pngset() and png_convert_to_rfc1123()
- (Frank Busse).
+ Validate time settings passed to png_set_tIME() and png_convert_to_rfc1123()
+ (Frank Busse). Note: This prevented CVE-2015-7981 from affecting
+ libpng-1.5.7 and later.
Added MINGW support to CMakeLists.txt
Reject invalid compression flag or method when reading the iTXt chunk.
Backed out 'simplified' API changes. The API seems too complex and there
@@ -3818,12 +3829,13 @@
(the other two required headers aren't used). Non-ANSI systems that don't
have stddef.h or limits.h will have to provide an appropriate fake
containing the relevant types and #defines.
- The use of FAR/far has been eliminated and the definition of png_alloc_size_t
- is now controlled by a flag so that 'small size_t' systems can select it
- if necessary. Libpng 1.6 may not currently work on such systems -- it
- seems likely that it will ask 'malloc' for more than 65535 bytes with any
- image that has a sufficiently large row size (rather than simply failing
- to read such images).
+ Dropped support for 16-bit platforms. The use of FAR/far has been eliminated
+ and the definition of png_alloc_size_t is now controlled by a flag so
+ that 'small size_t' systems can select it if necessary. Libpng 1.6 may
+ not currently work on such systems -- it seems likely that it will
+ ask 'malloc' for more than 65535 bytes with any image that has a
+ sufficiently large row size (rather than simply failing to read such
+ images).
New tools directory containing tools used to generate libpng code.
Fixed race conditions in parallel make builds. With higher degrees of
parallelism during 'make' the use of the same temporary file names such
@@ -4435,7 +4447,7 @@
Version 1.6.1beta03 [February 22, 2013]
Fixed ALIGNED_MEMORY support.
- Allow run-time ARM NEON checking to be disabled. A new configure option:
+ Added a new configure option:
--enable-arm-neon=always will stop the run-time checks. New checks
within arm/arm_init.c will cause the code not to be compiled unless
__ARM_NEON__ is set. This should make it fail safe (if someone asks
@@ -4454,10 +4466,10 @@
Version 1.6.1beta06 [March 4, 2013]
Better documentation of unknown handling API interactions.
Corrected Android builds and corrected libpng.vers with symbol
- prefixing. This adds an API to set optimization options externally,
+ prefixing. It also makes those tests compile and link on Android.
+ Added an API png_set_option() to set optimization options externally,
providing an alternative and general solution for the non-portable
- run-time tests used by the ARM Neon code. It also makes those tests
- compile and link on Android.
+ run-time tests used by the ARM Neon code, using the PNG_ARM_NEON option.
The order of settings vs options in pnglibconf.h is reversed to allow
settings to depend on options and options can now set (or override) the
defaults for settings.
@@ -4549,13 +4561,14 @@
Expanded manual paragraph about writing private chunks, particularly
the need to call png_set_keep_unknown_chunks() when writing them.
Avoid dereferencing NULL pointer possibly returned from
- png_create_write_struct() (Andrew Church).
+ png_create_write_struct() (Andrew Church).
Version 1.6.3beta05 [May 9, 2013]
Calculate our own zlib windowBits when decoding rather than trusting the
CMF bytes in the PNG datastream.
Added an option to force maximum window size for inflating, which was
- the behavior of libpng15 and earlier.
+ the behavior of libpng15 and earlier, via a new PNG_MAXIMUM_INFLATE_WINDOW
+ option for png_set_options().
Added png-fix-itxt and png-fix-too-far-back to the built programs and
removed warnings from the source code and timepng that are revealed as
a result.
@@ -5138,17 +5151,326 @@
Version 1.6.16rc01 [December 21, 2014]
Restored a test on width that was removed from png.c at libpng-1.6.9
- (Bug report by Alex Eubanks).
+ (Bug report by Alex Eubanks, CVE-2015-0973).
Version 1.6.16rc02 [December 21, 2014]
Undid the update to pngrutil.c in 1.6.16rc01.
Version 1.6.16rc03 [December 21, 2014]
- Fixed an overflow in png_combine_row with very wide interlaced images.
+ Fixed an overflow in png_combine_row() with very wide interlaced images
+ (Bug report and fix by John Bowler, CVE-2014-9495).
Version 1.6.16 [December 22, 2014]
No changes.
+Version 1.6.17beta01 [January 29, 2015]
+ Removed duplicate PNG_SAFE_LIMITS_SUPPORTED handling from pngconf.h
+ Corrected the width limit calculation in png_check_IHDR().
+ Removed user limits from pngfix. Also pass NULL pointers to
+ png_read_row to skip the unnecessary row de-interlace stuff.
+ Added testing of png_set_packing() to pngvalid.c
+ Regenerated configure scripts in the *.tar distributions with libtool-2.4.4
+ Implement previously untested cases of libpng transforms in pngvalid.c
+ Fixed byte order in png_do_read_filler() with 16-bit input. Previously
+ the high and low bytes of the filler, from png_set_filler() or from
+ png_set_add_alpha(), were read in the wrong order.
+ Made the check for out-of-range values in png_set_tRNS() detect
+ values that are exactly 2^bit_depth, and work on 16-bit platforms.
+ Merged some parts of libpng-1.6.17beta01 and libpng-1.7.0beta47.
+ Added #ifndef __COVERITY__ where needed in png.c, pngrutil.c and
+ pngset.c to avoid warnings about dead code.
+ Added "& 0xff" to many instances of expressions that are typecast
+ to (png_byte), to avoid Coverity warnings.
+
+Version 1.6.17beta02 [February 7, 2015]
+ Work around one more Coverity-scan dead-code warning.
+ Do not build png_product2() when it is unused.
+
+Version 1.6.17beta03 [February 17, 2015]
+ Display user limits in the output from pngtest.
+ Eliminated the PNG_SAFE_LIMITS macro and restored the 1-million-column
+ and 1-million-row default limits in pnglibconf.dfa, that can be reset
+ by the user at build time or run time. This provides a more robust
+ defense against DOS and as-yet undiscovered overflows.
+
+Version 1.6.17beta04 [February 21, 2015]
+ Added PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED macro, on by default.
+ Allow user to call png_get_IHDR() with NULL arguments (Reuben Hawkins).
+ Rebuilt configure scripts with automake-1.15 and libtool-2.4.6
+
+Version 1.6.17beta05 [February 25, 2015]
+ Restored compiling of png_reciprocal2 with PNG_NO_16BIT.
+
+Version 1.6.17beta06 [February 27, 2015]
+ Moved png_set_filter() prototype into a PNG_WRITE_SUPPORTED block
+ of png.h.
+ Avoid runtime checks when converting integer to png_byte with
+ Visual Studio (Sergey Kosarevsky)
+
+Version 1.6.17rc01 [March 4, 2015]
+ No changes.
+
+Version 1.6.17rc02 [March 9, 2015]
+ Removed some comments that the configure script did not handle
+ properly from scripts/pnglibconf.dfa and pnglibconf.h.prebuilt.
+ Free the unknown_chunks structure even when it contains no data.
+
+Version 1.6.17rc03 [March 12, 2015]
+ Updated CMakeLists.txt to add OSX framework, change YES/NO to ON/OFF
+ for consistency, and remove some useless tests (Alexey Petruchik).
+
+Version 1.6.17rc04 [March 16, 2015]
+ Remove pnglibconf.h, pnglibconf.c, and pnglibconf.out instead of
+ pnglibconf.* in "make clean" (Cosmin).
+ Fix bug in calculation of maxbits, in png_write_sBIT, introduced
+ in libpng-1.6.17beta01 (John Bowler).
+
+Version 1.6.17rc05 [March 21, 2015]
+ Define PNG_FILTER_* and PNG_FILTER_VALUE_* in png.h even when WRITE
+ is not supported (John Bowler). This fixes an error introduced in
+ libpng-1.6.17beta06.
+ Reverted "& 0xff" additions of version 1.6.17beta01. Libpng passes
+ the Coverity scan without them.
+
+Version 1.6.17rc06 [March 23, 2015]
+ Remove pnglibconf.dfn and pnglibconf.pre with "make clean".
+ Reformatted some "&0xff" instances to "& 0xff".
+ Fixed simplified 8-bit-linear to sRGB alpha. The calculated alpha
+ value was wrong. It's not clear if this affected the final stored
+ value; in the obvious code path the upper and lower 8-bits of the
+ alpha value were identical and the alpha was truncated to 8-bits
+ rather than dividing by 257 (John Bowler).
+
+Version 1.6.17 [March 26, 2015]
+ No changes.
+
+Version 1.6.18beta01 [April 1, 2015]
+ Removed PNG_SET_CHUNK_[CACHE|MALLOC]_LIMIT_SUPPORTED macros. They
+ have been combined with PNG_SET_USER_LIMITS_SUPPORTED (resolves
+ bug report by Andrew Church).
+ Fixed rgb_to_gray checks and added tRNS checks to pngvalid.c. This
+ fixes some arithmetic errors that caused some tests to fail on
+ some 32-bit platforms (Bug reports by Peter Breitenlohner [i686]
+ and Petr Gajdos [i586]).
+
+Version 1.6.18beta02 [April 26, 2015]
+ Suppressed some warnings from the Borland C++ 5.5.1/5.82 compiler
+ (Bug report by Viktor Szakats).
+
+Version 1.6.18beta03 [May 6, 2015]
+ Replaced "unexpected" with an integer (0xabadca11) in pngset.c
+ where a long was expected, to avoid a compiler warning when PNG_DEBUG > 1.
+ Added contrib/examples/simpleover.c, to demonstrate how to handle
+ alpha compositing of multiple images, using the "simplified API"
+ and an example PNG generation tool, contrib/examples/genpng.c
+ (John Bowler).
+
+Version 1.6.18beta04 [May 20, 2015]
+ PNG_RELEASE_BUILD replaces tests where the code depended on the build base
+ type and can be defined on the command line, allowing testing in beta
+ builds (John Bowler).
+ Avoid Coverity issue 80858 (REVERSE NULL) in pngtest.c PNG_DEBUG builds.
+ Avoid a harmless potential integer overflow in png_XYZ_from_xy() (Bug
+ report from Christopher Ferris).
+
+Version 1.6.18beta05 [May 31, 2015]
+ Backport filter selection code from libpng-1.7.0beta51, to combine
+ sub_row, up_row, avg_row, and paeth_row into try_row and tst_row.
+ Changed png_voidcast(), etc., to voidcast(), etc., in contrib/tools/pngfix.c
+ to avoid confusion with the libpng private macros.
+ Fixed old cut&paste bug in the weighted filter selection code in
+ pngwutil.c, introduced in libpng-0.95, March 1997.
+
+Version 1.6.18beta06 [June 1, 2015]
+ Removed WRITE_WEIGHTED_FILTERED code, to save a few kbytes of the
+ compiled library size. It never worked properly and as far as we can
+ tell, no one uses it. The png_set_filter_heuristics() and
+ png_set_filter_heuristics_fixed() APIs are retained but deprecated
+ and do nothing.
+
+Version 1.6.18beta07 [June 6, 2015]
+ Removed non-working progressive reader 'skip' function. This
+ function has apparently never been used. It was implemented
+ to support back-door modification of png_struct in libpng-1.4.x
+ but (because it does nothing and cannot do anything) was apparently
+ never tested (John Bowler).
+ Fixed cexcept.h in which GCC 5 now reports that one of the auto
+ variables in the Try macro needs to be volatile to prevent value
+ being lost over the setjmp (John Bowler).
+ Fixed NO_WRITE_FILTER and -Wconversion build breaks (John Bowler).
+ Fix g++ build breaks (John Bowler).
+ Quieted some Coverity issues in pngfix.c, png-fix-itxt.c, pngvalid.c,
+ pngstest.c, and pngimage.c. Most seem harmless, but png-fix-itxt
+ would only work with iTXt chunks with length 255 or less.
+ Added #ifdef's to contrib/examples programs so people don't try
+ to compile them without the minimum required support enabled
+ (suggested by Flavio Medeiros).
+
+Version 1.6.18beta08 [June 30, 2015]
+ Eliminated the final two Coverity defects (insecure temporary file
+ handling in contrib/libtests/pngstest.c; possible overflow of
+ unsigned char in contrib/tools/png-fix-itxt.c). To use the "secure"
+ file handling, define PNG_USE_MKSTEMP, otherwise "tmpfile()" will
+ be used.
+ Removed some unused WEIGHTED_FILTER macros from png.h and pngstruct.h
+
+Version 1.6.18beta09 [July 5, 2015]
+ Removed some useless typecasts from contrib/tools/png-fix-itxt.c
+ Fixed a new signed-unsigned comparison in pngrtran.c (Max Stepin).
+ Replaced arbitrary use of 'extern' with #define PNG_LINKAGE_*. To
+ preserve API compatibility, the new defines all default to "extern"
+ (requested by Jan Nijtmans).
+
+Version 1.6.18rc01 [July 9, 2015]
+ Belatedly added Mans Rullgard and James Yu to the list of Contributing
+ Authors.
+
+Version 1.6.18rc02 [July 12, 2015]
+ Restored unused FILTER_HEURISTIC macros removed at libpng-1.6.18beta08
+ to png.h to avoid compatibility warnings.
+
+Version 1.6.18rc03 [July 15, 2015]
+ Minor changes to the man page
+
+Version 1.6.18 [July 23, 2015]
+ No changes.
+
+Version 1.6.19beta01 [July 30, 2015]
+ Updated obsolete information about the simplified API macros in the
+ manual pages (Bug report by Arc Riley).
+ Avoid potentially dereferencing NULL info_ptr in png_info_init_3().
+ Rearranged png.h to put the major sections in the same order as
+ in libpng17.
+ Eliminated unused PNG_COST_SHIFT, PNG_WEIGHT_SHIFT, PNG_COST_FACTOR, and
+ PNG_WEIGHT_FACTOR macros.
+ Suppressed some warnings from the Borland C++ 5.5.1/5.82 compiler
+ (Bug report by Viktor Szakats). Several warnings remain and are
+ unavoidable, where we test for overflow.
+ Fixed potential leak of png_pixels in contrib/pngminus/pnm2png.c
+ Fixed uninitialized variable in contrib/gregbook/rpng2-x.c
+
+Version 1.6.19beta02 [August 19, 2015]
+ Moved config.h.in~ from the "libpng_autotools_files" list to the
+ "libpng_autotools_extra" list in autogen.sh because it was causing a
+ false positive for missing files (bug report by Robert C. Seacord).
+ Removed unreachable "break" statements in png.c, pngread.c, and pngrtran.c
+ to suppress clang warnings (Bug report by Viktor Szakats).
+ Fixed some bad links in the man page.
+ Changed "n bit" to "n-bit" in comments.
+ Added signed/unsigned 16-bit safety net. This removes the dubious
+ 0x8000 flag definitions on 16-bit systems. They aren't supported
+ yet the defs *probably* work, however it seems much safer to do this
+ and be advised if anyone, contrary to advice, is building libpng 1.6
+ on a 16-bit system. It also adds back various switch default clauses
+ for GCC; GCC errors out if they are not present (with an appropriately
+ high level of warnings).
+ Safely convert num_bytes to a png_byte in png_set_sig_bytes() (Robert
+ Seacord).
+ Fixed the recently reported 1's complement security issue by replacing
+ the value that is illegal in the PNG spec, in both signed and unsigned
+ values, with 0. Illegal unsigned values (anything greater than or equal
+ to 0x80000000) can still pass through, but since these are not illegal
+ in ANSI-C (unlike 0x80000000 in the signed case) the checking that
+ occurs later can catch them (John Bowler).
+
+Version 1.6.19beta03 [September 26, 2015]
+ Fixed png_save_int_32 when int is not 2's complement (John Bowler).
+ Updated libpng16 with all the recent test changes from libpng17,
+ including changes to pngvalid.c to ensure that the original,
+ distributed, version of contrib/visupng/cexcept.h can be used
+ (John Bowler).
+ pngvalid contains the correction to the use of SAVE/STORE_
+ UNKNOWN_CHUNKS; a bug revealed by changes in libpng 1.7. More
+ tests contain the --strict option to detect warnings and the
+ pngvalid-standard test has been corrected so that it does not
+ turn on progressive-read. There is a separate test which does
+ that. (John Bowler)
+ Also made some signed/unsigned fixes.
+ Make pngstest error limits version specific. Splitting the machine
+ generated error structs out to a file allows the values to be updated
+ without changing pngstest.c itself. Since libpng 1.6 and 1.7 have
+ slightly different error limits this simplifies maintenance. The
+ makepngs.sh script has also been updated to more accurately reflect
+ current problems in libpng 1.7 (John Bowler).
+ Incorporated new test PNG files into make check. tests/pngstest-*
+ are changed so that the new test files are divided into 8 groups by
+ gamma and alpha channel. These tests have considerably better code
+ and pixel-value coverage than contrib/pngsuite; however,coverage is
+ still incomplete (John Bowler).
+ Removed the '--strict' in 1.6 because of the double-gamma-correction
+ warning, updated pngstest-errors.h for the errors detected with the
+ new contrib/testspngs PNG test files (John Bowler).
+
+Version 1.6.19beta04 [October 15, 2015]
+ Worked around rgb-to-gray issues in libpng 1.6. The previous
+ attempts to ignore the errors in the code aren't quite enough to
+ deal with the 'channel selection' encoding added to libpng 1.7; abort.
+ pngvalid.c is changed to drop this encoding in prior versions.
+ Fixed 'pow' macros in pngvalid.c. It is legal for 'pow' to be a
+ macro, therefore the argument list cannot contain preprocessing
+ directives. Make sure pow is a function where this happens. This is
+ a minimal safe fix, the issue only arises in non-performance-critical
+ code (bug report by Curtis Leach, fix by John Bowler).
+ Added sPLT support to pngtest.c
+
+Version 1.6.19rc01 [October 23, 2015]
+ No changes.
+
+Version 1.6.19rc02 [October 31, 2015]
+ Prevent setting or writing over-length PLTE chunk (Cosmin Truta).
+ Silently truncate over-length PLTE chunk while reading.
+ Libpng incorrectly calculated the output rowbytes when the application
+ decreased either the number of channels or the bit depth (or both) in
+ a user transform. This was safe; libpng overallocated buffer space
+ (potentially by quite a lot; up to 4 times the amount required) but,
+ from 1.5.4 on, resulted in a png_error (John Bowler).
+
+Version 1.6.19rc03 [November 3, 2015]
+ Fixed some inconsequential cut-and-paste typos in png_set_cHRM_XYZ_fixed().
+ Clarified COPYRIGHT information to state explicitly that versions
+ are derived from previous versions.
+ Removed much of the long list of previous versions from png.h and
+ libpng.3.
+
+Version 1.6.19rc04 [November 5, 2015]
+ Fixed new bug with CRC error after reading an over-length palette
+ (bug report by Cosmin Truta) (CVE-2015-8126).
+
+Version 1.6.19 [November 12, 2015]
+ Cleaned up coding style in png_handle_PLTE().
+
+Version 1.6.20beta01 [November 20, 2015]
+ Avoid potential pointer overflow/underflow in png_handle_sPLT() and
+ png_handle_pCAL() (Bug report by John Regehr).
+
+Version 1.6.20beta02 [November 23, 2015]
+ Fixed incorrect implementation of png_set_PLTE() that uses png_ptr
+ not info_ptr, that left png_set_PLTE() open to the CVE-2015-8126
+ vulnerability.
+
+Version 1.6.20beta03 [November 24, 2015]
+ Backported tests from libpng-1.7.0beta69.
+
+Version 1.6.20rc01 [November 26, 2015]
+ Fixed an error in handling of bad zlib CMINFO field in pngfix, found by
+ American Fuzzy Lop, reported by Brian Carpenter. inflate() doesn't
+ immediately fault a bad CMINFO field; instead a 'too far back' error
+ happens later (at least some times). pngfix failed to limit CMINFO to
+ the allowed values but then assumed that window_bits was in range,
+ triggering an assert. The bug is mostly harmless; the PNG file cannot
+ be fixed.
+
+Version 1.6.20rc02 [November 29, 2015]
+ In libpng 1.6 zlib initialization was changed to use the window size
+ in the zlib stream, not a fixed value. This causes some invalid images,
+ where CINFO is too large, to display 'correctly' if the rest of the
+ data is valid. This provides a workaround for zlib versions where the
+ error arises (ones that support the API change to use the window size
+ in the stream).
+
+Version 1.6.20 [December 3, 2015]
+ No changes.
+
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
@@ -5156,3 +5478,4 @@
or to glennrp at users.sourceforge.net
Glenn R-P
+#endif
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE Thu Jan 21 10:17:21 2016 -0800
@@ -10,21 +10,18 @@
This code is released under the libpng license.
-libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
-Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
-distributed according to the same disclaimer and license as libpng-1.2.5
-with the following individual added to the list of Contributing Authors
-
- Cosmin Truta
-
-libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
-Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
-distributed according to the same disclaimer and license as libpng-1.0.6
-with the following individuals added to the list of Contributing Authors
+libpng versions 1.0.7, July 1, 2000, through 1.6.20, December 3, 2015, are
+Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
+derived from libpng-1.0.6, and are distributed according to the same
+disclaimer and license as libpng-1.0.6 with the following individuals
+added to the list of Contributing Authors:
Simon-Pierre Cadieux
Eric S. Raymond
+ Mans Rullgard
+ Cosmin Truta
Gilles Vollant
+ James Yu
and with the following additions to the disclaimer:
@@ -36,18 +33,20 @@
the user.
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
-Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are
-distributed according to the same disclaimer and license as libpng-0.96,
-with the following individuals added to the list of Contributing Authors:
+Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
+libpng-0.96, and are distributed according to the same disclaimer and
+license as libpng-0.96, with the following individuals added to the list
+of Contributing Authors:
Tom Lane
Glenn Randers-Pehrson
Willem van Schaik
libpng versions 0.89, June 1996, through 0.96, May 1997, are
-Copyright (c) 1996, 1997 Andreas Dilger
-Distributed according to the same disclaimer and license as libpng-0.88,
-with the following individuals added to the list of Contributing Authors:
+Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
+and are distributed according to the same disclaimer and license as
+libpng-0.88, with the following individuals added to the list of
+Contributing Authors:
John Bowler
Kevin Bracey
@@ -57,7 +56,7 @@
Tom Tanner
libpng versions 0.5, May 1995, through 0.88, January 1996, are
-Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
For the purposes of this copyright and license, "Contributing Authors"
is defined as the following set of individuals:
@@ -80,13 +79,13 @@
source code, or portions hereof, for any purpose, without fee, subject
to the following restrictions:
-1. The origin of this source code must not be misrepresented.
+ 1. The origin of this source code must not be misrepresented.
-2. Altered versions must be plainly marked as such and must not
- be misrepresented as being the original source.
+ 2. Altered versions must be plainly marked as such and must not
+ be misrepresented as being the original source.
-3. This Copyright notice may not be removed or altered from any
- source or altered source distribution.
+ 3. This Copyright notice may not be removed or altered from any
+ source or altered source distribution.
The Contributing Authors and Group 42, Inc. specifically permit, without
fee, and encourage the use of this source code as a component to
@@ -94,18 +93,20 @@
source code in a product, acknowledgment is not required but would be
appreciated.
+END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
A "png_get_copyright" function is available, for convenient use in "about"
boxes and the like:
- printf("%s",png_get_copyright(NULL));
+ printf("%s", png_get_copyright(NULL));
Also, the PNG logo (in PNG format, of course) is supplied in the
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
-Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a
-certification mark of the Open Source Initiative.
+Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
+a certification mark of the Open Source Initiative. OSI has not addressed
+the additional disclaimers inserted at version 1.0.7.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
-December 22, 2014
+December 3, 2015
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/README Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/README Thu Jan 21 10:17:21 2016 -0800
@@ -1,4 +1,4 @@
-README for libpng version 1.6.16 - December 22, 2014 (shared library 16.0)
+README for libpng version 1.6.20 - December 3, 2015 (shared library 16.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.
@@ -134,7 +134,7 @@
to others, if necessary.
Please do not send suggestions on how to change PNG. We have
-been discussing PNG for nineteen years now, and it is official and
+been discussing PNG for twenty years now, and it is official and
finished. If you have suggestions for libpng, however, I'll
gladly listen. Even if your suggestion is not used immediately,
it may be used later.
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/png.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/png.c Thu Jan 21 10:17:21 2016 -0800
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
- * Last changed in libpng 1.6.16 [December 22, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.19 [November 12, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -42,7 +42,7 @@
#include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_16 Your_png_h_is_not_version_1_6_16;
+typedef png_libpng_version_1_6_20 Your_png_h_is_not_version_1_6_20;
/* Tells libpng that we have already handled the first "num_bytes" bytes
* of the PNG file signature. If the PNG data is embedded into another
@@ -54,15 +54,20 @@
void PNGAPI
png_set_sig_bytes(png_structrp png_ptr, int num_bytes)
{
+ unsigned int nb = (unsigned int)num_bytes;
+
png_debug(1, "in png_set_sig_bytes");
if (png_ptr == NULL)
return;
- if (num_bytes > 8)
+ if (num_bytes < 0)
+ nb = 0;
+
+ if (nb > 8)
png_error(png_ptr, "Too many bytes for PNG signature");
- png_ptr->sig_bytes = (png_byte)(num_bytes < 0 ? 0 : num_bytes);
+ png_ptr->sig_bytes = (png_byte)nb;
}
/* Checks whether the supplied bytes match the PNG signature. We allow
@@ -129,7 +134,7 @@
void /* PRIVATE */
png_reset_crc(png_structrp png_ptr)
{
- /* The cast is safe because the crc is a 32 bit value. */
+ /* The cast is safe because the crc is a 32-bit value. */
png_ptr->crc = (png_uint_32)crc32(0, Z_NULL, 0);
}
@@ -157,7 +162,7 @@
}
/* 'uLong' is defined in zlib.h as unsigned long; this means that on some
- * systems it is a 64 bit value. crc32, however, returns 32 bits so the
+ * systems it is a 64-bit value. crc32, however, returns 32 bits so the
* following cast is safe. 'uInt' may be no more than 16 bits, so it is
* necessary to perform a loop here.
*/
@@ -168,8 +173,10 @@
do
{
uInt safe_length = (uInt)length;
+#ifndef __COVERITY__
if (safe_length == 0)
safe_length = (uInt)-1; /* evil, but safe */
+#endif
crc = crc32(crc, ptr, safe_length);
@@ -269,15 +276,15 @@
create_struct.user_height_max = PNG_USER_HEIGHT_MAX;
# ifdef PNG_USER_CHUNK_CACHE_MAX
- /* Added at libpng-1.2.43 and 1.4.0 */
- create_struct.user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
+ /* Added at libpng-1.2.43 and 1.4.0 */
+ create_struct.user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
# endif
# ifdef PNG_USER_CHUNK_MALLOC_MAX
- /* Added at libpng-1.2.43 and 1.4.1, required only for read but exists
- * in png_struct regardless.
- */
- create_struct.user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX;
+ /* Added at libpng-1.2.43 and 1.4.1, required only for read but exists
+ * in png_struct regardless.
+ */
+ create_struct.user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX;
# endif
# endif
@@ -301,7 +308,9 @@
# ifdef PNG_SETJMP_SUPPORTED
if (!setjmp(create_jmp_buf))
+# endif
{
+# ifdef PNG_SETJMP_SUPPORTED
/* Temporarily fake out the longjmp information until we have
* successfully completed this function. This only works if we have
* setjmp() support compiled in, but it is safe - this stuff should
@@ -310,8 +319,6 @@
create_struct.jmp_buf_ptr = &create_jmp_buf;
create_struct.jmp_buf_size = 0; /*stack allocation*/
create_struct.longjmp_fn = longjmp;
-# else
- {
# endif
/* Call the general version checker (shared with read and write code):
*/
@@ -330,10 +337,10 @@
create_struct.zstream.opaque = png_ptr;
# ifdef PNG_SETJMP_SUPPORTED
- /* Eliminate the local error handling: */
- create_struct.jmp_buf_ptr = NULL;
- create_struct.jmp_buf_size = 0;
- create_struct.longjmp_fn = 0;
+ /* Eliminate the local error handling: */
+ create_struct.jmp_buf_ptr = NULL;
+ create_struct.jmp_buf_size = 0;
+ create_struct.longjmp_fn = 0;
# endif
*png_ptr = create_struct;
@@ -439,6 +446,8 @@
free(info_ptr);
info_ptr = png_voidcast(png_inforp, png_malloc_base(NULL,
(sizeof *info_ptr)));
+ if (info_ptr == NULL)
+ return;
*ptr_ptr = info_ptr;
}
@@ -504,9 +513,10 @@
/* Free any tRNS entry */
if (((mask & PNG_FREE_TRNS) & info_ptr->free_me) != 0)
{
+ info_ptr->valid &= ~PNG_INFO_tRNS;
png_free(png_ptr, info_ptr->trans_alpha);
info_ptr->trans_alpha = NULL;
- info_ptr->valid &= ~PNG_INFO_tRNS;
+ info_ptr->num_trans = 0;
}
#endif
@@ -572,20 +582,17 @@
else
{
- if (info_ptr->splt_palettes_num != 0)
+ int i;
+
+ for (i = 0; i < info_ptr->splt_palettes_num; i++)
{
- int i;
-
- for (i = 0; i < info_ptr->splt_palettes_num; i++)
- {
- png_free(png_ptr, info_ptr->splt_palettes[i].name);
- png_free(png_ptr, info_ptr->splt_palettes[i].entries);
- }
-
- png_free(png_ptr, info_ptr->splt_palettes);
- info_ptr->splt_palettes = NULL;
- info_ptr->splt_palettes_num = 0;
+ png_free(png_ptr, info_ptr->splt_palettes[i].name);
+ png_free(png_ptr, info_ptr->splt_palettes[i].entries);
}
+
+ png_free(png_ptr, info_ptr->splt_palettes);
+ info_ptr->splt_palettes = NULL;
+ info_ptr->splt_palettes_num = 0;
info_ptr->valid &= ~PNG_INFO_sPLT;
}
}
@@ -605,15 +612,12 @@
{
int i;
- if (info_ptr->unknown_chunks_num != 0)
- {
- for (i = 0; i < info_ptr->unknown_chunks_num; i++)
- png_free(png_ptr, info_ptr->unknown_chunks[i].data);
-
- png_free(png_ptr, info_ptr->unknown_chunks);
- info_ptr->unknown_chunks = NULL;
- info_ptr->unknown_chunks_num = 0;
- }
+ for (i = 0; i < info_ptr->unknown_chunks_num; i++)
+ png_free(png_ptr, info_ptr->unknown_chunks[i].data);
+
+ png_free(png_ptr, info_ptr->unknown_chunks);
+ info_ptr->unknown_chunks = NULL;
+ info_ptr->unknown_chunks_num = 0;
}
}
#endif
@@ -694,22 +698,23 @@
}
# endif
-#ifdef PNG_SAVE_INT_32_SUPPORTED
-/* The png_save_int_32 function assumes integers are stored in two's
- * complement format. If this isn't the case, then this routine needs to
- * be modified to write data in two's complement format. Note that,
- * the following works correctly even if png_int_32 has more than 32 bits
- * (compare the more complex code required on read for sign extension.)
+# ifdef PNG_SAVE_INT_32_SUPPORTED
+/* PNG signed integers are saved in 32-bit 2's complement format. ANSI C-90
+ * defines a cast of a signed integer to an unsigned integer either to preserve
+ * the value, if it is positive, or to calculate:
+ *
+ * (UNSIGNED_MAX+1) + integer
+ *
+ * Where UNSIGNED_MAX is the appropriate maximum unsigned value, so when the
+ * negative integral value is added the result will be an unsigned value
+ * correspnding to the 2's complement representation.
*/
void PNGAPI
png_save_int_32(png_bytep buf, png_int_32 i)
{
- buf[0] = (png_byte)((i >> 24) & 0xff);
- buf[1] = (png_byte)((i >> 16) & 0xff);
- buf[2] = (png_byte)((i >> 8) & 0xff);
- buf[3] = (png_byte)(i & 0xff);
+ png_save_uint_32(buf, i);
}
-#endif
+# endif
# ifdef PNG_TIME_RFC1123_SUPPORTED
/* Convert the supplied time into an RFC 1123 string suitable for use in
@@ -753,6 +758,7 @@
APPEND(':');
APPEND_NUMBER(PNG_NUMBER_FORMAT_02u, (unsigned)ptime->second);
APPEND_STRING(" +0000"); /* This reliably terminates the buffer */
+ PNG_UNUSED (pos)
# undef APPEND
# undef APPEND_NUMBER
@@ -762,7 +768,7 @@
return 1;
}
-# if PNG_LIBPNG_VER < 10700
+# if PNG_LIBPNG_VER < 10700
/* To do: remove the following from libpng-1.7 */
/* Original API that uses a private buffer in png_struct.
* Deprecated because it causes png_struct to carry a spurious temporary
@@ -783,7 +789,7 @@
return NULL;
}
-# endif
+# endif /* LIBPNG_VER < 10700 */
# endif /* TIME_RFC1123 */
#endif /* READ || WRITE */
@@ -797,14 +803,14 @@
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
- "libpng version 1.6.16 - December 22, 2014" PNG_STRING_NEWLINE \
- "Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
- "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
- "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
- PNG_STRING_NEWLINE;
+ "libpng version 1.6.20 - December 3, 2015" PNG_STRING_NEWLINE \
+ "Copyright (c) 1998-2015 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
+ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
+ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
+ PNG_STRING_NEWLINE;
# else
- return "libpng version 1.6.16 - December 22, 2014\
- Copyright (c) 1998-2014 Glenn Randers-Pehrson\
+ return "libpng version 1.6.20 - December 3, 2015\
+ Copyright (c) 1998-2015 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
# endif
@@ -842,9 +848,9 @@
#ifdef __STDC__
return PNG_HEADER_VERSION_STRING
# ifndef PNG_READ_SUPPORTED
- " (NO READ SUPPORT)"
+ " (NO READ SUPPORT)"
# endif
- PNG_STRING_NEWLINE;
+ PNG_STRING_NEWLINE;
#else
return PNG_HEADER_VERSION_STRING;
#endif
@@ -900,9 +906,9 @@
for (i = 0, v = 0; i < num_palette; i++, v += color_inc)
{
- palette[i].red = (png_byte)v;
- palette[i].green = (png_byte)v;
- palette[i].blue = (png_byte)v;
+ palette[i].red = (png_byte)(v & 0xff);
+ palette[i].green = (png_byte)(v & 0xff);
+ palette[i].blue = (png_byte)(v & 0xff);
}
}
#endif
@@ -975,8 +981,6 @@
return((png_uint_32)PNG_LIBPNG_VER);
}
-
-
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
/* Ensure that png_ptr->zstream.msg holds some appropriate error message string.
* If it doesn't 'ret' is used to set it to something appropriate, even in cases
@@ -1119,10 +1123,10 @@
errmsg = "gamma value out of range";
# ifdef PNG_READ_gAMA_SUPPORTED
- /* Allow the application to set the gamma value more than once */
- else if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
- (colorspace->flags & PNG_COLORSPACE_FROM_gAMA) != 0)
- errmsg = "duplicate";
+ /* Allow the application to set the gamma value more than once */
+ else if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
+ (colorspace->flags & PNG_COLORSPACE_FROM_gAMA) != 0)
+ errmsg = "duplicate";
# endif
/* Do nothing if the colorspace is already invalid */
@@ -1163,31 +1167,31 @@
PNG_INFO_iCCP);
# ifdef PNG_COLORSPACE_SUPPORTED
- /* Clean up the iCCP profile now if it won't be used. */
- png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, -1/*not used*/);
+ /* Clean up the iCCP profile now if it won't be used. */
+ png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, -1/*not used*/);
# else
- PNG_UNUSED(png_ptr)
+ PNG_UNUSED(png_ptr)
# endif
}
else
{
# ifdef PNG_COLORSPACE_SUPPORTED
- /* Leave the INFO_iCCP flag set if the pngset.c code has already set
- * it; this allows a PNG to contain a profile which matches sRGB and
- * yet still have that profile retrievable by the application.
- */
- if ((info_ptr->colorspace.flags & PNG_COLORSPACE_MATCHES_sRGB) != 0)
- info_ptr->valid |= PNG_INFO_sRGB;
-
- else
- info_ptr->valid &= ~PNG_INFO_sRGB;
-
- if ((info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
- info_ptr->valid |= PNG_INFO_cHRM;
-
- else
- info_ptr->valid &= ~PNG_INFO_cHRM;
+ /* Leave the INFO_iCCP flag set if the pngset.c code has already set
+ * it; this allows a PNG to contain a profile which matches sRGB and
+ * yet still have that profile retrievable by the application.
+ */
+ if ((info_ptr->colorspace.flags & PNG_COLORSPACE_MATCHES_sRGB) != 0)
+ info_ptr->valid |= PNG_INFO_sRGB;
+
+ else
+ info_ptr->valid &= ~PNG_INFO_sRGB;
+
+ if ((info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
+ info_ptr->valid |= PNG_INFO_cHRM;
+
+ else
+ info_ptr->valid &= ~PNG_INFO_cHRM;
# endif
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0)
@@ -1209,7 +1213,7 @@
png_colorspace_sync_info(png_ptr, info_ptr);
}
#endif
-#endif
+#endif /* GAMMA */
#ifdef PNG_COLORSPACE_SUPPORTED
/* Added at libpng-1.5.5 to support read and write of true CIEXYZ values for
@@ -1268,16 +1272,17 @@
/* Check xy and, implicitly, z. Note that wide gamut color spaces typically
* have end points with 0 tristimulus values (these are impossible end
- * points, but they are used to cover the possible colors.)
+ * points, but they are used to cover the possible colors). We check
+ * xy->whitey against 5, not 0, to avoid a possible integer overflow.
*/
- if (xy->redx < 0 || xy->redx > PNG_FP_1) return 1;
- if (xy->redy < 0 || xy->redy > PNG_FP_1-xy->redx) return 1;
+ if (xy->redx < 0 || xy->redx > PNG_FP_1) return 1;
+ if (xy->redy < 0 || xy->redy > PNG_FP_1-xy->redx) return 1;
if (xy->greenx < 0 || xy->greenx > PNG_FP_1) return 1;
if (xy->greeny < 0 || xy->greeny > PNG_FP_1-xy->greenx) return 1;
- if (xy->bluex < 0 || xy->bluex > PNG_FP_1) return 1;
- if (xy->bluey < 0 || xy->bluey > PNG_FP_1-xy->bluex) return 1;
+ if (xy->bluex < 0 || xy->bluex > PNG_FP_1) return 1;
+ if (xy->bluey < 0 || xy->bluey > PNG_FP_1-xy->bluex) return 1;
if (xy->whitex < 0 || xy->whitex > PNG_FP_1) return 1;
- if (xy->whitey < 0 || xy->whitey > PNG_FP_1-xy->whitex) return 1;
+ if (xy->whitey < 5 || xy->whitey > PNG_FP_1-xy->whitex) return 1;
/* The reverse calculation is more difficult because the original tristimulus
* value had 9 independent values (red,green,blue)x(X,Y,Z) however only 8
@@ -1735,7 +1740,6 @@
*/
colorspace->flags |= PNG_COLORSPACE_INVALID;
png_error(png_ptr, "internal error checking chromaticities");
- break;
}
return 0; /* failed */
@@ -1763,7 +1767,6 @@
default:
colorspace->flags |= PNG_COLORSPACE_INVALID;
png_error(png_ptr, "internal error checking chromaticities");
- break;
}
return 0; /* failed */
@@ -2089,8 +2092,8 @@
temp = png_get_uint_32(profile+12); /* profile/device class */
switch (temp)
{
- case 0x73636E72: /* 'scnr' */
- case 0x6D6E7472: /* 'mntr' */
+ case 0x73636e72: /* 'scnr' */
+ case 0x6d6e7472: /* 'mntr' */
case 0x70727472: /* 'prtr' */
case 0x73706163: /* 'spac' */
/* All supported */
@@ -2101,7 +2104,7 @@
return png_icc_profile_error(png_ptr, colorspace, name, temp,
"invalid embedded Abstract ICC profile");
- case 0x6C696E6B: /* 'link' */
+ case 0x6c696e6b: /* 'link' */
/* DeviceLink profiles cannot be interpreted in a non-device specific
* fashion, if an app uses the AToB0Tag in the profile the results are
* undefined unless the result is sent to the intended device,
@@ -2111,7 +2114,7 @@
return png_icc_profile_error(png_ptr, colorspace, name, temp,
"unexpected DeviceLink ICC profile class");
- case 0x6E6D636C: /* 'nmcl' */
+ case 0x6e6d636c: /* 'nmcl' */
/* A NamedColor profile is also device specific, however it doesn't
* contain an AToB0 tag that is open to misinterpretation. Almost
* certainly it will fail the tests below.
@@ -2137,8 +2140,8 @@
temp = png_get_uint_32(profile+20);
switch (temp)
{
- case 0x58595A20: /* 'XYZ ' */
- case 0x4C616220: /* 'Lab ' */
+ case 0x58595a20: /* 'XYZ ' */
+ case 0x4c616220: /* 'Lab ' */
break;
default:
@@ -2194,7 +2197,8 @@
return 1; /* success, maybe with warnings */
}
-#if defined(PNG_sRGB_SUPPORTED) && PNG_sRGB_PROFILE_CHECKS >= 0
+#ifdef PNG_sRGB_SUPPORTED
+#if PNG_sRGB_PROFILE_CHECKS >= 0
/* Information about the known ICC sRGB profiles */
static const struct
{
@@ -2307,8 +2311,8 @@
}
/* Length *and* intent must match */
- if (length == png_sRGB_checks[i].length &&
- intent == png_sRGB_checks[i].intent)
+ if (length == (png_uint_32) png_sRGB_checks[i].length &&
+ intent == (png_uint_32) png_sRGB_checks[i].intent)
{
/* Now calculate the adler32 if not done already. */
if (adler == 0)
@@ -2352,8 +2356,8 @@
*/
else if (png_sRGB_checks[i].have_md5 == 0)
{
- png_chunk_report(png_ptr, "out-of-date sRGB profile with"
- " no signature",
+ png_chunk_report(png_ptr,
+ "out-of-date sRGB profile with no signature",
PNG_CHUNK_WARNING);
}
@@ -2366,8 +2370,8 @@
* way. This probably indicates a data error or uninformed hacking.
* Fall through to "no match".
*/
- png_chunk_report(png_ptr, "Not recognizing known sRGB profile that"
- " has been edited",
+ png_chunk_report(png_ptr,
+ "Not recognizing known sRGB profile that has been edited",
PNG_CHUNK_WARNING);
break;
# endif
@@ -2377,9 +2381,8 @@
return 0; /* no match */
}
-#endif
-
-#ifdef PNG_sRGB_SUPPORTED
+#endif /* PNG_sRGB_PROFILE_CHECKS >= 0 */
+
void /* PRIVATE */
png_icc_set_sRGB(png_const_structrp png_ptr,
png_colorspacerp colorspace, png_const_bytep profile, uLong adler)
@@ -2393,7 +2396,7 @@
(void)png_colorspace_set_sRGB(png_ptr, colorspace,
(int)/*already checked*/png_get_uint_32(profile+64));
}
-#endif /* READ_sRGB */
+#endif /* sRGB */
int /* PRIVATE */
png_colorspace_set_ICC(png_const_structrp png_ptr, png_colorspacerp colorspace,
@@ -2485,7 +2488,7 @@
png_error(png_ptr, "internal error handling cHRM->XYZ");
}
}
-#endif
+#endif /* READ_RGB_TO_GRAY */
#endif /* COLORSPACE */
@@ -2514,18 +2517,19 @@
png_warning(png_ptr, "Image width is zero in IHDR");
error = 1;
}
- else if (width > PNG_UINT_31_MAX)
+
+ if (width > PNG_UINT_31_MAX)
{
png_warning(png_ptr, "Invalid image width in IHDR");
error = 1;
}
- else if (png_gt(width,
- (PNG_SIZE_MAX >> 3) /* 8-byte RGBA pixels */
- - 48 /* big_row_buf hack */
- - 1 /* filter byte */
- - 7*8 /* rounding width to multiple of 8 pix */
- - 8)) /* extra max_pixel_depth pad */
+ if (png_gt(((width + 7) & (~7)),
+ ((PNG_SIZE_MAX
+ - 48 /* big_row_buf hack */
+ - 1) /* filter byte */
+ / 8) /* 8-byte RGBA pixels */
+ - 1)) /* extra max_pixel_depth pad */
{
/* The size of the row must be within the limits of this architecture.
* Because the read code can perform arbitrary transformations the
@@ -2541,17 +2545,15 @@
png_warning(png_ptr, "Image width is too large for this architecture");
error = 1;
}
- else
+
+#ifdef PNG_SET_USER_LIMITS_SUPPORTED
+ if (width > png_ptr->user_width_max)
+#else
+ if (width > PNG_USER_WIDTH_MAX)
+#endif
{
-# ifdef PNG_SET_USER_LIMITS_SUPPORTED
- if (width > png_ptr->user_width_max)
-# else
- if (width > PNG_USER_WIDTH_MAX)
-# endif
- {
- png_warning(png_ptr, "Image width exceeds user limit in IHDR");
- error = 1;
- }
+ png_warning(png_ptr, "Image width exceeds user limit in IHDR");
+ error = 1;
}
if (height == 0)
@@ -2559,22 +2561,21 @@
png_warning(png_ptr, "Image height is zero in IHDR");
error = 1;
}
- else if (height > PNG_UINT_31_MAX)
+
+ if (height > PNG_UINT_31_MAX)
{
png_warning(png_ptr, "Invalid image height in IHDR");
error = 1;
}
- else
+
+#ifdef PNG_SET_USER_LIMITS_SUPPORTED
+ if (height > png_ptr->user_height_max)
+#else
+ if (height > PNG_USER_HEIGHT_MAX)
+#endif
{
-# ifdef PNG_SET_USER_LIMITS_SUPPORTED
- if (height > png_ptr->user_height_max)
-# else
- if (height > PNG_USER_HEIGHT_MAX)
-# endif
- {
- png_warning(png_ptr, "Image height exceeds user limit in IHDR");
- error = 1;
- }
+ png_warning(png_ptr, "Image height exceeds user limit in IHDR");
+ error = 1;
}
/* Check other values */
@@ -2613,7 +2614,7 @@
error = 1;
}
-# ifdef PNG_MNG_FEATURES_SUPPORTED
+#ifdef PNG_MNG_FEATURES_SUPPORTED
/* Accept filter_method 64 (intrapixel differencing) only if
* 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
* 2. Libpng did not read a PNG signature (this filter_method is only
@@ -2646,13 +2647,13 @@
}
}
-# else
+#else
if (filter_type != PNG_FILTER_TYPE_BASE)
{
png_warning(png_ptr, "Unknown filter method in IHDR");
error = 1;
}
-# endif
+#endif
if (error == 1)
png_error(png_ptr, "Invalid IHDR data");
@@ -2878,7 +2879,7 @@
if (fp >= DBL_MIN && fp <= DBL_MAX)
{
- int exp_b10; /* A base 10 exponent */
+ int exp_b10; /* A base 10 exponent */
double base; /* 10^exp_b10 */
/* First extract a base 10 exponent of the number,
@@ -2926,7 +2927,7 @@
*/
{
- int czero, clead, cdigits;
+ unsigned int czero, clead, cdigits;
char exponent[10];
/* Allow up to two leading zeros - this will not lengthen
@@ -2956,7 +2957,7 @@
* of the loop don't break the number into parts so
* that the final digit is rounded.
*/
- if (cdigits+czero-clead+1 < (int)precision)
+ if (cdigits+czero+1 < precision+clead)
fp = modf(fp, &d);
else
@@ -3062,14 +3063,14 @@
*ascii++ = (char)(48 + (int)d), ++cdigits;
}
}
- while (cdigits+czero-clead < (int)precision && fp > DBL_MIN);
+ while (cdigits+czero < precision+clead && fp > DBL_MIN);
/* The total output count (max) is now 4+precision */
/* Check for an exponent, if we don't need one we are
* done and just need to terminate the string. At
* this point exp_b10==(-1) is effectively if flag - it got
- * to '-1' because of the decrement after outputing
+ * to '-1' because of the decrement after outputting
* the decimal point above (the exponent required is
* *not* -1!)
*/
@@ -3077,7 +3078,7 @@
{
/* The following only happens if we didn't output the
* leading zeros above for negative exponent, so this
- * doest add to the digit requirement. Note that the
+ * doesn't add to the digit requirement. Note that the
* two zeros here can only be output if the two leading
* zeros were *not* output, so this doesn't increase
* the output count.
@@ -3130,7 +3131,7 @@
/* Need another size check here for the exponent digits, so
* this need not be considered above.
*/
- if ((int)size > cdigits)
+ if (size > cdigits)
{
while (cdigits > 0) *ascii++ = exponent[--cdigits];
@@ -3178,7 +3179,7 @@
/* Avoid overflow here on the minimum integer. */
if (fp < 0)
- *ascii++ = 45, --size, num = -fp;
+ *ascii++ = 45, num = -fp;
else
num = fp;
@@ -3234,7 +3235,7 @@
png_error(png_ptr, "ASCII conversion buffer too small");
}
# endif /* FIXED_POINT */
-#endif /* READ_SCAL */
+#endif /* SCAL */
#if defined(PNG_FLOATING_POINT_SUPPORTED) && \
!defined(PNG_FIXED_POINT_MACRO_SUPPORTED) && \
@@ -3252,7 +3253,7 @@
png_fixed_error(png_ptr, text);
# ifndef PNG_ERROR_TEXT_SUPPORTED
- PNG_UNUSED(text)
+ PNG_UNUSED(text)
# endif
return (png_fixed_point)r;
@@ -3433,29 +3434,29 @@
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
-#if defined(PNG_16BIT_SUPPORTED) || !defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
+#ifdef PNG_16BIT_SUPPORTED
/* A local convenience routine. */
static png_fixed_point
png_product2(png_fixed_point a, png_fixed_point b)
{
/* The required result is 1/a * 1/b; the following preserves accuracy. */
-# ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
+#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
double r = a * 1E-5;
r *= b;
r = floor(r+.5);
if (r <= 2147483647. && r >= -2147483648.)
return (png_fixed_point)r;
-# else
+#else
png_fixed_point res;
if (png_muldiv(&res, a, b, 100000) != 0)
return res;
-# endif
+#endif
return 0; /* overflow */
}
-#endif /* 16BIT || !FLOATING_ARITHMETIC */
+#endif /* 16BIT */
/* The inverse of the above. */
png_fixed_point
@@ -3463,12 +3464,15 @@
{
/* The required result is 1/a * 1/b; the following preserves accuracy. */
#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
- double r = 1E15/a;
- r /= b;
- r = floor(r+.5);
-
- if (r <= 2147483647. && r >= -2147483648.)
- return (png_fixed_point)r;
+ if (a != 0 && b != 0)
+ {
+ double r = 1E15/a;
+ r /= b;
+ r = floor(r+.5);
+
+ if (r <= 2147483647. && r >= -2147483648.)
+ return (png_fixed_point)r;
+ }
#else
/* This may overflow because the range of png_fixed_point isn't symmetric,
* but this API is only used for the product of file and screen gamma so it
@@ -3706,7 +3710,7 @@
if (x > 0 && x <= 0xfffff) /* Else overflow or zero (underflow) */
{
/* Obtain a 4-bit approximation */
- png_uint_32 e = png_32bit_exp[(x >> 12) & 0xf];
+ png_uint_32 e = png_32bit_exp[(x >> 12) & 0x0f];
/* Incorporate the low 12 bits - these decrease the returned value by
* multiplying by a number less than 1 if the bit is set. The multiplier
@@ -3759,7 +3763,7 @@
* step.
*/
x -= x >> 8;
- return (png_byte)((x + 0x7fffffU) >> 24);
+ return (png_byte)(((x + 0x7fffffU) >> 24) & 0xff);
}
#ifdef PNG_16BIT_SUPPORTED
@@ -3820,7 +3824,7 @@
# endif
}
- return (png_byte)value;
+ return (png_byte)(value & 0xff);
}
#ifdef PNG_16BIT_SUPPORTED
@@ -4042,7 +4046,7 @@
else
for (i=0; i<256; ++i)
- table[i] = (png_byte)i;
+ table[i] = (png_byte)(i & 0xff);
}
/* Used from png_read_destroy and below to release the memory used by the gamma
@@ -4182,7 +4186,8 @@
*
*/
if (sig_bit > 0 && sig_bit < 16U)
- shift = (png_byte)(16U - sig_bit); /* shift == insignificant bits */
+ /* shift == insignificant bits */
+ shift = (png_byte)((16U - sig_bit) & 0xff);
else
shift = 0; /* keep all 16 bits */
@@ -4251,7 +4256,7 @@
int setting = (2 + (onoff != 0)) << option;
int current = png_ptr->options;
- png_ptr->options = (png_byte)((current & ~mask) | setting);
+ png_ptr->options = (png_byte)(((current & ~mask) | setting) & 0xff);
return (current & mask) >> option;
}
@@ -4267,7 +4272,7 @@
* contrib/tools/makesRGB.c. The actual sRGB transfer curve defined in the
* specification (see the article at http://en.wikipedia.org/wiki/SRGB)
* is used, not the gamma=1/2.2 approximation use elsewhere in libpng.
- * The sRGB to linear table is exact (to the nearest 16 bit linear fraction).
+ * The sRGB to linear table is exact (to the nearest 16-bit linear fraction).
* The inverse (linear to sRGB) table has accuracies as follows:
*
* For all possible (255*65535+1) input values:
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/png.h Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/png.h Thu Jan 21 10:17:21 2016 -0800
@@ -29,8 +29,9 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
- * libpng version 1.6.16, December 22, 2014
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * libpng version 1.6.20, December 3, 2015
+ *
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -38,17 +39,137 @@
*
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
- * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
- * libpng versions 0.97, January 1998, through 1.6.16, December 22, 2014: Glenn
+ * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
+ * libpng versions 0.97, January 1998, through 1.6.20, December 3, 2015:
+ * Glenn Randers-Pehrson.
* See also "Contributing Authors", below.
+ */
+
+/*
+ * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
*
- * Note about libpng version numbers:
+ * If you modify libpng you may insert additional notices immediately following
+ * this sentence.
+ *
+ * This code is released under the libpng license.
+ *
+ * libpng versions 1.0.7, July 1, 2000, through 1.6.20, December 3, 2015, are
+ * Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
+ * derived from libpng-1.0.6, and are distributed according to the same
+ * disclaimer and license as libpng-1.0.6 with the following individuals
+ * added to the list of Contributing Authors:
+ *
+ * Simon-Pierre Cadieux
+ * Eric S. Raymond
+ * Mans Rullgard
+ * Cosmin Truta
+ * Gilles Vollant
+ * James Yu
+ *
+ * and with the following additions to the disclaimer:
+ *
+ * There is no warranty against interference with your enjoyment of the
+ * library or against infringement. There is no warranty that our
+ * efforts or the library will fulfill any of your particular purposes
+ * or needs. This library is provided with all faults, and the entire
+ * risk of satisfactory quality, performance, accuracy, and effort is with
+ * the user.
+ *
+ * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
+ * Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
+ * libpng-0.96, and are distributed according to the same disclaimer and
+ * license as libpng-0.96, with the following individuals added to the list
+ * of Contributing Authors:
+ *
+ * Tom Lane
+ * Glenn Randers-Pehrson
+ * Willem van Schaik
+ *
+ * libpng versions 0.89, June 1996, through 0.96, May 1997, are
+ * Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
+ * and are distributed according to the same disclaimer and license as
+ * libpng-0.88, with the following individuals added to the list of
+ * Contributing Authors:
+ *
+ * John Bowler
+ * Kevin Bracey
+ * Sam Bushell
+ * Magnus Holmgren
+ * Greg Roelofs
+ * Tom Tanner
+ *
+ * libpng versions 0.5, May 1995, through 0.88, January 1996, are
+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
+ *
+ * For the purposes of this copyright and license, "Contributing Authors"
+ * is defined as the following set of individuals:
*
- * Due to various miscommunications, unforeseen code incompatibilities
- * and occasional factors outside the authors' control, version numbering
- * on the library has not always been consistent and straightforward.
- * The following table summarizes matters since version 0.89c, which was
- * the first widely used release:
+ * Andreas Dilger
+ * Dave Martindale
+ * Guy Eric Schalnat
+ * Paul Schmidt
+ * Tim Wegner
+ *
+ * The PNG Reference Library is supplied "AS IS". The Contributing Authors
+ * and Group 42, Inc. disclaim all warranties, expressed or implied,
+ * including, without limitation, the warranties of merchantability and of
+ * fitness for any purpose. The Contributing Authors and Group 42, Inc.
+ * assume no liability for direct, indirect, incidental, special, exemplary,
+ * or consequential damages, which may result from the use of the PNG
+ * Reference Library, even if advised of the possibility of such damage.
+ *
+ * Permission is hereby granted to use, copy, modify, and distribute this
+ * source code, or portions hereof, for any purpose, without fee, subject
+ * to the following restrictions:
+ *
+ * 1. The origin of this source code must not be misrepresented.
+ *
+ * 2. Altered versions must be plainly marked as such and must not
+ * be misrepresented as being the original source.
+ *
+ * 3. This Copyright notice may not be removed or altered from any
+ * source or altered source distribution.
+ *
+ * The Contributing Authors and Group 42, Inc. specifically permit, without
+ * fee, and encourage the use of this source code as a component to
+ * supporting the PNG file format in commercial products. If you use this
+ * source code in a product, acknowledgment is not required but would be
+ * appreciated.
+ *
+ * END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
+ */
+
+/*
+ * A "png_get_copyright" function is available, for convenient use in "about"
+ * boxes and the like:
+ *
+ * printf("%s", png_get_copyright(NULL));
+ *
+ * Also, the PNG logo (in PNG format, of course) is supplied in the
+ * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
+ */
+
+/*
+ * Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
+ * a certification mark of the Open Source Initiative. OSI has not addressed
+ * the additional disclaimers inserted at version 1.0.7.
+ */
+
+/*
+ * The contributing authors would like to thank all those who helped
+ * with testing, bug fixes, and patience. This wouldn't have been
+ * possible without all of you.
+ *
+ * Thanks to Frank J. T. Wojcik for helping with the documentation.
+ */
+
+/* Note about libpng version numbers:
+ *
+ * Due to various miscommunications, unforeseen code incompatibilities
+ * and occasional factors outside the authors' control, version numbering
+ * on the library has not always been consistent and straightforward.
+ * The following table summarizes matters since version 0.89c, which was
+ * the first widely used release:
*
* source png.h png.h shared-lib
* version string int version
@@ -86,310 +207,48 @@
* 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible)
* 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible)
* 1.0.7 1 10007 (still compatible)
- * 1.0.8beta1-4 1 10008 2.1.0.8beta1-4
- * 1.0.8rc1 1 10008 2.1.0.8rc1
- * 1.0.8 1 10008 2.1.0.8
- * 1.0.9beta1-6 1 10009 2.1.0.9beta1-6
- * 1.0.9rc1 1 10009 2.1.0.9rc1
- * 1.0.9beta7-10 1 10009 2.1.0.9beta7-10
- * 1.0.9rc2 1 10009 2.1.0.9rc2
- * 1.0.9 1 10009 2.1.0.9
- * 1.0.10beta1 1 10010 2.1.0.10beta1
- * 1.0.10rc1 1 10010 2.1.0.10rc1
- * 1.0.10 1 10010 2.1.0.10
- * 1.0.11beta1-3 1 10011 2.1.0.11beta1-3
- * 1.0.11rc1 1 10011 2.1.0.11rc1
- * 1.0.11 1 10011 2.1.0.11
- * 1.0.12beta1-2 2 10012 2.1.0.12beta1-2
- * 1.0.12rc1 2 10012 2.1.0.12rc1
- * 1.0.12 2 10012 2.1.0.12
- * 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned)
- * 1.2.0beta1-2 2 10200 2.1.2.0beta1-2
- * 1.2.0beta3-5 3 10200 3.1.2.0beta3-5
- * 1.2.0rc1 3 10200 3.1.2.0rc1
- * 1.2.0 3 10200 3.1.2.0
- * 1.2.1beta1-4 3 10201 3.1.2.1beta1-4
- * 1.2.1rc1-2 3 10201 3.1.2.1rc1-2
- * 1.2.1 3 10201 3.1.2.1
- * 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6
- * 1.0.13beta1 10 10013 10.so.0.1.0.13beta1
- * 1.0.13rc1 10 10013 10.so.0.1.0.13rc1
- * 1.2.2rc1 12 10202 12.so.0.1.2.2rc1
- * 1.0.13 10 10013 10.so.0.1.0.13
- * 1.2.2 12 10202 12.so.0.1.2.2
- * 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6
- * 1.2.3 12 10203 12.so.0.1.2.3
- * 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3
- * 1.0.14rc1 13 10014 10.so.0.1.0.14rc1
- * 1.2.4rc1 13 10204 12.so.0.1.2.4rc1
- * 1.0.14 10 10014 10.so.0.1.0.14
- * 1.2.4 13 10204 12.so.0.1.2.4
- * 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2
- * 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3
- * 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3
- * 1.0.15 10 10015 10.so.0.1.0.15
- * 1.2.5 13 10205 12.so.0.1.2.5
- * 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4
- * 1.0.16 10 10016 10.so.0.1.0.16
- * 1.2.6 13 10206 12.so.0.1.2.6
- * 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2
- * 1.0.17rc1 10 10017 12.so.0.1.0.17rc1
- * 1.2.7rc1 13 10207 12.so.0.1.2.7rc1
- * 1.0.17 10 10017 12.so.0.1.0.17
- * 1.2.7 13 10207 12.so.0.1.2.7
- * 1.2.8beta1-5 13 10208 12.so.0.1.2.8beta1-5
- * 1.0.18rc1-5 10 10018 12.so.0.1.0.18rc1-5
- * 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5
- * 1.0.18 10 10018 12.so.0.1.0.18
- * 1.2.8 13 10208 12.so.0.1.2.8
- * 1.2.9beta1-3 13 10209 12.so.0.1.2.9beta1-3
- * 1.2.9beta4-11 13 10209 12.so.0.9[.0]
- * 1.2.9rc1 13 10209 12.so.0.9[.0]
- * 1.2.9 13 10209 12.so.0.9[.0]
- * 1.2.10beta1-7 13 10210 12.so.0.10[.0]
- * 1.2.10rc1-2 13 10210 12.so.0.10[.0]
- * 1.2.10 13 10210 12.so.0.10[.0]
- * 1.4.0beta1-5 14 10400 14.so.0.0[.0]
- * 1.2.11beta1-4 13 10211 12.so.0.11[.0]
- * 1.4.0beta7-8 14 10400 14.so.0.0[.0]
- * 1.2.11 13 10211 12.so.0.11[.0]
- * 1.2.12 13 10212 12.so.0.12[.0]
- * 1.4.0beta9-14 14 10400 14.so.0.0[.0]
- * 1.2.13 13 10213 12.so.0.13[.0]
- * 1.4.0beta15-36 14 10400 14.so.0.0[.0]
- * 1.4.0beta37-87 14 10400 14.so.14.0[.0]
- * 1.4.0rc01 14 10400 14.so.14.0[.0]
- * 1.4.0beta88-109 14 10400 14.so.14.0[.0]
- * 1.4.0rc02-08 14 10400 14.so.14.0[.0]
- * 1.4.0 14 10400 14.so.14.0[.0]
- * 1.4.1beta01-03 14 10401 14.so.14.1[.0]
- * 1.4.1rc01 14 10401 14.so.14.1[.0]
- * 1.4.1beta04-12 14 10401 14.so.14.1[.0]
- * 1.4.1 14 10401 14.so.14.1[.0]
- * 1.4.2 14 10402 14.so.14.2[.0]
- * 1.4.3 14 10403 14.so.14.3[.0]
- * 1.4.4 14 10404 14.so.14.4[.0]
- * 1.5.0beta01-58 15 10500 15.so.15.0[.0]
- * 1.5.0rc01-07 15 10500 15.so.15.0[.0]
- * 1.5.0 15 10500 15.so.15.0[.0]
- * 1.5.1beta01-11 15 10501 15.so.15.1[.0]
- * 1.5.1rc01-02 15 10501 15.so.15.1[.0]
- * 1.5.1 15 10501 15.so.15.1[.0]
- * 1.5.2beta01-03 15 10502 15.so.15.2[.0]
- * 1.5.2rc01-03 15 10502 15.so.15.2[.0]
- * 1.5.2 15 10502 15.so.15.2[.0]
- * 1.5.3beta01-10 15 10503 15.so.15.3[.0]
- * 1.5.3rc01-02 15 10503 15.so.15.3[.0]
- * 1.5.3beta11 15 10503 15.so.15.3[.0]
- * 1.5.3 [omitted]
- * 1.5.4beta01-08 15 10504 15.so.15.4[.0]
- * 1.5.4rc01 15 10504 15.so.15.4[.0]
- * 1.5.4 15 10504 15.so.15.4[.0]
- * 1.5.5beta01-08 15 10505 15.so.15.5[.0]
- * 1.5.5rc01 15 10505 15.so.15.5[.0]
- * 1.5.5 15 10505 15.so.15.5[.0]
- * 1.5.6beta01-07 15 10506 15.so.15.6[.0]
- * 1.5.6rc01-03 15 10506 15.so.15.6[.0]
- * 1.5.6 15 10506 15.so.15.6[.0]
- * 1.5.7beta01-05 15 10507 15.so.15.7[.0]
- * 1.5.7rc01-03 15 10507 15.so.15.7[.0]
- * 1.5.7 15 10507 15.so.15.7[.0]
- * 1.6.0beta01-40 16 10600 16.so.16.0[.0]
- * 1.6.0rc01-08 16 10600 16.so.16.0[.0]
- * 1.6.0 16 10600 16.so.16.0[.0]
- * 1.6.1beta01-09 16 10601 16.so.16.1[.0]
- * 1.6.1rc01 16 10601 16.so.16.1[.0]
- * 1.6.1 16 10601 16.so.16.1[.0]
- * 1.6.2beta01 16 10602 16.so.16.2[.0]
- * 1.6.2rc01-06 16 10602 16.so.16.2[.0]
- * 1.6.2 16 10602 16.so.16.2[.0]
- * 1.6.3beta01-11 16 10603 16.so.16.3[.0]
- * 1.6.3rc01 16 10603 16.so.16.3[.0]
- * 1.6.3 16 10603 16.so.16.3[.0]
- * 1.6.4beta01-02 16 10604 16.so.16.4[.0]
- * 1.6.4rc01 16 10604 16.so.16.4[.0]
- * 1.6.4 16 10604 16.so.16.4[.0]
- * 1.6.5 16 10605 16.so.16.5[.0]
- * 1.6.6 16 10606 16.so.16.6[.0]
- * 1.6.7beta01-04 16 10607 16.so.16.7[.0]
- * 1.6.7rc01-03 16 10607 16.so.16.7[.0]
- * 1.6.7 16 10607 16.so.16.7[.0]
- * 1.6.8beta01-02 16 10608 16.so.16.8[.0]
- * 1.6.8rc01-02 16 10608 16.so.16.8[.0]
- * 1.6.8 16 10608 16.so.16.8[.0]
- * 1.6.9beta01-04 16 10609 16.so.16.9[.0]
- * 1.6.9rc01-02 16 10609 16.so.16.9[.0]
- * 1.6.9 16 10609 16.so.16.9[.0]
- * 1.6.10beta01-03 16 10610 16.so.16.10[.0]
- * 1.6.10rc01-03 16 10610 16.so.16.10[.0]
- * 1.6.10 16 10610 16.so.16.10[.0]
- * 1.6.11beta01-06 16 10611 16.so.16.11[.0]
- * 1.6.11rc01-02 16 10611 16.so.16.11[.0]
- * 1.6.11 16 10611 16.so.16.11[.0]
- * 1.6.12rc01-03 16 10612 16.so.16.12[.0]
- * 1.6.12 16 10612 16.so.16.12[.0]
- * 1.6.13beta01-04 16 10613 16.so.16.13[.0]
- * 1.6.13rc01-02 16 10613 16.so.16.13[.0]
- * 1.6.13 16 10613 16.so.16.13[.0]
- * 1.6.14beta01-07 16 10614 16.so.16.14[.0]
- * 1.6.14rc01-02 16 10614 16.so.16.14[.0]
- * 1.6.14 16 10614 16.so.16.14[.0]
- * 1.6.15beta01-08 16 10615 16.so.16.15[.0]
- * 1.6.15rc01-03 16 10615 16.so.16.15[.0]
- * 1.6.15 16 10615 16.so.16.15[.0]
- * 1.6.16beta01-03 16 10616 16.so.16.16[.0]
- * 1.6.16rc01-02 16 10616 16.so.16.16[.0]
- * 1.6.16 16 10616 16.so.16.16[.0]
+ * ...
+ * 1.0.19 10 10019 10.so.0.19[.0]
+ * ...
+ * 1.2.53 13 10253 12.so.0.53[.0]
+ * ...
+ * 1.5.23 15 10523 15.so.15.23[.0]
+ * ...
+ * 1.6.20 16 10620 16.so.16.20[.0]
*
- * Henceforth the source version will match the shared-library major
- * and minor numbers; the shared-library major version number will be
- * used for changes in backward compatibility, as it is intended. The
- * PNG_LIBPNG_VER macro, which is not used within libpng but is available
- * for applications, is an unsigned integer of the form xyyzz corresponding
- * to the source version x.y.z (leading zeros in y and z). Beta versions
- * were given the previous public release number plus a letter, until
- * version 1.0.6j; from then on they were given the upcoming public
- * release number plus "betaNN" or "rcNN".
- *
- * Binary incompatibility exists only when applications make direct access
- * to the info_ptr or png_ptr members through png.h, and the compiled
- * application is loaded with a different version of the library.
- *
- * DLLNUM will change each time there are forward or backward changes
- * in binary compatibility (e.g., when a new feature is added).
- *
- * See libpng-manual.txt or libpng.3 for more information. The PNG
- * specification is available as a W3C Recommendation and as an ISO
- * Specification, <http://www.w3.org/TR/2003/REC-PNG-20031110/
- */
-
-/*
- * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
- *
- * If you modify libpng you may insert additional notices immediately following
- * this sentence.
- *
- * This code is released under the libpng license.
- *
- * libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
- * Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
- * distributed according to the same disclaimer and license as libpng-1.2.5
- * with the following individual added to the list of Contributing Authors:
- *
- * Cosmin Truta
- *
- * libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are
- * Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
- * distributed according to the same disclaimer and license as libpng-1.0.6
- * with the following individuals added to the list of Contributing Authors:
- *
- * Simon-Pierre Cadieux
- * Eric S. Raymond
- * Gilles Vollant
- *
- * and with the following additions to the disclaimer:
- *
- * There is no warranty against interference with your enjoyment of the
- * library or against infringement. There is no warranty that our
- * efforts or the library will fulfill any of your particular purposes
- * or needs. This library is provided with all faults, and the entire
- * risk of satisfactory quality, performance, accuracy, and effort is with
- * the user.
- *
- * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson, and are
- * distributed according to the same disclaimer and license as libpng-0.96,
- * with the following individuals added to the list of Contributing Authors:
- *
- * Tom Lane
- * Glenn Randers-Pehrson
- * Willem van Schaik
+ * Henceforth the source version will match the shared-library major
+ * and minor numbers; the shared-library major version number will be
+ * used for changes in backward compatibility, as it is intended. The
+ * PNG_LIBPNG_VER macro, which is not used within libpng but is available
+ * for applications, is an unsigned integer of the form xyyzz corresponding
+ * to the source version x.y.z (leading zeros in y and z). Beta versions
+ * were given the previous public release number plus a letter, until
+ * version 1.0.6j; from then on they were given the upcoming public
+ * release number plus "betaNN" or "rcNN".
*
- * libpng versions 0.89, June 1996, through 0.96, May 1997, are
- * Copyright (c) 1996, 1997 Andreas Dilger
- * Distributed according to the same disclaimer and license as libpng-0.88,
- * with the following individuals added to the list of Contributing Authors:
- *
- * John Bowler
- * Kevin Bracey
- * Sam Bushell
- * Magnus Holmgren
- * Greg Roelofs
- * Tom Tanner
- *
- * libpng versions 0.5, May 1995, through 0.88, January 1996, are
- * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
- *
- * For the purposes of this copyright and license, "Contributing Authors"
- * is defined as the following set of individuals:
- *
- * Andreas Dilger
- * Dave Martindale
- * Guy Eric Schalnat
- * Paul Schmidt
- * Tim Wegner
- *
- * The PNG Reference Library is supplied "AS IS". The Contributing Authors
- * and Group 42, Inc. disclaim all warranties, expressed or implied,
- * including, without limitation, the warranties of merchantability and of
- * fitness for any purpose. The Contributing Authors and Group 42, Inc.
- * assume no liability for direct, indirect, incidental, special, exemplary,
- * or consequential damages, which may result from the use of the PNG
- * Reference Library, even if advised of the possibility of such damage.
- *
- * Permission is hereby granted to use, copy, modify, and distribute this
- * source code, or portions hereof, for any purpose, without fee, subject
- * to the following restrictions:
+ * Binary incompatibility exists only when applications make direct access
+ * to the info_ptr or png_ptr members through png.h, and the compiled
+ * application is loaded with a different version of the library.
*
- * 1. The origin of this source code must not be misrepresented.
- *
- * 2. Altered versions must be plainly marked as such and must not
- * be misrepresented as being the original source.
- *
- * 3. This Copyright notice may not be removed or altered from
- * any source or altered source distribution.
+ * DLLNUM will change each time there are forward or backward changes
+ * in binary compatibility (e.g., when a new feature is added).
*
- * The Contributing Authors and Group 42, Inc. specifically permit, without
- * fee, and encourage the use of this source code as a component to
- * supporting the PNG file format in commercial products. If you use this
- * source code in a product, acknowledgment is not required but would be
- * appreciated.
- */
-
-/*
- * A "png_get_copyright" function is available, for convenient use in "about"
- * boxes and the like:
- *
- * printf("%s", png_get_copyright(NULL));
- *
- * Also, the PNG logo (in PNG format, of course) is supplied in the
- * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
- */
-
-/*
- * Libpng is OSI Certified Open Source Software. OSI Certified is a
- * certification mark of the Open Source Initiative.
- */
-
-/*
- * The contributing authors would like to thank all those who helped
- * with testing, bug fixes, and patience. This wouldn't have been
- * possible without all of you.
- *
- * Thanks to Frank J. T. Wojcik for helping with the documentation.
+ * See libpng.txt or libpng.3 for more information. The PNG specification
+ * is available as a W3C Recommendation and as an ISO Specification,
+ * <http://www.w3.org/TR/2003/REC-PNG-20031110/
*/
/*
* Y2K compliance in libpng:
* =========================
*
- * December 22, 2014
+ * December 3, 2015
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
- * upward through 1.6.16 are Y2K compliant. It is my belief that
+ * upward through 1.6.20 are Y2K compliant. It is my belief that
* earlier versions were also Y2K compliant.
*
* Libpng only has two year fields. One is a 2-byte unsigned integer
@@ -451,9 +310,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.6.16"
+#define PNG_LIBPNG_VER_STRING "1.6.20"
#define PNG_HEADER_VERSION_STRING \
- " libpng version 1.6.16 - December 22, 2014\n"
+ " libpng version 1.6.20 - December 3, 2015\n"
#define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16
@@ -461,7 +320,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 6
-#define PNG_LIBPNG_VER_RELEASE 16
+#define PNG_LIBPNG_VER_RELEASE 20
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
@@ -492,7 +351,7 @@
* version 1.0.0 was mis-numbered 100 instead of 10000). From
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
*/
-#define PNG_LIBPNG_VER 10616 /* 1.6.16 */
+#define PNG_LIBPNG_VER 10620 /* 1.6.20 */
/* Library configuration: these options cannot be changed after
* the library has been built.
@@ -549,17 +408,22 @@
/* This file is arranged in several sections:
*
- * 1. Any configuration options that can be specified by for the application
+ * 1. [omitted]
+ * 2. Any configuration options that can be specified by for the application
* code when it is built. (Build time configuration is in pnglibconf.h)
- * 2. Type definitions (base types are defined in pngconf.h), structure
+ * 3. Type definitions (base types are defined in pngconf.h), structure
* definitions.
- * 3. Exported library functions.
- * 4. Simplified API.
+ * 4. Exported library functions.
+ * 5. Simplified API.
+ * 6. Implementation options.
*
* The library source code has additional files (principally pngpriv.h) that
* allow configuration of the library.
*/
-/* Section 1: run time configuration
+
+/* Section 1: [omitted] */
+
+/* Section 2: run time configuration
* See pnglibconf.h for build time configuration
*
* Run time configuration allows the application to choose between
@@ -589,7 +453,7 @@
* Otherwise the calls are mapped to png_error.
*/
-/* Section 2: type definitions, including structures and compile time
+/* Section 3: type definitions, including structures and compile time
* constants.
* See pngconf.h for base types that vary by machine/system
*/
@@ -597,7 +461,7 @@
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
-typedef char* png_libpng_version_1_6_16;
+typedef char* png_libpng_version_1_6_20;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
*
@@ -913,7 +777,9 @@
#define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */
#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
+#if INT_MAX >= 0x8000 /* else this might break */
#define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */
+#endif
/* This is used for the transformation routines, as some of them
* change these values for the row. It also should enable using
@@ -1017,7 +883,9 @@
#define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */
/* Added to libpng-1.5.4 */
#define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */
+#if INT_MAX >= 0x8000 /* else this might break */
#define PNG_TRANSFORM_SCALE_16 0x8000 /* read only */
+#endif
/* Flags for MNG supported features */
#define PNG_FLAG_MNG_EMPTY_PLTE 0x01
@@ -1034,7 +902,7 @@
png_alloc_size_t));
typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp));
-/* Section 3: exported functions
+/* Section 4: exported functions
* Here are the function definitions most commonly used. This is not
* the place to find out how to use libpng. See libpng-manual.txt for the
* full explanation, see example.c for the summary. This just provides
@@ -1407,13 +1275,13 @@
#endif
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
-/* Add a filler byte to 8-bit Gray or 24-bit RGB images. */
+/* Add a filler byte to 8-bit or 16-bit Gray or 24-bit or 48-bit RGB images. */
PNG_EXPORT(39, void, png_set_filler, (png_structrp png_ptr, png_uint_32 filler,
int flags));
/* The values of the PNG_FILLER_ defines should NOT be changed */
# define PNG_FILLER_BEFORE 0
# define PNG_FILLER_AFTER 1
-/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */
+/* Add an alpha byte to 8-bit or 16-bit Gray or 24-bit or 48-bit RGB images. */
PNG_EXPORT(40, void, png_set_add_alpha, (png_structrp png_ptr,
png_uint_32 filler, int flags));
#endif /* READ_FILLER || WRITE_FILLER */
@@ -1606,6 +1474,7 @@
#define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */
#define PNG_CRC_NO_CHANGE 5 /* use current value use current value */
+#ifdef PNG_WRITE_SUPPORTED
/* These functions give the user control over the scan-line filtering in
* libpng and the compression methods used by zlib. These functions are
* mainly useful for testing, as the defaults should work with most users.
@@ -1619,6 +1488,7 @@
*/
PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method,
int filters));
+#endif /* WRITE */
/* Flags for png_set_filter() to say which filters to use. The flags
* are chosen so that they don't conflict with real filter types
@@ -1644,35 +1514,8 @@
#define PNG_FILTER_VALUE_PAETH 4
#define PNG_FILTER_VALUE_LAST 5
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* EXPERIMENTAL */
-/* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_
- * defines, either the default (minimum-sum-of-absolute-differences), or
- * the experimental method (weighted-minimum-sum-of-absolute-differences).
- *
- * Weights are factors >= 1.0, indicating how important it is to keep the
- * filter type consistent between rows. Larger numbers mean the current
- * filter is that many times as likely to be the same as the "num_weights"
- * previous filters. This is cumulative for each previous row with a weight.
- * There needs to be "num_weights" values in "filter_weights", or it can be
- * NULL if the weights aren't being specified. Weights have no influence on
- * the selection of the first row filter. Well chosen weights can (in theory)
- * improve the compression for a given image.
- *
- * Costs are factors >= 1.0 indicating the relative decoding costs of a
- * filter type. Higher costs indicate more decoding expense, and are
- * therefore less likely to be selected over a filter with lower computational
- * costs. There needs to be a value in "filter_costs" for each valid filter
- * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't
- * setting the costs. Costs try to improve the speed of decompression without
- * unduly increasing the compressed image size.
- *
- * A negative weight or cost indicates the default value is to be used, and
- * values in the range [0.0, 1.0) indicate the value is to remain unchanged.
- * The default values for both weights and costs are currently 1.0, but may
- * change if good general weighting/cost heuristics can be found. If both
- * the weights and costs are set to 1.0, this degenerates the WEIGHTED method
- * to the UNWEIGHTED method, but with added encoding time/computation.
- */
+#ifdef PNG_WRITE_SUPPORTED
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* DEPRECATED */
PNG_FP_EXPORT(68, void, png_set_filter_heuristics, (png_structrp png_ptr,
int heuristic_method, int num_weights, png_const_doublep filter_weights,
png_const_doublep filter_costs))
@@ -1682,15 +1525,12 @@
png_const_fixed_point_p filter_costs))
#endif /* WRITE_WEIGHTED_FILTER */
-/* Heuristic used for row filter selection. These defines should NOT be
- * changed.
- */
+/* The following are no longer used and will be removed from libpng-1.7: */
#define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */
#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */
#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */
#define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */
-#ifdef PNG_WRITE_SUPPORTED
/* Set the library compression level. Currently, valid values range from
* 0 - 9, corresponding directly to the zlib compression levels 0 - 9
* (0 - no compression, 9 - "maximal" compression). Note that tests have
@@ -1698,6 +1538,7 @@
* for PNG images, and do considerably fewer caclulations. In the future,
* these values may not correspond directly to the zlib compression levels.
*/
+#ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
PNG_EXPORT(69, void, png_set_compression_level, (png_structrp png_ptr,
int level));
@@ -1715,7 +1556,7 @@
PNG_EXPORT(73, void, png_set_compression_method, (png_structrp png_ptr,
int method));
-#endif
+#endif /* WRITE_CUSTOMIZE_COMPRESSION */
#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
/* Also set zlib parameters for compressing non-IDAT chunks */
@@ -1737,6 +1578,7 @@
PNG_EXPORT(226, void, png_set_text_compression_method, (png_structrp png_ptr,
int method));
#endif /* WRITE_CUSTOMIZE_ZTXT_COMPRESSION */
+#endif /* WRITE */
/* These next functions are called for input/output, memory, and error
* handling. They are in the file pngrio.c, pngwio.c, and pngerror.c,
@@ -1847,7 +1689,7 @@
*
* The integer return from the callback function is interpreted thus:
*
- * negative: An error occured, png_chunk_error will be called.
+ * negative: An error occurred; png_chunk_error will be called.
* zero: The chunk was not handled, the chunk will be saved. A critical
* chunk will cause an error at this point unless it is to be saved.
* positive: The chunk was handled, libpng will ignore/discard it.
@@ -2692,26 +2534,28 @@
* (png_uint_16)(alpha) \
+ (png_uint_16)(bg)*(png_uint_16)(255 \
- (png_uint_16)(alpha)) + 128); \
- (composite) = (png_byte)((temp + (temp >> 8)) >> 8); }
+ (composite) = (png_byte)(((temp + (temp >> 8)) >> 8) & 0xff); }
# define png_composite_16(composite, fg, alpha, bg) \
{ png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \
* (png_uint_32)(alpha) \
+ (png_uint_32)(bg)*(65535 \
- (png_uint_32)(alpha)) + 32768); \
- (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
+ (composite) = (png_uint_16)(0xffff & ((temp + (temp >> 16)) >> 16)); }
#else /* Standard method using integer division */
-# define png_composite(composite, fg, alpha, bg) \
- (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \
- (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
- 127) / 255)
+# define png_composite(composite, fg, alpha, bg) \
+ (composite) = \
+ (png_byte)(0xff & (((png_uint_16)(fg) * (png_uint_16)(alpha) + \
+ (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
+ 127) / 255))
# define png_composite_16(composite, fg, alpha, bg) \
- (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
- (png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) + \
- 32767) / 65535)
+ (composite) = \
+ (png_uint_16)(0xffff & (((png_uint_32)(fg) * (png_uint_32)(alpha) + \
+ (png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) + \
+ 32767) / 65535))
#endif /* READ_COMPOSITE_NODIV */
#ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED
@@ -2762,7 +2606,7 @@
# define PNG_get_int_32(buf) \
((png_int_32)((*(buf) & 0x80) \
- ? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffffL) + 1)) \
+ ? -((png_int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \
: (png_int_32)png_get_uint_32(buf)))
/* If PNG_PREFIX is defined the same thing as below happens in pnglibconf.h,
@@ -2782,10 +2626,17 @@
# endif
#endif
-#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \
- defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
+#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
+PNG_EXPORT(242, void, png_set_check_for_invalid_index,
+ (png_structrp png_ptr, int allowed));
+# ifdef PNG_GET_PALETTE_MAX_SUPPORTED
+PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
+ png_const_infop info_ptr));
+# endif
+#endif /* CHECK_FOR_INVALID_INDEX */
+
/*******************************************************************************
- * SIMPLIFIED API
+ * Section 5: SIMPLIFIED API
*******************************************************************************
*
* Please read the documentation in libpng-manual.txt (TODO: write said
@@ -2801,8 +2652,9 @@
*
* To read a PNG file using the simplified API:
*
- * 1) Declare a 'png_image' structure (see below) on the stack and set the
- * version field to PNG_IMAGE_VERSION.
+ * 1) Declare a 'png_image' structure (see below) on the stack, set the
+ * version field to PNG_IMAGE_VERSION and the 'opaque' pointer to NULL
+ * (this is REQUIRED, your program may crash if you don't do it.)
* 2) Call the appropriate png_image_begin_read... function.
* 3) Set the png_image 'format' member to the required sample format.
* 4) Allocate a buffer for the image and, if required, the color-map.
@@ -2829,6 +2681,9 @@
* when it is being read or defines the in-memory format of an image that you
* need to write:
*/
+#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \
+ defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
+
#define PNG_IMAGE_VERSION 1
typedef struct png_control *png_controlp;
@@ -2928,7 +2783,7 @@
* called to read or write the color-map and set the format correctly for the
* image data. Do not set the PNG_FORMAT_FLAG_COLORMAP bit directly!
*
- * NOTE: libpng can be built with particular features disabled, if you see
+ * NOTE: libpng can be built with particular features disabled. If you see
* compiler errors because the definition of one of the following flags has been
* compiled out it is because libpng does not have the required support. It is
* possible, however, for the libpng configuration to enable the format on just
@@ -2940,7 +2795,7 @@
*/
#define PNG_FORMAT_FLAG_ALPHA 0x01U /* format with an alpha channel */
#define PNG_FORMAT_FLAG_COLOR 0x02U /* color format: otherwise grayscale */
-#define PNG_FORMAT_FLAG_LINEAR 0x04U /* 2 byte channels else 1 byte */
+#define PNG_FORMAT_FLAG_LINEAR 0x04U /* 2-byte channels else 1-byte */
#define PNG_FORMAT_FLAG_COLORMAP 0x08U /* image data is color-mapped */
#ifdef PNG_FORMAT_BGR_SUPPORTED
@@ -3227,9 +3082,11 @@
*
* With all APIs row_stride is handled as in the read APIs - it is the spacing
* from one row to the next in component sized units (1 or 2 bytes) and if
- * negative indicates a bottom-up row layout in the buffer.
+ * negative indicates a bottom-up row layout in the buffer. If row_stride is zero,
+ * libpng will calculate it for you from the image width and number of channels.
*
- * Note that the write API does not support interlacing or sub-8-bit pixels.
+ * Note that the write API does not support interlacing, sub-8-bit pixels, indexed
+ * PNG (color_type 3) or most ancillary chunks.
*/
#endif /* STDIO */
#endif /* SIMPLIFIED_WRITE */
@@ -3238,17 +3095,8 @@
******************************************************************************/
#endif /* SIMPLIFIED_{READ|WRITE} */
-#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
-PNG_EXPORT(242, void, png_set_check_for_invalid_index,
- (png_structrp png_ptr, int allowed));
-# ifdef PNG_GET_PALETTE_MAX_SUPPORTED
-PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
- png_const_infop info_ptr));
-# endif
-#endif /* CHECK_FOR_INVALID_INDEX */
-
/*******************************************************************************
- * IMPLEMENTATION OPTIONS
+ * Section 6: IMPLEMENTATION OPTIONS
*******************************************************************************
*
* Support for arbitrary implementation-specific optimizations. The API allows
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h Thu Jan 21 10:17:21 2016 -0800
@@ -29,9 +29,9 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
- * libpng version 1.6.16,December 22, 2014
+ * libpng version 1.6.20, December 3, 2015
*
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -39,9 +39,7 @@
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
- */
-
-/* Any machine specific code is near the front of this file, so if you
+ * Any machine specific code is near the front of this file, so if you
* are configuring libpng for a machine, you may want to read the section
* starting here down to where it starts to typedef png_color, png_text,
* and png_info.
@@ -50,26 +48,6 @@
#ifndef PNGCONF_H
#define PNGCONF_H
-/* To do: Do all of this in scripts/pnglibconf.dfa */
-#ifdef PNG_SAFE_LIMITS_SUPPORTED
-# ifdef PNG_USER_WIDTH_MAX
-# undef PNG_USER_WIDTH_MAX
-# define PNG_USER_WIDTH_MAX 1000000L
-# endif
-# ifdef PNG_USER_HEIGHT_MAX
-# undef PNG_USER_HEIGHT_MAX
-# define PNG_USER_HEIGHT_MAX 1000000L
-# endif
-# ifdef PNG_USER_CHUNK_MALLOC_MAX
-# undef PNG_USER_CHUNK_MALLOC_MAX
-# define PNG_USER_CHUNK_MALLOC_MAX 4000000L
-# endif
-# ifdef PNG_USER_CHUNK_CACHE_MAX
-# undef PNG_USER_CHUNK_CACHE_MAX
-# define PNG_USER_CHUNK_CACHE_MAX 128
-# endif
-#endif
-
#ifndef PNG_BUILDING_SYMBOL_TABLE /* else includes may cause problems */
/* From libpng 1.6.0 libpng requires an ANSI X3.159-1989 ("ISOC90") compliant C
@@ -113,7 +91,7 @@
*/
#define PNG_CONST const /* backward compatibility only */
-/* This controls optimization of the reading of 16 and 32 bit values
+/* This controls optimization of the reading of 16-bit and 32-bit values
* from PNG files. It can be set on a per-app-file basis - it
* just changes whether a macro is used when the function is called.
* The library builder sets the default; if read functions are not
@@ -345,11 +323,11 @@
* table entries, so we discard it here. See the .dfn files in the
* scripts directory.
*/
+
#ifndef PNG_EXPORTA
-
-# define PNG_EXPORTA(ordinal, type, name, args, attributes)\
- PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args), \
- extern attributes)
+# define PNG_EXPORTA(ordinal, type, name, args, attributes) \
+ PNG_FUNCTION(PNG_EXPORT_TYPE(type), (PNGAPI name), PNGARG(args), \
+ PNG_LINKAGE_API attributes)
#endif
/* ANSI-C (C90) does not permit a macro to be invoked with an empty argument,
@@ -357,7 +335,7 @@
*/
#define PNG_EMPTY /*empty list*/
-#define PNG_EXPORT(ordinal, type, name, args)\
+#define PNG_EXPORT(ordinal, type, name, args) \
PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY)
/* Use PNG_REMOVED to comment out a removed interface. */
@@ -530,7 +508,7 @@
#if CHAR_BIT == 8 && UCHAR_MAX == 255
typedef unsigned char png_byte;
#else
-# error "libpng requires 8 bit bytes"
+# error "libpng requires 8-bit bytes"
#endif
#if INT_MIN == -32768 && INT_MAX == 32767
@@ -538,7 +516,7 @@
#elif SHRT_MIN == -32768 && SHRT_MAX == 32767
typedef short png_int_16;
#else
-# error "libpng requires a signed 16 bit type"
+# error "libpng requires a signed 16-bit type"
#endif
#if UINT_MAX == 65535
@@ -546,7 +524,7 @@
#elif USHRT_MAX == 65535
typedef unsigned short png_uint_16;
#else
-# error "libpng requires an unsigned 16 bit type"
+# error "libpng requires an unsigned 16-bit type"
#endif
#if INT_MIN < -2147483646 && INT_MAX > 2147483646
@@ -554,7 +532,7 @@
#elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646
typedef long int png_int_32;
#else
-# error "libpng requires a signed 32 bit (or more) type"
+# error "libpng requires a signed 32-bit (or more) type"
#endif
#if UINT_MAX > 4294967294
@@ -562,7 +540,7 @@
#elif ULONG_MAX > 4294967294
typedef unsigned long int png_uint_32;
#else
-# error "libpng requires an unsigned 32 bit (or more) type"
+# error "libpng requires an unsigned 32-bit (or more) type"
#endif
/* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however,
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngdebug.h Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngdebug.h Thu Jan 21 10:17:21 2016 -0800
@@ -29,12 +29,11 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
+ * Last changed in libpng 1.6.8 [December 19, 2013]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
- * Last changed in libpng 1.6.8 [December 19, 2013]
- *
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c Thu Jan 21 10:17:21 2016 -0800
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.17 [March 26, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -827,14 +827,20 @@
{
png_debug1(1, "in %s retrieval function", "IHDR");
- if (png_ptr == NULL || info_ptr == NULL || width == NULL ||
- height == NULL || bit_depth == NULL || color_type == NULL)
+ if (png_ptr == NULL || info_ptr == NULL)
return (0);
- *width = info_ptr->width;
- *height = info_ptr->height;
- *bit_depth = info_ptr->bit_depth;
- *color_type = info_ptr->color_type;
+ if (width != NULL)
+ *width = info_ptr->width;
+
+ if (height != NULL)
+ *height = info_ptr->height;
+
+ if (bit_depth != NULL)
+ *bit_depth = info_ptr->bit_depth;
+
+ if (color_type != NULL)
+ *color_type = info_ptr->color_type;
if (compression_type != NULL)
*compression_type = info_ptr->compression_type;
@@ -1163,21 +1169,21 @@
if (png_ptr == NULL)
return 0;
-# ifdef PNG_WRITE_SUPPORTED
+#ifdef PNG_WRITE_SUPPORTED
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
-# endif
+#endif
{
-# ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
return png_ptr->IDAT_read_size;
-# else
+#else
return PNG_IDAT_READ_SIZE;
-# endif
+#endif
}
-# ifdef PNG_WRITE_SUPPORTED
+#ifdef PNG_WRITE_SUPPORTED
else
return png_ptr->zbuffer_size;
-# endif
+#endif
}
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pnginfo.h Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pnginfo.h Thu Jan 21 10:17:21 2016 -0800
@@ -29,12 +29,11 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
+ * Last changed in libpng 1.6.1 [March 28, 2013]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
- * Last changed in libpng 1.6.1 [March 28, 2013]
- *
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h Thu Jan 21 10:17:21 2016 -0800
@@ -34,7 +34,7 @@
* file and, per its terms, should not be removed:
*/
-/* libpng version 1.6.16,December 22, 2014 */
+/* libpng version 1.6.20, December 3, 2015 */
/* Copyright (c) 1998-2014 Glenn Randers-Pehrson */
@@ -129,13 +129,10 @@
#define PNG_READ_tIME_SUPPORTED
#define PNG_READ_tRNS_SUPPORTED
#define PNG_READ_zTXt_SUPPORTED
-/*#undef PNG_SAFE_LIMITS_SUPPORTED*/
/*#undef PNG_SAVE_INT_32_SUPPORTED*/
#define PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_SEQUENTIAL_READ_SUPPORTED
#define PNG_SETJMP_SUPPORTED
-#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
-#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
#define PNG_SET_OPTION_SUPPORTED
#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_SET_USER_LIMITS_SUPPORTED
@@ -161,6 +158,7 @@
/*#undef PNG_WRITE_BGR_SUPPORTED*/
/*#undef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED*/
/*#undef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED*/
+/*#undef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED*/
/*#undef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED*/
/*#undef PNG_WRITE_FILLER_SUPPORTED*/
/*#undef PNG_WRITE_FILTER_SUPPORTED*/
@@ -219,11 +217,14 @@
/* end of options */
/* settings */
#define PNG_API_RULE 0
-#define PNG_COST_SHIFT 3
#define PNG_DEFAULT_READ_MACROS 1
#define PNG_GAMMA_THRESHOLD_FIXED 5000
#define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE
#define PNG_INFLATE_BUF_SIZE 1024
+#define PNG_LINKAGE_API extern
+#define PNG_LINKAGE_CALLBACK extern
+#define PNG_LINKAGE_DATA extern
+#define PNG_LINKAGE_FUNCTION extern
#define PNG_MAX_GAMMA_8 11
#define PNG_QUANTIZE_BLUE_BITS 5
#define PNG_QUANTIZE_GREEN_BITS 5
@@ -234,7 +235,6 @@
#define PNG_USER_CHUNK_MALLOC_MAX 0
#define PNG_USER_HEIGHT_MAX 1000000
#define PNG_USER_WIDTH_MAX 1000000
-#define PNG_WEIGHT_SHIFT 8
#define PNG_ZBUF_SIZE 8192
#define PNG_ZLIB_VERNUM 0
#define PNG_Z_DEFAULT_COMPRESSION (-1)
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c Thu Jan 21 10:17:21 2016 -0800
@@ -69,7 +69,7 @@
}
/* Allocate memory. For reasonable files, size should never exceed
- * 64K. However, zlib may allocate more then 64K if you don't tell
+ * 64K. However, zlib may allocate more than 64K if you don't tell
* it not to. See zconf.h and png.h for more information. zlib does
* need to allocate exactly 64K, so whatever you call here must
* have the ability to do that.
@@ -105,6 +105,9 @@
PNG_UNUSED(png_ptr)
#endif
+ /* Some compilers complain that this is always true. However, it
+ * can be false when integer overflow happens.
+ */
if (size > 0 && size <= PNG_SIZE_MAX
# ifdef PNG_MAX_MALLOC_64K
&& size <= 65536U
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c Thu Jan 21 10:17:21 2016 -0800
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.18 [July 23, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -47,7 +47,6 @@
#define PNG_READ_SIG_MODE 0
#define PNG_READ_CHUNK_MODE 1
#define PNG_READ_IDAT_MODE 2
-#define PNG_SKIP_MODE 3
#define PNG_READ_tEXt_MODE 4
#define PNG_READ_zTXt_MODE 5
#define PNG_READ_DONE_MODE 6
@@ -106,32 +105,14 @@
png_uint_32 PNGAPI
png_process_data_skip(png_structrp png_ptr)
{
- png_uint_32 remaining = 0;
-
- if (png_ptr != NULL && png_ptr->process_mode == PNG_SKIP_MODE &&
- png_ptr->skip_length > 0)
- {
- /* At the end of png_process_data the buffer size must be 0 (see the loop
- * above) so we can detect a broken call here:
- */
- if (png_ptr->buffer_size != 0)
- png_error(png_ptr,
- "png_process_data_skip called inside png_process_data");
-
- /* If is impossible for there to be a saved buffer at this point -
- * otherwise we could not be in SKIP mode. This will also happen if
- * png_process_skip is called inside png_process_data (but only very
- * rarely.)
- */
- if (png_ptr->save_buffer_size != 0)
- png_error(png_ptr, "png_process_data_skip called with saved data");
-
- remaining = png_ptr->skip_length;
- png_ptr->skip_length = 0;
- png_ptr->process_mode = PNG_READ_CHUNK_MODE;
- }
-
- return remaining;
+ /* TODO: Deprecate and remove this API.
+ * Somewhere the implementation of this seems to have been lost,
+ * or abandoned. It was only to support some internal back-door access
+ * to png_struct) in libpng-1.4.x.
+ */
+ png_app_warning(png_ptr,
+"png_process_data_skip is not implemented in any current version of libpng");
+ return 0;
}
/* What we do with the incoming data depends on what we were previously
@@ -163,12 +144,6 @@
break;
}
- case PNG_SKIP_MODE:
- {
- png_push_crc_finish(png_ptr);
- break;
- }
-
default:
{
png_ptr->buffer_size = 0;
@@ -187,7 +162,7 @@
png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
{
png_size_t num_checked = png_ptr->sig_bytes, /* SAFE, does not exceed 8 */
- num_to_check = 8 - num_checked;
+ num_to_check = 8 - num_checked;
if (png_ptr->buffer_size < num_to_check)
{
@@ -467,69 +442,6 @@
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
}
-void /* PRIVATE */
-png_push_crc_skip(png_structrp png_ptr, png_uint_32 skip)
-{
- png_ptr->process_mode = PNG_SKIP_MODE;
- png_ptr->skip_length = skip;
-}
-
-void /* PRIVATE */
-png_push_crc_finish(png_structrp png_ptr)
-{
- if (png_ptr->skip_length != 0 && png_ptr->save_buffer_size != 0)
- {
- png_size_t save_size = png_ptr->save_buffer_size;
- png_uint_32 skip_length = png_ptr->skip_length;
-
- /* We want the smaller of 'skip_length' and 'save_buffer_size', but
- * they are of different types and we don't know which variable has the
- * fewest bits. Carefully select the smaller and cast it to the type of
- * the larger - this cannot overflow. Do not cast in the following test
- * - it will break on either 16 or 64 bit platforms.
- */
- if (skip_length < save_size)
- save_size = (png_size_t)skip_length;
-
- else
- skip_length = (png_uint_32)save_size;
-
- png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size);
-
- png_ptr->skip_length -= skip_length;
- png_ptr->buffer_size -= save_size;
- png_ptr->save_buffer_size -= save_size;
- png_ptr->save_buffer_ptr += save_size;
- }
- if (png_ptr->skip_length != 0 && png_ptr->current_buffer_size != 0)
- {
- png_size_t save_size = png_ptr->current_buffer_size;
- png_uint_32 skip_length = png_ptr->skip_length;
-
- /* We want the smaller of 'skip_length' and 'current_buffer_size', here,
- * the same problem exists as above and the same solution.
- */
- if (skip_length < save_size)
- save_size = (png_size_t)skip_length;
-
- else
- skip_length = (png_uint_32)save_size;
-
- png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size);
-
- png_ptr->skip_length -= skip_length;
- png_ptr->buffer_size -= save_size;
- png_ptr->current_buffer_size -= save_size;
- png_ptr->current_buffer_ptr += save_size;
- }
- if (png_ptr->skip_length == 0)
- {
- PNG_PUSH_SAVE_BUFFER_IF_LT(4)
- png_crc_finish(png_ptr, 0);
- png_ptr->process_mode = PNG_READ_CHUNK_MODE;
- }
-}
-
void PNGCBAPI
png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
{
@@ -612,13 +524,11 @@
if (png_ptr->save_buffer == NULL)
{
png_free(png_ptr, old_buffer);
- old_buffer = NULL;
png_error(png_ptr, "Insufficient memory for save_buffer");
}
memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
png_free(png_ptr, old_buffer);
- old_buffer = NULL;
png_ptr->save_buffer_max = new_max;
}
if (png_ptr->current_buffer_size)
@@ -681,7 +591,7 @@
* are of different types and we don't know which variable has the fewest
* bits. Carefully select the smaller and cast it to the type of the
* larger - this cannot overflow. Do not cast in the following test - it
- * will break on either 16 or 64 bit platforms.
+ * will break on either 16-bit or 64-bit platforms.
*/
if (idat_size < save_size)
save_size = (png_size_t)idat_size;
@@ -724,6 +634,7 @@
png_ptr->current_buffer_size -= save_size;
png_ptr->current_buffer_ptr += save_size;
}
+
if (png_ptr->idat_size == 0)
{
PNG_PUSH_SAVE_BUFFER_IF_LT(4)
@@ -754,7 +665,7 @@
* or the stream marked as finished.
*/
while (png_ptr->zstream.avail_in > 0 &&
- !(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED))
+ (png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) == 0)
{
int ret;
@@ -779,7 +690,7 @@
* change the current behavior (see comments in inflate.c
* for why this doesn't happen at present with zlib 1.2.5).
*/
- ret = inflate(&png_ptr->zstream, Z_SYNC_FLUSH);
+ ret = PNG_INFLATE(png_ptr, Z_SYNC_FLUSH);
/* Check for any failure before proceeding. */
if (ret != Z_OK && ret != Z_STREAM_END)
@@ -1064,6 +975,7 @@
}
}
else
+#endif
{
png_push_have_row(png_ptr, png_ptr->row_buf + 1);
png_read_push_finish_row(png_ptr);
@@ -1073,6 +985,7 @@
void /* PRIVATE */
png_read_push_finish_row(png_structrp png_ptr)
{
+#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */
@@ -1097,6 +1010,7 @@
if (png_ptr->row_number < png_ptr->num_rows)
return;
+#ifdef PNG_READ_INTERLACING_SUPPORTED
if (png_ptr->interlaced != 0)
{
png_ptr->row_number = 0;
@@ -1131,6 +1045,7 @@
} while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0);
}
+#endif /* READ_INTERLACING */
}
void /* PRIVATE */
@@ -1155,6 +1070,7 @@
(int)png_ptr->pass);
}
+#ifdef PNG_READ_INTERLACING_SUPPORTED
void PNGAPI
png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row,
png_const_bytep new_row)
@@ -1169,6 +1085,7 @@
if (new_row != NULL)
png_combine_row(png_ptr, old_row, 1/*blocky display*/);
}
+#endif /* READ_INTERLACING */
void PNGAPI
png_set_progressive_read_fn(png_structrp png_ptr, png_voidp progressive_ptr,
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h Thu Jan 21 10:17:21 2016 -0800
@@ -29,13 +29,11 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
- * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.18 [July 23, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
- * Last changed in libpng 1.6.10 [March 6, 1014]]
- *
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
@@ -148,8 +146,12 @@
* to compile with an appropriate #error if ALIGNED_MEMORY has been turned
* off.
*
- * Note that gcc-4.9 defines __ARM_NEON instead of __ARM_NEON__, so we
- * check both variants.
+ * Note that gcc-4.9 defines __ARM_NEON instead of the deprecated
+ * __ARM_NEON__, so we check both variants.
+ *
+ * To disable ARM_NEON optimizations entirely, and skip compiling the
+ * associated assembler code, pass --enable-arm-neon=no to configure
+ * or put -DPNG_ARM_NEON_OPT=0 in CPPFLAGS.
*/
# if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \
defined(PNG_ALIGNED_MEMORY_SUPPORTED)
@@ -278,17 +280,18 @@
* always be used to declare an extern data or function object in this file.
*/
#ifndef PNG_INTERNAL_DATA
-# define PNG_INTERNAL_DATA(type, name, array) extern type name array
+# define PNG_INTERNAL_DATA(type, name, array) PNG_LINKAGE_DATA type name array
#endif
#ifndef PNG_INTERNAL_FUNCTION
# define PNG_INTERNAL_FUNCTION(type, name, args, attributes)\
- extern PNG_FUNCTION(type, name, args, PNG_EMPTY attributes)
+ PNG_LINKAGE_FUNCTION PNG_FUNCTION(type, name, args, PNG_EMPTY attributes)
#endif
#ifndef PNG_INTERNAL_CALLBACK
# define PNG_INTERNAL_CALLBACK(type, name, args, attributes)\
- extern PNG_FUNCTION(type, (PNGCBAPI name), args, PNG_EMPTY attributes)
+ PNG_LINKAGE_CALLBACK PNG_FUNCTION(type, (PNGCBAPI name), args,\
+ PNG_EMPTY attributes)
#endif
/* If floating or fixed point APIs are disabled they may still be compiled
@@ -326,48 +329,27 @@
# define PNG_DLL_EXPORT
#endif
+/* This is a global switch to set the compilation for an installed system
+ * (a release build). It can be set for testing debug builds to ensure that
+ * they will compile when the build type is switched to RC or STABLE, the
+ * default is just to use PNG_LIBPNG_BUILD_BASE_TYPE. Set this in CPPFLAGS
+ * with either:
+ *
+ * -DPNG_RELEASE_BUILD Turns on the release compile path
+ * -DPNG_RELEASE_BUILD=0 Turns it off
+ * or in your pngusr.h with
+ * #define PNG_RELEASE_BUILD=1 Turns on the release compile path
+ * #define PNG_RELEASE_BUILD=0 Turns it off
+ */
+#ifndef PNG_RELEASE_BUILD
+# define PNG_RELEASE_BUILD (PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC)
+#endif
+
/* SECURITY and SAFETY:
*
- * By default libpng is built without any internal limits on image size,
- * individual heap (png_malloc) allocations or the total amount of memory used.
- * If PNG_SAFE_LIMITS_SUPPORTED is defined, however, the limits below are used
- * (unless individually overridden). These limits are believed to be fairly
- * safe, but builders of secure systems should verify the values against the
- * real system capabilities.
- */
-#ifdef PNG_SAFE_LIMITS_SUPPORTED
- /* 'safe' limits */
-# ifndef PNG_USER_WIDTH_MAX
-# define PNG_USER_WIDTH_MAX 1000000
-# endif
-# ifndef PNG_USER_HEIGHT_MAX
-# define PNG_USER_HEIGHT_MAX 1000000
-# endif
-# ifndef PNG_USER_CHUNK_CACHE_MAX
-# define PNG_USER_CHUNK_CACHE_MAX 128
-# endif
-# ifndef PNG_USER_CHUNK_MALLOC_MAX
-# define PNG_USER_CHUNK_MALLOC_MAX 8000000
-# endif
-#else
- /* values for no limits */
-# ifndef PNG_USER_WIDTH_MAX
-# define PNG_USER_WIDTH_MAX 0x7fffffff
-# endif
-# ifndef PNG_USER_HEIGHT_MAX
-# define PNG_USER_HEIGHT_MAX 0x7fffffff
-# endif
-# ifndef PNG_USER_CHUNK_CACHE_MAX
-# define PNG_USER_CHUNK_CACHE_MAX 0
-# endif
-# ifndef PNG_USER_CHUNK_MALLOC_MAX
-# define PNG_USER_CHUNK_MALLOC_MAX 0
-# endif
-#endif
-
-/* Moved to pngpriv.h at libpng-1.5.0 */
-/* NOTE: some of these may have been used in external applications as
- * these definitions were exposed in pngconf.h prior to 1.5.
+ * libpng is built with support for internal limits on image dimensions and
+ * memory usage. These are documented in scripts/pnglibconf.dfa of the
+ * source and recorded in the machine generated header file pnglibconf.h.
*/
/* If you are running on a machine where you cannot allocate more
@@ -610,21 +592,17 @@
#define PNG_RGB_TO_GRAY_WARN 0x400000
#define PNG_RGB_TO_GRAY 0x600000 /* two bits, RGB_TO_GRAY_ERR|WARN */
#define PNG_ENCODE_ALPHA 0x800000 /* Added to libpng-1.5.4 */
-#define PNG_ADD_ALPHA 0x1000000 /* Added to libpng-1.2.7 */
-#define PNG_EXPAND_tRNS 0x2000000 /* Added to libpng-1.2.9 */
-#define PNG_SCALE_16_TO_8 0x4000000 /* Added to libpng-1.5.4 */
- /* 0x8000000 unused */
- /* 0x10000000 unused */
- /* 0x20000000 unused */
- /* 0x40000000 unused */
+#define PNG_ADD_ALPHA 0x1000000 /* Added to libpng-1.2.7 */
+#define PNG_EXPAND_tRNS 0x2000000 /* Added to libpng-1.2.9 */
+#define PNG_SCALE_16_TO_8 0x4000000 /* Added to libpng-1.5.4 */
+ /* 0x8000000 unused */
+ /* 0x10000000 unused */
+ /* 0x20000000 unused */
+ /* 0x40000000 unused */
/* Flags for png_create_struct */
#define PNG_STRUCT_PNG 0x0001
#define PNG_STRUCT_INFO 0x0002
-/* Scaling factor for filter heuristic weighting calculations */
-#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT))
-#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))
-
/* Flags for the png_ptr->flags rather than declaring a byte for each one */
#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001
#define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002 /* Added to libpng-1.6.0 */
@@ -715,7 +693,7 @@
/* The fixed point conversion performs range checking and evaluates
* its argument multiple times, so must be used with care. The
* range checking uses the PNG specification values for a signed
- * 32 bit fixed point value except that the values are deliberately
+ * 32-bit fixed point value except that the values are deliberately
* rounded-to-zero to an integral value - 21474 (21474.83 is roughly
* (2^31-1) * 100000). 's' is a string that describes the value being
* converted.
@@ -808,15 +786,17 @@
* macro will fail on top-bit-set values because of the sign extension.
*/
#define PNG_CHUNK_FROM_STRING(s)\
- PNG_U32(0xff&(s)[0], 0xff&(s)[1], 0xff&(s)[2], 0xff&(s)[3])
+ PNG_U32(0xff & (s)[0], 0xff & (s)[1], 0xff & (s)[2], 0xff & (s)[3])
/* This uses (char), not (png_byte) to avoid warnings on systems where (char) is
* signed and the argument is a (char[]) This macro will fail miserably on
* systems where (char) is more than 8 bits.
*/
#define PNG_STRING_FROM_CHUNK(s,c)\
- (void)(((char*)(s))[0]=(char)((c)>>24), ((char*)(s))[1]=(char)((c)>>16),\
- ((char*)(s))[2]=(char)((c)>>8), ((char*)(s))[3]=(char)((c)))
+ (void)(((char*)(s))[0]=(char)(((c)>>24) & 0xff), \
+ ((char*)(s))[1]=(char)(((c)>>16) & 0xff),\
+ ((char*)(s))[2]=(char)(((c)>>8) & 0xff), \
+ ((char*)(s))[3]=(char)((c & 0xff)))
/* Do the same but terminate with a null character. */
#define PNG_CSTRING_FROM_CHUNK(s,c)\
@@ -860,7 +840,7 @@
*/
#endif
-/* This is used for 16 bit gamma tables -- only the top level pointers are
+/* This is used for 16-bit gamma tables -- only the top level pointers are
* const; this could be changed:
*/
typedef const png_uint_16p * png_const_uint_16pp;
@@ -878,8 +858,9 @@
PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_base, [512]);
PNG_INTERNAL_DATA(const png_byte, png_sRGB_delta, [512]);
-#define PNG_sRGB_FROM_LINEAR(linear) ((png_byte)((png_sRGB_base[(linear)>>15] +\
- ((((linear)&0x7fff)*png_sRGB_delta[(linear)>>15])>>12)) >> 8))
+#define PNG_sRGB_FROM_LINEAR(linear) \
+ ((png_byte)(0xff & ((png_sRGB_base[(linear)>>15] \
+ + ((((linear) & 0x7fff)*png_sRGB_delta[(linear)>>15])>>12)) >> 8)))
/* Given a value 'linear' in the range 0..255*65535 calculate the 8-bit sRGB
* encoded value with maximum error 0.646365. Note that the input is not a
* 16-bit value; it has been multiplied by 255! */
@@ -1262,6 +1243,14 @@
/* Initialize the row buffers, etc. */
PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY);
+#if PNG_ZLIB_VERNUM >= 0x1240
+PNG_INTERNAL_FUNCTION(int,png_zlib_inflate,(png_structrp png_ptr, int flush),
+ PNG_EMPTY);
+# define PNG_INFLATE(pp, flush) png_zlib_inflate(pp, flush)
+#else /* Zlib < 1.2.4 */
+# define PNG_INFLATE(pp, flush) inflate(&(pp)->zstream, flush)
+#endif /* Zlib < 1.2.4 */
+
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
/* Optional call to update the users info structure */
PNG_INTERNAL_FUNCTION(void,png_read_transform_info,(png_structrp png_ptr,
@@ -1436,10 +1425,6 @@
PNG_INTERNAL_FUNCTION(void,png_push_read_sig,(png_structrp png_ptr,
png_inforp info_ptr),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_push_check_crc,(png_structrp png_ptr),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_push_crc_skip,(png_structrp png_ptr,
- png_uint_32 length),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_push_crc_finish,(png_structrp png_ptr),
- PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_push_save_buffer,(png_structrp png_ptr),
PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_push_restore_buffer,(png_structrp png_ptr,
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c Thu Jan 21 10:17:21 2016 -0800
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.17 [March 26, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -91,7 +91,7 @@
/* In stable builds only warn if an application error can be completely
* handled.
*/
-# if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
+# if PNG_RELEASE_BUILD
png_ptr->flags |= PNG_FLAG_APP_WARNINGS_WARN;
# endif
# endif
@@ -842,8 +842,7 @@
/* Zero length IDATs are legal after the last IDAT has been
* read, but not after other chunks have been read.
*/
- if ((length > 0) ||
- (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
+ if ((length > 0) || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
png_benign_error(png_ptr, "Too many IDATs found");
png_crc_finish(png_ptr, length);
@@ -1072,9 +1071,9 @@
/* Tell libpng to strip 16-bit/color files down to 8 bits per color.
*/
if ((transforms & PNG_TRANSFORM_SCALE_16) != 0)
- /* Added at libpng-1.5.4. "strip_16" produces the same result that it
- * did in earlier versions, while "scale_16" is now more accurate.
- */
+ /* Added at libpng-1.5.4. "strip_16" produces the same result that it
+ * did in earlier versions, while "scale_16" is now more accurate.
+ */
#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
png_set_scale_16(png_ptr);
#else
@@ -1238,7 +1237,7 @@
for (iptr = 0; iptr < info_ptr->height; iptr++)
info_ptr->row_pointers[iptr] = png_voidcast(png_bytep,
- png_malloc(png_ptr, info_ptr->rowbytes));
+ png_malloc(png_ptr, info_ptr->rowbytes));
}
png_read_image(png_ptr, info_ptr->row_pointers);
@@ -1712,10 +1711,11 @@
value *= 257;
break;
+#ifdef __GNUC__
default:
png_error(display->image->opaque->png_ptr,
"unexpected encoding (internal error)");
- break;
+#endif
}
return value;
@@ -1852,6 +1852,7 @@
y = (y + 128) >> 8;
y *= 255;
y = PNG_sRGB_FROM_LINEAR((y + 64) >> 7);
+ alpha = PNG_DIV257(alpha);
encoding = P_sRGB;
}
@@ -2314,8 +2315,14 @@
output_processing = PNG_CMAP_NONE;
break;
}
-
+#ifdef __COVERITY__
+ /* Coverity claims that output_encoding cannot be 2 (P_LINEAR)
+ * here.
+ */
+ back_alpha = 255;
+#else
back_alpha = output_encoding == P_LINEAR ? 65535 : 255;
+#endif
}
/* output_processing means that the libpng-processed row will be
@@ -2440,7 +2447,14 @@
*/
background_index = i;
png_create_colormap_entry(display, i++, back_r, back_g, back_b,
- output_encoding == P_LINEAR ? 65535U : 255U, output_encoding);
+#ifdef __COVERITY__
+ /* Coverity claims that output_encoding cannot be 2 (P_LINEAR)
+ * here.
+ */ 255U,
+#else
+ output_encoding == P_LINEAR ? 65535U : 255U,
+#endif
+ output_encoding);
/* For non-opaque input composite on the sRGB background - this
* requires inverting the encoding for each component. The input
@@ -2852,7 +2866,6 @@
default:
png_error(png_ptr, "invalid PNG color type");
/*NOT REACHED*/
- break;
}
/* Now deal with the output processing */
@@ -2862,10 +2875,6 @@
switch (data_encoding)
{
- default:
- png_error(png_ptr, "bad data option (internal error)");
- break;
-
case P_sRGB:
/* Change to 8-bit sRGB */
png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, PNG_GAMMA_sRGB);
@@ -2875,6 +2884,11 @@
if (png_ptr->bit_depth > 8)
png_set_scale_16(png_ptr);
break;
+
+#ifdef __GNUC__
+ default:
+ png_error(png_ptr, "bad data option (internal error)");
+#endif
}
if (cmap_entries > 256 || cmap_entries > image->colormap_entries)
@@ -3274,7 +3288,7 @@
png_uint_32 width = image->width;
ptrdiff_t step_row = display->row_bytes;
unsigned int channels =
- (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
+ (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
int pass;
for (pass = 0; pass < passes; ++pass)
@@ -3425,10 +3439,6 @@
*/
switch (info_ptr->bit_depth)
{
- default:
- png_error(png_ptr, "unexpected bit depth");
- break;
-
case 8:
/* 8-bit sRGB gray values with an alpha channel; the alpha channel is
* to be removed by composing on a background: either the row if
@@ -3646,6 +3656,11 @@
}
}
break;
+
+#ifdef __GNUC__
+ default:
+ png_error(png_ptr, "unexpected bit depth");
+#endif
}
return 1;
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrio.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrio.c Thu Jan 21 10:17:21 2016 -0800
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.17 [March 26, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -54,7 +54,7 @@
* reads from a file pointer. Note that this routine sometimes gets called
* with very small lengths, so you should implement some kind of simple
* buffering if you are using unbuffered reads. This should never be asked
- * to read more then 64K on a 16 bit machine.
+ * to read more than 64K on a 16-bit machine.
*/
void /* PRIVATE */
png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length)
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c Thu Jan 21 10:17:21 2016 -0800
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.19 [November 12, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -422,7 +422,7 @@
/* Dither file to 8-bit. Supply a palette, the current number
* of elements in the palette, the maximum number of elements
* allowed, and a histogram if possible. If the current number
- * of colors is greater then the maximum number, the palette will be
+ * of colors is greater than the maximum number, the palette will be
* modified to fit in the maximum number. "full_quantize" indicates
* whether we need a quantizing cube set up for RGB images, or if we
* simply are reducing the number of colors in a paletted image.
@@ -1004,7 +1004,6 @@
default:
png_error(png_ptr, "invalid error action to rgb_to_gray");
- break;
}
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
@@ -2025,7 +2024,7 @@
# endif
# else
- /* No 16 bit support: force chopping 16-bit input down to 8, in this case
+ /* No 16-bit support: force chopping 16-bit input down to 8, in this case
* the app program can chose if both APIs are available by setting the
* correct scaling to use.
*/
@@ -2126,10 +2125,10 @@
defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
{
- if (info_ptr->bit_depth < png_ptr->user_transform_depth)
+ if (png_ptr->user_transform_depth != 0)
info_ptr->bit_depth = png_ptr->user_transform_depth;
- if (info_ptr->channels < png_ptr->user_transform_channels)
+ if (png_ptr->user_transform_channels != 0)
info_ptr->channels = png_ptr->user_transform_channels;
}
#endif
@@ -2385,7 +2384,7 @@
if (++channel >= channels)
channel = 0;
*bp++ = (png_byte)(value >> 8);
- *bp++ = (png_byte)(value & 0xff);
+ *bp++ = (png_byte)value;
}
break;
}
@@ -2410,8 +2409,8 @@
while (sp < ep)
{
- /* The input is an array of 16 bit components, these must be scaled to
- * 8 bits each. For a 16 bit value V the required value (from the PNG
+ /* The input is an array of 16-bit components, these must be scaled to
+ * 8 bits each. For a 16-bit value V the required value (from the PNG
* specification) is:
*
* (V * 255) / 65535
@@ -2432,7 +2431,7 @@
*
* The approximate differs from the exact answer only when (vlo-vhi) is
* 128; it then gives a correction of +1 when the exact correction is
- * 0. This gives 128 errors. The exact answer (correct for all 16 bit
+ * 0. This gives 128 errors. The exact answer (correct for all 16-bit
* input values) is:
*
* error = (vlo-vhi+128)*65535 >> 24;
@@ -2690,9 +2689,9 @@
png_uint_32 row_width = row_info->width;
#ifdef PNG_READ_16BIT_SUPPORTED
- png_byte hi_filler = (png_byte)((filler>>8) & 0xff);
+ png_byte hi_filler = (png_byte)(filler>>8);
#endif
- png_byte lo_filler = (png_byte)(filler & 0xff);
+ png_byte lo_filler = (png_byte)filler;
png_debug(1, "in png_do_read_filler");
@@ -2743,13 +2742,13 @@
png_bytep dp = sp + (png_size_t)row_width * 2;
for (i = 1; i < row_width; i++)
{
+ *(--dp) = lo_filler;
*(--dp) = hi_filler;
- *(--dp) = lo_filler;
*(--dp) = *(--sp);
*(--dp) = *(--sp);
}
+ *(--dp) = lo_filler;
*(--dp) = hi_filler;
- *(--dp) = lo_filler;
row_info->channels = 2;
row_info->pixel_depth = 32;
row_info->rowbytes = row_width * 4;
@@ -2764,8 +2763,8 @@
{
*(--dp) = *(--sp);
*(--dp) = *(--sp);
+ *(--dp) = lo_filler;
*(--dp) = hi_filler;
- *(--dp) = lo_filler;
}
row_info->channels = 2;
row_info->pixel_depth = 32;
@@ -2824,8 +2823,8 @@
png_bytep dp = sp + (png_size_t)row_width * 2;
for (i = 1; i < row_width; i++)
{
+ *(--dp) = lo_filler;
*(--dp) = hi_filler;
- *(--dp) = lo_filler;
*(--dp) = *(--sp);
*(--dp) = *(--sp);
*(--dp) = *(--sp);
@@ -2833,8 +2832,8 @@
*(--dp) = *(--sp);
*(--dp) = *(--sp);
}
+ *(--dp) = lo_filler;
*(--dp) = hi_filler;
- *(--dp) = lo_filler;
row_info->channels = 4;
row_info->pixel_depth = 64;
row_info->rowbytes = row_width * 8;
@@ -2853,8 +2852,8 @@
*(--dp) = *(--sp);
*(--dp) = *(--sp);
*(--dp) = *(--sp);
+ *(--dp) = lo_filler;
*(--dp) = hi_filler;
- *(--dp) = lo_filler;
}
row_info->channels = 4;
@@ -3115,10 +3114,11 @@
for (i = 0; i < row_width; i++)
{
png_uint_16 red, green, blue, w;
-
- red = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
- green = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
- blue = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
+ png_byte hi,lo;
+
+ hi=*(sp)++; lo=*(sp)++; red = (png_uint_16)((hi << 8) | (lo));
+ hi=*(sp)++; lo=*(sp)++; green = (png_uint_16)((hi << 8) | (lo));
+ hi=*(sp)++; lo=*(sp)++; blue = (png_uint_16)((hi << 8) | (lo));
if (red == green && red == blue)
{
@@ -3132,16 +3132,16 @@
else
{
- png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff)
+ png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red & 0xff)
>> png_ptr->gamma_shift][red>>8];
png_uint_16 green_1 =
- png_ptr->gamma_16_to_1[(green&0xff) >>
+ png_ptr->gamma_16_to_1[(green & 0xff) >>
png_ptr->gamma_shift][green>>8];
- png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff)
+ png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue & 0xff)
>> png_ptr->gamma_shift][blue>>8];
png_uint_16 gray16 = (png_uint_16)((rc*red_1 + gc*green_1
+ bc*blue_1 + 16384)>>15);
- w = png_ptr->gamma_16_from_1[(gray16&0xff) >>
+ w = png_ptr->gamma_16_from_1[(gray16 & 0xff) >>
png_ptr->gamma_shift][gray16 >> 8];
rgb_error |= 1;
}
@@ -3166,17 +3166,18 @@
for (i = 0; i < row_width; i++)
{
png_uint_16 red, green, blue, gray16;
-
- red = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
- green = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
- blue = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
+ png_byte hi,lo;
+
+ hi=*(sp)++; lo=*(sp)++; red = (png_uint_16)((hi << 8) | (lo));
+ hi=*(sp)++; lo=*(sp)++; green = (png_uint_16)((hi << 8) | (lo));
+ hi=*(sp)++; lo=*(sp)++; blue = (png_uint_16)((hi << 8) | (lo));
if (red != green || red != blue)
rgb_error |= 1;
- /* From 1.5.5 in the 16 bit case do the accurate conversion even
+ /* From 1.5.5 in the 16-bit case do the accurate conversion even
* in the 'fast' case - this is because this is where the code
- * ends up when handling linear 16 bit data.
+ * ends up when handling linear 16-bit data.
*/
gray16 = (png_uint_16)((rc*red + gc*green + bc*blue + 16384) >>
15);
@@ -3341,7 +3342,7 @@
if ((png_uint_16)((*sp >> shift) & 0x0f)
== png_ptr->trans_color.gray)
{
- unsigned int tmp = *sp & (0xf0f >> (4 - shift));
+ unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
tmp |= png_ptr->background.gray << shift;
*sp = (png_byte)(tmp & 0xff);
}
@@ -3351,7 +3352,7 @@
unsigned int p = (*sp >> shift) & 0x0f;
unsigned int g = (gamma_table[p | (p << 4)] >> 4) &
0x0f;
- unsigned int tmp = *sp & (0xf0f >> (4 - shift));
+ unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
tmp |= g << shift;
*sp = (png_byte)(tmp & 0xff);
}
@@ -3377,7 +3378,7 @@
if ((png_uint_16)((*sp >> shift) & 0x0f)
== png_ptr->trans_color.gray)
{
- unsigned int tmp = *sp & (0xf0f >> (4 - shift));
+ unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
tmp |= png_ptr->background.gray << shift;
*sp = (png_byte)(tmp & 0xff);
}
@@ -3695,7 +3696,8 @@
if (optimize != 0)
w = v;
else
- w = gamma_16_from_1[(v&0xff) >> gamma_shift][v >> 8];
+ w = gamma_16_from_1[(v & 0xff) >>
+ gamma_shift][v >> 8];
*sp = (png_byte)((w >> 8) & 0xff);
*(sp + 1) = (png_byte)(w & 0xff);
}
@@ -3859,7 +3861,7 @@
v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
png_composite_16(w, v, a, png_ptr->background_1.red);
if (optimize == 0)
- w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
+ w = gamma_16_from_1[((w & 0xff) >> gamma_shift)][w >>
8];
*sp = (png_byte)((w >> 8) & 0xff);
*(sp + 1) = (png_byte)(w & 0xff);
@@ -3867,7 +3869,7 @@
v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)];
png_composite_16(w, v, a, png_ptr->background_1.green);
if (optimize == 0)
- w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
+ w = gamma_16_from_1[((w & 0xff) >> gamma_shift)][w >>
8];
*(sp + 2) = (png_byte)((w >> 8) & 0xff);
@@ -3876,7 +3878,7 @@
v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)];
png_composite_16(w, v, a, png_ptr->background_1.blue);
if (optimize == 0)
- w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
+ w = gamma_16_from_1[((w & 0xff) >> gamma_shift)][w >>
8];
*(sp + 4) = (png_byte)((w >> 8) & 0xff);
@@ -4485,7 +4487,7 @@
for (i = 0; i < row_width; i++)
{
- if (*sp == gray)
+ if ((*sp & 0xffU) == gray)
*dp-- = 0;
else
@@ -4503,7 +4505,8 @@
dp = row + (row_info->rowbytes << 1) - 1;
for (i = 0; i < row_width; i++)
{
- if (*(sp - 1) == gray_high && *(sp) == gray_low)
+ if ((*(sp - 1) & 0xffU) == gray_high &&
+ (*(sp) & 0xffU) == gray_low)
{
*dp-- = 0;
*dp-- = 0;
@@ -4865,7 +4868,7 @@
/* Because PNG_COMPOSE does the gamma transform if there is something to
* do (if there is an alpha channel or transparency.)
*/
- !((png_ptr->transformations & PNG_COMPOSE) &&
+ !((png_ptr->transformations & PNG_COMPOSE) != 0 &&
((png_ptr->num_trans != 0) ||
(png_ptr->color_type & PNG_COLOR_MASK_ALPHA) != 0)) &&
#endif
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c Thu Jan 21 10:17:21 2016 -0800
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.20 [December 3, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -117,7 +117,13 @@
return uval;
uval = (uval ^ 0xffffffff) + 1; /* 2's complement: -x = ~x+1 */
- return -(png_int_32)uval;
+ if ((uval & 0x80000000) == 0) /* no overflow */
+ return -(png_int_32)uval;
+ /* The following has to be safe; this function only gets called on PNG data
+ * and if we get here that data is invalid. 0 is the most safe value and
+ * if not then an attacker would surely just generate a PNG with 0 instead.
+ */
+ return 0;
}
/* Grab an unsigned 16-bit integer from a buffer in big-endian format. */
@@ -126,7 +132,7 @@
{
/* ANSI-C requires an int value to accomodate at least 16 bits so this
* works and allows the compiler not to worry about possible narrowing
- * on 32 bit systems. (Pre-ANSI systems did not make integers smaller
+ * on 32-bit systems. (Pre-ANSI systems did not make integers smaller
* than 16 bits either.)
*/
unsigned int val =
@@ -369,7 +375,7 @@
* are minimal.
*/
(void)png_safecat(msg, (sizeof msg), 4, " using zstream");
-#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
+#if PNG_RELEASE_BUILD
png_chunk_warning(png_ptr, msg);
png_ptr->zowner = 0;
#else
@@ -399,10 +405,16 @@
if (((png_ptr->options >> PNG_MAXIMUM_INFLATE_WINDOW) & 3) ==
PNG_OPTION_ON)
+ {
window_bits = 15;
+ png_ptr->zstream_start = 0; /* fixed window size */
+ }
else
+ {
window_bits = 0;
+ png_ptr->zstream_start = 1;
+ }
# else
# define window_bits 0
# endif
@@ -451,6 +463,31 @@
#endif
}
+#if PNG_ZLIB_VERNUM >= 0x1240
+/* Handle the start of the inflate stream if we called inflateInit2(strm,0);
+ * in this case some zlib versions skip validation of the CINFO field and, in
+ * certain circumstances, libpng may end up displaying an invalid image, in
+ * contrast to implementations that call zlib in the normal way (e.g. libpng
+ * 1.5).
+ */
+int /* PRIVATE */
+png_zlib_inflate(png_structrp png_ptr, int flush)
+{
+ if (png_ptr->zstream_start && png_ptr->zstream.avail_in > 0)
+ {
+ if ((*png_ptr->zstream.next_in >> 4) > 7)
+ {
+ png_ptr->zstream.msg = "invalid window size (libpng)";
+ return Z_DATA_ERROR;
+ }
+
+ png_ptr->zstream_start = 0;
+ }
+
+ return inflate(&png_ptr->zstream, flush);
+}
+#endif /* Zlib >= 1.2.4 */
+
#ifdef PNG_READ_COMPRESSED_TEXT_SUPPORTED
/* png_inflate now returns zlib error codes including Z_OK and Z_STREAM_END to
* allow the caller to do multiple calls if required. If the 'finish' flag is
@@ -544,7 +581,7 @@
* the previous chunk of input data. Tell zlib if we have reached the
* end of the output buffer.
*/
- ret = inflate(&png_ptr->zstream, avail_out > 0 ? Z_NO_FLUSH :
+ ret = PNG_INFLATE(png_ptr, avail_out > 0 ? Z_NO_FLUSH :
(finish ? Z_FINISH : Z_SYNC_FLUSH));
} while (ret == Z_OK);
@@ -603,7 +640,7 @@
*/
png_alloc_size_t limit = PNG_SIZE_MAX;
-# ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
+# ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (png_ptr->user_chunk_malloc_max > 0 &&
png_ptr->user_chunk_malloc_max < limit)
limit = png_ptr->user_chunk_malloc_max;
@@ -698,7 +735,6 @@
* success)
*/
png_free(png_ptr, text);
- text = NULL;
/* This really is very benign, but it's still an error because
* the extra space may otherwise be used as a Trojan Horse.
@@ -794,7 +830,7 @@
* the available output is produced; this allows reading of truncated
* streams.
*/
- ret = inflate(&png_ptr->zstream,
+ ret = PNG_INFLATE(png_ptr,
*chunk_bytes > 0 ? Z_NO_FLUSH : (finish ? Z_FINISH : Z_SYNC_FLUSH));
}
while (ret == Z_OK && (*out_size > 0 || png_ptr->zstream.avail_out > 0));
@@ -895,7 +931,7 @@
png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{
png_color palette[PNG_MAX_PALETTE_LENGTH];
- int num, i;
+ int max_palette_length, num, i;
#ifdef PNG_POINTER_INDEXING_SUPPORTED
png_colorp pal_ptr;
#endif
@@ -956,6 +992,19 @@
/* The cast is safe because 'length' is less than 3*PNG_MAX_PALETTE_LENGTH */
num = (int)length / 3;
+ /* If the palette has 256 or fewer entries but is too large for the bit
+ * depth, we don't issue an error, to preserve the behavior of previous
+ * libpng versions. We silently truncate the unused extra palette entries
+ * here.
+ */
+ if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
+ max_palette_length = (1 << png_ptr->bit_depth);
+ else
+ max_palette_length = PNG_MAX_PALETTE_LENGTH;
+
+ if (num > max_palette_length)
+ num = max_palette_length;
+
#ifdef PNG_POINTER_INDEXING_SUPPORTED
for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++)
{
@@ -988,7 +1037,7 @@
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
#endif
{
- png_crc_finish(png_ptr, 0);
+ png_crc_finish(png_ptr, (int) length - num * 3);
}
#ifndef PNG_READ_OPT_PLTE_SUPPORTED
@@ -1175,11 +1224,13 @@
return;
for (i=0; i<truelen; ++i)
+ {
if (buf[i] == 0 || buf[i] > sample_depth)
{
png_chunk_benign_error(png_ptr, "invalid");
return;
}
+ }
if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
{
@@ -1490,10 +1541,10 @@
finished = 1;
# ifdef PNG_sRGB_SUPPORTED
- /* Check for a match against sRGB */
- png_icc_set_sRGB(png_ptr,
- &png_ptr->colorspace, profile,
- png_ptr->zstream.adler);
+ /* Check for a match against sRGB */
+ png_icc_set_sRGB(png_ptr,
+ &png_ptr->colorspace, profile,
+ png_ptr->zstream.adler);
# endif
/* Steal the profile for info_ptr. */
@@ -1543,8 +1594,10 @@
else if (size > 0)
errmsg = "truncated";
+#ifndef __COVERITY__
else
errmsg = png_ptr->zstream.msg;
+#endif
}
/* else png_icc_check_tag_table output an error */
@@ -1676,7 +1729,7 @@
++entry_start;
/* A sample depth should follow the separator, and we should be on it */
- if (entry_start > buffer + length - 2)
+ if (length < 2U || entry_start > buffer + (length - 2U))
{
png_warning(png_ptr, "malformed sPLT chunk");
return;
@@ -1701,8 +1754,8 @@
if (dl > max_dl)
{
- png_warning(png_ptr, "sPLT chunk too long");
- return;
+ png_warning(png_ptr, "sPLT chunk too long");
+ return;
}
new_palette.nentries = (png_int_32)(data_length / entry_size);
@@ -1712,8 +1765,8 @@
if (new_palette.entries == NULL)
{
- png_warning(png_ptr, "sPLT chunk requires too much memory");
- return;
+ png_warning(png_ptr, "sPLT chunk requires too much memory");
+ return;
}
#ifdef PNG_POINTER_INDEXING_SUPPORTED
@@ -1843,7 +1896,8 @@
return;
}
- if (length > png_ptr->num_palette || length > PNG_MAX_PALETTE_LENGTH ||
+ if (length > (unsigned int) png_ptr->num_palette ||
+ length > (unsigned int) PNG_MAX_PALETTE_LENGTH ||
length == 0)
{
png_crc_finish(png_ptr, length);
@@ -2006,7 +2060,8 @@
num = length / 2 ;
- if (num != png_ptr->num_palette || num > PNG_MAX_PALETTE_LENGTH)
+ if (num != (unsigned int) png_ptr->num_palette ||
+ num > (unsigned int) PNG_MAX_PALETTE_LENGTH)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "invalid");
@@ -2178,7 +2233,7 @@
/* We need to have at least 12 bytes after the purpose string
* in order to get the parameter information.
*/
- if (endptr <= buf + 12)
+ if (endptr - buf <= 12)
{
png_chunk_benign_error(png_ptr, "invalid");
return;
@@ -2741,14 +2796,14 @@
png_ptr->unknown_chunk.data = NULL;
}
-# ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
- if (png_ptr->user_chunk_malloc_max > 0 &&
- png_ptr->user_chunk_malloc_max < limit)
- limit = png_ptr->user_chunk_malloc_max;
+# ifdef PNG_SET_USER_LIMITS_SUPPORTED
+ if (png_ptr->user_chunk_malloc_max > 0 &&
+ png_ptr->user_chunk_malloc_max < limit)
+ limit = png_ptr->user_chunk_malloc_max;
# elif PNG_USER_CHUNK_MALLOC_MAX > 0
- if (PNG_USER_CHUNK_MALLOC_MAX < limit)
- limit = PNG_USER_CHUNK_MALLOC_MAX;
+ if (PNG_USER_CHUNK_MALLOC_MAX < limit)
+ limit = PNG_USER_CHUNK_MALLOC_MAX;
# endif
if (length <= limit)
@@ -2811,7 +2866,7 @@
*/
# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
# ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
- keep = png_chunk_unknown_handling(png_ptr, png_ptr->chunk_name);
+ keep = png_chunk_unknown_handling(png_ptr, png_ptr->chunk_name);
# endif
# endif
@@ -2820,153 +2875,153 @@
* PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
*/
# ifdef PNG_READ_USER_CHUNKS_SUPPORTED
- /* The user callback takes precedence over the chunk keep value, but the
- * keep value is still required to validate a save of a critical chunk.
- */
- if (png_ptr->read_user_chunk_fn != NULL)
+ /* The user callback takes precedence over the chunk keep value, but the
+ * keep value is still required to validate a save of a critical chunk.
+ */
+ if (png_ptr->read_user_chunk_fn != NULL)
+ {
+ if (png_cache_unknown_chunk(png_ptr, length) != 0)
{
- if (png_cache_unknown_chunk(png_ptr, length) != 0)
+ /* Callback to user unknown chunk handler */
+ int ret = (*(png_ptr->read_user_chunk_fn))(png_ptr,
+ &png_ptr->unknown_chunk);
+
+ /* ret is:
+ * negative: An error occurred; png_chunk_error will be called.
+ * zero: The chunk was not handled, the chunk will be discarded
+ * unless png_set_keep_unknown_chunks has been used to set
+ * a 'keep' behavior for this particular chunk, in which
+ * case that will be used. A critical chunk will cause an
+ * error at this point unless it is to be saved.
+ * positive: The chunk was handled, libpng will ignore/discard it.
+ */
+ if (ret < 0)
+ png_chunk_error(png_ptr, "error in user chunk");
+
+ else if (ret == 0)
{
- /* Callback to user unknown chunk handler */
- int ret = (*(png_ptr->read_user_chunk_fn))(png_ptr,
- &png_ptr->unknown_chunk);
-
- /* ret is:
- * negative: An error occured, png_chunk_error will be called.
- * zero: The chunk was not handled, the chunk will be discarded
- * unless png_set_keep_unknown_chunks has been used to set
- * a 'keep' behavior for this particular chunk, in which
- * case that will be used. A critical chunk will cause an
- * error at this point unless it is to be saved.
- * positive: The chunk was handled, libpng will ignore/discard it.
+ /* If the keep value is 'default' or 'never' override it, but
+ * still error out on critical chunks unless the keep value is
+ * 'always' While this is weird it is the behavior in 1.4.12.
+ * A possible improvement would be to obey the value set for the
+ * chunk, but this would be an API change that would probably
+ * damage some applications.
+ *
+ * The png_app_warning below catches the case that matters, where
+ * the application has not set specific save or ignore for this
+ * chunk or global save or ignore.
*/
- if (ret < 0)
- png_chunk_error(png_ptr, "error in user chunk");
-
- else if (ret == 0)
+ if (keep < PNG_HANDLE_CHUNK_IF_SAFE)
{
- /* If the keep value is 'default' or 'never' override it, but
- * still error out on critical chunks unless the keep value is
- * 'always' While this is weird it is the behavior in 1.4.12.
- * A possible improvement would be to obey the value set for the
- * chunk, but this would be an API change that would probably
- * damage some applications.
- *
- * The png_app_warning below catches the case that matters, where
- * the application has not set specific save or ignore for this
- * chunk or global save or ignore.
- */
- if (keep < PNG_HANDLE_CHUNK_IF_SAFE)
+# ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
+ if (png_ptr->unknown_default < PNG_HANDLE_CHUNK_IF_SAFE)
{
-# ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
- if (png_ptr->unknown_default < PNG_HANDLE_CHUNK_IF_SAFE)
- {
- png_chunk_warning(png_ptr, "Saving unknown chunk:");
- png_app_warning(png_ptr,
- "forcing save of an unhandled chunk;"
- " please call png_set_keep_unknown_chunks");
- /* with keep = PNG_HANDLE_CHUNK_IF_SAFE */
- }
-# endif
- keep = PNG_HANDLE_CHUNK_IF_SAFE;
+ png_chunk_warning(png_ptr, "Saving unknown chunk:");
+ png_app_warning(png_ptr,
+ "forcing save of an unhandled chunk;"
+ " please call png_set_keep_unknown_chunks");
+ /* with keep = PNG_HANDLE_CHUNK_IF_SAFE */
}
- }
-
- else /* chunk was handled */
- {
- handled = 1;
- /* Critical chunks can be safely discarded at this point. */
- keep = PNG_HANDLE_CHUNK_NEVER;
+# endif
+ keep = PNG_HANDLE_CHUNK_IF_SAFE;
}
}
- else
- keep = PNG_HANDLE_CHUNK_NEVER; /* insufficient memory */
+ else /* chunk was handled */
+ {
+ handled = 1;
+ /* Critical chunks can be safely discarded at this point. */
+ keep = PNG_HANDLE_CHUNK_NEVER;
+ }
}
else
- /* Use the SAVE_UNKNOWN_CHUNKS code or skip the chunk */
+ keep = PNG_HANDLE_CHUNK_NEVER; /* insufficient memory */
+ }
+
+ else
+ /* Use the SAVE_UNKNOWN_CHUNKS code or skip the chunk */
# endif /* READ_USER_CHUNKS */
# ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
+ {
+ /* keep is currently just the per-chunk setting, if there was no
+ * setting change it to the global default now (not that this may
+ * still be AS_DEFAULT) then obtain the cache of the chunk if required,
+ * if not simply skip the chunk.
+ */
+ if (keep == PNG_HANDLE_CHUNK_AS_DEFAULT)
+ keep = png_ptr->unknown_default;
+
+ if (keep == PNG_HANDLE_CHUNK_ALWAYS ||
+ (keep == PNG_HANDLE_CHUNK_IF_SAFE &&
+ PNG_CHUNK_ANCILLARY(png_ptr->chunk_name)))
{
- /* keep is currently just the per-chunk setting, if there was no
- * setting change it to the global default now (not that this may
- * still be AS_DEFAULT) then obtain the cache of the chunk if required,
- * if not simply skip the chunk.
- */
- if (keep == PNG_HANDLE_CHUNK_AS_DEFAULT)
- keep = png_ptr->unknown_default;
-
- if (keep == PNG_HANDLE_CHUNK_ALWAYS ||
- (keep == PNG_HANDLE_CHUNK_IF_SAFE &&
- PNG_CHUNK_ANCILLARY(png_ptr->chunk_name)))
- {
- if (png_cache_unknown_chunk(png_ptr, length) == 0)
- keep = PNG_HANDLE_CHUNK_NEVER;
- }
-
- else
- png_crc_finish(png_ptr, length);
+ if (png_cache_unknown_chunk(png_ptr, length) == 0)
+ keep = PNG_HANDLE_CHUNK_NEVER;
}
+
+ else
+ png_crc_finish(png_ptr, length);
+ }
# else
# ifndef PNG_READ_USER_CHUNKS_SUPPORTED
# error no method to support READ_UNKNOWN_CHUNKS
# endif
- {
- /* If here there is no read callback pointer set and no support is
- * compiled in to just save the unknown chunks, so simply skip this
- * chunk. If 'keep' is something other than AS_DEFAULT or NEVER then
- * the app has erroneously asked for unknown chunk saving when there
- * is no support.
- */
- if (keep > PNG_HANDLE_CHUNK_NEVER)
- png_app_error(png_ptr, "no unknown chunk support available");
-
- png_crc_finish(png_ptr, length);
- }
+ {
+ /* If here there is no read callback pointer set and no support is
+ * compiled in to just save the unknown chunks, so simply skip this
+ * chunk. If 'keep' is something other than AS_DEFAULT or NEVER then
+ * the app has erroneously asked for unknown chunk saving when there
+ * is no support.
+ */
+ if (keep > PNG_HANDLE_CHUNK_NEVER)
+ png_app_error(png_ptr, "no unknown chunk support available");
+
+ png_crc_finish(png_ptr, length);
+ }
# endif
# ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
- /* Now store the chunk in the chunk list if appropriate, and if the limits
- * permit it.
- */
- if (keep == PNG_HANDLE_CHUNK_ALWAYS ||
- (keep == PNG_HANDLE_CHUNK_IF_SAFE &&
- PNG_CHUNK_ANCILLARY(png_ptr->chunk_name)))
- {
+ /* Now store the chunk in the chunk list if appropriate, and if the limits
+ * permit it.
+ */
+ if (keep == PNG_HANDLE_CHUNK_ALWAYS ||
+ (keep == PNG_HANDLE_CHUNK_IF_SAFE &&
+ PNG_CHUNK_ANCILLARY(png_ptr->chunk_name)))
+ {
# ifdef PNG_USER_LIMITS_SUPPORTED
- switch (png_ptr->user_chunk_cache_max)
- {
- case 2:
- png_ptr->user_chunk_cache_max = 1;
- png_chunk_benign_error(png_ptr, "no space in chunk cache");
- /* FALL THROUGH */
- case 1:
- /* NOTE: prior to 1.6.0 this case resulted in an unknown critical
- * chunk being skipped, now there will be a hard error below.
- */
- break;
-
- default: /* not at limit */
- --(png_ptr->user_chunk_cache_max);
- /* FALL THROUGH */
- case 0: /* no limit */
-# endif /* USER_LIMITS */
- /* Here when the limit isn't reached or when limits are compiled
- * out; store the chunk.
- */
- png_set_unknown_chunks(png_ptr, info_ptr,
- &png_ptr->unknown_chunk, 1);
- handled = 1;
-# ifdef PNG_USER_LIMITS_SUPPORTED
- break;
- }
-# endif
+ switch (png_ptr->user_chunk_cache_max)
+ {
+ case 2:
+ png_ptr->user_chunk_cache_max = 1;
+ png_chunk_benign_error(png_ptr, "no space in chunk cache");
+ /* FALL THROUGH */
+ case 1:
+ /* NOTE: prior to 1.6.0 this case resulted in an unknown critical
+ * chunk being skipped, now there will be a hard error below.
+ */
+ break;
+
+ default: /* not at limit */
+ --(png_ptr->user_chunk_cache_max);
+ /* FALL THROUGH */
+ case 0: /* no limit */
+# endif /* USER_LIMITS */
+ /* Here when the limit isn't reached or when limits are compiled
+ * out; store the chunk.
+ */
+ png_set_unknown_chunks(png_ptr, info_ptr,
+ &png_ptr->unknown_chunk, 1);
+ handled = 1;
+# ifdef PNG_USER_LIMITS_SUPPORTED
+ break;
}
+# endif
+ }
# else /* no store support: the chunk must be handled by the user callback */
- PNG_UNUSED(info_ptr)
+ PNG_UNUSED(info_ptr)
# endif
/* Regardless of the error handling below the cached data (if any) can be
@@ -3068,13 +3123,13 @@
end_ptr = dp + PNG_ROWBYTES(pixel_depth, row_width) - 1;
end_byte = *end_ptr;
# ifdef PNG_READ_PACKSWAP_SUPPORTED
- if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
- /* little-endian byte */
- end_mask = 0xff << end_mask;
-
- else /* big-endian byte */
+ if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
+ /* little-endian byte */
+ end_mask = 0xff << end_mask;
+
+ else /* big-endian byte */
# endif
- end_mask = 0xff >> end_mask;
+ end_mask = 0xff >> end_mask;
/* end_mask is now the bits to *keep* from the destination row */
}
@@ -3232,12 +3287,12 @@
png_uint_32 mask;
# ifdef PNG_READ_PACKSWAP_SUPPORTED
- if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
- mask = MASK(pass, pixel_depth, display, 0);
-
- else
+ if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
+ mask = MASK(pass, pixel_depth, display, 0);
+
+ else
# endif
- mask = MASK(pass, pixel_depth, display, 1);
+ mask = MASK(pass, pixel_depth, display, 1);
for (;;)
{
@@ -3838,15 +3893,15 @@
p = b - c;
pc = a - c;
-# ifdef PNG_USE_ABS
- pa = abs(p);
- pb = abs(pc);
- pc = abs(p + pc);
-# else
- pa = p < 0 ? -p : p;
- pb = pc < 0 ? -pc : pc;
- pc = (p + pc) < 0 ? -(p + pc) : p + pc;
-# endif
+#ifdef PNG_USE_ABS
+ pa = abs(p);
+ pb = abs(pc);
+ pc = abs(p + pc);
+#else
+ pa = p < 0 ? -p : p;
+ pb = pc < 0 ? -pc : pc;
+ pc = (p + pc) < 0 ? -(p + pc) : p + pc;
+#endif
/* Find the best predictor, the least of pa, pb, pc favoring the earlier
* ones in the case of a tie.
@@ -3893,15 +3948,15 @@
p = b - c;
pc = a - c;
-# ifdef PNG_USE_ABS
- pa = abs(p);
- pb = abs(pc);
- pc = abs(p + pc);
-# else
- pa = p < 0 ? -p : p;
- pb = pc < 0 ? -pc : pc;
- pc = (p + pc) < 0 ? -(p + pc) : p + pc;
-# endif
+#ifdef PNG_USE_ABS
+ pa = abs(p);
+ pb = abs(pc);
+ pc = abs(p + pc);
+#else
+ pa = p < 0 ? -p : p;
+ pb = pc < 0 ? -pc : pc;
+ pc = (p + pc) < 0 ? -(p + pc) : p + pc;
+#endif
if (pb < pa) pa = pb, a = b;
if (pc < pa) a = c;
@@ -4043,7 +4098,7 @@
*
* TODO: deal more elegantly with truncated IDAT lists.
*/
- ret = inflate(&png_ptr->zstream, Z_NO_FLUSH);
+ ret = PNG_INFLATE(png_ptr, Z_NO_FLUSH);
/* Take the unconsumed output back. */
if (output != NULL)
@@ -4306,18 +4361,18 @@
#ifdef PNG_READ_EXPAND_16_SUPPORTED
if ((png_ptr->transformations & PNG_EXPAND_16) != 0)
{
-# ifdef PNG_READ_EXPAND_SUPPORTED
- /* In fact it is an error if it isn't supported, but checking is
- * the safe way.
- */
- if ((png_ptr->transformations & PNG_EXPAND) != 0)
- {
- if (png_ptr->bit_depth < 16)
- max_pixel_depth *= 2;
- }
- else
-# endif
- png_ptr->transformations &= ~PNG_EXPAND_16;
+# ifdef PNG_READ_EXPAND_SUPPORTED
+ /* In fact it is an error if it isn't supported, but checking is
+ * the safe way.
+ */
+ if ((png_ptr->transformations & PNG_EXPAND) != 0)
+ {
+ if (png_ptr->bit_depth < 16)
+ max_pixel_depth *= 2;
+ }
+ else
+# endif
+ png_ptr->transformations &= ~PNG_EXPAND_16;
}
#endif
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c Thu Jan 21 10:17:21 2016 -0800
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.19 [November 12, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -151,12 +151,12 @@
png_fixed(png_ptr, red_X, "cHRM Red X"),
png_fixed(png_ptr, red_Y, "cHRM Red Y"),
png_fixed(png_ptr, red_Z, "cHRM Red Z"),
- png_fixed(png_ptr, green_X, "cHRM Red X"),
- png_fixed(png_ptr, green_Y, "cHRM Red Y"),
- png_fixed(png_ptr, green_Z, "cHRM Red Z"),
- png_fixed(png_ptr, blue_X, "cHRM Red X"),
- png_fixed(png_ptr, blue_Y, "cHRM Red Y"),
- png_fixed(png_ptr, blue_Z, "cHRM Red Z"));
+ png_fixed(png_ptr, green_X, "cHRM Green X"),
+ png_fixed(png_ptr, green_Y, "cHRM Green Y"),
+ png_fixed(png_ptr, green_Z, "cHRM Green Z"),
+ png_fixed(png_ptr, blue_X, "cHRM Blue X"),
+ png_fixed(png_ptr, blue_Y, "cHRM Blue Y"),
+ png_fixed(png_ptr, blue_Z, "cHRM Blue Z"));
}
# endif /* FLOATING_POINT */
@@ -218,6 +218,7 @@
if (info_ptr->hist == NULL)
{
png_warning(png_ptr, "Insufficient memory for hIST chunk data");
+
return;
}
@@ -299,7 +300,7 @@
png_debug1(1, "in %s storage function", "pCAL");
if (png_ptr == NULL || info_ptr == NULL || purpose == NULL || units == NULL
- || (nparams > 0 && params == NULL))
+ || (nparams > 0 && params == NULL))
return;
length = strlen(purpose) + 1;
@@ -329,6 +330,7 @@
if (info_ptr->pcal_purpose == NULL)
{
png_warning(png_ptr, "Insufficient memory for pCAL purpose");
+
return;
}
@@ -350,6 +352,7 @@
if (info_ptr->pcal_units == NULL)
{
png_warning(png_ptr, "Insufficient memory for pCAL units");
+
return;
}
@@ -361,6 +364,7 @@
if (info_ptr->pcal_params == NULL)
{
png_warning(png_ptr, "Insufficient memory for pCAL params");
+
return;
}
@@ -377,6 +381,7 @@
if (info_ptr->pcal_params[i] == NULL)
{
png_warning(png_ptr, "Insufficient memory for pCAL parameter");
+
return;
}
@@ -426,6 +431,7 @@
if (info_ptr->scal_s_width == NULL)
{
png_warning(png_ptr, "Memory allocation failed while processing sCAL");
+
return;
}
@@ -444,6 +450,7 @@
info_ptr->scal_s_width = NULL;
png_warning(png_ptr, "Memory allocation failed while processing sCAL");
+
return;
}
@@ -534,12 +541,17 @@
png_const_colorp palette, int num_palette)
{
+ png_uint_32 max_palette_length;
+
png_debug1(1, "in %s storage function", "PLTE");
if (png_ptr == NULL || info_ptr == NULL)
return;
- if (num_palette < 0 || num_palette > PNG_MAX_PALETTE_LENGTH)
+ max_palette_length = (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ?
+ (1 << info_ptr->bit_depth) : PNG_MAX_PALETTE_LENGTH;
+
+ if (num_palette < 0 || num_palette > (int) max_palette_length)
{
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
png_error(png_ptr, "Invalid palette length");
@@ -547,6 +559,7 @@
else
{
png_warning(png_ptr, "Invalid palette length");
+
return;
}
}
@@ -559,7 +572,6 @@
))
{
png_error(png_ptr, "Invalid palette");
- return;
}
/* It may not actually be necessary to set png_ptr->palette here;
@@ -572,8 +584,8 @@
png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
/* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead
- * of num_palette entries, in case of an invalid PNG file that has
- * too-large sample values.
+ * of num_palette entries, in case of an invalid PNG file or incorrect
+ * call to png_set_PLTE() with too-large sample values.
*/
png_ptr->palette = png_voidcast(png_colorp, png_calloc(png_ptr,
PNG_MAX_PALETTE_LENGTH * (sizeof (png_color))));
@@ -683,6 +695,7 @@
if (new_iccp_name == NULL)
{
png_benign_error(png_ptr, "Insufficient memory to process iCCP chunk");
+
return;
}
@@ -693,9 +706,9 @@
if (new_iccp_profile == NULL)
{
png_free(png_ptr, new_iccp_name);
- new_iccp_name = NULL;
png_benign_error(png_ptr,
"Insufficient memory to process iCCP profile");
+
return;
}
@@ -729,7 +742,7 @@
{
int i;
- png_debug1(1, "in %lx storage function", png_ptr == NULL ? "unexpected" :
+ png_debug1(1, "in %lx storage function", png_ptr == NULL ? 0xabadca11U :
(unsigned long)png_ptr->chunk_name);
if (png_ptr == NULL || info_ptr == NULL || num_text <= 0 || text_ptr == NULL)
@@ -771,6 +784,7 @@
{
png_chunk_report(png_ptr, "too many text chunks",
PNG_CHUNK_WRITE_ERROR);
+
return 1;
}
@@ -826,7 +840,7 @@
else
lang_key_len = 0;
}
-# else /* PNG_iTXt_SUPPORTED */
+# else /* iTXt */
{
png_chunk_report(png_ptr, "iTXt chunk not supported",
PNG_CHUNK_WRITE_ERROR);
@@ -859,6 +873,7 @@
{
png_chunk_report(png_ptr, "text chunk: out of memory",
PNG_CHUNK_WRITE_ERROR);
+
return 1;
}
@@ -932,6 +947,7 @@
mod_time->second > 60)
{
png_warning(png_ptr, "Ignoring invalid time value");
+
return;
}
@@ -948,6 +964,7 @@
png_debug1(1, "in %s storage function", "tRNS");
if (png_ptr == NULL || info_ptr == NULL)
+
return;
if (trans_alpha != NULL)
@@ -973,16 +990,21 @@
if (trans_color != NULL)
{
- int sample_max = (1 << info_ptr->bit_depth);
+#ifdef PNG_WARNINGS_SUPPORTED
+ if (info_ptr->bit_depth < 16)
+ {
+ int sample_max = (1 << info_ptr->bit_depth) - 1;
- if ((info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
- trans_color->gray > sample_max) ||
- (info_ptr->color_type == PNG_COLOR_TYPE_RGB &&
- (trans_color->red > sample_max ||
- trans_color->green > sample_max ||
- trans_color->blue > sample_max)))
- png_warning(png_ptr,
- "tRNS chunk has out-of-range samples for bit_depth");
+ if ((info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
+ trans_color->gray > sample_max) ||
+ (info_ptr->color_type == PNG_COLOR_TYPE_RGB &&
+ (trans_color->red > sample_max ||
+ trans_color->green > sample_max ||
+ trans_color->blue > sample_max)))
+ png_warning(png_ptr,
+ "tRNS chunk has out-of-range samples for bit_depth");
+ }
+#endif
info_ptr->trans_color = *trans_color;
@@ -1029,6 +1051,7 @@
{
/* Out of memory or too many chunks */
png_chunk_report(png_ptr, "too many sPLT chunks", PNG_CHUNK_WRITE_ERROR);
+
return;
}
@@ -1144,7 +1167,7 @@
png_unknown_chunkp np;
if (png_ptr == NULL || info_ptr == NULL || num_unknowns <= 0 ||
- unknowns == NULL)
+ unknowns == NULL)
return;
/* Check for the failure cases where support has been disabled at compile
@@ -1158,6 +1181,7 @@
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
{
png_app_error(png_ptr, "no unknown chunk support on read");
+
return;
}
# endif
@@ -1166,6 +1190,7 @@
if ((png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
{
png_app_error(png_ptr, "no unknown chunk support on write");
+
return;
}
# endif
@@ -1183,6 +1208,7 @@
{
png_chunk_report(png_ptr, "too many unknown chunks",
PNG_CHUNK_WRITE_ERROR);
+
return;
}
@@ -1260,8 +1286,7 @@
check_location(png_ptr, location);
}
}
-#endif
-
+#endif /* STORE_UNKNOWN_CHUNKS */
#ifdef PNG_MNG_FEATURES_SUPPORTED
png_uint_32 PNGAPI
@@ -1292,6 +1317,7 @@
if (memcmp(list, add, 4) == 0)
{
list[4] = (png_byte)keep;
+
return count;
}
}
@@ -1319,6 +1345,7 @@
if (keep < 0 || keep >= PNG_HANDLE_CHUNK_LAST)
{
png_app_error(png_ptr, "png_set_keep_unknown_chunks: invalid keep");
+
return;
}
@@ -1368,6 +1395,7 @@
* which can be switched off.
*/
png_app_error(png_ptr, "png_set_keep_unknown_chunks: no chunk list");
+
return;
}
@@ -1383,6 +1411,7 @@
if (num_chunks + old_num_chunks > UINT_MAX/5)
{
png_app_error(png_ptr, "png_set_keep_unknown_chunks: too many chunks");
+
return;
}
@@ -1520,23 +1549,30 @@
{
png_warning(png_ptr,
"Compression buffer size cannot be changed because it is in use");
+
return;
}
+#ifndef __COVERITY__
+ /* Some compilers complain that this is always false. However, it
+ * can be true when integer overflow happens.
+ */
if (size > ZLIB_IO_MAX)
{
png_warning(png_ptr,
"Compression buffer size limited to system maximum");
size = ZLIB_IO_MAX; /* must fit */
}
+#endif
- else if (size < 6)
+ if (size < 6)
{
/* Deflate will potentially go into an infinite loop on a SYNC_FLUSH
* if this is permitted.
*/
png_warning(png_ptr,
"Compression buffer size cannot be reduced below 6");
+
return;
}
@@ -1565,7 +1601,7 @@
{
/* Images with dimensions larger than these limits will be
* rejected by png_set_IHDR(). To accept any PNG datastream
- * regardless of dimensions, set both limits to 0x7ffffffL.
+ * regardless of dimensions, set both limits to 0x7fffffff.
*/
if (png_ptr == NULL)
return;
@@ -1578,8 +1614,8 @@
void PNGAPI
png_set_chunk_cache_max (png_structrp png_ptr, png_uint_32 user_chunk_cache_max)
{
- if (png_ptr != NULL)
- png_ptr->user_chunk_cache_max = user_chunk_cache_max;
+ if (png_ptr != NULL)
+ png_ptr->user_chunk_cache_max = user_chunk_cache_max;
}
/* This function was added to libpng 1.4.1 */
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngstruct.h Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngstruct.h Thu Jan 21 10:17:21 2016 -0800
@@ -29,12 +29,11 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.18 [July 23, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
- * Last changed in libpng 1.6.1 [March 28, 2013]
- *
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
@@ -129,7 +128,7 @@
#endif /* COLORSPACE */
#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
-/* A colorspace is all the above plus, potentially, profile information,
+/* A colorspace is all the above plus, potentially, profile information;
* however at present libpng does not use the profile internally so it is only
* stored in the png_info struct (if iCCP is supported.) The rendering intent
* is retained here and is checked.
@@ -248,16 +247,18 @@
png_uint_32 row_number; /* current row in interlace pass */
png_uint_32 chunk_name; /* PNG_CHUNK() id of current chunk */
png_bytep prev_row; /* buffer to save previous (unfiltered) row.
- * This is a pointer into big_prev_row
+ * While reading this is a pointer into
+ * big_prev_row; while writing it is separately
+ * allocated if needed.
*/
png_bytep row_buf; /* buffer to save current (unfiltered) row.
- * This is a pointer into big_row_buf
+ * While reading, this is a pointer into
+ * big_row_buf; while writing it is separately
+ * allocated.
*/
-#ifdef PNG_WRITE_SUPPORTED
- png_bytep sub_row; /* buffer to save "sub" row when filtering */
- png_bytep up_row; /* buffer to save "up" row when filtering */
- png_bytep avg_row; /* buffer to save "avg" row when filtering */
- png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
+#ifdef PNG_WRITE_FILTER_SUPPORTED
+ png_bytep try_row; /* buffer to save trial row when filtering */
+ png_bytep tst_row; /* buffer to save best trial row when filtering */
#endif
png_size_t info_rowbytes; /* Added in 1.5.4: cache of updated row bytes */
@@ -290,6 +291,9 @@
/* pixel depth used for the row buffers */
png_byte transformed_pixel_depth;
/* pixel depth after read/write transforms */
+#if PNG_ZLIB_VERNUM >= 0x1240
+ png_byte zstream_start; /* at start of an input zlib stream */
+#endif /* Zlib >= 1.2.4 */
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
png_uint_16 filler; /* filler bytes for pixel expansion */
#endif
@@ -375,17 +379,7 @@
png_bytep quantize_index; /* index translation for palette files */
#endif
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
- png_byte heuristic_method; /* heuristic for row filter selection */
- png_byte num_prev_filters; /* number of weights for previous rows */
- png_bytep prev_filters; /* filter type(s) of previous row(s) */
- png_uint_16p filter_weights; /* weight(s) for previous line(s) */
- png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */
- png_uint_16p filter_costs; /* relative filter calculation cost */
- png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
-#endif
-
- /* Options */
+/* Options */
#ifdef PNG_SET_OPTION_SUPPORTED
png_byte options; /* On/off state (up to 4 options) */
#endif
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngtest.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngtest.c Thu Jan 21 10:17:21 2016 -0800
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.5.25 [December 3, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -89,10 +89,11 @@
defined PNG_READ_sBIT_SUPPORTED &&\
defined PNG_READ_sCAL_SUPPORTED &&\
defined PNG_READ_sRGB_SUPPORTED &&\
+ defined PNG_READ_sPLT_SUPPORTED &&\
defined PNG_READ_tEXt_SUPPORTED &&\
defined PNG_READ_tIME_SUPPORTED &&\
defined PNG_READ_zTXt_SUPPORTED &&\
- defined PNG_WRITE_INTERLACING_SUPPORTED
+ (defined PNG_WRITE_INTERLACING_SUPPORTED || PNG_LIBPNG_VER >= 10700)
#ifdef PNG_ZLIB_HEADER
# include PNG_ZLIB_HEADER /* defined by pnglibconf.h from 1.7 */
@@ -129,6 +130,10 @@
# define SINGLE_ROWBUF_ALLOC /* Makes buffer overruns easier to nail */
#endif
+#ifndef PNG_UNUSED
+# define PNG_UNUSED(param) (void)param;
+#endif
+
/* Turn on CPU timing
#define PNGTEST_TIMING
*/
@@ -146,6 +151,22 @@
#define PNG_tIME_STRING_LENGTH 29
static int tIME_chunk_present = 0;
static char tIME_string[PNG_tIME_STRING_LENGTH] = "tIME chunk is not present";
+
+#if PNG_LIBPNG_VER < 10619
+#define png_convert_to_rfc1123_buffer(ts, t) tIME_to_str(read_ptr, ts, t)
+
+static int
+tIME_to_str(png_structp png_ptr, png_charp ts, png_const_timep t)
+{
+ png_const_charp str = png_convert_to_rfc1123(png_ptr, t);
+
+ if (str == NULL)
+ return 0;
+
+ strcpy(ts, str);
+ return 1;
+}
+#endif /* older libpng */
#endif
static int verbose = 0;
@@ -213,16 +234,14 @@
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
-/* Example of using user transform callback (we don't transform anything,
- * but merely examine the row filters. We set this to 256 rather than
- * 5 in case illegal filter values are present.)
+/* Example of using a user transform callback (doesn't do anything at present).
*/
-static png_uint_32 filters_used[256];
static void PNGCBAPI
-count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data)
+read_user_callback(png_structp png_ptr, png_row_infop row_info, png_bytep data)
{
- if (png_ptr != NULL && row_info != NULL)
- ++filters_used[*(data - 1)];
+ PNG_UNUSED(png_ptr)
+ PNG_UNUSED(row_info)
+ PNG_UNUSED(data)
}
#endif
@@ -497,7 +516,7 @@
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
/* Allocate memory. For reasonable files, size should never exceed
- * 64K. However, zlib may allocate more then 64K if you don't tell
+ * 64K. However, zlib may allocate more than 64K if you don't tell
* it not to. See zconf.h and png.h for more information. zlib does
* need to allocate exactly 64K, so whatever you call here must
* have the ability to do that.
@@ -593,6 +612,7 @@
}
/* Unlink the element from the list. */
+ if (pinformation != NULL)
{
memory_infop *ppinfo = &pinformation;
@@ -609,8 +629,7 @@
/* We must free the list element too, but first kill
the memory that is to be freed. */
memset(ptr, 0x55, pinfo->size);
- if (pinfo != NULL)
- free(pinfo);
+ free(pinfo);
pinfo = NULL;
break;
}
@@ -820,7 +839,7 @@
*/
#ifdef PNG_TEXT_SUPPORTED
static void
-pngtest_check_text_support(png_const_structp png_ptr, png_textp text_ptr,
+pngtest_check_text_support(png_structp png_ptr, png_textp text_ptr,
int num_text)
{
while (num_text > 0)
@@ -833,6 +852,8 @@
case PNG_TEXT_COMPRESSION_zTXt:
# ifndef PNG_WRITE_zTXt_SUPPORTED
++unsupported_chunks;
+ /* In libpng 1.7 this now does an app-error, so stop it: */
+ text_ptr[num_text].compression = PNG_TEXT_COMPRESSION_NONE;
# endif
break;
@@ -840,6 +861,7 @@
case PNG_ITXT_COMPRESSION_zTXt:
# ifndef PNG_WRITE_iTXt_SUPPORTED
++unsupported_chunks;
+ text_ptr[num_text].compression = PNG_TEXT_COMPRESSION_NONE;
# endif
break;
@@ -866,16 +888,19 @@
png_structp write_ptr;
png_infop write_info_ptr;
png_infop write_end_info_ptr;
+#ifdef PNG_WRITE_FILTER_SUPPORTED
int interlace_preserved = 1;
-#else
+#endif /* WRITE_FILTER */
+#else /* !WRITE */
png_structp write_ptr = NULL;
png_infop write_info_ptr = NULL;
png_infop write_end_info_ptr = NULL;
-#endif
+#endif /* !WRITE */
png_bytep row_buf;
png_uint_32 y;
png_uint_32 width, height;
- int num_pass = 1, pass;
+ volatile int num_passes;
+ int pass;
int bit_depth, color_type;
row_buf = NULL;
@@ -1028,14 +1053,7 @@
}
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
- {
- int i;
-
- for (i = 0; i<256; i++)
- filters_used[i] = 0;
-
- png_set_read_user_transform_fn(read_ptr, count_filters);
- }
+ png_set_read_user_transform_fn(read_ptr, read_user_callback);
#endif
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
zero_samples = 0;
@@ -1082,27 +1100,27 @@
{
png_set_IHDR(write_ptr, write_info_ptr, width, height, bit_depth,
color_type, interlace_type, compression_type, filter_type);
-#ifndef PNG_READ_INTERLACING_SUPPORTED
- /* num_pass will not be set below, set it here if the image is
- * interlaced: what happens is that write interlacing is *not* turned
- * on an the partial interlaced rows are written directly.
+ /* num_passes may not be available below if interlace support is not
+ * provided by libpng for both read and write.
*/
switch (interlace_type)
{
case PNG_INTERLACE_NONE:
- num_pass = 1;
+ num_passes = 1;
break;
case PNG_INTERLACE_ADAM7:
- num_pass = 7;
- break;
+ num_passes = 7;
+ break;
default:
- png_error(read_ptr, "invalid interlace type");
- /*NOT REACHED*/
+ png_error(read_ptr, "invalid interlace type");
+ /*NOT REACHED*/
}
-#endif
}
+
+ else
+ png_error(read_ptr, "png_get_IHDR failed");
}
#ifdef PNG_FIXED_POINT_SUPPORTED
#ifdef PNG_cHRM_SUPPORTED
@@ -1273,6 +1291,19 @@
#endif
#endif
#endif
+
+#ifdef PNG_sPLT_SUPPORTED
+ {
+ png_sPLT_tp entries;
+
+ int num_entries = (int) png_get_sPLT(read_ptr, read_info_ptr, &entries);
+ if (num_entries)
+ {
+ png_set_sPLT(write_ptr, write_info_ptr, entries, num_entries);
+ }
+ }
+#endif
+
#ifdef PNG_TEXT_SUPPORTED
{
png_textp text_ptr;
@@ -1394,21 +1425,49 @@
#endif /* SINGLE_ROWBUF_ALLOC */
pngtest_debug("Writing row data");
-#ifdef PNG_READ_INTERLACING_SUPPORTED
- num_pass = png_set_interlace_handling(read_ptr);
- if (png_set_interlace_handling(write_ptr) != num_pass)
- png_error(write_ptr, "png_set_interlace_handling: inconsistent num_pass");
-#endif
+#if defined(PNG_READ_INTERLACING_SUPPORTED) &&\
+ defined(PNG_WRITE_INTERLACING_SUPPORTED)
+ /* Both must be defined for libpng to be able to handle the interlace,
+ * otherwise it gets handled below by simply reading and writing the passes
+ * directly.
+ */
+ if (png_set_interlace_handling(read_ptr) != num_passes)
+ png_error(write_ptr,
+ "png_set_interlace_handling(read): wrong pass count ");
+ if (png_set_interlace_handling(write_ptr) != num_passes)
+ png_error(write_ptr,
+ "png_set_interlace_handling(write): wrong pass count ");
+#else /* png_set_interlace_handling not called on either read or write */
+# define calc_pass_height
+#endif /* not using libpng interlace handling */
#ifdef PNGTEST_TIMING
t_stop = (float)clock();
t_misc += (t_stop - t_start);
t_start = t_stop;
#endif
- for (pass = 0; pass < num_pass; pass++)
+ for (pass = 0; pass < num_passes; pass++)
{
+# ifdef calc_pass_height
+ png_uint_32 pass_height;
+
+ if (num_passes == 7) /* interlaced */
+ {
+ if (PNG_PASS_COLS(width, pass) > 0)
+ pass_height = PNG_PASS_ROWS(height, pass);
+
+ else
+ pass_height = 0;
+ }
+
+ else /* not interlaced */
+ pass_height = height;
+# else
+# define pass_height height
+# endif
+
pngtest_debug1("Writing row data for pass %d", pass);
- for (y = 0; y < height; y++)
+ for (y = 0; y < pass_height; y++)
{
#ifndef SINGLE_ROWBUF_ALLOC
pngtest_debug2("Allocating row buffer (pass %d, y = %u)...", pass, y);
@@ -1598,7 +1657,7 @@
}
# ifdef PNG_WRITE_SUPPORTED
- /* If there we no write support nothing was written! */
+ /* If there is no write support nothing was written! */
else if (unsupported_chunks > 0)
{
fprintf(STDERR, "\n %s: unsupported chunks (%d)%s",
@@ -1629,7 +1688,8 @@
return (1);
}
-#ifdef PNG_WRITE_SUPPORTED /* else nothing was written */
+#if defined (PNG_WRITE_SUPPORTED) /* else nothing was written */ &&\
+ defined (PNG_WRITE_FILTER_SUPPORTED)
if (interlace_preserved != 0) /* else the files will be changed */
{
for (;;)
@@ -1706,7 +1766,7 @@
}
}
}
-#endif /* WRITE */
+#endif /* WRITE && WRITE_FILTER */
FCLOSE(fpin);
FCLOSE(fpout);
@@ -1729,6 +1789,8 @@
int multiple = 0;
int ierror = 0;
+ png_structp dummy_ptr;
+
fprintf(STDERR, "\n Testing libpng version %s\n", PNG_LIBPNG_VER_STRING);
fprintf(STDERR, " with zlib version %s\n", ZLIB_VERSION);
fprintf(STDERR, "%s", png_get_copyright(NULL));
@@ -1843,26 +1905,17 @@
kerror = test_one_file(argv[i], outname);
if (kerror == 0)
{
-#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
- int k;
-#endif
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
fprintf(STDERR, "\n PASS (%lu zero samples)\n",
(unsigned long)zero_samples);
#else
fprintf(STDERR, " PASS\n");
#endif
-#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
- for (k = 0; k<256; k++)
- if (filters_used[k] != 0)
- fprintf(STDERR, " Filter %d was used %lu times\n",
- k, (unsigned long)filters_used[k]);
-#endif
#ifdef PNG_TIME_RFC1123_SUPPORTED
- if (tIME_chunk_present != 0)
- fprintf(STDERR, " tIME = %s\n", tIME_string);
+ if (tIME_chunk_present != 0)
+ fprintf(STDERR, " tIME = %s\n", tIME_string);
- tIME_chunk_present = 0;
+ tIME_chunk_present = 0;
#endif /* TIME_RFC1123 */
}
@@ -1934,21 +1987,12 @@
{
if (verbose == 1 || i == 2)
{
-#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
- int k;
-#endif
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
fprintf(STDERR, "\n PASS (%lu zero samples)\n",
(unsigned long)zero_samples);
#else
fprintf(STDERR, " PASS\n");
#endif
-#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
- for (k = 0; k<256; k++)
- if (filters_used[k] != 0)
- fprintf(STDERR, " Filter %d was used %lu times\n",
- k, (unsigned long)filters_used[k]);
-#endif
#ifdef PNG_TIME_RFC1123_SUPPORTED
if (tIME_chunk_present != 0)
fprintf(STDERR, " tIME = %s\n", tIME_string);
@@ -2022,6 +2066,24 @@
else
fprintf(STDERR, " libpng FAILS test\n");
+ dummy_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+ fprintf(STDERR, " Default limits:\n");
+ fprintf(STDERR, " width_max = %lu\n",
+ (unsigned long) png_get_user_width_max(dummy_ptr));
+ fprintf(STDERR, " height_max = %lu\n",
+ (unsigned long) png_get_user_height_max(dummy_ptr));
+ if (png_get_chunk_cache_max(dummy_ptr) == 0)
+ fprintf(STDERR, " cache_max = unlimited\n");
+ else
+ fprintf(STDERR, " cache_max = %lu\n",
+ (unsigned long) png_get_chunk_cache_max(dummy_ptr));
+ if (png_get_chunk_malloc_max(dummy_ptr) == 0)
+ fprintf(STDERR, " malloc_max = unlimited\n");
+ else
+ fprintf(STDERR, " malloc_max = %lu\n",
+ (unsigned long) png_get_chunk_malloc_max(dummy_ptr));
+ png_destroy_read_struct(&dummy_ptr, NULL, NULL);
+
return (int)(ierror != 0);
}
#else
@@ -2036,4 +2098,4 @@
#endif
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_16 Your_png_h_is_not_version_1_6_16;
+typedef png_libpng_version_1_6_20 Your_png_h_is_not_version_1_6_20;
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c Thu Jan 21 10:17:21 2016 -0800
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.18 [July 23, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -58,7 +58,7 @@
#endif
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
-/* Turn on 16 bit byte swapping */
+/* Turn on 16-bit byte swapping */
void PNGAPI
png_set_swap(png_structrp png_ptr)
{
@@ -341,7 +341,7 @@
#ifdef PNG_16BIT_SUPPORTED
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
-/* Swaps byte order on 16 bit depth images */
+/* Swaps byte order on 16-bit depth images */
void /* PRIVATE */
png_do_swap(png_row_infop row_info, png_bytep row)
{
@@ -732,7 +732,7 @@
*/
for (; rp > png_ptr->row_buf; rp--)
{
- if (*rp >> padding != 0)
+ if ((*rp >> padding) != 0)
png_ptr->num_palette_max = 1;
padding = 0;
}
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwio.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwio.c Thu Jan 21 10:17:21 2016 -0800
@@ -54,7 +54,7 @@
* writes to a file pointer. Note that this routine sometimes gets called
* with very small lengths, so you should implement some kind of simple
* buffering if you are using unbuffered writes. This should never be asked
- * to write more than 64K on a 16 bit machine.
+ * to write more than 64K on a 16-bit machine.
*/
void /* PRIVATE */
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwrite.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwrite.c Thu Jan 21 10:17:21 2016 -0800
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.19 [November 12, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -118,43 +118,44 @@
if ((png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE) == 0)
{
- /* Write PNG signature */
- png_write_sig(png_ptr);
+ /* Write PNG signature */
+ png_write_sig(png_ptr);
#ifdef PNG_MNG_FEATURES_SUPPORTED
- if ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) != 0 && \
- png_ptr->mng_features_permitted != 0)
- {
- png_warning(png_ptr, "MNG features are not allowed in a PNG datastream");
- png_ptr->mng_features_permitted = 0;
- }
+ if ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) != 0 && \
+ png_ptr->mng_features_permitted != 0)
+ {
+ png_warning(png_ptr,
+ "MNG features are not allowed in a PNG datastream");
+ png_ptr->mng_features_permitted = 0;
+ }
#endif
- /* Write IHDR information. */
- png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height,
- info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type,
- info_ptr->filter_type,
+ /* Write IHDR information. */
+ png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height,
+ info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type,
+ info_ptr->filter_type,
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
- info_ptr->interlace_type
+ info_ptr->interlace_type
#else
- 0
+ 0
#endif
- );
+ );
- /* The rest of these check to see if the valid field has the appropriate
- * flag set, and if it does, writes the chunk.
- *
- * 1.6.0: COLORSPACE support controls the writing of these chunks too, and
- * the chunks will be written if the WRITE routine is there and information
- * is available in the COLORSPACE. (See png_colorspace_sync_info in png.c
- * for where the valid flags get set.)
- *
- * Under certain circumstances the colorspace can be invalidated without
- * syncing the info_struct 'valid' flags; this happens if libpng detects and
- * error and calls png_error while the color space is being set, yet the
- * application continues writing the PNG. So check the 'invalid' flag here
- * too.
- */
+ /* The rest of these check to see if the valid field has the appropriate
+ * flag set, and if it does, writes the chunk.
+ *
+ * 1.6.0: COLORSPACE support controls the writing of these chunks too, and
+ * the chunks will be written if the WRITE routine is there and
+ * information * is available in the COLORSPACE. (See
+ * png_colorspace_sync_info in png.c for where the valid flags get set.)
+ *
+ * Under certain circumstances the colorspace can be invalidated without
+ * syncing the info_struct 'valid' flags; this happens if libpng detects
+ * an error and calls png_error while the color space is being set, yet
+ * the application continues writing the PNG. So check the 'invalid'
+ * flag here too.
+ */
#ifdef PNG_GAMMA_SUPPORTED
# ifdef PNG_WRITE_gAMA_SUPPORTED
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
@@ -165,50 +166,50 @@
#endif
#ifdef PNG_COLORSPACE_SUPPORTED
- /* Write only one of sRGB or an ICC profile. If a profile was supplied
- * and it matches one of the known sRGB ones issue a warning.
- */
+ /* Write only one of sRGB or an ICC profile. If a profile was supplied
+ * and it matches one of the known sRGB ones issue a warning.
+ */
# ifdef PNG_WRITE_iCCP_SUPPORTED
- if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
- (info_ptr->valid & PNG_INFO_iCCP) != 0)
- {
-# ifdef PNG_WRITE_sRGB_SUPPORTED
- if ((info_ptr->valid & PNG_INFO_sRGB) != 0)
- png_app_warning(png_ptr,
- "profile matches sRGB but writing iCCP instead");
-# endif
+ if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
+ (info_ptr->valid & PNG_INFO_iCCP) != 0)
+ {
+# ifdef PNG_WRITE_sRGB_SUPPORTED
+ if ((info_ptr->valid & PNG_INFO_sRGB) != 0)
+ png_app_warning(png_ptr,
+ "profile matches sRGB but writing iCCP instead");
+# endif
- png_write_iCCP(png_ptr, info_ptr->iccp_name,
- info_ptr->iccp_profile);
- }
+ png_write_iCCP(png_ptr, info_ptr->iccp_name,
+ info_ptr->iccp_profile);
+ }
# ifdef PNG_WRITE_sRGB_SUPPORTED
else
# endif
# endif
# ifdef PNG_WRITE_sRGB_SUPPORTED
- if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
- (info_ptr->valid & PNG_INFO_sRGB) != 0)
- png_write_sRGB(png_ptr, info_ptr->colorspace.rendering_intent);
+ if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
+ (info_ptr->valid & PNG_INFO_sRGB) != 0)
+ png_write_sRGB(png_ptr, info_ptr->colorspace.rendering_intent);
# endif /* WRITE_sRGB */
#endif /* COLORSPACE */
#ifdef PNG_WRITE_sBIT_SUPPORTED
- if ((info_ptr->valid & PNG_INFO_sBIT) != 0)
- png_write_sBIT(png_ptr, &(info_ptr->sig_bit), info_ptr->color_type);
+ if ((info_ptr->valid & PNG_INFO_sBIT) != 0)
+ png_write_sBIT(png_ptr, &(info_ptr->sig_bit), info_ptr->color_type);
#endif
#ifdef PNG_COLORSPACE_SUPPORTED
# ifdef PNG_WRITE_cHRM_SUPPORTED
- if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
- (info_ptr->colorspace.flags & PNG_COLORSPACE_FROM_cHRM) != 0 &&
- (info_ptr->valid & PNG_INFO_cHRM) != 0)
- png_write_cHRM_fixed(png_ptr, &info_ptr->colorspace.end_points_xy);
+ if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
+ (info_ptr->colorspace.flags & PNG_COLORSPACE_FROM_cHRM) != 0 &&
+ (info_ptr->valid & PNG_INFO_cHRM) != 0)
+ png_write_cHRM_fixed(png_ptr, &info_ptr->colorspace.end_points_xy);
# endif
#endif
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
- write_unknown_chunks(png_ptr, info_ptr, PNG_HAVE_IHDR);
+ write_unknown_chunks(png_ptr, info_ptr, PNG_HAVE_IHDR);
#endif
png_ptr->mode |= PNG_WROTE_INFO_BEFORE_PLTE;
@@ -233,7 +234,7 @@
png_write_PLTE(png_ptr, info_ptr->palette,
(png_uint_32)info_ptr->num_palette);
- else if ((info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) !=0)
+ else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
png_error(png_ptr, "Valid palette required for paletted images");
#ifdef PNG_WRITE_tRNS_SUPPORTED
@@ -244,8 +245,13 @@
if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0 &&
info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{
- int j;
- for (j = 0; j<(int)info_ptr->num_trans; j++)
+ int j, jend;
+
+ jend = info_ptr->num_trans;
+ if (jend > PNG_MAX_PALETTE_LENGTH)
+ jend = PNG_MAX_PALETTE_LENGTH;
+
+ for (j = 0; j<jend; ++j)
info_ptr->trans_alpha[j] =
(png_byte)(255 - info_ptr->trans_alpha[j]);
}
@@ -566,7 +572,7 @@
/* App warnings are warnings in release (or release candidate) builds but
* are errors during development.
*/
-#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
+#if PNG_RELEASE_BUILD
png_ptr->flags |= PNG_FLAG_APP_WARNINGS_WARN;
#endif
@@ -666,8 +672,8 @@
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
{
- *(rp) = (png_byte)((*rp - *(rp + 1)) & 0xff);
- *(rp + 2) = (png_byte)((*(rp + 2) - *(rp + 1)) & 0xff);
+ *(rp) = (png_byte)(*rp - *(rp + 1));
+ *(rp + 2) = (png_byte)(*(rp + 2) - *(rp + 1));
}
}
@@ -693,10 +699,10 @@
png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
- *(rp ) = (png_byte)((red >> 8) & 0xff);
- *(rp + 1) = (png_byte)(red & 0xff);
- *(rp + 4) = (png_byte)((blue >> 8) & 0xff);
- *(rp + 5) = (png_byte)(blue & 0xff);
+ *(rp ) = (png_byte)(red >> 8);
+ *(rp + 1) = (png_byte)red;
+ *(rp + 4) = (png_byte)(blue >> 8);
+ *(rp + 5) = (png_byte)blue;
}
}
#endif /* WRITE_16BIT */
@@ -877,7 +883,7 @@
* which is also the output depth.
*/
if (row_info.pixel_depth != png_ptr->pixel_depth ||
- row_info.pixel_depth != png_ptr->transformed_pixel_depth)
+ row_info.pixel_depth != png_ptr->transformed_pixel_depth)
png_error(png_ptr, "internal write transform logic error");
#ifdef PNG_MNG_FEATURES_SUPPORTED
@@ -945,10 +951,6 @@
}
#endif /* WRITE_FLUSH */
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-static void png_reset_filter_heuristics(png_structrp png_ptr);/* forward decl */
-#endif
-
/* Free any memory used in png_ptr struct without freeing the struct itself. */
static void
png_write_destroy(png_structrp png_ptr)
@@ -965,24 +967,11 @@
png_ptr->row_buf = NULL;
#ifdef PNG_WRITE_FILTER_SUPPORTED
png_free(png_ptr, png_ptr->prev_row);
- png_free(png_ptr, png_ptr->sub_row);
- png_free(png_ptr, png_ptr->up_row);
- png_free(png_ptr, png_ptr->avg_row);
- png_free(png_ptr, png_ptr->paeth_row);
+ png_free(png_ptr, png_ptr->try_row);
+ png_free(png_ptr, png_ptr->tst_row);
png_ptr->prev_row = NULL;
- png_ptr->sub_row = NULL;
- png_ptr->up_row = NULL;
- png_ptr->avg_row = NULL;
- png_ptr->paeth_row = NULL;
-#endif
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
- /* Use this to save a little code space, it doesn't free the filter_costs */
- png_reset_filter_heuristics(png_ptr);
- png_free(png_ptr, png_ptr->filter_costs);
- png_free(png_ptr, png_ptr->inv_filter_costs);
- png_ptr->filter_costs = NULL;
- png_ptr->inv_filter_costs = NULL;
+ png_ptr->try_row = NULL;
+ png_ptr->tst_row = NULL;
#endif
#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
@@ -1072,211 +1061,85 @@
#endif /* WRITE_FILTER */
}
+#ifdef PNG_WRITE_FILTER_SUPPORTED
/* If we have allocated the row_buf, this means we have already started
* with the image and we should have allocated all of the filter buffers
* that have been selected. If prev_row isn't already allocated, then
* it is too late to start using the filters that need it, since we
* will be missing the data in the previous row. If an application
* wants to start and stop using particular filters during compression,
- * it should start out with all of the filters, and then add and
- * remove them after the start of compression.
+ * it should start out with all of the filters, and then remove them
+ * or add them back after the start of compression.
+ *
+ * NOTE: this is a nasty constraint on the code, because it means that the
+ * prev_row buffer must be maintained even if there are currently no
+ * 'prev_row' requiring filters active.
*/
if (png_ptr->row_buf != NULL)
{
-#ifdef PNG_WRITE_FILTER_SUPPORTED
- if ((png_ptr->do_filter & PNG_FILTER_SUB) != 0 &&
- png_ptr->sub_row == NULL)
- {
- png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
- (png_ptr->rowbytes + 1));
- png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB;
- }
+ int num_filters;
+ png_alloc_size_t buf_size;
- if ((png_ptr->do_filter & PNG_FILTER_UP) != 0 &&
- png_ptr->up_row == NULL)
+ /* Repeat the checks in png_write_start_row; 1 pixel high or wide
+ * images cannot benefit from certain filters. If this isn't done here
+ * the check below will fire on 1 pixel high images.
+ */
+ if (png_ptr->height == 1)
+ filters &= ~(PNG_FILTER_UP|PNG_FILTER_AVG|PNG_FILTER_PAETH);
+
+ if (png_ptr->width == 1)
+ filters &= ~(PNG_FILTER_SUB|PNG_FILTER_AVG|PNG_FILTER_PAETH);
+
+ if ((filters & (PNG_FILTER_UP|PNG_FILTER_AVG|PNG_FILTER_PAETH)) != 0
+ && png_ptr->prev_row == NULL)
{
- if (png_ptr->prev_row == NULL)
- {
- png_warning(png_ptr, "Can't add Up filter after starting");
- png_ptr->do_filter = (png_byte)(png_ptr->do_filter &
- ~PNG_FILTER_UP);
- }
-
- else
- {
- png_ptr->up_row = (png_bytep)png_malloc(png_ptr,
- (png_ptr->rowbytes + 1));
- png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
- }
+ /* This is the error case, however it is benign - the previous row
+ * is not available so the filter can't be used. Just warn here.
+ */
+ png_app_warning(png_ptr,
+ "png_set_filter: UP/AVG/PAETH cannot be added after start");
+ filters &= ~(PNG_FILTER_UP|PNG_FILTER_AVG|PNG_FILTER_PAETH);
}
- if ((png_ptr->do_filter & PNG_FILTER_AVG) != 0 &&
- png_ptr->avg_row == NULL)
- {
- if (png_ptr->prev_row == NULL)
- {
- png_warning(png_ptr, "Can't add Average filter after starting");
- png_ptr->do_filter = (png_byte)(png_ptr->do_filter &
- ~PNG_FILTER_AVG);
- }
+ num_filters = 0;
+
+ if (filters & PNG_FILTER_SUB)
+ num_filters++;
- else
- {
- png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
- (png_ptr->rowbytes + 1));
- png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
- }
- }
+ if (filters & PNG_FILTER_UP)
+ num_filters++;
+
+ if (filters & PNG_FILTER_AVG)
+ num_filters++;
+
+ if (filters & PNG_FILTER_PAETH)
+ num_filters++;
- if ((png_ptr->do_filter & PNG_FILTER_PAETH) != 0 &&
- png_ptr->paeth_row == NULL)
- {
- if (png_ptr->prev_row == NULL)
- {
- png_warning(png_ptr, "Can't add Paeth filter after starting");
- png_ptr->do_filter &= (png_byte)(~PNG_FILTER_PAETH);
- }
+ /* Allocate needed row buffers if they have not already been
+ * allocated.
+ */
+ buf_size = PNG_ROWBYTES(png_ptr->usr_channels * png_ptr->usr_bit_depth,
+ png_ptr->width) + 1;
+
+ if (png_ptr->try_row == NULL)
+ png_ptr->try_row = png_voidcast(png_bytep,
+ png_malloc(png_ptr, buf_size));
- else
- {
- png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr,
- (png_ptr->rowbytes + 1));
- png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
- }
+ if (num_filters > 1)
+ {
+ if (png_ptr->tst_row == NULL)
+ png_ptr->tst_row = png_voidcast(png_bytep,
+ png_malloc(png_ptr, buf_size));
}
-
- if (png_ptr->do_filter == PNG_NO_FILTERS)
-#endif /* WRITE_FILTER */
- png_ptr->do_filter = PNG_FILTER_NONE;
}
+ png_ptr->do_filter = (png_byte)filters;
+#endif
}
else
png_error(png_ptr, "Unknown custom filter method");
}
-/* This allows us to influence the way in which libpng chooses the "best"
- * filter for the current scanline. While the "minimum-sum-of-absolute-
- * differences metric is relatively fast and effective, there is some
- * question as to whether it can be improved upon by trying to keep the
- * filtered data going to zlib more consistent, hopefully resulting in
- * better compression.
- */
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* GRR 970116 */
-/* Convenience reset API. */
-static void
-png_reset_filter_heuristics(png_structrp png_ptr)
-{
- /* Clear out any old values in the 'weights' - this must be done because if
- * the app calls set_filter_heuristics multiple times with different
- * 'num_weights' values we would otherwise potentially have wrong sized
- * arrays.
- */
- png_ptr->num_prev_filters = 0;
- png_ptr->heuristic_method = PNG_FILTER_HEURISTIC_UNWEIGHTED;
- if (png_ptr->prev_filters != NULL)
- {
- png_bytep old = png_ptr->prev_filters;
- png_ptr->prev_filters = NULL;
- png_free(png_ptr, old);
- }
- if (png_ptr->filter_weights != NULL)
- {
- png_uint_16p old = png_ptr->filter_weights;
- png_ptr->filter_weights = NULL;
- png_free(png_ptr, old);
- }
-
- if (png_ptr->inv_filter_weights != NULL)
- {
- png_uint_16p old = png_ptr->inv_filter_weights;
- png_ptr->inv_filter_weights = NULL;
- png_free(png_ptr, old);
- }
-
- /* Leave the filter_costs - this array is fixed size. */
-}
-
-static int
-png_init_filter_heuristics(png_structrp png_ptr, int heuristic_method,
- int num_weights)
-{
- if (png_ptr == NULL)
- return 0;
-
- /* Clear out the arrays */
- png_reset_filter_heuristics(png_ptr);
-
- /* Check arguments; the 'reset' function makes the correct settings for the
- * unweighted case, but we must handle the weight case by initializing the
- * arrays for the caller.
- */
- if (heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
- {
- int i;
-
- if (num_weights > 0)
- {
- png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr,
- (png_uint_32)((sizeof (png_byte)) * num_weights));
-
- /* To make sure that the weighting starts out fairly */
- for (i = 0; i < num_weights; i++)
- {
- png_ptr->prev_filters[i] = 255;
- }
-
- png_ptr->filter_weights = (png_uint_16p)png_malloc(png_ptr,
- (png_uint_32)((sizeof (png_uint_16)) * num_weights));
-
- png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr,
- (png_uint_32)((sizeof (png_uint_16)) * num_weights));
-
- for (i = 0; i < num_weights; i++)
- {
- png_ptr->inv_filter_weights[i] =
- png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
- }
-
- /* Safe to set this now */
- png_ptr->num_prev_filters = (png_byte)num_weights;
- }
-
- /* If, in the future, there are other filter methods, this would
- * need to be based on png_ptr->filter.
- */
- if (png_ptr->filter_costs == NULL)
- {
- png_ptr->filter_costs = (png_uint_16p)png_malloc(png_ptr,
- (png_uint_32)((sizeof (png_uint_16)) * PNG_FILTER_VALUE_LAST));
-
- png_ptr->inv_filter_costs = (png_uint_16p)png_malloc(png_ptr,
- (png_uint_32)((sizeof (png_uint_16)) * PNG_FILTER_VALUE_LAST));
- }
-
- for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
- {
- png_ptr->inv_filter_costs[i] =
- png_ptr->filter_costs[i] = PNG_COST_FACTOR;
- }
-
- /* All the arrays are inited, safe to set this: */
- png_ptr->heuristic_method = PNG_FILTER_HEURISTIC_WEIGHTED;
-
- /* Return the 'ok' code. */
- return 1;
- }
- else if (heuristic_method == PNG_FILTER_HEURISTIC_DEFAULT ||
- heuristic_method == PNG_FILTER_HEURISTIC_UNWEIGHTED)
- {
- return 1;
- }
- else
- {
- png_warning(png_ptr, "Unknown filter heuristic method");
- return 0;
- }
-}
-
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* DEPRECATED */
/* Provide floating and fixed point APIs */
#ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
@@ -1284,52 +1147,11 @@
int num_weights, png_const_doublep filter_weights,
png_const_doublep filter_costs)
{
- png_debug(1, "in png_set_filter_heuristics");
-
- /* The internal API allocates all the arrays and ensures that the elements of
- * those arrays are set to the default value.
- */
- if (png_init_filter_heuristics(png_ptr, heuristic_method, num_weights) == 0)
- return;
-
- /* If using the weighted method copy in the weights. */
- if (heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
- {
- int i;
- for (i = 0; i < num_weights; i++)
- {
- if (filter_weights[i] <= 0.0)
- {
- png_ptr->inv_filter_weights[i] =
- png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
- }
-
- else
- {
- png_ptr->inv_filter_weights[i] =
- (png_uint_16)(PNG_WEIGHT_FACTOR*filter_weights[i]+.5);
-
- png_ptr->filter_weights[i] =
- (png_uint_16)(PNG_WEIGHT_FACTOR/filter_weights[i]+.5);
- }
- }
-
- /* Here is where we set the relative costs of the different filters. We
- * should take the desired compression level into account when setting
- * the costs, so that Paeth, for instance, has a high relative cost at low
- * compression levels, while it has a lower relative cost at higher
- * compression settings. The filter types are in order of increasing
- * relative cost, so it would be possible to do this with an algorithm.
- */
- for (i = 0; i < PNG_FILTER_VALUE_LAST; i++) if (filter_costs[i] >= 1.0)
- {
- png_ptr->inv_filter_costs[i] =
- (png_uint_16)(PNG_COST_FACTOR / filter_costs[i] + .5);
-
- png_ptr->filter_costs[i] =
- (png_uint_16)(PNG_COST_FACTOR * filter_costs[i] + .5);
- }
- }
+ PNG_UNUSED(png_ptr)
+ PNG_UNUSED(heuristic_method)
+ PNG_UNUSED(num_weights)
+ PNG_UNUSED(filter_weights)
+ PNG_UNUSED(filter_costs)
}
#endif /* FLOATING_POINT */
@@ -1339,67 +1161,16 @@
int num_weights, png_const_fixed_point_p filter_weights,
png_const_fixed_point_p filter_costs)
{
- png_debug(1, "in png_set_filter_heuristics_fixed");
-
- /* The internal API allocates all the arrays and ensures that the elements of
- * those arrays are set to the default value.
- */
- if (png_init_filter_heuristics(png_ptr, heuristic_method, num_weights) == 0)
- return;
-
- /* If using the weighted method copy in the weights. */
- if (heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
- {
- int i;
- for (i = 0; i < num_weights; i++)
- {
- if (filter_weights[i] <= 0)
- {
- png_ptr->inv_filter_weights[i] =
- png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
- }
-
- else
- {
- png_ptr->inv_filter_weights[i] = (png_uint_16)
- ((PNG_WEIGHT_FACTOR*filter_weights[i]+PNG_FP_HALF)/PNG_FP_1);
-
- png_ptr->filter_weights[i] = (png_uint_16)((PNG_WEIGHT_FACTOR*
- PNG_FP_1+(filter_weights[i]/2))/filter_weights[i]);
- }
- }
-
- /* Here is where we set the relative costs of the different filters. We
- * should take the desired compression level into account when setting
- * the costs, so that Paeth, for instance, has a high relative cost at low
- * compression levels, while it has a lower relative cost at higher
- * compression settings. The filter types are in order of increasing
- * relative cost, so it would be possible to do this with an algorithm.
- */
- for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
- if (filter_costs[i] >= PNG_FP_1)
- {
- png_uint_32 tmp;
-
- /* Use a 32 bit unsigned temporary here because otherwise the
- * intermediate value will be a 32 bit *signed* integer (ANSI rules)
- * and this will get the wrong answer on division.
- */
- tmp = PNG_COST_FACTOR*PNG_FP_1 + (filter_costs[i]/2);
- tmp /= filter_costs[i];
-
- png_ptr->inv_filter_costs[i] = (png_uint_16)tmp;
-
- tmp = PNG_COST_FACTOR * filter_costs[i] + PNG_FP_HALF;
- tmp /= PNG_FP_1;
-
- png_ptr->filter_costs[i] = (png_uint_16)tmp;
- }
- }
+ PNG_UNUSED(png_ptr)
+ PNG_UNUSED(heuristic_method)
+ PNG_UNUSED(num_weights)
+ PNG_UNUSED(filter_weights)
+ PNG_UNUSED(filter_costs)
}
#endif /* FIXED_POINT */
#endif /* WRITE_WEIGHTED_FILTER */
+#ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
void PNGAPI
png_set_compression_level(png_structrp png_ptr, int level)
{
@@ -1445,8 +1216,8 @@
if (png_ptr == NULL)
return;
- /* Prior to 1.6.0 this would warn but then set the window_bits value, this
- * meant that negative window bits values could be selected which would cause
+ /* Prior to 1.6.0 this would warn but then set the window_bits value. This
+ * meant that negative window bits values could be selected that would cause
* libpng to write a non-standard PNG file with raw deflate or gzip
* compressed IDAT or ancillary chunks. Such files can be read and there is
* no warning on read, so this seems like a very bad idea.
@@ -1482,6 +1253,7 @@
png_ptr->zlib_method = method;
}
+#endif /* WRITE_CUSTOMIZE_COMPRESSION */
/* The following were added to libpng-1.5.4 */
#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
@@ -1642,14 +1414,14 @@
* alpha channel.
*/
if ((transforms & (PNG_TRANSFORM_STRIP_FILLER_AFTER|
- PNG_TRANSFORM_STRIP_FILLER_BEFORE)) != 0)
+ PNG_TRANSFORM_STRIP_FILLER_BEFORE)) != 0)
{
#ifdef PNG_WRITE_FILLER_SUPPORTED
if ((transforms & PNG_TRANSFORM_STRIP_FILLER_AFTER) != 0)
{
if ((transforms & PNG_TRANSFORM_STRIP_FILLER_BEFORE) != 0)
png_app_error(png_ptr,
- "PNG_TRANSFORM_STRIP_FILLER: BEFORE+AFTER not supported");
+ "PNG_TRANSFORM_STRIP_FILLER: BEFORE+AFTER not supported");
/* Continue if ignored - this is the pre-1.6.10 behavior */
png_set_filler(png_ptr, 0, PNG_FILLER_AFTER);
@@ -1678,7 +1450,7 @@
png_app_error(png_ptr, "PNG_TRANSFORM_SWAP_ENDIAN not supported");
#endif
- /* Swap bits of 1, 2, 4 bit packed pixel formats */
+ /* Swap bits of 1-bit, 2-bit, 4-bit packed pixel formats */
if ((transforms & PNG_TRANSFORM_PACKSWAP) != 0)
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
png_set_packswap(png_ptr);
@@ -1708,13 +1480,13 @@
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
-#ifdef PNG_STDIO_SUPPORTED /* currently required for png_image_write_* */
+# ifdef PNG_STDIO_SUPPORTED /* currently required for png_image_write_* */
/* Initialize the write structure - general purpose utility. */
static int
png_image_write_init(png_imagep image)
{
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, image,
- png_safe_error, png_safe_warning);
+ png_safe_error, png_safe_warning);
if (png_ptr != NULL)
{
@@ -1723,7 +1495,7 @@
if (info_ptr != NULL)
{
png_controlp control = png_voidcast(png_controlp,
- png_malloc_warn(png_ptr, (sizeof *control)));
+ png_malloc_warn(png_ptr, (sizeof *control)));
if (control != NULL)
{
@@ -1770,12 +1542,12 @@
png_write_image_16bit(png_voidp argument)
{
png_image_write_control *display = png_voidcast(png_image_write_control*,
- argument);
+ argument);
png_imagep image = display->image;
png_structrp png_ptr = image->opaque->png_ptr;
png_const_uint_16p input_row = png_voidcast(png_const_uint_16p,
- display->first_row);
+ display->first_row);
png_uint_16p output_row = png_voidcast(png_uint_16p, display->local_row);
png_uint_16p row_end;
const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
@@ -1784,17 +1556,18 @@
if ((image->format & PNG_FORMAT_FLAG_ALPHA) != 0)
{
-# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
- if ((image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
- {
- aindex = -1;
- ++input_row; /* To point to the first component */
- ++output_row;
- }
-
+# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
+ if ((image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
+ {
+ aindex = -1;
+ ++input_row; /* To point to the first component */
+ ++output_row;
+ }
else
+ aindex = channels;
+# else
+ aindex = channels;
# endif
- aindex = channels;
}
else
@@ -1876,7 +1649,7 @@
* calculation can be done to 15 bits of accuracy; however, the output needs to
* be scaled in the range 0..255*65535, so include that scaling here.
*/
-#define UNP_RECIPROCAL(alpha) ((((0xffff*0xff)<<7)+(alpha>>1))/alpha)
+# define UNP_RECIPROCAL(alpha) ((((0xffff*0xff)<<7)+(alpha>>1))/alpha)
static png_byte
png_unpremultiply(png_uint_32 component, png_uint_32 alpha,
@@ -1927,12 +1700,12 @@
png_write_image_8bit(png_voidp argument)
{
png_image_write_control *display = png_voidcast(png_image_write_control*,
- argument);
+ argument);
png_imagep image = display->image;
png_structrp png_ptr = image->opaque->png_ptr;
png_const_uint_16p input_row = png_voidcast(png_const_uint_16p,
- display->first_row);
+ display->first_row);
png_bytep output_row = png_voidcast(png_bytep, display->local_row);
png_uint_32 y = image->height;
const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
@@ -1942,17 +1715,17 @@
png_bytep row_end;
int aindex;
-# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
- if ((image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
- {
- aindex = -1;
- ++input_row; /* To point to the first component */
- ++output_row;
- }
+# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
+ if ((image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
+ {
+ aindex = -1;
+ ++input_row; /* To point to the first component */
+ ++output_row;
+ }
- else
-# endif
- aindex = channels;
+ else
+# endif
+ aindex = channels;
/* Use row_end in place of a loop counter: */
row_end = output_row + image->width * (channels+1);
@@ -1986,7 +1759,7 @@
} /* while out_ptr < row_end */
png_write_row(png_ptr, png_voidcast(png_const_bytep,
- display->local_row));
+ display->local_row));
input_row += display->row_bytes/(sizeof (png_uint_16));
} /* while y */
}
@@ -2025,25 +1798,25 @@
const png_imagep image = display->image;
const void *cmap = display->colormap;
const int entries = image->colormap_entries > 256 ? 256 :
- (int)image->colormap_entries;
+ (int)image->colormap_entries;
/* NOTE: the caller must check for cmap != NULL and entries != 0 */
const png_uint_32 format = image->format;
const int channels = PNG_IMAGE_SAMPLE_CHANNELS(format);
-# if defined(PNG_FORMAT_BGR_SUPPORTED) &&\
+# if defined(PNG_FORMAT_BGR_SUPPORTED) &&\
defined(PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED)
const int afirst = (format & PNG_FORMAT_FLAG_AFIRST) != 0 &&
- (format & PNG_FORMAT_FLAG_ALPHA) != 0;
-# else
+ (format & PNG_FORMAT_FLAG_ALPHA) != 0;
+# else
# define afirst 0
-# endif
+# endif
-# ifdef PNG_FORMAT_BGR_SUPPORTED
+# ifdef PNG_FORMAT_BGR_SUPPORTED
const int bgr = (format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0;
-# else
+# else
# define bgr 0
-# endif
+# endif
int i, num_trans;
png_color palette[256];
@@ -2068,11 +1841,11 @@
if (channels >= 3) /* RGB */
{
palette[i].blue = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
- entry[(2 ^ bgr)]);
+ entry[(2 ^ bgr)]);
palette[i].green = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
- entry[1]);
+ entry[1]);
palette[i].red = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
- entry[bgr]);
+ entry[bgr]);
}
else /* Gray */
@@ -2148,12 +1921,12 @@
}
}
-# ifdef afirst
+# ifdef afirst
# undef afirst
-# endif
-# ifdef bgr
+# endif
+# ifdef bgr
# undef bgr
-# endif
+# endif
png_set_PLTE(image->opaque->png_ptr, image->opaque->info_ptr, palette,
entries);
@@ -2181,10 +1954,10 @@
int alpha = !colormap && (format & PNG_FORMAT_FLAG_ALPHA);
int write_16bit = linear && !colormap && (display->convert_to_8bit == 0);
-# ifdef PNG_BENIGN_ERRORS_SUPPORTED
+# ifdef PNG_BENIGN_ERRORS_SUPPORTED
/* Make sure we error out on any bad situation */
png_set_benign_errors(png_ptr, 0/*error*/);
-# endif
+# endif
/* Default the 'row_stride' parameter if required. */
if (display->row_stride == 0)
@@ -2253,7 +2026,7 @@
/* Now set up the data transformations (*after* the header is written),
* remove the handled transformations from the 'format' flags for checking.
*
- * First check for a little endian system if writing 16 bit files.
+ * First check for a little endian system if writing 16-bit files.
*/
if (write_16bit != 0)
{
@@ -2263,23 +2036,23 @@
png_set_swap(png_ptr);
}
-# ifdef PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
+# ifdef PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
if ((format & PNG_FORMAT_FLAG_BGR) != 0)
{
if (colormap == 0 && (format & PNG_FORMAT_FLAG_COLOR) != 0)
png_set_bgr(png_ptr);
format &= ~PNG_FORMAT_FLAG_BGR;
}
-# endif
+# endif
-# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
+# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
if ((format & PNG_FORMAT_FLAG_AFIRST) != 0)
{
if (colormap == 0 && (format & PNG_FORMAT_FLAG_ALPHA) != 0)
png_set_swap_alpha(png_ptr);
format &= ~PNG_FORMAT_FLAG_AFIRST;
}
-# endif
+# endif
/* If there are 16 or fewer color-map entries we wrote a lower bit depth
* above, but the application data is still byte packed.
@@ -2315,7 +2088,9 @@
* it about 50 times. The speed-up in pngstest was about 10-20% of the
* total (user) time on a heavily loaded system.
*/
+# ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
png_set_compression_level(png_ptr, 3);
+# endif
}
/* Check for the cases that currently require a pre-transform on the row
@@ -2478,6 +2253,6 @@
else
return 0;
}
-#endif /* STDIO */
+# endif /* STDIO */
#endif /* SIMPLIFIED_WRITE */
#endif /* WRITE */
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwtran.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwtran.c Thu Jan 21 10:17:21 2016 -0800
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.18 [July 23, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -99,7 +99,8 @@
case 2:
{
png_bytep sp, dp;
- int shift, v;
+ unsigned int shift;
+ int v;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
@@ -138,7 +139,8 @@
case 4:
{
png_bytep sp, dp;
- int shift, v;
+ unsigned int shift;
+ int v;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
@@ -450,7 +452,7 @@
*(dp++) = *(sp++);
*/
sp+=3; dp = sp;
- *(dp++) = (png_byte)(255 - *(sp++));
+ *dp = (png_byte)(255 - *(sp++));
}
}
@@ -474,7 +476,7 @@
*/
sp+=6; dp = sp;
*(dp++) = (png_byte)(255 - *(sp++));
- *(dp++) = (png_byte)(255 - *(sp++));
+ *dp = (png_byte)(255 - *(sp++));
}
}
#endif /* WRITE_16BIT */
@@ -512,7 +514,7 @@
*/
sp+=2; dp = sp;
*(dp++) = (png_byte)(255 - *(sp++));
- *(dp++) = (png_byte)(255 - *(sp++));
+ *dp = (png_byte)(255 - *(sp++));
}
}
#endif /* WRITE_16BIT */
--- a/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwutil.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/libpng/pngwutil.c Thu Jan 21 10:17:21 2016 -0800
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.19 [November 12, 2015]
+ * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -51,10 +51,10 @@
void PNGAPI
png_save_uint_32(png_bytep buf, png_uint_32 i)
{
- buf[0] = (png_byte)((i >> 24) & 0xff);
- buf[1] = (png_byte)((i >> 16) & 0xff);
- buf[2] = (png_byte)((i >> 8) & 0xff);
- buf[3] = (png_byte)(i & 0xff);
+ buf[0] = (png_byte)(i >> 24);
+ buf[1] = (png_byte)(i >> 16);
+ buf[2] = (png_byte)(i >> 8);
+ buf[3] = (png_byte)(i );
}
/* Place a 16-bit number into a buffer in PNG byte order.
@@ -64,8 +64,8 @@
void PNGAPI
png_save_uint_16(png_bytep buf, unsigned int i)
{
- buf[0] = (png_byte)((i >> 8) & 0xff);
- buf[1] = (png_byte)(i & 0xff);
+ buf[0] = (png_byte)(i >> 8);
+ buf[1] = (png_byte)(i );
}
#endif
@@ -207,7 +207,7 @@
if (png_ptr == NULL)
return;
- /* On 64 bit architectures 'length' may not fit in a png_uint_32. */
+ /* On 64-bit architectures 'length' may not fit in a png_uint_32. */
if (length > PNG_UINT_31_MAX)
png_error(png_ptr, "length exceeds PNG maximum");
@@ -336,7 +336,7 @@
*/
(void)png_safecat(msg, (sizeof msg), 10, " using zstream");
#endif
-#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
+#if PNG_RELEASE_BUILD
png_warning(png_ptr, msg);
/* Attempt sane error recovery */
@@ -723,7 +723,7 @@
while (*key && key_len < 79)
{
- png_byte ch = (png_byte)(0xff & *key++);
+ png_byte ch = (png_byte)*key++;
if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
*new_key++ = ch, ++key_len, space = 0;
@@ -899,7 +899,7 @@
interlace_type=PNG_INTERLACE_NONE;
#endif
- /* Save the relevent information */
+ /* Save the relevant information */
png_ptr->bit_depth = (png_byte)bit_depth;
png_ptr->color_type = (png_byte)color_type;
png_ptr->interlaced = (png_byte)interlace_type;
@@ -950,17 +950,20 @@
png_write_PLTE(png_structrp png_ptr, png_const_colorp palette,
png_uint_32 num_pal)
{
- png_uint_32 i;
+ png_uint_32 max_palette_length, i;
png_const_colorp pal_ptr;
png_byte buf[3];
png_debug(1, "in png_write_PLTE");
+ max_palette_length = (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ?
+ (1 << png_ptr->bit_depth) : PNG_MAX_PALETTE_LENGTH;
+
if ((
#ifdef PNG_MNG_FEATURES_SUPPORTED
(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0 &&
#endif
- num_pal == 0) || num_pal > 256)
+ num_pal == 0) || num_pal > max_palette_length)
{
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{
@@ -1472,7 +1475,7 @@
else if (color_type == PNG_COLOR_TYPE_GRAY)
{
- /* One 16 bit value */
+ /* One 16-bit value */
if (tran->gray >= (1 << png_ptr->bit_depth))
{
png_app_warning(png_ptr,
@@ -1487,7 +1490,7 @@
else if (color_type == PNG_COLOR_TYPE_RGB)
{
- /* Three 16 bit values */
+ /* Three 16-bit values */
png_save_uint_16(buf, tran->red);
png_save_uint_16(buf + 2, tran->green);
png_save_uint_16(buf + 4, tran->blue);
@@ -1793,7 +1796,7 @@
png_write_compressed_data_out(png_ptr, &comp);
else
- png_write_chunk_data(png_ptr, (png_const_bytep)text, comp.input_len);
+ png_write_chunk_data(png_ptr, (png_const_bytep)text, comp.output_len);
png_write_chunk_end(png_ptr);
}
@@ -1989,6 +1992,10 @@
png_alloc_size_t buf_size;
int usr_pixel_depth;
+#ifdef PNG_WRITE_FILTER_SUPPORTED
+ png_byte filters;
+#endif
+
png_debug(1, "in png_write_start_row");
usr_pixel_depth = png_ptr->usr_channels * png_ptr->usr_bit_depth;
@@ -1999,50 +2006,54 @@
png_ptr->maximum_pixel_depth = (png_byte)usr_pixel_depth;
/* Set up row buffer */
- png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, buf_size);
+ png_ptr->row_buf = png_voidcast(png_bytep, png_malloc(png_ptr, buf_size));
png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE;
#ifdef PNG_WRITE_FILTER_SUPPORTED
- /* Set up filtering buffer, if using this filter */
- if (png_ptr->do_filter & PNG_FILTER_SUB)
- {
- png_ptr->sub_row = (png_bytep)png_malloc(png_ptr, png_ptr->rowbytes + 1);
-
- png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB;
- }
-
- /* We only need to keep the previous row if we are using one of these. */
- if ((png_ptr->do_filter &
- (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH)) != 0)
+ filters = png_ptr->do_filter;
+
+ if (png_ptr->height == 1)
+ filters &= 0xff & ~(PNG_FILTER_UP|PNG_FILTER_AVG|PNG_FILTER_PAETH);
+
+ if (png_ptr->width == 1)
+ filters &= 0xff & ~(PNG_FILTER_SUB|PNG_FILTER_AVG|PNG_FILTER_PAETH);
+
+ if (filters == 0)
+ filters = PNG_FILTER_NONE;
+
+ png_ptr->do_filter = filters;
+
+ if (((filters & (PNG_FILTER_SUB | PNG_FILTER_UP | PNG_FILTER_AVG |
+ PNG_FILTER_PAETH)) != 0) && png_ptr->try_row == NULL)
{
- /* Set up previous row buffer */
- png_ptr->prev_row = (png_bytep)png_calloc(png_ptr, buf_size);
-
- if ((png_ptr->do_filter & PNG_FILTER_UP) != 0)
- {
- png_ptr->up_row = (png_bytep)png_malloc(png_ptr,
- png_ptr->rowbytes + 1);
-
- png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
- }
-
- if ((png_ptr->do_filter & PNG_FILTER_AVG) != 0)
- {
- png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
- png_ptr->rowbytes + 1);
-
- png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
- }
-
- if ((png_ptr->do_filter & PNG_FILTER_PAETH) != 0)
- {
- png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr,
- png_ptr->rowbytes + 1);
-
- png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
- }
+ int num_filters = 0;
+
+ png_ptr->try_row = png_voidcast(png_bytep, png_malloc(png_ptr, buf_size));
+
+ if (filters & PNG_FILTER_SUB)
+ num_filters++;
+
+ if (filters & PNG_FILTER_UP)
+ num_filters++;
+
+ if (filters & PNG_FILTER_AVG)
+ num_filters++;
+
+ if (filters & PNG_FILTER_PAETH)
+ num_filters++;
+
+ if (num_filters > 1)
+ png_ptr->tst_row = png_voidcast(png_bytep, png_malloc(png_ptr,
+ buf_size));
}
+
+ /* We only need to keep the previous row if we are using one of the following
+ * filters.
+ */
+ if ((filters & (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH)) != 0)
+ png_ptr->prev_row = png_voidcast(png_bytep,
+ png_calloc(png_ptr, buf_size));
#endif /* WRITE_FILTER */
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
@@ -2188,7 +2199,7 @@
{
png_bytep sp;
png_bytep dp;
- int shift;
+ unsigned int shift;
int d;
int value;
png_uint_32 i;
@@ -2226,7 +2237,7 @@
{
png_bytep sp;
png_bytep dp;
- int shift;
+ unsigned int shift;
int d;
int value;
png_uint_32 i;
@@ -2263,7 +2274,7 @@
{
png_bytep sp;
png_bytep dp;
- int shift;
+ unsigned int shift;
int d;
int value;
png_uint_32 i;
@@ -2338,50 +2349,181 @@
}
#endif
+
/* This filters the row, chooses which filter to use, if it has not already
* been specified by the application, and then writes the row out with the
* chosen filter.
*/
-static void
+static void /* PRIVATE */
png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
png_size_t row_bytes);
-#define PNG_MAXSUM (((png_uint_32)(-1)) >> 1)
-#define PNG_HISHIFT 10
-#define PNG_LOMASK ((png_uint_32)0xffffL)
-#define PNG_HIMASK ((png_uint_32)(~PNG_LOMASK >> PNG_HISHIFT))
+#ifdef PNG_WRITE_FILTER_SUPPORTED
+static png_size_t /* PRIVATE */
+png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp,
+ const png_size_t row_bytes, const png_size_t lmins)
+{
+ png_bytep rp, dp, lp;
+ png_size_t i;
+ png_size_t sum = 0;
+ int v;
+
+ png_ptr->try_row[0] = PNG_FILTER_VALUE_SUB;
+
+ for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1; i < bpp;
+ i++, rp++, dp++)
+ {
+ v = *dp = *rp;
+ sum += (v < 128) ? v : 256 - v;
+ }
+
+ for (lp = png_ptr->row_buf + 1; i < row_bytes;
+ i++, rp++, lp++, dp++)
+ {
+ v = *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
+ sum += (v < 128) ? v : 256 - v;
+
+ if (sum > lmins) /* We are already worse, don't continue. */
+ break;
+ }
+
+ return (sum);
+}
+
+static png_size_t /* PRIVATE */
+png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes,
+ const png_size_t lmins)
+{
+ png_bytep rp, dp, pp;
+ png_size_t i;
+ png_size_t sum = 0;
+ int v;
+
+ png_ptr->try_row[0] = PNG_FILTER_VALUE_UP;
+
+ for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
+ pp = png_ptr->prev_row + 1; i < row_bytes;
+ i++, rp++, pp++, dp++)
+ {
+ v = *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
+ sum += (v < 128) ? v : 256 - v;
+
+ if (sum > lmins) /* We are already worse, don't continue. */
+ break;
+ }
+
+ return (sum);
+}
+
+static png_size_t /* PRIVATE */
+png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp,
+ const png_size_t row_bytes, const png_size_t lmins)
+{
+ png_bytep rp, dp, pp, lp;
+ png_uint_32 i;
+ png_size_t sum = 0;
+ int v;
+
+ png_ptr->try_row[0] = PNG_FILTER_VALUE_AVG;
+
+ for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
+ pp = png_ptr->prev_row + 1; i < bpp; i++)
+ {
+ v = *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
+
+ sum += (v < 128) ? v : 256 - v;
+ }
+
+ for (lp = png_ptr->row_buf + 1; i < row_bytes; i++)
+ {
+ v = *dp++ = (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2))
+ & 0xff);
+
+ sum += (v < 128) ? v : 256 - v;
+
+ if (sum > lmins) /* We are already worse, don't continue. */
+ break;
+ }
+
+ return (sum);
+}
+
+static png_size_t /* PRIVATE */
+png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
+ const png_size_t row_bytes, const png_size_t lmins)
+{
+ png_bytep rp, dp, pp, cp, lp;
+ png_size_t i;
+ png_size_t sum = 0;
+ int v;
+
+ png_ptr->try_row[0] = PNG_FILTER_VALUE_PAETH;
+
+ for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
+ pp = png_ptr->prev_row + 1; i < bpp; i++)
+ {
+ v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
+
+ sum += (v < 128) ? v : 256 - v;
+ }
+
+ for (lp = png_ptr->row_buf + 1, cp = png_ptr->prev_row + 1; i < row_bytes;
+ i++)
+ {
+ int a, b, c, pa, pb, pc, p;
+
+ b = *pp++;
+ c = *cp++;
+ a = *lp++;
+
+ p = b - c;
+ pc = a - c;
+
+#ifdef PNG_USE_ABS
+ pa = abs(p);
+ pb = abs(pc);
+ pc = abs(p + pc);
+#else
+ pa = p < 0 ? -p : p;
+ pb = pc < 0 ? -pc : pc;
+ pc = (p + pc) < 0 ? -(p + pc) : p + pc;
+#endif
+
+ p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
+
+ v = *dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
+
+ sum += (v < 128) ? v : 256 - v;
+
+ if (sum > lmins) /* We are already worse, don't continue. */
+ break;
+ }
+
+ return (sum);
+}
+#endif /* WRITE_FILTER */
+
void /* PRIVATE */
png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
{
- png_bytep best_row;
-#ifdef PNG_WRITE_FILTER_SUPPORTED
- png_bytep prev_row, row_buf;
- png_uint_32 mins, bpp;
+#ifndef PNG_WRITE_FILTER_SUPPORTED
+ png_write_filtered_row(png_ptr, png_ptr->row_buf, row_info->rowbytes+1);
+#else
png_byte filter_to_do = png_ptr->do_filter;
+ png_bytep row_buf;
+ png_bytep best_row;
+ png_uint_32 bpp;
+ png_size_t mins;
png_size_t row_bytes = row_info->rowbytes;
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
- int num_p_filters = png_ptr->num_prev_filters;
-#endif
png_debug(1, "in png_write_find_filter");
-#ifndef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
- if (png_ptr->row_number == 0 && filter_to_do == PNG_ALL_FILTERS)
- {
- /* These will never be selected so we need not test them. */
- filter_to_do &= ~(PNG_FILTER_UP | PNG_FILTER_PAETH);
- }
-#endif
-
/* Find out how many bytes offset each pixel is */
bpp = (row_info->pixel_depth + 7) >> 3;
- prev_row = png_ptr->prev_row;
-#endif
- best_row = png_ptr->row_buf;
-#ifdef PNG_WRITE_FILTER_SUPPORTED
- row_buf = best_row;
- mins = PNG_MAXSUM;
+ row_buf = png_ptr->row_buf;
+ mins = PNG_SIZE_MAX - 256/* so we can detect potential overflow of the
+ running sum */;
/* The prediction method we use is to find which method provides the
* smallest value when summing the absolute values of the distances
@@ -2411,57 +2553,37 @@
/* We don't need to test the 'no filter' case if this is the only filter
* that has been chosen, as it doesn't actually do anything to the data.
*/
+ best_row = png_ptr->row_buf;
+
+
if ((filter_to_do & PNG_FILTER_NONE) != 0 && filter_to_do != PNG_FILTER_NONE)
{
png_bytep rp;
- png_uint_32 sum = 0;
+ png_size_t sum = 0;
png_size_t i;
int v;
- for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++)
+ if (PNG_SIZE_MAX/128 <= row_bytes)
{
- v = *rp;
- sum += (v < 128) ? v : 256 - v;
- }
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
- if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
- {
- png_uint_32 sumhi, sumlo;
- int j;
- sumlo = sum & PNG_LOMASK;
- sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; /* Gives us some footroom */
-
- /* Reduce the sum if we match any of the previous rows */
- for (j = 0; j < num_p_filters; j++)
+ for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++)
{
- if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_NONE)
- {
- sumlo = (sumlo * png_ptr->filter_weights[j]) >>
- PNG_WEIGHT_SHIFT;
-
- sumhi = (sumhi * png_ptr->filter_weights[j]) >>
- PNG_WEIGHT_SHIFT;
- }
+ /* Check for overflow */
+ if (sum > PNG_SIZE_MAX/128 - 256)
+ break;
+
+ v = *rp;
+ sum += (v < 128) ? v : 256 - v;
}
-
- /* Factor in the cost of this filter (this is here for completeness,
- * but it makes no sense to have a "cost" for the NONE filter, as
- * it has the minimum possible computational cost - none).
- */
- sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_NONE]) >>
- PNG_COST_SHIFT;
-
- sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_NONE]) >>
- PNG_COST_SHIFT;
-
- if (sumhi > PNG_HIMASK)
- sum = PNG_MAXSUM;
-
- else
- sum = (sumhi << PNG_HISHIFT) + sumlo;
}
-#endif
+ else /* Overflow is not possible */
+ {
+ for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++)
+ {
+ v = *rp;
+ sum += (v < 128) ? v : 256 - v;
+ }
+ }
+
mins = sum;
}
@@ -2469,553 +2591,109 @@
if (filter_to_do == PNG_FILTER_SUB)
/* It's the only filter so no testing is needed */
{
- png_bytep rp, lp, dp;
- png_size_t i;
-
- for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp;
- i++, rp++, dp++)
- {
- *dp = *rp;
- }
-
- for (lp = row_buf + 1; i < row_bytes;
- i++, rp++, lp++, dp++)
- {
- *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
- }
-
- best_row = png_ptr->sub_row;
+ (void) png_setup_sub_row(png_ptr, bpp, row_bytes, mins);
+ best_row = png_ptr->try_row;
}
else if ((filter_to_do & PNG_FILTER_SUB) != 0)
{
- png_bytep rp, dp, lp;
- png_uint_32 sum = 0, lmins = mins;
- png_size_t i;
- int v;
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
- /* We temporarily increase the "minimum sum" by the factor we
- * would reduce the sum of this filter, so that we can do the
- * early exit comparison without scaling the sum each time.
- */
- if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
- {
- int j;
- png_uint_32 lmhi, lmlo;
- lmlo = lmins & PNG_LOMASK;
- lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
-
- for (j = 0; j < num_p_filters; j++)
- {
- if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_SUB)
- {
- lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
- PNG_WEIGHT_SHIFT;
-
- lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
- PNG_WEIGHT_SHIFT;
- }
- }
-
- lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
- PNG_COST_SHIFT;
-
- lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
- PNG_COST_SHIFT;
-
- if (lmhi > PNG_HIMASK)
- lmins = PNG_MAXSUM;
-
- else
- lmins = (lmhi << PNG_HISHIFT) + lmlo;
- }
-#endif
-
- for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp;
- i++, rp++, dp++)
- {
- v = *dp = *rp;
-
- sum += (v < 128) ? v : 256 - v;
- }
-
- for (lp = row_buf + 1; i < row_bytes;
- i++, rp++, lp++, dp++)
- {
- v = *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
-
- sum += (v < 128) ? v : 256 - v;
-
- if (sum > lmins) /* We are already worse, don't continue. */
- break;
- }
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
- if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
- {
- int j;
- png_uint_32 sumhi, sumlo;
- sumlo = sum & PNG_LOMASK;
- sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
-
- for (j = 0; j < num_p_filters; j++)
- {
- if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_SUB)
- {
- sumlo = (sumlo * png_ptr->inv_filter_weights[j]) >>
- PNG_WEIGHT_SHIFT;
-
- sumhi = (sumhi * png_ptr->inv_filter_weights[j]) >>
- PNG_WEIGHT_SHIFT;
- }
- }
-
- sumlo = (sumlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
- PNG_COST_SHIFT;
-
- sumhi = (sumhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
- PNG_COST_SHIFT;
-
- if (sumhi > PNG_HIMASK)
- sum = PNG_MAXSUM;
-
- else
- sum = (sumhi << PNG_HISHIFT) + sumlo;
- }
-#endif
+ png_size_t sum;
+ png_size_t lmins = mins;
+
+ sum = png_setup_sub_row(png_ptr, bpp, row_bytes, lmins);
if (sum < mins)
{
mins = sum;
- best_row = png_ptr->sub_row;
+ best_row = png_ptr->try_row;
+ if (png_ptr->tst_row != NULL)
+ {
+ png_ptr->try_row = png_ptr->tst_row;
+ png_ptr->tst_row = best_row;
+ }
}
}
/* Up filter */
if (filter_to_do == PNG_FILTER_UP)
{
- png_bytep rp, dp, pp;
- png_size_t i;
-
- for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1,
- pp = prev_row + 1; i < row_bytes;
- i++, rp++, pp++, dp++)
- {
- *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
- }
-
- best_row = png_ptr->up_row;
+ (void) png_setup_up_row(png_ptr, row_bytes, mins);
+ best_row = png_ptr->try_row;
}
else if ((filter_to_do & PNG_FILTER_UP) != 0)
{
- png_bytep rp, dp, pp;
- png_uint_32 sum = 0, lmins = mins;
- png_size_t i;
- int v;
-
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
- if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
- {
- int j;
- png_uint_32 lmhi, lmlo;
- lmlo = lmins & PNG_LOMASK;
- lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
-
- for (j = 0; j < num_p_filters; j++)
- {
- if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_UP)
- {
- lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
- PNG_WEIGHT_SHIFT;
-
- lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
- PNG_WEIGHT_SHIFT;
- }
- }
-
- lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_UP]) >>
- PNG_COST_SHIFT;
-
- lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_UP]) >>
- PNG_COST_SHIFT;
-
- if (lmhi > PNG_HIMASK)
- lmins = PNG_MAXSUM;
-
- else
- lmins = (lmhi << PNG_HISHIFT) + lmlo;
- }
-#endif
-
- for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1,
- pp = prev_row + 1; i < row_bytes; i++)
- {
- v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
-
- sum += (v < 128) ? v : 256 - v;
-
- if (sum > lmins) /* We are already worse, don't continue. */
- break;
- }
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
- if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
- {
- int j;
- png_uint_32 sumhi, sumlo;
- sumlo = sum & PNG_LOMASK;
- sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
-
- for (j = 0; j < num_p_filters; j++)
- {
- if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_UP)
- {
- sumlo = (sumlo * png_ptr->filter_weights[j]) >>
- PNG_WEIGHT_SHIFT;
-
- sumhi = (sumhi * png_ptr->filter_weights[j]) >>
- PNG_WEIGHT_SHIFT;
- }
- }
-
- sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_UP]) >>
- PNG_COST_SHIFT;
-
- sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_UP]) >>
- PNG_COST_SHIFT;
-
- if (sumhi > PNG_HIMASK)
- sum = PNG_MAXSUM;
-
- else
- sum = (sumhi << PNG_HISHIFT) + sumlo;
- }
-#endif
+ png_size_t sum;
+ png_size_t lmins = mins;
+
+ sum = png_setup_up_row(png_ptr, row_bytes, lmins);
if (sum < mins)
{
mins = sum;
- best_row = png_ptr->up_row;
+ best_row = png_ptr->try_row;
+ if (png_ptr->tst_row != NULL)
+ {
+ png_ptr->try_row = png_ptr->tst_row;
+ png_ptr->tst_row = best_row;
+ }
}
}
/* Avg filter */
if (filter_to_do == PNG_FILTER_AVG)
{
- png_bytep rp, dp, pp, lp;
- png_uint_32 i;
-
- for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
- pp = prev_row + 1; i < bpp; i++)
- {
- *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
- }
-
- for (lp = row_buf + 1; i < row_bytes; i++)
- {
- *dp++ = (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2))
- & 0xff);
- }
- best_row = png_ptr->avg_row;
+ (void) png_setup_avg_row(png_ptr, bpp, row_bytes, mins);
+ best_row = png_ptr->try_row;
}
else if ((filter_to_do & PNG_FILTER_AVG) != 0)
{
- png_bytep rp, dp, pp, lp;
- png_uint_32 sum = 0, lmins = mins;
- png_size_t i;
- int v;
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
- if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
- {
- int j;
- png_uint_32 lmhi, lmlo;
- lmlo = lmins & PNG_LOMASK;
- lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
-
- for (j = 0; j < num_p_filters; j++)
- {
- if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_AVG)
- {
- lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
- PNG_WEIGHT_SHIFT;
-
- lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
- PNG_WEIGHT_SHIFT;
- }
- }
-
- lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_AVG]) >>
- PNG_COST_SHIFT;
-
- lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_AVG]) >>
- PNG_COST_SHIFT;
-
- if (lmhi > PNG_HIMASK)
- lmins = PNG_MAXSUM;
-
- else
- lmins = (lmhi << PNG_HISHIFT) + lmlo;
- }
-#endif
-
- for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
- pp = prev_row + 1; i < bpp; i++)
- {
- v = *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
-
- sum += (v < 128) ? v : 256 - v;
- }
-
- for (lp = row_buf + 1; i < row_bytes; i++)
- {
- v = *dp++ =
- (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2)) & 0xff);
-
- sum += (v < 128) ? v : 256 - v;
-
- if (sum > lmins) /* We are already worse, don't continue. */
- break;
- }
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
- if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
- {
- int j;
- png_uint_32 sumhi, sumlo;
- sumlo = sum & PNG_LOMASK;
- sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
-
- for (j = 0; j < num_p_filters; j++)
- {
- if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_NONE)
- {
- sumlo = (sumlo * png_ptr->filter_weights[j]) >>
- PNG_WEIGHT_SHIFT;
-
- sumhi = (sumhi * png_ptr->filter_weights[j]) >>
- PNG_WEIGHT_SHIFT;
- }
- }
-
- sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_AVG]) >>
- PNG_COST_SHIFT;
-
- sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_AVG]) >>
- PNG_COST_SHIFT;
-
- if (sumhi > PNG_HIMASK)
- sum = PNG_MAXSUM;
-
- else
- sum = (sumhi << PNG_HISHIFT) + sumlo;
- }
-#endif
+ png_size_t sum;
+ png_size_t lmins = mins;
+
+ sum= png_setup_avg_row(png_ptr, bpp, row_bytes, lmins);
if (sum < mins)
{
mins = sum;
- best_row = png_ptr->avg_row;
+ best_row = png_ptr->try_row;
+ if (png_ptr->tst_row != NULL)
+ {
+ png_ptr->try_row = png_ptr->tst_row;
+ png_ptr->tst_row = best_row;
+ }
}
}
/* Paeth filter */
if ((filter_to_do == PNG_FILTER_PAETH) != 0)
{
- png_bytep rp, dp, pp, cp, lp;
- png_size_t i;
-
- for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
- pp = prev_row + 1; i < bpp; i++)
- {
- *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
- }
-
- for (lp = row_buf + 1, cp = prev_row + 1; i < row_bytes; i++)
- {
- int a, b, c, pa, pb, pc, p;
-
- b = *pp++;
- c = *cp++;
- a = *lp++;
-
- p = b - c;
- pc = a - c;
-
-#ifdef PNG_USE_ABS
- pa = abs(p);
- pb = abs(pc);
- pc = abs(p + pc);
-#else
- pa = p < 0 ? -p : p;
- pb = pc < 0 ? -pc : pc;
- pc = (p + pc) < 0 ? -(p + pc) : p + pc;
-#endif
-
- p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
-
- *dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
- }
- best_row = png_ptr->paeth_row;
+ (void) png_setup_paeth_row(png_ptr, bpp, row_bytes, mins);
+ best_row = png_ptr->try_row;
}
else if ((filter_to_do & PNG_FILTER_PAETH) != 0)
{
- png_bytep rp, dp, pp, cp, lp;
- png_uint_32 sum = 0, lmins = mins;
- png_size_t i;
- int v;
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
- if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
- {
- int j;
- png_uint_32 lmhi, lmlo;
- lmlo = lmins & PNG_LOMASK;
- lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
-
- for (j = 0; j < num_p_filters; j++)
- {
- if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_PAETH)
- {
- lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
- PNG_WEIGHT_SHIFT;
-
- lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
- PNG_WEIGHT_SHIFT;
- }
- }
-
- lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_PAETH]) >>
- PNG_COST_SHIFT;
-
- lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_PAETH]) >>
- PNG_COST_SHIFT;
-
- if (lmhi > PNG_HIMASK)
- lmins = PNG_MAXSUM;
-
- else
- lmins = (lmhi << PNG_HISHIFT) + lmlo;
- }
-#endif
-
- for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
- pp = prev_row + 1; i < bpp; i++)
- {
- v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
-
- sum += (v < 128) ? v : 256 - v;
- }
-
- for (lp = row_buf + 1, cp = prev_row + 1; i < row_bytes; i++)
- {
- int a, b, c, pa, pb, pc, p;
-
- b = *pp++;
- c = *cp++;
- a = *lp++;
-
-#ifndef PNG_SLOW_PAETH
- p = b - c;
- pc = a - c;
-#ifdef PNG_USE_ABS
- pa = abs(p);
- pb = abs(pc);
- pc = abs(p + pc);
-#else
- pa = p < 0 ? -p : p;
- pb = pc < 0 ? -pc : pc;
- pc = (p + pc) < 0 ? -(p + pc) : p + pc;
-#endif
- p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
-#else /* SLOW_PAETH */
- p = a + b - c;
- pa = abs(p - a);
- pb = abs(p - b);
- pc = abs(p - c);
-
- if (pa <= pb && pa <= pc)
- p = a;
-
- else if (pb <= pc)
- p = b;
-
- else
- p = c;
-#endif /* SLOW_PAETH */
-
- v = *dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
-
- sum += (v < 128) ? v : 256 - v;
-
- if (sum > lmins) /* We are already worse, don't continue. */
- break;
- }
-
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
- if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
- {
- int j;
- png_uint_32 sumhi, sumlo;
- sumlo = sum & PNG_LOMASK;
- sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
-
- for (j = 0; j < num_p_filters; j++)
- {
- if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_PAETH)
- {
- sumlo = (sumlo * png_ptr->filter_weights[j]) >>
- PNG_WEIGHT_SHIFT;
-
- sumhi = (sumhi * png_ptr->filter_weights[j]) >>
- PNG_WEIGHT_SHIFT;
- }
- }
-
- sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_PAETH]) >>
- PNG_COST_SHIFT;
-
- sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_PAETH]) >>
- PNG_COST_SHIFT;
-
- if (sumhi > PNG_HIMASK)
- sum = PNG_MAXSUM;
-
- else
- sum = (sumhi << PNG_HISHIFT) + sumlo;
- }
-#endif
+ png_size_t sum;
+ png_size_t lmins = mins;
+
+ sum = png_setup_paeth_row(png_ptr, bpp, row_bytes, lmins);
if (sum < mins)
{
- best_row = png_ptr->paeth_row;
+ best_row = png_ptr->try_row;
+ if (png_ptr->tst_row != NULL)
+ {
+ png_ptr->try_row = png_ptr->tst_row;
+ png_ptr->tst_row = best_row;
+ }
}
}
-#endif /* WRITE_FILTER */
/* Do the actual writing of the filtered row data from the chosen filter. */
png_write_filtered_row(png_ptr, best_row, row_info->rowbytes+1);
-#ifdef PNG_WRITE_FILTER_SUPPORTED
-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
- /* Save the type of filter we picked this time for future calculations */
- if (png_ptr->num_prev_filters > 0)
- {
- int j;
-
- for (j = 1; j < num_p_filters; j++)
- {
- png_ptr->prev_filters[j] = png_ptr->prev_filters[j - 1];
- }
-
- png_ptr->prev_filters[j] = best_row[0];
- }
-#endif
#endif /* WRITE_FILTER */
}
@@ -3031,6 +2709,7 @@
png_compress_IDAT(png_ptr, filtered_row, full_row_length, Z_NO_FLUSH);
+#ifdef PNG_WRITE_FILTER_SUPPORTED
/* Swap the current and previous rows */
if (png_ptr->prev_row != NULL)
{
@@ -3040,6 +2719,7 @@
png_ptr->prev_row = png_ptr->row_buf;
png_ptr->row_buf = tptr;
}
+#endif /* WRITE_FILTER */
/* Finish row - updates counters and flushes zlib if last row */
png_write_finish_row(png_ptr);
--- a/jdk/src/java.desktop/share/native/libsplashscreen/splashscreen_png.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/splashscreen_png.c Thu Jan 21 10:17:21 2016 -0800
@@ -103,6 +103,7 @@
if (png_get_gAMA(png_ptr, info_ptr, &gamma))
png_set_gamma(png_ptr, 2.2, gamma);
+ png_set_interlace_handling(png_ptr);
png_read_update_info(png_ptr, info_ptr);
rowbytes = png_get_rowbytes(png_ptr, info_ptr);
--- a/jdk/src/java.desktop/unix/native/common/awt/fontpath.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.desktop/unix/native/common/awt/fontpath.c Thu Jan 21 10:17:21 2016 -0800
@@ -1156,8 +1156,8 @@
continue;
}
pattern = (*FcNameParse)((FcChar8 *)fcName);
+ (*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
if (pattern == NULL) {
- (*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
closeFontConfig(libfontconfig, JNI_FALSE);
return;
}
@@ -1175,7 +1175,6 @@
fontset = (*FcFontSort)(NULL, pattern, FcTrue, NULL, &result);
if (fontset == NULL) {
(*FcPatternDestroy)(pattern);
- (*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
closeFontConfig(libfontconfig, JNI_FALSE);
return;
}
@@ -1207,7 +1206,6 @@
}
(*FcPatternDestroy)(pattern);
(*FcFontSetDestroy)(fontset);
- (*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
closeFontConfig(libfontconfig, JNI_FALSE);
return;
}
@@ -1249,8 +1247,6 @@
free(file);
(*FcPatternDestroy)(pattern);
(*FcFontSetDestroy)(fontset);
- (*env)->ReleaseStringUTFChars(env,
- fcNameStr, (const char*)fcName);
closeFontConfig(libfontconfig, JNI_FALSE);
return;
}
@@ -1298,6 +1294,16 @@
if (includeFallbacks) {
fcFontArr =
(*env)->NewObjectArray(env, fontCount, fcFontClass, NULL);
+ if (IS_NULL(fcFontArr)) {
+ free(family);
+ free(fullname);
+ free(styleStr);
+ free(file);
+ (*FcPatternDestroy)(pattern);
+ (*FcFontSetDestroy)(fontset);
+ closeFontConfig(libfontconfig, JNI_FALSE);
+ return;
+ }
(*env)->SetObjectField(env,fcCompFontObj, fcAllFontsID, fcFontArr);
}
fn=0;
@@ -1306,18 +1312,23 @@
if (family[j] != NULL) {
jobject fcFont =
(*env)->NewObject(env, fcFontClass, fcFontCons);
+ if (IS_NULL(fcFont)) break;
jstr = (*env)->NewStringUTF(env, (const char*)family[j]);
+ if (IS_NULL(jstr)) break;
(*env)->SetObjectField(env, fcFont, familyNameID, jstr);
if (file[j] != NULL) {
jstr = (*env)->NewStringUTF(env, (const char*)file[j]);
+ if (IS_NULL(jstr)) break;
(*env)->SetObjectField(env, fcFont, fontFileID, jstr);
}
if (styleStr[j] != NULL) {
jstr = (*env)->NewStringUTF(env, (const char*)styleStr[j]);
+ if (IS_NULL(jstr)) break;
(*env)->SetObjectField(env, fcFont, styleNameID, jstr);
}
if (fullname[j] != NULL) {
jstr = (*env)->NewStringUTF(env, (const char*)fullname[j]);
+ if (IS_NULL(jstr)) break;
(*env)->SetObjectField(env, fcFont, fullNameID, jstr);
}
if (fn==0) {
@@ -1331,7 +1342,6 @@
}
}
}
- (*env)->ReleaseStringUTFChars (env, fcNameStr, (const char*)fcName);
(*FcFontSetDestroy)(fontset);
(*FcPatternDestroy)(pattern);
free(family);
--- a/jdk/src/java.logging/share/classes/java/util/logging/FileHandler.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.logging/share/classes/java/util/logging/FileHandler.java Thu Jan 21 10:17:21 2016 -0800
@@ -423,7 +423,7 @@
* @exception IllegalArgumentException if {@code limit < 0}, or {@code count < 1}.
* @exception IllegalArgumentException if pattern is an empty string
*
- * @since 1.9
+ * @since 9
*
*/
public FileHandler(String pattern, long limit, int count, boolean append)
--- a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java Thu Jan 21 10:17:21 2016 -0800
@@ -2548,7 +2548,7 @@
* caller does not have LoggingPermission("control").
* @throws NullPointerException if the listener is null.
*
- * @since 1.9
+ * @since 9
*/
public LogManager addConfigurationListener(Runnable listener) {
final Runnable r = Objects.requireNonNull(listener);
@@ -2575,7 +2575,7 @@
* @throws SecurityException if a security manager exists and if the
* caller does not have LoggingPermission("control").
*
- * @since 1.9
+ * @since 9
*/
public void removeConfigurationListener(Runnable listener) {
final Runnable key = Objects.requireNonNull(listener);
--- a/jdk/src/java.logging/share/classes/java/util/logging/LogRecord.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LogRecord.java Thu Jan 21 10:17:21 2016 -0800
@@ -138,7 +138,7 @@
/**
* Event time.
- * @since 1.9
+ * @since 9
*/
private Instant instant;
@@ -158,7 +158,7 @@
* The event time instant can be reconstructed using
* <code>Instant.ofEpochSecond(millis/1000, (millis % 1000) * 1000_000 + nanoAdjustment)</code>
* <p>
- * Since: 1.9
+ * Since: 9
* @serialField thrown Throwable The Throwable (if any) associated with log
* message
* @serialField loggerName String Name of the source Logger
@@ -207,7 +207,7 @@
* The sequence property will be initialized with a new unique value.
* These sequence values are allocated in increasing order within a VM.
* <p>
- * Since JDK 1.9, the event time is represented by an {@link Instant}.
+ * Since JDK 9, the event time is represented by an {@link Instant}.
* The instant property will be initialized to the {@linkplain
* Instant#now() current instant}, using the best available
* {@linkplain Clock#systemUTC() clock} on the system.
@@ -505,7 +505,7 @@
*
* @return the instant that the event occurred.
*
- * @since 1.9
+ * @since 9
*/
public Instant getInstant() {
return instant;
@@ -525,7 +525,7 @@
* @throws ArithmeticException if numeric overflow would occur while
* calling {@link Instant#toEpochMilli() instant.toEpochMilli()}.
*
- * @since 1.9
+ * @since 9
*/
public void setInstant(Instant instant) {
instant.toEpochMilli();
--- a/jdk/src/java.logging/share/classes/java/util/logging/Logger.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.logging/share/classes/java/util/logging/Logger.java Thu Jan 21 10:17:21 2016 -0800
@@ -1300,7 +1300,7 @@
* can be {@code null}.
* @param msg The string message (or a key in the message catalog)
* @param params Parameters to the message (optional, may be none).
- * @since 1.9
+ * @since 9
*/
public void logrb(Level level, ResourceBundle bundle, String msg, Object... params) {
if (!isLoggable(level)) {
@@ -1417,7 +1417,7 @@
* can be {@code null}.
* @param msg The string message (or a key in the message catalog)
* @param thrown Throwable associated with the log message.
- * @since 1.9
+ * @since 9
*/
public void logrb(Level level, ResourceBundle bundle, String msg,
Throwable thrown) {
--- a/jdk/src/java.logging/share/classes/sun/util/logging/internal/package-info.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.logging/share/classes/sun/util/logging/internal/package-info.java Thu Jan 21 10:17:21 2016 -0800
@@ -50,6 +50,6 @@
* @see sun.util.logging.PlatformLogger.Bridge
* @see jdk.internal.logger
*
- * @since 1.9
+ * @since 9
*/
package sun.util.logging.internal;
--- a/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java Thu Jan 21 10:17:21 2016 -0800
@@ -590,7 +590,7 @@
* @return {@code true} if the thread is a daemon thread,
* {@code false} otherwise.
* @see Thread#isDaemon
- * @since 1.9
+ * @since 9
*/
public boolean isDaemon() {
return daemon;
@@ -602,7 +602,7 @@
*
* @return The priority of the thread associated with this
* {@code ThreadInfo}.
- * @since 1.9
+ * @since 9
*/
public int getPriority() {
return priority;
--- a/jdk/src/java.management/share/classes/javax/management/ConstructorParameters.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.management/share/classes/javax/management/ConstructorParameters.java Thu Jan 21 10:17:21 2016 -0800
@@ -62,7 +62,7 @@
* the JMX introspection will give an absolute precedence to the latter one.
* </p>
*
- * @since 1.9
+ * @since 9
*/
@Documented @Target(CONSTRUCTOR) @Retention(RUNTIME)
public @interface ConstructorParameters {
--- a/jdk/src/java.management/share/classes/javax/management/loading/MLetParser.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.management/share/classes/javax/management/loading/MLetParser.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -37,6 +37,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.logging.Level;
@@ -142,7 +143,7 @@
skipSpace(in);
val = buf.toString();
}
- atts.put(att.toLowerCase(), val);
+ atts.put(att.toLowerCase(Locale.ENGLISH), val);
skipSpace(in);
}
return atts;
--- a/jdk/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, 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
@@ -45,6 +45,7 @@
import java.security.AccessController;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
@@ -283,7 +284,7 @@
throw new RuntimeOperationsException(iae, msg);
}
- final String lowerInStr = inStr.toLowerCase();
+ final String lowerInStr = inStr.toLowerCase(Locale.ENGLISH);
if (!lowerInStr.startsWith("<descriptor>")
|| !lowerInStr.endsWith("</descriptor>")) {
throw new XMLParseException("No <descriptor>, </descriptor> pair");
--- a/jdk/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, 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
@@ -38,6 +38,7 @@
import java.net.MalformedURLException;
import java.net.UnknownHostException;
import java.util.BitSet;
+import java.util.Locale;
import java.util.StringTokenizer;
/**
@@ -168,7 +169,7 @@
final int protoStart = requiredPrefixLength;
final int protoEnd = indexOf(serviceURL, ':', protoStart);
this.protocol =
- serviceURL.substring(protoStart, protoEnd).toLowerCase();
+ serviceURL.substring(protoStart, protoEnd).toLowerCase(Locale.ENGLISH);
if (!serviceURL.regionMatches(protoEnd, "://", 0, 3)) {
throw new MalformedURLException("Missing \"://\" after " +
@@ -328,7 +329,7 @@
throw new MalformedURLException("More than one [[...]]");
}
- this.protocol = protocol.toLowerCase();
+ this.protocol = protocol.toLowerCase(Locale.ENGLISH);
this.host = host;
this.port = port;
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java Thu Jan 21 10:17:21 2016 -0800
@@ -359,7 +359,6 @@
"connectionId=" + connectionId
+", className=" + className
+", name=" + name
- +", params=" + objects(values)
+", signature=" + strings(signature));
return (ObjectInstance)
@@ -425,7 +424,6 @@
+", className=" + className
+", name=" + name
+", loaderName=" + loaderName
- +", params=" + objects(values)
+", signature=" + strings(signature));
return (ObjectInstance)
@@ -717,7 +715,7 @@
if (debug) logger.debug("setAttribute",
"connectionId=" + connectionId
+", name="+name
- +", attribute="+attr);
+ +", attribute name="+attr.getName());
doPrivilegedOperation(
SET_ATTRIBUTE,
@@ -768,7 +766,7 @@
if (debug) logger.debug("setAttributes",
"connectionId=" + connectionId
+", name="+name
- +", attributes="+attrlist);
+ +", attribute names="+RMIConnector.getAttributesNames(attrlist));
return (AttributeList)
doPrivilegedOperation(
@@ -823,7 +821,6 @@
"connectionId=" + connectionId
+", name="+name
+", operationName="+operationName
- +", params="+objects(values)
+", signature="+strings(signature));
return
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java Thu Jan 21 10:17:21 2016 -0800
@@ -65,6 +65,7 @@
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
+import java.util.stream.Collectors;
import javax.management.Attribute;
import javax.management.AttributeList;
import javax.management.AttributeNotFoundException;
@@ -689,9 +690,7 @@
if (logger.debugOn())
logger.debug("createMBean(String,ObjectName,Object[],String[])",
"className=" + className + ", name="
- + name + ", params="
- + objects(params) + ", signature="
- + strings(signature));
+ + name + ", signature=" + strings(signature));
final MarshalledObject<Object[]> sParams =
new MarshalledObject<Object[]>(params);
@@ -730,8 +729,7 @@
if (logger.debugOn()) logger.debug(
"createMBean(String,ObjectName,ObjectName,Object[],String[])",
"className=" + className + ", name=" + name + ", loaderName="
- + loaderName + ", params=" + objects(params)
- + ", signature=" + strings(signature));
+ + loaderName + ", signature=" + strings(signature));
final MarshalledObject<Object[]> sParams =
new MarshalledObject<Object[]>(params);
@@ -931,8 +929,8 @@
IOException {
if (logger.debugOn()) logger.debug("setAttribute",
- "name=" + name + ", attribute="
- + attribute);
+ "name=" + name + ", attribute name="
+ + attribute.getName());
final MarshalledObject<Attribute> sAttribute =
new MarshalledObject<Attribute>(attribute);
@@ -954,9 +952,11 @@
ReflectionException,
IOException {
- if (logger.debugOn()) logger.debug("setAttributes",
- "name=" + name + ", attributes="
- + attributes);
+ if (logger.debugOn()) {
+ logger.debug("setAttributes",
+ "name=" + name + ", attribute names="
+ + getAttributesNames(attributes));
+ }
final MarshalledObject<AttributeList> sAttributes =
new MarshalledObject<AttributeList>(attributes);
@@ -989,7 +989,6 @@
if (logger.debugOn()) logger.debug("invoke",
"name=" + name
+ ", operationName=" + operationName
- + ", params=" + objects(params)
+ ", signature=" + strings(signature));
final MarshalledObject<Object[]> sParams =
@@ -2246,4 +2245,12 @@
private static String strings(final String[] strs) {
return objects(strs);
}
+
+ static String getAttributesNames(AttributeList attributes) {
+ return attributes != null ?
+ attributes.asList().stream()
+ .map(Attribute::getName)
+ .collect(Collectors.joining("[", ", ", "]"))
+ : "[]";
+ }
}
--- a/jdk/src/java.management/share/classes/sun/management/MemoryImpl.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.management/share/classes/sun/management/MemoryImpl.java Thu Jan 21 10:17:21 2016 -0800
@@ -115,17 +115,10 @@
"Memory usage exceeds collection usage threshold"
};
- private MBeanNotificationInfo[] notifInfo = null;
public MBeanNotificationInfo[] getNotificationInfo() {
- synchronized (this) {
- if (notifInfo == null) {
- notifInfo = new MBeanNotificationInfo[1];
- notifInfo[0] = new MBeanNotificationInfo(notifTypes,
- notifName,
- "Memory Notification");
- }
- }
- return notifInfo;
+ return new MBeanNotificationInfo[] {
+ new MBeanNotificationInfo(notifTypes, notifName, "Memory Notification")
+ };
}
private static String getNotifMsg(String notifType) {
--- a/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java Thu Jan 21 10:17:21 2016 -0800
@@ -30,9 +30,12 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.Serializable;
import java.lang.management.ManagementFactory;
import java.net.InetAddress;
import java.net.MalformedURLException;
+import java.net.Socket;
+import java.net.ServerSocket;
import java.net.UnknownHostException;
import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
@@ -40,6 +43,7 @@
import java.rmi.registry.Registry;
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMIServerSocketFactory;
+import java.rmi.server.RMISocketFactory;
import java.rmi.server.RemoteObject;
import java.rmi.server.UnicastRemoteObject;
import java.security.KeyStore;
@@ -60,6 +64,8 @@
import javax.management.remote.rmi.RMIConnectorServer;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocket;
+import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManagerFactory;
import javax.rmi.ssl.SslRMIClientSocketFactory;
import javax.rmi.ssl.SslRMIServerSocketFactory;
@@ -107,6 +113,8 @@
public static final String PORT =
"com.sun.management.jmxremote.port";
+ public static final String HOST =
+ "com.sun.management.jmxremote.host";
public static final String RMI_PORT =
"com.sun.management.jmxremote.rmi.port";
public static final String CONFIG_FILE_NAME =
@@ -424,10 +432,14 @@
checkAccessFile(accessFileName);
}
+ final String bindAddress =
+ props.getProperty(PropertyNames.HOST);
+
if (log.debugOn()) {
log.debug("startRemoteConnectorServer",
Agent.getText("jmxremote.ConnectorBootstrap.starting") +
"\n\t" + PropertyNames.PORT + "=" + port +
+ (bindAddress == null ? "" : "\n\t" + PropertyNames.HOST + "=" + bindAddress) +
"\n\t" + PropertyNames.RMI_PORT + "=" + rmiPort +
"\n\t" + PropertyNames.USE_SSL + "=" + useSsl +
"\n\t" + PropertyNames.USE_REGISTRY_SSL + "=" + useRegistrySsl +
@@ -458,7 +470,7 @@
sslConfigFileName, enabledCipherSuitesList,
enabledProtocolsList, sslNeedClientAuth,
useAuthentication, loginConfigName,
- passwordFileName, accessFileName);
+ passwordFileName, accessFileName, bindAddress);
cs = data.jmxConnectorServer;
url = data.jmxRemoteURL;
log.config("startRemoteConnectorServer",
@@ -628,12 +640,13 @@
String sslConfigFileName,
String[] enabledCipherSuites,
String[] enabledProtocols,
- boolean sslNeedClientAuth) {
+ boolean sslNeedClientAuth,
+ String bindAddress) {
if (sslConfigFileName == null) {
- return new SslRMIServerSocketFactory(
+ return new HostAwareSslSocketFactory(
enabledCipherSuites,
enabledProtocols,
- sslNeedClientAuth);
+ sslNeedClientAuth, bindAddress);
} else {
checkRestrictedFile(sslConfigFileName);
try {
@@ -687,11 +700,11 @@
SSLContext ctx = SSLContext.getInstance("SSL");
ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
- return new SslRMIServerSocketFactory(
+ return new HostAwareSslSocketFactory(
ctx,
enabledCipherSuites,
enabledProtocols,
- sslNeedClientAuth);
+ sslNeedClientAuth, bindAddress);
} catch (Exception e) {
throw new AgentConfigurationError(AGENT_EXCEPTION, e, e.toString());
}
@@ -711,7 +724,8 @@
boolean useAuthentication,
String loginConfigName,
String passwordFileName,
- String accessFileName)
+ String accessFileName,
+ String bindAddress)
throws IOException, MalformedURLException {
/* Make sure we use non-guessable RMI object IDs. Otherwise
@@ -719,7 +733,7 @@
* IDs. */
System.setProperty("java.rmi.server.randomIDs", "true");
- JMXServiceURL url = new JMXServiceURL("rmi", null, rmiPort);
+ JMXServiceURL url = new JMXServiceURL("rmi", bindAddress, rmiPort);
Map<String, Object> env = new HashMap<>();
@@ -727,6 +741,8 @@
env.put(RMIExporter.EXPORTER_ATTRIBUTE, exporter);
+ boolean useSocketFactory = bindAddress != null && !useSsl;
+
if (useAuthentication) {
if (loginConfigName != null) {
env.put("jmx.remote.x.login.config", loginConfigName);
@@ -751,7 +767,7 @@
csf = new SslRMIClientSocketFactory();
ssf = createSslRMIServerSocketFactory(
sslConfigFileName, enabledCipherSuites,
- enabledProtocols, sslNeedClientAuth);
+ enabledProtocols, sslNeedClientAuth, bindAddress);
}
if (useSsl) {
@@ -761,6 +777,12 @@
ssf);
}
+ if (useSocketFactory) {
+ ssf = new HostAwareSocketFactory(bindAddress);
+ env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE,
+ ssf);
+ }
+
JMXConnectorServer connServer = null;
try {
connServer =
@@ -780,6 +802,10 @@
registry =
new SingleEntryRegistry(port, csf, ssf,
"jmxrmi", exporter.firstExported);
+ } else if (useSocketFactory) {
+ registry =
+ new SingleEntryRegistry(port, csf, ssf,
+ "jmxrmi", exporter.firstExported);
} else {
registry =
new SingleEntryRegistry(port,
@@ -813,4 +839,172 @@
private static final ClassLogger log =
new ClassLogger(ConnectorBootstrap.class.getPackage().getName(),
"ConnectorBootstrap");
+
+ private static class HostAwareSocketFactory implements RMIServerSocketFactory {
+
+ private final String bindAddress;
+
+ private HostAwareSocketFactory(String bindAddress) {
+ this.bindAddress = bindAddress;
+ }
+
+ @Override
+ public ServerSocket createServerSocket(int port) throws IOException {
+ if (bindAddress == null) {
+ return new ServerSocket(port);
+ } else {
+ try {
+ InetAddress addr = InetAddress.getByName(bindAddress);
+ return new ServerSocket(port, 0, addr);
+ } catch (UnknownHostException e) {
+ return new ServerSocket(port);
+ }
+ }
+ }
+ }
+
+ private static class HostAwareSslSocketFactory extends SslRMIServerSocketFactory {
+
+ private final String bindAddress;
+ private final String[] enabledCipherSuites;
+ private final String[] enabledProtocols;
+ private final boolean needClientAuth;
+ private final SSLContext context;
+
+ private HostAwareSslSocketFactory(String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean sslNeedClientAuth,
+ String bindAddress) throws IllegalArgumentException {
+ this(null, enabledCipherSuites, enabledProtocols, sslNeedClientAuth, bindAddress);
+ }
+
+ private HostAwareSslSocketFactory(SSLContext ctx,
+ String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean sslNeedClientAuth,
+ String bindAddress) throws IllegalArgumentException {
+ this.context = ctx;
+ this.bindAddress = bindAddress;
+ this.enabledProtocols = enabledProtocols;
+ this.enabledCipherSuites = enabledCipherSuites;
+ this.needClientAuth = sslNeedClientAuth;
+ checkValues(ctx, enabledCipherSuites, enabledProtocols);
+ }
+
+ @Override
+ public ServerSocket createServerSocket(int port) throws IOException {
+ if (bindAddress != null) {
+ try {
+ InetAddress addr = InetAddress.getByName(bindAddress);
+ return new SslServerSocket(port, 0, addr, context,
+ enabledCipherSuites, enabledProtocols, needClientAuth);
+ } catch (UnknownHostException e) {
+ return new SslServerSocket(port, context,
+ enabledCipherSuites, enabledProtocols, needClientAuth);
+ }
+ } else {
+ return new SslServerSocket(port, context,
+ enabledCipherSuites, enabledProtocols, needClientAuth);
+ }
+ }
+
+ private static void checkValues(SSLContext context,
+ String[] enabledCipherSuites,
+ String[] enabledProtocols) throws IllegalArgumentException {
+ // Force the initialization of the default at construction time,
+ // rather than delaying it to the first time createServerSocket()
+ // is called.
+ //
+ final SSLSocketFactory sslSocketFactory =
+ context == null ?
+ (SSLSocketFactory)SSLSocketFactory.getDefault() : context.getSocketFactory();
+ SSLSocket sslSocket = null;
+ if (enabledCipherSuites != null || enabledProtocols != null) {
+ try {
+ sslSocket = (SSLSocket) sslSocketFactory.createSocket();
+ } catch (Exception e) {
+ final String msg = "Unable to check if the cipher suites " +
+ "and protocols to enable are supported";
+ throw (IllegalArgumentException)
+ new IllegalArgumentException(msg).initCause(e);
+ }
+ }
+
+ // Check if all the cipher suites and protocol versions to enable
+ // are supported by the underlying SSL/TLS implementation and if
+ // true create lists from arrays.
+ //
+ if (enabledCipherSuites != null) {
+ sslSocket.setEnabledCipherSuites(enabledCipherSuites);
+ }
+ if (enabledProtocols != null) {
+ sslSocket.setEnabledProtocols(enabledProtocols);
+ }
+ }
+ }
+
+ private static class SslServerSocket extends ServerSocket {
+
+ private static SSLSocketFactory defaultSSLSocketFactory;
+ private final String[] enabledCipherSuites;
+ private final String[] enabledProtocols;
+ private final boolean needClientAuth;
+ private final SSLContext context;
+
+ private SslServerSocket(int port,
+ SSLContext ctx,
+ String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean needClientAuth) throws IOException {
+ super(port);
+ this.enabledProtocols = enabledProtocols;
+ this.enabledCipherSuites = enabledCipherSuites;
+ this.needClientAuth = needClientAuth;
+ this.context = ctx;
+ }
+
+ private SslServerSocket(int port,
+ int backlog,
+ InetAddress bindAddr,
+ SSLContext ctx,
+ String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean needClientAuth) throws IOException {
+ super(port, backlog, bindAddr);
+ this.enabledProtocols = enabledProtocols;
+ this.enabledCipherSuites = enabledCipherSuites;
+ this.needClientAuth = needClientAuth;
+ this.context = ctx;
+ }
+
+ @Override
+ public Socket accept() throws IOException {
+ final SSLSocketFactory sslSocketFactory =
+ context == null ?
+ getDefaultSSLSocketFactory() : context.getSocketFactory();
+ Socket socket = super.accept();
+ SSLSocket sslSocket = (SSLSocket) sslSocketFactory.createSocket(
+ socket, socket.getInetAddress().getHostName(),
+ socket.getPort(), true);
+ sslSocket.setUseClientMode(false);
+ if (enabledCipherSuites != null) {
+ sslSocket.setEnabledCipherSuites(enabledCipherSuites);
+ }
+ if (enabledProtocols != null) {
+ sslSocket.setEnabledProtocols(enabledProtocols);
+ }
+ sslSocket.setNeedClientAuth(needClientAuth);
+ return sslSocket;
+ }
+
+ private static synchronized SSLSocketFactory getDefaultSSLSocketFactory() {
+ if (defaultSSLSocketFactory == null) {
+ defaultSSLSocketFactory = (SSLSocketFactory)SSLSocketFactory.getDefault();
+ return defaultSSLSocketFactory;
+ } else {
+ return defaultSSLSocketFactory;
+ }
+ }
+
+ }
}
--- a/jdk/src/java.management/share/conf/management.properties Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.management/share/conf/management.properties Thu Jan 21 10:17:21 2016 -0800
@@ -316,3 +316,16 @@
# For a non-default password file location use the following line
# com.sun.management.jmxremote.access.file=filepath
+#
+
+# ################ Management agent listen interface #########################
+#
+# com.sun.management.jmxremote.host=<host-or-interface-name>
+# Specifies the local interface on which the JMX RMI agent will bind.
+# This is useful when running on machines which have several
+# interfaces defined. It makes it possible to listen to a specific
+# subnet accessible through that interface.
+#
+# The format of the value for that property is any string accepted
+# by java.net.InetAddress.getByName(String).
+#
--- a/jdk/src/java.management/share/native/include/jmm.h Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.management/share/native/include/jmm.h Thu Jan 21 10:17:21 2016 -0800
@@ -227,16 +227,10 @@
jint (JNICALL *GetOptionalSupport) (JNIEnv *env,
jmmOptionalSupport* support_ptr);
- /* This is used by JDK 6 and earlier.
- * For JDK 7 and after, use GetInputArgumentArray.
- */
- jobject (JNICALL *GetInputArguments) (JNIEnv *env);
-
jint (JNICALL *GetThreadInfo) (JNIEnv *env,
jlongArray ids,
jint maxDepth,
jobjectArray infoArray);
- jobjectArray (JNICALL *GetInputArgumentArray) (JNIEnv *env);
jobjectArray (JNICALL *GetMemoryPools) (JNIEnv* env, jobject mgr);
--- a/jdk/src/java.management/share/native/libmanagement/VMManagementImpl.c Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.management/share/native/libmanagement/VMManagementImpl.c Thu Jan 21 10:17:21 2016 -0800
@@ -112,7 +112,7 @@
Java_sun_management_VMManagementImpl_getVmArguments0
(JNIEnv *env, jobject dummy)
{
- return jmm_interface->GetInputArgumentArray(env);
+ return JVM_GetVmArguments(env);
}
JNIEXPORT jlong JNICALL
--- a/jdk/src/java.naming/share/classes/sun/security/provider/certpath/ldap/JdkLDAP.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.naming/share/classes/sun/security/provider/certpath/ldap/JdkLDAP.java Thu Jan 21 10:17:21 2016 -0800
@@ -34,7 +34,7 @@
* Provider class for the JdkLDAP provider.
* Supports LDAP cert store.
*
- * @since 1.9
+ * @since 9
*/
public final class JdkLDAP extends Provider {
--- a/jdk/src/java.naming/share/classes/sun/security/provider/certpath/ldap/LDAPCertStoreImpl.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.naming/share/classes/sun/security/provider/certpath/ldap/LDAPCertStoreImpl.java Thu Jan 21 10:17:21 2016 -0800
@@ -54,7 +54,7 @@
* Core implementation of a LDAP Cert Store.
* @see java.security.cert.CertStore
*
- * @since 1.9
+ * @since 9
*/
final class LDAPCertStoreImpl {
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/EncryptionKey.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/EncryptionKey.java Thu Jan 21 10:17:21 2016 -0800
@@ -44,7 +44,7 @@
* The key material of an {@code EncryptionKey} is defined as the value
* of the {@code keyValue} above.
*
- * @since 1.9
+ * @since 9
*/
public final class EncryptionKey implements SecretKey {
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java Thu Jan 21 10:17:21 2016 -0800
@@ -45,7 +45,7 @@
* }
* </pre>
*
- * @since 1.9
+ * @since 9
*/
public final class KerberosCredMessage implements Destroyable {
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ssl/Krb5KeyExchangeService.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ssl/Krb5KeyExchangeService.java Thu Jan 21 10:17:21 2016 -0800
@@ -65,7 +65,7 @@
/**
* The provider for TLS_KRB_ cipher suites.
*
- * @since 1.9
+ * @since 9
*/
public class Krb5KeyExchangeService implements ClientKeyExchangeService {
--- a/jdk/src/java.sql/share/classes/java/sql/Connection.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.sql/share/classes/java/sql/Connection.java Thu Jan 21 10:17:21 2016 -0800
@@ -1538,7 +1538,7 @@
* prior to returning the {@code PooledConnection} back to the cache</li>
* </ul>
* @throws SQLException if an error occurs
- * @since 1.9
+ * @since 9
* @see endRequest
* @see javax.sql.PooledConnection
*/
@@ -1580,7 +1580,7 @@
* prior to returning the {@code PooledConnection} back to the cache</li>
* </ul>
* @throws SQLException if an error occurs
- * @since 1.9
+ * @since 9
* @see beginRequest
* @see javax.sql.PooledConnection
*/
@@ -1614,7 +1614,7 @@
* this method is called on a closed {@code connection}; or
* the {@code timeout} value is less than 0.
* @throws SQLFeatureNotSupportedException if the driver does not support sharding
- * @since 1.9
+ * @since 9
* @see ShardingKey
* @see ShardingKeyBuilder
*/
@@ -1645,7 +1645,7 @@
* this method is called on a closed {@code connection}; the {@code shardingkey}
* is {@code null}; or the {@code timeout} value is less than 0.
* @throws SQLFeatureNotSupportedException if the driver does not support sharding
- * @since 1.9
+ * @since 9
* @see ShardingKey
* @see ShardingKeyBuilder
*/
@@ -1671,7 +1671,7 @@
* the {@code shardingkey} is {@code null}; or
* a {@code superSharedingKey} is specified without a {@code shardingKey}
* @throws SQLFeatureNotSupportedException if the driver does not support sharding
- * @since 1.9
+ * @since 9
* @see ShardingKey
* @see ShardingKeyBuilder
*/
@@ -1694,7 +1694,7 @@
* this method is called on a closed {@code connection}; or the
* {@code shardkingKey} is {@code null}
* @throws SQLFeatureNotSupportedException if the driver does not support sharding
- * @since 1.9
+ * @since 9
* @see ShardingKey
* @see ShardingKeyBuilder
*/
--- a/jdk/src/java.sql/share/classes/java/sql/ConnectionBuilder.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.sql/share/classes/java/sql/ConnectionBuilder.java Thu Jan 21 10:17:21 2016 -0800
@@ -49,7 +49,7 @@
* .build();
* }</pre>
*
- * @since 1.9
+ * @since 9
*
*/
public interface ConnectionBuilder {
--- a/jdk/src/java.sql/share/classes/java/sql/DatabaseMetaData.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.sql/share/classes/java/sql/DatabaseMetaData.java Thu Jan 21 10:17:21 2016 -0800
@@ -3694,7 +3694,7 @@
* @return {@code true} if this database supports sharding;
* {@code false} otherwise
* @exception SQLException if a database access error occurs
- * @since 1.9
+ * @since 9
*/
default boolean supportsSharding() throws SQLException {
return false;
--- a/jdk/src/java.sql/share/classes/java/sql/DriverManager.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.sql/share/classes/java/sql/DriverManager.java Thu Jan 21 10:17:21 2016 -0800
@@ -449,7 +449,7 @@
* to which the current caller has access.
*
* @return the stream of JDBC Drivers loaded by the caller's class loader
- * @since 1.9
+ * @since 9
*/
@CallerSensitive
public static Stream<Driver> drivers() {
--- a/jdk/src/java.sql/share/classes/java/sql/ShardingKey.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.sql/share/classes/java/sql/ShardingKey.java Thu Jan 21 10:17:21 2016 -0800
@@ -69,7 +69,7 @@
* }
* </pre>
*
- * @since 1.9
+ * @since 9
*/
public interface ShardingKey {
--- a/jdk/src/java.sql/share/classes/javax/sql/CommonDataSource.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.sql/share/classes/javax/sql/CommonDataSource.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, 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
@@ -26,8 +26,8 @@
package javax.sql;
import java.sql.SQLException;
-import java.io.PrintWriter;
import java.sql.SQLFeatureNotSupportedException;
+import java.sql.ShardingKeyBuilder;
import java.util.logging.Logger;
/**
@@ -128,4 +128,20 @@
* @since 1.7
*/
public Logger getParentLogger() throws SQLFeatureNotSupportedException;
+
+ //------------------------- JDBC 4.3 -----------------------------------
+
+ /**
+ * Creates a new {@code ShardingKeyBuilder} instance
+ * @implSpec
+ * The default implementation will throw a {@code SQLFeatureNotSupportedException}.
+ * @return The ShardingKeyBuilder instance that was created
+ * @throws SQLException if an error occurs creating the builder
+ * @throws SQLFeatureNotSupportedException if the driver does not support this method
+ * @since 9
+ * @see ShardingKeyBuilder
+ */
+ default ShardingKeyBuilder createShardingKeyBuilder() throws SQLException {
+ throw new SQLFeatureNotSupportedException("createShardingKeyBuilder not implemented");
+ };
}
--- a/jdk/src/java.sql/share/classes/javax/sql/ConnectionPoolDataSource.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.sql/share/classes/javax/sql/ConnectionPoolDataSource.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, 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
@@ -26,6 +26,7 @@
package javax.sql;
import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
/**
@@ -70,4 +71,20 @@
*/
PooledConnection getPooledConnection(String user, String password)
throws SQLException;
+
+ //------------------------- JDBC 4.3 -----------------------------------
+
+ /**
+ * Creates a new {@code PooledConnectionBuilder} instance
+ * @implSpec
+ * The default implementation will throw a {@code SQLFeatureNotSupportedException}.
+ * @return The ConnectionBuilder instance that was created
+ * @throws SQLException if an error occurs creating the builder
+ * @throws SQLFeatureNotSupportedException if the driver does not support sharding
+ * @since 9
+ * @see PooledConnectionBuilder
+ */
+ default PooledConnectionBuilder createPooledConnectionBuilder() throws SQLException {
+ throw new SQLFeatureNotSupportedException("createPooledConnectionBuilder not implemented");
+ };
}
--- a/jdk/src/java.sql/share/classes/javax/sql/DataSource.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.sql/share/classes/javax/sql/DataSource.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, 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
@@ -29,7 +29,6 @@
import java.sql.ConnectionBuilder;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
-import java.sql.ShardingKeyBuilder;
import java.sql.Wrapper;
/**
@@ -119,25 +118,11 @@
* @return The ConnectionBuilder instance that was created
* @throws SQLException if an error occurs creating the builder
* @throws SQLFeatureNotSupportedException if the driver does not support sharding
- * @since 1.9
- * @see createConnectionBuilder
+ * @since 9
+ * @see ConnectionBuilder
*/
default ConnectionBuilder createConnectionBuilder() throws SQLException {
throw new SQLFeatureNotSupportedException("createConnectionBuilder not implemented");
};
- /**
- * Create a new {@code ShardingKeyBuilder} instance
- * @implSpec
- * The default implementation will throw a {@code SQLFeatureNotSupportedException}
- * @return The ShardingKeyBuilder instance that was created
- * @throws SQLException if an error occurs creating the builder
- * @throws SQLFeatureNotSupportedException if the driver does not support this method
- * @since 1.9
- * @see ShardingKeyBuilder
- */
- default ShardingKeyBuilder createShardingKeyBuilder()
- throws SQLException {
- throw new SQLFeatureNotSupportedException("createShardingKeyBuilder not implemented");
- };
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.sql/share/classes/javax/sql/PooledConnectionBuilder.java Thu Jan 21 10:17:21 2016 -0800
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2016, 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 javax.sql;
+
+import java.sql.SQLException;
+import java.sql.ShardingKey;
+
+/**
+ * A builder created from a {@code ConnectionPoolDataSource} object,
+ * used to establish a connection to the database that the
+ * {@code data source} object represents. The connection
+ * properties that were specified for the {@code data source} are used as the
+ * default values by the {@code PooledConnectionBuilder}.
+ * <p>The following example illustrates the use of {@code PooledConnectionBuilder}
+ * to create a {@link XAConnection}:
+ *
+ * <pre>{@code
+ * ConnectionPoolDataSource ds = new MyConnectionPoolDataSource();
+ * ShardingKey superShardingKey = ds.createShardingKeyBuilder()
+ * .subkey("EASTERN_REGION", JDBCType.VARCHAR)
+ * .build();
+ * ShardingKey shardingKey = ds.createShardingKeyBuilder()
+ * .subkey("PITTSBURGH_BRANCH", JDBCType.VARCHAR)
+ * .build();
+ * PooledConnection con = ds.createPooledConnectionBuilder()
+ * .user("rafa")
+ * .password("tennis")
+ * .setShardingKey(shardingKey)
+ * .setSuperShardingKey(superShardingKey)
+ * .build();
+ * }</pre>
+ *
+ * @since 9
+ *
+ */
+public interface PooledConnectionBuilder {
+
+ /**
+ * Specifies the username to be used when creating a connection
+ *
+ * @param username the database user on whose behalf the connection is being
+ * made
+ * @return the same {@code PooledConnectionBuilder} instance
+ */
+ PooledConnectionBuilder user(String username);
+
+ /**
+ * Specifies the password to be used when creating a connection
+ *
+ * @param password the password to use for this connection. May be {@code null}
+ * @return the same {@code PooledConnectionBuilder} instance
+ */
+ PooledConnectionBuilder password(String password);
+
+ /**
+ * Specifies a {@code shardingKey} to be used when creating a connection
+ *
+ * @param shardingKey the ShardingKey. May be {@code null}
+ * @return the same {@code PooledConnectionBuilder} instance
+ * @see java.sql.ShardingKey
+ * @see java.sql.ShardingKeyBuilder
+ */
+ PooledConnectionBuilder shardingKey(ShardingKey shardingKey);
+
+ /**
+ * Specifies a {@code superShardingKey} to be used when creating a connection
+ *
+ * @param superShardingKey the SuperShardingKey. May be {@code null}
+ * @return the same {@code PooledConnectionBuilder} instance
+ * @see java.sql.ShardingKey
+ * @see java.sql.ShardingKeyBuilder
+ */
+ PooledConnectionBuilder superShardingKey(ShardingKey superShardingKey);
+
+ /**
+ * Returns an instance of the object defined by this builder.
+ *
+ * @return The built object
+ * @throws java.sql.SQLException If an error occurs building the object
+ */
+ PooledConnection build() throws SQLException;
+
+}
--- a/jdk/src/java.sql/share/classes/javax/sql/XAConnection.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.sql/share/classes/javax/sql/XAConnection.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, 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
@@ -52,121 +52,4 @@
* @since 1.4
*/
javax.transaction.xa.XAResource getXAResource() throws SQLException;
-
- // JDBC 4.3
-
- /**
- * Sets and validates the sharding keys for this connection.
- *
- * @implSpec The default implementation will throw a
- * {@code SQLFeatureNotSupportedException}.
- *
- * @apiNote This method validates that the sharding keys are valid for the
- * {@code Connection}. The timeout value indicates how long the driver
- * should wait for the {@code Connection} to verify that the sharding key is
- * valid before {@code setShardingKeyIfValid} returns false.
- * @param shardingKey the sharding key to be validated against this
- * connection
- * @param superShardingKey the super sharding key to be validated against
- * this connection. The super sharding key may be {@code null}.
- * @param timeout time in seconds before which the validation process is
- * expected to be completed, otherwise the validation process is aborted. A
- * value of 0 indicates the validation process will not time out.
- * @return true if the connection is valid and the sharding keys are valid
- * and set on this connection; false if the sharding keys are not valid or
- * the timeout period expires before the operation completes.
- * @throws SQLException if an error occurs while performing this validation;
- * the {@code shardingkey} is {@code null}; a {@code superSharedingKey} is specified
- * without a {@code shardingKey}; this method is called on a closed
- * {@code connection}; or the {@code timeout} value is less than 0.
- * @throws SQLFeatureNotSupportedException if the driver does not support
- * sharding
- * @since 1.9
- * @see ShardingKey
- * @see ShardingKeyBuilder
- */
- default boolean setShardingKeyIfValid(ShardingKey shardingKey,
- ShardingKey superShardingKey, int timeout)
- throws SQLException {
- throw new SQLFeatureNotSupportedException("setShardingKeyIfValid not implemented");
- }
-
- /**
- * Sets and validates the sharding key for this connection.
- * @implSpec
- * The default implementation will throw a
- * {@code SQLFeatureNotSupportedException}.
- * @apiNote
- * This method validates that the sharding key is valid for the
- * {@code Connection}. The timeout value indicates how long the driver
- * should wait for the {@code Connection} to verify that the sharding key
- * is valid before {@code setShardingKeyIfValid} returns false.
- * @param shardingKey the sharding key to be validated against this connection
- * @param timeout time in seconds before which the validation process is expected to
- * be completed,else the validation process is aborted. A value of 0 indicates
- * the validation process will not time out.
- * @return true if the connection is valid and the sharding key is valid to be
- * set on this connection; false if the sharding key is not valid or
- * the timeout period expires before the operation completes.
- * @throws SQLException if there is an error while performing this validation;
- * this method is called on a closed {@code connection}; the {@code shardingkey}
- * is {@code null}; or the {@code timeout} value is less than 0.
- * @throws SQLFeatureNotSupportedException if the driver does not support sharding
- * @since 1.9
- * @see ShardingKey
- * @see ShardingKeyBuilder
- */
- default boolean setShardingKeyIfValid(ShardingKey shardingKey, int timeout)
- throws SQLException {
- throw new SQLFeatureNotSupportedException("setShardingKeyIfValid not implemented");
- }
-
- /**
- * Specifies a shardingKey and superShardingKey to use with this Connection
- * @implSpec
- * The default implementation will throw a
- * {@code SQLFeatureNotSupportedException}.
- * @apiNote
- * This method sets the specified sharding keys but does not require a
- * round trip to the database to validate that the sharding keys are valid
- * for the {@code Connection}.
- * @param shardingKey the sharding key to set on this connection.
- * @param superShardingKey the super sharding key to set on this connection.
- * The super sharding key may be {@code null}
- * @throws SQLException if an error occurs setting the sharding keys;
- * this method is called on a closed {@code connection};
- * the {@code shardingkey} is {@code null}; or
- * a {@code superSharedingKey} is specified without a {@code shardingKey}
- * @throws SQLFeatureNotSupportedException if the driver does not support sharding
- * @since 1.9
- * @see ShardingKey
- * @see ShardingKeyBuilder
- */
- default void setShardingKey(ShardingKey shardingKey, ShardingKey superShardingKey)
- throws SQLException {
- throw new SQLFeatureNotSupportedException("setShardingKey not implemented");
- }
-
- /**
- * Specifies a shardingKey to use with this Connection
- * @implSpec
- * The default implementation will throw a
- * {@code SQLFeatureNotSupportedException}.
- * @apiNote
- * This method sets the specified sharding key but does not require a
- * round trip to the database to validate that the sharding key is valid
- * for the {@code Connection}.
- * @param shardingKey the sharding key to set on this connection.
- * @throws SQLException if an error occurs setting the sharding key;
- * this method is called on a closed {@code connection}; or the
- * {@code shardkingKey} is {@code null}
- * @throws SQLFeatureNotSupportedException if the driver does not support sharding
- * @since 1.9
- * @see ShardingKey
- * @see ShardingKeyBuilder
- */
- default void setShardingKey(ShardingKey shardingKey)
- throws SQLException {
- throw new SQLFeatureNotSupportedException("setShardingKey not implemented");
- }
}
--- a/jdk/src/java.sql/share/classes/javax/sql/XAConnectionBuilder.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.sql/share/classes/javax/sql/XAConnectionBuilder.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 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
@@ -37,7 +37,7 @@
* to create a {@link XAConnection}:
*
* <pre>{@code
- * DataSource ds = new MyDataSource();
+ * XADataSource ds = new MyXADataSource();
* ShardingKey superShardingKey = ds.createShardingKeyBuilder()
* .subkey("EASTERN_REGION", JDBCType.VARCHAR)
* .build();
@@ -52,7 +52,7 @@
* .build();
* }</pre>
*
- * @since 1.9
+ * @since 9
*
*/
public interface XAConnectionBuilder {
--- a/jdk/src/java.sql/share/classes/javax/sql/XADataSource.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/java.sql/share/classes/javax/sql/XADataSource.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, 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
@@ -87,28 +87,14 @@
* Creates a new {@code XAConnectionBuilder} instance
* @implSpec
* The default implementation will throw a {@code SQLFeatureNotSupportedException}.
- * @return The ConnectionBuilder instance that was created
+ * @return The XAConnectionBuilder instance that was created
* @throws SQLException if an error occurs creating the builder
* @throws SQLFeatureNotSupportedException if the driver does not support sharding
- * @since 1.9
+ * @since 9
* @see XAConnectionBuilder
*/
default XAConnectionBuilder createXAConnectionBuilder() throws SQLException {
throw new SQLFeatureNotSupportedException("createXAConnectionBuilder not implemented");
};
- /**
- * Creates a new {@code ShardingKeyBuilder} instance
- * @implSpec
- * The default implementation will throw a {@code SQLFeatureNotSupportedException}.
- * @return The ShardingKeyBuilder instance that was created
- * @throws SQLException if an error occurs creating the builder
- * @throws SQLFeatureNotSupportedException if the driver does not support this method
- * @since 1.9
- * @see ShardingKeyBuilder
- */
- default ShardingKeyBuilder createShardingKeyBuilder()
- throws SQLException {
- throw new SQLFeatureNotSupportedException("createShardingKeyBuilder not implemented");
- };
}
--- a/jdk/src/jdk.attach/share/classes/com/sun/tools/attach/AttachOperationFailedException.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.attach/share/classes/com/sun/tools/attach/AttachOperationFailedException.java Thu Jan 21 10:17:21 2016 -0800
@@ -35,7 +35,7 @@
* fails in the target VM. If there is a communication error,
* a regular IOException will be thrown.
*
- * @since 1.9
+ * @since 9
*/
public class AttachOperationFailedException extends IOException {
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Cipher.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Cipher.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -35,6 +35,7 @@
import javax.crypto.spec.*;
import sun.nio.ch.DirectBuffer;
+import sun.security.jca.JCAUtil;
import sun.security.pkcs11.wrapper.*;
import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
@@ -379,7 +380,7 @@
}
// generate random IV
if (random == null) {
- random = new SecureRandom();
+ random = JCAUtil.getSecureRandom();
}
iv = new byte[blockSize];
random.nextBytes(iv);
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11RSACipher.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11RSACipher.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -470,49 +470,49 @@
algorithm.equals("TlsRsaPremasterSecret");
Exception failover = null;
- SecureRandom secureRandom = random;
- if (secureRandom == null && isTlsRsaPremasterSecret) {
- secureRandom = new SecureRandom();
- }
-
// Should C_Unwrap be preferred for non-TLS RSA premaster secret?
if (token.supportsRawSecretKeyImport()) {
// XXX implement unwrap using C_Unwrap() for all keys
implInit(Cipher.DECRYPT_MODE, p11Key);
- if (wrappedKey.length > maxInputSize) {
- throw new InvalidKeyException("Key is too long for unwrapping");
- }
+ try {
+ if (wrappedKey.length > maxInputSize) {
+ throw new InvalidKeyException("Key is too long for unwrapping");
+ }
- byte[] encoded = null;
- implUpdate(wrappedKey, 0, wrappedKey.length);
- try {
- encoded = doFinal();
- } catch (BadPaddingException e) {
- if (isTlsRsaPremasterSecret) {
- failover = e;
- } else {
+ byte[] encoded = null;
+ implUpdate(wrappedKey, 0, wrappedKey.length);
+ try {
+ encoded = doFinal();
+ } catch (BadPaddingException e) {
+ if (isTlsRsaPremasterSecret) {
+ failover = e;
+ } else {
+ throw new InvalidKeyException("Unwrapping failed", e);
+ }
+ } catch (IllegalBlockSizeException e) {
+ // should not occur, handled with length check above
throw new InvalidKeyException("Unwrapping failed", e);
}
- } catch (IllegalBlockSizeException e) {
- // should not occur, handled with length check above
- throw new InvalidKeyException("Unwrapping failed", e);
- }
+
+ if (isTlsRsaPremasterSecret) {
+ if (!(spec instanceof TlsRsaPremasterSecretParameterSpec)) {
+ throw new IllegalStateException(
+ "No TlsRsaPremasterSecretParameterSpec specified");
+ }
- if (isTlsRsaPremasterSecret) {
- if (!(spec instanceof TlsRsaPremasterSecretParameterSpec)) {
- throw new IllegalStateException(
- "No TlsRsaPremasterSecretParameterSpec specified");
+ // polish the TLS premaster secret
+ TlsRsaPremasterSecretParameterSpec psps =
+ (TlsRsaPremasterSecretParameterSpec)spec;
+ encoded = KeyUtil.checkTlsPreMasterSecretKey(
+ psps.getClientVersion(), psps.getServerVersion(),
+ random, encoded, (failover != null));
}
- // polish the TLS premaster secret
- TlsRsaPremasterSecretParameterSpec psps =
- (TlsRsaPremasterSecretParameterSpec)spec;
- encoded = KeyUtil.checkTlsPreMasterSecretKey(
- psps.getClientVersion(), psps.getServerVersion(),
- secureRandom, encoded, (failover != null));
+ return ConstructKeys.constructKey(encoded, algorithm, type);
+ } finally {
+ // Restore original mode
+ implInit(Cipher.UNWRAP_MODE, p11Key);
}
-
- return ConstructKeys.constructKey(encoded, algorithm, type);
} else {
Session s = null;
SecretKey secretKey = null;
@@ -540,20 +540,13 @@
}
if (isTlsRsaPremasterSecret) {
- byte[] replacer = new byte[48];
- if (failover == null) {
- // Does smart compiler dispose this operation?
- secureRandom.nextBytes(replacer);
- }
-
TlsRsaPremasterSecretParameterSpec psps =
(TlsRsaPremasterSecretParameterSpec)spec;
- // Please use the tricky failover and replacer byte array
- // as the parameters so that smart compiler won't dispose
- // the unused variable .
+ // Please use the tricky failover as the parameter so that
+ // smart compiler won't dispose the unused variable.
secretKey = polishPreMasterSecretKey(token, s,
- failover, replacer, secretKey,
+ failover, secretKey,
psps.getClientVersion(), psps.getServerVersion());
}
@@ -572,29 +565,27 @@
private static SecretKey polishPreMasterSecretKey(
Token token, Session session,
- Exception failover, byte[] replacer, SecretKey secretKey,
+ Exception failover, SecretKey unwrappedKey,
int clientVersion, int serverVersion) {
- if (failover != null) {
- CK_VERSION version = new CK_VERSION(
- (clientVersion >>> 8) & 0xFF, clientVersion & 0xFF);
- try {
- CK_ATTRIBUTE[] attributes = token.getAttributes(
- O_GENERATE, CKO_SECRET_KEY,
- CKK_GENERIC_SECRET, new CK_ATTRIBUTE[0]);
- long keyID = token.p11.C_GenerateKey(session.id(),
- // new CK_MECHANISM(CKM_TLS_PRE_MASTER_KEY_GEN, version),
- new CK_MECHANISM(CKM_SSL3_PRE_MASTER_KEY_GEN, version),
- attributes);
- return P11Key.secretKey(session,
- keyID, "TlsRsaPremasterSecret", 48 << 3, attributes);
- } catch (PKCS11Exception e) {
- throw new ProviderException(
- "Could not generate premaster secret", e);
- }
+ SecretKey newKey;
+ CK_VERSION version = new CK_VERSION(
+ (clientVersion >>> 8) & 0xFF, clientVersion & 0xFF);
+ try {
+ CK_ATTRIBUTE[] attributes = token.getAttributes(
+ O_GENERATE, CKO_SECRET_KEY,
+ CKK_GENERIC_SECRET, new CK_ATTRIBUTE[0]);
+ long keyID = token.p11.C_GenerateKey(session.id(),
+ new CK_MECHANISM(CKM_SSL3_PRE_MASTER_KEY_GEN, version),
+ attributes);
+ newKey = P11Key.secretKey(session,
+ keyID, "TlsRsaPremasterSecret", 48 << 3, attributes);
+ } catch (PKCS11Exception e) {
+ throw new ProviderException(
+ "Could not generate premaster secret", e);
}
- return secretKey;
+ return (failover == null) ? unwrappedKey : newKey;
}
}
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/CipherContextRef.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/CipherContextRef.java Thu Jan 21 10:17:21 2016 -0800
@@ -41,7 +41,7 @@
/**
* Internal class for context resource clean up.
*
- * @since 1.9
+ * @since 9
*/
final class CipherContextRef extends PhantomReference<NativeCipher>
implements Comparable<CipherContextRef> {
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/Config.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/Config.java Thu Jan 21 10:17:21 2016 -0800
@@ -49,7 +49,7 @@
* where <Service> can be "MessageDigest", "Cipher", etc. and <Algorithm>
* reprepresents the value that's passed into the various getInstance() calls.
*
- * @since 1.9
+ * @since 9
*/
final class Config {
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/GCMParameters.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/GCMParameters.java Thu Jan 21 10:17:21 2016 -0800
@@ -48,7 +48,7 @@
* as possible AES-GCM-ICVlen values, so we allow all 6 values.
* </pre>
*
- * @since 1.9
+ * @since 9
*/
public final class GCMParameters extends AlgorithmParametersSpi {
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipher.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipher.java Thu Jan 21 10:17:21 2016 -0800
@@ -38,6 +38,8 @@
import javax.crypto.spec.SecretKeySpec;
import javax.crypto.spec.IvParameterSpec;
+import sun.security.jca.JCAUtil;
+
/**
* Cipher wrapper class utilizing ucrypto APIs. This class currently supports
* - AES/ECB/NOPADDING
@@ -46,7 +48,7 @@
* - AES/CFB128/NOPADDING
* (Support for GCM mode is inside the child class NativeGCMCipher)
*
- * @since 1.9
+ * @since 9
*/
class NativeCipher extends CipherSpi {
@@ -288,7 +290,10 @@
if (encrypt) {
// generate IV if none supplied for encryption
ivBytes = new byte[blockSize];
- new SecureRandom().nextBytes(ivBytes);
+ if (random == null) {
+ random = JCAUtil.getSecureRandom();
+ }
+ random.nextBytes(ivBytes);
} else {
throw new InvalidAlgorithmParameterException
("Parameters required for decryption");
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipherWithJavaPadding.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipherWithJavaPadding.java Thu Jan 21 10:17:21 2016 -0800
@@ -59,7 +59,7 @@
* - AES/CBC/PKCS5PADDING
* - AES/CFB128/PKCS5PADDING
*
- * @since 1.9
+ * @since 9
*/
public class NativeCipherWithJavaPadding extends CipherSpi {
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeDigest.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeDigest.java Thu Jan 21 10:17:21 2016 -0800
@@ -36,7 +36,7 @@
* MessageDigest implementation class. This class currently supports
* MD5, SHA1, SHA256, SHA384, and SHA512
*
- * @since 1.9
+ * @since 9
*/
public abstract class NativeDigest extends MessageDigestSpi
implements Cloneable {
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeGCMCipher.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeGCMCipher.java Thu Jan 21 10:17:21 2016 -0800
@@ -36,11 +36,13 @@
import javax.crypto.spec.SecretKeySpec;
import javax.crypto.spec.GCMParameterSpec;
+import sun.security.jca.JCAUtil;
+
/**
* Cipher wrapper class utilizing ucrypto APIs. This class currently supports
* - AES/GCM/NoPADDING
*
- * @since 1.9
+ * @since 9
*/
class NativeGCMCipher extends NativeCipher {
@@ -200,7 +202,10 @@
// generate IV if none supplied for encryption
ivBytes = new byte[blockSize];
- new SecureRandom().nextBytes(ivBytes);
+ if (random == null) {
+ random = JCAUtil.getSecureRandom();
+ }
+ random.nextBytes(ivBytes);
} else {
throw new InvalidAlgorithmParameterException("Parameters required for decryption");
}
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeKey.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeKey.java Thu Jan 21 10:17:21 2016 -0800
@@ -39,7 +39,7 @@
* Wrapper class for native keys needed for using ucrypto APIs.
* This class currently supports native RSA private/public keys.
*
- * @since 1.9
+ * @since 9
*/
abstract class NativeKey implements Key {
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSACipher.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSACipher.java Thu Jan 21 10:17:21 2016 -0800
@@ -63,6 +63,7 @@
import javax.crypto.spec.SecretKeySpec;
import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec;
+import sun.security.jca.JCAUtil;
import sun.security.util.KeyUtil;
/**
@@ -71,7 +72,7 @@
* - RSA/ECB/NOPADDING
* - RSA/ECB/PKCS1PADDING
*
- * @since 1.9
+ * @since 9
*/
public class NativeRSACipher extends CipherSpi {
// fields set in constructor
@@ -201,6 +202,9 @@
"No Parameters can be specified");
}
spec = params;
+ if (random == null) {
+ random = JCAUtil.getSecureRandom();
+ }
this.random = random; // for TLS RSA premaster secret
}
boolean doEncrypt = (opmode == Cipher.ENCRYPT_MODE || opmode == Cipher.WRAP_MODE);
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSAKeyFactory.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSAKeyFactory.java Thu Jan 21 10:17:21 2016 -0800
@@ -44,7 +44,7 @@
* Ucrypto-private KeyFactory class for generating native keys
* needed for using ucrypto APIs.
*
- * @since 1.9
+ * @since 9
*/
public final class NativeRSAKeyFactory extends KeyFactorySpi {
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSASignature.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSASignature.java Thu Jan 21 10:17:21 2016 -0800
@@ -59,7 +59,7 @@
* . SHA384withRSA
* . SHA512withRSA
*
- * @since 1.9
+ * @since 9
*/
class NativeRSASignature extends SignatureSpi {
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoException.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoException.java Thu Jan 21 10:17:21 2016 -0800
@@ -33,7 +33,7 @@
* object of this class indicates that a function call to the underlying
* native calls returned a value not equal to CRYPTO_SUCCESS.
*
- * @since 1.9
+ * @since 9
*/
public final class UcryptoException extends ProviderException {
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoMech.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoMech.java Thu Jan 21 10:17:21 2016 -0800
@@ -30,7 +30,7 @@
/**
* Enum for representing the ucrypto mechanisms.
*
- * @since 1.9
+ * @since 9
*/
// Check /usr/include/libsoftcrypto.h for updates
public enum UcryptoMech {
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoProvider.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoProvider.java Thu Jan 21 10:17:21 2016 -0800
@@ -33,7 +33,7 @@
/**
* OracleUcrypto provider main class.
*
- * @since 1.9
+ * @since 9
*/
public final class UcryptoProvider extends Provider {
--- a/jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSignerParameters.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSignerParameters.java Thu Jan 21 10:17:21 2016 -0800
@@ -73,7 +73,7 @@
* Retreives the message digest algorithm that is used to generate
* the message imprint to be sent to the TSA server.
*
- * @since 1.9
+ * @since 9
* @return The non-null string of the message digest algorithm name.
*/
public default String getTSADigestAlg() {
--- a/jdk/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSigner.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSigner.java Thu Jan 21 10:17:21 2016 -0800
@@ -77,7 +77,7 @@
* }
* </pre>
*
- * @since 1.9
+ * @since 9
*/
public final class JarSigner {
@@ -85,7 +85,7 @@
* A mutable builder class that can create an immutable {@code JarSigner}
* from various signing-related parameters.
*
- * @since 1.9
+ * @since 9
*/
public static class Builder {
--- a/jdk/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSignerException.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSignerException.java Thu Jan 21 10:17:21 2016 -0800
@@ -28,7 +28,7 @@
/**
* This exception is thrown when {@link JarSigner#sign} fails.
*
- * @since 1.9
+ * @since 9
*/
public class JarSignerException extends RuntimeException {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, 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
@@ -43,7 +43,7 @@
class EventRequestManagerImpl extends MirrorImpl
implements EventRequestManager
{
- List<? extends EventRequest>[] requestLists;
+ private final List<? extends EventRequest>[] requestLists;
private static int methodExitEventCmd = 0;
static int JDWPtoJDISuspendPolicy(byte jdwpPolicy) {
@@ -83,7 +83,7 @@
return System.identityHashCode(this);
}
- abstract class EventRequestImpl extends MirrorImpl implements EventRequest {
+ private abstract class EventRequestImpl extends MirrorImpl implements EventRequest {
int id;
/*
@@ -734,7 +734,7 @@
}
requestLists = new List[highest+1];
for (int i=0; i <= highest; i++) {
- requestLists[i] = new ArrayList<>();
+ requestLists[i] = Collections.synchronizedList(new ArrayList<>());
}
}
@@ -933,22 +933,27 @@
}
List<? extends EventRequest> unmodifiableRequestList(int eventCmd) {
- return Collections.unmodifiableList(requestList(eventCmd));
+ // No need of explicit synchronization for requestList here.
+ // It is taken care internally by SynchronizedList class.
+ return Collections.unmodifiableList(new ArrayList<>(requestList(eventCmd)));
}
EventRequest request(int eventCmd, int requestId) {
List<? extends EventRequest> rl = requestList(eventCmd);
- for (int i = rl.size() - 1; i >= 0; i--) {
- EventRequestImpl er = (EventRequestImpl)rl.get(i);
- if (er.id == requestId) {
- return er;
+ synchronized(rl) { // Refer Collections.synchronizedList javadoc.
+ Iterator<? extends EventRequest> itr = rl.iterator();
+ while (itr.hasNext()){
+ EventRequestImpl er = (EventRequestImpl)itr.next();
+ if (er.id == requestId)
+ return er;
}
}
return null;
}
- List<? extends EventRequest> requestList(int eventCmd) {
+ private List<? extends EventRequest> requestList(int eventCmd) {
return requestLists[eventCmd];
}
}
+
--- a/jdk/src/jdk.management/share/classes/com/sun/management/VMOption.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.management/share/classes/com/sun/management/VMOption.java Thu Jan 21 10:17:21 2016 -0800
@@ -96,7 +96,7 @@
ERGONOMIC,
/**
* The VM option was set using the attach framework.
- * @since 1.9
+ * @since 9
*/
ATTACH_ON_DEMAND,
/**
--- a/jdk/src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandImpl.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandImpl.java Thu Jan 21 10:17:21 2016 -0800
@@ -343,7 +343,7 @@
"Diagnostic Framework Notification");
}
}
- return notifInfo;
+ return notifInfo.clone();
}
private static long seqNumber = 0;
--- a/jdk/src/jdk.management/share/classes/com/sun/management/internal/GarbageCollectorExtImpl.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/GarbageCollectorExtImpl.java Thu Jan 21 10:17:21 2016 -0800
@@ -81,17 +81,12 @@
GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION
};
- private MBeanNotificationInfo[] notifInfo = null;
public MBeanNotificationInfo[] getNotificationInfo() {
- synchronized (this) {
- if (notifInfo == null) {
- notifInfo = new MBeanNotificationInfo[1];
- notifInfo[0] = new MBeanNotificationInfo(gcNotifTypes,
- notifName,
- "GC Notification");
- }
- }
- return notifInfo;
+ return new MBeanNotificationInfo[]{
+ new MBeanNotificationInfo(gcNotifTypes,
+ notifName,
+ "GC Notification")
+ };
}
private static long seqNumber = 0;
--- a/jdk/src/jdk.security.jgss/share/classes/com/sun/security/jgss/InquireType.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/src/jdk.security.jgss/share/classes/com/sun/security/jgss/InquireType.java Thu Jan 21 10:17:21 2016 -0800
@@ -40,7 +40,7 @@
* <li>Format: "RAW"
* <li>Encoded form: the raw key bytes, not in any ASN.1 encoding
* </ul>
- * @deprecated as of 1.9, replaced by {@link #KRB5_GET_SESSION_KEY_EX}
+ * @deprecated as of 9, replaced by {@link #KRB5_GET_SESSION_KEY_EX}
* which returns an instance of
* {@link javax.security.auth.kerberos.EncryptionKey}
* that implements the {@link javax.crypto.SecretKey} interface and
@@ -53,7 +53,7 @@
* established Kerberos 5 security context. The return value is an
* instance of {@link javax.security.auth.kerberos.EncryptionKey}.
*
- * @since 1.9
+ * @since 9
*/
KRB5_GET_SESSION_KEY_EX,
/**
@@ -83,7 +83,7 @@
* is about to send to an acceptor. The return type is an instance of
* {@link javax.security.auth.kerberos.KerberosCredMessage}.
*
- * @since 1.9
+ * @since 9
*/
KRB5_GET_KRB_CRED,
}
--- a/jdk/test/TEST.groups Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/TEST.groups Thu Jan 21 10:17:21 2016 -0800
@@ -31,8 +31,8 @@
-java/util/zip/TestLocalTime.java \
:jdk_util \
-java/util/WeakHashMap/GCDuringIteration.java \
- -java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java
- -java/util/concurrent/forkjoin/FJExceptionTableLeak.java
+ -java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \
+ -java/util/concurrent/forkjoin/FJExceptionTableLeak.java \
sun/nio/cs/ISO8859x.java \
java/nio/Buffer \
com/sun/crypto/provider/Cipher \
@@ -43,7 +43,7 @@
java/util/zip/TestLocalTime.java \
java/util/WeakHashMap/GCDuringIteration.java \
java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \
- java/util/concurrent/forkjoin/FJExceptionTableLeak.java
+ java/util/concurrent/forkjoin/FJExceptionTableLeak.java \
:jdk_io \
:jdk_nio \
-sun/nio/cs/ISO8859x.java \
--- a/jdk/test/com/sun/crypto/provider/Cipher/DES/PerformanceTest.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/com/sun/crypto/provider/Cipher/DES/PerformanceTest.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
@@ -33,7 +33,6 @@
import java.io.*;
import javax.crypto.*;
import javax.crypto.spec.*;
-import com.sun.crypto.provider.*;
public class PerformanceTest {
@@ -81,8 +80,6 @@
byte[] in;
- SunJCE jce = new SunJCE();
- Security.addProvider(jce);
col = new StringBuffer();
printHeadings();
--- a/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh Thu Jan 21 10:17:21 2016 -0800
@@ -121,7 +121,8 @@
jdbFailIfNotPresent 'System\..*end of test'
# make sure we had at least one full GC
-debuggeeFailIfNotPresent 'Full GC'
+# Prior to JDK9-B95, the pattern was 'Full GC'
+debuggeeMatchRegexp '^.*?\bPause Full\b\(System.gc\(\)\)\b.*?$'
# check for error message due to thread ID change
debuggeeFailIfPresent \
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java Thu Jan 21 10:17:21 2016 -0800
@@ -24,6 +24,8 @@
/*
* @test
* @bug 8028994
+ * @ignore 8147477
+ * @ignore 8147494
* @author Staffan Larsen
* @library /lib/testlibrary
* @modules jdk.attach/sun.tools.attach
@@ -62,7 +64,7 @@
ProcessBuilder pb = ProcessTools.
createJavaProcessBuilder(
"-XX:+UseConcMarkSweepGC", // this will cause UseParNewGC to be FLAG_SET_ERGO
- "-XX:+PrintGCDetails",
+ "-XX:+UseCodeAging",
"-XX:+UseCerealGC", // Should be ignored.
"-XX:Flags=" + flagsFile.getAbsolutePath(),
"-cp", System.getProperty("test.class.path"),
@@ -97,7 +99,7 @@
// Not set, so should be default
checkOrigin("ManagementServer", Origin.DEFAULT);
// Set on the command line
- checkOrigin("PrintGCDetails", Origin.VM_CREATION);
+ checkOrigin("UseCodeAging", Origin.VM_CREATION);
// Set in _JAVA_OPTIONS
checkOrigin("TraceExceptions", Origin.ENVIRON_VAR);
// Set in JAVA_TOOL_OPTIONS
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/GetVMOption.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/GetVMOption.java Thu Jan 21 10:17:21 2016 -0800
@@ -28,7 +28,7 @@
* @author Mandy Chung
*
* @modules jdk.management
- * @run main/othervm -XX:+PrintGCDetails GetVMOption
+ * @run main/othervm -XX:+HeapDumpOnOutOfMemoryError GetVMOption
*/
import com.sun.management.HotSpotDiagnosticMXBean;
@@ -38,7 +38,7 @@
import javax.management.MBeanServer;
public class GetVMOption {
- private static final String PRINT_GC_DETAILS = "PrintGCDetails";
+ private static final String HEAP_DUMP_ON_OOM = "HeapDumpOnOutOfMemoryError";
private static final String EXPECTED_VALUE = "true";
private static final String BAD_OPTION = "BadOption";
private static final String HOTSPOT_DIAGNOSTIC_MXBEAN_NAME =
@@ -58,7 +58,7 @@
}
private static void checkVMOption(HotSpotDiagnosticMXBean mbean) {
- VMOption option = mbean.getVMOption(PRINT_GC_DETAILS);
+ VMOption option = mbean.getVMOption(HEAP_DUMP_ON_OOM);
if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
throw new RuntimeException("Unexpected value: " +
option.getValue() + " expected: " + EXPECTED_VALUE);
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/SetVMOption.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/SetVMOption.java Thu Jan 21 10:17:21 2016 -0800
@@ -30,7 +30,7 @@
* @author Jaroslav Bachorik
*
* @modules jdk.management
- * @run main/othervm -XX:+PrintGCDetails SetVMOption
+ * @run main/othervm -XX:+HeapDumpOnOutOfMemoryError SetVMOption
*/
import java.lang.management.ManagementFactory;
@@ -40,7 +40,7 @@
import com.sun.management.VMOption.Origin;
public class SetVMOption {
- private static final String PRINT_GC_DETAILS = "PrintGCDetails";
+ private static final String HEAP_DUMP_ON_OOM = "HeapDumpOnOutOfMemoryError";
private static final String EXPECTED_VALUE = "true";
private static final String BAD_VALUE = "yes";
private static final String NEW_VALUE = "false";
@@ -51,7 +51,7 @@
mbean =
ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
- VMOption option = findPrintGCDetailsOption();
+ VMOption option = findHeapDumpOnOomOption();
if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
throw new RuntimeException("Unexpected value: " +
option.getValue() + " expected: " + EXPECTED_VALUE);
@@ -61,14 +61,14 @@
option.getOrigin() + " expected: VM_CREATION");
}
if (!option.isWriteable()) {
- throw new RuntimeException("Expected " + PRINT_GC_DETAILS +
+ throw new RuntimeException("Expected " + HEAP_DUMP_ON_OOM +
" to be writeable");
}
// set VM option to a new value
- mbean.setVMOption(PRINT_GC_DETAILS, NEW_VALUE);
+ mbean.setVMOption(HEAP_DUMP_ON_OOM, NEW_VALUE);
- option = findPrintGCDetailsOption();
+ option = findHeapDumpOnOomOption();
if (!option.getValue().equalsIgnoreCase(NEW_VALUE)) {
throw new RuntimeException("Unexpected value: " +
option.getValue() + " expected: " + NEW_VALUE);
@@ -77,7 +77,7 @@
throw new RuntimeException("Unexpected origin: " +
option.getOrigin() + " expected: MANAGEMENT");
}
- VMOption o = mbean.getVMOption(PRINT_GC_DETAILS);
+ VMOption o = mbean.getVMOption(HEAP_DUMP_ON_OOM);
if (!option.getValue().equals(o.getValue())) {
throw new RuntimeException("Unmatched value: " +
option.getValue() + " expected: " + o.getValue());
@@ -123,17 +123,17 @@
}
}
- public static VMOption findPrintGCDetailsOption() {
+ public static VMOption findHeapDumpOnOomOption() {
List<VMOption> options = mbean.getDiagnosticOptions();
VMOption gcDetails = null;
for (VMOption o : options) {
- if (o.getName().equals(PRINT_GC_DETAILS)) {
+ if (o.getName().equals(HEAP_DUMP_ON_OOM)) {
gcDetails = o;
break;
}
}
if (gcDetails == null) {
- throw new RuntimeException("VM option " + PRINT_GC_DETAILS +
+ throw new RuntimeException("VM option " + HEAP_DUMP_ON_OOM +
" not found");
}
return gcDetails;
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java Thu Jan 21 10:17:21 2016 -0800
@@ -100,7 +100,7 @@
opts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
opts.add("-cp");
opts.add(System.getProperty("test.class.path", "test.class.path"));
- opts.add("-XX:+PrintGCDetails");
+ opts.add("-Xlog:gc*=debug");
opts.addAll(Arrays.asList(testOpts));
opts.add(classMain);
--- a/jdk/test/java/lang/management/MemoryMXBean/RunUtil.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/java/lang/management/MemoryMXBean/RunUtil.java Thu Jan 21 10:17:21 2016 -0800
@@ -66,7 +66,7 @@
opts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
opts.add("-cp");
opts.add(System.getProperty("test.class.path", "test.class.path"));
- opts.add("-XX:+PrintGCDetails");
+ opts.add("-Xlog:gc*=debug");
if (clearGcOpts) {
opts = Utils.removeGcOpts(opts);
--- a/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh Thu Jan 21 10:17:21 2016 -0800
@@ -48,8 +48,8 @@
runOne InputArgument
-runOne -XX:+UseFastJNIAccessors -XX:+PrintGCDetails InputArgument -XX:+PrintGCDetails
-runOne -XX:+UseFastJNIAccessors -XX:+PrintGCDetails InputArgument -XX:+UseFastJNIAccessors
+runOne -XX:+UseFastJNIAccessors -Xlog:gc*=debug InputArgument
+runOne -XX:+UseFastJNIAccessors -Xlog:gc*=debug InputArgument -XX:+UseFastJNIAccessors
runOne "-Dprops=one two three" InputArgument "-Dprops=one two three"
exit 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ref/PhantomReferentClearing.java Thu Jan 21 10:17:21 2016 -0800
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2015, 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 8071507
+ * @summary Test that PhantomReferences are cleared when notified.
+ * @run main/othervm PhantomReferentClearing
+ */
+
+import java.lang.ref.PhantomReference;
+import java.lang.ref.ReferenceQueue;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PhantomReferentClearing {
+
+ private static final long ENQUEUE_TIMEOUT = 1000; // 1 sec, in millis
+
+ // P1 & P2 are PhantomReference objects
+ // O1 & O2 are objects
+ //
+ // -> is a strong reference
+ // => is a referent reference
+ //
+ // root -> P1
+ // root -> P2
+ // root -> O1
+ // root -> O2
+ // O1 -> O2
+ // P1 => O1
+ // P2 => O2
+ //
+ // (1) Remove root -> O1 and collect. P1 notified, P2 !notified.
+ // (2) Remove root -> O2 and collect.
+ //
+ // If phantom references are cleared when notified, as proposed by
+ // 8071507, then P2 should be notified, and the test passes.
+ //
+ // Otherwise, P2 does not get notified because it remains reachable
+ // from O1, which is being retained by P1. This fails the test.
+
+ private static final ReferenceQueue<Object> Q1 = new ReferenceQueue<>();
+ private static final ReferenceQueue<Object> Q2 = new ReferenceQueue<>();
+
+ private static volatile Object O2 = new Object();
+ private static volatile List<Object> O1 = new ArrayList<>();
+ static {
+ O1.add(O2);
+ }
+
+ private static final PhantomReference<Object> P1 = new PhantomReference<>(O1, Q1);
+ private static final PhantomReference<Object> P2 = new PhantomReference<>(O2, Q2);
+
+ public static void main(String[] args) throws InterruptedException {
+
+ // Collect, and verify neither P1 or P2 notified.
+ System.gc();
+ if (Q1.remove(ENQUEUE_TIMEOUT) != null) {
+ throw new RuntimeException("P1 already notified");
+ } else if (Q2.poll() != null) {
+ throw new RuntimeException("P2 already notified");
+ }
+
+ // Delete root -> O1, collect, verify P1 notified, P2 not notified.
+ O1 = null;
+ System.gc();
+ if (Q1.remove(ENQUEUE_TIMEOUT) == null) {
+ throw new RuntimeException("P1 not notified by O1 deletion");
+ } else if (Q2.remove(ENQUEUE_TIMEOUT) != null) {
+ throw new RuntimeException("P2 notified by O1 deletion.");
+ }
+
+ // Delete root -> O2, collect. P2 should be notified.
+ O2 = null;
+ System.gc();
+ if (Q2.remove(ENQUEUE_TIMEOUT) == null) {
+ throw new RuntimeException("P2 not notified by O2 deletion");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ref/ReachabilityFenceTest.java Thu Jan 21 10:17:21 2016 -0800
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2015, 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 8133348
+ * @summary Tests if reachabilityFence is working
+ *
+ * @run main/othervm -Xint -Dpremature=false ReachabilityFenceTest
+ * @run main/othervm -XX:TieredStopAtLevel=1 -Dpremature=true ReachabilityFenceTest
+ * @run main/othervm -XX:TieredStopAtLevel=2 -Dpremature=true ReachabilityFenceTest
+ * @run main/othervm -XX:TieredStopAtLevel=3 -Dpremature=true ReachabilityFenceTest
+ * @run main/othervm -XX:TieredStopAtLevel=4 -Dpremature=true ReachabilityFenceTest
+ */
+
+import java.lang.ref.Reference;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public class ReachabilityFenceTest {
+
+ /*
+ * Implementation notes:
+ *
+ * This test has positive and negative parts.
+ *
+ * Negative test is "nonFenced", and it tests that absent of reachabilityFence, the object can
+ * be prematurely finalized -- this validates the test itself. Not every VM mode is expected to
+ * prematurely finalize the objects, and -Dpremature option communicates that to test. If a VM mode
+ * passes the negative test, then our understanding of what could happen is correct, and we can
+ * go forward.
+ *
+ * Positive test is "fenced", and it checks that given the reachabilityFence at the end of the block,
+ * the object cannot be finalized. There is no sense running a positive test when premature finalization
+ * is not expected. It is a job for negative test to verify that invariant.
+ *
+ * The test methods should be appropriately compiled, therefore we do several iterations.
+ */
+
+ // Enough to OSR and compile
+ static final int LOOP_ITERS = Integer.getInteger("LOOP_ITERS", 50000);
+
+ // Enough after which to start triggering GC and finalization
+ static final int WARMUP_LOOP_ITERS = LOOP_ITERS - Integer.getInteger("GC_ITERS", 100);
+
+ // Enough to switch from an OSR'ed method to compiled method
+ static final int MAIN_ITERS = 3;
+
+ static final boolean PREMATURE_FINALIZATION = Boolean.getBoolean("premature");
+
+ public static void main(String... args) {
+ // Negative test
+ boolean finalized = false;
+ for (int c = 0; !finalized && c < MAIN_ITERS; c++) {
+ finalized |= nonFenced();
+ }
+
+ if (PREMATURE_FINALIZATION && !finalized) {
+ throw new IllegalStateException("The object had never been finalized before timeout reached.");
+ }
+
+ if (!PREMATURE_FINALIZATION && finalized) {
+ throw new IllegalStateException("The object had been finalized without a fence, even though we don't expect it.");
+ }
+
+ if (!PREMATURE_FINALIZATION)
+ return;
+
+ // Positive test
+ finalized = false;
+ for (int c = 0; !finalized && c < MAIN_ITERS; c++) {
+ finalized |= fenced();
+ }
+
+ if (finalized) {
+ throw new IllegalStateException("The object had been prematurely finalized.");
+ }
+ }
+
+ public static boolean nonFenced() {
+ AtomicBoolean finalized = new AtomicBoolean();
+ MyFinalizeable o = new MyFinalizeable(finalized);
+
+ for (int i = 0; i < LOOP_ITERS; i++) {
+ if (finalized.get()) break;
+ if (i > WARMUP_LOOP_ITERS) {
+ System.gc();
+ System.runFinalization();
+ }
+ }
+
+ return finalized.get();
+ }
+
+ public static boolean fenced() {
+ AtomicBoolean finalized = new AtomicBoolean();
+ MyFinalizeable o = new MyFinalizeable(finalized);
+
+ for (int i = 0; i < LOOP_ITERS; i++) {
+ if (finalized.get()) break;
+ if (i > WARMUP_LOOP_ITERS) {
+ System.gc();
+ System.runFinalization();
+ }
+ }
+
+ Reference.reachabilityFence(o);
+
+ return finalized.get();
+ }
+
+ private static class MyFinalizeable {
+ private final AtomicBoolean finalized;
+
+ public MyFinalizeable(AtomicBoolean b) {
+ this.finalized = b;
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ super.finalize();
+ finalized.set(true);
+ }
+ }
+}
\ No newline at end of file
--- a/jdk/test/java/nio/channels/ServerSocketChannel/AdaptServerSocket.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/java/nio/channels/ServerSocketChannel/AdaptServerSocket.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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
@@ -22,8 +22,8 @@
*/
/* @test
+ * @bug 4286936 8146213
* @summary Unit test for server-socket-channel adaptors
- * @key intermittent
*/
import java.io.*;
@@ -77,6 +77,9 @@
static void test(int clientDally, int timeout, boolean shouldTimeout)
throws Exception
{
+ boolean needClient = !shouldTimeout;
+ client = null;
+ clientException = null;
clientStarted = false;
out.println();
@@ -90,9 +93,11 @@
sso.bind(null);
out.println("bound: " + ssc);
out.println(" " + sso);
- startClient(sso.getLocalPort(), clientDally);
- while (!clientStarted) {
- Thread.sleep(20);
+ if (needClient) {
+ startClient(sso.getLocalPort(), clientDally);
+ while (!clientStarted) {
+ Thread.sleep(20);
+ }
}
Socket so = null;
try {
@@ -115,10 +120,12 @@
out.println("server: read " + b);
}
}
- client.interrupt();
- client.join();
- if (clientException != null)
- throw clientException;
+ if (needClient) {
+ client.interrupt();
+ client.join();
+ if (clientException != null)
+ throw clientException;
+ }
}
public static void main(String[] args) throws Exception {
--- a/jdk/test/java/text/Format/DecimalFormat/FormatMicroBenchmark.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/java/text/Format/DecimalFormat/FormatMicroBenchmark.java Thu Jan 21 10:17:21 2016 -0800
@@ -51,7 +51,7 @@
* getting reliable numbers. Otherwise GC activity may corrupt results.
* As of jdk80b48 using "-Xms500m -Xmx500m -XX:NewSize=400m" covers
* all cases.
- * - Optionally using "-XX:+printGC" option provides information that
+ * - Optionally using "-Xlog:gc" option provides information that
* helps checking any GC activity while benches are run.
*
* Vm Options:
@@ -60,7 +60,7 @@
* non fast-path case: -Xms500m -Xmx500m -XX:NewSize=400m
* or use worst case (non fast-path above) with both types of algorithm.
*
- * - use -XX:+PrintGC to verify memory consumption of the benchmarks.
+ * - use -Xlog:gc to verify memory consumption of the benchmarks.
* (See "Checking Memory Consumption" below).
*
* Description:
@@ -166,7 +166,7 @@
* but is not enough, since any unexpected incremental GC may lower
* artificially the estimation of the memory consumption.
*
- * Options to set are -Xms, -Xmx, -XX:NewSize, plus -XX:+PrintGC to evaluate
+ * Options to set are -Xms, -Xmx, -XX:NewSize, plus -Xlog:gc to evaluate
* correctly the values of these options. When running "-verbose", varying
* numbers reported for memory consumption may indicate bad choices for these
* options.
@@ -217,7 +217,7 @@
" getting reliable numbers. Otherwise GC activity may corrupt results.\n" +
" As of jdk80b48 using \"-Xms500m -Xmx500m -XX:NewSize=400m\" covers \n" +
" all cases.\n" +
- " - Optionally using \"-XX:+printGC\" option provides information that \n" +
+ " - Optionally using \"-Xlog:gc\" option provides information that \n" +
" helps checking any GC activity while benches are run.\n\n" +
"Look at the heading comments and description in source code for " +
"detailed information.\n");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/management/loading/MletParserLocaleTest.java Thu Jan 21 10:17:21 2016 -0800
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2015, 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 7065236
+ * @summary Checking MletParser for Locale insensitive strings
+ * @author Harsha Wardhana B
+ * @modules java.management
+ * @run clean MletParserLocaleTest
+ * @run build MletParserLocaleTest
+ * @run main/othervm/timeout=5 MletParserLocaleTest mlet4.html
+ */
+
+import java.io.File;
+import java.util.Locale;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+import javax.management.loading.MLet;
+
+public class MletParserLocaleTest {
+
+ public static void main(String[] args) throws Exception {
+
+ boolean error = false;
+
+ // Instantiate the MBean server
+ //
+ System.out.println("Create the MBean server");
+ MBeanServer mbs = MBeanServerFactory.createMBeanServer();
+
+ // Get Default Locale
+ Locale loc = Locale.getDefault();
+
+ // Instantiate an MLet
+ //
+ System.out.println("Create the MLet");
+ MLet mlet = new MLet();
+
+ // Register the MLet MBean with the MBeanServer
+ //
+ System.out.println("Register the MLet MBean");
+ ObjectName mletObjectName = new ObjectName("Test:type=MLet");
+ mbs.registerMBean(mlet, mletObjectName);
+
+ // Call getMBeansFromURL
+ //
+ System.out.println("Call mlet.getMBeansFromURL(<url>)");
+ String testSrc = System.getProperty("test.src");
+ System.out.println("test.src = " + testSrc);
+ String urlCodebase;
+ if (testSrc.startsWith("/")) {
+ urlCodebase =
+ "file:" + testSrc.replace(File.separatorChar, '/') + "/";
+ } else {
+ urlCodebase =
+ "file:/" + testSrc.replace(File.separatorChar, '/') + "/";
+ }
+ String mletFile = urlCodebase + args[0];
+ System.out.println("MLet File = " + mletFile);
+ try {
+ // Change default Locale to Turkish
+ Locale.setDefault(new Locale("tr", "TR"));
+ mlet.getMBeansFromURL(mletFile);
+ System.out.println("Test Passes");
+ } catch (Exception e) {
+ error = true;
+ e.printStackTrace(System.out);
+ }finally {
+ Locale.setDefault(loc);
+ }
+
+ // Unregister the MLet MBean
+ //
+ System.out.println("Unregister the MLet MBean");
+ mbs.unregisterMBean(mletObjectName);
+
+ // Release MBean server
+ //
+ System.out.println("Release the MBean server");
+ MBeanServerFactory.releaseMBeanServer(mbs);
+
+ // End Test
+ //
+ System.out.println("Bye! Bye!");
+ if (error) System.exit(1);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/management/loading/mlet4.html Thu Jan 21 10:17:21 2016 -0800
@@ -0,0 +1,2 @@
+<MLET CODE=HelloWorld ARCHIVE="helloworld.jar">
+</MLET>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/management/modelmbean/DescriptorSupportXMLLocaleTest.java Thu Jan 21 10:17:21 2016 -0800
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2015, 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 7065236
+ * @summary Test for locale insensitive strings in DescriptorSupport class
+ * @author Harsha Wardhana B
+ * @modules java.management
+ * @run clean DescriptorSupportXMLLocaleTest
+ * @run build DescriptorSupportXMLLocaleTest
+ * @run main DescriptorSupportXMLLocaleTest
+ */
+import java.util.Locale;
+import javax.management.modelmbean.DescriptorSupport;
+
+public class DescriptorSupportXMLLocaleTest {
+
+ public static void main(String[] args) throws Exception {
+ boolean failed = false;
+ String xmlDesc = "<DESCRIPTOR>"
+ + "<FIELD name=\"field1\" value=\"dummy\">"
+ + "</FIELD>"
+ + "</DESCRIPTOR>";
+ Locale loc = Locale.getDefault();
+ try {
+ Locale.setDefault(new Locale("tr", "TR"));
+ new DescriptorSupport(xmlDesc);
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ failed = true;
+ }finally{
+ Locale.setDefault(loc);
+ }
+
+ if (!failed) {
+ System.out.println("OK: all tests passed");
+ } else {
+ System.out.println("TEST FAILED");
+ throw new IllegalArgumentException("Test Failed");
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/management/remote/mandatory/connection/JMXServiceURLLocaleTest.java Thu Jan 21 10:17:21 2016 -0800
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2015, 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 7065236
+ * @summary Test for locale insensitive strings in JMXServiceURL class
+ * @author Harsha Wardhana B
+ * @modules java.management
+ * @run clean JMXServiceURLLocaleTest
+ * @run build JMXServiceURLLocaleTest
+ * @run main JMXServiceURLLocaleTest
+*/
+
+import java.util.Locale;
+import javax.management.remote.JMXServiceURL;
+
+public class JMXServiceURLLocaleTest {
+ public static void main(String[] args) throws Exception {
+
+ boolean error = false;
+ Locale loc = Locale.getDefault();
+
+ try {
+ echo("Setting Turkish locale");
+ // Set locale other than Locale.ENGLISH
+ Locale.setDefault(new Locale("tr", "TR"));
+ new JMXServiceURL("service:jmx:RMI://");
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ error = true;
+ } finally {
+ Locale.setDefault(loc);
+ echo("\n>>> Bye! Bye!");
+ }
+
+ if (error) {
+ echo("\nTest failed! ");
+ throw new IllegalArgumentException("Test failed");
+ } else {
+ echo("\nTest passed!\n");
+ }
+ }
+
+ private static void echo(String msg) {
+ System.out.println(msg);
+ }
+}
--- a/jdk/test/javax/net/ssl/HttpsURLConnection/CriticalSubjectAltName.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/javax/net/ssl/HttpsURLConnection/CriticalSubjectAltName.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, 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
@@ -159,8 +159,10 @@
public static void main(String[] args) throws Exception {
// MD5 is used in this test case, don't disable MD5 algorithm.
- Security.setProperty(
- "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.certpath.disabledAlgorithms",
+ "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.tls.disabledAlgorithms",
+ "SSLv3, RC4, DH keySize < 768");
String keyFilename =
System.getProperty("test.src", "./") + "/" + pathToStores +
--- a/jdk/test/javax/net/ssl/SSLSession/SSLCtxAccessToSessCtx.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/javax/net/ssl/SSLSession/SSLCtxAccessToSessCtx.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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
@@ -35,6 +35,7 @@
import java.net.*;
import javax.net.ssl.*;
import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
import java.security.KeyStore;
public class SSLCtxAccessToSessCtx {
@@ -63,7 +64,7 @@
/*
* Is the server ready to serve?
*/
- volatile static boolean serverReady = false;
+ AtomicInteger serverReady = new AtomicInteger(1); // only one port now
/*
* Turn on SSL debugging?
@@ -89,12 +90,13 @@
SSLServerSocket sslServerSocket =
(SSLServerSocket) sslssf.createServerSocket(serverPort);
- serverPorts[createdPorts++] = sslServerSocket.getLocalPort();
+ int slot = createdPorts.getAndIncrement();
+ serverPorts[slot] = sslServerSocket.getLocalPort();
/*
* Signal Client, we're ready for his connect.
*/
- serverReady = true;
+ serverReady.getAndDecrement();
int read = 0;
SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
InputStream sslIS = sslSocket.getInputStream();
@@ -121,7 +123,7 @@
/*
* Wait for server to get started.
*/
- while (!serverReady) {
+ while (serverReady.get() > 0) {
Thread.sleep(50);
}
/*
@@ -151,8 +153,8 @@
* The remainder is just support stuff
*/
- volatile int serverPorts[] = new int[]{0};
- volatile int createdPorts = 0;
+ int serverPorts[] = new int[]{0}; // only one port at present
+ AtomicInteger createdPorts = new AtomicInteger(0);
static SSLServerSocketFactory sslssf;
static SSLSocketFactory sslsf;
static SSLContext sslctx;
@@ -255,14 +257,20 @@
*/
System.err.println("Server died...");
e.printStackTrace();
- serverReady = true;
+ serverReady.set(0);
serverException = e;
}
}
};
serverThread.start();
} else {
- doServerSide(port);
+ try {
+ doServerSide(port);
+ } catch (Exception e) {
+ serverException = e;
+ } finally {
+ serverReady.set(0);
+ }
}
}
@@ -284,7 +292,11 @@
};
clientThread.start();
} else {
- doClientSide();
+ try {
+ doClientSide();
+ } catch (Exception e) {
+ clientException = e;
+ }
}
}
}
--- a/jdk/test/javax/net/ssl/SSLSession/SessionTimeOutTests.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/javax/net/ssl/SSLSession/SessionTimeOutTests.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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
@@ -112,7 +112,8 @@
SSLServerSocket sslServerSocket =
(SSLServerSocket) sslssf.createServerSocket(serverPort);
- serverPorts[createdPorts++] = sslServerSocket.getLocalPort();
+ int slot = createdPorts.getAndIncrement();
+ serverPorts[slot] = sslServerSocket.getLocalPort();
/*
* Signal Client, we're ready for his connect.
@@ -288,8 +289,8 @@
* The remainder is just support stuff
*/
- volatile int serverPorts[] = new int[PORTS];
- volatile int createdPorts = 0;
+ int serverPorts[] = new int[PORTS];
+ AtomicInteger createdPorts = new AtomicInteger(0);
static SSLServerSocketFactory sslssf;
static SSLSocketFactory sslsf;
static SSLContext sslctx;
--- a/jdk/test/javax/net/ssl/ServerName/SSLSocketSNISensitive.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/javax/net/ssl/ServerName/SSLSocketSNISensitive.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -433,8 +433,10 @@
public static void main(String[] args) throws Exception {
// MD5 is used in this test case, don't disable MD5 algorithm.
- Security.setProperty(
- "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.certpath.disabledAlgorithms",
+ "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.tls.disabledAlgorithms",
+ "SSLv3, RC4, DH keySize < 768");
if (debug)
System.setProperty("javax.net.debug", "all");
--- a/jdk/test/javax/net/ssl/TLS/TestJSSE.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/javax/net/ssl/TLS/TestJSSE.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, 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
@@ -111,8 +111,6 @@
out.println(" Testing - https://" + LOCAL_IP + ":" + testPort);
out.println(" Testing - Protocol : " + testProtocols);
out.println(" Testing - Cipher : " + testCipher);
- Provider p = new sun.security.ec.SunEC();
- Security.insertProviderAt(p, 1);
try {
CipherTestUtils.main(new JSSEFactory(LOCAL_IP,
testPort, testProtocols,
@@ -132,8 +130,6 @@
out.println(" Testing Protocol: " + testProtocol);
out.println(" Testing Cipher: " + testCipher);
out.println(" Testing Port: " + testPort);
- Provider p = new sun.security.ec.SunEC();
- Security.insertProviderAt(p, 1);
try {
CipherTestUtils.main(new JSSEFactory(null, testPort,
testProtocol, testCipher, "Server JSSE"),
--- a/jdk/test/javax/net/ssl/TLSv11/EmptyCertificateAuthorities.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/javax/net/ssl/TLSv11/EmptyCertificateAuthorities.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -230,8 +230,10 @@
public static void main(String[] args) throws Exception {
// MD5 is used in this test case, don't disable MD5 algorithm.
- Security.setProperty(
- "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.certpath.disabledAlgorithms",
+ "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.tls.disabledAlgorithms",
+ "SSLv3, RC4, DH keySize < 768");
String keyFilename =
System.getProperty("test.src", ".") + "/" + pathToStores +
--- a/jdk/test/javax/net/ssl/TLSv12/ShortRSAKey512.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/javax/net/ssl/TLSv12/ShortRSAKey512.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -282,6 +282,8 @@
// reset the security property to make sure that the algorithms
// and keys used in this test are not disabled.
Security.setProperty("jdk.certpath.disabledAlgorithms", "MD2");
+ Security.setProperty("jdk.tls.disabledAlgorithms",
+ "SSLv3, RC4, DH keySize < 768");
if (debug)
System.setProperty("javax.net.debug", "all");
--- a/jdk/test/javax/net/ssl/TLSv12/ShortRSAKeyGCM.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/javax/net/ssl/TLSv12/ShortRSAKeyGCM.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -303,6 +303,8 @@
// reset the security property to make sure that the algorithms
// and keys used in this test are not disabled.
Security.setProperty("jdk.certpath.disabledAlgorithms", "MD2");
+ Security.setProperty("jdk.tls.disabledAlgorithms",
+ "SSLv3, RC4, DH keySize < 768");
if (debug) {
System.setProperty("javax.net.debug", "all");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/ws/publish/WSTest.java Thu Jan 21 10:17:21 2016 -0800
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2016, 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 8146086
+ * @summary Publishing two webservices on same port fails with "java.net.BindException: Address already in use"
+ * @run main/othervm WSTest
+ */
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.xml.ws.Endpoint;
+import java.net.ServerSocket;
+
+public class WSTest {
+
+ @WebService(targetNamespace = "test")
+ public static class Method1 {
+ @WebMethod
+ public String getMethod1Value() {
+ return "from Method1";
+ }
+ }
+
+ @WebService(targetNamespace = "test")
+ public static class Method2 {
+ @WebMethod
+ public String getMethod2Value() {
+ return "from Method2";
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+
+ // find a free port
+ ServerSocket ss = new ServerSocket(0);
+ int port = ss.getLocalPort();
+ ss.close();
+
+ Endpoint endPoint1 = null;
+ Endpoint endPoint2 = null;
+ try {
+ endPoint1 = Endpoint.publish("http://0.0.0.0:" + port + "/method1",
+ new Method1());
+ endPoint2 = Endpoint.publish("http://0.0.0.0:" + port + "/method2",
+ new Method2());
+
+ System.out.println("Sleep 3 secs...");
+
+ Thread.sleep(3000);
+ } finally {
+ stop(endPoint2);
+ stop(endPoint1);
+ }
+ }
+
+ private static void stop(Endpoint endPoint) {
+ if (endPoint == null) return;
+
+ try {
+ endPoint.stop();
+ } catch (Throwable ignored) {
+ }
+ }
+
+}
--- a/jdk/test/lib/testlibrary/ExtendedRobot.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/lib/testlibrary/ExtendedRobot.java Thu Jan 21 10:17:21 2016 -0800
@@ -48,7 +48,7 @@
* </pre>
*
* @author Dmitriy Ermashov
- * @since 1.9
+ * @since 9
*/
public class ExtendedRobot extends Robot {
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java Thu Jan 21 10:17:21 2016 -0800
@@ -38,8 +38,7 @@
* <pre>
* {@code
* JDKToolLauncher jmap = JDKToolLauncher.create("jmap")
- * .addVMArg("-XX:+PrintGC");
- * .addVMArg("-XX:+PrintGCDetails")
+ * .addVMArg("-Xlog:gc*=debug")
* .addToolArg("-heap")
* .addToolArg(pid);
* ProcessBuilder pb = new ProcessBuilder(jmap.getCommand());
--- a/jdk/test/sun/invoke/anon/ConstantPoolPatch/OptimalMapSize.java Thu Jan 21 09:46:03 2016 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2015, 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 8080535
- * @summary Static storages should be initialized with optimal capacity
- * @library /lib/testlibrary
- * @build jdk.testlibrary.OptimalCapacity
- * @run main OptimalMapSize
- */
-
-import jdk.testlibrary.OptimalCapacity;
-
-public class OptimalMapSize {
- public static void main(String[] args) throws Throwable {
- OptimalCapacity.ofIdentityHashMap(
- Class.forName("sun.invoke.anon.ConstantPoolPatch"),
- "CONSTANT_VALUE_CLASS_TAG", 6);
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/management/jmxremote/bootstrap/JMXAgentInterfaceBinding.java Thu Jan 21 10:17:21 2016 -0800
@@ -0,0 +1,297 @@
+/*
+ * Copyright (c) 2015, Red Hat Inc
+ * 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.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.MalformedURLException;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+import javax.management.remote.rmi.RMIConnectorServer;
+import javax.net.ssl.SSLSocket;
+import javax.net.ssl.SSLSocketFactory;
+import javax.rmi.ssl.SslRMIClientSocketFactory;
+
+/**
+ * Tests client connections to the JDK's built-in JMX agent server on the given
+ * ports/interface combinations.
+ *
+ * @see JMXInterfaceBindingTest
+ *
+ * @author Severin Gehwolf <sgehwolf@redhat.com>
+ *
+ * Usage:
+ *
+ * SSL:
+ * java -Dcom.sun.management.jmxremote.ssl.need.client.auth=true \
+ * -Dcom.sun.management.jmxremote.host=127.0.0.1 \
+ * -Dcom.sun.management.jmxremote.port=9111 \
+ * -Dcom.sun.management.jmxremote.rmi.port=9112 \
+ * -Dcom.sun.management.jmxremote.authenticate=false \
+ * -Dcom.sun.management.jmxremote.ssl=true \
+ * -Dcom.sun.management.jmxremote.registry.ssl=true
+ * -Djavax.net.ssl.keyStore=... \
+ * -Djavax.net.ssl.keyStorePassword=... \
+ * JMXAgentInterfaceBinding 127.0.0.1 9111 9112 true
+ *
+ * Non-SSL:
+ * java -Dcom.sun.management.jmxremote.host=127.0.0.1 \
+ * -Dcom.sun.management.jmxremote.port=9111 \
+ * -Dcom.sun.management.jmxremote.rmi.port=9112 \
+ * -Dcom.sun.management.jmxremote.authenticate=false \
+ * -Dcom.sun.management.jmxremote.ssl=false \
+ * JMXAgentInterfaceBinding 127.0.0.1 9111 9112 false
+ *
+ */
+public class JMXAgentInterfaceBinding {
+
+ private final MainThread mainThread;
+
+ public JMXAgentInterfaceBinding(InetAddress bindAddress,
+ int jmxPort,
+ int rmiPort,
+ boolean useSSL) {
+ this.mainThread = new MainThread(bindAddress, jmxPort, rmiPort, useSSL);
+ }
+
+ public void startEndpoint() {
+ mainThread.start();
+ try {
+ mainThread.join();
+ } catch (InterruptedException e) {
+ throw new RuntimeException("Test failed", e);
+ }
+ if (mainThread.isFailed()) {
+ mainThread.rethrowException();
+ }
+ }
+
+ public static void main(String[] args) {
+ if (args.length != 4) {
+ throw new RuntimeException(
+ "Test failed. usage: java JMXInterfaceBindingTest <BIND_ADDRESS> <JMX_PORT> <RMI_PORT> {true|false}");
+ }
+ int jmxPort = parsePortFromString(args[1]);
+ int rmiPort = parsePortFromString(args[2]);
+ boolean useSSL = Boolean.parseBoolean(args[3]);
+ String strBindAddr = args[0];
+ System.out.println(
+ "DEBUG: Running test for triplet (hostname,jmxPort,rmiPort) = ("
+ + strBindAddr + "," + jmxPort + "," + rmiPort + "), useSSL = " + useSSL);
+ InetAddress bindAddress;
+ try {
+ bindAddress = InetAddress.getByName(args[0]);
+ } catch (UnknownHostException e) {
+ throw new RuntimeException("Test failed. Unknown ip: " + args[0]);
+ }
+ JMXAgentInterfaceBinding test = new JMXAgentInterfaceBinding(bindAddress,
+ jmxPort, rmiPort, useSSL);
+ test.startEndpoint(); // Expect for main test to terminate process
+ }
+
+ private static int parsePortFromString(String port) {
+ try {
+ return Integer.parseInt(port);
+ } catch (NumberFormatException e) {
+ throw new RuntimeException(
+ "Invalid port specified. Not an integer! Value was: "
+ + port);
+ }
+ }
+
+ private static class JMXConnectorThread extends Thread {
+
+ private final InetAddress addr;
+ private final int jmxPort;
+ private final int rmiPort;
+ private final boolean useSSL;
+ private final CountDownLatch latch;
+ private boolean failed;
+ private boolean jmxConnectWorked;
+ private boolean rmiConnectWorked;
+
+ private JMXConnectorThread(InetAddress addr,
+ int jmxPort,
+ int rmiPort,
+ boolean useSSL,
+ CountDownLatch latch) {
+ this.addr = addr;
+ this.jmxPort = jmxPort;
+ this.rmiPort = rmiPort;
+ this.latch = latch;
+ this.useSSL = useSSL;
+ }
+
+ @Override
+ public void run() {
+ try {
+ connect();
+ } catch (IOException e) {
+ failed = true;
+ }
+ }
+
+ private void connect() throws IOException {
+ System.out.println(
+ "JMXConnectorThread: Attempting JMX connection on: "
+ + addr.getHostAddress() + " on port " + jmxPort);
+ JMXServiceURL url;
+ try {
+ url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://"
+ + addr.getHostAddress() + ":" + jmxPort + "/jmxrmi");
+ } catch (MalformedURLException e) {
+ throw new RuntimeException("Test failed.", e);
+ }
+ Map<String, Object> env = new HashMap<>();
+ if (useSSL) {
+ SslRMIClientSocketFactory csf = new SslRMIClientSocketFactory();
+ env.put("com.sun.jndi.rmi.factory.socket", csf);
+ env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, csf);
+ }
+ // connect and immediately close
+ JMXConnector c = JMXConnectorFactory.connect(url, env);
+ c.close();
+ System.out.println("JMXConnectorThread: connection to JMX worked");
+ jmxConnectWorked = true;
+ checkRmiSocket();
+ latch.countDown(); // signal we are done.
+ }
+
+ private void checkRmiSocket() throws IOException {
+ Socket rmiConnection;
+ if (useSSL) {
+ rmiConnection = SSLSocketFactory.getDefault().createSocket();
+ } else {
+ rmiConnection = new Socket();
+ }
+ SocketAddress target = new InetSocketAddress(addr, rmiPort);
+ rmiConnection.connect(target);
+ if (useSSL) {
+ ((SSLSocket)rmiConnection).startHandshake();
+ }
+ System.out.println(
+ "JMXConnectorThread: connection to rmi socket worked host/port = "
+ + addr.getHostAddress() + "/" + rmiPort);
+ rmiConnectWorked = true;
+ // Closing the channel without sending any data will cause an
+ // java.io.EOFException on the server endpoint. We don't care about this
+ // though, since we only want to test if we can connect.
+ rmiConnection.close();
+ }
+
+ public boolean isFailed() {
+ return failed;
+ }
+
+ public boolean jmxConnectionWorked() {
+ return jmxConnectWorked;
+ }
+
+ public boolean rmiConnectionWorked() {
+ return rmiConnectWorked;
+ }
+ }
+
+ private static class MainThread extends Thread {
+
+ private static final int WAIT_FOR_JMX_AGENT_TIMEOUT_MS = 500;
+ private final InetAddress bindAddress;
+ private final int jmxPort;
+ private final int rmiPort;
+ private final boolean useSSL;
+ private boolean terminated = false;
+ private boolean jmxAgentStarted = false;
+ private Exception excptn;
+
+ private MainThread(InetAddress bindAddress, int jmxPort, int rmiPort, boolean useSSL) {
+ this.bindAddress = bindAddress;
+ this.jmxPort = jmxPort;
+ this.rmiPort = rmiPort;
+ this.useSSL = useSSL;
+ }
+
+ @Override
+ public void run() {
+ try {
+ waitUntilReadyForConnections();
+ // Do nothing, but wait for termination.
+ try {
+ while (!terminated) {
+ Thread.sleep(100);
+ }
+ } catch (InterruptedException e) { // ignore
+ }
+ System.out.println("MainThread: Thread stopped.");
+ } catch (Exception e) {
+ this.excptn = e;
+ }
+ }
+
+ private void waitUntilReadyForConnections() {
+ CountDownLatch latch = new CountDownLatch(1);
+ JMXConnectorThread connectionTester = new JMXConnectorThread(
+ bindAddress, jmxPort, rmiPort, useSSL, latch);
+ connectionTester.start();
+ boolean expired = false;
+ try {
+ expired = !latch.await(WAIT_FOR_JMX_AGENT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+ System.out.println(
+ "MainThread: Finished waiting for JMX agent to become available: expired == "
+ + expired);
+ jmxAgentStarted = !expired;
+ } catch (InterruptedException e) {
+ throw new RuntimeException("Test failed", e);
+ }
+ if (!jmxAgentStarted) {
+ throw new RuntimeException(
+ "Test failed. JMX server agents not becoming available.");
+ }
+ if (connectionTester.isFailed()
+ || !connectionTester.jmxConnectionWorked()
+ || !connectionTester.rmiConnectionWorked()) {
+ throw new RuntimeException(
+ "Test failed. JMX agent does not seem ready. See log output for details.");
+ }
+ // The main test expects this exact message being printed
+ System.out.println("MainThread: Ready for connections");
+ }
+
+ private boolean isFailed() {
+ return excptn != null;
+ }
+
+ private void rethrowException() throws RuntimeException {
+ throw new RuntimeException(excptn);
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java Thu Jan 21 10:17:21 2016 -0800
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2015, Red Hat Inc
+ * 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.io.File;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+
+import jdk.testlibrary.ProcessThread;
+import jdk.testlibrary.ProcessTools;
+
+/**
+ * NOTE:
+ * This test requires at least a setup similar to the following in
+ * /etc/hosts file (or the windows equivalent). I.e. it expects it to
+ * be multi-homed and not both being the loop-back interface.
+ * For example:
+ * ----->8-------- /etc/hosts ----------->8---
+ * 127.0.0.1 localhost
+ * 192.168.0.1 localhost
+ * ----->8-------- /etc/hosts ----------->8---
+ *
+ * @test
+ * @bug 6425769
+ * @summary Test JMX agent host address binding. Same ports but different
+ * interfaces to bind to (using plain sockets and SSL sockets).
+ *
+ * @modules java.management/sun.management
+ * java.management/sun.management.jmxremote
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.* JMXAgentInterfaceBinding
+ * @run main/timeout=5 JMXInterfaceBindingTest
+ */
+public class JMXInterfaceBindingTest {
+
+ public static final int COMMUNICATION_ERROR_EXIT_VAL = 1;
+ public static final int STOP_PROCESS_EXIT_VAL = 143;
+ public static final int JMX_PORT = 9111;
+ public static final int RMI_PORT = 9112;
+ public static final String READY_MSG = "MainThread: Ready for connections";
+ public static final String TEST_CLASS = JMXAgentInterfaceBinding.class.getSimpleName();
+ public static final String KEYSTORE_LOC = System.getProperty("test.src", ".") +
+ File.separator +
+ "ssl" +
+ File.separator +
+ "keystore";
+ public static final String TRUSTSTORE_LOC = System.getProperty("test.src", ".") +
+ File.separator +
+ "ssl" +
+ File.separator +
+ "truststore";
+ public static final String TEST_CLASSPATH = System.getProperty("test.classes", ".");
+
+ public void run(InetAddress[] addrs) {
+ System.out.println("DEBUG: Running tests with plain sockets.");
+ runTests(addrs, false);
+ System.out.println("DEBUG: Running tests with SSL sockets.");
+ runTests(addrs, true);
+ }
+
+ private void runTests(InetAddress[] addrs, boolean useSSL) {
+ ProcessThread[] jvms = new ProcessThread[addrs.length];
+ for (int i = 0; i < addrs.length; i++) {
+ System.out.println();
+ String msg = String.format("DEBUG: Launching java tester for triplet (HOSTNAME,JMX_PORT,RMI_PORT) == (%s,%d,%d)",
+ addrs[i].getHostAddress(),
+ JMX_PORT,
+ RMI_PORT);
+ System.out.println(msg);
+ jvms[i] = runJMXBindingTest(addrs[i], useSSL);
+ jvms[i].start();
+ System.out.println("DEBUG: Started " + (i + 1) + " Process(es).");
+ }
+ int failedProcesses = 0;
+ for (ProcessThread pt: jvms) {
+ try {
+ pt.stopProcess();
+ pt.join();
+ } catch (InterruptedException e) {
+ System.err.println("Failed to stop process: " + pt.getName());
+ throw new RuntimeException("Test failed", e);
+ }
+ int exitValue = pt.getOutput().getExitValue();
+ // If there is a communication error (the case we care about)
+ // we get a exit code of 1
+ if (exitValue == COMMUNICATION_ERROR_EXIT_VAL) {
+ // Failure case since the java processes should still be
+ // running.
+ System.err.println("Test FAILURE on " + pt.getName());
+ failedProcesses++;
+ } else if (exitValue == STOP_PROCESS_EXIT_VAL) {
+ System.out.println("DEBUG: OK. Spawned java process terminated with expected exit code of " + STOP_PROCESS_EXIT_VAL);
+ } else {
+ System.err.println("Test FAILURE on " + pt.getName() + " reason: Unexpected exit code => " + exitValue);
+ failedProcesses++;
+ }
+ }
+ if (failedProcesses > 0) {
+ throw new RuntimeException("Test FAILED. " + failedProcesses + " out of " + addrs.length + " process(es) failed to start the JMX agent.");
+ }
+ }
+
+ private ProcessThread runJMXBindingTest(InetAddress a, boolean useSSL) {
+ List<String> args = new ArrayList<>();
+ args.add("-classpath");
+ args.add(TEST_CLASSPATH);
+ args.add("-Dcom.sun.management.jmxremote.host=" + a.getHostAddress());
+ args.add("-Dcom.sun.management.jmxremote.port=" + JMX_PORT);
+ args.add("-Dcom.sun.management.jmxremote.rmi.port=" + RMI_PORT);
+ args.add("-Dcom.sun.management.jmxremote.authenticate=false");
+ args.add("-Dcom.sun.management.jmxremote.ssl=" + Boolean.toString(useSSL));
+ if (useSSL) {
+ args.add("-Dcom.sun.management.jmxremote.registry.ssl=true");
+ args.add("-Djavax.net.ssl.keyStore=" + KEYSTORE_LOC);
+ args.add("-Djavax.net.ssl.trustStore=" + TRUSTSTORE_LOC);
+ args.add("-Djavax.net.ssl.keyStorePassword=password");
+ args.add("-Djavax.net.ssl.trustStorePassword=trustword");
+ }
+ args.add(TEST_CLASS);
+ args.add(a.getHostAddress());
+ args.add(Integer.toString(JMX_PORT));
+ args.add(Integer.toString(RMI_PORT));
+ args.add(Boolean.toString(useSSL));
+ try {
+ ProcessBuilder builder = ProcessTools.createJavaProcessBuilder(args.toArray(new String[] {}));
+ System.out.println(ProcessTools.getCommandLine(builder));
+ ProcessThread jvm = new ProcessThread("JMX-Tester-" + a.getHostAddress(), JMXInterfaceBindingTest::isJMXAgentResponseAvailable, builder);
+ return jvm;
+ } catch (Exception e) {
+ throw new RuntimeException("Test failed", e);
+ }
+
+ }
+
+ private static boolean isJMXAgentResponseAvailable(String line) {
+ if (line.equals(READY_MSG)) {
+ System.out.println("DEBUG: Found expected READY_MSG.");
+ return true;
+ } else if (line.startsWith("Error:")) {
+ // Allow for a JVM process that exits with
+ // "Error: JMX connector server communication error: ..."
+ // to continue as well since we handle that case elsewhere.
+ // This has the effect that the test does not timeout and
+ // fails with an exception in the test.
+ System.err.println("PROBLEM: JMX agent of target JVM did not start as it should.");
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static void main(String[] args) {
+ InetAddress[] addrs = getAddressesForLocalHost();
+ if (addrs.length < 2) {
+ System.out.println("Ignoring manual test since no more than one IPs are configured for 'localhost'");
+ return;
+ }
+ JMXInterfaceBindingTest test = new JMXInterfaceBindingTest();
+ test.run(addrs);
+ System.out.println("All tests PASSED.");
+ }
+
+ private static InetAddress[] getAddressesForLocalHost() {
+ InetAddress[] addrs;
+ try {
+ addrs = InetAddress.getAllByName("localhost");
+ } catch (UnknownHostException e) {
+ throw new RuntimeException("Test failed", e);
+ }
+ return addrs;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/www/http/HttpURLConnection/DigestAuth.java Thu Jan 21 10:17:21 2016 -0800
@@ -0,0 +1,424 @@
+/*
+ * Copyright (c) 2016, 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 com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpServer;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.Authenticator;
+import java.net.InetSocketAddress;
+import java.net.PasswordAuthentication;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.List;
+
+/*
+ * @test
+ * @bug 8138990
+ * @summary Tests for HTTP Digest auth
+ * The impl maintains a cache for auth info,
+ * the testcases run in a separate JVM to avoid cache hits
+ * @run main/othervm DigestAuth good
+ * @run main/othervm DigestAuth only_nonce
+ * @run main/othervm DigestAuth sha1
+ * @run main/othervm DigestAuth no_header
+ * @run main/othervm DigestAuth no_nonce
+ * @run main/othervm DigestAuth no_qop
+ * @run main/othervm DigestAuth invalid_alg
+ * @run main/othervm DigestAuth validate_server
+ * @run main/othervm DigestAuth validate_server_no_qop
+ */
+public class DigestAuth {
+
+ static final String LOCALHOST = "localhost";
+ static final String EXPECT_FAILURE = null;
+ static final String EXPECT_DIGEST = "Digest";
+ static final String REALM = "testrealm@host.com";
+ static final String NEXT_NONCE = "40f2e879449675f288476d772627370a";
+
+ static final String GOOD_WWW_AUTH_HEADER = "Digest "
+ + "realm=\"testrealm@host.com\", "
+ + "qop=\"auth,auth-int\", "
+ + "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
+ + "opaque=\"5ccc069c403ebaf9f0171e9517f40e41\"";
+
+ static final String GOOD_WWW_AUTH_HEADER_NO_QOP = "Digest "
+ + "realm=\"testrealm@host.com\", "
+ + "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
+ + "opaque=\"5ccc069c403ebaf9f0171e9517f40e41\"";
+
+ static final String WWW_AUTH_HEADER_NO_NONCE = "Digest "
+ + "realm=\"testrealm@host.com\", "
+ + "qop=\"auth,auth-int\", "
+ + "opaque=\"5ccc069c403ebaf9f0171e9517f40e41\"";
+
+ static final String WWW_AUTH_HEADER_NO_QOP = "Digest "
+ + "realm=\"testrealm@host.com\", "
+ + "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
+ + "opaque=\"5ccc069c403ebaf9f0171e9517f40e41\"";
+
+ static final String WWW_AUTH_HEADER_ONLY_NONCE = "Digest "
+ + "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\"";
+
+ static final String WWW_AUTH_HEADER_SHA1 = "Digest "
+ + "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
+ + "algorithm=\"SHA1\"";
+
+ static final String WWW_AUTH_HEADER_INVALID_ALGORITHM = "Digest "
+ + "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
+ + "algorithm=\"SHA123\"";
+
+ static final String AUTH_INFO_HEADER_NO_QOP_FIRST =
+ "nextnonce=\"" + NEXT_NONCE + "\", "
+ + "rspauth=\"ee85bc4315d8b18757809f1a8b9382d8\"";
+
+ static final String AUTH_INFO_HEADER_NO_QOP_SECOND =
+ "rspauth=\"12f2fa12841b3775b6054576722446b2\"";
+
+ static final String AUTH_INFO_HEADER_WRONG_DIGEST =
+ "nextnonce=\"" + NEXT_NONCE + "\", "
+ + "rspauth=\"7327570c586207eca2afae94fc20903d\", "
+ + "cnonce=\"0a4f113b\", "
+ + "nc=00000001, "
+ + "qop=auth";
+
+ public static void main(String[] args) throws Exception {
+ if (args.length == 0) {
+ throw new RuntimeException("No testcase specified");
+ }
+ String testcase = args[0];
+
+ // start a local HTTP server
+ try (LocalHttpServer server = LocalHttpServer.startServer()) {
+
+ // set authenticator
+ AuthenticatorImpl auth = new AuthenticatorImpl();
+ Authenticator.setDefault(auth);
+
+ String url = String.format("http://%s:%d/test/",
+ LOCALHOST, server.getPort());
+
+ boolean success = true;
+ switch (testcase) {
+ case "good":
+ // server returns a good WWW-Authenticate header
+ server.setWWWAuthHeader(GOOD_WWW_AUTH_HEADER);
+ success = testAuth(url, auth, EXPECT_DIGEST);
+ if (auth.lastRequestedPrompt == null ||
+ !auth.lastRequestedPrompt.equals(REALM)) {
+ System.out.println("Unexpected realm: "
+ + auth.lastRequestedPrompt);
+ success = false;
+ }
+ break;
+ case "validate_server":
+ // enable processing Authentication-Info headers
+ System.setProperty("http.auth.digest.validateServer",
+ "true");
+
+ /* Server returns good WWW-Authenticate
+ * and Authentication-Info headers with wrong digest
+ */
+ server.setWWWAuthHeader(GOOD_WWW_AUTH_HEADER);
+ server.setAuthInfoHeader(AUTH_INFO_HEADER_WRONG_DIGEST);
+ success = testAuth(url, auth, EXPECT_FAILURE);
+ if (auth.lastRequestedPrompt == null ||
+ !auth.lastRequestedPrompt.equals(REALM)) {
+ System.out.println("Unexpected realm: "
+ + auth.lastRequestedPrompt);
+ success = false;
+ }
+ break;
+ case "validate_server_no_qop":
+ // enable processing Authentication-Info headers
+ System.setProperty("http.auth.digest.validateServer",
+ "true");
+
+ /* Server returns good both WWW-Authenticate
+ * and Authentication-Info headers without any qop field,
+ * so that client-nonce should not be taked into account,
+ * and connection should succeed.
+ */
+ server.setWWWAuthHeader(GOOD_WWW_AUTH_HEADER_NO_QOP);
+ server.setAuthInfoHeader(AUTH_INFO_HEADER_NO_QOP_FIRST);
+ success = testAuth(url, auth, EXPECT_DIGEST);
+ if (auth.lastRequestedPrompt == null ||
+ !auth.lastRequestedPrompt.equals(REALM)) {
+ System.out.println("Unexpected realm: "
+ + auth.lastRequestedPrompt);
+ success = false;
+ }
+
+ // connect again and check if nextnonce was used
+ server.setAuthInfoHeader(AUTH_INFO_HEADER_NO_QOP_SECOND);
+ success &= testAuth(url, auth, EXPECT_DIGEST);
+ if (!NEXT_NONCE.equals(server.lastRequestedNonce)) {
+ System.out.println("Unexpected next nonce: "
+ + server.lastRequestedNonce);
+ success = false;
+ }
+ break;
+ case "only_nonce":
+ /* Server returns a good WWW-Authenticate header
+ * which contains only nonce (no realm set).
+ *
+ * Realm from WWW-Authenticate header is passed to
+ * authenticator which can use it as a prompt
+ * when it asks a user for credentials.
+ *
+ * It's fine if an HTTP client doesn't fail if no realm set,
+ * and delegates making a decision to authenticator/user.
+ */
+ server.setWWWAuthHeader(WWW_AUTH_HEADER_ONLY_NONCE);
+ success = testAuth(url, auth, EXPECT_DIGEST);
+ if (auth.lastRequestedPrompt != null &&
+ !auth.lastRequestedPrompt.trim().isEmpty()) {
+ System.out.println("Unexpected realm: "
+ + auth.lastRequestedPrompt);
+ success = false;
+ }
+ break;
+ case "sha1":
+ // server returns a good WWW-Authenticate header with SHA-1
+ server.setWWWAuthHeader(WWW_AUTH_HEADER_SHA1);
+ success = testAuth(url, auth, EXPECT_DIGEST);
+ break;
+ case "no_header":
+ // server returns no WWW-Authenticate header
+ success = testAuth(url, auth, EXPECT_FAILURE);
+ if (auth.lastRequestedScheme != null) {
+ System.out.println("Unexpected scheme: "
+ + auth.lastRequestedScheme);
+ success = false;
+ }
+ break;
+ case "no_nonce":
+ // server returns a wrong WWW-Authenticate header (no nonce)
+ server.setWWWAuthHeader(WWW_AUTH_HEADER_NO_NONCE);
+ success = testAuth(url, auth, EXPECT_FAILURE);
+ break;
+ case "invalid_alg":
+ // server returns a wrong WWW-Authenticate header
+ // (invalid hash algorithm)
+ server.setWWWAuthHeader(WWW_AUTH_HEADER_INVALID_ALGORITHM);
+ success = testAuth(url, auth, EXPECT_FAILURE);
+ break;
+ case "no_qop":
+ // server returns a good WWW-Authenticate header
+ // without QOPs
+ server.setWWWAuthHeader(WWW_AUTH_HEADER_NO_QOP);
+ success = testAuth(url, auth, EXPECT_DIGEST);
+ break;
+ default:
+ throw new RuntimeException("Unexpected testcase: "
+ + testcase);
+ }
+
+ if (!success) {
+ throw new RuntimeException("Test failed");
+ }
+ }
+
+ System.out.println("Test passed");
+ }
+
+ static boolean testAuth(String url, AuthenticatorImpl auth,
+ String expectedScheme) {
+
+ try {
+ System.out.printf("Connect to %s, expected auth scheme is '%s'%n",
+ url, expectedScheme);
+ load(url);
+
+ if (expectedScheme == null) {
+ System.out.println("Unexpected successful connection");
+ return false;
+ }
+
+ System.out.printf("Actual auth scheme is '%s'%n",
+ auth.lastRequestedScheme);
+ if (!expectedScheme.equalsIgnoreCase(auth.lastRequestedScheme)) {
+ System.out.println("Unexpected auth scheme");
+ return false;
+ }
+ } catch (IOException e) {
+ if (expectedScheme != null) {
+ System.out.println("Unexpected exception: " + e);
+ e.printStackTrace(System.out);
+ return false;
+ }
+ System.out.println("Expected exception: " + e);
+ }
+
+ return true;
+ }
+
+ static void load(String url) throws IOException {
+ URLConnection conn = new URL(url).openConnection();
+ conn.setUseCaches(false);
+ try (BufferedReader reader = new BufferedReader(
+ new InputStreamReader(conn.getInputStream()))) {
+
+ String line = reader.readLine();
+ if (line == null) {
+ throw new IOException("Couldn't read response");
+ }
+ do {
+ System.out.println(line);
+ } while ((line = reader.readLine()) != null);
+ }
+ }
+
+ private static class AuthenticatorImpl extends Authenticator {
+
+ private String lastRequestedScheme;
+ private String lastRequestedPrompt;
+
+ @Override
+ public PasswordAuthentication getPasswordAuthentication() {
+ lastRequestedScheme = getRequestingScheme();
+ lastRequestedPrompt = getRequestingPrompt();
+ System.out.println("AuthenticatorImpl: requested "
+ + lastRequestedScheme);
+
+ return new PasswordAuthentication("Mufasa",
+ "Circle Of Life".toCharArray());
+ }
+ }
+
+ // local HTTP server which pretends to support HTTP Digest auth
+ static class LocalHttpServer implements HttpHandler, AutoCloseable {
+
+ private final HttpServer server;
+ private volatile String wwwAuthHeader = null;
+ private volatile String authInfoHeader = null;
+ private volatile String lastRequestedNonce;
+
+ private LocalHttpServer(HttpServer server) {
+ this.server = server;
+ }
+
+ void setWWWAuthHeader(String wwwAuthHeader) {
+ this.wwwAuthHeader = wwwAuthHeader;
+ }
+
+ void setAuthInfoHeader(String authInfoHeader) {
+ this.authInfoHeader = authInfoHeader;
+ }
+
+ static LocalHttpServer startServer() throws IOException {
+ HttpServer httpServer = HttpServer.create(
+ new InetSocketAddress(0), 0);
+ LocalHttpServer localHttpServer = new LocalHttpServer(httpServer);
+ localHttpServer.start();
+
+ return localHttpServer;
+ }
+
+ void start() {
+ server.createContext("/test", this);
+ server.start();
+ System.out.println("HttpServer: started on port " + getPort());
+ }
+
+ void stop() {
+ server.stop(0);
+ System.out.println("HttpServer: stopped");
+ }
+
+ int getPort() {
+ return server.getAddress().getPort();
+ }
+
+ @Override
+ public void handle(HttpExchange t) throws IOException {
+ System.out.println("HttpServer: handle connection");
+
+ // read a request
+ try (InputStream is = t.getRequestBody()) {
+ while (is.read() > 0);
+ }
+
+ try {
+ List<String> headers = t.getRequestHeaders()
+ .get("Authorization");
+ String header = "";
+ if (headers != null && !headers.isEmpty()) {
+ header = headers.get(0).trim().toLowerCase();
+ }
+ if (header.startsWith("digest")) {
+ if (authInfoHeader != null) {
+ t.getResponseHeaders().add("Authentication-Info",
+ authInfoHeader);
+ }
+ lastRequestedNonce = findParameter(header, "nonce");
+ byte[] output = "hello".getBytes();
+ t.sendResponseHeaders(200, output.length);
+ t.getResponseBody().write(output);
+ System.out.println("HttpServer: return 200");
+ } else {
+ if (wwwAuthHeader != null) {
+ t.getResponseHeaders().add(
+ "WWW-Authenticate", wwwAuthHeader);
+ }
+ byte[] output = "forbidden".getBytes();
+ t.sendResponseHeaders(401, output.length);
+ t.getResponseBody().write(output);
+ System.out.println("HttpServer: return 401");
+ }
+ } catch (IOException e) {
+ System.out.println("HttpServer: exception: " + e);
+ System.out.println("HttpServer: return 500");
+ t.sendResponseHeaders(500, 0);
+ } finally {
+ t.close();
+ }
+ }
+
+ private static String findParameter(String header, String name) {
+ name = name.toLowerCase();
+ if (header != null) {
+ String[] params = header.split("\\s");
+ for (String param : params) {
+ param = param.trim().toLowerCase();
+ if (param.startsWith(name)) {
+ String[] parts = param.split("=");
+ if (parts.length > 1) {
+ return parts[1]
+ .replaceAll("\"", "").replaceAll(",", "");
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void close() {
+ stop();
+ }
+ }
+}
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/DNSIdentities.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/DNSIdentities.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -745,8 +745,10 @@
public static void main(String args[]) throws Exception {
// MD5 is used in this test case, don't disable MD5 algorithm.
- Security.setProperty(
- "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.certpath.disabledAlgorithms",
+ "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.tls.disabledAlgorithms",
+ "SSLv3, RC4, DH keySize < 768");
if (debug)
System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/IPAddressIPIdentities.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/IPAddressIPIdentities.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -746,8 +746,10 @@
public static void main(String args[]) throws Exception {
// MD5 is used in this test case, don't disable MD5 algorithm.
- Security.setProperty(
- "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.certpath.disabledAlgorithms",
+ "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.tls.disabledAlgorithms",
+ "SSLv3, RC4, DH keySize < 768");
if (debug)
System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/IPIdentities.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/IPIdentities.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -745,8 +745,10 @@
public static void main(String args[]) throws Exception {
// MD5 is used in this test case, don't disable MD5 algorithm.
- Security.setProperty(
- "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.certpath.disabledAlgorithms",
+ "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.tls.disabledAlgorithms",
+ "SSLv3, RC4, DH keySize < 768");
if (debug)
System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/Identities.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/Identities.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -745,8 +745,10 @@
public static void main(String args[]) throws Exception {
// MD5 is used in this test case, don't disable MD5 algorithm.
- Security.setProperty(
- "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.certpath.disabledAlgorithms",
+ "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.tls.disabledAlgorithms",
+ "SSLv3, RC4, DH keySize < 768");
if (debug)
System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/security/pkcs11/PKCS11Test.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/sun/security/pkcs11/PKCS11Test.java Thu Jan 21 10:17:21 2016 -0800
@@ -540,6 +540,7 @@
"/usr/lib/x86_64-linux-gnu/", "/usr/lib/x86_64-linux-gnu/nss/",
"/usr/lib64/"});
osMap.put("Linux-ppc64-64", new String[]{"/usr/lib64/"});
+ osMap.put("Linux-ppc64le-64", new String[]{"/usr/lib64/"});
osMap.put("Windows-x86-32", new String[]{
PKCS11_BASE + "/nss/lib/windows-i586/".replace('/', SEP)});
osMap.put("Windows-amd64-64", new String[]{
--- a/jdk/test/sun/security/pkcs11/fips/ImportKeyStore.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/sun/security/pkcs11/fips/ImportKeyStore.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, 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
@@ -48,7 +48,8 @@
public static void main(String[] args) throws Exception {
String nssCfg = "--name=NSS\nnssSecmodDirectory=.\n ";
// "attributes(*,CKO_PRIVATE_KEY,CKK_DSA) = { CKA_NETSCAPE_DB = 0h00 }";
- Provider p = new sun.security.pkcs11.SunPKCS11(nssCfg);
+ Provider p = Security.getProvider("SunPKCS11");
+ p.configure(nssCfg);
KeyStore ks = KeyStore.getInstance("PKCS11", p);
ks.load(null, "test12".toCharArray());
--- a/jdk/test/sun/security/ssl/SSLContextImpl/MD2InTrustAnchor.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/sun/security/ssl/SSLContextImpl/MD2InTrustAnchor.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -287,8 +287,10 @@
public static void main(String[] args) throws Exception {
// MD5 is used in this test case, don't disable MD5 algorithm.
- Security.setProperty(
- "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.certpath.disabledAlgorithms",
+ "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.tls.disabledAlgorithms",
+ "SSLv3, RC4, DH keySize < 768");
if (debug)
System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/security/ssl/SSLContextImpl/TrustTrustedCert.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/sun/security/ssl/SSLContextImpl/TrustTrustedCert.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -339,8 +339,10 @@
public static void main(String[] args) throws Exception {
// MD5 is used in this test case, don't disable MD5 algorithm.
- Security.setProperty(
- "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.certpath.disabledAlgorithms",
+ "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.tls.disabledAlgorithms",
+ "SSLv3, RC4, DH keySize < 768");
if (debug)
System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/security/ssl/X509KeyManager/PreferredKey.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/sun/security/ssl/X509KeyManager/PreferredKey.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, 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
@@ -57,8 +57,10 @@
public static void main(String[] args) throws Exception {
// MD5 is used in this test case, don't disable MD5 algorithm.
- Security.setProperty(
- "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.certpath.disabledAlgorithms",
+ "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.tls.disabledAlgorithms",
+ "SSLv3, RC4, DH keySize < 768");
KeyStore ks;
KeyManagerFactory kmf;
--- a/jdk/test/sun/security/ssl/X509TrustManagerImpl/BasicConstraints.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/sun/security/ssl/X509TrustManagerImpl/BasicConstraints.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -458,8 +458,10 @@
public static void main(String args[]) throws Exception {
// MD5 is used in this test case, don't disable MD5 algorithm.
- Security.setProperty(
- "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.certpath.disabledAlgorithms",
+ "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.tls.disabledAlgorithms",
+ "SSLv3, RC4, DH keySize < 768");
if (debug)
System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/security/ssl/X509TrustManagerImpl/PKIXExtendedTM.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/sun/security/ssl/X509TrustManagerImpl/PKIXExtendedTM.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -794,8 +794,10 @@
public static void main(String args[]) throws Exception {
// MD5 is used in this test case, don't disable MD5 algorithm.
- Security.setProperty(
- "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.certpath.disabledAlgorithms",
+ "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.tls.disabledAlgorithms",
+ "SSLv3, RC4, DH keySize < 768");
if (debug)
System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/security/ssl/X509TrustManagerImpl/SelfIssuedCert.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/sun/security/ssl/X509TrustManagerImpl/SelfIssuedCert.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, 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
@@ -306,8 +306,10 @@
public static void main(String args[]) throws Exception {
// MD5 is used in this test case, don't disable MD5 algorithm.
- Security.setProperty(
- "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.certpath.disabledAlgorithms",
+ "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.tls.disabledAlgorithms",
+ "SSLv3, RC4, DH keySize < 768");
if (debug)
System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/security/ssl/X509TrustManagerImpl/SunX509ExtendedTM.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/sun/security/ssl/X509TrustManagerImpl/SunX509ExtendedTM.java Thu Jan 21 10:17:21 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -796,8 +796,10 @@
public static void main(String args[]) throws Exception {
// MD5 is used in this test case, don't disable MD5 algorithm.
- Security.setProperty(
- "jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.certpath.disabledAlgorithms",
+ "MD2, RSA keySize < 1024");
+ Security.setProperty("jdk.tls.disabledAlgorithms",
+ "SSLv3, RC4, DH keySize < 768");
if (debug)
System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java Thu Jan 21 10:17:21 2016 -0800
@@ -60,30 +60,30 @@
}
private static void testFlagPlus() throws Exception {
- OutputAnalyzer output = JInfoHelper.jinfo("-flag", "+PrintGC");
+ OutputAnalyzer output = JInfoHelper.jinfo("-flag", "+HeapDumpOnOutOfMemoryError");
output.shouldHaveExitValue(0);
- output = JInfoHelper.jinfo("-flag", "PrintGC");
+ output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError");
output.shouldHaveExitValue(0);
- output.shouldContain("+PrintGC");
- verifyIsEnabled("PrintGC");
+ output.shouldContain("+HeapDumpOnOutOfMemoryError");
+ verifyIsEnabled("HeapDumpOnOutOfMemoryError");
}
private static void testFlagMinus() throws Exception {
- OutputAnalyzer output = JInfoHelper.jinfo("-flag", "-PrintGC");
+ OutputAnalyzer output = JInfoHelper.jinfo("-flag", "-HeapDumpOnOutOfMemoryError");
output.shouldHaveExitValue(0);
- output = JInfoHelper.jinfo("-flag", "PrintGC");
+ output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError");
output.shouldHaveExitValue(0);
- output.shouldContain("-PrintGC");
- verifyIsDisabled("PrintGC");
+ output.shouldContain("-HeapDumpOnOutOfMemoryError");
+ verifyIsDisabled("HeapDumpOnOutOfMemoryError");
}
private static void testFlagEqual() throws Exception {
- OutputAnalyzer output = JInfoHelper.jinfo("-flag", "PrintGC=1");
+ OutputAnalyzer output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError=1");
output.shouldHaveExitValue(0);
- output = JInfoHelper.jinfo("-flag", "PrintGC");
+ output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError");
output.shouldHaveExitValue(0);
- output.shouldContain("+PrintGC");
- verifyIsEnabled("PrintGC");
+ output.shouldContain("+HeapDumpOnOutOfMemoryError");
+ verifyIsEnabled("HeapDumpOnOutOfMemoryError");
}
private static void testInvalidFlag() throws Exception {
--- a/jdk/test/sun/tools/jps/JpsHelper.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/sun/tools/jps/JpsHelper.java Thu Jan 21 10:17:21 2016 -0800
@@ -98,7 +98,7 @@
* -XX:+UsePerfData is required for running the tests on embedded platforms.
*/
public static final String[] VM_ARGS = {
- "-XX:+UsePerfData", "-Xmx512m", "-XX:+PrintGCDetails",
+ "-XX:+UsePerfData", "-Xmx512m", "-Xlog:gc",
"-Dmultiline.prop=value1\nvalue2\r\nvalue3"
};
/**
--- a/jdk/test/tools/launcher/Settings.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/tools/launcher/Settings.java Thu Jan 21 10:17:21 2016 -0800
@@ -74,7 +74,7 @@
static void runTestOptionDefault() throws IOException {
String stackSize = "256"; // in kb
- if (getArch().equals("ppc64")) {
+ if (getArch().equals("ppc64") || getArch().equals("ppc64le")) {
stackSize = "800";
}
TestResult tr = null;
--- a/jdk/test/tools/launcher/TooSmallStackSize.java Thu Jan 21 09:46:03 2016 -0800
+++ b/jdk/test/tools/launcher/TooSmallStackSize.java Thu Jan 21 10:17:21 2016 -0800
@@ -24,6 +24,7 @@
/*
* @test
* @bug 6762191
+ * @ignore 8146751
* @summary Setting stack size to 16K causes segmentation fault
* @compile TooSmallStackSize.java
* @run main TooSmallStackSize