This commit is contained in:
J. Duke 2017-07-05 22:20:50 +02:00
commit 269299ac22
162 changed files with 1288 additions and 563 deletions

View File

@ -382,3 +382,4 @@ be1218f792a450dfb5d4b1f82616b9d95a6a732e jdk-9+133
d7f519b004254b19e384131d9f0d0e40e31a0fd3 jdk-9+137
67c4388142bdf58aec8fefa4475faaa8a5d7380c jdk-9+138
7dcf453eacae79ee86a6bcc75fd0b546fc99b48a jdk-9+139
a5815c6098a241d3a1df64d22b84b3524e4a77df jdk-9+140

View File

@ -428,9 +428,10 @@ AC_DEFUN([BASIC_SETUP_TOOL],
# Call BASIC_SETUP_TOOL with AC_PATH_PROGS to locate the tool
# $1: variable to set
# $2: executable name (or list of names) to look for
# $3: [path]
AC_DEFUN([BASIC_PATH_PROGS],
[
BASIC_SETUP_TOOL($1, [AC_PATH_PROGS($1, $2)])
BASIC_SETUP_TOOL($1, [AC_PATH_PROGS($1, $2, , $3)])
])
# Call BASIC_SETUP_TOOL with AC_CHECK_TOOLS to locate the tool
@ -444,9 +445,10 @@ AC_DEFUN([BASIC_CHECK_TOOLS],
# Like BASIC_PATH_PROGS but fails if no tool was found.
# $1: variable to set
# $2: executable name (or list of names) to look for
# $3: [path]
AC_DEFUN([BASIC_REQUIRE_PROGS],
[
BASIC_PATH_PROGS($1, $2)
BASIC_PATH_PROGS($1, $2, , $3)
BASIC_CHECK_NONEMPTY($1)
])
@ -1065,7 +1067,9 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
BASIC_PATH_PROGS(HG, hg)
BASIC_PATH_PROGS(STAT, stat)
BASIC_PATH_PROGS(TIME, time)
BASIC_PATH_PROGS(DTRACE, dtrace)
# Dtrace is usually found in /usr/sbin on Solaris, but that directory may not
# be in the user path.
BASIC_PATH_PROGS(DTRACE, dtrace, $PATH:/usr/sbin)
BASIC_PATH_PROGS(PATCH, [gpatch patch])
# Check if it's GNU time
IS_GNU_TIME=`$TIME --version 2>&1 | $GREP 'GNU time'`

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -168,7 +168,6 @@ AC_DEFUN([BPERF_SETUP_CCACHE],
[AS_HELP_STRING([--enable-ccache],
[enable using ccache to speed up recompilations @<:@disabled@:>@])])
CCACHE=
CCACHE_STATUS=
AC_MSG_CHECKING([is ccache enabled])
if test "x$enable_ccache" = xyes; then

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 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
@ -156,7 +156,3 @@ JVM_VARIANT_KERNEL := false
JVM_VARIANT_ZERO := false
JVM_VARIANT_ZEROSHARK := false
JVM_VARIANT_CORE := false
# Sneak this in via the spec.gmk file, since we don't want to mess around too much with the Hotspot make files.
# This is needed to get the LOG setting to work properly.
include $(SRC_ROOT)/make/common/MakeBase.gmk

View File

@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 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

View File

@ -3657,6 +3657,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Call BASIC_SETUP_TOOL with AC_PATH_PROGS to locate the tool
# $1: variable to set
# $2: executable name (or list of names) to look for
# $3: [path]
# Call BASIC_SETUP_TOOL with AC_CHECK_TOOLS to locate the tool
@ -3667,6 +3668,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Like BASIC_PATH_PROGS but fails if no tool was found.
# $1: variable to set
# $2: executable name (or list of names) to look for
# $3: [path]
# Like BASIC_SETUP_TOOL but fails if no tool was found.
@ -3733,7 +3735,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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
@ -3792,7 +3794,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# ... then the rest
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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
@ -4403,7 +4405,7 @@ VALID_JVM_VARIANTS="server client minimal core zero zeroshark custom"
#
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 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
@ -4498,7 +4500,7 @@ VALID_JVM_VARIANTS="server client minimal core zero zeroshark custom"
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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
@ -4818,7 +4820,7 @@ VALID_JVM_VARIANTS="server client minimal core zero zeroshark custom"
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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
@ -5091,7 +5093,7 @@ VS_SDK_PLATFORM_NAME_2013=
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1475218974
DATE_WHEN_GENERATED=1476275292
###############################################################################
#
@ -22769,6 +22771,8 @@ $as_echo "$tool_specified" >&6; }
fi
# Dtrace is usually found in /usr/sbin on Solaris, but that directory may not
# be in the user path.
# Publish this variable in the help.
@ -22791,7 +22795,8 @@ else
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
as_dummy="$PATH:/usr/sbin"
for as_dir in $as_dummy
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
@ -22849,7 +22854,8 @@ else
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
as_dummy="$PATH:/usr/sbin"
for as_dir in $as_dummy
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
@ -65239,7 +65245,6 @@ if test "${enable_ccache+set}" = set; then :
fi
CCACHE=
CCACHE_STATUS=
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking is ccache enabled" >&5
$as_echo_n "checking is ccache enabled... " >&6; }

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -175,7 +175,7 @@ VERSION_NUMBER_FOUR_POSITIONS := @VERSION_NUMBER_FOUR_POSITIONS@
VERSION_STRING := @VERSION_STRING@
# The short version string, without trailing zeroes and just PRE, if present.
VERSION_SHORT := @VERSION_SHORT@
# The Java specification version. It usually equals to the major version number.
# The Java specification version. It usually equals the major version number.
VERSION_SPECIFICATION := @VERSION_MAJOR@
# A GA version is defined by the PRE string being empty. Rather than testing for
# that, this variable defines it with true/false.
@ -244,9 +244,6 @@ USE_PRECOMPILED_HEADER := @USE_PRECOMPILED_HEADER@
# Only build headless support or not
ENABLE_HEADLESS_ONLY := @ENABLE_HEADLESS_ONLY@
# Legacy support
USE_NEW_HOTSPOT_BUILD:=@USE_NEW_HOTSPOT_BUILD@
# JDK_OUTPUTDIR specifies where a working jvm is built.
# You can run $(JDK_OUTPUTDIR)/bin/java
# Though the layout of the contents of $(JDK_OUTPUTDIR) is not

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 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

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2009, 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

View File

@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
@ -287,7 +287,8 @@ var getJibProfilesProfiles = function (input, common) {
target_os: "solaris",
target_cpu: "x64",
dependencies: concat(common.dependencies, "devkit", "cups"),
configure_args: concat(common.configure_args, "--with-zlib=system"),
configure_args: concat(common.configure_args, "--with-zlib=system",
"--enable-dtrace"),
default_make_targets: common.default_make_targets
},
@ -295,7 +296,8 @@ var getJibProfilesProfiles = function (input, common) {
target_os: "solaris",
target_cpu: "sparcv9",
dependencies: concat(common.dependencies, "devkit", "cups"),
configure_args: concat(common.configure_args, "--with-zlib=system"),
configure_args: concat(common.configure_args, "--with-zlib=system",
"--enable-dtrace"),
default_make_targets: common.default_make_targets
},

