Merge
This commit is contained in:
commit
9864800638
2
.hgtags
2
.hgtags
@ -382,3 +382,5 @@ e384420383a5b79fa0012ebcb25d8f83cff7f777 jdk-9+135
|
||||
9cb87c88ed851c0575b8ead753ea238ed5b544e9 jdk-9+137
|
||||
d273dfe9a126d3bffe92072547fef2cd1361b0eb jdk-9+138
|
||||
65477538bec32963dc41153d89c4417eb46c45fc jdk-9+139
|
||||
0875007901f7d364a08220b052f0c81003e9c8c5 jdk-9+140
|
||||
9aadd2163b568d76f8969ad2fb404a63733da359 jdk-9+141
|
||||
|
@ -382,3 +382,5 @@ be1218f792a450dfb5d4b1f82616b9d95a6a732e jdk-9+133
|
||||
d7f519b004254b19e384131d9f0d0e40e31a0fd3 jdk-9+137
|
||||
67c4388142bdf58aec8fefa4475faaa8a5d7380c jdk-9+138
|
||||
7dcf453eacae79ee86a6bcc75fd0b546fc99b48a jdk-9+139
|
||||
a5815c6098a241d3a1df64d22b84b3524e4a77df jdk-9+140
|
||||
f64afae7f1a5608e438585bbf0bc23785e69cba0 jdk-9+141
|
||||
|
@ -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'`
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -895,7 +895,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
|
||||
elif test "x$OPENJDK_$1_OS" = xsolaris; then
|
||||
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -DSOLARIS"
|
||||
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -template=no%extdef -features=no%split_init \
|
||||
-D_Crun_inline_placement -library=%none -KPIC -mt -xwe -features=no%except"
|
||||
-D_Crun_inline_placement -library=%none -KPIC -mt -features=no%except"
|
||||
elif test "x$OPENJDK_$1_OS" = xmacosx; then
|
||||
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
|
||||
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_ALLBSD_SOURCE"
|
||||
|
@ -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=1477108079
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
@ -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=.
|
||||
@ -50071,7 +50077,7 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
|
||||
elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
||||
JVM_CFLAGS="$JVM_CFLAGS -DSOLARIS"
|
||||
JVM_CFLAGS="$JVM_CFLAGS -template=no%extdef -features=no%split_init \
|
||||
-D_Crun_inline_placement -library=%none -KPIC -mt -xwe -features=no%except"
|
||||
-D_Crun_inline_placement -library=%none -KPIC -mt -features=no%except"
|
||||
elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
|
||||
JVM_CFLAGS="$JVM_CFLAGS -D_ALLBSD_SOURCE"
|
||||
@ -50886,7 +50892,7 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
|
||||
elif test "x$OPENJDK_BUILD_OS" = xsolaris; then
|
||||
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -DSOLARIS"
|
||||
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -template=no%extdef -features=no%split_init \
|
||||
-D_Crun_inline_placement -library=%none -KPIC -mt -xwe -features=no%except"
|
||||
-D_Crun_inline_placement -library=%none -KPIC -mt -features=no%except"
|
||||
elif test "x$OPENJDK_BUILD_OS" = xmacosx; then
|
||||
OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
|
||||
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -D_ALLBSD_SOURCE"
|
||||
@ -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; }
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
},
|
||||
|
||||
|
@ -382,3 +382,5 @@ aa053a3faf266c12b4fd5272da431a3e08e4a3e3 jdk-9+136
|
||||
258cf18fa7fc59359b874f8743b7168dc48baf73 jdk-9+137
|
||||
27bb44be32076861a0951bcefb07a1d92509a4b6 jdk-9+138
|
||||
8c9da7fc5b07c606afd571c7012441b77dda83b2 jdk-9+139
|
||||
9f3fc931bc230f44f2a58d75f7f6360af98bb113 jdk-9+140
|
||||
b32f998da32b488ec7c4e9dbb3c750841b48e74d jdk-9+141
|
||||
|
@ -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
|
||||
|
@ -31,22 +31,17 @@
|
||||
|
||||
package com.sun.corba.se.impl.io;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.StreamCorruptedException;
|
||||
import java.io.ObjectInputValidation;
|
||||
import java.io.NotActiveException;
|
||||
import java.io.InvalidObjectException;
|
||||
import java.io.InvalidClassException;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.OptionalDataException;
|
||||
import java.io.WriteAbortedException;
|
||||
import java.io.Externalizable;
|
||||
import java.io.EOFException;
|
||||
import java.lang.reflect.*;
|
||||
import java.util.Vector;
|
||||
import java.util.Stack;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import sun.corba.Bridge ;
|
||||
@ -54,7 +49,6 @@ import sun.corba.Bridge ;
|
||||
import java.security.AccessController ;
|
||||
import java.security.PrivilegedAction ;
|
||||
|
||||
import com.sun.corba.se.impl.io.ObjectStreamClass;
|
||||
import com.sun.corba.se.impl.util.Utility;
|
||||
|
||||
import org.omg.CORBA.portable.ValueInputStream;
|
||||
@ -71,14 +65,12 @@ import org.omg.CORBA.TypeCode;
|
||||
import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription;
|
||||
import com.sun.org.omg.SendingContext.CodeBase;
|
||||
|
||||
import javax.rmi.PortableRemoteObject;
|
||||
import javax.rmi.CORBA.Util;
|
||||
import javax.rmi.CORBA.ValueHandler;
|
||||
|
||||
import java.security.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.corba.se.impl.orbutil.ObjectUtility ;
|
||||
import com.sun.corba.se.impl.logging.OMGSystemException ;
|
||||
import com.sun.corba.se.impl.logging.UtilSystemException ;
|
||||
|
||||
@ -182,75 +174,6 @@ public class IIOPInputStream
|
||||
|
||||
private byte streamFormatVersion;
|
||||
|
||||
// Since java.io.OptionalDataException's constructors are
|
||||
// package private, but we need to throw it in some special
|
||||
// cases, we try to do it by reflection.
|
||||
private static final Constructor OPT_DATA_EXCEPTION_CTOR;
|
||||
|
||||
private Object[] readObjectArgList = { this } ;
|
||||
|
||||
static {
|
||||
OPT_DATA_EXCEPTION_CTOR = getOptDataExceptionCtor();
|
||||
}
|
||||
|
||||
// Grab the OptionalDataException boolean ctor and make
|
||||
// it accessible. Note that any exceptions
|
||||
// will be wrapped in ExceptionInInitializerErrors.
|
||||
private static Constructor getOptDataExceptionCtor() {
|
||||
|
||||
try {
|
||||
|
||||
Constructor result =
|
||||
|
||||
(Constructor) AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction() {
|
||||
public java.lang.Object run()
|
||||
throws NoSuchMethodException,
|
||||
SecurityException {
|
||||
|
||||
Constructor boolCtor
|
||||
= OptionalDataException.class.getDeclaredConstructor(
|
||||
new Class[] {
|
||||
Boolean.TYPE });
|
||||
|
||||
boolCtor.setAccessible(true);
|
||||
|
||||
return boolCtor;
|
||||
}});
|
||||
|
||||
if (result == null)
|
||||
// XXX I18N, logging needed.
|
||||
throw new Error("Unable to find OptionalDataException constructor");
|
||||
|
||||
return result;
|
||||
|
||||
} catch (Exception ex) {
|
||||
// XXX I18N, logging needed.
|
||||
throw new ExceptionInInitializerError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new OptionalDataException with the EOF marker
|
||||
// set to true. See handleOptionalDataMarshalException.
|
||||
private OptionalDataException createOptionalDataException() {
|
||||
try {
|
||||
OptionalDataException result
|
||||
= (OptionalDataException)
|
||||
OPT_DATA_EXCEPTION_CTOR.newInstance(new Object[] {
|
||||
Boolean.TRUE });
|
||||
|
||||
if (result == null)
|
||||
// XXX I18N, logging needed.
|
||||
throw new Error("Created null OptionalDataException");
|
||||
|
||||
return result;
|
||||
|
||||
} catch (Exception ex) {
|
||||
// XXX I18N, logging needed.
|
||||
throw new Error("Couldn't create OptionalDataException", ex);
|
||||
}
|
||||
}
|
||||
|
||||
// Return the stream format version currently being used
|
||||
// to deserialize an object
|
||||
protected byte getStreamFormatVersion() {
|
||||
@ -395,7 +318,6 @@ public class IIOPInputStream
|
||||
int offset)
|
||||
/* throws OptionalDataException, ClassNotFoundException, IOException */
|
||||
{
|
||||
|
||||
/* Save the current state and get ready to read an object. */
|
||||
Object prevObject = currentObject;
|
||||
ObjectStreamClass prevClassDesc = currentClassDesc;
|
||||
@ -947,7 +869,7 @@ public class IIOPInputStream
|
||||
if (!objectRead)
|
||||
result = new EOFException("No more optional data");
|
||||
else
|
||||
result = createOptionalDataException();
|
||||
result = bridge.newOptionalDataExceptionForSerialization(true);
|
||||
|
||||
result.initCause(marshalException);
|
||||
|
||||
@ -1230,8 +1152,7 @@ public class IIOPInputStream
|
||||
|
||||
readObjectState.beginUnmarshalCustomValue(this,
|
||||
calledDefaultWriteObject,
|
||||
(currentClassDesc.readObjectMethod
|
||||
!= null));
|
||||
currentClassDesc.hasReadObject());
|
||||
} else {
|
||||
if (currentClassDesc.hasReadObject())
|
||||
setState(IN_READ_OBJECT_REMOTE_NOT_CUSTOM_MARSHALED);
|
||||
@ -1556,8 +1477,7 @@ public class IIOPInputStream
|
||||
|
||||
readObjectState.beginUnmarshalCustomValue(this,
|
||||
calledDefaultWriteObject,
|
||||
(currentClassDesc.readObjectMethod
|
||||
!= null));
|
||||
currentClassDesc.hasReadObject());
|
||||
}
|
||||
|
||||
boolean usedReadObject = false;
|
||||
@ -1714,13 +1634,8 @@ public class IIOPInputStream
|
||||
throws InvalidClassException, StreamCorruptedException,
|
||||
ClassNotFoundException, IOException
|
||||
{
|
||||
if (osc.readObjectMethod == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
osc.readObjectMethod.invoke( obj, readObjectArgList ) ;
|
||||
return true;
|
||||
return osc.invokeReadObject( obj, this ) ;
|
||||
} catch (InvocationTargetException e) {
|
||||
Throwable t = e.getTargetException();
|
||||
if (t instanceof ClassNotFoundException)
|
||||
@ -1734,8 +1649,6 @@ public class IIOPInputStream
|
||||
else
|
||||
// XXX I18N, logging needed.
|
||||
throw new Error("internal error");
|
||||
} catch (IllegalAccessException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,33 +31,23 @@
|
||||
|
||||
package com.sun.corba.se.impl.io;
|
||||
|
||||
import org.omg.CORBA.INTERNAL;
|
||||
import org.omg.CORBA.portable.OutputStream;
|
||||
|
||||
import java.security.AccessController ;
|
||||
import java.security.PrivilegedAction ;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.io.InvalidClassException;
|
||||
import java.io.StreamCorruptedException;
|
||||
import java.io.Externalizable;
|
||||
import java.io.ObjectStreamException;
|
||||
import java.io.NotSerializableException;
|
||||
import java.io.NotActiveException;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
import javax.rmi.CORBA.Util;
|
||||
import javax.rmi.CORBA.ValueHandlerMultiFormat;
|
||||
|
||||
import sun.corba.Bridge ;
|
||||
|
||||
import com.sun.corba.se.impl.io.ObjectStreamClass;
|
||||
import com.sun.corba.se.impl.util.Utility;
|
||||
import com.sun.corba.se.impl.util.RepositoryId;
|
||||
|
||||
@ -621,7 +611,7 @@ public class IIOPOutputStream
|
||||
writeObjectState.enterWriteObject(this);
|
||||
|
||||
// writeObject(obj, c, this);
|
||||
osc.writeObjectMethod.invoke( obj, writeObjectArgList ) ;
|
||||
osc.invokeWriteObject( obj, this ) ;
|
||||
|
||||
writeObjectState.exitWriteObject(this);
|
||||
|
||||
@ -636,8 +626,6 @@ public class IIOPOutputStream
|
||||
else
|
||||
// XXX I18N, Logging needed.
|
||||
throw new Error("invokeObjectWriter internal error",e);
|
||||
} catch (IllegalAccessException e) {
|
||||
// cannot happen
|
||||
}
|
||||
}
|
||||
|
||||
@ -761,59 +749,52 @@ public class IIOPOutputStream
|
||||
*/
|
||||
private void outputClassFields(Object o, Class cl,
|
||||
ObjectStreamField[] fields)
|
||||
throws IOException, InvalidClassException {
|
||||
throws IOException {
|
||||
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
if (fields[i].getField() == null)
|
||||
// XXX I18N, Logging needed.
|
||||
throw new InvalidClassException(cl.getName(),
|
||||
"Nonexistent field " + fields[i].getName());
|
||||
|
||||
try {
|
||||
switch (fields[i].getTypeCode()) {
|
||||
case 'B':
|
||||
byte byteValue = fields[i].getField().getByte( o ) ;
|
||||
orbStream.write_octet(byteValue);
|
||||
break;
|
||||
case 'C':
|
||||
char charValue = fields[i].getField().getChar( o ) ;
|
||||
orbStream.write_wchar(charValue);
|
||||
break;
|
||||
case 'F':
|
||||
float floatValue = fields[i].getField().getFloat( o ) ;
|
||||
orbStream.write_float(floatValue);
|
||||
break;
|
||||
case 'D' :
|
||||
double doubleValue = fields[i].getField().getDouble( o ) ;
|
||||
orbStream.write_double(doubleValue);
|
||||
break;
|
||||
case 'I':
|
||||
int intValue = fields[i].getField().getInt( o ) ;
|
||||
orbStream.write_long(intValue);
|
||||
break;
|
||||
case 'J':
|
||||
long longValue = fields[i].getField().getLong( o ) ;
|
||||
orbStream.write_longlong(longValue);
|
||||
break;
|
||||
case 'S':
|
||||
short shortValue = fields[i].getField().getShort( o ) ;
|
||||
orbStream.write_short(shortValue);
|
||||
break;
|
||||
case 'Z':
|
||||
boolean booleanValue = fields[i].getField().getBoolean( o ) ;
|
||||
orbStream.write_boolean(booleanValue);
|
||||
break;
|
||||
case '[':
|
||||
case 'L':
|
||||
Object objectValue = fields[i].getField().get( o ) ;
|
||||
writeObjectField(fields[i], objectValue);
|
||||
break;
|
||||
default:
|
||||
// XXX I18N, Logging needed.
|
||||
throw new InvalidClassException(cl.getName());
|
||||
}
|
||||
} catch (IllegalAccessException exc) {
|
||||
throw wrapper.illegalFieldAccess( exc, fields[i].getName() ) ;
|
||||
switch (fields[i].getTypeCode()) {
|
||||
case 'B':
|
||||
byte byteValue = bridge.getByte(o, fields[i].getFieldID()) ;
|
||||
orbStream.write_octet(byteValue);
|
||||
break;
|
||||
case 'C':
|
||||
char charValue = bridge.getChar(o, fields[i].getFieldID()) ;
|
||||
orbStream.write_wchar(charValue);
|
||||
break;
|
||||
case 'F':
|
||||
float floatValue = bridge.getFloat(o, fields[i].getFieldID()) ;
|
||||
orbStream.write_float(floatValue);
|
||||
break;
|
||||
case 'D' :
|
||||
double doubleValue = bridge.getDouble(o, fields[i].getFieldID()) ;
|
||||
orbStream.write_double(doubleValue);
|
||||
break;
|
||||
case 'I':
|
||||
int intValue = bridge.getInt(o, fields[i].getFieldID()) ;
|
||||
orbStream.write_long(intValue);
|
||||
break;
|
||||
case 'J':
|
||||
long longValue = bridge.getLong(o, fields[i].getFieldID()) ;
|
||||
orbStream.write_longlong(longValue);
|
||||
break;
|
||||
case 'S':
|
||||
short shortValue = bridge.getShort(o, fields[i].getFieldID()) ;
|
||||
orbStream.write_short(shortValue);
|
||||
break;
|
||||
case 'Z':
|
||||
boolean booleanValue = bridge.getBoolean(o, fields[i].getFieldID()) ;
|
||||
orbStream.write_boolean(booleanValue);
|
||||
break;
|
||||
case '[':
|
||||
case 'L':
|
||||
Object objectValue = bridge.getObject(o, fields[i].getFieldID()) ;
|
||||
writeObjectField(fields[i], objectValue);
|
||||
break;
|
||||
default:
|
||||
throw new InvalidClassException(cl.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,16 +31,16 @@
|
||||
|
||||
package com.sun.corba.se.impl.io;
|
||||
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.DigestOutputStream;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Member;
|
||||
import java.lang.reflect.Method;
|
||||
@ -80,9 +80,6 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
|
||||
public static final long kDefaultUID = -1;
|
||||
|
||||
private static Object noArgsList[] = {};
|
||||
private static Class<?> noTypesList[] = {};
|
||||
|
||||
/** true if represents enum type */
|
||||
private boolean isEnum;
|
||||
|
||||
@ -311,12 +308,37 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final boolean invokeWriteObject(Object obj, ObjectOutputStream ois) throws InvocationTargetException {
|
||||
if (!hasWriteObject()) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
writeObjectMethod.invoke(obj, ois);
|
||||
} catch (Throwable t) {
|
||||
throw new InvocationTargetException(t, "writeObject");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public final boolean invokeReadObject(Object obj, ObjectInputStream ois) throws InvocationTargetException {
|
||||
if (hasReadObject()) {
|
||||
try {
|
||||
readObjectMethod.invoke(obj, ois);
|
||||
return true;
|
||||
} catch (Throwable t) {
|
||||
throw new InvocationTargetException(t, "readObject");
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Serializable writeReplace(Serializable value) {
|
||||
if (writeReplaceObjectMethod != null) {
|
||||
try {
|
||||
return (Serializable) writeReplaceObjectMethod.invoke(value,noArgsList);
|
||||
} catch(Throwable t) {
|
||||
throw new RuntimeException(t);
|
||||
return (Serializable) writeReplaceObjectMethod.invoke(value);
|
||||
} catch (Throwable t) {
|
||||
throw new InternalError("unexpected error", t);
|
||||
}
|
||||
}
|
||||
else return value;
|
||||
@ -325,9 +347,9 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
public Object readResolve(Object value) {
|
||||
if (readResolveObjectMethod != null) {
|
||||
try {
|
||||
return readResolveObjectMethod.invoke(value,noArgsList);
|
||||
} catch(Throwable t) {
|
||||
throw new RuntimeException(t);
|
||||
return readResolveObjectMethod.invoke(value);
|
||||
} catch (Throwable t) {
|
||||
throw new InternalError("unexpected error", t);
|
||||
}
|
||||
}
|
||||
else return value;
|
||||
@ -382,31 +404,34 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
*/
|
||||
}
|
||||
|
||||
private static final class PersistentFieldsValue
|
||||
static final class PersistentFieldsValue
|
||||
extends ClassValue<ObjectStreamField[]> {
|
||||
PersistentFieldsValue() { }
|
||||
|
||||
protected ObjectStreamField[] computeValue(Class<?> type) {
|
||||
try {
|
||||
bridge.ensureClassInitialized(type);
|
||||
Field pf = type.getDeclaredField("serialPersistentFields");
|
||||
int mods = pf.getModifiers();
|
||||
if (Modifier.isPrivate(mods) && Modifier.isStatic(mods) &&
|
||||
Modifier.isFinal(mods)) {
|
||||
pf.setAccessible(true);
|
||||
long offset = bridge.staticFieldOffset(pf);
|
||||
java.io.ObjectStreamField[] fields =
|
||||
(java.io.ObjectStreamField[])pf.get(type);
|
||||
(java.io.ObjectStreamField[])bridge.getObject(type, offset);
|
||||
return translateFields(fields);
|
||||
}
|
||||
} catch (NoSuchFieldException | IllegalAccessException |
|
||||
} catch (NoSuchFieldException |
|
||||
IllegalArgumentException | ClassCastException e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static ObjectStreamField[] translateFields(
|
||||
java.io.ObjectStreamField[] fields) {
|
||||
private static ObjectStreamField[] translateFields(java.io.ObjectStreamField[] fields) {
|
||||
if (fields == null) {
|
||||
return null;
|
||||
}
|
||||
ObjectStreamField[] translation =
|
||||
new ObjectStreamField[fields.length];
|
||||
new ObjectStreamField[fields.length];
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
translation[i] = new ObjectStreamField(fields[i].getName(),
|
||||
fields[i].getType());
|
||||
@ -450,13 +475,11 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
* If it is declared, use the declared serialPersistentFields.
|
||||
* Otherwise, extract the fields from the class itself.
|
||||
*/
|
||||
fields = persistentFieldsValue.get(cl);
|
||||
fields = persistentFieldsValue.get(cl);
|
||||
|
||||
if (fields == null) {
|
||||
/* Get all of the declared fields for this
|
||||
* Class. setAccessible on all fields so they
|
||||
* can be accessed later. Create a temporary
|
||||
* ObjectStreamField array to hold each
|
||||
/* Get all of the declared fields for this Class.
|
||||
* Create a temporary ObjectStreamField array to hold each
|
||||
* non-static, non-transient field. Then copy the
|
||||
* temporary array into an array of the correct
|
||||
* size once the number of fields is known.
|
||||
@ -471,7 +494,6 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
int modifiers = fld.getModifiers();
|
||||
if (!Modifier.isStatic(modifiers) &&
|
||||
!Modifier.isTransient(modifiers)) {
|
||||
fld.setAccessible(true) ;
|
||||
tempFields[numFields++] = new ObjectStreamField(fld);
|
||||
}
|
||||
}
|
||||
@ -487,7 +509,6 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
try {
|
||||
Field reflField = cl.getDeclaredField(fields[j].getName());
|
||||
if (fields[j].getType() == reflField.getType()) {
|
||||
reflField.setAccessible(true);
|
||||
fields[j].setField(reflField);
|
||||
}
|
||||
} catch (NoSuchFieldException e) {
|
||||
@ -527,8 +548,8 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
int mods = f.getModifiers();
|
||||
// SerialBug 5: static final SUID should be read
|
||||
if (Modifier.isStatic(mods) && Modifier.isFinal(mods) ) {
|
||||
f.setAccessible(true);
|
||||
suid = f.getLong(cl);
|
||||
long offset = bridge.staticFieldOffset(f);
|
||||
suid = bridge.getLong(cl, offset);
|
||||
// SerialBug 2: should be computed after writeObject
|
||||
// actualSuid = computeStructuralUID(cl);
|
||||
} else {
|
||||
@ -540,16 +561,12 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
suid = _computeSerialVersionUID(cl);
|
||||
// SerialBug 2: should be computed after writeObject
|
||||
// actualSuid = computeStructuralUID(cl);
|
||||
} catch (IllegalAccessException ex) {
|
||||
suid = _computeSerialVersionUID(cl);
|
||||
}
|
||||
}
|
||||
|
||||
writeReplaceObjectMethod = ObjectStreamClass.getInheritableMethod(cl,
|
||||
"writeReplace", noTypesList, Object.class);
|
||||
writeReplaceObjectMethod = bridge.writeReplaceForSerialization(cl);
|
||||
|
||||
readResolveObjectMethod = ObjectStreamClass.getInheritableMethod(cl,
|
||||
"readResolve", noTypesList, Object.class);
|
||||
readResolveObjectMethod = bridge.readResolveForSerialization(cl);
|
||||
|
||||
if (externalizable)
|
||||
cons = getExternalizableConstructor(cl) ;
|
||||
@ -557,14 +574,8 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
cons = getSerializableConstructor(cl) ;
|
||||
|
||||
if (serializable && !forProxyClass) {
|
||||
/* Look for the writeObject method
|
||||
* Set the accessible flag on it here. ObjectOutputStream
|
||||
* will call it as necessary.
|
||||
*/
|
||||
writeObjectMethod = getPrivateMethod( cl, "writeObject",
|
||||
new Class<?>[] { java.io.ObjectOutputStream.class }, Void.TYPE ) ;
|
||||
readObjectMethod = getPrivateMethod( cl, "readObject",
|
||||
new Class<?>[] { java.io.ObjectInputStream.class }, Void.TYPE ) ;
|
||||
writeObjectMethod = bridge.writeObjectForSerialization(cl) ;
|
||||
readObjectMethod = bridge.readObjectForSerialization(cl);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -585,27 +596,6 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns non-static private method with given signature defined by given
|
||||
* class, or null if none found. Access checks are disabled on the
|
||||
* returned method (if any).
|
||||
*/
|
||||
private static Method getPrivateMethod(Class<?> cl, String name,
|
||||
Class<?>[] argTypes,
|
||||
Class<?> returnType)
|
||||
{
|
||||
try {
|
||||
Method meth = cl.getDeclaredMethod(name, argTypes);
|
||||
meth.setAccessible(true);
|
||||
int mods = meth.getModifiers();
|
||||
return ((meth.getReturnType() == returnType) &&
|
||||
((mods & Modifier.STATIC) == 0) &&
|
||||
((mods & Modifier.PRIVATE) != 0)) ? meth : null;
|
||||
} catch (NoSuchMethodException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Specific to RMI-IIOP
|
||||
/**
|
||||
* Java to IDL ptc-02-01-12 1.5.1
|
||||
@ -848,6 +838,22 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
return writeObjectMethod != null ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if represented class is serializable or externalizable and
|
||||
* defines a conformant writeReplace method. Otherwise, returns false.
|
||||
*/
|
||||
boolean hasWriteReplaceMethod() {
|
||||
return (writeReplaceObjectMethod != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if represented class is serializable or externalizable and
|
||||
* defines a conformant readResolve method. Otherwise, returns false.
|
||||
*/
|
||||
boolean hasReadResolveMethod() {
|
||||
return (readResolveObjectMethod != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns when or not this class should be custom
|
||||
* marshaled (use chunking). This should happen if
|
||||
@ -904,7 +910,7 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
{
|
||||
if (cons != null) {
|
||||
try {
|
||||
return cons.newInstance(new Object[0]);
|
||||
return cons.newInstance();
|
||||
} catch (IllegalAccessException ex) {
|
||||
// should not occur, as access checks have been suppressed
|
||||
InternalError ie = new InternalError();
|
||||
@ -912,7 +918,7 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
throw ie ;
|
||||
}
|
||||
} else {
|
||||
throw new UnsupportedOperationException();
|
||||
throw new UnsupportedOperationException("no constructor for " + ofClass);
|
||||
}
|
||||
}
|
||||
|
||||
@ -921,15 +927,8 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
* Access checks are disabled on the returned constructor (if any), since
|
||||
* the defining class may still be non-public.
|
||||
*/
|
||||
private static Constructor getExternalizableConstructor(Class<?> cl) {
|
||||
try {
|
||||
Constructor cons = cl.getDeclaredConstructor(new Class<?>[0]);
|
||||
cons.setAccessible(true);
|
||||
return ((cons.getModifiers() & Modifier.PUBLIC) != 0) ?
|
||||
cons : null;
|
||||
} catch (NoSuchMethodException ex) {
|
||||
return null;
|
||||
}
|
||||
private static Constructor<?> getExternalizableConstructor(Class<?> cl) {
|
||||
return bridge.newConstructorForExternalization(cl);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -937,28 +936,8 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
* superclass, or null if none found. Access checks are disabled on the
|
||||
* returned constructor (if any).
|
||||
*/
|
||||
private static Constructor getSerializableConstructor(Class<?> cl) {
|
||||
Class<?> initCl = cl;
|
||||
while (Serializable.class.isAssignableFrom(initCl)) {
|
||||
if ((initCl = initCl.getSuperclass()) == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
try {
|
||||
Constructor cons = initCl.getDeclaredConstructor(new Class<?>[0]);
|
||||
int mods = cons.getModifiers();
|
||||
if ((mods & Modifier.PRIVATE) != 0 ||
|
||||
((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 &&
|
||||
!packageEquals(cl, initCl)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
cons = bridge.newConstructorForSerialization(cl, cons);
|
||||
cons.setAccessible(true);
|
||||
return cons;
|
||||
} catch (NoSuchMethodException ex) {
|
||||
return null;
|
||||
}
|
||||
private static Constructor<?> getSerializableConstructor(Class<?> cl) {
|
||||
return bridge.newConstructorForSerialization(cl);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1522,11 +1501,11 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
* @since JDK 1.2
|
||||
*/
|
||||
private boolean hasExternalizableBlockData;
|
||||
Method writeObjectMethod;
|
||||
Method readObjectMethod;
|
||||
private transient Method writeReplaceObjectMethod;
|
||||
private transient Method readResolveObjectMethod;
|
||||
private Constructor cons ;
|
||||
private transient MethodHandle writeObjectMethod;
|
||||
private transient MethodHandle readObjectMethod;
|
||||
private transient MethodHandle writeReplaceObjectMethod;
|
||||
private transient MethodHandle readResolveObjectMethod;
|
||||
private transient Constructor<?> cons;
|
||||
|
||||
/**
|
||||
* Beginning in Java to IDL ptc/02-01-12, RMI-IIOP has a
|
||||
@ -1543,44 +1522,12 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
*/
|
||||
private ObjectStreamClass localClassDesc;
|
||||
|
||||
/* Find out if the class has a static class initializer <clinit> */
|
||||
private static Method hasStaticInitializerMethod = null;
|
||||
/**
|
||||
* Returns true if the given class defines a static initializer method,
|
||||
* false otherwise.
|
||||
*/
|
||||
private static boolean hasStaticInitializer(Class<?> cl) {
|
||||
if (hasStaticInitializerMethod == null) {
|
||||
Class<?> classWithThisMethod = null;
|
||||
|
||||
try {
|
||||
if (classWithThisMethod == null)
|
||||
classWithThisMethod = java.io.ObjectStreamClass.class;
|
||||
|
||||
hasStaticInitializerMethod =
|
||||
classWithThisMethod.getDeclaredMethod("hasStaticInitializer",
|
||||
new Class<?>[] { Class.class });
|
||||
} catch (NoSuchMethodException ex) {
|
||||
}
|
||||
|
||||
if (hasStaticInitializerMethod == null) {
|
||||
// XXX I18N, logging needed
|
||||
throw new InternalError("Can't find hasStaticInitializer method on "
|
||||
+ classWithThisMethod.getName());
|
||||
}
|
||||
hasStaticInitializerMethod.setAccessible(true);
|
||||
}
|
||||
|
||||
try {
|
||||
Boolean retval = (Boolean)
|
||||
hasStaticInitializerMethod.invoke(null, new Object[] { cl });
|
||||
return retval.booleanValue();
|
||||
} catch (Exception ex) {
|
||||
// XXX I18N, logging needed
|
||||
InternalError ie = new InternalError( "Error invoking hasStaticInitializer" ) ;
|
||||
ie.initCause( ex ) ;
|
||||
throw ie ;
|
||||
}
|
||||
return bridge.hasStaticInitializerForSerialization(cl);
|
||||
}
|
||||
|
||||
|
||||
@ -1754,7 +1701,6 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
if ((meth == null) || (meth.getReturnType() != returnType)) {
|
||||
return null;
|
||||
}
|
||||
meth.setAccessible(true);
|
||||
int mods = meth.getModifiers();
|
||||
if ((mods & (Modifier.STATIC | Modifier.ABSTRACT)) != 0) {
|
||||
return null;
|
||||
|
@ -32,6 +32,7 @@ module java.corba {
|
||||
requires java.logging;
|
||||
requires java.naming;
|
||||
requires java.transaction;
|
||||
requires jdk.unsupported;
|
||||
|
||||
exports javax.activity;
|
||||
exports javax.rmi;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 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
|
||||
@ -25,25 +25,24 @@
|
||||
|
||||
package sun.corba ;
|
||||
|
||||
import java.io.OptionalDataException;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.reflect.Field ;
|
||||
import java.lang.reflect.Method ;
|
||||
import java.lang.reflect.Constructor ;
|
||||
import java.lang.reflect.InvocationTargetException ;
|
||||
|
||||
import java.io.ObjectInputStream ;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.Permission;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import jdk.internal.misc.Unsafe ;
|
||||
import jdk.internal.reflect.ReflectionFactory;
|
||||
import sun.misc.Unsafe;
|
||||
import sun.reflect.ReflectionFactory;
|
||||
|
||||
/** This class provides the methods for fundamental JVM operations
|
||||
* needed in the ORB that are not part of the public Java API. This includes:
|
||||
* <ul>
|
||||
* <li>throwException, which can throw undeclared checked exceptions.
|
||||
* This is needed to handle throwing arbitrary exceptions across a standardized OMG interface that (incorrectly) does not specify appropriate exceptions.</li>
|
||||
* This is needed to handle throwing arbitrary exceptions across a standardized
|
||||
* OMG interface that (incorrectly) does not specify appropriate exceptions.</li>
|
||||
* <li>putXXX/getXXX methods that allow unchecked access to fields of objects.
|
||||
* This is used for setting uninitialzed non-static final fields (which is
|
||||
* impossible with reflection) and for speed.</li>
|
||||
@ -71,88 +70,28 @@ import jdk.internal.reflect.ReflectionFactory;
|
||||
*/
|
||||
public final class Bridge
|
||||
{
|
||||
private static final Class[] NO_ARGS = new Class[] {};
|
||||
private static final Permission getBridgePermission =
|
||||
new BridgePermission( "getBridge" ) ;
|
||||
new BridgePermission("getBridge");
|
||||
private static Bridge bridge = null ;
|
||||
|
||||
// latestUserDefinedLoader() is a private static method
|
||||
// in ObjectInputStream in JDK 1.3 through 1.5.
|
||||
// We use reflection in a doPrivileged block to get a
|
||||
// Method reference and make it accessible.
|
||||
private final Method latestUserDefinedLoaderMethod ;
|
||||
private final Unsafe unsafe ;
|
||||
/** Access to Unsafe to read/write fields. */
|
||||
private static final Unsafe unsafe = AccessController.doPrivileged(
|
||||
(PrivilegedAction<Unsafe>)() -> {
|
||||
try {
|
||||
Field field = Unsafe.class.getDeclaredField("theUnsafe");
|
||||
field.setAccessible(true);
|
||||
return (Unsafe)field.get(null);
|
||||
|
||||
} catch (NoSuchFieldException |IllegalAccessException ex) {
|
||||
throw new InternalError("Unsafe.theUnsafe field not available", ex);
|
||||
}
|
||||
}
|
||||
) ;
|
||||
|
||||
private final ReflectionFactory reflectionFactory ;
|
||||
|
||||
private Method getLatestUserDefinedLoaderMethod()
|
||||
{
|
||||
return (Method) AccessController.doPrivileged(
|
||||
new PrivilegedAction()
|
||||
{
|
||||
public Object run()
|
||||
{
|
||||
Method result = null;
|
||||
|
||||
try {
|
||||
Class io = ObjectInputStream.class;
|
||||
result = io.getDeclaredMethod(
|
||||
"latestUserDefinedLoader", NO_ARGS);
|
||||
result.setAccessible(true);
|
||||
} catch (NoSuchMethodException nsme) {
|
||||
Error err = new Error( "java.io.ObjectInputStream" +
|
||||
" latestUserDefinedLoader " + nsme );
|
||||
err.initCause(nsme) ;
|
||||
throw err ;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private Unsafe getUnsafe() {
|
||||
Field fld = (Field)AccessController.doPrivileged(
|
||||
new PrivilegedAction()
|
||||
{
|
||||
public Object run()
|
||||
{
|
||||
Field fld = null ;
|
||||
|
||||
try {
|
||||
Class unsafeClass = jdk.internal.misc.Unsafe.class ;
|
||||
fld = unsafeClass.getDeclaredField( "theUnsafe" ) ;
|
||||
fld.setAccessible( true ) ;
|
||||
return fld ;
|
||||
} catch (NoSuchFieldException exc) {
|
||||
Error err = new Error( "Could not access Unsafe" ) ;
|
||||
err.initCause( exc ) ;
|
||||
throw err ;
|
||||
}
|
||||
}
|
||||
}
|
||||
) ;
|
||||
|
||||
Unsafe unsafe = null;
|
||||
|
||||
try {
|
||||
unsafe = (Unsafe)(fld.get( null )) ;
|
||||
} catch (Throwable t) {
|
||||
Error err = new Error( "Could not access Unsafe" ) ;
|
||||
err.initCause( t ) ;
|
||||
throw err ;
|
||||
}
|
||||
|
||||
return unsafe ;
|
||||
}
|
||||
|
||||
|
||||
private Bridge()
|
||||
{
|
||||
latestUserDefinedLoaderMethod = getLatestUserDefinedLoaderMethod();
|
||||
unsafe = getUnsafe() ;
|
||||
reflectionFactory = (ReflectionFactory)AccessController.doPrivileged(
|
||||
new ReflectionFactory.GetReflectionFactoryAction());
|
||||
private Bridge() {
|
||||
reflectionFactory = ReflectionFactory.getReflectionFactory();
|
||||
}
|
||||
|
||||
/** Fetch the Bridge singleton. This requires the following
|
||||
@ -182,23 +121,8 @@ public final class Bridge
|
||||
/** Obtain the latest user defined ClassLoader from the call stack.
|
||||
* This is required by the RMI-IIOP specification.
|
||||
*/
|
||||
public final ClassLoader getLatestUserDefinedLoader()
|
||||
{
|
||||
try {
|
||||
// Invoke the ObjectInputStream.latestUserDefinedLoader method
|
||||
return (ClassLoader)latestUserDefinedLoaderMethod.invoke(null,
|
||||
(Object[])NO_ARGS);
|
||||
} catch (InvocationTargetException ite) {
|
||||
Error err = new Error(
|
||||
"sun.corba.Bridge.latestUserDefinedLoader: " + ite ) ;
|
||||
err.initCause( ite ) ;
|
||||
throw err ;
|
||||
} catch (IllegalAccessException iae) {
|
||||
Error err = new Error(
|
||||
"sun.corba.Bridge.latestUserDefinedLoader: " + iae ) ;
|
||||
err.initCause( iae ) ;
|
||||
throw err ;
|
||||
}
|
||||
public final ClassLoader getLatestUserDefinedLoader() {
|
||||
return jdk.internal.misc.VM.latestUserDefinedLoader();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -345,6 +269,23 @@ public final class Bridge
|
||||
return unsafe.objectFieldOffset( f ) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the offset of a static field.
|
||||
*/
|
||||
public final long staticFieldOffset(Field f)
|
||||
{
|
||||
return unsafe.staticFieldOffset( f ) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the class has been initalized.
|
||||
* @param cl the class to ensure is initialized
|
||||
*/
|
||||
public final void ensureClassInitialized(Class<?> cl) {
|
||||
unsafe.ensureClassInitialized(cl);
|
||||
}
|
||||
|
||||
|
||||
/** Throw the exception.
|
||||
* The exception may be an undeclared checked exception.
|
||||
*/
|
||||
@ -353,16 +294,55 @@ public final class Bridge
|
||||
unsafe.throwException( ee ) ;
|
||||
}
|
||||
|
||||
/** Obtain a constructor for Class cl using constructor cons which
|
||||
* may be the constructor defined in a superclass of cl. This is
|
||||
* used to create a constructor for Serializable classes that
|
||||
* constructs an instance of the Serializable class using the
|
||||
/**
|
||||
* Obtain a constructor for Class cl.
|
||||
* This is used to create a constructor for Serializable classes that
|
||||
* construct an instance of the Serializable class using the
|
||||
* no args constructor of the first non-Serializable superclass
|
||||
* of the Serializable class.
|
||||
*/
|
||||
public final Constructor newConstructorForSerialization( Class cl,
|
||||
Constructor cons )
|
||||
{
|
||||
return reflectionFactory.newConstructorForSerialization( cl, cons ) ;
|
||||
public final Constructor<?> newConstructorForSerialization( Class<?> cl ) {
|
||||
return reflectionFactory.newConstructorForSerialization( cl ) ;
|
||||
}
|
||||
|
||||
public final Constructor<?> newConstructorForExternalization(Class<?> cl) {
|
||||
return reflectionFactory.newConstructorForExternalization( cl ) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given class defines a static initializer method,
|
||||
* false otherwise.
|
||||
*/
|
||||
public final boolean hasStaticInitializerForSerialization(Class<?> cl) {
|
||||
return reflectionFactory.hasStaticInitializerForSerialization(cl);
|
||||
}
|
||||
|
||||
public final MethodHandle writeObjectForSerialization(Class<?> cl) {
|
||||
return reflectionFactory.writeObjectForSerialization(cl);
|
||||
}
|
||||
|
||||
public final MethodHandle readObjectForSerialization(Class<?> cl) {
|
||||
return reflectionFactory.readObjectForSerialization(cl);
|
||||
}
|
||||
|
||||
public final MethodHandle readObjectNoDataForSerialization(Class<?> cl) {
|
||||
return reflectionFactory.readObjectNoDataForSerialization(cl);
|
||||
}
|
||||
|
||||
public final MethodHandle readResolveForSerialization(Class<?> cl) {
|
||||
return reflectionFactory.readResolveForSerialization(cl);
|
||||
}
|
||||
|
||||
public final MethodHandle writeReplaceForSerialization(Class<?> cl) {
|
||||
return reflectionFactory.writeReplaceForSerialization(cl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new OptionalDataException instance.
|
||||
* @return a new OptionalDataException instance
|
||||
*/
|
||||
public final OptionalDataException newOptionalDataExceptionForSerialization(boolean bool) {
|
||||
return reflectionFactory.newOptionalDataExceptionForSerialization(bool);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,13 +25,13 @@
|
||||
|
||||
package sun.corba;
|
||||
|
||||
import com.sun.corba.se.impl.io.ValueUtility;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import com.sun.corba.se.impl.io.ValueUtility;
|
||||
import sun.misc.Unsafe;
|
||||
|
||||
/** A repository of "shared secrets", which are a mechanism for
|
||||
calling implementation-private methods in another package without
|
||||
using reflection. A package-private class implements a public
|
||||
@ -43,22 +43,22 @@ import java.security.PrivilegedAction;
|
||||
|
||||
// SharedSecrets cloned in corba repo to avoid build issues
|
||||
public class SharedSecrets {
|
||||
private static final Unsafe unsafe = getUnsafe();
|
||||
private static JavaCorbaAccess javaCorbaAccess;
|
||||
|
||||
private static Unsafe getUnsafe() {
|
||||
PrivilegedAction<Unsafe> pa = () -> {
|
||||
Class<?> unsafeClass = jdk.internal.misc.Unsafe.class ;
|
||||
try {
|
||||
Field f = unsafeClass.getDeclaredField("theUnsafe");
|
||||
f.setAccessible(true);
|
||||
return (Unsafe) f.get(null);
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
};
|
||||
return AccessController.doPrivileged(pa);
|
||||
}
|
||||
/** Access to Unsafe to read/write fields. */
|
||||
private static final Unsafe unsafe = AccessController.doPrivileged(
|
||||
(PrivilegedAction<Unsafe>)() -> {
|
||||
try {
|
||||
Field field = Unsafe.class.getDeclaredField("theUnsafe");
|
||||
field.setAccessible(true);
|
||||
return (Unsafe)field.get(null);
|
||||
|
||||
} catch (NoSuchFieldException |IllegalAccessException ex) {
|
||||
throw new InternalError("Unsafe.theUnsafe field not available", ex);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
private static JavaCorbaAccess javaCorbaAccess;
|
||||
|
||||
public static JavaCorbaAccess getJavaCorbaAccess() {
|
||||
if (javaCorbaAccess == null) {
|
||||
|
@ -542,3 +542,5 @@ a20da289f646ee44440695b81abc0548330e4ca7 jdk-9+136
|
||||
dfcbf839e299e7e2bba1da69bdb347617ea4c7e8 jdk-9+137
|
||||
fc0956308c7a586267c5dd35dff74f773aa9c3eb jdk-9+138
|
||||
08492e67bf3226784dab3bf9ae967382ddbc1af5 jdk-9+139
|
||||
fec31089c2ef5a12dd64f401b0bf2e00f56ee0d0 jdk-9+140
|
||||
160a00bc6ed0af1fdf8418fc65e6bddbbc0c536d jdk-9+141
|
||||
|
@ -1894,6 +1894,22 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
|
||||
__ beq(combined_check, slow);
|
||||
}
|
||||
|
||||
if (flags & LIR_OpArrayCopy::type_check) {
|
||||
if (!(flags & LIR_OpArrayCopy::LIR_OpArrayCopy::dst_objarray)) {
|
||||
__ load_klass(tmp, dst);
|
||||
__ lwz(tmp2, in_bytes(Klass::layout_helper_offset()), tmp);
|
||||
__ cmpwi(CCR0, tmp2, Klass::_lh_neutral_value);
|
||||
__ bge(CCR0, slow);
|
||||
}
|
||||
|
||||
if (!(flags & LIR_OpArrayCopy::LIR_OpArrayCopy::src_objarray)) {
|
||||
__ load_klass(tmp, src);
|
||||
__ lwz(tmp2, in_bytes(Klass::layout_helper_offset()), tmp);
|
||||
__ cmpwi(CCR0, tmp2, Klass::_lh_neutral_value);
|
||||
__ bge(CCR0, slow);
|
||||
}
|
||||
}
|
||||
|
||||
// Higher 32bits must be null.
|
||||
__ extsw(length, length);
|
||||
|
||||
|
@ -2034,6 +2034,27 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
|
||||
__ delayed()->nop();
|
||||
}
|
||||
|
||||
// If the compiler was not able to prove that exact type of the source or the destination
|
||||
// of the arraycopy is an array type, check at runtime if the source or the destination is
|
||||
// an instance type.
|
||||
if (flags & LIR_OpArrayCopy::type_check) {
|
||||
if (!(flags & LIR_OpArrayCopy::LIR_OpArrayCopy::dst_objarray)) {
|
||||
__ load_klass(dst, tmp);
|
||||
__ lduw(tmp, in_bytes(Klass::layout_helper_offset()), tmp2);
|
||||
__ cmp(tmp2, Klass::_lh_neutral_value);
|
||||
__ br(Assembler::greaterEqual, false, Assembler::pn, *stub->entry());
|
||||
__ delayed()->nop();
|
||||
}
|
||||
|
||||
if (!(flags & LIR_OpArrayCopy::LIR_OpArrayCopy::src_objarray)) {
|
||||
__ load_klass(src, tmp);
|
||||
__ lduw(tmp, in_bytes(Klass::layout_helper_offset()), tmp2);
|
||||
__ cmp(tmp2, Klass::_lh_neutral_value);
|
||||
__ br(Assembler::greaterEqual, false, Assembler::pn, *stub->entry());
|
||||
__ delayed()->nop();
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & LIR_OpArrayCopy::src_pos_positive_check) {
|
||||
// test src_pos register
|
||||
__ cmp_zero_and_br(Assembler::less, src_pos, *stub->entry());
|
||||
|
@ -3146,6 +3146,23 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
|
||||
__ jcc(Assembler::zero, *stub->entry());
|
||||
}
|
||||
|
||||
// If the compiler was not able to prove that exact type of the source or the destination
|
||||
// of the arraycopy is an array type, check at runtime if the source or the destination is
|
||||
// an instance type.
|
||||
if (flags & LIR_OpArrayCopy::type_check) {
|
||||
if (!(flags & LIR_OpArrayCopy::dst_objarray)) {
|
||||
__ load_klass(tmp, dst);
|
||||
__ cmpl(Address(tmp, in_bytes(Klass::layout_helper_offset())), Klass::_lh_neutral_value);
|
||||
__ jcc(Assembler::greaterEqual, *stub->entry());
|
||||
}
|
||||
|
||||
if (!(flags & LIR_OpArrayCopy::src_objarray)) {
|
||||
__ load_klass(tmp, src);
|
||||
__ cmpl(Address(tmp, in_bytes(Klass::layout_helper_offset())), Klass::_lh_neutral_value);
|
||||
__ jcc(Assembler::greaterEqual, *stub->entry());
|
||||
}
|
||||
}
|
||||
|
||||
// check if negative
|
||||
if (flags & LIR_OpArrayCopy::src_pos_positive_check) {
|
||||
__ testl(src_pos, src_pos);
|
||||
|
@ -5869,6 +5869,11 @@ void ClassFileParser::post_process_parsed_stream(const ClassFileStream* const st
|
||||
assert(cp != NULL, "invariant");
|
||||
assert(_loader_data != NULL, "invariant");
|
||||
|
||||
if (_class_name == vmSymbols::java_lang_Object()) {
|
||||
check_property(_local_interfaces == Universe::the_empty_klass_array(),
|
||||
"java.lang.Object cannot implement an interface in class file %s",
|
||||
CHECK);
|
||||
}
|
||||
// We check super class after class file is parsed and format is checked
|
||||
if (_super_class_index > 0 && NULL ==_super_klass) {
|
||||
Symbol* const super_class_name = cp->klass_name_at(_super_class_index);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2012, 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
|
||||
@ -203,6 +203,7 @@ class stack_map_frame {
|
||||
inline bool verify(address start, address end) const;
|
||||
|
||||
inline void print_on(outputStream* st, int current_offset) const;
|
||||
inline void print_truncated(outputStream* st, int current_offset) const;
|
||||
|
||||
// Create as_xxx and is_xxx methods for the subtypes
|
||||
#define FRAME_TYPE_DECL(stackmap_frame_type, arg1, arg2) \
|
||||
@ -263,6 +264,10 @@ class same_frame : public stack_map_frame {
|
||||
void print_on(outputStream* st, int current_offset = -1) const {
|
||||
st->print("same_frame(@%d)", offset_delta() + current_offset);
|
||||
}
|
||||
|
||||
void print_truncated(outputStream* st, int current_offset = -1) const {
|
||||
print_on(st, current_offset);
|
||||
}
|
||||
};
|
||||
|
||||
class same_frame_extended : public stack_map_frame {
|
||||
@ -309,6 +314,10 @@ class same_frame_extended : public stack_map_frame {
|
||||
void print_on(outputStream* st, int current_offset = -1) const {
|
||||
st->print("same_frame_extended(@%d)", offset_delta() + current_offset);
|
||||
}
|
||||
|
||||
void print_truncated(outputStream* st, int current_offset = -1) const {
|
||||
print_on(st, current_offset);
|
||||
}
|
||||
};
|
||||
|
||||
class same_locals_1_stack_item_frame : public stack_map_frame {
|
||||
@ -381,6 +390,11 @@ class same_locals_1_stack_item_frame : public stack_map_frame {
|
||||
types()->print_on(st);
|
||||
st->print(")");
|
||||
}
|
||||
|
||||
void print_truncated(outputStream* st, int current_offset = -1) const {
|
||||
st->print("same_locals_1_stack_item_frame(@%d), output truncated, Stackmap exceeds table size.",
|
||||
offset_delta() + current_offset);
|
||||
}
|
||||
};
|
||||
|
||||
class same_locals_1_stack_item_extended : public stack_map_frame {
|
||||
@ -446,6 +460,11 @@ class same_locals_1_stack_item_extended : public stack_map_frame {
|
||||
types()->print_on(st);
|
||||
st->print(")");
|
||||
}
|
||||
|
||||
void print_truncated(outputStream* st, int current_offset = -1) const {
|
||||
st->print("same_locals_1_stack_item_extended(@%d), output truncated, Stackmap exceeds table size.",
|
||||
offset_delta() + current_offset);
|
||||
}
|
||||
};
|
||||
|
||||
class chop_frame : public stack_map_frame {
|
||||
@ -511,6 +530,10 @@ class chop_frame : public stack_map_frame {
|
||||
void print_on(outputStream* st, int current_offset = -1) const {
|
||||
st->print("chop_frame(@%d,%d)", offset_delta() + current_offset, chops());
|
||||
}
|
||||
|
||||
void print_truncated(outputStream* st, int current_offset = -1) const {
|
||||
print_on(st, current_offset);
|
||||
}
|
||||
};
|
||||
|
||||
class append_frame : public stack_map_frame {
|
||||
@ -619,6 +642,11 @@ class append_frame : public stack_map_frame {
|
||||
}
|
||||
st->print(")");
|
||||
}
|
||||
|
||||
void print_truncated(outputStream* st, int current_offset = -1) const {
|
||||
st->print("append_frame(@%d), output truncated, Stackmap exceeds table size.",
|
||||
offset_delta() + current_offset);
|
||||
}
|
||||
};
|
||||
|
||||
class full_frame : public stack_map_frame {
|
||||
@ -784,6 +812,11 @@ class full_frame : public stack_map_frame {
|
||||
}
|
||||
st->print("})");
|
||||
}
|
||||
|
||||
void print_truncated(outputStream* st, int current_offset = -1) const {
|
||||
st->print("full_frame(@%d), output truncated, Stackmap exceeds table size.",
|
||||
offset_delta() + current_offset);
|
||||
}
|
||||
};
|
||||
|
||||
#define VIRTUAL_DISPATCH(stack_frame_type, func_name, args) \
|
||||
@ -841,6 +874,10 @@ void stack_map_frame::print_on(outputStream* st, int offs = -1) const {
|
||||
FOR_EACH_STACKMAP_FRAME_TYPE(VOID_VIRTUAL_DISPATCH, print_on, (st, offs));
|
||||
}
|
||||
|
||||
void stack_map_frame::print_truncated(outputStream* st, int offs = -1) const {
|
||||
FOR_EACH_STACKMAP_FRAME_TYPE(VOID_VIRTUAL_DISPATCH, print_truncated, (st, offs));
|
||||
}
|
||||
|
||||
#undef VIRTUAL_DISPATCH
|
||||
#undef VOID_VIRTUAL_DISPATCH
|
||||
|
||||
|
@ -541,8 +541,19 @@ void ErrorContext::stackmap_details(outputStream* ss, const Method* method) cons
|
||||
stack_map_frame* sm_frame = sm_table->entries();
|
||||
streamIndentor si2(ss);
|
||||
int current_offset = -1;
|
||||
// Subtract two from StackMapAttribute length because the length includes
|
||||
// two bytes for number of table entries.
|
||||
size_t sm_table_space = method->stackmap_data()->length() - 2;
|
||||
for (u2 i = 0; i < sm_table->number_of_entries(); ++i) {
|
||||
ss->indent();
|
||||
size_t sm_frame_size = sm_frame->size();
|
||||
// If the size of the next stackmap exceeds the length of the entire
|
||||
// stackmap table then print a truncated message and return.
|
||||
if (sm_frame_size > sm_table_space) {
|
||||
sm_frame->print_truncated(ss, current_offset);
|
||||
return;
|
||||
}
|
||||
sm_table_space -= sm_frame_size;
|
||||
sm_frame->print_on(ss, current_offset);
|
||||
ss->cr();
|
||||
current_offset += sm_frame->offset_delta();
|
||||
|
@ -2524,7 +2524,6 @@ JVM_ENTRY(const char*, JVM_GetCPMethodNameUTF(JNIEnv *env, jclass cls, jint cp_i
|
||||
switch (cp->tag_at(cp_index).value()) {
|
||||
case JVM_CONSTANT_InterfaceMethodref:
|
||||
case JVM_CONSTANT_Methodref:
|
||||
case JVM_CONSTANT_NameAndType: // for invokedynamic
|
||||
return cp->uncached_name_ref_at(cp_index)->as_utf8();
|
||||
default:
|
||||
fatal("JVM_GetCPMethodNameUTF: illegal constant");
|
||||
@ -2542,7 +2541,6 @@ JVM_ENTRY(const char*, JVM_GetCPMethodSignatureUTF(JNIEnv *env, jclass cls, jint
|
||||
switch (cp->tag_at(cp_index).value()) {
|
||||
case JVM_CONSTANT_InterfaceMethodref:
|
||||
case JVM_CONSTANT_Methodref:
|
||||
case JVM_CONSTANT_NameAndType: // for invokedynamic
|
||||
return cp->uncached_signature_ref_at(cp_index)->as_utf8();
|
||||
default:
|
||||
fatal("JVM_GetCPMethodSignatureUTF: illegal constant");
|
||||
|
@ -416,6 +416,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() },
|
||||
@ -793,9 +795,10 @@ static bool append_to_string_flag(const char* name, const char* new_value, Flag:
|
||||
} else if (new_len == 0) {
|
||||
value = old_value;
|
||||
} else {
|
||||
char* buf = NEW_C_HEAP_ARRAY(char, old_len + 1 + new_len + 1, mtArguments);
|
||||
size_t length = old_len + 1 + new_len + 1;
|
||||
char* buf = NEW_C_HEAP_ARRAY(char, length, mtArguments);
|
||||
// each new setting adds another LINE to the switch:
|
||||
sprintf(buf, "%s\n%s", old_value, new_value);
|
||||
jio_snprintf(buf, length, "%s\n%s", old_value, new_value);
|
||||
value = buf;
|
||||
free_this_too = buf;
|
||||
}
|
||||
@ -1013,15 +1016,17 @@ const char* Arguments::build_resource_string(char** args, int count) {
|
||||
if (args == NULL || count == 0) {
|
||||
return NULL;
|
||||
}
|
||||
size_t length = strlen(args[0]) + 1; // add 1 for the null terminator
|
||||
for (int i = 1; i < count; i++) {
|
||||
length += strlen(args[i]) + 1; // add 1 for a space
|
||||
size_t length = 0;
|
||||
for (int i = 0; i < count; i++) {
|
||||
length += strlen(args[i]) + 1; // add 1 for a space or NULL terminating character
|
||||
}
|
||||
char* s = NEW_RESOURCE_ARRAY(char, length);
|
||||
strcpy(s, args[0]);
|
||||
for (int j = 1; j < count; j++) {
|
||||
strcat(s, " ");
|
||||
strcat(s, args[j]);
|
||||
char* dst = s;
|
||||
for (int j = 0; j < count; j++) {
|
||||
size_t offset = strlen(args[j]) + 1; // add 1 for a space or NULL terminating character
|
||||
jio_snprintf(dst, length, "%s ", args[j]); // jio_snprintf will replace the last space character with NULL character
|
||||
dst += offset;
|
||||
length -= offset;
|
||||
}
|
||||
return (const char*) s;
|
||||
}
|
||||
@ -1105,9 +1110,8 @@ bool Arguments::process_argument(const char* arg,
|
||||
// Only make the obsolete check for valid arguments.
|
||||
if (arg_len <= BUFLEN) {
|
||||
// Construct a string which consists only of the argument name without '+', '-', or '='.
|
||||
char stripped_argname[BUFLEN+1];
|
||||
strncpy(stripped_argname, argname, arg_len);
|
||||
stripped_argname[arg_len] = '\0'; // strncpy may not null terminate.
|
||||
char stripped_argname[BUFLEN+1]; // +1 for '\0'
|
||||
jio_snprintf(stripped_argname, arg_len+1, "%s", argname); // +1 for '\0'
|
||||
if (is_obsolete_flag(stripped_argname, &since)) {
|
||||
char version[256];
|
||||
since.to_string(version, sizeof(version));
|
||||
@ -1259,8 +1263,7 @@ bool Arguments::add_property(const char* prop, PropertyWriteable writeable, Prop
|
||||
size_t key_len = eq - prop;
|
||||
char* tmp_key = AllocateHeap(key_len + 1, mtArguments);
|
||||
|
||||
strncpy(tmp_key, prop, key_len);
|
||||
tmp_key[key_len] = '\0';
|
||||
jio_snprintf(tmp_key, key_len + 1, "%s", prop);
|
||||
key = tmp_key;
|
||||
|
||||
value = &prop[key_len + 1];
|
||||
@ -2260,7 +2263,7 @@ jint Arguments::set_aggressive_opts_flags() {
|
||||
|
||||
// Feed the cache size setting into the JDK
|
||||
char buffer[1024];
|
||||
sprintf(buffer, "java.lang.Integer.IntegerCache.high=" INTX_FORMAT, AutoBoxCacheMax);
|
||||
jio_snprintf(buffer, 1024, "java.lang.Integer.IntegerCache.high=" INTX_FORMAT, AutoBoxCacheMax);
|
||||
if (!add_property(buffer)) {
|
||||
return JNI_ENOMEM;
|
||||
}
|
||||
@ -2781,8 +2784,8 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
|
||||
if (tail != NULL) {
|
||||
const char* pos = strchr(tail, ':');
|
||||
size_t len = (pos == NULL) ? strlen(tail) : pos - tail;
|
||||
char* name = (char*)memcpy(NEW_C_HEAP_ARRAY(char, len + 1, mtArguments), tail, len);
|
||||
name[len] = '\0';
|
||||
char* name = NEW_C_HEAP_ARRAY(char, len + 1, mtArguments);
|
||||
jio_snprintf(name, len + 1, "%s", tail);
|
||||
|
||||
char *options = NULL;
|
||||
if(pos != NULL) {
|
||||
@ -2858,7 +2861,9 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
|
||||
return JNI_ERR;
|
||||
#else
|
||||
if (tail != NULL) {
|
||||
char *options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(tail) + 1, mtArguments), tail);
|
||||
size_t length = strlen(tail) + 1;
|
||||
char *options = NEW_C_HEAP_ARRAY(char, length, mtArguments);
|
||||
jio_snprintf(options, length, "%s", tail);
|
||||
add_init_agent("instrument", options, false);
|
||||
// java agents need module java.instrument
|
||||
if (!create_numbered_property("jdk.module.addmods", "java.instrument", addmods_count++)) {
|
||||
@ -3518,7 +3523,7 @@ jint Arguments::finalize_vm_init_args() {
|
||||
// check if the default lib/endorsed directory exists; if so, error
|
||||
char path[JVM_MAXPATHLEN];
|
||||
const char* fileSep = os::file_separator();
|
||||
sprintf(path, "%s%slib%sendorsed", Arguments::get_java_home(), fileSep, fileSep);
|
||||
jio_snprintf(path, JVM_MAXPATHLEN, "%s%slib%sendorsed", Arguments::get_java_home(), fileSep, fileSep);
|
||||
|
||||
if (CheckEndorsedAndExtDirs) {
|
||||
int nonEmptyDirs = 0;
|
||||
@ -3540,7 +3545,7 @@ jint Arguments::finalize_vm_init_args() {
|
||||
return JNI_ERR;
|
||||
}
|
||||
|
||||
sprintf(path, "%s%slib%sext", Arguments::get_java_home(), fileSep, fileSep);
|
||||
jio_snprintf(path, JVM_MAXPATHLEN, "%s%slib%sext", Arguments::get_java_home(), fileSep, fileSep);
|
||||
dir = os::opendir(path);
|
||||
if (dir != NULL) {
|
||||
jio_fprintf(defaultStream::output_stream(),
|
||||
@ -3905,6 +3910,13 @@ jint Arguments::parse_options_buffer(const char* name, char* buffer, const size_
|
||||
|
||||
void Arguments::set_shared_spaces_flags() {
|
||||
if (DumpSharedSpaces) {
|
||||
if (FailOverToOldVerifier) {
|
||||
// Don't fall back to the old verifier on verification failure. If a
|
||||
// class fails verification with the split verifier, it might fail the
|
||||
// CDS runtime verifier constraint check. In that case, we don't want
|
||||
// to share the class. We only archive classes that pass the split verifier.
|
||||
FLAG_SET_DEFAULT(FailOverToOldVerifier, false);
|
||||
}
|
||||
|
||||
if (RequireSharedSpaces) {
|
||||
warning("Cannot dump shared archive while using shared archive");
|
||||
|
@ -2881,8 +2881,6 @@ VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver,
|
||||
char *s = sig->as_C_string();
|
||||
int len = (int)strlen(s);
|
||||
s++; len--; // Skip opening paren
|
||||
char *t = s+len;
|
||||
while (*(--t) != ')'); // Find close paren
|
||||
|
||||
BasicType *sig_bt = NEW_RESOURCE_ARRAY(BasicType, 256);
|
||||
VMRegPair *regs = NEW_RESOURCE_ARRAY(VMRegPair, 256);
|
||||
@ -2891,7 +2889,7 @@ VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver,
|
||||
sig_bt[cnt++] = T_OBJECT; // Receiver is argument 0; not in signature
|
||||
}
|
||||
|
||||
while (s < t) {
|
||||
while (*s != ')') { // Find closing right paren
|
||||
switch (*s++) { // Switch on signature character
|
||||
case 'B': sig_bt[cnt++] = T_BYTE; break;
|
||||
case 'C': sig_bt[cnt++] = T_CHAR; break;
|
||||
|
@ -224,7 +224,49 @@ void SignatureIterator::iterate_returntype() {
|
||||
_index = 0;
|
||||
expect('(');
|
||||
Symbol* sig = _signature;
|
||||
while (sig->byte_at(_index) != ')') _index++;
|
||||
// Need to skip over each type in the signature's argument list until a
|
||||
// closing ')' is found., then get the return type. We cannot just scan
|
||||
// for the first ')' because ')' is a legal character in a type name.
|
||||
while (sig->byte_at(_index) != ')') {
|
||||
switch(sig->byte_at(_index)) {
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'D':
|
||||
case 'F':
|
||||
case 'I':
|
||||
case 'J':
|
||||
case 'S':
|
||||
case 'Z':
|
||||
case 'V':
|
||||
{
|
||||
_index++;
|
||||
}
|
||||
break;
|
||||
case 'L':
|
||||
{
|
||||
while (sig->byte_at(_index++) != ';') ;
|
||||
}
|
||||
break;
|
||||
case '[':
|
||||
{
|
||||
int begin = ++_index;
|
||||
skip_optional_size();
|
||||
while (sig->byte_at(_index) == '[') {
|
||||
_index++;
|
||||
skip_optional_size();
|
||||
}
|
||||
if (sig->byte_at(_index) == 'L') {
|
||||
while (sig->byte_at(_index++) != ';') ;
|
||||
} else {
|
||||
_index++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ShouldNotReachHere();
|
||||
break;
|
||||
}
|
||||
}
|
||||
expect(')');
|
||||
// Parse return type
|
||||
_parameter_index = -1;
|
||||
|
64
hotspot/test/compiler/c1/TestArrayCopyToFromObject.java
Normal file
64
hotspot/test/compiler/c1/TestArrayCopyToFromObject.java
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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 8160591
|
||||
* @summary C1-generated code for System.arraycopy() does not throw an ArrayStoreException if 'dst' is no a "proper" array (i.e., it is java.lang.Object)
|
||||
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xcomp -XX:-UseCompressedClassPointers -XX:CompileOnly=TestArrayCopyToFromObject.test TestArrayCopyToFromObject
|
||||
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xcomp -XX:+UseCompressedClassPointers -XX:CompileOnly=TestArrayCopyToFromObject.test TestArrayCopyToFromObject
|
||||
*/
|
||||
public class TestArrayCopyToFromObject {
|
||||
|
||||
public void test(Object aArray[]) {
|
||||
Object a = new Object();
|
||||
|
||||
try {
|
||||
System.arraycopy(aArray, 0, a, 0, 1);
|
||||
throw new RuntimeException ("FAILED: Expected ArrayStoreException " +
|
||||
"(due to destination not being an array) " +
|
||||
"was not thrown");
|
||||
} catch (ArrayStoreException e) {
|
||||
System.out.println("PASSED: Expected ArrayStoreException was thrown");
|
||||
}
|
||||
|
||||
try {
|
||||
System.arraycopy(a, 0, aArray, 0, 1);
|
||||
throw new RuntimeException ("FAILED: Expected ArrayStoreException " +
|
||||
"(due to source not being an array) " +
|
||||
"was not thrown");
|
||||
} catch (ArrayStoreException e) {
|
||||
System.out.println("PASSED: Expected ArrayStoreException was thrown");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
System.out.println("TestArrayCopyToFromObject");
|
||||
Object aArray[] = new Object[10];
|
||||
for (int i = 0; i < 10; i++) {
|
||||
aArray[i] = new Object();
|
||||
}
|
||||
new TestArrayCopyToFromObject().test(aArray);
|
||||
}
|
||||
}
|
51
hotspot/test/runtime/CommandLine/PermGenFlagsTest.java
Normal file
51
hotspot/test/runtime/CommandLine/PermGenFlagsTest.java
Normal 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);
|
||||
}
|
||||
}
|
@ -382,3 +382,5 @@ f1eafcb0eb7182b937bc93f214d8cabd01ec4d59 jdk-9+136
|
||||
a8d5fe567ae72b4931040e59dd4478363f9004f5 jdk-9+137
|
||||
69c3b12ba75b2e321dee731ac545e7fbff608451 jdk-9+138
|
||||
8991d71c5316bde259e6a417c1199b008ca3cdf0 jdk-9+139
|
||||
8d100cb9b04819b5bd09f33c7fd5b8628d1a456f jdk-9+140
|
||||
037c095ba0c345edbeaaab52fda913a76c3930c0 jdk-9+141
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -31,6 +31,7 @@ import com.sun.org.apache.bcel.internal.generic.GETFIELD;
|
||||
import com.sun.org.apache.bcel.internal.generic.GETSTATIC;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESPECIAL;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
|
||||
import com.sun.org.apache.bcel.internal.generic.ISTORE;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionHandle;
|
||||
@ -1252,6 +1253,10 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
classGen.getConstantPool());
|
||||
transf.addException("com.sun.org.apache.xalan.internal.xsltc.TransletException");
|
||||
|
||||
// call resetPrefixIndex at the beginning of transform
|
||||
final int check = cpg.addMethodref(BASIS_LIBRARY_CLASS, "resetPrefixIndex", "()V");
|
||||
il.append(new INVOKESTATIC(check));
|
||||
|
||||
// Define and initialize current with the root node
|
||||
final LocalVariableGen current =
|
||||
transf.addLocalVariable("current",
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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
|
||||
|
@ -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";
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -31,6 +31,7 @@ import java.text.MessageFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.xsltc.DOM;
|
||||
@ -1533,16 +1534,25 @@ public final class BasisLibrary {
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used in the execution of xsl:element
|
||||
* These functions are used in the execution of xsl:element to generate
|
||||
* and reset namespace prefix index local to current transformation process
|
||||
*/
|
||||
private static int prefixIndex = 0;
|
||||
|
||||
public static String generatePrefix() {
|
||||
synchronized (BasisLibrary.class) {
|
||||
return ("ns" + prefixIndex++);
|
||||
}
|
||||
return ("ns" + threadLocalPrefixIndex.get().getAndIncrement());
|
||||
}
|
||||
|
||||
public static void resetPrefixIndex() {
|
||||
threadLocalPrefixIndex.get().set(0);
|
||||
}
|
||||
|
||||
private static final ThreadLocal<AtomicInteger> threadLocalPrefixIndex =
|
||||
new ThreadLocal<AtomicInteger>() {
|
||||
@Override
|
||||
protected AtomicInteger initialValue() {
|
||||
return new AtomicInteger();
|
||||
}
|
||||
};
|
||||
|
||||
public static final String RUN_TIME_INTERNAL_ERR =
|
||||
"RUN_TIME_INTERNAL_ERR";
|
||||
public static final String RUN_TIME_COPY_ERR =
|
||||
|
@ -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
|
||||
|
@ -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";
|
||||
}
|
||||
|
@ -0,0 +1,193 @@
|
||||
/*
|
||||
* 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 java.io.StringWriter;
|
||||
import java.util.concurrent.CyclicBarrier;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.Templates;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8167179
|
||||
* @library /javax/xml/jaxp/libs
|
||||
* @run testng/othervm -DrunSecMngr=true transform.NamespacePrefixTest
|
||||
* @run testng/othervm transform.NamespacePrefixTest
|
||||
* @summary This class tests the generation of namespace prefixes
|
||||
*/
|
||||
public class NamespacePrefixTest {
|
||||
|
||||
@Test
|
||||
public void testReuseTemplates() throws Exception {
|
||||
final TransformerFactory tf = TransformerFactory.newInstance();
|
||||
final Source xslsrc = new StreamSource(new StringReader(XSL));
|
||||
final Templates tmpl = tf.newTemplates(xslsrc);
|
||||
for (int i = 0; i < TRANSF_COUNT; i++) {
|
||||
checkResult(doTransformation(tmpl.newTransformer()));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReuseTransformer() throws Exception {
|
||||
final TransformerFactory tf = TransformerFactory.newInstance();
|
||||
final Source xslsrc = new StreamSource(new StringReader(XSL));
|
||||
final Transformer t = tf.newTransformer(xslsrc);
|
||||
for (int i = 0; i < TRANSF_COUNT; i++) {
|
||||
checkResult(doTransformation(t));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConcurrentTransformations() throws Exception {
|
||||
final TransformerFactory tf = TransformerFactory.newInstance();
|
||||
final Source xslsrc = new StreamSource(new StringReader(XSL));
|
||||
final Templates tmpl = tf.newTemplates(xslsrc);
|
||||
concurrentTestPassed.set(true);
|
||||
|
||||
// Execute multiple TestWorker tasks
|
||||
for (int id = 0; id < THREADS_COUNT; id++) {
|
||||
EXECUTOR.execute(new TransformerThread(tmpl.newTransformer(), id));
|
||||
}
|
||||
// Initiate shutdown of previously submitted task
|
||||
runWithAllPerm(EXECUTOR::shutdown);
|
||||
// Wait for termination of submitted tasks
|
||||
if (!EXECUTOR.awaitTermination(THREADS_COUNT, TimeUnit.SECONDS)) {
|
||||
// If not all tasks terminates during the time out force them to shutdown
|
||||
runWithAllPerm(EXECUTOR::shutdownNow);
|
||||
}
|
||||
// Check if all transformation threads generated the correct namespace prefix
|
||||
assertTrue(concurrentTestPassed.get());
|
||||
}
|
||||
|
||||
// Do one transformation with the provided transformer
|
||||
private static String doTransformation(Transformer t) throws Exception {
|
||||
StringWriter resWriter = new StringWriter();
|
||||
Source xmlSrc = new StreamSource(new StringReader(XML));
|
||||
t.transform(xmlSrc, new StreamResult(resWriter));
|
||||
return resWriter.toString();
|
||||
}
|
||||
|
||||
// Check if the transformation result string contains the
|
||||
// element with the exact namespace prefix generated.
|
||||
private static void checkResult(String result) {
|
||||
// Check prefix of 'Element2' element, it should always be the same
|
||||
assertTrue(result.contains(EXPECTED_CONTENT));
|
||||
}
|
||||
|
||||
// Check if the transformation result string contains the element with
|
||||
// the exact namespace prefix generated by current thread.
|
||||
// If the expected prefix is not found and there was no failures observed by
|
||||
// other test threads then mark concurrent test as failed.
|
||||
private static void checkThreadResult(String result, int id) {
|
||||
boolean res = result.contains(EXPECTED_CONTENT);
|
||||
System.out.printf("%d: transformation result: %s%n", id, res ? "Pass" : "Fail");
|
||||
if (!res) {
|
||||
System.out.printf("%d result:%s%n", id, result);
|
||||
}
|
||||
concurrentTestPassed.compareAndSet(true, res);
|
||||
}
|
||||
|
||||
// TransformerThread task that does the transformation similar
|
||||
// to testReuseTransformer test method
|
||||
private class TransformerThread implements Runnable {
|
||||
|
||||
private final Transformer transformer;
|
||||
private final int id;
|
||||
|
||||
TransformerThread(Transformer transformer, int id) {
|
||||
this.transformer = transformer;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
System.out.printf("%d: waiting for barrier%n", id);
|
||||
//Synchronize startup of all tasks
|
||||
BARRIER.await();
|
||||
System.out.printf("%d: starting transformation%n", id);
|
||||
checkThreadResult(doTransformation(transformer), id);
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException("TransformerThread " + id + " failed", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Number of subsequent transformations
|
||||
private static final int TRANSF_COUNT = 10;
|
||||
|
||||
// Number of transformer threads running concurently
|
||||
private static final int THREADS_COUNT = 10;
|
||||
|
||||
// Variable for storing the concurrent transformation test result. It is
|
||||
// updated by transformer threads
|
||||
private static final AtomicBoolean concurrentTestPassed = new AtomicBoolean(true);
|
||||
|
||||
// Cyclic barrier for threads startup synchronization
|
||||
private static final CyclicBarrier BARRIER = new CyclicBarrier(THREADS_COUNT);
|
||||
|
||||
// Thread pool
|
||||
private static final ExecutorService EXECUTOR = Executors.newCachedThreadPool();
|
||||
|
||||
// XSL that transforms XML and produces unique namespace prefixes for each element
|
||||
private final static String XSL = "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n"
|
||||
+ " <xsl:template match=\"node()|@*\" priority=\"1\">\n"
|
||||
+ " <xsl:copy>\n"
|
||||
+ " <xsl:apply-templates select=\"node()|@*\"/>\n"
|
||||
+ " </xsl:copy>\n"
|
||||
+ " </xsl:template>\n"
|
||||
+ " <xsl:template match=\"*\" priority=\"2\">\n"
|
||||
+ " <xsl:element name=\"{name()}\" namespace=\"{namespace-uri()}\">\n"
|
||||
+ " <xsl:apply-templates select=\"node()|@*\"/>\n"
|
||||
+ " </xsl:element>\n"
|
||||
+ " </xsl:template>\n"
|
||||
+ "</xsl:stylesheet>";
|
||||
|
||||
// Simple XML content with root and two child elements
|
||||
private final static String XML = "<TestRoot xmlns=\"test.xmlns\">\n"
|
||||
+ " <Element1 xmlns=\"test.xmlns\">\n"
|
||||
+ " </Element1>\n"
|
||||
+ " <Element2 xmlns=\"test.xmlns\">\n"
|
||||
+ " </Element2>\n"
|
||||
+ "</TestRoot>";
|
||||
|
||||
// With thread local namespace prefix index each transformation result should
|
||||
// be the same and contain the same prefix for Element2
|
||||
private final static String EXPECTED_CONTENT = "</ns2:Element2>";
|
||||
|
||||
}
|
@ -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 {
|
||||
|
149
jaxp/test/javax/xml/jaxp/unittest/transform/StylesheetTest.java
Normal file
149
jaxp/test/javax/xml/jaxp/unittest/transform/StylesheetTest.java
Normal 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"}
|
||||
};
|
||||
}
|
||||
}
|
21
jaxp/test/javax/xml/jaxp/unittest/transform/XSLImport.xsl
Normal file
21
jaxp/test/javax/xml/jaxp/unittest/transform/XSLImport.xsl
Normal 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>
|
@ -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>
|
@ -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>
|
@ -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>
|
@ -385,3 +385,5 @@ ab1d78d395d4cb8be426ff181211da1a4085cf01 jdk-9+134
|
||||
297c16d401c534cb879809d2a746d21ca99d2954 jdk-9+137
|
||||
7d3a8f52b124db26ba8425c2931b748dd9d2791b jdk-9+138
|
||||
7a7aadf3c4500cc273c889aa1172d4fe3844bb6b jdk-9+139
|
||||
9004617323fe99cbe4fad48f373cb2ed4fc50aa6 jdk-9+140
|
||||
b2c18f755228d1d19a86cd7d5fa1abb6b1495dfb jdk-9+141
|
||||
|
@ -382,3 +382,5 @@ d5c70818cd8a82e76632c8c815bdb4f75f53aeaf jdk-9+132
|
||||
e72df94364e3686e7d62059ce0d6b187b82da713 jdk-9+137
|
||||
665096863382bf23ce891307cf2a7511e77c1c88 jdk-9+138
|
||||
5518ac2f2ead5e594bd983f2047178136aafdfd0 jdk-9+139
|
||||
e93b7ea559759f036c9f69fd2ddaf47bb4e98385 jdk-9+140
|
||||
8d752af5f61d41f226adf2cda72a20faa9ad620a jdk-9+141
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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, \
|
||||
|
@ -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
|
||||
|
@ -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 \
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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
|
||||
@ -1413,27 +1413,7 @@ public class ObjectStreamClass implements Serializable {
|
||||
* returned constructor (if any).
|
||||
*/
|
||||
private static Constructor<?> getSerializableConstructor(Class<?> cl) {
|
||||
Class<?> initCl = cl;
|
||||
while (Serializable.class.isAssignableFrom(initCl)) {
|
||||
if ((initCl = initCl.getSuperclass()) == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
try {
|
||||
Constructor<?> cons = initCl.getDeclaredConstructor((Class<?>[]) null);
|
||||
int mods = cons.getModifiers();
|
||||
if ((mods & Modifier.PRIVATE) != 0 ||
|
||||
((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 &&
|
||||
!packageEquals(cl, initCl)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
cons = reflFactory.newConstructorForSerialization(cl, cons);
|
||||
cons.setAccessible(true);
|
||||
return cons;
|
||||
} catch (NoSuchMethodException ex) {
|
||||
return null;
|
||||
}
|
||||
return reflFactory.newConstructorForSerialization(cl);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -557,7 +557,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
if (newInstanceCallerCache != caller) {
|
||||
int modifiers = tmpConstructor.getModifiers();
|
||||
Reflection.ensureMemberAccess(caller, this, null, modifiers);
|
||||
Reflection.ensureMemberAccess(caller, this, this, modifiers);
|
||||
newInstanceCallerCache = caller;
|
||||
}
|
||||
// Run constructor
|
||||
|
@ -79,7 +79,7 @@ public @interface Deprecated {
|
||||
/**
|
||||
* Returns the version in which the annotated element became deprecated.
|
||||
* The version string is in the same format and namespace as the value of
|
||||
* the {@code @since} javadoc tag. The default value is the empty
|
||||
* the {@code @since} javadoc tag. The default value is the empty
|
||||
* string.
|
||||
*
|
||||
* @return the version string
|
||||
|
@ -504,11 +504,12 @@ class Thread implements Runnable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Thread that inherits the given AccessControlContext.
|
||||
* Creates a new Thread that inherits the given AccessControlContext
|
||||
* but thread-local variables are not inherited.
|
||||
* This is not a public constructor.
|
||||
*/
|
||||
Thread(Runnable target, AccessControlContext acc) {
|
||||
init(null, target, "Thread-" + nextThreadNum(), 0, acc, true);
|
||||
init(null, target, "Thread-" + nextThreadNum(), 0, acc, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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<>();
|
||||
|
@ -44,6 +44,8 @@ import java.util.function.Supplier;
|
||||
import jdk.internal.jimage.ImageLocation;
|
||||
import jdk.internal.jimage.ImageReader;
|
||||
import jdk.internal.jimage.ImageReaderFactory;
|
||||
import jdk.internal.misc.JavaNetUriAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.module.ModuleHashes;
|
||||
import jdk.internal.module.ModuleHashes.HashSupplier;
|
||||
import jdk.internal.module.SystemModules;
|
||||
@ -71,6 +73,8 @@ class SystemModuleFinder implements ModuleFinder {
|
||||
// ImageReader used to access all modules in the image
|
||||
private static final ImageReader imageReader;
|
||||
|
||||
private static final JavaNetUriAccess jnua = SharedSecrets.getJavaNetUriAccess();
|
||||
|
||||
// the set of modules in the run-time image
|
||||
private static final Set<ModuleReference> modules;
|
||||
|
||||
@ -166,7 +170,8 @@ class SystemModuleFinder implements ModuleFinder {
|
||||
HashSupplier hash)
|
||||
{
|
||||
String mn = md.name();
|
||||
URI uri = URI.create("jrt:/" + mn);
|
||||
|
||||
URI uri = jnua.create("jrt", "/".concat(mn));
|
||||
|
||||
Supplier<ModuleReader> readerSupplier = new Supplier<>() {
|
||||
@Override
|
||||
|
@ -312,22 +312,22 @@ public class AccessibleObject implements AnnotatedElement {
|
||||
// (See also Class.newInstance(), which uses a similar method.)
|
||||
//
|
||||
// A more complicated security check cache is needed for Method and Field
|
||||
// The cache can be either null (empty cache), a 2-array of {caller,target},
|
||||
// or a caller (with target implicitly equal to this.clazz).
|
||||
// In the 2-array case, the target is always different from the clazz.
|
||||
// The cache can be either null (empty cache), a 2-array of {caller,targetClass},
|
||||
// or a caller (with targetClass implicitly equal to memberClass).
|
||||
// In the 2-array case, the targetClass is always different from the memberClass.
|
||||
volatile Object securityCheckCache;
|
||||
|
||||
void checkAccess(Class<?> caller, Class<?> clazz, Object obj, int modifiers)
|
||||
final void checkAccess(Class<?> caller, Class<?> memberClass,
|
||||
Class<?> targetClass, int modifiers)
|
||||
throws IllegalAccessException
|
||||
{
|
||||
if (caller == clazz) { // quick check
|
||||
if (caller == memberClass) { // quick check
|
||||
return; // ACCESS IS OK
|
||||
}
|
||||
Object cache = securityCheckCache; // read volatile
|
||||
Class<?> targetClass = clazz;
|
||||
if (obj != null
|
||||
if (targetClass != null // instance member or constructor
|
||||
&& Modifier.isProtected(modifiers)
|
||||
&& ((targetClass = obj.getClass()) != clazz)) {
|
||||
&& targetClass != memberClass) {
|
||||
// Must match a 2-list of { caller, targetClass }.
|
||||
if (cache instanceof Class[]) {
|
||||
Class<?>[] cache2 = (Class<?>[]) cache;
|
||||
@ -339,25 +339,27 @@ public class AccessibleObject implements AnnotatedElement {
|
||||
// subsumes range check for [0].)
|
||||
}
|
||||
} else if (cache == caller) {
|
||||
// Non-protected case (or obj.class == this.clazz).
|
||||
// Non-protected case (or targetClass == memberClass or static member).
|
||||
return; // ACCESS IS OK
|
||||
}
|
||||
|
||||
// If no return, fall through to the slow path.
|
||||
slowCheckMemberAccess(caller, clazz, obj, modifiers, targetClass);
|
||||
slowCheckMemberAccess(caller, memberClass, targetClass, modifiers);
|
||||
}
|
||||
|
||||
// Keep all this slow stuff out of line:
|
||||
void slowCheckMemberAccess(Class<?> caller, Class<?> clazz, Object obj, int modifiers,
|
||||
Class<?> targetClass)
|
||||
void slowCheckMemberAccess(Class<?> caller, Class<?> memberClass,
|
||||
Class<?> targetClass, int modifiers)
|
||||
throws IllegalAccessException
|
||||
{
|
||||
Reflection.ensureMemberAccess(caller, clazz, obj, modifiers);
|
||||
Reflection.ensureMemberAccess(caller, memberClass, targetClass, modifiers);
|
||||
|
||||
// Success: Update the cache.
|
||||
Object cache = ((targetClass == clazz)
|
||||
? caller
|
||||
: new Class<?>[] { caller, targetClass });
|
||||
Object cache = (targetClass != null
|
||||
&& Modifier.isProtected(modifiers)
|
||||
&& targetClass != memberClass)
|
||||
? new Class<?>[] { caller, targetClass }
|
||||
: caller;
|
||||
|
||||
// Note: The two cache elements are not volatile,
|
||||
// but they are effectively final. The Java memory model
|
||||
|
@ -443,7 +443,7 @@ public final class Constructor<T> extends Executable {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, null, modifiers);
|
||||
checkAccess(caller, clazz, clazz, modifiers);
|
||||
}
|
||||
if ((clazz.getModifiers() & Modifier.ENUM) != 0)
|
||||
throw new IllegalArgumentException("Cannot reflectively create enum objects");
|
||||
|
@ -403,7 +403,7 @@ class Field extends AccessibleObject implements Member {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, obj);
|
||||
}
|
||||
return getFieldAccessor(obj).get(obj);
|
||||
}
|
||||
@ -437,7 +437,7 @@ class Field extends AccessibleObject implements Member {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, obj);
|
||||
}
|
||||
return getFieldAccessor(obj).getBoolean(obj);
|
||||
}
|
||||
@ -471,7 +471,7 @@ class Field extends AccessibleObject implements Member {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, obj);
|
||||
}
|
||||
return getFieldAccessor(obj).getByte(obj);
|
||||
}
|
||||
@ -507,7 +507,7 @@ class Field extends AccessibleObject implements Member {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, obj);
|
||||
}
|
||||
return getFieldAccessor(obj).getChar(obj);
|
||||
}
|
||||
@ -543,7 +543,7 @@ class Field extends AccessibleObject implements Member {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, obj);
|
||||
}
|
||||
return getFieldAccessor(obj).getShort(obj);
|
||||
}
|
||||
@ -579,7 +579,7 @@ class Field extends AccessibleObject implements Member {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, obj);
|
||||
}
|
||||
return getFieldAccessor(obj).getInt(obj);
|
||||
}
|
||||
@ -615,7 +615,7 @@ class Field extends AccessibleObject implements Member {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, obj);
|
||||
}
|
||||
return getFieldAccessor(obj).getLong(obj);
|
||||
}
|
||||
@ -651,7 +651,7 @@ class Field extends AccessibleObject implements Member {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, obj);
|
||||
}
|
||||
return getFieldAccessor(obj).getFloat(obj);
|
||||
}
|
||||
@ -687,7 +687,7 @@ class Field extends AccessibleObject implements Member {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, obj);
|
||||
}
|
||||
return getFieldAccessor(obj).getDouble(obj);
|
||||
}
|
||||
@ -765,7 +765,7 @@ class Field extends AccessibleObject implements Member {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, obj);
|
||||
}
|
||||
getFieldAccessor(obj).set(obj, value);
|
||||
}
|
||||
@ -801,7 +801,7 @@ class Field extends AccessibleObject implements Member {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, obj);
|
||||
}
|
||||
getFieldAccessor(obj).setBoolean(obj, z);
|
||||
}
|
||||
@ -837,7 +837,7 @@ class Field extends AccessibleObject implements Member {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, obj);
|
||||
}
|
||||
getFieldAccessor(obj).setByte(obj, b);
|
||||
}
|
||||
@ -873,7 +873,7 @@ class Field extends AccessibleObject implements Member {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, obj);
|
||||
}
|
||||
getFieldAccessor(obj).setChar(obj, c);
|
||||
}
|
||||
@ -909,7 +909,7 @@ class Field extends AccessibleObject implements Member {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, obj);
|
||||
}
|
||||
getFieldAccessor(obj).setShort(obj, s);
|
||||
}
|
||||
@ -945,7 +945,7 @@ class Field extends AccessibleObject implements Member {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, obj);
|
||||
}
|
||||
getFieldAccessor(obj).setInt(obj, i);
|
||||
}
|
||||
@ -981,7 +981,7 @@ class Field extends AccessibleObject implements Member {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, obj);
|
||||
}
|
||||
getFieldAccessor(obj).setLong(obj, l);
|
||||
}
|
||||
@ -1017,7 +1017,7 @@ class Field extends AccessibleObject implements Member {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, obj);
|
||||
}
|
||||
getFieldAccessor(obj).setFloat(obj, f);
|
||||
}
|
||||
@ -1053,11 +1053,20 @@ class Field extends AccessibleObject implements Member {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, obj);
|
||||
}
|
||||
getFieldAccessor(obj).setDouble(obj, d);
|
||||
}
|
||||
|
||||
// check access to field
|
||||
private void checkAccess(Class<?> caller, Object obj)
|
||||
throws IllegalAccessException
|
||||
{
|
||||
checkAccess(caller, clazz,
|
||||
Modifier.isStatic(modifiers) ? null : obj.getClass(),
|
||||
modifiers);
|
||||
}
|
||||
|
||||
// security check is done before calling this method
|
||||
private FieldAccessor getFieldAccessor(Object obj)
|
||||
throws IllegalAccessException
|
||||
|
@ -526,7 +526,9 @@ public final class Method extends Executable {
|
||||
{
|
||||
if (!override) {
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
checkAccess(caller, clazz, obj, modifiers);
|
||||
checkAccess(caller, clazz,
|
||||
Modifier.isStatic(modifiers) ? null : obj.getClass(),
|
||||
modifiers);
|
||||
}
|
||||
MethodAccessor ma = methodAccessor; // read volatile
|
||||
if (ma == null) {
|
||||
|
@ -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
|
||||
|
@ -321,6 +321,13 @@ class InetAddress implements java.io.Serializable {
|
||||
public String getOriginalHostName(InetAddress ia) {
|
||||
return ia.holder.getOriginalHostName();
|
||||
}
|
||||
|
||||
public InetAddress getByName(String hostName,
|
||||
InetAddress hostAddress)
|
||||
throws UnknownHostException
|
||||
{
|
||||
return InetAddress.getByName(hostName, hostAddress);
|
||||
}
|
||||
}
|
||||
);
|
||||
init();
|
||||
|
@ -37,6 +37,9 @@ import java.nio.charset.CoderResult;
|
||||
import java.nio.charset.CodingErrorAction;
|
||||
import java.nio.charset.CharacterCodingException;
|
||||
import java.text.Normalizer;
|
||||
import jdk.internal.loader.URLClassPath;
|
||||
import jdk.internal.misc.JavaNetUriAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.nio.cs.ThreadLocalCoders;
|
||||
|
||||
import java.lang.Character; // for javadoc
|
||||
@ -819,6 +822,25 @@ public final class URI
|
||||
.parse(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a simple URI consisting of only a scheme and a pre-validated
|
||||
* path. Provides a fast-path for some internal cases.
|
||||
*/
|
||||
URI(String scheme, String path) {
|
||||
assert validSchemeAndPath(scheme, path);
|
||||
this.scheme = scheme;
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
private static boolean validSchemeAndPath(String scheme, String path) {
|
||||
try {
|
||||
URI u = new URI(scheme + ":" + path);
|
||||
return scheme.equals(u.scheme) && path.equals(u.path);
|
||||
} catch (URISyntaxException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a URI by parsing the given string.
|
||||
*
|
||||
@ -3571,5 +3593,13 @@ public final class URI
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static {
|
||||
SharedSecrets.setJavaNetUriAccess(
|
||||
new JavaNetUriAccess() {
|
||||
public URI create(String scheme, String path) {
|
||||
return new URI(scheme, path);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
@ -51,7 +51,7 @@ import java.util.jar.Manifest;
|
||||
|
||||
import jdk.internal.loader.Resource;
|
||||
import jdk.internal.loader.URLClassPath;
|
||||
import jdk.internal.misc.JavaNetAccess;
|
||||
import jdk.internal.misc.JavaNetURLClassLoaderAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.perf.PerfCounter;
|
||||
import sun.net.www.ParseUtil;
|
||||
@ -767,10 +767,11 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
}
|
||||
|
||||
static {
|
||||
SharedSecrets.setJavaNetAccess(
|
||||
new JavaNetAccess() {
|
||||
public URLClassPath getURLClassPath(URLClassLoader u) {
|
||||
return u.ucp;
|
||||
SharedSecrets.setJavaNetURLClassLoaderAccess(
|
||||
new JavaNetURLClassLoaderAccess() {
|
||||
@Override
|
||||
public AccessControlContext getAccessControlContext(URLClassLoader u) {
|
||||
return u.acc;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user