View File

@ -382,3 +382,4 @@ aa053a3faf266c12b4fd5272da431a3e08e4a3e3 jdk-9+136
258cf18fa7fc59359b874f8743b7168dc48baf73 jdk-9+137
27bb44be32076861a0951bcefb07a1d92509a4b6 jdk-9+138
8c9da7fc5b07c606afd571c7012441b77dda83b2 jdk-9+139
9f3fc931bc230f44f2a58d75f7f6360af98bb113 jdk-9+140

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 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

View File

@ -542,3 +542,4 @@ a20da289f646ee44440695b81abc0548330e4ca7 jdk-9+136
dfcbf839e299e7e2bba1da69bdb347617ea4c7e8 jdk-9+137
fc0956308c7a586267c5dd35dff74f773aa9c3eb jdk-9+138
08492e67bf3226784dab3bf9ae967382ddbc1af5 jdk-9+139
fec31089c2ef5a12dd64f401b0bf2e00f56ee0d0 jdk-9+140

View File

@ -69,7 +69,7 @@ $(eval $(call SetupNativeCompilation, BUILD_GTEST_LIBJVM, \
CFLAGS := $(JVM_CFLAGS) -I$(GTEST_FRAMEWORK_SRC) \
-I$(GTEST_FRAMEWORK_SRC)/include \
$(addprefix -I,$(GTEST_TEST_SRC)), \
CFLAGS_windows := /EHsc, \
CFLAGS_windows := -EHsc, \
CFLAGS_solaris := -DGTEST_HAS_EXCEPTIONS=0 -library=stlport4, \
CFLAGS_macosx := -DGTEST_OS_MAC=1, \
CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \

View File

@ -422,6 +422,8 @@ static SpecialFlag const special_jvm_flags[] = {
{ "UseAltSigs", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
{ "SegmentedHeapDumpThreshold", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
{ "PrintOopAddress", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
{ "PermSize", JDK_Version::undefined(), JDK_Version::jdk(8), JDK_Version::jdk(10) },
{ "MaxPermSize", JDK_Version::undefined(), JDK_Version::jdk(8), JDK_Version::jdk(10) },
#ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
{ "dep > obs", JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() },

View File

@ -0,0 +1,51 @@
/*
* 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 8167446
* @summary Commandline options PermSize and MaxPermSize should be recognized but ignored.
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
* @run driver PermGenFlagsTest
*/
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
public class PermGenFlagsTest {
public static void main(String[] args) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:PermSize=22k",
"-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("Ignoring option PermSize; support was removed in 8.0");
output.shouldHaveExitValue(0);
pb = ProcessTools.createJavaProcessBuilder("-XX:MaxPermSize=22k",
"-version");
output = new OutputAnalyzer(pb.start());
output.shouldContain("Ignoring option MaxPermSize; support was removed in 8.0");
output.shouldHaveExitValue(0);
}
}

View File

@ -67,10 +67,11 @@ public class IgnoreModulePropertiesTest {
}
public static void main(String[] args) throws Exception {
testOption("--add-modules", "java.sqlx", "jdk.module.addmods", "java.lang.module.ResolutionException");
testOption("--add-modules", "java.sqlx", "jdk.module.addmods.0", "java.lang.module.ResolutionException");
testOption("--limit-modules", "java.sqlx", "jdk.module.limitmods", "java.lang.module.ResolutionException");
testOption("--add-reads", "xyzz=yyzd", "jdk.module.addreads.0", "java.lang.RuntimeException");
testOption("--add-exports", "java.base/xyzz=yyzd", "jdk.module.addexports.0", "java.lang.RuntimeException");
testOption("--add-reads", "xyzz=yyzd", "jdk.module.addreads.0", "WARNING: Unknown module: xyzz");
testOption("--add-exports", "java.base/xyzz=yyzd", "jdk.module.addexports.0",
"WARNING: package xyzz not in java.base");
testOption("--patch-module", "=d", "jdk.module.patch.0", "IllegalArgumentException");
}
}

View File

@ -382,3 +382,4 @@ f1eafcb0eb7182b937bc93f214d8cabd01ec4d59 jdk-9+136
a8d5fe567ae72b4931040e59dd4478363f9004f5 jdk-9+137
69c3b12ba75b2e321dee731ac545e7fbff608451 jdk-9+138
8991d71c5316bde259e6a417c1199b008ca3cdf0 jdk-9+139
8d100cb9b04819b5bd09f33c7fd5b8628d1a456f jdk-9+140

View File

@ -1342,6 +1342,12 @@ public class Parser implements Constants, ContentHandler {
}
else {
SyntaxTreeNode parent = _parentStack.peek();
if (element.getClass().isAssignableFrom(Import.class) &&
parent.notTypeOf(Import.class)) {
ErrorMsg err = new ErrorMsg(ErrorMsg.IMPORT_PRECEDE_OTHERS_ERR,
prefix+':'+localname);
throw new SAXException(err.toString());
}
parent.addElement(element);
element.setParent(parent);
}

View File

@ -523,6 +523,24 @@ public abstract class SyntaxTreeNode implements Constants {
}
}
/**
* Checks whether any children of this node is not of the specified type.
*
* @param type the type to be checked against
* @return true if there is at least one child that is not of the specified
* type, false otherwise.
*/
public boolean notTypeOf(Class<?> type) {
if (_contents.size() > 0) {
for (SyntaxTreeNode item : _contents) {
if (!item.getClass().isAssignableFrom(type)) {
return true;
}
}
}
return false;
}
/**
* Return true if the node represents a simple RTF.
*

View File

@ -273,6 +273,14 @@ public class ErrorMessages extends ListResourceBundle {
{ErrorMsg.CIRCULAR_INCLUDE_ERR,
"Circular import/include. Stylesheet ''{0}'' already loaded."},
/*
* Note to translators: "xsl:import" and "xsl:include" are keywords that
* should not be translated.
*/
{ErrorMsg.IMPORT_PRECEDE_OTHERS_ERR,
"The xsl:import element children must precede all other element children of "
+ "an xsl:stylesheet element, including any xsl:include element children."},
/*
* Note to translators: A result-tree fragment is a portion of a
* resulting XML document represented as a tree. "<xsl:sort>" is a

View File

@ -70,6 +70,7 @@ public final class ErrorMsg {
public static final String STRAY_ATTRIBUTE_ERR = "STRAY_ATTRIBUTE_ERR";
public static final String ILLEGAL_ATTRIBUTE_ERR = "ILLEGAL_ATTRIBUTE_ERR";
public static final String CIRCULAR_INCLUDE_ERR = "CIRCULAR_INCLUDE_ERR";
public static final String IMPORT_PRECEDE_OTHERS_ERR = "IMPORT_PRECEDE_OTHERS_ERR";
public static final String RESULT_TREE_SORT_ERR = "RESULT_TREE_SORT_ERR";
public static final String SYMBOLS_REDEF_ERR = "SYMBOLS_REDEF_ERR";
public static final String XSL_VERSION_ERR = "XSL_VERSION_ERR";

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2015, 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
@ -305,9 +305,12 @@ public class StAXStream2SAX implements XMLReader, Locator {
if (prefix == null) { // true for default namespace
prefix = "";
}
_sax.startPrefixMapping(
prefix,
staxStreamReader.getNamespaceURI(i));
String uri = staxStreamReader.getNamespaceURI(i);
if (uri == null && prefix.isEmpty()) { // true for default namespace
uri = "";
}
_sax.startPrefixMapping(prefix, uri);
}
// fire startElement

View File

@ -28,6 +28,7 @@ import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.nio.file.Paths;
import java.util.PropertyPermission;
import javax.xml.parsers.SAXParserFactory;
@ -53,8 +54,14 @@ public class Bug6341770 {
// naming a file "aux" would fail on windows.
@Test
public void testNonAsciiURI() {
if (!isNonAsciiSupported()) {
// @bug 8167478
// if it doesn't support non-ascii, the following test is invalid even if test is passed.
System.out.println("Current environment doesn't support non-ascii, exit the test.");
return;
}
try {
File dir = new File("sko\u0159ice");
File dir = new File(ALPHA);
dir.delete();
dir.mkdir();
File main = new File(dir, "main.xml");
@ -82,4 +89,18 @@ public class Bug6341770 {
}
System.out.println("OK.");
}
private boolean isNonAsciiSupported() {
// Use Paths.get method to test if the path is valid in current environment
try {
Paths.get(ALPHA);
return true;
} catch (Exception e) {
return false;
}
}
// Select alpha because it's a very common non-ascii character in different charsets.
// That this test can run in as many as possible environments if it's possible.
private static final String ALPHA = "\u03b1";
}

View File

@ -30,7 +30,9 @@ import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLEventWriter;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
@ -38,6 +40,7 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.stax.StAXResult;
import javax.xml.transform.stax.StAXSource;
import javax.xml.transform.stream.StreamResult;
import org.testng.Assert;
import org.testng.annotations.Listeners;
@ -45,6 +48,7 @@ import org.testng.annotations.Test;
/*
* @test
* @bug 8152530
* @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
* @run testng/othervm -DrunSecMngr=true transform.StAXSourceTest
* @run testng/othervm transform.StAXSourceTest
@ -52,6 +56,33 @@ import org.testng.annotations.Test;
*/
@Listeners({jaxp.library.FilePolicy.class})
public class StAXSourceTest {
/**
* @bug 8152530
* Verifies that StAXSource handles empty namespace properly. NPE was thrown
* before the fix.
* @throws Exception if the test fails
*/
@Test
public final void testStAXSourceWEmptyNS() throws Exception {
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<EntityList>\n"
+ " <Entity xmlns=\"\">\n"
+ " </Entity>\n"
+ " <Entity xmlns=\"\">\n"
+ " </Entity>\n"
+ "</EntityList> ";
XMLInputFactory xif = XMLInputFactory.newInstance();
XMLStreamReader xsr = xif.createXMLStreamReader(new StringReader(xml));
xsr.nextTag();
TransformerFactory tf = TransformerFactory.newInstance();
Transformer t = tf.newTransformer();
while (xsr.nextTag() == XMLStreamConstants.START_ELEMENT && xsr.getLocalName().equals("Entity")) {
StringWriter stringResult = new StringWriter();
t.transform(new StAXSource(xsr), new StreamResult(stringResult));
System.out.println("result: \n" + stringResult.toString());
}
}
@Test
public final void testStAXSource() throws XMLStreamException {

View File

@ -0,0 +1,149 @@
/*
* 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.
*/
package transform;
import java.io.StringReader;
import org.xml.sax.InputSource;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.TransformerConfigurationException;
import org.testng.annotations.Listeners;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/**
* @test
* @bug 8058152
* @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
* @run testng/othervm -DrunSecMngr=true transform.StylesheetTest
* @run testng/othervm transform.StylesheetTest
* @summary this test contains test cases for verifying stylesheet
*/
@Listeners(jaxp.library.FilePolicy.class)
public class StylesheetTest {
/**
* @bug 8058152
* Verifies that an error is reported if the xsl:import element
* is not at the top of the stylesheet.
* @throws TransformerConfigurationException
*/
@Test(dataProvider = "invalidImport", expectedExceptions = TransformerConfigurationException.class)
public void testInvalidImport(String xsl) throws TransformerConfigurationException {
StringReader xsl1 = new StringReader(xsl);
TransformerFactory factory = TransformerFactory.newInstance();
SAXSource xslSource = new SAXSource(new InputSource(xsl1));
Transformer transformer = factory.newTransformer(xslSource);
}
/**
* @bug 8058152
* Verifies that valid xsl:import elements are accepted
* @throws TransformerConfigurationException
*/
@Test(dataProvider = "validImport")
public void testValidImport(String file) throws TransformerConfigurationException {
String xsl = getClass().getResource(file).getFile();
TransformerFactory factory = TransformerFactory.newInstance();
SAXSource xslSource = new SAXSource(new InputSource(xsl));
Transformer transformer = factory.newTransformer(xslSource);
}
/*
DataProvider: for testing with xsl:import placed incorrectly
Data: stylesheet
*/
@DataProvider(name = "invalidImport")
public Object[][] getInvalid() {
return new Object[][]{
// xsl:import after template and include elements
{"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">\n"
+ "\n"
+ " <xsl:template match=\"content\">\n"
+ " <html>\n"
+ " <xsl:apply-templates/>\n"
+ " </html>\n"
+ " </xsl:template>\n"
+ " \n"
+ " <xsl:include href=\"XSLInclude_header.xsl\"/>\n"
+ "\n"
+ " <xsl:template match=\"content/title\">\n"
+ " <h1>\n"
+ " <xsl:apply-templates/>\n"
+ " </h1>\n"
+ " </xsl:template>\n"
+ " \n"
+ " <xsl:import href=\"XSLInclude_footer.xsl\"/>\n"
+ "\n"
+ "</xsl:stylesheet>"},
// xsl:import inside template
{"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">\n"
+ "\n"
+ " <xsl:template match=\"content\">\n"
+ " <xsl:import href=\"XSLInclude_header.xsl\"/>"
+ " <html>\n"
+ " <xsl:apply-templates/>\n"
+ " </html>\n"
+ " </xsl:template>\n"
+ "\n"
+ "</xsl:stylesheet>"},
// xsl:import after xsl:include
{"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">\n"
+ " <xsl:include href=\"XSLInclude_header.xsl\"/>\n"
+ " <xsl:import href=\"XSLInclude_footer.xsl\"/>\n"
+ "\n"
+ " <xsl:template match=\"content/title\">\n"
+ " <h1>\n"
+ " <xsl:apply-templates/>\n"
+ " </h1>\n"
+ " </xsl:template>\n"
+ "\n"
+ "</xsl:stylesheet>"}
};
}
/*
DataProvider: for testing with xsl:import placed correctly
Data: path to stylesheet
*/
@DataProvider(name = "validImport")
public Object[][] getValid() {
return new Object[][]{
// xsl:import at the top
{"XSLInclude_main.xsl"},
// two xsl:import elements at the top
{"XSLImport.xsl"}
};
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.1" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="XSLInclude_header.xsl"/>
<xsl:import href="XSLInclude_footer.xsl"/>
<xsl:template match="content">
<html>
<xsl:apply-templates/>
</html>
</xsl:template>
<xsl:template match="content/title">
<h1>
<xsl:apply-templates/>
</h1>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="footer">
<dv id="footer"><xsl:apply-templates/></dv>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="header">
<h4><xsl:apply-templates/></h4>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,20 @@
<?xml version="1.1" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="XSLInclude_header.xsl"/>
<xsl:template match="content">
<html>
<xsl:apply-templates/>
</html>
</xsl:template>
<xsl:template match="content/title">
<h1>
<xsl:apply-templates/>
</h1>
</xsl:template>
<xsl:include href="XSLInclude_footer.xsl"/>
</xsl:stylesheet>

View File

@ -382,3 +382,4 @@ d5c70818cd8a82e76632c8c815bdb4f75f53aeaf jdk-9+132
e72df94364e3686e7d62059ce0d6b187b82da713 jdk-9+137
665096863382bf23ce891307cf2a7511e77c1c88 jdk-9+138
5518ac2f2ead5e594bd983f2047178136aafdfd0 jdk-9+139
e93b7ea559759f036c9f69fd2ddaf47bb4e98385 jdk-9+140

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -1,5 +1,5 @@
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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
@ -58,10 +58,6 @@ else
endif
ifeq ($(OPENJDK_TARGET_OS), solaris)
UNPACKEXE_TOOLCHAIN := TOOLCHAIN_LINK_CXX
endif
UNPACK_MAPFILE_DIR := $(JDK_TOPDIR)/make/mapfiles/libunpack
UNPACK_MAPFILE_PLATFORM_FILE := \
$(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH)
@ -79,7 +75,7 @@ endif
$(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \
SRC := $(UNPACKEXE_SRC), \
TOOLCHAIN := $(UNPACKEXE_TOOLCHAIN), \
TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
OPTIMIZATION := LOW, \
CFLAGS := $(UNPACKEXE_CFLAGS) $(CXXFLAGS_JDKEXE) -DFULL, \
CFLAGS_release := -DPRODUCT, \

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -255,7 +255,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJIMAGE, \
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(JIMAGELIB_CPPFLAGS), \
CFLAGS_unix := -UDEBUG, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjimage/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_windows := -export:JIMAGE_Open -export:JIMAGE_Close \
-export:JIMAGE_PackageToModule \

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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

View File

@ -33,7 +33,6 @@ import java.nio.file.Paths;
import java.security.AccessController;
import java.security.Permission;
import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@ -333,7 +332,7 @@ public interface ModuleFinder {
*
* <p> When locating modules then any exceptions or errors thrown by the
* {@code find} or {@code findAll} methods of the underlying module finders
* will be propogated to the caller of the resulting module finder's
* will be propagated to the caller of the resulting module finder's
* {@code find} or {@code findAll} methods. </p>
*
* @param finders
@ -342,8 +341,8 @@ public interface ModuleFinder {
* @return A {@code ModuleFinder} that composes a sequence of module finders
*/
static ModuleFinder compose(ModuleFinder... finders) {
final List<ModuleFinder> finderList = Arrays.asList(finders);
finderList.forEach(Objects::requireNonNull);
// copy the list, also checking for nulls
final List<ModuleFinder> finderList = List.of(finders);
return new ModuleFinder() {
private final Map<String, ModuleReference> nameToModule = new HashMap<>();

View File

@ -81,7 +81,7 @@ import sun.util.logging.PlatformLogger;
* <li>
* Currently, only CookieStore.add(URI, HttpCookie) and CookieStore.get(URI)
* are used by CookieManager. Others are for completeness and might be needed
* by a more sophisticated CookieStore implementation, e.g. a NetscapeCookieSotre.
* by a more sophisticated CookieStore implementation, e.g. a NetscapeCookieStore.
* </li>
* </ul>
* </blockquote>
@ -201,10 +201,9 @@ public class CookieManager extends CookieHandler
throw new IllegalArgumentException("Argument is null");
}
Map<String, List<String>> cookieMap = new java.util.HashMap<>();
// if there's no default CookieStore, no way for us to get any cookie
if (cookieJar == null)
return Collections.unmodifiableMap(cookieMap);
return Map.of();
boolean secureLink = "https".equalsIgnoreCase(uri.getScheme());
List<HttpCookie> cookies = new java.util.ArrayList<>();
@ -244,8 +243,7 @@ public class CookieManager extends CookieHandler
// apply sort rule (RFC 2965 sec. 3.3.4)
List<String> cookieHeader = sortByPath(cookies);
cookieMap.put("Cookie", cookieHeader);
return Collections.unmodifiableMap(cookieMap);
return Map.of("Cookie", cookieHeader);
}
public void

View File

@ -217,7 +217,7 @@ public final class URLPermission extends Permission {
* where method-names is the list of methods separated by commas
* and header-names is the list of permitted headers separated by commas.
* There is no white space in the returned String. If header-names is empty
* then the colon separator will not be present.
* then the colon separator may not be present.
*/
public String getActions() {
return actions;

View File

@ -31,11 +31,10 @@ import java.io.UncheckedIOException;
import java.util.Arrays;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.nio.file.FileTreeWalker.Event;
/**
* An {@code Iterator to iterate over the nodes of a file tree.
* An {@code Iterator} to iterate over the nodes of a file tree.
*
* <pre>{@code
* try (FileTreeIterator iterator = new FileTreeIterator(start, maxDepth, options)) {
@ -62,7 +61,7 @@ class FileTreeIterator implements Iterator<Event>, Closeable {
* @throws SecurityException
* if the security manager denies access to the starting file
* @throws NullPointerException
* if {@code start} or {@code options} is {@ocde null} or
* if {@code start} or {@code options} is {@code null} or
* the options array contains a {@code null} element
*/
FileTreeIterator(Path start, int maxDepth, FileVisitOption... options)

View File

@ -171,7 +171,7 @@ class FileTreeWalker implements Closeable {
* if {@code options} contains an element that is not a
* {@code FileVisitOption}
* @throws NullPointerException
* if {@code options} is {@ocde null} or the options
* if {@code options} is {@code null} or the options
* array contains a {@code null} element
*/
FileTreeWalker(Collection<FileVisitOption> options, int maxDepth) {

View File

@ -479,6 +479,10 @@ public abstract class KeyStoreSpi {
} else if (engineIsKeyEntry(alias)) {
KeyStore.PasswordProtection pp =
(KeyStore.PasswordProtection)protParam;
if (pp.getProtectionAlgorithm() != null) {
throw new KeyStoreException(
"unsupported password protection algorithm");
}
char[] password = pp.getPassword();
Key key = engineGetKey(alias, password);
@ -524,6 +528,10 @@ public abstract class KeyStoreSpi {
KeyStore.PasswordProtection pProtect = null;
if (protParam != null) {
pProtect = (KeyStore.PasswordProtection)protParam;
if (pProtect.getProtectionAlgorithm() != null) {
throw new KeyStoreException(
"unsupported password protection algorithm");
}
}
// set entry

View File

@ -32,10 +32,13 @@ import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.io.InputStream;
import java.io.ByteArrayInputStream;
import java.security.InvalidKeyException;
import java.nio.ByteBuffer;
import sun.security.util.Debug;
import sun.security.util.MessageDigestSpi2;
import javax.crypto.SecretKey;
/**
* This MessageDigest class provides applications the functionality of a
@ -548,7 +551,7 @@ public abstract class MessageDigest extends MessageDigestSpi {
* and its original parent (Object).
*/
static class Delegate extends MessageDigest {
static class Delegate extends MessageDigest implements MessageDigestSpi2 {
// The provider implementation (delegate)
private MessageDigestSpi digestSpi;
@ -601,6 +604,14 @@ public abstract class MessageDigest extends MessageDigestSpi {
digestSpi.engineUpdate(input);
}
public void engineUpdate(SecretKey key) throws InvalidKeyException {
if (digestSpi instanceof MessageDigestSpi2) {
((MessageDigestSpi2)digestSpi).engineUpdate(key);
} else {
throw new UnsupportedOperationException
("Digest does not support update of SecretKey object");
}
}
protected byte[] engineDigest() {
return digestSpi.engineDigest();
}

View File

@ -37,7 +37,6 @@ import java.nio.ByteBuffer;
import java.security.Provider.Service;
import javax.crypto.Cipher;
import javax.crypto.CipherSpi;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.BadPaddingException;
import javax.crypto.NoSuchPaddingException;
@ -180,15 +179,12 @@ public abstract class Signature extends SignatureSpi {
private static final String RSA_CIPHER = "RSA/ECB/PKCS1Padding";
// all the services we need to lookup for compatibility with Cipher
private static final List<ServiceId> rsaIds = Arrays.asList(
new ServiceId[] {
new ServiceId("Signature", "NONEwithRSA"),
new ServiceId("Cipher", "RSA/ECB/PKCS1Padding"),
new ServiceId("Cipher", "RSA/ECB"),
new ServiceId("Cipher", "RSA//PKCS1Padding"),
new ServiceId("Cipher", "RSA"),
}
);
private static final List<ServiceId> rsaIds = List.of(
new ServiceId("Signature", "NONEwithRSA"),
new ServiceId("Cipher", "RSA/ECB/PKCS1Padding"),
new ServiceId("Cipher", "RSA/ECB"),
new ServiceId("Cipher", "RSA//PKCS1Padding"),
new ServiceId("Cipher", "RSA"));
/**
* Returns a Signature object that implements the specified signature

View File

@ -88,8 +88,6 @@ import java.time.temporal.Temporal;
import java.time.temporal.TemporalAmount;
import java.time.temporal.TemporalUnit;
import java.time.temporal.UnsupportedTemporalTypeException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.regex.Matcher;
@ -578,8 +576,7 @@ public final class Duration
* the simple initialization in Duration.
*/
private static class DurationUnits {
static final List<TemporalUnit> UNITS =
Collections.unmodifiableList(Arrays.<TemporalUnit>asList(SECONDS, NANOS));
static final List<TemporalUnit> UNITS = List.of(SECONDS, NANOS);
}
//-----------------------------------------------------------------------

View File

@ -610,7 +610,7 @@ public final class Instant
* <p>
* The epoch second count is a simple incrementing count of seconds where
* second 0 is 1970-01-01T00:00:00Z.
* The nanosecond part of the day is returned by {@code getNanosOfSecond}.
* The nanosecond part of the day is returned by {@link #getNano}.
*
* @return the seconds from the epoch of 1970-01-01T00:00:00Z
*/
@ -623,7 +623,7 @@ public final class Instant
* of the second.
* <p>
* The nanosecond-of-second value measures the total number of nanoseconds from
* the second returned by {@code getEpochSecond}.
* the second returned by {@link #getEpochSecond}.
*
* @return the nanoseconds within the second, always positive, never exceeds 999,999,999
*/

View File

@ -83,8 +83,6 @@ import java.time.temporal.TemporalAmount;
import java.time.temporal.TemporalQueries;
import java.time.temporal.TemporalUnit;
import java.time.temporal.UnsupportedTemporalTypeException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.regex.Matcher;
@ -152,8 +150,7 @@ public final class Period
/**
* The set of supported units.
*/
private static final List<TemporalUnit> SUPPORTED_UNITS =
Collections.unmodifiableList(Arrays.<TemporalUnit>asList(YEARS, MONTHS, DAYS));
private static final List<TemporalUnit> SUPPORTED_UNITS = List.of(YEARS, MONTHS, DAYS);
/**
* The number of years.

View File

@ -76,14 +76,14 @@ import java.time.temporal.UnsupportedTemporalTypeException;
import java.time.zone.ZoneRules;
import java.time.zone.ZoneRulesException;
import java.time.zone.ZoneRulesProvider;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TimeZone;
import static java.util.Map.entry;
/**
* A time-zone ID, such as {@code Europe/Paris}.
* <p>
@ -220,39 +220,36 @@ public abstract class ZoneId implements Serializable {
* </ul>
* The map is unmodifiable.
*/
public static final Map<String, String> SHORT_IDS;
static {
Map<String, String> map = new HashMap<>(64);
map.put("ACT", "Australia/Darwin");
map.put("AET", "Australia/Sydney");
map.put("AGT", "America/Argentina/Buenos_Aires");
map.put("ART", "Africa/Cairo");
map.put("AST", "America/Anchorage");
map.put("BET", "America/Sao_Paulo");
map.put("BST", "Asia/Dhaka");
map.put("CAT", "Africa/Harare");
map.put("CNT", "America/St_Johns");
map.put("CST", "America/Chicago");
map.put("CTT", "Asia/Shanghai");
map.put("EAT", "Africa/Addis_Ababa");
map.put("ECT", "Europe/Paris");
map.put("IET", "America/Indiana/Indianapolis");
map.put("IST", "Asia/Kolkata");
map.put("JST", "Asia/Tokyo");
map.put("MIT", "Pacific/Apia");
map.put("NET", "Asia/Yerevan");
map.put("NST", "Pacific/Auckland");
map.put("PLT", "Asia/Karachi");
map.put("PNT", "America/Phoenix");
map.put("PRT", "America/Puerto_Rico");
map.put("PST", "America/Los_Angeles");
map.put("SST", "Pacific/Guadalcanal");
map.put("VST", "Asia/Ho_Chi_Minh");
map.put("EST", "-05:00");
map.put("MST", "-07:00");
map.put("HST", "-10:00");
SHORT_IDS = Collections.unmodifiableMap(map);
}
public static final Map<String, String> SHORT_IDS = Map.ofEntries(
entry("ACT", "Australia/Darwin"),
entry("AET", "Australia/Sydney"),
entry("AGT", "America/Argentina/Buenos_Aires"),
entry("ART", "Africa/Cairo"),
entry("AST", "America/Anchorage"),
entry("BET", "America/Sao_Paulo"),
entry("BST", "Asia/Dhaka"),
entry("CAT", "Africa/Harare"),
entry("CNT", "America/St_Johns"),
entry("CST", "America/Chicago"),
entry("CTT", "Asia/Shanghai"),
entry("EAT", "Africa/Addis_Ababa"),
entry("ECT", "Europe/Paris"),
entry("IET", "America/Indiana/Indianapolis"),
entry("IST", "Asia/Kolkata"),
entry("JST", "Asia/Tokyo"),
entry("MIT", "Pacific/Apia"),
entry("NET", "Asia/Yerevan"),
entry("NST", "Pacific/Auckland"),
entry("PLT", "Asia/Karachi"),
entry("PNT", "America/Phoenix"),
entry("PRT", "America/Puerto_Rico"),
entry("PST", "America/Los_Angeles"),
entry("SST", "Pacific/Guadalcanal"),
entry("VST", "Asia/Ho_Chi_Minh"),
entry("EST", "-05:00"),
entry("MST", "-07:00"),
entry("HST", "-10:00")
);
/**
* Serialization version.
*/

View File

@ -77,8 +77,6 @@ import java.time.temporal.TemporalQueries;
import java.time.temporal.TemporalUnit;
import java.time.temporal.UnsupportedTemporalTypeException;
import java.time.temporal.ValueRange;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
@ -105,8 +103,7 @@ final class ChronoPeriodImpl
/**
* The set of supported units.
*/
private static final List<TemporalUnit> SUPPORTED_UNITS =
Collections.unmodifiableList(Arrays.<TemporalUnit>asList(YEARS, MONTHS, DAYS));
private static final List<TemporalUnit> SUPPORTED_UNITS = List.of(YEARS, MONTHS, DAYS);
/**
* The chronology.

View File

@ -59,10 +59,7 @@ package java.time.chrono;
import static java.time.temporal.ChronoField.EPOCH_DAY;
import java.io.File;
import java.io.FileInputStream;
import java.io.FilePermission;
import java.io.IOException;
import java.io.InputStream;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
@ -83,7 +80,6 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
import sun.util.logging.PlatformLogger;
@ -512,7 +508,7 @@ public final class HijrahChronology extends AbstractChronology implements Serial
@Override
public List<Era> eras() {
return Arrays.<Era>asList(HijrahEra.values());
return List.of(HijrahEra.values());
}
//-----------------------------------------------------------------------

View File

@ -90,7 +90,6 @@ import java.time.temporal.ChronoField;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalField;
import java.time.temporal.ValueRange;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@ -492,7 +491,7 @@ public final class IsoChronology extends AbstractChronology implements Serializa
@Override
public List<Era> eras() {
return Arrays.<Era>asList(IsoEra.values());
return List.of(IsoEra.values());
}
//-----------------------------------------------------------------------

View File

@ -81,7 +81,6 @@ import java.time.temporal.TemporalAdjusters;
import java.time.temporal.TemporalField;
import java.time.temporal.UnsupportedTemporalTypeException;
import java.time.temporal.ValueRange;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;
@ -379,7 +378,7 @@ public final class JapaneseChronology extends AbstractChronology implements Seri
@Override
public List<Era> eras() {
return Arrays.<Era>asList(JapaneseEra.values());
return List.of(JapaneseEra.values());
}
JapaneseEra getCurrentEra() {

View File

@ -72,7 +72,6 @@ import java.time.temporal.ChronoField;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalField;
import java.time.temporal.ValueRange;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@ -306,7 +305,7 @@ public final class MinguoChronology extends AbstractChronology implements Serial
@Override
public List<Era> eras() {
return Arrays.<Era>asList(MinguoEra.values());
return List.of(MinguoEra.values());
}
//-----------------------------------------------------------------------

View File

@ -342,7 +342,7 @@ public final class ThaiBuddhistChronology extends AbstractChronology implements
@Override
public List<Era> eras() {
return Arrays.<Era>asList(ThaiBuddhistEra.values());
return List.of(ThaiBuddhistEra.values());
}
//-----------------------------------------------------------------------

View File

@ -1685,6 +1685,7 @@ public final class DateTimeFormatter {
public DateTimeFormatter withResolverFields(TemporalField... resolverFields) {
Set<TemporalField> fields = null;
if (resolverFields != null) {
// Set.of cannot be used because it is hostile to nulls and duplicate elements
fields = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(resolverFields)));
}
if (Objects.equals(this.resolverFields, fields)) {

View File

@ -387,9 +387,9 @@ public final class ZoneOffsetTransition
*/
List<ZoneOffset> getValidOffsets() {
if (isGap()) {
return Collections.emptyList();
return List.of();
}
return Arrays.asList(getOffsetBefore(), getOffsetAfter());
return List.of(getOffsetBefore(), getOffsetAfter());
}
//-----------------------------------------------------------------------

View File

@ -303,7 +303,6 @@ public final class ZoneRules implements Serializable {
* Creates an instance of ZoneRules that has fixed zone rules.
*
* @param offset the offset this fixed zone rules is based on, not null
* @return the zone rules, not null
* @see #isFixedOffset()
*/
private ZoneRules(ZoneOffset offset) {
@ -970,7 +969,7 @@ public final class ZoneRules implements Serializable {
* @return an immutable list of transition rules, not null
*/
public List<ZoneOffsetTransitionRule> getTransitionRules() {
return Collections.unmodifiableList(Arrays.asList(lastRules));
return List.of(lastRules);
}
/**

View File

@ -85,12 +85,12 @@ import sun.util.calendar.ZoneInfo;
* further information is the U.S. Naval Observatory, particularly
* the Directorate of Time at:
* <blockquote><pre>
* <a href=http://tycho.usno.navy.mil>http://tycho.usno.navy.mil</a>
* <a href="http://www.usno.navy.mil">http://www.usno.navy.mil</a>
* </pre></blockquote>
* <p>
* and their definitions of "Systems of Time" at:
* <blockquote><pre>
* <a href=http://tycho.usno.navy.mil/systime.html>http://tycho.usno.navy.mil/systime.html</a>
* <a href="http://www.usno.navy.mil/USNO/time/master-clock/systems-of-time">http://www.usno.navy.mil/USNO/time/master-clock/systems-of-time</a>
* </pre></blockquote>
* <p>
* In all methods of class {@code Date} that accept or return

View File

@ -2491,34 +2491,29 @@ public abstract class ResourceBundle {
/**
* The default format <code>List</code>, which contains the strings
* <code>"java.class"</code> and <code>"java.properties"</code>, in
* this order. This <code>List</code> is {@linkplain
* Collections#unmodifiableList(List) unmodifiable}.
* this order. This <code>List</code> is unmodifiable.
*
* @see #getFormats(String)
*/
public static final List<String> FORMAT_DEFAULT
= Collections.unmodifiableList(Arrays.asList("java.class",
"java.properties"));
= List.of("java.class", "java.properties");
/**
* The class-only format <code>List</code> containing
* <code>"java.class"</code>. This <code>List</code> is {@linkplain
* Collections#unmodifiableList(List) unmodifiable}.
* <code>"java.class"</code>. This <code>List</code> is unmodifiable.
*
* @see #getFormats(String)
*/
public static final List<String> FORMAT_CLASS
= Collections.unmodifiableList(Arrays.asList("java.class"));
public static final List<String> FORMAT_CLASS = List.of("java.class");
/**
* The properties-only format <code>List</code> containing
* <code>"java.properties"</code>. This <code>List</code> is
* {@linkplain Collections#unmodifiableList(List) unmodifiable}.
* <code>"java.properties"</code>. This <code>List</code> is unmodifiable.
*
* @see #getFormats(String)
*/
public static final List<String> FORMAT_PROPERTIES
= Collections.unmodifiableList(Arrays.asList("java.properties"));
= List.of("java.properties");
/**
* The time-to-live constant for not caching loaded resource bundle

View File

@ -56,8 +56,8 @@ public interface ToolProvider {
/**
* Returns the name of this tool provider.
*
* @apiNote It is recommended that the name be the same as would be used on
* the command line: for example, "javac", "jar", "jlink".
* @apiNote It is recommended that the name be the same as would be
* used on the command line: for example, "javac", "jar", "jlink".
*
* @return the name of this tool provider
*/
@ -67,12 +67,13 @@ public interface ToolProvider {
* Runs an instance of the tool, returning zero for a successful run.
* Any non-zero return value indicates a tool-specific error during the
* execution.
*
* Two streams should be provided, for "expected" output, and for any
* error messages. If it is not necessary to distinguish the output,
* the same stream may be used for both.
*
* @apiNote The interpretation of the arguments will be specific to
* each tool.
* each tool.
*
* @param out a stream to which "expected" output should be written
*
@ -81,12 +82,13 @@ public interface ToolProvider {
* @param args the command-line arguments for the tool
*
* @return the result of executing the tool.
* A return value of 0 means the tool did not encounter any errors;
* any other value indicates that at least one error occurred during
* execution.
* A return value of 0 means the tool did not encounter any errors;
* any other value indicates that at least one error occurred
* during execution.
*
* @throws NullPointerException if any of the arguments are {@code null},
* or if there are any {@code null} values in the {@code args} array
* or if there are any {@code null} values in the {@code args}
* array
*/
int run(PrintWriter out, PrintWriter err, String... args);
@ -94,16 +96,17 @@ public interface ToolProvider {
* Runs an instance of the tool, returning zero for a successful run.
* Any non-zero return value indicates a tool-specific error during the
* execution.
*
* Two streams should be provided, for "expected" output, and for any
* error messages. If it is not necessary to distinguish the output,
* the same stream may be used for both.
*
* @apiNote The interpretation of the arguments will be specific to
* each tool.
* each tool.
*
* @implNote This implementation wraps the {@code out} and {@code err}
* streams within {@link PrintWriter}s, and then calls
* {@link run(PrintWriter, PrintWriter, String[])}.
* streams within {@link PrintWriter}s, and then calls
* {@link #run(PrintWriter, PrintWriter, String[])}.
*
* @param out a stream to which "expected" output should be written
*
@ -112,12 +115,13 @@ public interface ToolProvider {
* @param args the command-line arguments for the tool
*
* @return the result of executing the tool.
* A return value of 0 means the tool did not encounter any errors;
* any other value indicates that at least one error occurred during
* execution.
* A return value of 0 means the tool did not encounter any errors;
* any other value indicates that at least one error occurred
* during execution.
*
* @throws NullPointerException if any of the arguments are {@code null},
* or if there are any {@code null} values in the {@code args} array
* or if there are any {@code null} values in the {@code args}
* array
*/
default int run(PrintStream out, PrintStream err, String... args) {
Objects.requireNonNull(out);

View File

@ -27,7 +27,6 @@ package java.util.stream;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
@ -1720,12 +1719,12 @@ public final class Collectors {
@Override
public Set<Map.Entry<Boolean, T>> entrySet() {
return new AbstractSet<Map.Entry<Boolean, T>>() {
return new AbstractSet<>() {
@Override
public Iterator<Map.Entry<Boolean, T>> iterator() {
Map.Entry<Boolean, T> falseEntry = new SimpleImmutableEntry<>(false, forFalse);
Map.Entry<Boolean, T> trueEntry = new SimpleImmutableEntry<>(true, forTrue);
return Arrays.asList(falseEntry, trueEntry).iterator();
return List.of(falseEntry, trueEntry).iterator();
}
@Override

View File

@ -282,7 +282,7 @@ public interface Stream<T> extends BaseStream<T, Stream<T>> {
*/
<R> Stream<R> flatMap(Function<? super T, ? extends Stream<? extends R>> mapper);
/**:
/**
* Returns an {@code IntStream} consisting of the results of replacing each
* element of this stream with the contents of a mapped stream produced by
* applying the provided mapping function to each element. Each mapped

View File

@ -154,7 +154,6 @@ module java.base {
exports jdk.internal.module to
java.instrument,
java.management,
jdk.dynalink,
jdk.jartool,
jdk.jlink;
exports jdk.internal.misc to

View File

@ -432,6 +432,8 @@ public class HKSCS {
continue;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == UNMAPPABLE_DECODING)
continue;
int hi = c >> 8;
if (c2b[hi] == C2B_UNMAPPABLE) {
c2b[hi] = new char[0x100];

View File

@ -282,7 +282,7 @@ final class EllipticCurvesExtension extends HelloExtension {
private static int getPreferredCurve(int[] curves,
AlgorithmConstraints constraints) {
for (int curveId : curves) {
if (constraints.permits(
if (isSupported(curveId) && constraints.permits(
EnumSet.of(CryptoPrimitive.KEY_AGREEMENT),
"EC", idToParams.get(curveId))) {
return curveId;

View File

@ -49,6 +49,7 @@ import sun.security.internal.spec.TlsPrfParameterSpec;
import sun.security.ssl.CipherSuite.*;
import static sun.security.ssl.CipherSuite.PRF.*;
import sun.security.util.KeyUtil;
import sun.security.util.MessageDigestSpi2;
import sun.security.provider.certpath.OCSPResponse;
/**
@ -2124,63 +2125,14 @@ static final class CertificateVerify extends HandshakeMessage {
md.update(temp);
}
private static final Class<?> delegate;
private static final Field spiField;
static {
try {
delegate = Class.forName("java.security.MessageDigest$Delegate");
spiField = delegate.getDeclaredField("digestSpi");
} catch (Exception e) {
throw new RuntimeException("Reflection failed", e);
}
makeAccessible(spiField);
}
private static void makeAccessible(final AccessibleObject o) {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
o.setAccessible(true);
return null;
}
});
}
// ConcurrentHashMap does not allow null values, use this marker object
private static final Object NULL_OBJECT = new Object();
// cache Method objects per Spi class
// Note that this will prevent the Spi classes from being GC'd. We assume
// that is not a problem.
private static final Map<Class<?>,Object> methodCache =
new ConcurrentHashMap<>();
private static void digestKey(MessageDigest md, SecretKey key) {
try {
// Verify that md is implemented via MessageDigestSpi, not
// via JDK 1.1 style MessageDigest subclassing.
if (md.getClass() != delegate) {
throw new Exception("Digest is not a MessageDigestSpi");
}
MessageDigestSpi spi = (MessageDigestSpi)spiField.get(md);
Class<?> clazz = spi.getClass();
Object r = methodCache.get(clazz);
if (r == null) {
try {
r = clazz.getDeclaredMethod("implUpdate", SecretKey.class);
makeAccessible((Method)r);
} catch (NoSuchMethodException e) {
r = NULL_OBJECT;
}
methodCache.put(clazz, r);
}
if (r == NULL_OBJECT) {
if (md instanceof MessageDigestSpi2) {
((MessageDigestSpi2)md).engineUpdate(key);
} else {
throw new Exception(
"Digest does not support implUpdate(SecretKey)");
}
Method update = (Method)r;
update.invoke(spi, key);
} catch (Exception e) {
throw new RuntimeException(
"Could not obtain encoded key and "

View File

@ -1172,11 +1172,18 @@ final class ServerHandshaker extends Handshaker {
if (trySetCipherSuite(suite) == false) {
continue;
}
if (debug != null && Debug.isOn("handshake")) {
System.out.println("Standard ciphersuite chosen: " + suite);
}
return;
}
for (CipherSuite suite : legacySuites) {
if (trySetCipherSuite(suite)) {
if (debug != null && Debug.isOn("handshake")) {
System.out.println("Legacy ciphersuite chosen: " + suite);
}
return;
}
}

View File

@ -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
@ -23,11 +23,22 @@
* questions.
*/
package jdk.dynalink.test;
package sun.security.util;
import java.security.InvalidKeyException;
import javax.crypto.SecretKey;
/**
* Exception used to signal to the test method that the control has reached auto loaded
* dynamic linker.
* Special interface for additional MessageDigestSpi method(s).
*/
public final class ReachedAutoLoadedDynamicLinkerException extends RuntimeException {
public interface MessageDigestSpi2 {
/**
* Updates the digest using the specified key.
* This is used for SSL 3.0 only, we may deprecate and remove the support
* of this in the future
*
* @param key the key whose value is to be digested.
*/
void engineUpdate(SecretKey key) throws InvalidKeyException;
}

View File

@ -91,7 +91,6 @@ grant codeBase "jrt:/java.xml.ws" {
};
grant codeBase "jrt:/jdk.charsets" {
permission java.io.FilePermission "${java.home}/-", "read";
permission java.util.PropertyPermission "os.name", "read";
permission java.util.PropertyPermission "sun.nio.cs.map", "read";
permission java.lang.RuntimePermission "charsetProvider";

View File

@ -376,14 +376,14 @@ public class Base64 {
return null;
}
int lengthDataBits = binaryData.length * EIGHTBIT;
if (lengthDataBits == 0) {
long lengthDataBits = ((long) binaryData.length) * ((long) EIGHTBIT);
if (lengthDataBits == 0L) {
return "";
}
int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets;
long fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
int numberTriplets = (int) (lengthDataBits / TWENTYFOURBITGROUP);
int numberQuartet = fewerThan24bits != 0L ? numberTriplets + 1 : numberTriplets;
int quartesPerLine = length / 4;
int numberLines = (numberQuartet - 1) / quartesPerLine;
char encodedData[] = null;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -34,6 +34,8 @@ import javax.crypto.SecretKey;
import sun.nio.ch.DirectBuffer;
import sun.security.util.MessageDigestSpi2;
import sun.security.pkcs11.wrapper.*;
import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
@ -49,7 +51,8 @@ import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
* @author Andreas Sterbenz
* @since 1.5
*/
final class P11Digest extends MessageDigestSpi implements Cloneable {
final class P11Digest extends MessageDigestSpi implements Cloneable,
MessageDigestSpi2 {
/* fields initialized, no session acquired */
private final static int S_BLANK = 1;
@ -233,10 +236,11 @@ final class P11Digest extends MessageDigestSpi implements Cloneable {
}
// Called by SunJSSE via reflection during the SSL 3.0 handshake if
// the master secret is sensitive. We may want to consider making this
// method public in a future release.
protected void implUpdate(SecretKey key) throws InvalidKeyException {
// the master secret is sensitive.
// Note: Change to protected after this method is moved from
// sun.security.util.MessageSpi2 interface to
// java.security.MessageDigestSpi class
public void engineUpdate(SecretKey key) throws InvalidKeyException {
// SunJSSE calls this method only if the key does not have a RAW
// encoding, i.e. if it is sensitive. Therefore, no point in calling
// SecretKeyFactory to try to convert it. Just verify it ourselves.

View File

@ -2339,7 +2339,7 @@ public class ConsoleReader
Stack<Character> pushBackChar = new Stack<Character>();
if (terminal.isAnsiSupported()) {
if (terminal.isAnsiSupported() && System.console() != null) {
//detect the prompt length by reading the cursor position from the terminal
//the real prompt length could differ from the simple prompt length due to
//use of escape sequences:

View File

@ -26,5 +26,7 @@
module jdk.jartool {
exports com.sun.jarsigner;
exports jdk.security.jarsigner;
provides java.util.spi.ToolProvider with sun.tools.jar.JarToolProvider;
}

Some files were not shown because too many files have changed in this diff Show More