# HG changeset patch # User ctornqvi # Date 1425303121 28800 # Node ID d4bd9341ded3083b41da8751ca7ce347db34563e # Parent 54c7d4e5261fa67c75fadc3296a011ff04fe1f9d# Parent 3f7ad0911ddb28b96b4556647e0858dc79fbbbc6 Merge diff -r 54c7d4e5261f -r d4bd9341ded3 .hgtags --- a/.hgtags Fri Feb 27 12:48:06 2015 -0500 +++ b/.hgtags Mon Mar 02 05:32:01 2015 -0800 @@ -294,3 +294,4 @@ 5b8db585a33c3cc48e70e688ceee57dd9271dc5d jdk9-b49 1550b2f6b63d1411fa84dc7bbc6f04809aedb43f jdk9-b50 6efe265424e3f1ea596408a1f71baf2de316c772 jdk9-b51 +d6224d6021459ac8b3832e822f5acc849fa944af jdk9-b52 diff -r 54c7d4e5261f -r d4bd9341ded3 .hgtags-top-repo --- a/.hgtags-top-repo Fri Feb 27 12:48:06 2015 -0500 +++ b/.hgtags-top-repo Mon Mar 02 05:32:01 2015 -0800 @@ -294,3 +294,4 @@ d91ed1951b948210590ce1394bea5515357246ba jdk9-b49 d1f37d39ff2421f956a6ddf316cf763807bc3363 jdk9-b50 6207b4b8731ca75c51b031c47daa813ab92ef558 jdk9-b51 +1822e59f17121b09e7899cf338cfb6e37fe5fceb jdk9-b52 diff -r 54c7d4e5261f -r d4bd9341ded3 common/autoconf/basics.m4 --- a/common/autoconf/basics.m4 Fri Feb 27 12:48:06 2015 -0500 +++ b/common/autoconf/basics.m4 Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -77,26 +77,30 @@ # $1: The name of the variable to fix AC_DEFUN([BASIC_FIXUP_PATH], [ - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then - BASIC_FIXUP_PATH_CYGWIN($1) - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - BASIC_FIXUP_PATH_MSYS($1) - else - # We're on a unix platform. Hooray! :) - path="[$]$1" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.]) - AC_MSG_ERROR([Spaces are not allowed in this path.]) + # Only process if variable expands to non-empty + + if test "x[$]$1" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + BASIC_FIXUP_PATH_CYGWIN($1) + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + BASIC_FIXUP_PATH_MSYS($1) + else + # We're on a unix platform. Hooray! :) + path="[$]$1" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.]) + AC_MSG_ERROR([Spaces are not allowed in this path.]) + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + AC_MSG_ERROR([The path of $1, which resolves as "$path", is not found.]) + fi + + $1="`cd "$path"; $THEPWDCMD -L`" fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - AC_MSG_ERROR([The path of $1, which resolves as "$path", is not found.]) - fi - - $1="`cd "$path"; $THEPWDCMD -L`" fi ]) @@ -113,57 +117,61 @@ # $1: The name of the variable to fix AC_DEFUN([BASIC_FIXUP_EXECUTABLE], [ - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then - BASIC_FIXUP_EXECUTABLE_CYGWIN($1) - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - BASIC_FIXUP_EXECUTABLE_MSYS($1) - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="[$]$1" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" + # Only process if variable expands to non-empty + + if test "x[$]$1" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + BASIC_FIXUP_EXECUTABLE_CYGWIN($1) + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + BASIC_FIXUP_EXECUTABLE_MSYS($1) + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="[$]$1" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.]) + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + AC_MSG_NOTICE([This might be caused by spaces in the path, which is not allowed.]) fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" + AC_MSG_ERROR([Cannot locate the the path of $1]) + fi fi - if test "x$new_path" = x; then - AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.]) - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - AC_MSG_NOTICE([This might be caused by spaces in the path, which is not allowed.]) - fi - AC_MSG_ERROR([Cannot locate the the path of $1]) + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" fi - fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - $1="$new_complete" - AC_MSG_NOTICE([Rewriting $1 to "$new_complete"]) + if test "x$complete" != "x$new_complete"; then + $1="$new_complete" + AC_MSG_NOTICE([Rewriting $1 to "$new_complete"]) + fi fi ]) diff -r 54c7d4e5261f -r d4bd9341ded3 common/autoconf/generated-configure.sh --- a/common/autoconf/generated-configure.sh Fri Feb 27 12:48:06 2015 -0500 +++ b/common/autoconf/generated-configure.sh Mon Mar 02 05:32:01 2015 -0800 @@ -3386,7 +3386,7 @@ # Include these first... # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -4393,7 +4393,7 @@ #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1424202275 +DATE_WHEN_GENERATED=1424872170 ############################################################################### # @@ -14155,7 +14155,10 @@ # We can only call BASIC_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS. - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$CURDIR" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -14216,7 +14219,7 @@ $as_echo "$as_me: Rewriting CURDIR to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$CURDIR" has_colon=`$ECHO $path | $GREP ^.:` @@ -14257,27 +14260,31 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$CURDIR" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of CURDIR, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$CURDIR" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of CURDIR, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of CURDIR, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of CURDIR, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - CURDIR="`cd "$path"; $THEPWDCMD -L`" - fi - - - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of CURDIR, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + CURDIR="`cd "$path"; $THEPWDCMD -L`" + fi + fi + + + # Only process if variable expands to non-empty + + if test "x$TOPDIR" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -14338,7 +14345,7 @@ $as_echo "$as_me: Rewriting TOPDIR to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$TOPDIR" has_colon=`$ECHO $path | $GREP ^.:` @@ -14379,23 +14386,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$TOPDIR" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of TOPDIR, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$TOPDIR" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of TOPDIR, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of TOPDIR, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of TOPDIR, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - TOPDIR="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of TOPDIR, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + TOPDIR="`cd "$path"; $THEPWDCMD -L`" + fi fi # SRC_ROOT is a traditional alias for TOPDIR. @@ -14797,7 +14805,10 @@ if test "${with_devkit+set}" = set; then : withval=$with_devkit; - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$with_devkit" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -14858,7 +14869,7 @@ $as_echo "$as_me: Rewriting with_devkit to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$with_devkit" has_colon=`$ECHO $path | $GREP ^.:` @@ -14899,23 +14910,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$with_devkit" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of with_devkit, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$with_devkit" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of with_devkit, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of with_devkit, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of with_devkit, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - with_devkit="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of with_devkit, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + with_devkit="`cd "$path"; $THEPWDCMD -L`" + fi fi DEVKIT_ROOT="$with_devkit" @@ -15271,7 +15283,10 @@ $as_echo "$CONF_NAME" >&6; } - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$OUTPUT_ROOT" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -15332,7 +15347,7 @@ $as_echo "$as_me: Rewriting OUTPUT_ROOT to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$OUTPUT_ROOT" has_colon=`$ECHO $path | $GREP ^.:` @@ -15373,23 +15388,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$OUTPUT_ROOT" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OUTPUT_ROOT, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$OUTPUT_ROOT" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OUTPUT_ROOT, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of OUTPUT_ROOT, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of OUTPUT_ROOT, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - OUTPUT_ROOT="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of OUTPUT_ROOT, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + OUTPUT_ROOT="`cd "$path"; $THEPWDCMD -L`" + fi fi @@ -15511,7 +15527,10 @@ else FOUND_MAKE=$MAKE_CANDIDATE - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$FOUND_MAKE" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -15625,7 +15644,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -15740,56 +15759,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$FOUND_MAKE" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$FOUND_MAKE" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of FOUND_MAKE" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - FOUND_MAKE="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of FOUND_MAKE" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + FOUND_MAKE="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting FOUND_MAKE to \"$new_complete\"" >&6;} + fi fi fi @@ -15884,7 +15904,10 @@ else FOUND_MAKE=$MAKE_CANDIDATE - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$FOUND_MAKE" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -15998,7 +16021,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -16113,56 +16136,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$FOUND_MAKE" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$FOUND_MAKE" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of FOUND_MAKE" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - FOUND_MAKE="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of FOUND_MAKE" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + FOUND_MAKE="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting FOUND_MAKE to \"$new_complete\"" >&6;} + fi fi fi @@ -16254,7 +16278,10 @@ else FOUND_MAKE=$MAKE_CANDIDATE - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$FOUND_MAKE" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -16368,7 +16395,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -16483,56 +16510,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$FOUND_MAKE" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$FOUND_MAKE" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of FOUND_MAKE" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - FOUND_MAKE="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of FOUND_MAKE" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + FOUND_MAKE="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting FOUND_MAKE to \"$new_complete\"" >&6;} + fi fi fi @@ -16629,7 +16657,10 @@ else FOUND_MAKE=$MAKE_CANDIDATE - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$FOUND_MAKE" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -16743,7 +16774,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -16858,56 +16889,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$FOUND_MAKE" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$FOUND_MAKE" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of FOUND_MAKE" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - FOUND_MAKE="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of FOUND_MAKE" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + FOUND_MAKE="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting FOUND_MAKE to \"$new_complete\"" >&6;} + fi fi fi @@ -16998,7 +17030,10 @@ else FOUND_MAKE=$MAKE_CANDIDATE - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$FOUND_MAKE" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -17112,7 +17147,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -17227,56 +17262,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$FOUND_MAKE" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$FOUND_MAKE" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of FOUND_MAKE" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - FOUND_MAKE="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of FOUND_MAKE" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + FOUND_MAKE="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting FOUND_MAKE to \"$new_complete\"" >&6;} + fi fi fi @@ -20116,7 +20152,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -20177,7 +20216,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -20218,23 +20257,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -20441,7 +20481,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -20502,7 +20545,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -20543,23 +20586,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -20628,7 +20672,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -20689,7 +20736,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -20730,23 +20777,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -20808,7 +20856,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -20869,7 +20920,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -20910,23 +20961,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -20987,7 +21039,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -21048,7 +21103,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -21089,23 +21144,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -21166,7 +21222,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -21227,7 +21286,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -21268,23 +21327,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -21336,7 +21396,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -21397,7 +21460,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -21438,23 +21501,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -21481,7 +21545,10 @@ if test "x$JAVA_HOME" != x; then JAVA_HOME_PROCESSED="$JAVA_HOME" - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$JAVA_HOME_PROCESSED" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -21542,7 +21609,7 @@ $as_echo "$as_me: Rewriting JAVA_HOME_PROCESSED to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$JAVA_HOME_PROCESSED" has_colon=`$ECHO $path | $GREP ^.:` @@ -21583,23 +21650,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$JAVA_HOME_PROCESSED" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JAVA_HOME_PROCESSED, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$JAVA_HOME_PROCESSED" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JAVA_HOME_PROCESSED, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of JAVA_HOME_PROCESSED, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of JAVA_HOME_PROCESSED, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - JAVA_HOME_PROCESSED="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of JAVA_HOME_PROCESSED, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + JAVA_HOME_PROCESSED="`cd "$path"; $THEPWDCMD -L`" + fi fi if test ! -d "$JAVA_HOME_PROCESSED"; then @@ -21647,7 +21715,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -21708,7 +21779,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -21749,23 +21820,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -21968,7 +22040,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -22029,7 +22104,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -22070,23 +22145,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -22176,7 +22252,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -22237,7 +22316,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -22278,23 +22357,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -22349,7 +22429,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -22410,7 +22493,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -22451,23 +22534,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -22550,7 +22634,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -22611,7 +22698,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -22652,23 +22739,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -22723,7 +22811,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -22784,7 +22875,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -22825,23 +22916,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -22924,7 +23016,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -22985,7 +23080,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -23026,23 +23121,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -23097,7 +23193,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -23158,7 +23257,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -23199,23 +23298,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -23298,7 +23398,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -23359,7 +23462,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -23400,23 +23503,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -23471,7 +23575,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -23532,7 +23639,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -23573,23 +23680,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -23659,7 +23767,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -23720,7 +23831,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -23761,23 +23872,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -23830,7 +23942,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -23891,7 +24006,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -23932,23 +24047,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -24019,7 +24135,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -24080,7 +24199,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -24121,23 +24240,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -24190,7 +24310,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -24251,7 +24374,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -24292,23 +24415,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -24378,7 +24502,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -24439,7 +24566,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -24480,23 +24607,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -24549,7 +24677,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -24610,7 +24741,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -24651,23 +24782,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -24738,178 +24870,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then - - # Input might be given as Windows format, start by converting to - # unix format. - path="$BOOT_JDK" - new_path=`$CYGPATH -u "$path"` - - # Cygwin tries to hide some aspects of the Windows file system, such that binaries are - # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered - # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then - # "foo.exe" is OK but "foo" is an error. - # - # This test is therefore slightly more accurate than "test -f" to check for file precense. - # It is also a way to make sure we got the proper file name for the real test later on. - test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` - if test "x$test_shortpath" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 -$as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Cannot locate the the path of BOOT_JDK" "$LINENO" 5 - fi - - # Call helper function which possibly converts this using DOS-style short mode. - # If so, the updated path is stored in $new_path. - - input_path="$new_path" - # Check if we need to convert this using DOS-style short mode. If the path - # contains just simple characters, use it. Otherwise (spaces, weird characters), - # take no chances and rewrite it. - # Note: m4 eats our [], so we need to use [ and ] instead. - has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` - if test "x$has_forbidden_chars" != x; then - # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) - shortmode_path=`$CYGPATH -s -m -a "$input_path"` - path_after_shortmode=`$CYGPATH -u "$shortmode_path"` - if test "x$path_after_shortmode" != "x$input_to_shortpath"; then - # Going to short mode and back again did indeed matter. Since short mode is - # case insensitive, let's make it lowercase to improve readability. - shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) - input_path=`$CYGPATH -u "$shortmode_path"` - new_path="$input_path" - fi - fi - - test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` - if test "x$test_cygdrive_prefix" = x; then - # As a simple fix, exclude /usr/bin since it's not a real path. - if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then - # The path is in a Cygwin special directory (e.g. /home). We need this converted to - # a path prefixed by /cygdrive for fixpath to work. - new_path="$CYGWIN_ROOT_PATH$input_path" - fi - fi - - - if test "x$path" != "x$new_path"; then - BOOT_JDK="$new_path" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BOOT_JDK to \"$new_path\"" >&5 -$as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} - fi - - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - - path="$BOOT_JDK" - has_colon=`$ECHO $path | $GREP ^.:` - new_path="$path" - if test "x$has_colon" = x; then - # Not in mixed or Windows style, start by that. - new_path=`cmd //c echo $path` - fi - - - input_path="$new_path" - # Check if we need to convert this using DOS-style short mode. If the path - # contains just simple characters, use it. Otherwise (spaces, weird characters), - # take no chances and rewrite it. - # Note: m4 eats our [], so we need to use [ and ] instead. - has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` - if test "x$has_forbidden_chars" != x; then - # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) - new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - fi - - - windows_path="$new_path" - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then - unix_path=`$CYGPATH -u "$windows_path"` - new_path="$unix_path" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` - new_path="$unix_path" - fi - - if test "x$path" != "x$new_path"; then - BOOT_JDK="$new_path" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BOOT_JDK to \"$new_path\"" >&5 -$as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} - fi - - # Save the first 10 bytes of this path to the storage, so fixpath can work. - all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 -$as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 -$as_echo_n "checking for Boot JDK... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5 -$as_echo "$BOOT_JDK" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5 -$as_echo_n "checking Boot JDK version... " >&6; } - BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5 -$as_echo "$BOOT_JDK_VERSION" >&6; } - fi # end check jdk version - fi # end check javac - fi # end check java - fi # end check boot jdk found - fi - - done - fi - - - # If previous step claimed to have found a JDK, check it to see if it seems to be valid. - if test "x$BOOT_JDK_FOUND" = xmaybe; then - # Do we have a bin/java? - if test ! -x "$BOOT_JDK/bin/java"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5 -$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;} - BOOT_JDK_FOUND=no - else - # Do we have a bin/javac? - if test ! -x "$BOOT_JDK/bin/javac"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5 -$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5 -$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;} - BOOT_JDK_FOUND=no - else - # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version? - BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1` - - # Extra M4 quote needed to protect [] in grep expression. - FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'` - if test "x$FOUND_CORRECT_VERSION" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5 -$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5 -$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;} - BOOT_JDK_FOUND=no - else - # We're done! :-) - BOOT_JDK_FOUND=yes - - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -24970,7 +24934,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -25011,23 +24975,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -25045,6 +25010,7 @@ fi # end check boot jdk found fi + done fi @@ -25079,7 +25045,10 @@ # We're done! :-) BOOT_JDK_FOUND=yes - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -25140,7 +25109,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$BOOT_JDK" has_colon=`$ECHO $path | $GREP ^.:` @@ -25181,23 +25150,198 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$BOOT_JDK" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 +$as_echo_n "checking for Boot JDK... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5 +$as_echo "$BOOT_JDK" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5 +$as_echo_n "checking Boot JDK version... " >&6; } + BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5 +$as_echo "$BOOT_JDK_VERSION" >&6; } + fi # end check jdk version + fi # end check javac + fi # end check java + fi # end check boot jdk found + fi + + fi + + + # If previous step claimed to have found a JDK, check it to see if it seems to be valid. + if test "x$BOOT_JDK_FOUND" = xmaybe; then + # Do we have a bin/java? + if test ! -x "$BOOT_JDK/bin/java"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5 +$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;} + BOOT_JDK_FOUND=no + else + # Do we have a bin/javac? + if test ! -x "$BOOT_JDK/bin/javac"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5 +$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5 +$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;} + BOOT_JDK_FOUND=no + else + # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version? + BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1` + + # Extra M4 quote needed to protect [] in grep expression. + FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'` + if test "x$FOUND_CORRECT_VERSION" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5 +$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5 +$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;} + BOOT_JDK_FOUND=no + else + # We're done! :-) + BOOT_JDK_FOUND=yes + + # Only process if variable expands to non-empty + + if test "x$BOOT_JDK" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$BOOT_JDK" + new_path=`$CYGPATH -u "$path"` + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file precense. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Cannot locate the the path of BOOT_JDK" "$LINENO" 5 + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-stile (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + + if test "x$path" != "x$new_path"; then + BOOT_JDK="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BOOT_JDK to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$BOOT_JDK" + has_colon=`$ECHO $path | $GREP ^.:` + new_path="$path" + if test "x$has_colon" = x; then + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $path` + fi + + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + if test "x$path" != "x$new_path"; then + BOOT_JDK="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BOOT_JDK to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} + fi + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + + else + # We're on a unix platform. Hooray! :) + path="$BOOT_JDK" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + BOOT_JDK="`cd "$path"; $THEPWDCMD -L`" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5 @@ -27154,7 +27298,10 @@ if test "x$VS_ENV_CMD" != x; then # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file. - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$VS_ENV_CMD" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -27268,7 +27415,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -27383,56 +27530,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$VS_ENV_CMD" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of VS_ENV_CMD, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$VS_ENV_CMD" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of VS_ENV_CMD, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of VS_ENV_CMD, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of VS_ENV_CMD" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - VS_ENV_CMD="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting VS_ENV_CMD to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of VS_ENV_CMD" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + VS_ENV_CMD="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting VS_ENV_CMD to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting VS_ENV_CMD to \"$new_complete\"" >&6;} + fi fi @@ -27548,9 +27696,27 @@ IFS=";" for i in $VS_INCLUDE; do ipath=$i - IFS="$OLDIFS" - - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process non-empty elements + if test "x$ipath" != x; then + IFS="$OLDIFS" + # Check that directory exists before calling fixup_path + testpath=$ipath + + windows_path="$testpath" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + testpath="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + testpath="$unix_path" + fi + + if test -d "$testpath"; then + + # Only process if variable expands to non-empty + + if test "x$ipath" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -27611,7 +27777,7 @@ $as_echo "$as_me: Rewriting ipath to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$ipath" has_colon=`$ECHO $path | $GREP ^.:` @@ -27652,34 +27818,55 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$ipath" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of ipath, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$ipath" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of ipath, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of ipath, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of ipath, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - ipath="`cd "$path"; $THEPWDCMD -L`" - fi - - IFS=";" - SYSROOT_CFLAGS="$SYSROOT_CFLAGS -I$ipath" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of ipath, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + ipath="`cd "$path"; $THEPWDCMD -L`" + fi + fi + + SYSROOT_CFLAGS="$SYSROOT_CFLAGS -I$ipath" + fi + IFS=";" + fi done # Convert VS_LIB into SYSROOT_LDFLAGS for i in $VS_LIB; do libpath=$i - IFS="$OLDIFS" - - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process non-empty elements + if test "x$libpath" != x; then + IFS="$OLDIFS" + # Check that directory exists before calling fixup_path + testpath=$libpath + + windows_path="$testpath" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + testpath="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + testpath="$unix_path" + fi + + if test -d "$testpath"; then + + # Only process if variable expands to non-empty + + if test "x$libpath" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -27740,7 +27927,7 @@ $as_echo "$as_me: Rewriting libpath to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$libpath" has_colon=`$ECHO $path | $GREP ^.:` @@ -27781,27 +27968,30 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$libpath" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of libpath, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$libpath" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of libpath, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of libpath, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of libpath, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - libpath="`cd "$path"; $THEPWDCMD -L`" - fi - - IFS=";" - SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -libpath:$libpath" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of libpath, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + libpath="`cd "$path"; $THEPWDCMD -L`" + fi + fi + + SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -libpath:$libpath" + fi + IFS=";" + fi done IFS="$OLDIFS" fi @@ -28076,7 +28266,10 @@ # Now we have a compiler binary in CC. Make sure it's okay. - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$CC" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -28190,7 +28383,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -28305,56 +28498,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$CC" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of CC, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$CC" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of CC, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of CC, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of CC" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - CC="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting CC to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of CC" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + CC="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting CC to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting CC to \"$new_complete\"" >&6;} + fi fi TEST_COMPILER="$CC" @@ -28533,7 +28727,10 @@ fi - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$PROPER_COMPILER_CC" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -28647,7 +28844,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -28762,56 +28959,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$PROPER_COMPILER_CC" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of PROPER_COMPILER_CC, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$PROPER_COMPILER_CC" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of PROPER_COMPILER_CC, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of PROPER_COMPILER_CC, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of PROPER_COMPILER_CC" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - PROPER_COMPILER_CC="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting PROPER_COMPILER_CC to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of PROPER_COMPILER_CC" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + PROPER_COMPILER_CC="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting PROPER_COMPILER_CC to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting PROPER_COMPILER_CC to \"$new_complete\"" >&6;} + fi fi PATH="$RETRY_COMPILER_SAVED_PATH" @@ -29816,7 +30014,10 @@ # Now we have a compiler binary in CXX. Make sure it's okay. - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$CXX" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -29930,7 +30131,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -30045,56 +30246,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$CXX" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of CXX, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$CXX" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of CXX, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of CXX, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of CXX" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - CXX="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting CXX to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of CXX" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + CXX="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting CXX to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting CXX to \"$new_complete\"" >&6;} + fi fi TEST_COMPILER="$CXX" @@ -30273,7 +30475,10 @@ fi - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$PROPER_COMPILER_CXX" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -30387,7 +30592,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -30502,56 +30707,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$PROPER_COMPILER_CXX" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of PROPER_COMPILER_CXX, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$PROPER_COMPILER_CXX" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of PROPER_COMPILER_CXX, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of PROPER_COMPILER_CXX, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of PROPER_COMPILER_CXX" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - PROPER_COMPILER_CXX="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting PROPER_COMPILER_CXX to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of PROPER_COMPILER_CXX" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + PROPER_COMPILER_CXX="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting PROPER_COMPILER_CXX to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting PROPER_COMPILER_CXX to \"$new_complete\"" >&6;} + fi fi PATH="$RETRY_COMPILER_SAVED_PATH" @@ -31135,7 +31341,10 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$CPP" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -31249,7 +31458,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -31364,56 +31573,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$CPP" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of CPP, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$CPP" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of CPP, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of CPP, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of CPP" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - CPP="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting CPP to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of CPP" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + CPP="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting CPP to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting CPP to \"$new_complete\"" >&6;} + fi fi ac_ext=cpp @@ -31550,7 +31760,10 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$CXXCPP" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -31664,7 +31877,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -31779,56 +31992,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$CXXCPP" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of CXXCPP, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$CXXCPP" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of CXXCPP, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of CXXCPP, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of CXXCPP" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - CXXCPP="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting CXXCPP to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of CXXCPP" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + CXXCPP="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting CXXCPP to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting CXXCPP to \"$new_complete\"" >&6;} + fi fi @@ -31894,7 +32108,10 @@ - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$LD" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -32008,7 +32225,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -32123,56 +32340,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$LD" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of LD, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$LD" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of LD, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of LD, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of LD" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - LD="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting LD to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of LD" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + LD="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting LD to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting LD to \"$new_complete\"" >&6;} + fi fi # Verify that we indeed succeeded with this trick. @@ -32389,7 +32607,10 @@ - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$AS" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -32503,7 +32724,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -32618,56 +32839,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$AS" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of AS, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$AS" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of AS, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of AS, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of AS" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - AS="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting AS to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of AS" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + AS="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting AS to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting AS to \"$new_complete\"" >&6;} + fi fi else @@ -33017,7 +33239,10 @@ fi - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$AR" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -33131,7 +33356,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -33246,56 +33471,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$AR" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of AR, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$AR" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of AR, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of AR, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of AR" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - AR="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting AR to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of AR" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + AR="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting AR to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting AR to \"$new_complete\"" >&6;} + fi fi @@ -33553,7 +33779,10 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$OBJC" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -33667,7 +33896,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -33782,56 +34011,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$OBJC" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OBJC, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$OBJC" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OBJC, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of OBJC, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of OBJC" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - OBJC="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OBJC to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of OBJC" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + OBJC="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OBJC to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting OBJC to \"$new_complete\"" >&6;} + fi fi @@ -34021,7 +34251,10 @@ - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$LIPO" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -34135,7 +34368,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -34250,56 +34483,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$LIPO" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of LIPO, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$LIPO" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of LIPO, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of LIPO, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of LIPO" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - LIPO="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting LIPO to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of LIPO" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + LIPO="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting LIPO to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting LIPO to \"$new_complete\"" >&6;} + fi fi else @@ -34362,7 +34596,10 @@ - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$MT" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -34476,7 +34713,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -34591,56 +34828,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$MT" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MT, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$MT" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MT, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of MT, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of MT" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - MT="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MT to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of MT" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + MT="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MT to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting MT to \"$new_complete\"" >&6;} + fi fi # Setup the resource compiler (RC) @@ -34699,7 +34937,10 @@ - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$RC" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -34813,7 +35054,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -34928,56 +35169,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$RC" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of RC, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$RC" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of RC, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of RC, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of RC" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - RC="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting RC to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of RC" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + RC="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting RC to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting RC to \"$new_complete\"" >&6;} + fi fi # Extract the first word of "dumpbin", so it can be a program name with args. @@ -35018,7 +35260,10 @@ - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$DUMPBIN" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -35132,7 +35377,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -35247,56 +35492,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$DUMPBIN" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of DUMPBIN, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$DUMPBIN" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of DUMPBIN, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of DUMPBIN, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of DUMPBIN" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - DUMPBIN="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting DUMPBIN to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of DUMPBIN" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + DUMPBIN="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting DUMPBIN to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting DUMPBIN to \"$new_complete\"" >&6;} + fi fi # We need to check for 'msbuild.exe' because at the place where we expect to @@ -35533,7 +35779,10 @@ - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$STRIP" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -35647,7 +35896,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -35762,56 +36011,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$STRIP" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of STRIP, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$STRIP" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of STRIP, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of STRIP, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of STRIP" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - STRIP="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting STRIP to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of STRIP" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + STRIP="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting STRIP to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting STRIP to \"$new_complete\"" >&6;} + fi fi @@ -36001,7 +36251,10 @@ - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$NM" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -36115,7 +36368,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -36230,56 +36483,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$NM" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of NM, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$NM" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of NM, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of NM, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of NM" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - NM="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting NM to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of NM" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + NM="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting NM to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting NM to \"$new_complete\"" >&6;} + fi fi @@ -36469,7 +36723,10 @@ - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$GNM" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -36583,7 +36840,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -36698,56 +36955,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$GNM" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of GNM, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$GNM" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of GNM, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of GNM, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of GNM" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - GNM="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting GNM to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of GNM" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + GNM="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting GNM to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting GNM to \"$new_complete\"" >&6;} + fi fi @@ -36938,7 +37196,10 @@ - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$MCS" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -37052,7 +37313,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -37167,56 +37428,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$MCS" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MCS, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$MCS" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MCS, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of MCS, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of MCS" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - MCS="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MCS to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of MCS" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + MCS="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MCS to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting MCS to \"$new_complete\"" >&6;} + fi fi elif test "x$OPENJDK_TARGET_OS" != xwindows; then @@ -37518,7 +37780,10 @@ - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$STRIP" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -37632,7 +37897,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -37747,56 +38012,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$STRIP" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of STRIP, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$STRIP" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of STRIP, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of STRIP, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of STRIP" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - STRIP="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting STRIP to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of STRIP" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + STRIP="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting STRIP to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting STRIP to \"$new_complete\"" >&6;} + fi fi @@ -38096,7 +38362,10 @@ - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$NM" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -38210,7 +38479,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -38325,56 +38594,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$NM" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of NM, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$NM" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of NM, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of NM, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of NM" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - NM="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting NM to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of NM" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + NM="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting NM to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting NM to \"$new_complete\"" >&6;} + fi fi GNM="$NM" @@ -38683,7 +38953,10 @@ # Only call fixup if objcopy was found. if test -n "$OBJCOPY"; then - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$OBJCOPY" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -38797,7 +39070,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -38912,56 +39185,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$OBJCOPY" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OBJCOPY, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$OBJCOPY" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OBJCOPY, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of OBJCOPY, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of OBJCOPY" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - OBJCOPY="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OBJCOPY to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of OBJCOPY" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + OBJCOPY="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OBJCOPY to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting OBJCOPY to \"$new_complete\"" >&6;} + fi fi fi @@ -39267,7 +39541,10 @@ # Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE # bails if argument is missing. - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$OBJDUMP" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -39381,7 +39658,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -39496,56 +39773,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$OBJDUMP" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OBJDUMP, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$OBJDUMP" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OBJDUMP, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of OBJDUMP, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of OBJDUMP" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - OBJDUMP="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OBJDUMP to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of OBJDUMP" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + OBJDUMP="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OBJDUMP to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting OBJDUMP to \"$new_complete\"" >&6;} + fi fi fi @@ -39760,7 +40038,10 @@ - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BUILD_CC" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -39874,7 +40155,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -39989,56 +40270,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$BUILD_CC" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_CC, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$BUILD_CC" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_CC, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of BUILD_CC, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of BUILD_CC" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - BUILD_CC="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BUILD_CC to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of BUILD_CC" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + BUILD_CC="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BUILD_CC to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting BUILD_CC to \"$new_complete\"" >&6;} + fi fi @@ -40228,7 +40510,10 @@ - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BUILD_CXX" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -40342,7 +40627,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -40457,56 +40742,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$BUILD_CXX" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_CXX, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$BUILD_CXX" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_CXX, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of BUILD_CXX, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of BUILD_CXX" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - BUILD_CXX="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BUILD_CXX to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of BUILD_CXX" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + BUILD_CXX="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BUILD_CXX to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting BUILD_CXX to \"$new_complete\"" >&6;} + fi fi @@ -40696,7 +40982,10 @@ - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$BUILD_LD" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # First separate the path from the arguments. This will split at the first # space. @@ -40810,7 +41099,7 @@ # remove trailing .exe if any new_path="${new_path/%.exe/}" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # First separate the path from the arguments. This will split at the first # space. @@ -40925,56 +41214,57 @@ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") fi - else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="$BUILD_LD" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. - new_path="$path" - fi - - if test "x$new_path" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_LD, which resolves as \"$complete\", is not found." >&5 + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$BUILD_LD" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_LD, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of BUILD_LD, which resolves as \"$complete\", is not found." >&6;} - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 $as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} - fi - as_fn_error $? "Cannot locate the the path of BUILD_LD" "$LINENO" 5 - fi - fi - - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi - - if test "x$complete" != "x$new_complete"; then - BUILD_LD="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BUILD_LD to \"$new_complete\"" >&5 + fi + as_fn_error $? "Cannot locate the the path of BUILD_LD" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + BUILD_LD="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BUILD_LD to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting BUILD_LD to \"$new_complete\"" >&6;} + fi fi else @@ -41307,7 +41597,10 @@ # use JT_HOME enviroment var. - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$JT_HOME" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -41368,7 +41661,7 @@ $as_echo "$as_me: Rewriting JT_HOME to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$JT_HOME" has_colon=`$ECHO $path | $GREP ^.:` @@ -41409,23 +41702,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$JT_HOME" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JT_HOME, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$JT_HOME" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JT_HOME, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of JT_HOME, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of JT_HOME, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - JT_HOME="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of JT_HOME, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + JT_HOME="`cd "$path"; $THEPWDCMD -L`" + fi fi @@ -44698,7 +44992,10 @@ if test "x$FOUND_FREETYPE" = xyes; then - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -44759,7 +45056,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -44800,27 +45097,31 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_INCLUDE_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_INCLUDE_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" - fi - - - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" + fi + fi + + + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -44881,7 +45182,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_LIB_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -44922,23 +45223,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_LIB_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_LIB_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + fi fi @@ -45051,7 +45353,10 @@ if test "x$FOUND_FREETYPE" = xyes; then - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -45112,7 +45417,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -45153,27 +45458,31 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_INCLUDE_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_INCLUDE_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" - fi - - - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" + fi + fi + + + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -45234,7 +45543,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_LIB_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -45275,23 +45584,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_LIB_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_LIB_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + fi fi @@ -45665,7 +45975,10 @@ if test "x$FOUND_FREETYPE" = xyes; then - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -45726,7 +46039,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -45767,27 +46080,31 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_INCLUDE_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_INCLUDE_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" - fi - - - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" + fi + fi + + + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -45848,7 +46165,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_LIB_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -45889,23 +46206,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_LIB_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_LIB_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + fi fi @@ -45993,7 +46311,10 @@ if test "x$FOUND_FREETYPE" = xyes; then - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -46054,7 +46375,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -46095,27 +46416,31 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_INCLUDE_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_INCLUDE_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" - fi - - - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" + fi + fi + + + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -46176,7 +46501,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_LIB_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -46217,23 +46542,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_LIB_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_LIB_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + fi fi @@ -46312,7 +46638,10 @@ if test "x$FOUND_FREETYPE" = xyes; then - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -46373,7 +46702,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -46414,27 +46743,31 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_INCLUDE_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_INCLUDE_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" - fi - - - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" + fi + fi + + + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -46495,7 +46828,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_LIB_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -46536,23 +46869,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_LIB_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_LIB_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + fi fi @@ -46631,7 +46965,10 @@ if test "x$FOUND_FREETYPE" = xyes; then - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -46692,7 +47029,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -46733,27 +47070,31 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_INCLUDE_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_INCLUDE_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" - fi - - - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" + fi + fi + + + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -46814,7 +47155,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_LIB_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -46855,23 +47196,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_LIB_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_LIB_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + fi fi @@ -46951,7 +47293,10 @@ if test "x$FOUND_FREETYPE" = xyes; then - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -47012,7 +47357,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -47053,27 +47398,31 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_INCLUDE_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_INCLUDE_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" - fi - - - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" + fi + fi + + + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -47134,7 +47483,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_LIB_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -47175,23 +47524,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_LIB_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_LIB_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + fi fi @@ -47272,7 +47622,10 @@ if test "x$FOUND_FREETYPE" = xyes; then - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -47333,7 +47686,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -47374,27 +47727,31 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_INCLUDE_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_INCLUDE_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" - fi - - - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" + fi + fi + + + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -47455,7 +47812,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_LIB_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -47496,23 +47853,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_LIB_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_LIB_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + fi fi @@ -47589,7 +47947,10 @@ if test "x$FOUND_FREETYPE" = xyes; then - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -47650,7 +48011,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -47691,27 +48052,31 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_INCLUDE_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_INCLUDE_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" - fi - - - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" + fi + fi + + + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -47772,7 +48137,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_LIB_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -47813,23 +48178,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_LIB_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_LIB_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + fi fi @@ -47906,7 +48272,10 @@ if test "x$FOUND_FREETYPE" = xyes; then - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -47967,7 +48336,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -48008,27 +48377,31 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_INCLUDE_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_INCLUDE_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" - fi - - - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" + fi + fi + + + # Only process if variable expands to non-empty + + if test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -48089,7 +48462,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$POTENTIAL_FREETYPE_LIB_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -48130,23 +48503,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$POTENTIAL_FREETYPE_LIB_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_LIB_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + fi fi @@ -48206,7 +48580,10 @@ # Set FREETYPE_CFLAGS, _LIBS and _LIB_PATH from include and lib dir. if test "x$FREETYPE_CFLAGS" = x; then - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$FREETYPE_INCLUDE_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -48267,7 +48644,7 @@ $as_echo "$as_me: Rewriting FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$FREETYPE_INCLUDE_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -48308,23 +48685,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$FREETYPE_INCLUDE_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$FREETYPE_INCLUDE_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" + fi fi if test -d $FREETYPE_INCLUDE_PATH/freetype2/freetype; then @@ -48336,7 +48714,10 @@ if test "x$FREETYPE_LIBS" = x; then - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$FREETYPE_LIB_PATH" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -48397,7 +48778,7 @@ $as_echo "$as_me: Rewriting FREETYPE_LIB_PATH to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$FREETYPE_LIB_PATH" has_colon=`$ECHO $path | $GREP ^.:` @@ -48438,23 +48819,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$FREETYPE_LIB_PATH" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$FREETYPE_LIB_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + fi fi if test "x$OPENJDK_TARGET_OS" = xwindows; then @@ -50252,7 +50634,10 @@ MSVCR_DLL=$MSVC_DLL - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$MSVCR_DLL" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -50313,7 +50698,7 @@ $as_echo "$as_me: Rewriting MSVCR_DLL to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$MSVCR_DLL" has_colon=`$ECHO $path | $GREP ^.:` @@ -50354,23 +50739,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$MSVCR_DLL" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVCR_DLL, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$MSVCR_DLL" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVCR_DLL, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of MSVCR_DLL, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of MSVCR_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - MSVCR_DLL="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of MSVCR_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + MSVCR_DLL="`cd "$path"; $THEPWDCMD -L`" + fi fi MSVCR_DLL=$MSVCR_DLL @@ -50753,7 +51139,10 @@ MSVCP_DLL=$MSVC_DLL - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + # Only process if variable expands to non-empty + + if test "x$MSVCP_DLL" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. @@ -50814,7 +51203,7 @@ $as_echo "$as_me: Rewriting MSVCP_DLL to \"$new_path\"" >&6;} fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then path="$MSVCP_DLL" has_colon=`$ECHO $path | $GREP ^.:` @@ -50855,23 +51244,24 @@ # Save the first 10 bytes of this path to the storage, so fixpath can work. all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") - else - # We're on a unix platform. Hooray! :) - path="$MSVCP_DLL" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVCP_DLL, which resolves as \"$path\", is invalid." >&5 + else + # We're on a unix platform. Hooray! :) + path="$MSVCP_DLL" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVCP_DLL, which resolves as \"$path\", is invalid." >&5 $as_echo "$as_me: The path of MSVCP_DLL, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 - fi - - # Use eval to expand a potential ~ - eval path="$path" - if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of MSVCP_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - MSVCP_DLL="`cd "$path"; $THEPWDCMD -L`" + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of MSVCP_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + MSVCP_DLL="`cd "$path"; $THEPWDCMD -L`" + fi fi MSVCP_DLL=$MSVCP_DLL diff -r 54c7d4e5261f -r d4bd9341ded3 common/autoconf/toolchain_windows.m4 --- a/common/autoconf/toolchain_windows.m4 Fri Feb 27 12:48:06 2015 -0500 +++ b/common/autoconf/toolchain_windows.m4 Mon Mar 02 05:32:01 2015 -0800 @@ -351,18 +351,34 @@ IFS=";" for i in $VS_INCLUDE; do ipath=$i - IFS="$OLDIFS" - BASIC_FIXUP_PATH([ipath]) - IFS=";" - SYSROOT_CFLAGS="$SYSROOT_CFLAGS -I$ipath" + # Only process non-empty elements + if test "x$ipath" != x; then + IFS="$OLDIFS" + # Check that directory exists before calling fixup_path + testpath=$ipath + BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([testpath]) + if test -d "$testpath"; then + BASIC_FIXUP_PATH([ipath]) + SYSROOT_CFLAGS="$SYSROOT_CFLAGS -I$ipath" + fi + IFS=";" + fi done # Convert VS_LIB into SYSROOT_LDFLAGS for i in $VS_LIB; do libpath=$i - IFS="$OLDIFS" - BASIC_FIXUP_PATH([libpath]) - IFS=";" - SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -libpath:$libpath" + # Only process non-empty elements + if test "x$libpath" != x; then + IFS="$OLDIFS" + # Check that directory exists before calling fixup_path + testpath=$libpath + BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([testpath]) + if test -d "$testpath"; then + BASIC_FIXUP_PATH([libpath]) + SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -libpath:$libpath" + fi + IFS=";" + fi done IFS="$OLDIFS" fi diff -r 54c7d4e5261f -r d4bd9341ded3 common/bin/unshuffle_list.txt --- a/common/bin/unshuffle_list.txt Fri Feb 27 12:48:06 2015 -0500 +++ b/common/bin/unshuffle_list.txt Mon Mar 02 05:32:01 2015 -0800 @@ -180,7 +180,6 @@ jdk/src/java.base/share/classes/sun/nio/cs : jdk/src/share/classes/sun/nio/cs jdk/src/java.base/share/classes/sun/nio/fs : jdk/src/share/classes/sun/nio/fs jdk/src/java.base/share/classes/sun/reflect : jdk/src/share/classes/sun/reflect -jdk/src/java.base/share/classes/sun/security/acl : jdk/src/share/classes/sun/security/acl jdk/src/java.base/share/classes/sun/security/action : jdk/src/share/classes/sun/security/action jdk/src/java.base/share/classes/sun/security/internal : jdk/src/share/classes/sun/security/internal jdk/src/java.base/share/classes/sun/security/jca : jdk/src/share/classes/sun/security/jca diff -r 54c7d4e5261f -r d4bd9341ded3 corba/.hgtags --- a/corba/.hgtags Fri Feb 27 12:48:06 2015 -0500 +++ b/corba/.hgtags Mon Mar 02 05:32:01 2015 -0800 @@ -294,3 +294,4 @@ 9285d14eb7b6b0815679bae98dd936dbc136218d jdk9-b49 224f593393e5b01b3c8f1e591b7f4b1790a3737a jdk9-b50 2309c02386d1fa4ced5051873ffb9e04874f7a44 jdk9-b51 +b8538bbb6f224ab1dabba579137099c166ad4724 jdk9-b52 diff -r 54c7d4e5261f -r d4bd9341ded3 corba/src/java.corba/share/classes/javax/rmi/CORBA/GetORBPropertiesFileAction.java --- a/corba/src/java.corba/share/classes/javax/rmi/CORBA/GetORBPropertiesFileAction.java Fri Feb 27 12:48:06 2015 -0500 +++ b/corba/src/java.corba/share/classes/javax/rmi/CORBA/GetORBPropertiesFileAction.java Mon Mar 02 05:32:01 2015 -0800 @@ -43,7 +43,6 @@ import java.security.AccessController; import java.security.PrivilegedAction; -import sun.security.action.GetPropertyAction; import java.util.Properties; class GetORBPropertiesFileAction implements PrivilegedAction { diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/.hgtags --- a/hotspot/.hgtags Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/.hgtags Mon Mar 02 05:32:01 2015 -0800 @@ -454,3 +454,4 @@ 360cd1fc42f10941a9fd17cc32d5b85a22d12a0b jdk9-b49 e0947f58c9c1426aa0d98b98ebb78357b27a7b99 jdk9-b50 403b9cbadb04d3d1201823591cf931dc93b38e3a jdk9-b51 +9fb7fdc554db5be5c5b10f88f529ec3b870c44e3 jdk9-b52 diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/GenCollectedHeap.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/GenCollectedHeap.java Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/GenCollectedHeap.java Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,8 @@ public class GenCollectedHeap extends SharedHeap { private static CIntegerField nGensField; - private static long gensOffset; + private static AddressField youngGenField; + private static AddressField oldGenField; private static AddressField genSpecsField; private static GenerationFactory genFactory; @@ -52,7 +53,8 @@ Type type = db.lookupType("GenCollectedHeap"); nGensField = type.getCIntegerField("_n_gens"); - gensOffset = type.getField("_gens").getOffset(); + youngGenField = type.getAddressField("_young_gen"); + oldGenField = type.getAddressField("_old_gen"); genSpecsField = type.getAddressField("_gen_specs"); genFactory = new GenerationFactory(); @@ -68,18 +70,19 @@ public Generation getGen(int i) { if (Assert.ASSERTS_ENABLED) { - Assert.that((i >= 0) && (i < nGens()), "Index " + i + - " out of range (should be between 0 and " + nGens() + ")"); + Assert.that((i == 0) || (i == 1), "Index " + i + + " out of range (should be 0 or 1)"); } - if ((i < 0) || (i >= nGens())) { + switch (i) { + case 0: + return genFactory.newObject(youngGenField.getValue(addr)); + case 1: + return genFactory.newObject(oldGenField.getValue(addr)); + default: + // no generation for i, and assertions disabled. return null; } - - Address genAddr = addr.getAddressAt(gensOffset + - (i * VM.getVM().getAddressSize())); - return genFactory.newObject(addr.getAddressAt(gensOffset + - (i * VM.getVM().getAddressSize()))); } public boolean isIn(Address a) { diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/make/test/JtregNative.gmk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/make/test/JtregNative.gmk Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,81 @@ +# +# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +################################################################################ +# This file builds the native component of the JTReg tests for Hotspot. +# It also covers the test-image part, where the built files are copied to the +# test image. +################################################################################ + +default: all + +include $(SPEC) +include MakeBase.gmk +include TestFilesCompilation.gmk + +################################################################################ +# Targets for building the native tests themselves. +################################################################################ + +# Add more directories here when needed. +BUILD_HOTSPOT_JTREG_NATIVE_SRC := \ + $(HOTSPOT_TOPDIR)/test/native_sanity \ + # + +BUILD_HOTSPOT_JTREG_OUTPUT_DIR := $(BUILD_OUTPUT)/support/test/hotspot/jtreg/native + +BUILD_HOTSPOT_JTREG_IMAGE_DIR := $(TEST_IMAGE_DIR)/hotspot/jtreg + +$(eval $(call SetupTestFilesCompilation, BUILD_HOTSPOT_JTREG_LIBRARIES, \ + TYPE := LIBRARY, \ + SOURCE_DIRS := $(BUILD_HOTSPOT_JTREG_NATIVE_SRC), \ + OUTPUT_DIR := $(BUILD_HOTSPOT_JTREG_OUTPUT_DIR), \ +)) + +$(eval $(call SetupTestFilesCompilation, BUILD_HOTSPOT_JTREG_EXECUTABLES, \ + TYPE := PROGRAM, \ + SOURCE_DIRS := $(BUILD_HOTSPOT_JTREG_NATIVE_SRC), \ + OUTPUT_DIR := $(BUILD_HOTSPOT_JTREG_OUTPUT_DIR), \ +)) + +build-test-hotspot-jtreg-native: $(BUILD_HOTSPOT_JTREG_LIBRARIES) $(BUILD_HOTSPOT_JTREG_EXECUTABLES) + +################################################################################ +# Targets for building test-image. +################################################################################ + +# Copy to hotspot jtreg test image +$(eval $(call SetupCopyFiles,COPY_HOTSPOT_JTREG_NATIVE, \ + SRC := $(BUILD_HOTSPOT_JTREG_OUTPUT_DIR), \ + DEST := $(TEST_IMAGE_DIR)/hotspot/jtreg/native, \ + FILES := $(BUILD_HOTSPOT_JTREG_LIBRARIES) $(BUILD_HOTSPOT_JTREG_EXECUTABLES), \ + FLATTEN := true)) + +test-image-hotspot-jtreg-native: $(COPY_HOTSPOT_JTREG_NATIVE) + +all: build-test-hotspot-jtreg-native +test-image: test-image-hotspot-jtreg-native + +.PHONY: default all build-test-hotspot-jtreg-native test-image-hotspot-jtreg-native test-image diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp --- a/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -26,8 +26,8 @@ #include "runtime/os.hpp" #include "vm_version_sparc.hpp" -static bool detect_niagara() { - char cpu[128]; +static bool cpuinfo_field_contains(const char* field, const char* value) { + char line[1024]; bool rv = false; FILE* fp = fopen("/proc/cpuinfo", "r"); @@ -35,9 +35,10 @@ return rv; } - while (!feof(fp)) { - if (fscanf(fp, "cpu\t\t: %100[^\n]", cpu) == 1) { - if (strstr(cpu, "Niagara") != NULL) { + while (fgets(line, sizeof(line), fp) != NULL) { + assert(strlen(line) < sizeof(line) - 1, "buffer line[1024] is too small."); + if (strncmp(line, field, strlen(field)) == 0) { + if (strstr(line, value) != NULL) { rv = true; } break; @@ -45,8 +46,15 @@ } fclose(fp); + return rv; +} - return rv; +static bool detect_niagara() { + return cpuinfo_field_contains("cpu", "Niagara"); +} + +static bool detect_blkinit() { + return cpuinfo_field_contains("cpucaps", "blkinit"); } int VM_Version::platform_features(int features) { @@ -58,5 +66,9 @@ features = niagara1_m | T_family_m; } + if (detect_blkinit()) { + features |= blk_init_instructions_m; + } + return features; } diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/ci/ciKlass.hpp --- a/hotspot/src/share/vm/ci/ciKlass.hpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/ci/ciKlass.hpp Mon Mar 02 05:32:01 2015 -0800 @@ -26,6 +26,7 @@ #define SHARE_VM_CI_CIKLASS_HPP #include "ci/ciType.hpp" +#include "oops/klass.hpp" // ciKlass // diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/classfile/classFileError.cpp --- a/hotspot/src/share/vm/classfile/classFileError.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/classfile/classFileError.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ #include "classfile/classFileParser.hpp" #include "classfile/stackMapTable.hpp" #include "classfile/verifier.hpp" +#include "memory/resourceArea.hpp" // Keep these in a separate file to prevent inlining diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/classfile/classFileParser.cpp --- a/hotspot/src/share/vm/classfile/classFileParser.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -38,6 +38,7 @@ #include "memory/metadataFactory.hpp" #include "memory/oopFactory.hpp" #include "memory/referenceType.hpp" +#include "memory/resourceArea.hpp" #include "memory/universe.inline.hpp" #include "oops/constantPool.hpp" #include "oops/fieldStreams.hpp" @@ -59,6 +60,7 @@ #include "services/threadService.hpp" #include "utilities/array.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/exceptions.hpp" #include "utilities/macros.hpp" #include "utilities/ostream.hpp" #include "utilities/resourceHash.hpp" @@ -313,6 +315,19 @@ return NULL; } +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED +void ClassFileParser::report_assert_property_failure(const char* msg, TRAPS) { + ResourceMark rm(THREAD); + fatal(err_msg(msg, _class_name->as_C_string())); +} + +void ClassFileParser::report_assert_property_failure(const char* msg, int index, TRAPS) { + ResourceMark rm(THREAD); + fatal(err_msg(msg, index, _class_name->as_C_string())); +} +PRAGMA_DIAG_POP + constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) { ClassFileStream* cfs = stream(); constantPoolHandle nullHandle; diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/classfile/classFileParser.hpp --- a/hotspot/src/share/vm/classfile/classFileParser.hpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/classfile/classFileParser.hpp Mon Mar 02 05:32:01 2015 -0800 @@ -26,12 +26,15 @@ #define SHARE_VM_CLASSFILE_CLASSFILEPARSER_HPP #include "classfile/classFileStream.hpp" -#include "memory/resourceArea.hpp" +#include "classfile/symbolTable.hpp" +#include "oops/annotations.hpp" +#include "oops/constantPool.hpp" #include "oops/typeArrayOop.hpp" #include "utilities/accessFlags.hpp" -#include "classfile/symbolTable.hpp" +class CompressedLineNumberWriteStream; class FieldAllocationCount; +class FieldInfo; class FieldLayoutInfo; @@ -315,13 +318,13 @@ if (!b) { classfile_parse_error(msg, CHECK); } } -PRAGMA_DIAG_PUSH -PRAGMA_FORMAT_NONLITERAL_IGNORED -inline void assert_property(bool b, const char* msg, TRAPS) { + void report_assert_property_failure(const char* msg, TRAPS); + void report_assert_property_failure(const char* msg, int index, TRAPS); + + inline void assert_property(bool b, const char* msg, TRAPS) { #ifdef ASSERT if (!b) { - ResourceMark rm(THREAD); - fatal(err_msg(msg, _class_name->as_C_string())); + report_assert_property_failure(msg, THREAD); } #endif } @@ -329,12 +332,10 @@ inline void assert_property(bool b, const char* msg, int index, TRAPS) { #ifdef ASSERT if (!b) { - ResourceMark rm(THREAD); - fatal(err_msg(msg, index, _class_name->as_C_string())); + report_assert_property_failure(msg, index, THREAD); } #endif } -PRAGMA_DIAG_POP inline void check_property(bool property, const char* msg, int index, TRAPS) { if (_need_verify) { diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/classfile/classLoaderExt.hpp --- a/hotspot/src/share/vm/classfile/classLoaderExt.hpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/classfile/classLoaderExt.hpp Mon Mar 02 05:32:01 2015 -0800 @@ -26,6 +26,8 @@ #define SHARE_VM_CLASSFILE_CLASSLOADEREXT_HPP #include "classfile/classLoader.hpp" +#include "oops/instanceKlass.hpp" +#include "runtime/handles.hpp" class ClassLoaderExt: public ClassLoader { // AllStatic public: diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/code/codeCache.cpp --- a/hotspot/src/share/vm/code/codeCache.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/code/codeCache.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -31,7 +31,6 @@ #include "code/nmethod.hpp" #include "code/pcDesc.hpp" #include "compiler/compileBroker.hpp" -#include "gc_implementation/shared/markSweep.hpp" #include "memory/allocation.inline.hpp" #include "memory/gcLocker.hpp" #include "memory/iterator.hpp" diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/code/dependencies.hpp --- a/hotspot/src/share/vm/code/dependencies.hpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/code/dependencies.hpp Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,7 @@ #include "classfile/systemDictionary.hpp" #include "code/compressedStream.hpp" #include "code/nmethod.hpp" +#include "memory/resourceArea.hpp" #include "utilities/growableArray.hpp" #include "utilities/hashtable.hpp" diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -869,7 +869,7 @@ if (prev_level >= 0) { size_t prev_size = 0; GenCollectedHeap* gch = GenCollectedHeap::heap(); - Generation* prev_gen = gch->_gens[prev_level]; + Generation* prev_gen = gch->get_gen(prev_level); prev_size = prev_gen->capacity(); gclog_or_tty->print_cr(" Younger gen size "SIZE_FORMAT, prev_size/1000); diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -37,7 +37,7 @@ _use_cache = true; _hot_cache_size = (size_t)1 << G1ConcRSLogCacheSize; - _hot_cache = NEW_C_HEAP_ARRAY(jbyte*, _hot_cache_size, mtGC); + _hot_cache = _hot_cache_memory.allocate(_hot_cache_size); reset_hot_cache_internal(); @@ -52,7 +52,8 @@ G1HotCardCache::~G1HotCardCache() { if (default_use_cache()) { assert(_hot_cache != NULL, "Logic"); - FREE_C_HEAP_ARRAY(jbyte*, _hot_cache); + _hot_cache_memory.free(); + _hot_cache = NULL; } } diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.hpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.hpp Mon Mar 02 05:32:01 2015 -0800 @@ -61,6 +61,8 @@ G1CardCounts _card_counts; + ArrayAllocator _hot_cache_memory; + // The card cache table jbyte** _hot_cache; diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -26,6 +26,8 @@ #include "gc_implementation/parallelScavenge/cardTableExtension.hpp" #include "gc_implementation/parallelScavenge/gcTaskManager.hpp" #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" +#include "gc_implementation/parallelScavenge/psPromotionManager.hpp" +#include "gc_implementation/parallelScavenge/psScavenge.hpp" #include "gc_implementation/parallelScavenge/psTasks.hpp" #include "gc_implementation/parallelScavenge/psYoungGen.hpp" #include "oops/oop.inline.hpp" diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -66,6 +66,15 @@ // for work stealing. } +// Helper functions to get around the circular dependency between +// psScavenge.inline.hpp and psPromotionManager.inline.hpp. +bool PSPromotionManager::should_scavenge(oop* p, bool check_to_space) { + return PSScavenge::should_scavenge(p, check_to_space); +} +bool PSPromotionManager::should_scavenge(narrowOop* p, bool check_to_space) { + return PSScavenge::should_scavenge(p, check_to_space); +} + PSPromotionManager* PSPromotionManager::gc_thread_promotion_manager(int index) { assert(index >= 0 && index < (int)ParallelGCThreads, "index out of range"); assert(_manager_array != NULL, "Sanity"); diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp Mon Mar 02 05:32:01 2015 -0800 @@ -203,6 +203,12 @@ inline void process_popped_location_depth(StarTask p); + static bool should_scavenge(oop* p, bool check_to_space = false); + static bool should_scavenge(narrowOop* p, bool check_to_space = false); + + template + void copy_and_push_safe_barrier(T* p); + template inline void claim_or_forward_depth(T* p); TASKQUEUE_STATS_ONLY(inline void record_steal(StarTask& p);) diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp Mon Mar 02 05:32:01 2015 -0800 @@ -56,7 +56,7 @@ template inline void PSPromotionManager::claim_or_forward_depth(T* p) { - assert(PSScavenge::should_scavenge(p, true), "revisiting object?"); + assert(should_scavenge(p, true), "revisiting object?"); assert(Universe::heap()->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); assert(Universe::heap()->is_in(p), "pointer outside heap"); @@ -98,7 +98,7 @@ // template oop PSPromotionManager::copy_to_survivor_space(oop o) { - assert(PSScavenge::should_scavenge(&o), "Sanity"); + assert(should_scavenge(&o), "Sanity"); oop new_obj = NULL; @@ -257,7 +257,7 @@ // information. if (TraceScavenge) { gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", - PSScavenge::should_scavenge(&new_obj) ? "copying" : "tenuring", + should_scavenge(&new_obj) ? "copying" : "tenuring", new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size()); } #endif @@ -265,6 +265,40 @@ return new_obj; } +// Attempt to "claim" oop at p via CAS, push the new obj if successful +// This version tests the oop* to make sure it is within the heap before +// attempting marking. +template +inline void PSPromotionManager::copy_and_push_safe_barrier(T* p) { + assert(should_scavenge(p, true), "revisiting object?"); + + oop o = oopDesc::load_decode_heap_oop_not_null(p); + oop new_obj = o->is_forwarded() + ? o->forwardee() + : copy_to_survivor_space(o); + +#ifndef PRODUCT + // This code must come after the CAS test, or it will print incorrect + // information. + if (TraceScavenge && o->is_forwarded()) { + gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", + "forwarding", + new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size()); + } +#endif + + oopDesc::encode_store_heap_oop_not_null(p, new_obj); + + // We cannot mark without test, as some code passes us pointers + // that are outside the heap. These pointers are either from roots + // or from metadata. + if ((!PSScavenge::is_obj_in_young((HeapWord*)p)) && + Universe::heap()->is_in_reserved(p)) { + if (PSScavenge::is_obj_in_young(new_obj)) { + PSScavenge::card_table()->inline_write_ref_field_gc(p, new_obj); + } + } +} inline void PSPromotionManager::process_popped_location_depth(StarTask p) { if (is_oop_masked(p)) { @@ -274,9 +308,9 @@ } else { if (p.is_narrow()) { assert(UseCompressedOops, "Error"); - PSScavenge::copy_and_push_safe_barrier(this, p); + copy_and_push_safe_barrier(p); } else { - PSScavenge::copy_and_push_safe_barrier(this, p); + copy_and_push_safe_barrier(p); } } } diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -105,7 +105,7 @@ // Weak refs may be visited more than once. if (PSScavenge::should_scavenge(p, _to_space)) { - PSScavenge::copy_and_push_safe_barrier(_promotion_manager, p); + _promotion_manager->copy_and_push_safe_barrier(p); } } virtual void do_oop(oop* p) { PSKeepAliveClosure::do_oop_work(p); } diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.hpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.hpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.hpp Mon Mar 02 05:32:01 2015 -0800 @@ -144,9 +144,6 @@ template static inline bool should_scavenge(T* p, MutableSpace* to_space); template static inline bool should_scavenge(T* p, bool check_to_space); - template - inline static void copy_and_push_safe_barrier(PSPromotionManager* pm, T* p); - static void copy_and_push_safe_barrier_from_klass(PSPromotionManager* pm, oop* p); // Is an object in the young generation diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp Mon Mar 02 05:32:01 2015 -0800 @@ -27,7 +27,6 @@ #include "gc_implementation/parallelScavenge/cardTableExtension.hpp" #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" -#include "gc_implementation/parallelScavenge/psPromotionManager.hpp" #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" #include "gc_implementation/parallelScavenge/psScavenge.hpp" #include "memory/iterator.hpp" @@ -63,42 +62,6 @@ return should_scavenge(p); } -// Attempt to "claim" oop at p via CAS, push the new obj if successful -// This version tests the oop* to make sure it is within the heap before -// attempting marking. -template -inline void PSScavenge::copy_and_push_safe_barrier(PSPromotionManager* pm, - T* p) { - assert(should_scavenge(p, true), "revisiting object?"); - - oop o = oopDesc::load_decode_heap_oop_not_null(p); - oop new_obj = o->is_forwarded() - ? o->forwardee() - : pm->copy_to_survivor_space(o); - -#ifndef PRODUCT - // This code must come after the CAS test, or it will print incorrect - // information. - if (TraceScavenge && o->is_forwarded()) { - gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", - "forwarding", - new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size()); - } -#endif - - oopDesc::encode_store_heap_oop_not_null(p, new_obj); - - // We cannot mark without test, as some code passes us pointers - // that are outside the heap. These pointers are either from roots - // or from metadata. - if ((!PSScavenge::is_obj_in_young((HeapWord*)p)) && - Universe::heap()->is_in_reserved(p)) { - if (PSScavenge::is_obj_in_young(new_obj)) { - card_table()->inline_write_ref_field_gc(p, new_obj); - } - } -} - template class PSRootsClosure: public OopClosure { private: @@ -108,7 +71,7 @@ template void do_oop_work(T *p) { if (PSScavenge::should_scavenge(p)) { // We never card mark roots, maybe call a func without test? - PSScavenge::copy_and_push_safe_barrier(_promotion_manager, p); + _promotion_manager->copy_and_push_safe_barrier(p); } } public: diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/interpreter/interpreter.hpp --- a/hotspot/src/share/vm/interpreter/interpreter.hpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/interpreter/interpreter.hpp Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,7 @@ #include "code/stubs.hpp" #include "interpreter/cppInterpreter.hpp" #include "interpreter/templateInterpreter.hpp" +#include "memory/resourceArea.hpp" #ifdef ZERO #ifdef TARGET_ARCH_zero # include "entry_zero.hpp" diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/memory/collectorPolicy.cpp --- a/hotspot/src/share/vm/memory/collectorPolicy.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -965,32 +965,38 @@ } static void test_old_size() { - size_t flag_value; + size_t flag_value; + size_t heap_alignment = CollectorPolicy::compute_heap_alignment(); - save_flags(); + save_flags(); - // If OldSize is set on the command line, it should be used - // for both min and initial old size if less than min heap. - flag_value = 20 * M; - set_basic_flag_values(); - FLAG_SET_CMDLINE(uintx, OldSize, flag_value); - verify_old_min(flag_value); + // If OldSize is set on the command line, it should be used + // for both min and initial old size if less than min heap. + flag_value = 20 * M; + set_basic_flag_values(); + FLAG_SET_CMDLINE(uintx, OldSize, flag_value); + verify_old_min(flag_value); - set_basic_flag_values(); - FLAG_SET_CMDLINE(uintx, OldSize, flag_value); - verify_old_initial(flag_value); + set_basic_flag_values(); + FLAG_SET_CMDLINE(uintx, OldSize, flag_value); + // Calculate what we expect the flag to be. + size_t expected_old_initial = align_size_up(InitialHeapSize, heap_alignment) - MaxNewSize; + verify_old_initial(expected_old_initial); - // If MaxNewSize is large, the maximum OldSize will be less than - // what's requested on the command line and it should be reset - // ergonomically. - flag_value = 30 * M; - set_basic_flag_values(); - FLAG_SET_CMDLINE(uintx, OldSize, flag_value); - FLAG_SET_CMDLINE(uintx, MaxNewSize, 170*M); - // Calculate what we expect the flag to be. - flag_value = MaxHeapSize - MaxNewSize; - verify_old_initial(flag_value); - + // If MaxNewSize is large, the maximum OldSize will be less than + // what's requested on the command line and it should be reset + // ergonomically. + // We intentionally set MaxNewSize + OldSize > MaxHeapSize (see over_size). + flag_value = 30 * M; + set_basic_flag_values(); + FLAG_SET_CMDLINE(uintx, OldSize, flag_value); + size_t over_size = 20*M; + size_t new_size_value = align_size_up(MaxHeapSize, heap_alignment) - flag_value + over_size; + FLAG_SET_CMDLINE(uintx, MaxNewSize, new_size_value); + // Calculate what we expect the flag to be. + expected_old_initial = align_size_up(MaxHeapSize, heap_alignment) - MaxNewSize; + verify_old_initial(expected_old_initial); + restore_flags(); } static void verify_young_min(size_t expected) { @@ -1011,6 +1017,12 @@ MarkSweepPolicy msp; msp.initialize_all(); + if (InitialHeapSize > initial_heap_size) { + // InitialHeapSize was adapted by msp.initialize_all, e.g. due to alignment + // caused by 64K page size. + initial_heap_size = InitialHeapSize; + } + size_t expected = msp.scale_by_NewRatio_aligned(initial_heap_size); assert(msp.initial_young_size() == expected, err_msg("%zu != %zu", msp.initial_young_size(), expected)); assert(FLAG_IS_ERGO(NewSize) && NewSize == expected, diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/memory/defNewGeneration.cpp --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -383,7 +383,7 @@ assert(next_level < gch->_n_gens, "DefNewGeneration cannot be an oldest gen"); - Generation* next_gen = gch->_gens[next_level]; + Generation* next_gen = gch->get_gen(next_level); size_t old_size = next_gen->capacity(); size_t new_size_before = _virtual_space.committed_size(); size_t min_new_size = spec()->init_size(); diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/memory/genCollectedHeap.cpp --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -86,6 +86,7 @@ int i; _n_gens = gen_policy()->number_of_generations(); + assert(_n_gens == 2, "There is no support for more than two generations"); // While there are no constraints in the GC code that HeapWordSize // be any particular value, there are multiple other areas in the @@ -126,11 +127,12 @@ _gch = this; - for (i = 0; i < _n_gens; i++) { - ReservedSpace this_rs = heap_rs.first_part(_gen_specs[i]->max_size(), false, false); - _gens[i] = _gen_specs[i]->init(this_rs, i, rem_set()); - heap_rs = heap_rs.last_part(_gen_specs[i]->max_size()); - } + ReservedSpace young_rs = heap_rs.first_part(_gen_specs[0]->max_size(), false, false); + _young_gen = _gen_specs[0]->init(young_rs, 0, rem_set()); + heap_rs = heap_rs.last_part(_gen_specs[0]->max_size()); + + ReservedSpace old_rs = heap_rs.first_part(_gen_specs[1]->max_size(), false, false); + _old_gen = _gen_specs[1]->init(old_rs, 1, rem_set()); clear_incremental_collection_failed(); #if INCLUDE_ALL_GCS @@ -145,7 +147,6 @@ return JNI_OK; } - char* GenCollectedHeap::allocate(size_t alignment, ReservedSpace* heap_rs){ const char overflow_msg[] = "The size of the object heap + VM data exceeds " @@ -172,7 +173,6 @@ return heap_rs->base(); } - void GenCollectedHeap::post_initialize() { SharedHeap::post_initialize(); GenCollectorPolicy *policy = (GenCollectorPolicy *)collector_policy(); @@ -195,41 +195,30 @@ void GenCollectedHeap::ref_processing_init() { SharedHeap::ref_processing_init(); - for (int i = 0; i < _n_gens; i++) { - _gens[i]->ref_processor_init(); - } + _young_gen->ref_processor_init(); + _old_gen->ref_processor_init(); } size_t GenCollectedHeap::capacity() const { - size_t res = 0; - for (int i = 0; i < _n_gens; i++) { - res += _gens[i]->capacity(); - } - return res; + return _young_gen->capacity() + _old_gen->capacity(); } size_t GenCollectedHeap::used() const { - size_t res = 0; - for (int i = 0; i < _n_gens; i++) { - res += _gens[i]->used(); - } - return res; + return _young_gen->used() + _old_gen->used(); } // Save the "used_region" for generations level and lower. void GenCollectedHeap::save_used_regions(int level) { + assert(level >= 0, "Illegal level parameter"); assert(level < _n_gens, "Illegal level parameter"); - for (int i = level; i >= 0; i--) { - _gens[i]->save_used_region(); + if (level == 1) { + _old_gen->save_used_region(); } + _young_gen->save_used_region(); } size_t GenCollectedHeap::max_capacity() const { - size_t res = 0; - for (int i = 0; i < _n_gens; i++) { - res += _gens[i]->max_capacity(); - } - return res; + return _young_gen->max_capacity() + _old_gen->max_capacity(); } // Update the _full_collections_completed counter @@ -293,16 +282,20 @@ HeapWord* GenCollectedHeap::attempt_allocation(size_t size, bool is_tlab, bool first_only) { - HeapWord* res; - for (int i = 0; i < _n_gens; i++) { - if (_gens[i]->should_allocate(size, is_tlab)) { - res = _gens[i]->allocate(size, is_tlab); - if (res != NULL) return res; - else if (first_only) break; + HeapWord* res = NULL; + + if (_young_gen->should_allocate(size, is_tlab)) { + res = _young_gen->allocate(size, is_tlab); + if (res != NULL || first_only) { + return res; } } - // Otherwise... - return NULL; + + if (_old_gen->should_allocate(size, is_tlab)) { + res = _old_gen->allocate(size, is_tlab); + } + + return res; } HeapWord* GenCollectedHeap::mem_allocate(size_t size, @@ -322,12 +315,107 @@ (cause == GCCause::_java_lang_system_gc && ExplicitGCInvokesConcurrent)); } -void GenCollectedHeap::do_collection(bool full, +void GenCollectedHeap::collect_generation(Generation* gen, bool full, size_t size, + bool is_tlab, bool run_verification, bool clear_soft_refs, + bool restore_marks_for_biased_locking) { + // Timer for individual generations. Last argument is false: no CR + // FIXME: We should try to start the timing earlier to cover more of the GC pause + // The PrintGCDetails logging starts before we have incremented the GC id. We will do that later + // so we can assume here that the next GC id is what we want. + GCTraceTime t1(gen->short_name(), PrintGCDetails, false, NULL, GCId::peek()); + TraceCollectorStats tcs(gen->counters()); + TraceMemoryManagerStats tmms(gen->kind(),gc_cause()); + + size_t prev_used = gen->used(); + gen->stat_record()->invocations++; + gen->stat_record()->accumulated_time.start(); + + // Must be done anew before each collection because + // a previous collection will do mangling and will + // change top of some spaces. + record_gen_tops_before_GC(); + + if (PrintGC && Verbose) { + gclog_or_tty->print("level=%d invoke=%d size=" SIZE_FORMAT, + gen->level(), + gen->stat_record()->invocations, + size * HeapWordSize); + } + + if (run_verification && VerifyBeforeGC) { + HandleMark hm; // Discard invalid handles created during verification + Universe::verify(" VerifyBeforeGC:"); + } + COMPILER2_PRESENT(DerivedPointerTable::clear()); + + if (restore_marks_for_biased_locking) { + // We perform this mark word preservation work lazily + // because it's only at this point that we know whether we + // absolutely have to do it; we want to avoid doing it for + // scavenge-only collections where it's unnecessary + BiasedLocking::preserve_marks(); + } + + // Do collection work + { + // Note on ref discovery: For what appear to be historical reasons, + // GCH enables and disabled (by enqueing) refs discovery. + // In the future this should be moved into the generation's + // collect method so that ref discovery and enqueueing concerns + // are local to a generation. The collect method could return + // an appropriate indication in the case that notification on + // the ref lock was needed. This will make the treatment of + // weak refs more uniform (and indeed remove such concerns + // from GCH). XXX + + HandleMark hm; // Discard invalid handles created during gc + save_marks(); // save marks for all gens + // We want to discover references, but not process them yet. + // This mode is disabled in process_discovered_references if the + // generation does some collection work, or in + // enqueue_discovered_references if the generation returns + // without doing any work. + ReferenceProcessor* rp = gen->ref_processor(); + // If the discovery of ("weak") refs in this generation is + // atomic wrt other collectors in this configuration, we + // are guaranteed to have empty discovered ref lists. + if (rp->discovery_is_atomic()) { + rp->enable_discovery(); + rp->setup_policy(clear_soft_refs); + } else { + // collect() below will enable discovery as appropriate + } + gen->collect(full, clear_soft_refs, size, is_tlab); + if (!rp->enqueuing_is_done()) { + rp->enqueue_discovered_references(); + } else { + rp->set_enqueuing_is_done(false); + } + rp->verify_no_references_recorded(); + } + + COMPILER2_PRESENT(DerivedPointerTable::update_pointers()); + + gen->stat_record()->accumulated_time.stop(); + + update_gc_stats(gen->level(), full); + + if (run_verification && VerifyAfterGC) { + HandleMark hm; // Discard invalid handles created during verification + Universe::verify(" VerifyAfterGC:"); + } + + if (PrintGCDetails) { + gclog_or_tty->print(":"); + gen->print_heap_change(prev_used); + } +} + +void GenCollectedHeap::do_collection(bool full, bool clear_all_soft_refs, size_t size, bool is_tlab, int max_level) { - bool prepared_for_verification = false; ResourceMark rm; DEBUG_ONLY(Thread* my_thread = Thread::current();) @@ -367,141 +455,62 @@ increment_total_collections(complete); size_t gch_prev_used = used(); + bool run_verification = total_collections() >= VerifyGCStartAt; - int starting_level = 0; - if (full) { - // Search for the oldest generation which will collect all younger - // generations, and start collection loop there. - for (int i = max_level; i >= 0; i--) { - if (_gens[i]->full_collects_younger_generations()) { - starting_level = i; - break; - } + bool prepared_for_verification = false; + int max_level_collected = 0; + bool old_collects_young = (max_level == 1) && + full && + _old_gen->full_collects_younger_generations(); + if (!old_collects_young && + _young_gen->should_collect(full, size, is_tlab)) { + if (run_verification && VerifyGCLevel <= 0 && VerifyBeforeGC) { + prepare_for_verify(); + prepared_for_verification = true; + } + + assert(!_young_gen->performs_in_place_marking(), "No young generation do in place marking"); + collect_generation(_young_gen, + full, + size, + is_tlab, + run_verification && VerifyGCLevel <= 0, + do_clear_all_soft_refs, + false); + + if (size > 0 && (!is_tlab || _young_gen->supports_tlab_allocation()) && + size * HeapWordSize <= _young_gen->unsafe_max_alloc_nogc()) { + // Allocation request was met by young GC. + size = 0; } } bool must_restore_marks_for_biased_locking = false; - int max_level_collected = starting_level; - for (int i = starting_level; i <= max_level; i++) { - if (_gens[i]->should_collect(full, size, is_tlab)) { - if (i == n_gens() - 1) { // a major collection is to happen - if (!complete) { - // The full_collections increment was missed above. - increment_total_full_collections(); - } - pre_full_gc_dump(NULL); // do any pre full gc dumps - } - // Timer for individual generations. Last argument is false: no CR - // FIXME: We should try to start the timing earlier to cover more of the GC pause - // The PrintGCDetails logging starts before we have incremented the GC id. We will do that later - // so we can assume here that the next GC id is what we want. - GCTraceTime t1(_gens[i]->short_name(), PrintGCDetails, false, NULL, GCId::peek()); - TraceCollectorStats tcs(_gens[i]->counters()); - TraceMemoryManagerStats tmms(_gens[i]->kind(),gc_cause()); - - size_t prev_used = _gens[i]->used(); - _gens[i]->stat_record()->invocations++; - _gens[i]->stat_record()->accumulated_time.start(); - - // Must be done anew before each collection because - // a previous collection will do mangling and will - // change top of some spaces. - record_gen_tops_before_GC(); + if (max_level == 1 && _old_gen->should_collect(full, size, is_tlab)) { + if (!complete) { + // The full_collections increment was missed above. + increment_total_full_collections(); + } - if (PrintGC && Verbose) { - gclog_or_tty->print("level=%d invoke=%d size=" SIZE_FORMAT, - i, - _gens[i]->stat_record()->invocations, - size*HeapWordSize); - } - - if (VerifyBeforeGC && i >= VerifyGCLevel && - total_collections() >= VerifyGCStartAt) { - HandleMark hm; // Discard invalid handles created during verification - if (!prepared_for_verification) { - prepare_for_verify(); - prepared_for_verification = true; - } - Universe::verify(" VerifyBeforeGC:"); - } - COMPILER2_PRESENT(DerivedPointerTable::clear()); - - if (!must_restore_marks_for_biased_locking && - _gens[i]->performs_in_place_marking()) { - // We perform this mark word preservation work lazily - // because it's only at this point that we know whether we - // absolutely have to do it; we want to avoid doing it for - // scavenge-only collections where it's unnecessary - must_restore_marks_for_biased_locking = true; - BiasedLocking::preserve_marks(); - } + pre_full_gc_dump(NULL); // do any pre full gc dumps - // Do collection work - { - // Note on ref discovery: For what appear to be historical reasons, - // GCH enables and disabled (by enqueing) refs discovery. - // In the future this should be moved into the generation's - // collect method so that ref discovery and enqueueing concerns - // are local to a generation. The collect method could return - // an appropriate indication in the case that notification on - // the ref lock was needed. This will make the treatment of - // weak refs more uniform (and indeed remove such concerns - // from GCH). XXX + if (!prepared_for_verification && run_verification && + VerifyGCLevel <= 1 && VerifyBeforeGC) { + prepare_for_verify(); + } - HandleMark hm; // Discard invalid handles created during gc - save_marks(); // save marks for all gens - // We want to discover references, but not process them yet. - // This mode is disabled in process_discovered_references if the - // generation does some collection work, or in - // enqueue_discovered_references if the generation returns - // without doing any work. - ReferenceProcessor* rp = _gens[i]->ref_processor(); - // If the discovery of ("weak") refs in this generation is - // atomic wrt other collectors in this configuration, we - // are guaranteed to have empty discovered ref lists. - if (rp->discovery_is_atomic()) { - rp->enable_discovery(); - rp->setup_policy(do_clear_all_soft_refs); - } else { - // collect() below will enable discovery as appropriate - } - _gens[i]->collect(full, do_clear_all_soft_refs, size, is_tlab); - if (!rp->enqueuing_is_done()) { - rp->enqueue_discovered_references(); - } else { - rp->set_enqueuing_is_done(false); - } - rp->verify_no_references_recorded(); - } - max_level_collected = i; + assert(_old_gen->performs_in_place_marking(), "All old generations do in place marking"); + collect_generation(_old_gen, + full, + size, + is_tlab, + run_verification && VerifyGCLevel <= 1, + do_clear_all_soft_refs, + true); - // Determine if allocation request was met. - if (size > 0) { - if (!is_tlab || _gens[i]->supports_tlab_allocation()) { - if (size*HeapWordSize <= _gens[i]->unsafe_max_alloc_nogc()) { - size = 0; - } - } - } - - COMPILER2_PRESENT(DerivedPointerTable::update_pointers()); - - _gens[i]->stat_record()->accumulated_time.stop(); - - update_gc_stats(i, full); - - if (VerifyAfterGC && i >= VerifyGCLevel && - total_collections() >= VerifyGCStartAt) { - HandleMark hm; // Discard invalid handles created during verification - Universe::verify(" VerifyAfterGC:"); - } - - if (PrintGCDetails) { - gclog_or_tty->print(":"); - _gens[i]->print_heap_change(prev_used); - } - } + must_restore_marks_for_biased_locking = true; + max_level_collected = 1; } // Update "complete" boolean wrt what actually transpired -- @@ -523,10 +532,11 @@ } } - for (int j = max_level_collected; j >= 0; j -= 1) { - // Adjust generation sizes. - _gens[j]->compute_new_size(); + // Adjust generation sizes. + if (max_level_collected == 1) { + _old_gen->compute_new_size(); } + _young_gen->compute_new_size(); if (complete) { // Delete metaspaces for unloaded class loaders and clean up loader_data graph @@ -583,18 +593,18 @@ if (younger_gens_as_roots) { if (!_gen_process_roots_tasks->is_task_claimed(GCH_PS_younger_gens)) { - for (int i = 0; i < level; i++) { - not_older_gens->set_generation(_gens[i]); - _gens[i]->oop_iterate(not_older_gens); + if (level == 1) { + not_older_gens->set_generation(_young_gen); + _young_gen->oop_iterate(not_older_gens); } not_older_gens->reset_generation(); } } // When collection is parallel, all threads get to cooperate to do // older-gen scanning. - for (int i = level+1; i < _n_gens; i++) { - older_gens->set_generation(_gens[i]); - rem_set()->younger_refs_iterate(_gens[i], older_gens); + if (level == 0) { + older_gens->set_generation(_old_gen); + rem_set()->younger_refs_iterate(_old_gen, older_gens); older_gens->reset_generation(); } @@ -635,9 +645,8 @@ void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) { SharedHeap::process_weak_roots(root_closure); // "Local" "weak" refs - for (int i = 0; i < _n_gens; i++) { - _gens[i]->ref_processor()->weak_oops_do(root_closure); - } + _young_gen->ref_processor()->weak_oops_do(root_closure); + _old_gen->ref_processor()->weak_oops_do(root_closure); } #define GCH_SINCE_SAVE_MARKS_ITERATE_DEFN(OopClosureType, nv_suffix) \ @@ -645,9 +654,11 @@ oop_since_save_marks_iterate(int level, \ OopClosureType* cur, \ OopClosureType* older) { \ - _gens[level]->oop_since_save_marks_iterate##nv_suffix(cur); \ - for (int i = level+1; i < n_gens(); i++) { \ - _gens[i]->oop_since_save_marks_iterate##nv_suffix(older); \ + if (level == 0) { \ + _young_gen->oop_since_save_marks_iterate##nv_suffix(cur); \ + _old_gen->oop_since_save_marks_iterate##nv_suffix(older); \ + } else { \ + _old_gen->oop_since_save_marks_iterate##nv_suffix(cur); \ } \ } @@ -656,22 +667,22 @@ #undef GCH_SINCE_SAVE_MARKS_ITERATE_DEFN bool GenCollectedHeap::no_allocs_since_save_marks(int level) { - for (int i = level; i < _n_gens; i++) { - if (!_gens[i]->no_allocs_since_save_marks()) return false; + if (level == 0 && !_young_gen->no_allocs_since_save_marks()) { + return false; } - return true; + return _old_gen->no_allocs_since_save_marks(); } bool GenCollectedHeap::supports_inline_contig_alloc() const { - return _gens[0]->supports_inline_contig_alloc(); + return _young_gen->supports_inline_contig_alloc(); } HeapWord** GenCollectedHeap::top_addr() const { - return _gens[0]->top_addr(); + return _young_gen->top_addr(); } HeapWord** GenCollectedHeap::end_addr() const { - return _gens[0]->end_addr(); + return _young_gen->end_addr(); } // public collection interfaces @@ -734,12 +745,12 @@ #if INCLUDE_ALL_GCS bool GenCollectedHeap::create_cms_collector() { - assert(_gens[1]->kind() == Generation::ConcurrentMarkSweep, + assert(_old_gen->kind() == Generation::ConcurrentMarkSweep, "Unexpected generation kinds"); // Skip two header words in the block content verification NOT_PRODUCT(_skip_header_HeapWords = CMSCollector::skip_header_HeapWords();) CMSCollector* collector = new CMSCollector( - (ConcurrentMarkSweepGeneration*)_gens[1], + (ConcurrentMarkSweepGeneration*)_old_gen, _rem_set->as_CardTableRS(), (ConcurrentMarkSweepPolicy*) collector_policy()); @@ -806,8 +817,8 @@ } bool GenCollectedHeap::is_in_young(oop p) { - bool result = ((HeapWord*)p) < _gens[_n_gens - 1]->reserved().start(); - assert(result == _gens[0]->is_in_reserved(p), + bool result = ((HeapWord*)p) < _old_gen->reserved().start(); + assert(result == _young_gen->is_in_reserved(p), err_msg("incorrect test - result=%d, p=" INTPTR_FORMAT, result, p2i((void*)p))); return result; } @@ -825,13 +836,7 @@ VMError::fatal_error_in_progress(), "too expensive"); #endif - // This might be sped up with a cache of the last generation that - // answered yes. - for (int i = 0; i < _n_gens; i++) { - if (_gens[i]->is_in(p)) return true; - } - // Otherwise... - return false; + return _young_gen->is_in(p) || _old_gen->is_in(p); } #ifdef ASSERT @@ -840,114 +845,97 @@ bool GenCollectedHeap::is_in_partial_collection(const void* p) { assert(is_in_reserved(p) || p == NULL, "Does not work if address is non-null and outside of the heap"); - return p < _gens[_n_gens - 2]->reserved().end() && p != NULL; + return p < _young_gen->reserved().end() && p != NULL; } #endif void GenCollectedHeap::oop_iterate(ExtendedOopClosure* cl) { - for (int i = 0; i < _n_gens; i++) { - _gens[i]->oop_iterate(cl); - } + _young_gen->oop_iterate(cl); + _old_gen->oop_iterate(cl); } void GenCollectedHeap::object_iterate(ObjectClosure* cl) { - for (int i = 0; i < _n_gens; i++) { - _gens[i]->object_iterate(cl); - } + _young_gen->object_iterate(cl); + _old_gen->object_iterate(cl); } void GenCollectedHeap::safe_object_iterate(ObjectClosure* cl) { - for (int i = 0; i < _n_gens; i++) { - _gens[i]->safe_object_iterate(cl); - } + _young_gen->safe_object_iterate(cl); + _old_gen->safe_object_iterate(cl); } Space* GenCollectedHeap::space_containing(const void* addr) const { - for (int i = 0; i < _n_gens; i++) { - Space* res = _gens[i]->space_containing(addr); - if (res != NULL) return res; + Space* res = _young_gen->space_containing(addr); + if (res != NULL) { + return res; } - // Otherwise... - assert(false, "Could not find containing space"); - return NULL; + res = _old_gen->space_containing(addr); + assert(res != NULL, "Could not find containing space"); + return res; } - HeapWord* GenCollectedHeap::block_start(const void* addr) const { assert(is_in_reserved(addr), "block_start of address outside of heap"); - for (int i = 0; i < _n_gens; i++) { - if (_gens[i]->is_in_reserved(addr)) { - assert(_gens[i]->is_in(addr), - "addr should be in allocated part of generation"); - return _gens[i]->block_start(addr); - } + if (_young_gen->is_in_reserved(addr)) { + assert(_young_gen->is_in(addr), "addr should be in allocated part of generation"); + return _young_gen->block_start(addr); } - assert(false, "Some generation should contain the address"); - return NULL; + + assert(_old_gen->is_in_reserved(addr), "Some generation should contain the address"); + assert(_old_gen->is_in(addr), "addr should be in allocated part of generation"); + return _old_gen->block_start(addr); } size_t GenCollectedHeap::block_size(const HeapWord* addr) const { assert(is_in_reserved(addr), "block_size of address outside of heap"); - for (int i = 0; i < _n_gens; i++) { - if (_gens[i]->is_in_reserved(addr)) { - assert(_gens[i]->is_in(addr), - "addr should be in allocated part of generation"); - return _gens[i]->block_size(addr); - } + if (_young_gen->is_in_reserved(addr)) { + assert(_young_gen->is_in(addr), "addr should be in allocated part of generation"); + return _young_gen->block_size(addr); } - assert(false, "Some generation should contain the address"); - return 0; + + assert(_old_gen->is_in_reserved(addr), "Some generation should contain the address"); + assert(_old_gen->is_in(addr), "addr should be in allocated part of generation"); + return _old_gen->block_size(addr); } bool GenCollectedHeap::block_is_obj(const HeapWord* addr) const { assert(is_in_reserved(addr), "block_is_obj of address outside of heap"); assert(block_start(addr) == addr, "addr must be a block start"); - for (int i = 0; i < _n_gens; i++) { - if (_gens[i]->is_in_reserved(addr)) { - return _gens[i]->block_is_obj(addr); - } + if (_young_gen->is_in_reserved(addr)) { + return _young_gen->block_is_obj(addr); } - assert(false, "Some generation should contain the address"); - return false; + + assert(_old_gen->is_in_reserved(addr), "Some generation should contain the address"); + return _old_gen->block_is_obj(addr); } bool GenCollectedHeap::supports_tlab_allocation() const { - for (int i = 0; i < _n_gens; i += 1) { - if (_gens[i]->supports_tlab_allocation()) { - return true; - } - } - return false; + assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!"); + return _young_gen->supports_tlab_allocation(); } size_t GenCollectedHeap::tlab_capacity(Thread* thr) const { - size_t result = 0; - for (int i = 0; i < _n_gens; i += 1) { - if (_gens[i]->supports_tlab_allocation()) { - result += _gens[i]->tlab_capacity(); - } + assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!"); + if (_young_gen->supports_tlab_allocation()) { + return _young_gen->tlab_capacity(); } - return result; + return 0; } size_t GenCollectedHeap::tlab_used(Thread* thr) const { - size_t result = 0; - for (int i = 0; i < _n_gens; i += 1) { - if (_gens[i]->supports_tlab_allocation()) { - result += _gens[i]->tlab_used(); - } + assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!"); + if (_young_gen->supports_tlab_allocation()) { + return _young_gen->tlab_used(); } - return result; + return 0; } size_t GenCollectedHeap::unsafe_max_tlab_alloc(Thread* thr) const { - size_t result = 0; - for (int i = 0; i < _n_gens; i += 1) { - if (_gens[i]->supports_tlab_allocation()) { - result += _gens[i]->unsafe_max_tlab_alloc(); - } + assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!"); + if (_young_gen->supports_tlab_allocation()) { + return _young_gen->unsafe_max_tlab_alloc(); } - return result; + return 0; } HeapWord* GenCollectedHeap::allocate_new_tlab(size_t size) { @@ -996,17 +984,15 @@ ScratchBlock* GenCollectedHeap::gather_scratch(Generation* requestor, size_t max_alloc_words) { ScratchBlock* res = NULL; - for (int i = 0; i < _n_gens; i++) { - _gens[i]->contribute_scratch(res, requestor, max_alloc_words); - } + _young_gen->contribute_scratch(res, requestor, max_alloc_words); + _old_gen->contribute_scratch(res, requestor, max_alloc_words); sort_scratch_list(res); return res; } void GenCollectedHeap::release_scratch() { - for (int i = 0; i < _n_gens; i++) { - _gens[i]->reset_scratch(); - } + _young_gen->reset_scratch(); + _old_gen->reset_scratch(); } class GenPrepareForVerifyClosure: public GenCollectedHeap::GenClosure { @@ -1021,39 +1007,29 @@ generation_iterate(&blk, false); } - void GenCollectedHeap::generation_iterate(GenClosure* cl, bool old_to_young) { if (old_to_young) { - for (int i = _n_gens-1; i >= 0; i--) { - cl->do_generation(_gens[i]); - } + cl->do_generation(_old_gen); + cl->do_generation(_young_gen); } else { - for (int i = 0; i < _n_gens; i++) { - cl->do_generation(_gens[i]); - } + cl->do_generation(_young_gen); + cl->do_generation(_old_gen); } } void GenCollectedHeap::space_iterate(SpaceClosure* cl) { - for (int i = 0; i < _n_gens; i++) { - _gens[i]->space_iterate(cl, true); - } + _young_gen->space_iterate(cl, true); + _old_gen->space_iterate(cl, true); } bool GenCollectedHeap::is_maximal_no_gc() const { - for (int i = 0; i < _n_gens; i++) { - if (!_gens[i]->is_maximal_no_gc()) { - return false; - } - } - return true; + return _young_gen->is_maximal_no_gc() && _old_gen->is_maximal_no_gc(); } void GenCollectedHeap::save_marks() { - for (int i = 0; i < _n_gens; i++) { - _gens[i]->save_marks(); - } + _young_gen->save_marks(); + _old_gen->save_marks(); } GenCollectedHeap* GenCollectedHeap::heap() { @@ -1065,27 +1041,33 @@ void GenCollectedHeap::prepare_for_compaction() { guarantee(_n_gens = 2, "Wrong number of generations"); - Generation* old_gen = _gens[1]; // Start by compacting into same gen. - CompactPoint cp(old_gen); - old_gen->prepare_for_compaction(&cp); - Generation* young_gen = _gens[0]; - young_gen->prepare_for_compaction(&cp); + CompactPoint cp(_old_gen); + _old_gen->prepare_for_compaction(&cp); + _young_gen->prepare_for_compaction(&cp); } GCStats* GenCollectedHeap::gc_stats(int level) const { - return _gens[level]->gc_stats(); + if (level == 0) { + return _young_gen->gc_stats(); + } else { + return _old_gen->gc_stats(); + } } void GenCollectedHeap::verify(bool silent, VerifyOption option /* ignored */) { - for (int i = _n_gens-1; i >= 0; i--) { - Generation* g = _gens[i]; - if (!silent) { - gclog_or_tty->print("%s", g->name()); - gclog_or_tty->print(" "); - } - g->verify(); + if (!silent) { + gclog_or_tty->print("%s", _old_gen->name()); + gclog_or_tty->print(" "); } + _old_gen->verify(); + + if (!silent) { + gclog_or_tty->print("%s", _young_gen->name()); + gclog_or_tty->print(" "); + } + _young_gen->verify(); + if (!silent) { gclog_or_tty->print("remset "); } @@ -1093,9 +1075,8 @@ } void GenCollectedHeap::print_on(outputStream* st) const { - for (int i = 0; i < _n_gens; i++) { - _gens[i]->print_on(st); - } + _young_gen->print_on(st); + _old_gen->print_on(st); MetaspaceAux::print_on(st); } diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/memory/genCollectedHeap.hpp --- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp Mon Mar 02 05:32:01 2015 -0800 @@ -33,7 +33,7 @@ class SubTasksDone; // A "GenCollectedHeap" is a SharedHeap that uses generational -// collection. It is represented with a sequence of Generation's. +// collection. It has two generations, young and old. class GenCollectedHeap : public SharedHeap { friend class GenCollectorPolicy; friend class Generation; @@ -63,7 +63,10 @@ private: int _n_gens; - Generation* _gens[max_gens]; + + Generation* _young_gen; + Generation* _old_gen; + GenerationSpec** _gen_specs; // The singleton Gen Remembered Set. @@ -85,6 +88,11 @@ SubTasksDone* _gen_process_roots_tasks; SubTasksDone* gen_process_roots_tasks() { return _gen_process_roots_tasks; } + // Collects the given generation. + void collect_generation(Generation* gen, bool full, size_t size, bool is_tlab, + bool run_verification, bool clear_soft_refs, + bool restore_marks_for_biased_locking); + // In block contents verification, the number of header words to skip NOT_PRODUCT(static size_t _skip_header_HeapWords;) @@ -138,8 +146,12 @@ return CollectedHeap::GenCollectedHeap; } + Generation* young_gen() { return _young_gen; } + Generation* old_gen() { return _old_gen; } + // The generational collector policy. GenCollectorPolicy* gen_policy() const { return _gen_policy; } + virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) gen_policy(); } // Adaptive size policy @@ -309,20 +321,17 @@ // Update above counter, as appropriate, at the end of a concurrent GC cycle unsigned int update_full_collections_completed(unsigned int count); - // Update "time of last gc" for all constituent generations - // to "now". + // Update "time of last gc" for all generations to "now". void update_time_of_last_gc(jlong now) { - for (int i = 0; i < _n_gens; i++) { - _gens[i]->update_time_of_last_gc(now); - } + _young_gen->update_time_of_last_gc(now); + _old_gen->update_time_of_last_gc(now); } // Update the gc statistics for each generation. // "level" is the level of the latest collection. void update_gc_stats(int current_level, bool full) { - for (int i = 0; i < _n_gens; i++) { - _gens[i]->update_gc_stats(current_level, full); - } + _young_gen->update_gc_stats(current_level, full); + _old_gen->update_gc_stats(current_level, full); } // Override. @@ -366,21 +375,23 @@ // Return the generation before "gen". Generation* prev_gen(Generation* gen) const { - int l = gen->level(); - guarantee(l > 0, "Out of bounds"); - return _gens[l-1]; + guarantee(gen->level() == 1, "Out of bounds"); + return _young_gen; } // Return the generation after "gen". Generation* next_gen(Generation* gen) const { - int l = gen->level() + 1; - guarantee(l < _n_gens, "Out of bounds"); - return _gens[l]; + guarantee(gen->level() == 0, "Out of bounds"); + return _old_gen; } Generation* get_gen(int i) const { - guarantee(i >= 0 && i < _n_gens, "Out of bounds"); - return _gens[i]; + guarantee(i == 0 || i == 1, "Out of bounds"); + if (i == 0) { + return _young_gen; + } else { + return _old_gen; + } } int n_gens() const { diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/memory/genMarkSweep.cpp --- a/hotspot/src/share/vm/memory/genMarkSweep.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -159,7 +159,7 @@ GenCollectedHeap* gch = GenCollectedHeap::heap(); // Scratch request on behalf of oldest generation; will do no // allocation. - ScratchBlock* scratch = gch->gather_scratch(gch->_gens[gch->_n_gens-1], 0); + ScratchBlock* scratch = gch->gather_scratch(gch->get_gen(gch->_n_gens-1), 0); // $$$ To cut a corner, we'll only use the first scratch block, and then // revert to malloc. diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/memory/genRemSet.cpp --- a/hotspot/src/share/vm/memory/genRemSet.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/memory/genRemSet.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -26,6 +26,7 @@ #include "classfile/classLoaderData.hpp" #include "memory/cardTableRS.hpp" #include "memory/genRemSet.hpp" +#include "oops/klass.hpp" // This kind of "BarrierSet" allows a "CollectedHeap" to detect and // enumerate ref fields that have been modified (since the last diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/memory/generation.cpp --- a/hotspot/src/share/vm/memory/generation.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/memory/generation.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -155,7 +155,7 @@ GenCollectedHeap* gch = GenCollectedHeap::heap(); int next = level() + 1; if (next < gch->_n_gens) { - return gch->_gens[next]; + return gch->get_gen(next); } else { return NULL; } diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/oops/cpCache.cpp --- a/hotspot/src/share/vm/oops/cpCache.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/oops/cpCache.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -23,7 +23,6 @@ */ #include "precompiled.hpp" -#include "gc_implementation/shared/markSweep.inline.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/rewriter.hpp" #include "memory/universe.inline.hpp" diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp --- a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -41,7 +41,6 @@ #if INCLUDE_ALL_GCS #include "gc_implementation/parNew/parOopClosures.inline.hpp" #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" -#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" #include "oops/oop.pcgc.inline.hpp" #endif // INCLUDE_ALL_GCS diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/oops/klassVtable.cpp --- a/hotspot/src/share/vm/oops/klassVtable.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/oops/klassVtable.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -25,7 +25,6 @@ #include "precompiled.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" -#include "gc_implementation/shared/markSweep.inline.hpp" #include "memory/gcLocker.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.inline.hpp" diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/oops/oop.pcgc.inline.hpp --- a/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp Mon Mar 02 05:32:01 2015 -0800 @@ -33,7 +33,6 @@ #include "gc_implementation/parallelScavenge/psCompactionManager.hpp" #include "gc_implementation/parallelScavenge/psParallelCompact.hpp" #include "gc_implementation/parallelScavenge/psScavenge.hpp" -#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" #endif // INCLUDE_ALL_GCS inline void oopDesc::update_contents(ParCompactionManager* cm) { diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/oops/oop.psgc.inline.hpp --- a/hotspot/src/share/vm/oops/oop.psgc.inline.hpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/oops/oop.psgc.inline.hpp Mon Mar 02 05:32:01 2015 -0800 @@ -29,7 +29,6 @@ #if INCLUDE_ALL_GCS #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" #include "gc_implementation/parallelScavenge/psScavenge.hpp" -#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" #endif // INCLUDE_ALL_GCS // ParallelScavengeHeap methods diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/precompiled/precompiled.hpp --- a/hotspot/src/share/vm/precompiled/precompiled.hpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/precompiled/precompiled.hpp Mon Mar 02 05:32:01 2015 -0800 @@ -90,8 +90,6 @@ # include "gc_implementation/shared/gcUtil.hpp" # include "gc_implementation/shared/generationCounters.hpp" # include "gc_implementation/shared/immutableSpace.hpp" -# include "gc_implementation/shared/markSweep.hpp" -# include "gc_implementation/shared/markSweep.inline.hpp" # include "gc_implementation/shared/mutableSpace.hpp" # include "gc_implementation/shared/spaceCounters.hpp" # include "gc_implementation/shared/spaceDecorator.hpp" diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/runtime/handles.cpp --- a/hotspot/src/share/vm/runtime/handles.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/runtime/handles.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -214,4 +214,8 @@ area->_no_handle_mark_nesting = _no_handle_mark_nesting; } +bool instanceKlassHandle::is_instanceKlass(const Klass* k) { + return k->oop_is_instance(); +} + #endif diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/runtime/handles.hpp --- a/hotspot/src/share/vm/runtime/handles.hpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/runtime/handles.hpp Mon Mar 02 05:32:01 2015 -0800 @@ -25,7 +25,11 @@ #ifndef SHARE_VM_RUNTIME_HANDLES_HPP #define SHARE_VM_RUNTIME_HANDLES_HPP -#include "oops/klass.hpp" +#include "oops/oop.hpp" +#include "oops/oopsHierarchy.hpp" + +class InstanceKlass; +class Klass; //------------------------------------------------------------------------------------------------------------------------ // In order to preserve oops during garbage collection, they should be @@ -201,16 +205,16 @@ /* Constructors */ instanceKlassHandle () : KlassHandle() {} instanceKlassHandle (const Klass* k) : KlassHandle(k) { - assert(k == NULL || k->oop_is_instance(), - "illegal type"); + assert(k == NULL || is_instanceKlass(k), "illegal type"); } instanceKlassHandle (Thread* thread, const Klass* k) : KlassHandle(thread, k) { - assert(k == NULL || k->oop_is_instance(), - "illegal type"); + assert(k == NULL || is_instanceKlass(k), "illegal type"); } /* Access to klass part */ InstanceKlass* operator () () const { return (InstanceKlass*)obj(); } InstanceKlass* operator -> () const { return (InstanceKlass*)obj(); } + + debug_only(bool is_instanceKlass(const Klass* k)); }; diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/runtime/interfaceSupport.cpp --- a/hotspot/src/share/vm/runtime/interfaceSupport.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/runtime/interfaceSupport.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -23,7 +23,6 @@ */ #include "precompiled.hpp" -#include "gc_implementation/shared/markSweep.hpp" #include "gc_interface/collectedHeap.hpp" #include "gc_interface/collectedHeap.inline.hpp" #include "memory/genCollectedHeap.hpp" diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/runtime/java.cpp --- a/hotspot/src/share/vm/runtime/java.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/runtime/java.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -67,7 +67,6 @@ #if INCLUDE_ALL_GCS #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp" #include "gc_implementation/parallelScavenge/psScavenge.hpp" -#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" #endif // INCLUDE_ALL_GCS #ifdef COMPILER1 #include "c1/c1_Compiler.hpp" diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/runtime/vmStructs.cpp --- a/hotspot/src/share/vm/runtime/vmStructs.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -46,7 +46,6 @@ #include "compiler/oopMap.hpp" #include "compiler/compileBroker.hpp" #include "gc_implementation/shared/immutableSpace.hpp" -#include "gc_implementation/shared/markSweep.hpp" #include "gc_implementation/shared/mutableSpace.hpp" #include "gc_interface/collectedHeap.hpp" #include "interpreter/bytecodeInterpreter.hpp" @@ -552,8 +551,9 @@ nonstatic_field(GenerationSpec, _max_size, size_t) \ \ static_field(GenCollectedHeap, _gch, GenCollectedHeap*) \ + nonstatic_field(GenCollectedHeap, _young_gen, Generation*) \ + nonstatic_field(GenCollectedHeap, _old_gen, Generation*) \ nonstatic_field(GenCollectedHeap, _n_gens, int) \ - unchecked_nonstatic_field(GenCollectedHeap, _gens, sizeof(GenCollectedHeap::_gens)) /* NOTE: no type */ \ nonstatic_field(GenCollectedHeap, _gen_specs, GenerationSpec**) \ \ nonstatic_field(HeapWord, i, char*) \ diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/services/nmtDCmd.cpp --- a/hotspot/src/share/vm/services/nmtDCmd.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/services/nmtDCmd.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -22,7 +22,7 @@ * */ #include "precompiled.hpp" - +#include "memory/resourceArea.hpp" #include "runtime/mutexLocker.hpp" #include "services/nmtDCmd.hpp" #include "services/memReporter.hpp" diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/services/runtimeService.cpp --- a/hotspot/src/share/vm/services/runtimeService.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/services/runtimeService.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "classfile/classLoader.hpp" +#include "runtime/vm_version.hpp" #include "services/attachListener.hpp" #include "services/management.hpp" #include "services/runtimeService.hpp" diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/src/share/vm/utilities/debug.cpp --- a/hotspot/src/share/vm/utilities/debug.cpp Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/src/share/vm/utilities/debug.cpp Mon Mar 02 05:32:01 2015 -0800 @@ -30,7 +30,6 @@ #include "code/vtableStubs.hpp" #include "compiler/compileBroker.hpp" #include "compiler/disassembler.hpp" -#include "gc_implementation/shared/markSweep.hpp" #include "gc_interface/collectedHeap.hpp" #include "interpreter/bytecodeHistogram.hpp" #include "interpreter/interpreter.hpp" diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/test/Makefile --- a/hotspot/test/Makefile Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/test/Makefile Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ # -# Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -143,11 +143,24 @@ endif # Expect JPRT to set JAVA_ARGS (e.g. -server etc.) -JAVA_OPTIONS = +JAVA_OPTIONS = ifdef JAVA_ARGS JAVA_OPTIONS = $(JAVA_ARGS) endif +# jtreg -nativepath +# +# Local make tests will be TEST_IMAGE_DIR and JPRT with jprt.use.reg.test.bundle=true +# should be JPRT_TESTNATIVE_PATH +ifdef TEST_IMAGE_DIR + TESTNATIVE_DIR = $(TEST_IMAGE_DIR) +else ifdef JPRT_TESTNATIVE_PATH + TESTNATIVE_DIR = $(JPRT_TESTNATIVE_PATH) +endif +ifdef TESTNATIVE_DIR + JTREG_NATIVE_PATH = -nativepath:$(shell $(GETMIXEDPATH) "$(TESTNATIVE_DIR)/hotspot/jtreg/native") +endif + # Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results) ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip ifdef JPRT_ARCHIVE_BUNDLE @@ -303,6 +316,7 @@ -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport") \ -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork") \ -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \ + $(JTREG_NATIVE_PATH) \ $(JTREG_EXCLUSIONS) \ $(JTREG_TEST_OPTIONS) \ $(TEST_SELECTION) \ @@ -313,7 +327,7 @@ PHONY_LIST += jtreg_tests # flags used to execute java in test targets -TEST_FLAGS += -version -Xinternalversion -X -help +TEST_FLAGS += -version -Xinternalversion -X -help sanitytest: prep $(PRODUCT_HOME) @for flag in $(TEST_FLAGS); \ diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/test/TEST.groups --- a/hotspot/test/TEST.groups Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/test/TEST.groups Mon Mar 02 05:32:01 2015 -0800 @@ -332,6 +332,9 @@ hotspot_wbapitest = \ sanity/ +hotspot_native_sanity = \ + native_sanity + hotspot_compiler_1 = \ compiler/arraycopy/ \ compiler/c1/ \ diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java --- a/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java Fri Feb 27 12:48:06 2015 -0500 +++ b/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,6 +36,7 @@ import java.util.List; public class CompressedClassSpaceSizeInJmapHeap { + // Note that on some platforms it may require root privileges to run this test. public static void main(String[] args) throws Exception { if (!Platform.is64bit()) { // Compressed Class Space is only available on 64-bit JVMs diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/test/native_sanity/JniVersion.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/native_sanity/JniVersion.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + /* + * @test + * @run main/native JniVersion + */ +public class JniVersion { + + public static final int JNI_VERSION_1_8 = 0x00010008; + + public static void main(String... args) throws Exception { + System.loadLibrary("JniVersion"); + int res = getJniVersion(); + if (res < JNI_VERSION_1_8) { + throw new Exception("Unexpected value returned from getJniVersion(): 0x" + Integer.toHexString(res)); + } + } + + static native int getJniVersion(); +} diff -r 54c7d4e5261f -r d4bd9341ded3 hotspot/test/native_sanity/libJniVersion.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/native_sanity/libJniVersion.c Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#include + +JNIEXPORT jint JNICALL +Java_JniVersion_getJniVersion(JNIEnv *env, jclass clz) { + return (*env)->GetVersion(env); +} diff -r 54c7d4e5261f -r d4bd9341ded3 jaxp/.hgtags --- a/jaxp/.hgtags Fri Feb 27 12:48:06 2015 -0500 +++ b/jaxp/.hgtags Mon Mar 02 05:32:01 2015 -0800 @@ -294,3 +294,4 @@ 786058752e0ac3e48d7aef79e0885d29d6a2a7eb jdk9-b49 74ead7bddde19263fd463bc1bd87de84f27d1b5e jdk9-b50 7cb3674cbd8c06222851444285bb66b2952a2a5c jdk9-b51 +57b26c883d54f45912bc3885ccad3c6b80960b1f jdk9-b52 diff -r 54c7d4e5261f -r d4bd9341ded3 jaxws/.hgtags --- a/jaxws/.hgtags Fri Feb 27 12:48:06 2015 -0500 +++ b/jaxws/.hgtags Mon Mar 02 05:32:01 2015 -0800 @@ -297,3 +297,4 @@ 435a49db1de0589acc86b2cc5fd61d546f94b56c jdk9-b49 45a30e7ee623031a1532685512dd2c2d8e8fa0ad jdk9-b50 bb9cf97a5ac6aa1aa2a1034676d64413071f58ea jdk9-b51 +1d1e7704eca9c77ebe6a8705d17ac568801f7a3b jdk9-b52 diff -r 54c7d4e5261f -r d4bd9341ded3 jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/ClassFactory.java --- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/ClassFactory.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/ClassFactory.java Mon Mar 02 05:32:01 2015 -0800 @@ -30,6 +30,8 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.ref.WeakReference; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Map; import java.util.WeakHashMap; import java.util.logging.Level; @@ -85,19 +87,25 @@ if(consRef!=null) cons = consRef.get(); if(cons==null) { - try { - cons = clazz.getDeclaredConstructor(emptyClass); - } catch (NoSuchMethodException e) { - logger.log(Level.INFO,"No default constructor found on "+clazz,e); - NoSuchMethodError exp; - if(clazz.getDeclaringClass()!=null && !Modifier.isStatic(clazz.getModifiers())) { - exp = new NoSuchMethodError(Messages.NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS.format(clazz.getName())); - } else { - exp = new NoSuchMethodError(e.getMessage()); + cons = AccessController.doPrivileged(new PrivilegedAction>() { + @Override + public Constructor run() { + try { + return clazz.getDeclaredConstructor(emptyClass); + } catch (NoSuchMethodException e) { + logger.log(Level.INFO,"No default constructor found on "+clazz,e); + NoSuchMethodError exp; + if(clazz.getDeclaringClass()!=null && !Modifier.isStatic(clazz.getModifiers())) { + exp = new NoSuchMethodError(Messages.NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS + .format(clazz.getName())); + } else { + exp = new NoSuchMethodError(e.getMessage()); + } + exp.initCause(e); + throw exp; + } } - exp.initCause(e); - throw exp; - } + }); int classMod = clazz.getModifiers(); diff -r 54c7d4e5261f -r d4bd9341ded3 jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/BindingHelper.java --- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/BindingHelper.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/BindingHelper.java Mon Mar 02 05:32:01 2015 -0800 @@ -36,9 +36,6 @@ //TODO DOMHeader DOMMessage SAAJMessage StatefulInstanceResolver import com.sun.xml.internal.bind.unmarshaller.DOMScanner; -//TODO MtomCodec -import com.sun.xml.internal.bind.v2.runtime.output.Encoded; - //TODO ExceptionBean import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper; diff -r 54c7d4e5261f -r d4bd9341ded3 jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPConstants.java --- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPConstants.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPConstants.java Mon Mar 02 05:32:01 2015 -0800 @@ -25,8 +25,6 @@ package com.sun.tools.internal.ws.wsdl.document.soap; -import com.sun.xml.internal.ws.encoding.soap.streaming.SOAPNamespaceConstants; - import javax.xml.namespace.QName; /** @@ -37,7 +35,9 @@ public interface SOAPConstants { // namespace URIs - public static final String URI_ENVELOPE = SOAPNamespaceConstants.ENVELOPE; + public static final String URI_ENVELOPE = + "http://schemas.xmlsoap.org/soap/envelope/"; + public static final String NS_WSDL_SOAP = "http://schemas.xmlsoap.org/wsdl/soap/"; public static final String NS_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/"; diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/.hgtags --- a/jdk/.hgtags Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/.hgtags Mon Mar 02 05:32:01 2015 -0800 @@ -294,3 +294,4 @@ 541a8cef4e0d54c3e4b52a98c6af3c31e2096669 jdk9-b49 f6b8edd397ee463be208fee27517c99101293267 jdk9-b50 a0dad230aeb3b0d5cfd5b0715029e48d50573f8c jdk9-b51 +607ea68032cd4a4cf2c7a7a41fcb39602d6a75e2 jdk9-b52 diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/make/data/charsetmapping/IBM1166.c2b --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/make/data/charsetmapping/IBM1166.c2b Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,1 @@ +0x15 U+0085 diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/make/data/charsetmapping/IBM1166.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/make/data/charsetmapping/IBM1166.map Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,256 @@ +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+04d9 +0x43 U+0493 +0x44 U+0451 +0x45 U+0454 +0x46 U+0455 +0x47 U+0456 +0x48 U+049b +0x49 U+0458 +0x4a U+005b +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+04a3 +0x52 U+04e9 +0x53 U+04b1 +0x54 U+04af +0x55 U+045e +0x56 U+04bb +0x57 U+042a +0x58 U+2116 +0x59 U+04d8 +0x5a U+005d +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+0492 +0x63 U+0401 +0x64 U+0404 +0x65 U+0405 +0x66 U+0406 +0x67 U+049a +0x68 U+0408 +0x69 U+04a2 +0x6a U+007c +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+04e8 +0x71 U+04b0 +0x72 U+04ae +0x73 U+00ad +0x74 U+040e +0x75 U+04ba +0x76 U+044e +0x77 U+0430 +0x78 U+0431 +0x79 U+0060 +0x7a U+003a +0x7b U+0023 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+0446 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+0434 +0x8b U+0435 +0x8c U+0444 +0x8d U+0433 +0x8e U+0445 +0x8f U+0438 +0x90 U+0439 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+043a +0x9b U+043b +0x9c U+043c +0x9d U+043d +0x9e U+043e +0x9f U+043f +0xa0 U+044f +0xa1 U+007e +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+0440 +0xab U+0441 +0xac U+0442 +0xad U+0443 +0xae U+0436 +0xaf U+0432 +0xb0 U+044c +0xb1 U+044b +0xb2 U+0437 +0xb3 U+0448 +0xb4 U+044d +0xb5 U+0449 +0xb6 U+0447 +0xb7 U+044a +0xb8 U+042e +0xb9 U+0410 +0xba U+0411 +0xbb U+0426 +0xbc U+0414 +0xbd U+0415 +0xbe U+0424 +0xbf U+0413 +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+0425 +0xcb U+0418 +0xcc U+0419 +0xcd U+041a +0xce U+041b +0xcf U+041c +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+041d +0xdb U+041e +0xdc U+041f +0xdd U+042f +0xde U+0420 +0xdf U+0421 +0xe0 U+005c +0xe1 U+20ac +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+0422 +0xeb U+0423 +0xec U+0416 +0xed U+0412 +0xee U+042c +0xef U+042b +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+0417 +0xfb U+0428 +0xfc U+042d +0xfd U+0429 +0xfe U+0427 +0xff U+009f diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/make/data/charsetmapping/IBM1166.nr --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/make/data/charsetmapping/IBM1166.nr Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,1 @@ +0x25 U+000a diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/make/data/charsetmapping/charsets --- a/jdk/make/data/charsetmapping/charsets Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/make/data/charsetmapping/charsets Mon Mar 02 05:32:01 2015 -0800 @@ -503,7 +503,7 @@ charset x-EUC-TW EUC_TW package sun.nio.cs.ext - type source + type template alias euc_tw # JDK historical alias euctw alias cns11643 @@ -1660,6 +1660,16 @@ alias EBCDIC-JP-kana alias 290 +charset x-IBM1166 IBM1166 + package sun.nio.cs.ext + type sbcs + hisname Cp1166 + ascii false + alias cp1166 + alias ibm1166 + alias ibm-1166 + alias 1166 + charset x-IBM300 IBM300 package sun.nio.cs.ext type dbcsonly @@ -1816,3 +1826,17 @@ ascii false minmax 0x21 0x7e 0x21 0x7e internal true # "internal implementation + +######################################################## +# +# platform specific charsets, to be registered into spi +## +######################################################## + +charset x-COMPOUND_TEXT COMPOUND_TEXT + package sun.nio.cs.ext + type source + os unix + alias COMPOUND_TEXT # JDK historical + alias x11-compound_text + alias x-compound-text diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/make/data/charsetmapping/list_old --- a/jdk/make/data/charsetmapping/list_old Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/make/data/charsetmapping/list_old Mon Mar 02 05:32:01 2015 -0800 @@ -57,6 +57,7 @@ IBM1147 IBM01147 Cp1147 false sun.nio.cs.ext IBM1148 IBM01148 Cp1148 false sun.nio.cs.ext IBM1149 IBM01149 Cp1149 false sun.nio.cs.ext +IBM1166 x-IBM1166 Cp1166 false sun.nio.cs.ext IBM273 IBM273 Cp273 false sun.nio.cs.ext IBM277 IBM277 Cp277 false sun.nio.cs.ext IBM278 IBM278 Cp278 false sun.nio.cs.ext diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/make/data/charsetmapping/stdcs-solaris --- a/jdk/make/data/charsetmapping/stdcs-solaris Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/make/data/charsetmapping/stdcs-solaris Mon Mar 02 05:32:01 2015 -0800 @@ -9,6 +9,7 @@ EUC_JP EUC_JP_LINUX EUC_JP_Open +EUC_TW GBK ISO_8859_11 ISO_8859_3 diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/make/gensrc/Gensrc-jdk.charsets.gmk --- a/jdk/make/gensrc/Gensrc-jdk.charsets.gmk Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/make/gensrc/Gensrc-jdk.charsets.gmk Mon Mar 02 05:32:01 2015 -0800 @@ -50,7 +50,9 @@ $(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) \ extcs charsets $(CHARSET_STANDARD_OS) \ $(CHARSET_EXTENDED_JAVA_TEMPLATES) \ - $(CHARSET_EXTENDED_JAVA_DIR) $(LOG_INFO) + $(CHARSET_EXTENDED_JAVA_DIR) \ + $(CHARSET_COPYRIGHT_HEADER) \ + $(LOG_INFO) $(TOUCH) '$@' $(CHARSET_DONE_CS)-hkscs: $(CHARSET_COPYRIGHT_HEADER)/HKSCS.java \ diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/make/gensrc/GensrcCharsetMapping.gmk --- a/jdk/make/gensrc/GensrcCharsetMapping.gmk Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/make/gensrc/GensrcCharsetMapping.gmk Mon Mar 02 05:32:01 2015 -0800 @@ -32,6 +32,7 @@ CHARSET_EXTSRC_DIR := $(JDK_TOPDIR)/src/jdk.charsets/share/classes/sun/nio/cs/ext CHARSET_GENSRC_JAVA_DIR_BASE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/cs CHARSET_DONE_BASE := $(CHARSET_GENSRC_JAVA_DIR_BASE)/_the.charsetmapping +CHARSET_COPYRIGHT_HEADER := $(JDK_TOPDIR)/make/src/classes/build/tools/charsetmapping CHARSET_TEMPLATES := \ $(CHARSET_DATA_DIR)/SingleByte-X.java.template \ $(CHARSET_DATA_DIR)/DoubleByte-X.java.template @@ -46,7 +47,9 @@ $(MKDIR) -p $(@D) $(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_BASE) \ stdcs charsets $(CHARSET_STANDARD_OS) \ - $(CHARSET_STANDARD_JAVA_TEMPLATES) $(CHARSET_EXTSRC_DIR) $(LOG_INFO) + $(CHARSET_STANDARD_JAVA_TEMPLATES) $(CHARSET_EXTSRC_DIR) \ + $(CHARSET_COPYRIGHT_HEADER) \ + $(LOG_INFO) $(TOUCH) '$@' GENSRC_JAVA_BASE += $(CHARSET_DONE_BASE)-stdcs diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/make/gensrc/GensrcProperties.gmk --- a/jdk/make/gensrc/GensrcProperties.gmk Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/make/gensrc/GensrcProperties.gmk Mon Mar 02 05:32:01 2015 -0800 @@ -53,15 +53,21 @@ # Param 1 - Variable to add targets to, must not contain space # Param 2 - Properties files to process # Param 3 - The super class for the generated classes +# Param 4 - Module path root, defaults to $(JDK_TOPDIR)/src define SetupCompileProperties $1_SRCS := $2 $1_CLASS := $3 + $1_MODULE_PATH_ROOT := $4 + + ifeq ($$($1_MODULE_PATH_ROOT), ) + $1_MODULE_PATH_ROOT := $(JDK_TOPDIR)/src + endif # Convert .../src//share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties # to .../support/gensrc//com/sun/tools/javac/resources/javac_zh_CN.java # Strip away prefix and suffix, leaving for example only: # "/share/classes/com/sun/tools/javac/resources/javac_zh_CN" - $1_JAVAS := $$(patsubst $(JDK_TOPDIR)/src/%, \ + $1_JAVAS := $$(patsubst $$($1_MODULE_PATH_ROOT)/%, \ $(SUPPORT_OUTPUTDIR)/gensrc/%, \ $$(patsubst %.properties, %.java, \ $$(subst /$(OPENJDK_TARGET_OS)/classes,, \ diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/make/src/classes/build/tools/charsetmapping/Charset.java --- a/jdk/make/src/classes/build/tools/charsetmapping/Charset.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/make/src/classes/build/tools/charsetmapping/Charset.java Mon Mar 02 05:32:01 2015 -0800 @@ -31,6 +31,7 @@ String csName; String hisName; String type; + String os; boolean isASCII; int b1Min; int b1Max; diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/make/src/classes/build/tools/charsetmapping/EUC_TW.java --- a/jdk/make/src/classes/build/tools/charsetmapping/EUC_TW.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/make/src/classes/build/tools/charsetmapping/EUC_TW.java Mon Mar 02 05:32:01 2015 -0800 @@ -80,12 +80,12 @@ private static Pattern euctw = Pattern.compile("(?:8ea)?(\\p{XDigit}++)\\s++(\\p{XDigit}++)?\\s*+.*"); - static void genClass(String args[]) throws Exception + static void genClass(String pkg, String args[]) throws Exception { InputStream is = new FileInputStream(new File(args[0], "euc_tw.map")); PrintStream ps = new PrintStream(new File(args[1], "EUC_TWMapping.java"), "ISO-8859-1"); - String copyright = getCopyright(new File(args[3])); + String copyright = getCopyright(new File(args[7], "EUC_TW.java")); // ranges of byte1 and byte2, something should come from a "config" file @@ -128,7 +128,7 @@ out.format(copyright); out.format("%n// -- This file was mechanically generated: Do not edit! -- //%n"); - out.format("package sun.nio.cs.ext;%n%n"); + out.format("package %s;%n%n", pkg); out.format("class EUC_TWMapping {%n%n"); // boundaries diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/make/src/classes/build/tools/charsetmapping/HKSCS.java --- a/jdk/make/src/classes/build/tools/charsetmapping/HKSCS.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/make/src/classes/build/tools/charsetmapping/HKSCS.java Mon Mar 02 05:32:01 2015 -0800 @@ -42,7 +42,7 @@ private static Pattern hkscs = Pattern.compile("(?:0x)?+(\\p{XDigit}++)\\s++(?:0x|U\\+)?+(\\p{XDigit}++)?\\s*+(?:0x|U\\+)?(\\p{XDigit}++)?\\s*+.*"); - static void genClass2008(String srcDir, String dstDir, String pkgName) + static void genClass2008(String srcDir, String dstDir, String pkgName, File copyright) throws Exception { // hkscs2008 @@ -53,10 +53,11 @@ pkgName, "HKSCSMapping", true, - ""); + getCopyright(copyright)); + } - static void genClassXP(String srcDir, String dstDir, String pkgName) + static void genClassXP(String srcDir, String dstDir, String pkgName, File copyright) throws Exception { genClass0(new FileInputStream(new File(srcDir, "HKSCS_XP.map")), @@ -66,7 +67,7 @@ pkgName, "HKSCS_XPMapping", false, - ""); + getCopyright(copyright)); } static void genClass2001(String args[]) throws Exception { diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/make/src/classes/build/tools/charsetmapping/Main.java --- a/jdk/make/src/classes/build/tools/charsetmapping/Main.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/make/src/classes/build/tools/charsetmapping/Main.java Mon Mar 02 05:32:01 2015 -0800 @@ -41,6 +41,7 @@ int OS = 4; int TEMPLATE = 5; int EXT_SRC = 6; + int COPYRIGHT_SRC = 7; if (args.length < 3 ) { System.out.println("Usage: java -jar charsetmapping.jar src dst spiType charsets os [template]"); @@ -54,6 +55,7 @@ String[] osStdcs = getOSStdCSList(new File(args[SRC_DIR], args[OS])); boolean hasBig5_HKSCS = false; boolean hasMS950_HKSCS_XP = false; + boolean hasEUC_TW = false; for (String name : osStdcs) { Charset cs = charsets.get(name); if (cs != null) { @@ -63,6 +65,8 @@ hasBig5_HKSCS = true; } else if (name.equals("MS950_HKSCS_XP")) { hasMS950_HKSCS_XP = true; + } else if (name.equals("EUC_TW")) { + hasEUC_TW = true; } } for (Charset cs : charsets.values()) { @@ -89,19 +93,28 @@ } } // provider StandardCharsets.java / ExtendedCharsets.java - SPI.genClass(args[TYPE], charsets, args[SRC_DIR], args[DST_DIR], args[TEMPLATE]); + SPI.genClass(args[TYPE], charsets, + args[SRC_DIR], args[DST_DIR], + args[TEMPLATE], + args[OS].endsWith("windows") ? "windows" : "unix"); // HKSCSMapping2008/XP.java goes together with Big5/MS950XP_HKSCS if (isStandard && hasBig5_HKSCS || isExtended && !hasBig5_HKSCS) { HKSCS.genClass2008(args[SRC_DIR], args[DST_DIR], - isStandard ? "sun.nio.cs" : "sun.nio.cs.ext"); + isStandard ? "sun.nio.cs" : "sun.nio.cs.ext", + new File(args[COPYRIGHT_SRC], "HKSCS.java")); } if (isStandard && hasMS950_HKSCS_XP || isExtended && !hasMS950_HKSCS_XP) { HKSCS.genClassXP(args[SRC_DIR], args[DST_DIR], - isStandard ? "sun.nio.cs" : "sun.nio.cs.ext"); + isStandard ? "sun.nio.cs" : "sun.nio.cs.ext", + new File(args[COPYRIGHT_SRC], "HKSCS.java")); } - } else if ("euctw".equals(args[TYPE])) { - EUC_TW.genClass(args); + if (isStandard && hasEUC_TW) { + EUC_TW.genClass("sun.nio.cs", args); + } + if (!isStandard && !hasEUC_TW) { + EUC_TW.genClass("sun.nio.cs.ext", args); + } } else if ("sjis0213".equals(args[TYPE])) { JIS0213.genClass(args); } else if ("hkscs".equals(args[TYPE])) { @@ -157,6 +170,9 @@ case "type": cs.type = tokens[2]; break; + case "os": + cs.os = tokens[2]; + break; case "hisname": cs.hisName = tokens[2]; break; diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/make/src/classes/build/tools/charsetmapping/SPI.java --- a/jdk/make/src/classes/build/tools/charsetmapping/SPI.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/make/src/classes/build/tools/charsetmapping/SPI.java Mon Mar 02 05:32:01 2015 -0800 @@ -33,8 +33,10 @@ public class SPI { - public static void genClass(String type, LinkedHashMap charsets, - String srcDir, String dstDir, String template) + public static void genClass(String type, + LinkedHashMap charsets, + String srcDir, String dstDir, String template, + String os) throws Exception { try (Scanner s = new Scanner(new File(template)); @@ -50,7 +52,8 @@ charsets.values() .stream() .filter(cs -> cs.pkgName.equals("sun.nio.cs.ext") && - !cs.isInternal) + !cs.isInternal && + (cs.os == null || cs.os.equals(os))) .forEach( cs -> { out.printf(" charset(\"%s\", \"%s\",%n", cs.csName, cs.clzName); out.printf(" new String[] {%n"); diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/java.base/share/classes/java/lang/Class.java --- a/jdk/src/java.base/share/classes/java/lang/Class.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/java.base/share/classes/java/lang/Class.java Mon Mar 02 05:32:01 2015 -0800 @@ -1063,16 +1063,24 @@ parameterClasses[i] = toClass(parameterTypes[i]); // Perform access check - Class enclosingCandidate = enclosingInfo.getEnclosingClass(); + final Class enclosingCandidate = enclosingInfo.getEnclosingClass(); enclosingCandidate.checkMemberAccess(Member.DECLARED, Reflection.getCallerClass(), true); + // Client is ok to access declared methods but j.l.Class might not be. + Method[] candidates = AccessController.doPrivileged( + new PrivilegedAction() { + @Override + public Method[] run() { + return enclosingCandidate.getDeclaredMethods(); + } + }); /* * Loop over all declared methods; match method name, * number of and type of parameters, *and* return * type. Matching return type is also necessary * because of covariant returns, etc. */ - for(Method m: enclosingCandidate.getDeclaredMethods()) { + for(Method m: candidates) { if (m.getName().equals(enclosingInfo.getName()) ) { Class[] candidateParamClasses = m.getParameterTypes(); if (candidateParamClasses.length == parameterClasses.length) { @@ -1215,14 +1223,22 @@ parameterClasses[i] = toClass(parameterTypes[i]); // Perform access check - Class enclosingCandidate = enclosingInfo.getEnclosingClass(); + final Class enclosingCandidate = enclosingInfo.getEnclosingClass(); enclosingCandidate.checkMemberAccess(Member.DECLARED, Reflection.getCallerClass(), true); + // Client is ok to access declared methods but j.l.Class might not be. + Constructor[] candidates = AccessController.doPrivileged( + new PrivilegedAction[]>() { + @Override + public Constructor[] run() { + return enclosingCandidate.getDeclaredConstructors(); + } + }); /* * Loop over all declared constructors; match number * of and type of parameters. */ - for(Constructor c: enclosingCandidate.getDeclaredConstructors()) { + for(Constructor c: candidates) { Class[] candidateParamClasses = c.getParameterTypes(); if (candidateParamClasses.length == parameterClasses.length) { boolean matches = true; diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java --- a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java Mon Mar 02 05:32:01 2015 -0800 @@ -35,6 +35,7 @@ import static java.lang.invoke.MethodHandleStatics.*; import java.lang.ref.WeakReference; import java.lang.reflect.Field; +import java.util.Objects; import sun.invoke.util.ValueConversions; import sun.invoke.util.VerifyType; import sun.invoke.util.Wrapper; @@ -439,8 +440,7 @@ // Therefore, the only remaining check is for null. // Since this check is *not* guaranteed by Unsafe.getInt // and its siblings, we need to make an explicit one here. - obj.getClass(); // maybe throw NPE - return obj; + return Objects.requireNonNull(obj); } /** This subclass handles static field references. */ @@ -468,8 +468,7 @@ @ForceInline /*non-public*/ static Object nullCheck(Object obj) { - obj.getClass(); - return obj; + return Objects.requireNonNull(obj); } @ForceInline diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java --- a/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java Mon Mar 02 05:32:01 2015 -0800 @@ -521,7 +521,7 @@ } @SuppressWarnings("LeakingThisInConstructor") public MemberName(Method m, boolean wantSpecial) { - m.getClass(); // NPE check + Objects.requireNonNull(m); // fill in vmtarget, vmindex while we have m in hand: MethodHandleNatives.init(this, m); if (clazz == null) { // MHN.init failed @@ -600,7 +600,7 @@ /** Create a name for the given reflected constructor. The resulting name will be in a resolved state. */ @SuppressWarnings("LeakingThisInConstructor") public MemberName(Constructor ctor) { - ctor.getClass(); // NPE check + Objects.requireNonNull(ctor); // fill in vmtarget, vmindex while we have ctor in hand: MethodHandleNatives.init(this, ctor); assert(isResolved() && this.clazz != null); @@ -615,7 +615,7 @@ } @SuppressWarnings("LeakingThisInConstructor") public MemberName(Field fld, boolean makeSetter) { - fld.getClass(); // NPE check + Objects.requireNonNull(fld); // fill in vmtarget, vmindex while we have fld in hand: MethodHandleNatives.init(this, fld); assert(isResolved() && this.clazz != null); diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java Mon Mar 02 05:32:01 2015 -0800 @@ -453,10 +453,8 @@ */ // @param type type (permanently assigned) of the new method handle /*non-public*/ MethodHandle(MethodType type, LambdaForm form) { - type.getClass(); // explicit NPE - form.getClass(); // explicit NPE - this.type = type; - this.form = form.uncustomize(); + this.type = Objects.requireNonNull(type); + this.form = Objects.requireNonNull(form).uncustomize(); this.form.prepare(); // TO DO: Try to delay this step until just before invocation. } @@ -1171,7 +1169,7 @@ * @see #asFixedArity */ public MethodHandle asVarargsCollector(Class arrayType) { - arrayType.getClass(); // explicit NPE + Objects.requireNonNull(arrayType); boolean lastMatch = asCollectorChecks(arrayType, 0); if (isVarargsCollector() && lastMatch) return this; diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Mon Mar 02 05:32:01 2015 -0800 @@ -29,6 +29,7 @@ import java.util.BitSet; import java.util.List; import java.util.Arrays; +import java.util.Objects; import sun.invoke.util.ValueConversions; import sun.invoke.util.VerifyAccess; @@ -632,7 +633,7 @@ * @throws NullPointerException if the argument is null */ public Lookup in(Class requestedLookupClass) { - requestedLookupClass.getClass(); // null check + Objects.requireNonNull(requestedLookupClass); if (allowedModes == TRUSTED) // IMPL_LOOKUP can make any lookup at all return new Lookup(requestedLookupClass, ALL_MODES); if (requestedLookupClass == this.lookupClass) @@ -1367,16 +1368,16 @@ MemberName resolveOrFail(byte refKind, Class refc, String name, Class type) throws NoSuchFieldException, IllegalAccessException { checkSymbolicClass(refc); // do this before attempting to resolve - name.getClass(); // NPE - type.getClass(); // NPE + Objects.requireNonNull(name); + Objects.requireNonNull(type); return IMPL_NAMES.resolveOrFail(refKind, new MemberName(refc, name, type, refKind), lookupClassOrNull(), NoSuchFieldException.class); } MemberName resolveOrFail(byte refKind, Class refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException { checkSymbolicClass(refc); // do this before attempting to resolve - name.getClass(); // NPE - type.getClass(); // NPE + Objects.requireNonNull(name); + Objects.requireNonNull(type); checkMethodName(refKind, name); // NPE check on name return IMPL_NAMES.resolveOrFail(refKind, new MemberName(refc, name, type, refKind), lookupClassOrNull(), NoSuchMethodException.class); @@ -1384,14 +1385,14 @@ MemberName resolveOrFail(byte refKind, MemberName member) throws ReflectiveOperationException { checkSymbolicClass(member.getDeclaringClass()); // do this before attempting to resolve - member.getName().getClass(); // NPE - member.getType().getClass(); // NPE + Objects.requireNonNull(member.getName()); + Objects.requireNonNull(member.getType()); return IMPL_NAMES.resolveOrFail(refKind, member, lookupClassOrNull(), ReflectiveOperationException.class); } void checkSymbolicClass(Class refc) throws IllegalAccessException { - refc.getClass(); // NPE + Objects.requireNonNull(refc); Class caller = lookupClassOrNull(); if (caller != null && !VerifyAccess.isClassAccessible(refc, caller, allowedModes)) throw new MemberName(refc).makeAccessException("symbolic reference class is not public", this); diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/java.base/share/classes/java/lang/invoke/MutableCallSite.java --- a/jdk/src/java.base/share/classes/java/lang/invoke/MutableCallSite.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MutableCallSite.java Mon Mar 02 05:32:01 2015 -0800 @@ -25,6 +25,7 @@ package java.lang.invoke; +import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; /** @@ -275,7 +276,7 @@ if (sites.length == 0) return; STORE_BARRIER.lazySet(0); for (MutableCallSite site : sites) { - site.getClass(); // trigger NPE on first null + Objects.requireNonNull(site); // trigger NPE on first null } // FIXME: NYI } diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java --- a/jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java Mon Mar 02 05:32:01 2015 -0800 @@ -296,7 +296,8 @@ * constructor has default (package) access. * * @return a string describing this {@code Constructor} - * @jls 8.8.3. Constructor Modifiers + * @jls 8.8.3 Constructor Modifiers + * @jls 8.9.2 Enum Body Declarations */ public String toString() { return sharedToString(Modifier.constructorModifiers(), @@ -342,7 +343,8 @@ * include type parameters * * @since 1.5 - * @jls 8.8.3. Constructor Modifiers + * @jls 8.8.3 Constructor Modifiers + * @jls 8.9.2 Enum Body Declarations */ @Override public String toGenericString() { diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/java.base/share/classes/java/lang/reflect/Method.java --- a/jdk/src/java.base/share/classes/java/lang/reflect/Method.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/java.base/share/classes/java/lang/reflect/Method.java Mon Mar 02 05:32:01 2015 -0800 @@ -356,6 +356,8 @@ * @return a string describing this {@code Method} * * @jls 8.4.3 Method Modifiers + * @jls 9.4 Method Declarations + * @jls 9.6.1 Annotation Type Elements */ public String toString() { return sharedToString(Modifier.methodModifiers(), @@ -409,6 +411,8 @@ * @since 1.5 * * @jls 8.4.3 Method Modifiers + * @jls 9.4 Method Declarations + * @jls 9.6.1 Annotation Type Elements */ @Override public String toGenericString() { diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/java.base/share/classes/java/net/SocksSocketImpl.java --- a/jdk/src/java.base/share/classes/java/net/SocksSocketImpl.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/java.base/share/classes/java/net/SocksSocketImpl.java Mon Mar 02 05:32:01 2015 -0800 @@ -388,14 +388,13 @@ } while (iProxy.hasNext()) { p = iProxy.next(); - if (p == null || p == Proxy.NO_PROXY) { + if (p == null || p.type() != Proxy.Type.SOCKS) { super.connect(epoint, remainingMillis(deadlineMillis)); return; } - if (p.type() != Proxy.Type.SOCKS) - throw new SocketException("Unknown proxy type : " + p.type()); + if (!(p.address() instanceof InetSocketAddress)) - throw new SocketException("Unknow address type for proxy: " + p); + throw new SocketException("Unknown address type for proxy: " + p); // Use getHostString() to avoid reverse lookups server = ((InetSocketAddress) p.address()).getHostString(); serverPort = ((InetSocketAddress) p.address()).getPort(); @@ -707,13 +706,12 @@ } while (iProxy.hasNext()) { p = iProxy.next(); - if (p == null || p == Proxy.NO_PROXY) { + if (p == null || p.type() != Proxy.Type.SOCKS) { return; } - if (p.type() != Proxy.Type.SOCKS) - throw new SocketException("Unknown proxy type : " + p.type()); + if (!(p.address() instanceof InetSocketAddress)) - throw new SocketException("Unknow address type for proxy: " + p); + throw new SocketException("Unknown address type for proxy: " + p); // Use getHostString() to avoid reverse lookups server = ((InetSocketAddress) p.address()).getHostString(); serverPort = ((InetSocketAddress) p.address()).getPort(); diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/java.base/share/classes/java/net/URL.java --- a/jdk/src/java.base/share/classes/java/net/URL.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/java.base/share/classes/java/net/URL.java Mon Mar 02 05:32:01 2015 -0800 @@ -27,8 +27,15 @@ import java.io.IOException; import java.io.InputStream; +import java.net.spi.URLStreamHandlerProvider; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Hashtable; -import java.util.StringTokenizer; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.ServiceConfigurationError; +import java.util.ServiceLoader; + import sun.security.util.SecurityConstants; /** @@ -248,23 +255,19 @@ * stream protocol handler. *
  • If no {@code URLStreamHandlerFactory} has yet been set up, * or if the factory's {@code createURLStreamHandler} method - * returns {@code null}, then the constructor finds the - * value of the system property: - *
    -     *         java.protocol.handler.pkgs
    -     *     
    - * If the value of that system property is not {@code null}, - * it is interpreted as a list of packages separated by a vertical - * slash character '{@code |}'. The constructor tries to load - * the class named: - *
    -     *         <package>.<protocol>.Handler
    -     *     
    - * where <package> is replaced by the name of the package - * and <protocol> is replaced by the name of the protocol. - * If this class does not exist, or if the class exists but it is not - * a subclass of {@code URLStreamHandler}, then the next package - * in the list is tried. + * returns {@code null}, then the {@linkplain java.util.ServiceLoader + * ServiceLoader} mechanism is used to locate {@linkplain + * java.net.spi.URLStreamHandlerProvider URLStreamHandlerProvider} + * implementations using the system class + * loader. The order that providers are located is implementation + * specific, and an implementation is free to cache the located + * providers. A {@linkplain java.util.ServiceConfigurationError + * ServiceConfigurationError}, {@code Error} or {@code RuntimeException} + * thrown from the {@code createURLStreamHandler}, if encountered, will + * be propagated to the calling thread. The {@code + * createURLStreamHandler} method of each provider, if instantiated, is + * invoked, with the protocol string, until a provider returns non-null, + * or all providers have been exhausted. *
  • If the previous step fails to find a protocol handler, then the * constructor tries to load a built-in protocol handler. * If this class does not exist, or if the class exists but it is not a @@ -277,8 +280,12 @@ *
          *     http, https, file, and jar
          * 
    - * Protocol handlers for additional protocols may also be - * available. + * Protocol handlers for additional protocols may also be available. + * Some protocol handlers, for example those used for loading platform + * classes or classes on the class path, may not be overridden. The details + * of such restrictions, and when those restrictions apply (during + * initialization of the runtime for example), are implementation specific + * and therefore not specified * *

    No validation of the inputs is performed by this constructor. * @@ -1107,20 +1114,115 @@ } handlers.clear(); - // ensure the core protocol handlers are loaded before setting - // a custom URLStreamHandlerFactory - ensureHandlersLoaded("jrt", "jar", "file"); - // safe publication of URLStreamHandlerFactory with volatile write factory = fac; } } + private static final URLStreamHandlerFactory defaultFactory = new DefaultFactory(); + + private static class DefaultFactory implements URLStreamHandlerFactory { + private static String PREFIX = "sun.net.www.protocol"; + + public URLStreamHandler createURLStreamHandler(String protocol) { + String name = PREFIX + "." + protocol + ".Handler"; + try { + Class c = Class.forName(name); + return (URLStreamHandler)c.newInstance(); + } catch (ClassNotFoundException x) { + // ignore + } catch (Exception e) { + // For compatibility, all Exceptions are ignored. + // any number of exceptions can get thrown here + } + return null; + } + } + + private static Iterator providers() { + return new Iterator() { + + ClassLoader cl = ClassLoader.getSystemClassLoader(); + ServiceLoader sl = + ServiceLoader.load(URLStreamHandlerProvider.class, cl); + Iterator i = sl.iterator(); + + URLStreamHandlerProvider next = null; + + private boolean getNext() { + while (next == null) { + try { + if (!i.hasNext()) + return false; + next = i.next(); + } catch (ServiceConfigurationError sce) { + if (sce.getCause() instanceof SecurityException) { + // Ignore security exceptions + continue; + } + throw sce; + } + } + return true; + } + + public boolean hasNext() { + return getNext(); + } + + public URLStreamHandlerProvider next() { + if (!getNext()) + throw new NoSuchElementException(); + URLStreamHandlerProvider n = next; + next = null; + return n; + } + }; + } + + // Thread-local gate to prevent recursive provider lookups + private static ThreadLocal gate = new ThreadLocal<>(); + + private static URLStreamHandler lookupViaProviders(final String protocol) { + if (!sun.misc.VM.isBooted()) + return null; + + if (gate.get() != null) + throw new Error("Circular loading of URL stream handler providers detected"); + + gate.set(gate); + try { + return AccessController.doPrivileged( + new PrivilegedAction() { + public URLStreamHandler run() { + Iterator itr = providers(); + while (itr.hasNext()) { + URLStreamHandlerProvider f = itr.next(); + URLStreamHandler h = f.createURLStreamHandler(protocol); + if (h != null) + return h; + } + return null; + } + }); + } finally { + gate.set(null); + } + } + + private static final String[] NON_OVERRIDEABLE_PROTOCOLS = {"file", "jrt"}; + private static boolean isOverrideable(String protocol) { + for (String p : NON_OVERRIDEABLE_PROTOCOLS) + if (protocol.equalsIgnoreCase(p)) + return false; + return true; + } + /** * A table of protocol handlers. */ static Hashtable handlers = new Hashtable<>(); - private static Object streamHandlerLock = new Object(); + private static final Object streamHandlerLock = new Object(); /** * Returns the Stream Handler. @@ -1129,66 +1231,33 @@ static URLStreamHandler getURLStreamHandler(String protocol) { URLStreamHandler handler = handlers.get(protocol); - if (handler == null) { + + if (handler != null) { + return handler; + } - boolean checkedWithFactory = false; + URLStreamHandlerFactory fac; + boolean checkedWithFactory = false; + if (isOverrideable(protocol)) { // Use the factory (if any). Volatile read makes // URLStreamHandlerFactory appear fully initialized to current thread. - URLStreamHandlerFactory fac = factory; + fac = factory; if (fac != null) { handler = fac.createURLStreamHandler(protocol); checkedWithFactory = true; } - // Try java protocol handler - if (handler == null) { - String packagePrefixList = null; - - packagePrefixList - = java.security.AccessController.doPrivileged( - new sun.security.action.GetPropertyAction( - protocolPathProp,"")); - if (packagePrefixList != "") { - packagePrefixList += "|"; - } - - // REMIND: decide whether to allow the "null" class prefix - // or not. - packagePrefixList += "sun.net.www.protocol"; - - StringTokenizer packagePrefixIter = - new StringTokenizer(packagePrefixList, "|"); - - while (handler == null && - packagePrefixIter.hasMoreTokens()) { + if (handler == null && !protocol.equalsIgnoreCase("jar")) { + handler = lookupViaProviders(protocol); + } + } - String packagePrefix = - packagePrefixIter.nextToken().trim(); - try { - String clsName = packagePrefix + "." + protocol + - ".Handler"; - Class cls = null; - try { - cls = Class.forName(clsName); - } catch (ClassNotFoundException e) { - ClassLoader cl = ClassLoader.getSystemClassLoader(); - if (cl != null) { - cls = cl.loadClass(clsName); - } - } - if (cls != null) { - handler = - (URLStreamHandler)cls.newInstance(); - } - } catch (Exception e) { - // any number of exceptions can get thrown here - } - } - } - - synchronized (streamHandlerLock) { - + synchronized (streamHandlerLock) { + if (handler == null) { + // Try the built-in protocol handler + handler = defaultFactory.createURLStreamHandler(protocol); + } else { URLStreamHandler handler2 = null; // Check again with hashtable just in case another @@ -1202,7 +1271,7 @@ // Check with factory if another thread set a // factory since our last check if (!checkedWithFactory && (fac = factory) != null) { - handler2 = fac.createURLStreamHandler(protocol); + handler2 = fac.createURLStreamHandler(protocol); } if (handler2 != null) { @@ -1211,30 +1280,18 @@ // this thread created. handler = handler2; } + } - // Insert this handler into the hashtable - if (handler != null) { - handlers.put(protocol, handler); - } - + // Insert this handler into the hashtable + if (handler != null) { + handlers.put(protocol, handler); } } return handler; - } /** - * Ensures that the given protocol handlers are loaded - */ - private static void ensureHandlersLoaded(String... protocols) { - for (String protocol: protocols) { - getURLStreamHandler(protocol); - } - } - - - /** * WriteObject is called to save the state of the URL to an * ObjectOutputStream. The handler is not saved since it is * specific to this system. diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/java.base/share/classes/java/net/URLStreamHandlerFactory.java --- a/jdk/src/java.base/share/classes/java/net/URLStreamHandlerFactory.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/java.base/share/classes/java/net/URLStreamHandlerFactory.java Mon Mar 02 05:32:01 2015 -0800 @@ -44,7 +44,9 @@ * * @param protocol the protocol ("{@code ftp}", * "{@code http}", "{@code nntp}", etc.). - * @return a {@code URLStreamHandler} for the specific protocol. + * @return a {@code URLStreamHandler} for the specific protocol, or {@code + * null} if this factory cannot create a handler for the specific + * protocol * @see java.net.URLStreamHandler */ URLStreamHandler createURLStreamHandler(String protocol); diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/java.base/share/classes/java/net/package-info.java --- a/jdk/src/java.base/share/classes/java/net/package-info.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/java.base/share/classes/java/net/package-info.java Mon Mar 02 05:32:01 2015 -0800 @@ -143,13 +143,11 @@ * a similar URL will try to instantiate the handler for the specified protocol; * if it doesn't exist an exception will be thrown. *

    By default the protocol handlers are loaded dynamically from the default - * location. It is, however, possible to add to the search path by setting - * the {@code java.protocol.handler.pkgs} system property. For instance if - * it is set to {@code myapp.protocols}, then the URL code will try, in the - * case of http, first to load {@code myapp.protocols.http.Handler}, then, - * if this fails, {@code http.Handler} from the default location. - *

    Note that the Handler class has to be a subclass of the abstract - * class {@link java.net.URLStreamHandler}.

    + * location. It is, however, possible to deploy additional protocols handlers + * as {@link java.util.ServiceLoader services}. Service providers of type + * {@linkplain java.net.spi.URLStreamHandlerProvider} are located at + * runtime, as specified in the {@linkplain + * java.net.URL#URL(String,String,int,String) URL constructor}. *

    Additional Specification

    * *

    This method can also be overridden in a subclass. * It is recommended to use the {@link Formatter#formatMessage} @@ -137,8 +149,10 @@ * @param record the log record to be formatted. * @return a formatted log record */ + @Override public synchronized String format(LogRecord record) { - dat.setTime(record.getMillis()); + ZonedDateTime zdt = ZonedDateTime.ofInstant( + record.getInstant(), zoneId); String source; if (record.getSourceClassName() != null) { source = record.getSourceClassName(); @@ -159,7 +173,7 @@ throwable = sw.toString(); } return String.format(format, - dat, + zdt, source, record.getLoggerName(), record.getLevel().getLocalizedLevelName(), diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/java.logging/share/classes/java/util/logging/XMLFormatter.java --- a/jdk/src/java.logging/share/classes/java/util/logging/XMLFormatter.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/java.logging/share/classes/java/util/logging/XMLFormatter.java Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,8 +26,9 @@ package java.util.logging; -import java.io.*; import java.nio.charset.Charset; +import java.time.Instant; +import java.time.format.DateTimeFormatter; import java.util.*; /** @@ -40,11 +41,70 @@ * but it is recommended that it normally be used with UTF-8. The * character encoding can be set on the output Handler. * + * @implSpec Since JDK 1.9, instances of {@linkplain LogRecord} contain + * an {@link LogRecord#getInstant() Instant} which can have nanoseconds below + * the millisecond resolution. + * The DTD specification has been updated to allow for an optional + * {@code } element. By default, the XMLFormatter will compute the + * nanosecond adjustment below the millisecond resolution (using + * {@code LogRecord.getInstant().getNano() % 1000_000}) - and if this is not 0, + * this adjustment value will be printed in the new {@code } element. + * The event instant can then be reconstructed using + * {@code Instant.ofEpochSecond(millis/1000L, (millis % 1000L) * 1000_000L + nanos)} + * where {@code millis} and {@code nanos} represent the numbers serialized in + * the {@code } and {@code } elements, respectively. + *
    + * The {@code } element will now contain the whole instant as formatted + * by the {@link DateTimeFormatter#ISO_INSTANT DateTimeFormatter.ISO_INSTANT} + * formatter. + *

    + * For compatibility with old parsers, XMLFormatters can + * be configured to revert to the old format by specifying a + * {@code .useInstant = false} + * {@linkplain LogManager#getProperty(java.lang.String) property} in the + * logging configuration. When {@code useInstant} is {@code false}, the old + * formatting will be preserved. When {@code useInstant} is {@code true} + * (the default), the {@code } element will be printed and the + * {@code } element will contain the {@linkplain + * DateTimeFormatter#ISO_INSTANT formatted} instant. + *

    + * For instance, in order to configure plain instances of XMLFormatter to omit + * the new {@code } element, + * {@code java.util.logging.XMLFormatter.useInstant = false} can be specified + * in the logging configuration. + * * @since 1.4 */ public class XMLFormatter extends Formatter { - private LogManager manager = LogManager.getLogManager(); + private final LogManager manager = LogManager.getLogManager(); + private final boolean useInstant; + + /** + * Creates a new instance of XMLFormatter. + * + * @implSpec + * Since JDK 1.9, the XMLFormatter will print out the record {@linkplain + * LogRecord#getInstant() event time} as an Instant. This instant + * has the best resolution available on the system. The {@code } + * element will contain the instant as formatted by the {@link + * DateTimeFormatter#ISO_INSTANT}. + * In addition, an optional {@code } element containing a + * nanosecond adjustment will be printed if the instant contains some + * nanoseconds below the millisecond resolution. + *

    + * This new behavior can be turned off, and the old formatting restored, + * by specifying a property in the {@linkplain + * LogManager#getProperty(java.lang.String) logging configuration}. + * If {@code LogManager.getLogManager().getProperty( + * this.getClass().getName()+".useInstant")} is {@code "false"} or + * {@code "0"}, the old formatting will be restored. + */ + public XMLFormatter() { + useInstant = (manager == null) + || manager.getBooleanProperty( + this.getClass().getName()+".useInstant", true); + } // Append a two digit number. private void a2(StringBuilder sb, int x) { @@ -102,18 +162,35 @@ * @param record the log record to be formatted. * @return a formatted log record */ + @Override public String format(LogRecord record) { StringBuilder sb = new StringBuilder(500); sb.append("\n"); + final Instant instant = record.getInstant(); + sb.append(" "); - appendISO8601(sb, record.getMillis()); + if (useInstant) { + // If useInstant is true - we will print the instant in the + // date field, using the ISO_INSTANT formatter. + DateTimeFormatter.ISO_INSTANT.formatTo(instant, sb); + } else { + // If useInstant is false - we will keep the 'old' formating + appendISO8601(sb, instant.toEpochMilli()); + } sb.append("\n"); sb.append(" "); - sb.append(record.getMillis()); + sb.append(instant.toEpochMilli()); sb.append("\n"); + final int nanoAdjustment = instant.getNano() % 1000_000; + if (useInstant && nanoAdjustment != 0) { + sb.append(" "); + sb.append(nanoAdjustment); + sb.append("\n"); + } + sb.append(" "); sb.append(record.getSequenceNumber()); sb.append("\n"); @@ -223,6 +300,7 @@ * @param h The target handler (can be null) * @return a valid XML string */ + @Override public String getHead(Handler h) { StringBuilder sb = new StringBuilder(); String encoding; @@ -251,6 +329,7 @@ sb.append(encoding); sb.append("\""); sb.append(" standalone=\"no\"?>\n"); + sb.append("\n"); sb.append("\n"); return sb.toString(); @@ -262,6 +341,7 @@ * @param h The target handler (can be null) * @return a valid XML string */ + @Override public String getTail(Handler h) { return "\n"; } diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/java.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java --- a/jdk/src/java.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/java.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java Mon Mar 02 05:32:01 2015 -0800 @@ -45,7 +45,7 @@ * All methods throw a {@code NullPointerException} if any input argument is * {@code null} unless it's stated otherwise. * - * @see ManagementFactory#getPlatformMXBeans(Class) + * @see java.lang.management.ManagementFactory#getPlatformMXBeans(Class) */ @jdk.Exported public interface HotSpotDiagnosticMXBean extends PlatformManagedObject { diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java --- a/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java Mon Mar 02 05:32:01 2015 -0800 @@ -31,12 +31,13 @@ import static java.lang.Thread.State.*; /** - * Thread information. ThreadInfo contains the information + * Thread information. {@code ThreadInfo} contains the information * about a thread including: *

    General thread information

    *
      *
    • Thread ID.
    • *
    • Name of the thread.
    • + *
    • Whether a thread is a daemon thread
    • *
    * *

    Execution information

    @@ -57,6 +58,7 @@ *
  • List of object monitors locked by the thread.
  • *
  • List of * ownable synchronizers locked by the thread.
  • + *
  • Thread priority
  • * * *

    Synchronization Statistics

    @@ -78,7 +80,7 @@ * the system, not for synchronization control. * *

    MXBean Mapping

    - * ThreadInfo is mapped to a {@link CompositeData CompositeData} + * {@code ThreadInfo} is mapped to a {@link CompositeData CompositeData} * with attributes as specified in * the {@link #from from} method. * @@ -100,9 +102,11 @@ private String lockName; private long lockOwnerId; private String lockOwnerName; + private boolean daemon; private boolean inNative; private boolean suspended; private Thread.State threadState; + private int priority; private StackTraceElement[] stackTrace; private MonitorInfo[] lockedMonitors; private LockInfo[] lockedSynchronizers; @@ -229,6 +233,8 @@ this.blockedTime = blockedTime; this.waitedCount = waitedCount; this.waitedTime = waitedTime; + this.daemon = t.isDaemon(); + this.priority = t.getPriority(); if (lockObj == null) { this.lock = null; @@ -256,7 +262,7 @@ } /* - * Constructs a ThreadInfo object from a + * Constructs a {@code ThreadInfo} object from a * {@link CompositeData CompositeData}. */ private ThreadInfo(CompositeData cd) { @@ -277,7 +283,7 @@ stackTrace = ticd.stackTrace(); // 6.0 attributes - if (ticd.isCurrentVersion()) { + if (ticd.hasV6()) { lock = ticd.lockInfo(); lockedMonitors = ticd.lockedMonitors(); lockedSynchronizers = ticd.lockedSynchronizers(); @@ -300,10 +306,20 @@ lockedMonitors = EMPTY_MONITORS; lockedSynchronizers = EMPTY_SYNCS; } + + // 9.0 attributes + if (ticd.isCurrentVersion()) { + daemon = ticd.isDaemon(); + priority = ticd.getPriority(); + } else { + // Not ideal, but unclear what else we can do. + daemon = false; + priority = Thread.NORM_PRIORITY; + } } /** - * Returns the ID of the thread associated with this ThreadInfo. + * Returns the ID of the thread associated with this {@code ThreadInfo}. * * @return the ID of the associated thread. */ @@ -312,7 +328,7 @@ } /** - * Returns the name of the thread associated with this ThreadInfo. + * Returns the name of the thread associated with this {@code ThreadInfo}. * * @return the name of the associated thread. */ @@ -321,9 +337,9 @@ } /** - * Returns the state of the thread associated with this ThreadInfo. + * Returns the state of the thread associated with this {@code ThreadInfo}. * - * @return Thread.State of the associated thread. + * @return {@code Thread.State} of the associated thread. */ public Thread.State getThreadState() { return threadState; @@ -331,13 +347,13 @@ /** * Returns the approximate accumulated elapsed time (in milliseconds) - * that the thread associated with this ThreadInfo + * that the thread associated with this {@code ThreadInfo} * has blocked to enter or reenter a monitor * since thread contention monitoring is enabled. * I.e. the total accumulated time the thread has been in the * {@link java.lang.Thread.State#BLOCKED BLOCKED} state since thread * contention monitoring was last enabled. - * This method returns -1 if thread contention monitoring + * This method returns {@code -1} if thread contention monitoring * is disabled. * *

    The Java virtual machine may measure the time with a high @@ -345,8 +361,8 @@ * the thread contention monitoring is reenabled. * * @return the approximate accumulated elapsed time in milliseconds - * that a thread entered the BLOCKED state; - * -1 if thread contention monitoring is disabled. + * that a thread entered the {@code BLOCKED} state; + * {@code -1} if thread contention monitoring is disabled. * * @throws java.lang.UnsupportedOperationException if the Java * virtual machine does not support this operation. @@ -360,13 +376,13 @@ /** * Returns the total number of times that - * the thread associated with this ThreadInfo + * the thread associated with this {@code ThreadInfo} * blocked to enter or reenter a monitor. * I.e. the number of times a thread has been in the * {@link java.lang.Thread.State#BLOCKED BLOCKED} state. * * @return the total number of times that the thread - * entered the BLOCKED state. + * entered the {@code BLOCKED} state. */ public long getBlockedCount() { return blockedCount; @@ -374,14 +390,14 @@ /** * Returns the approximate accumulated elapsed time (in milliseconds) - * that the thread associated with this ThreadInfo + * that the thread associated with this {@code ThreadInfo} * has waited for notification * since thread contention monitoring is enabled. * I.e. the total accumulated time the thread has been in the * {@link java.lang.Thread.State#WAITING WAITING} * or {@link java.lang.Thread.State#TIMED_WAITING TIMED_WAITING} state * since thread contention monitoring is enabled. - * This method returns -1 if thread contention monitoring + * This method returns {@code -1} if thread contention monitoring * is disabled. * *

    The Java virtual machine may measure the time with a high @@ -389,9 +405,9 @@ * the thread contention monitoring is reenabled. * * @return the approximate accumulated elapsed time in milliseconds - * that a thread has been in the WAITING or - * TIMED_WAITING state; - * -1 if thread contention monitoring is disabled. + * that a thread has been in the {@code WAITING} or + * {@code TIMED_WAITING} state; + * {@code -1} if thread contention monitoring is disabled. * * @throws java.lang.UnsupportedOperationException if the Java * virtual machine does not support this operation. @@ -405,29 +421,29 @@ /** * Returns the total number of times that - * the thread associated with this ThreadInfo + * the thread associated with this {@code ThreadInfo} * waited for notification. * I.e. the number of times that a thread has been * in the {@link java.lang.Thread.State#WAITING WAITING} * or {@link java.lang.Thread.State#TIMED_WAITING TIMED_WAITING} state. * * @return the total number of times that the thread - * was in the WAITING or TIMED_WAITING state. + * was in the {@code WAITING} or {@code TIMED_WAITING} state. */ public long getWaitedCount() { return waitedCount; } /** - * Returns the LockInfo of an object for which - * the thread associated with this ThreadInfo + * Returns the {@code LockInfo} of an object for which + * the thread associated with this {@code ThreadInfo} * is blocked waiting. * A thread can be blocked waiting for one of the following: *

      *
    • an object monitor to be acquired for entering or reentering * a synchronization block/method. *
      The thread is in the {@link java.lang.Thread.State#BLOCKED BLOCKED} - * state waiting to enter the synchronized statement + * state waiting to enter the {@code synchronized} statement * or method. *
    • *
    • an object monitor to be notified by another thread. @@ -448,11 +464,11 @@ * or a {@link java.util.concurrent.locks.Condition Condition}.
    • *
    * - *

    This method returns null if the thread is not in any of + *

    This method returns {@code null} if the thread is not in any of * the above conditions. * - * @return LockInfo of an object for which the thread - * is blocked waiting if any; null otherwise. + * @return {@code LockInfo} of an object for which the thread + * is blocked waiting if any; {@code null} otherwise. * @since 1.6 */ public LockInfo getLockInfo() { @@ -462,19 +478,19 @@ /** * Returns the {@link LockInfo#toString string representation} * of an object for which the thread associated with this - * ThreadInfo is blocked waiting. + * {@code ThreadInfo} is blocked waiting. * This method is equivalent to calling: *

    *
          * getLockInfo().toString()
          * 
    * - *

    This method will return null if this thread is not blocked + *

    This method will return {@code null} if this thread is not blocked * waiting for any object or if the object is not owned by any thread. * * @return the string representation of the object on which * the thread is blocked if any; - * null otherwise. + * {@code null} otherwise. * * @see #getLockInfo */ @@ -484,14 +500,14 @@ /** * Returns the ID of the thread which owns the object - * for which the thread associated with this ThreadInfo + * for which the thread associated with this {@code ThreadInfo} * is blocked waiting. - * This method will return -1 if this thread is not blocked + * This method will return {@code -1} if this thread is not blocked * waiting for any object or if the object is not owned by any thread. * * @return the thread ID of the owner thread of the object * this thread is blocked on; - * -1 if this thread is not blocked + * {@code -1} if this thread is not blocked * or if the object is not owned by any thread. * * @see #getLockInfo @@ -502,14 +518,14 @@ /** * Returns the name of the thread which owns the object - * for which the thread associated with this ThreadInfo + * for which the thread associated with this {@code ThreadInfo} * is blocked waiting. - * This method will return null if this thread is not blocked + * This method will return {@code null} if this thread is not blocked * waiting for any object or if the object is not owned by any thread. * * @return the name of the thread that owns the object * this thread is blocked on; - * null if this thread is not blocked + * {@code null} if this thread is not blocked * or if the object is not owned by any thread. * * @see #getLockInfo @@ -520,7 +536,7 @@ /** * Returns the stack trace of the thread - * associated with this ThreadInfo. + * associated with this {@code ThreadInfo}. * If no stack trace was requested for this thread info, this method * will return a zero-length array. * If the returned array is of non-zero length then the first element of @@ -532,42 +548,67 @@ *

    Some Java virtual machines may, under some circumstances, omit one * or more stack frames from the stack trace. In the extreme case, * a virtual machine that has no stack trace information concerning - * the thread associated with this ThreadInfo + * the thread associated with this {@code ThreadInfo} * is permitted to return a zero-length array from this method. * - * @return an array of StackTraceElement objects of the thread. + * @return an array of {@code StackTraceElement} objects of the thread. */ public StackTraceElement[] getStackTrace() { return stackTrace; } /** - * Tests if the thread associated with this ThreadInfo - * is suspended. This method returns true if + * Tests if the thread associated with this {@code ThreadInfo} + * is suspended. This method returns {@code true} if * {@link Thread#suspend} has been called. * - * @return true if the thread is suspended; - * false otherwise. + * @return {@code true} if the thread is suspended; + * {@code false} otherwise. */ public boolean isSuspended() { return suspended; } /** - * Tests if the thread associated with this ThreadInfo + * Tests if the thread associated with this {@code ThreadInfo} * is executing native code via the Java Native Interface (JNI). * The JNI native code does not include * the virtual machine support code or the compiled native * code generated by the virtual machine. * - * @return true if the thread is executing native code; - * false otherwise. + * @return {@code true} if the thread is executing native code; + * {@code false} otherwise. */ public boolean isInNative() { return inNative; } /** + * Tests if the thread associated with this {@code ThreadInfo} is + * a {@linkplain Thread#isDaemon daemon thread}. + * + * @return {@code true} if the thread is a daemon thread, + * {@code false} otherwise. + * @see Thread#isDaemon + * @since 1.9 + */ + public boolean isDaemon() { + return daemon; + } + + /** + * Returns the {@linkplain Thread#getPriority() thread priority} of the + * thread associated with this {@code ThreadInfo}. + * + * @return The priority of the thread associated with this + * {@code ThreadInfo}. + * @since 1.9 + */ + public int getPriority() { + return priority; + } + + /** * Returns a string representation of this thread info. * The format of this string depends on the implementation. * The returned string will typically include @@ -580,6 +621,8 @@ */ public String toString() { StringBuilder sb = new StringBuilder("\"" + getThreadName() + "\"" + + (daemon ? " daemon" : "") + + " prio=" + priority + " Id=" + getThreadId() + " " + getThreadState()); if (getLockName() != null) { @@ -647,9 +690,9 @@ private static final int MAX_FRAMES = 8; /** - * Returns a ThreadInfo object represented by the - * given CompositeData. - * The given CompositeData must contain the following attributes + * Returns a {@code ThreadInfo} object represented by the + * given {@code CompositeData}. + * The given {@code CompositeData} must contain the following attributes * unless otherwise specified below: *

    * @@ -659,67 +702,67 @@ * * * - * + * * * * - * + * * * * - * + * * * * - * + * * * * - * + * * * * - * + * * * * - * + * * * * - * + * * * * - * + * * * * - * + * If {@code cd} does not contain this attribute, + * the {@code LockInfo} object will be constructed from + * the value of the {@code lockName} attribute. * * * - * + * * * * - * + * * * * - * + * * * * - * * * - * * * * - * * + * + * + * + * + * + * + * + * *
    threadIdjava.lang.Long{@code java.lang.Long}
    threadNamejava.lang.String{@code java.lang.String}
    threadStatejava.lang.String{@code java.lang.String}
    suspendedjava.lang.Boolean{@code java.lang.Boolean}
    inNativejava.lang.Boolean{@code java.lang.Boolean}
    blockedCountjava.lang.Long{@code java.lang.Long}
    blockedTimejava.lang.Long{@code java.lang.Long}
    waitedCountjava.lang.Long{@code java.lang.Long}
    waitedTimejava.lang.Long{@code java.lang.Long}
    lockInfojavax.management.openmbean.CompositeData + * {@code javax.management.openmbean.CompositeData} * - the mapped type for {@link LockInfo} as specified in the * {@link LockInfo#from} method. *

    - * If cd does not contain this attribute, - * the LockInfo object will be constructed from - * the value of the lockName attribute.

    lockNamejava.lang.String{@code java.lang.String}
    lockOwnerIdjava.lang.Long{@code java.lang.Long}
    lockOwnerNamejava.lang.String{@code java.lang.String}
    stackTracejavax.management.openmbean.CompositeData[] + * {@code javax.management.openmbean.CompositeData[]} *

    - * Each element is a CompositeData representing + * Each element is a {@code CompositeData} representing * StackTraceElement containing the following attributes: *

    * @@ -729,23 +772,23 @@ * * * - * + * * * * - * + * * * * - * + * * * * - * + * * * * - * + * * *
    classNamejava.lang.String{@code java.lang.String}
    methodNamejava.lang.String{@code java.lang.String}
    fileNamejava.lang.String{@code java.lang.String}
    lineNumberjava.lang.Integer{@code java.lang.Integer}
    nativeMethodjava.lang.Boolean{@code java.lang.Boolean}
    *
    @@ -753,35 +796,43 @@ *
    lockedMonitorsjavax.management.openmbean.CompositeData[] + * {@code javax.management.openmbean.CompositeData[]} * whose element type is the mapped type for * {@link MonitorInfo} as specified in the * {@link MonitorInfo#from Monitor.from} method. *

    - * If cd does not contain this attribute, + * If {@code cd} does not contain this attribute, * this attribute will be set to an empty array.

    lockedSynchronizersjavax.management.openmbean.CompositeData[] + * {@code javax.management.openmbean.CompositeData[]} * whose element type is the mapped type for * {@link LockInfo} as specified in the {@link LockInfo#from} method. *

    - * If cd does not contain this attribute, + * If {@code cd} does not contain this attribute, * this attribute will be set to an empty array.

    daemon{@code java.lang.Boolean}
    priority{@code java.lang.Integer}
    *
    * - * @param cd CompositeData representing a ThreadInfo + * @param cd {@code CompositeData} representing a {@code ThreadInfo} * - * @throws IllegalArgumentException if cd does not - * represent a ThreadInfo with the attributes described + * @throws IllegalArgumentException if {@code cd} does not + * represent a {@code ThreadInfo} with the attributes described * above. * - * @return a ThreadInfo object represented - * by cd if cd is not null; - * null otherwise. + * @return a {@code ThreadInfo} object represented + * by {@code cd} if {@code cd} is not {@code null}; + * {@code null} otherwise. */ public static ThreadInfo from(CompositeData cd) { if (cd == null) { @@ -798,12 +849,12 @@ /** * Returns an array of {@link MonitorInfo} objects, each of which * represents an object monitor currently locked by the thread - * associated with this ThreadInfo. + * associated with this {@code ThreadInfo}. * If no locked monitor was requested for this thread info or * no monitor is locked by the thread, this method * will return a zero-length array. * - * @return an array of MonitorInfo objects representing + * @return an array of {@code MonitorInfo} objects representing * the object monitors locked by the thread. * * @since 1.6 @@ -816,11 +867,11 @@ * Returns an array of {@link LockInfo} objects, each of which * represents an ownable * synchronizer currently locked by the thread associated with - * this ThreadInfo. If no locked synchronizer was + * this {@code ThreadInfo}. If no locked synchronizer was * requested for this thread info or no synchronizer is locked by * the thread, this method will return a zero-length array. * - * @return an array of LockInfo objects representing + * @return an array of {@code LockInfo} objects representing * the ownable synchronizers locked by the thread. * * @since 1.6 diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/java.management/share/classes/sun/management/AgentConfigurationError.java --- a/jdk/src/java.management/share/classes/sun/management/AgentConfigurationError.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/java.management/share/classes/sun/management/AgentConfigurationError.java Mon Mar 02 05:32:01 2015 -0800 @@ -87,26 +87,6 @@ "agent.err.connector.server.io.error"; public static final String INVALID_OPTION = "agent.err.invalid.option"; - public static final String INVALID_SNMP_PORT = - "agent.err.invalid.snmp.port"; - public static final String INVALID_SNMP_TRAP_PORT = - "agent.err.invalid.snmp.trap.port"; - public static final String UNKNOWN_SNMP_INTERFACE = - "agent.err.unknown.snmp.interface"; - public static final String SNMP_ACL_FILE_NOT_SET = - "agent.err.acl.file.notset"; - public static final String SNMP_ACL_FILE_NOT_FOUND = - "agent.err.acl.file.notfound"; - public static final String SNMP_ACL_FILE_NOT_READABLE = - "agent.err.acl.file.not.readable"; - public static final String SNMP_ACL_FILE_READ_FAILED = - "agent.err.acl.file.read.failed"; - public static final String SNMP_ACL_FILE_ACCESS_NOT_RESTRICTED = - "agent.err.acl.file.access.notrestricted"; - public static final String SNMP_ADAPTOR_START_FAILED = - "agent.err.snmp.adaptor.start.failed"; - public static final String SNMP_MIB_INIT_FAILED = - "agent.err.snmp.mib.init.failed"; public static final String INVALID_STATE = "agent.err.invalid.state"; diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/java.management/share/classes/sun/management/ThreadInfoCompositeData.java --- a/jdk/src/java.management/share/classes/sun/management/ThreadInfoCompositeData.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/java.management/share/classes/sun/management/ThreadInfoCompositeData.java Mon Mar 02 05:32:01 2015 -0800 @@ -43,23 +43,30 @@ private final ThreadInfo threadInfo; private final CompositeData cdata; private final boolean currentVersion; + private final boolean hasV6; private ThreadInfoCompositeData(ThreadInfo ti) { this.threadInfo = ti; this.currentVersion = true; this.cdata = null; + this.hasV6 = true; } private ThreadInfoCompositeData(CompositeData cd) { this.threadInfo = null; this.currentVersion = ThreadInfoCompositeData.isCurrentVersion(cd); this.cdata = cd; + this.hasV6 = ThreadInfoCompositeData.hasV6(cd); } public ThreadInfo getThreadInfo() { return threadInfo; } + public boolean hasV6() { + return hasV6; + } + public boolean isCurrentVersion() { return currentVersion; } @@ -124,6 +131,8 @@ threadInfo.isInNative(), lockedMonitorsData, lockedSyncsData, + threadInfo.isDaemon(), + threadInfo.getPriority(), }; try { @@ -151,6 +160,8 @@ private static final String STACK_TRACE = "stackTrace"; private static final String SUSPENDED = "suspended"; private static final String IN_NATIVE = "inNative"; + private static final String DAEMON = "daemon"; + private static final String PRIORITY = "priority"; private static final String LOCKED_MONITORS = "lockedMonitors"; private static final String LOCKED_SYNCS = "lockedSynchronizers"; @@ -171,6 +182,8 @@ IN_NATIVE, LOCKED_MONITORS, LOCKED_SYNCS, + DAEMON, + PRIORITY, }; // New attributes added in 6.0 ThreadInfo @@ -180,9 +193,16 @@ LOCKED_SYNCS, }; + private static final String[] threadInfoV9Attributes = { + DAEMON, + PRIORITY, + }; + // Current version of ThreadInfo private static final CompositeType threadInfoCompositeType; // Previous version of ThreadInfo + private static final CompositeType threadInfoV6CompositeType; + // Previous-previous version of ThreadInfo private static final CompositeType threadInfoV5CompositeType; private static final CompositeType lockInfoCompositeType; static { @@ -193,7 +213,7 @@ String[] itemNames = threadInfoCompositeType.keySet().toArray(new String[0]); int numV5Attributes = threadInfoItemNames.length - - threadInfoV6Attributes.length; + threadInfoV6Attributes.length - threadInfoV9Attributes.length; String[] v5ItemNames = new String[numV5Attributes]; String[] v5ItemDescs = new String[numV5Attributes]; OpenType[] v5ItemTypes = new OpenType[numV5Attributes]; @@ -213,6 +233,31 @@ v5ItemNames, v5ItemDescs, v5ItemTypes); + + + // Form a CompositeType for JDK 6.0 ThreadInfo version + int numV6Attributes = threadInfoItemNames.length - + threadInfoV9Attributes.length; + String[] v6ItemNames = new String[numV6Attributes]; + String[] v6ItemDescs = new String[numV6Attributes]; + OpenType[] v6ItemTypes = new OpenType[numV6Attributes]; + i = 0; + for (String n : itemNames) { + if (isV5Attribute(n) || isV6Attribute(n)) { + v6ItemNames[i] = n; + v6ItemDescs[i] = threadInfoCompositeType.getDescription(n); + v6ItemTypes[i] = threadInfoCompositeType.getType(n); + i++; + } + } + + threadInfoV6CompositeType = + new CompositeType("java.lang.management.ThreadInfo", + "Java SE 6 java.lang.management.ThreadInfo", + v6ItemNames, + v6ItemDescs, + v6ItemTypes); + } catch (OpenDataException e) { // Should never reach here throw new AssertionError(e); @@ -236,6 +281,20 @@ return false; } } + for (String n : threadInfoV9Attributes) { + if (itemName.equals(n)) { + return false; + } + } + return true; + } + + private static boolean isV6Attribute(String itemName) { + for (String n : threadInfoV9Attributes) { + if (itemName.equals(n)) { + return false; + } + } return true; } @@ -247,6 +306,15 @@ return isTypeMatched(threadInfoCompositeType, cd.getCompositeType()); } + private static boolean hasV6(CompositeData cd) { + if (cd == null) { + throw new NullPointerException("Null CompositeData"); + } + + return isTypeMatched(threadInfoCompositeType, cd.getCompositeType()) || + isTypeMatched(threadInfoV6CompositeType, cd.getCompositeType()); + } + public long threadId() { return getLong(cdata, THREAD_ID); } @@ -304,6 +372,14 @@ return getBoolean(cdata, IN_NATIVE); } + public boolean isDaemon() { + return getBoolean(cdata, DAEMON); + } + + public int getPriority(){ + return getInt(cdata, PRIORITY); + } + public StackTraceElement[] stackTrace() { CompositeData[] stackTraceData = (CompositeData[]) cdata.get(STACK_TRACE); @@ -368,9 +444,10 @@ if (!isTypeMatched(threadInfoCompositeType, type)) { currentVersion = false; // check if cd is an older version - if (!isTypeMatched(threadInfoV5CompositeType, type)) { - throw new IllegalArgumentException( - "Unexpected composite type for ThreadInfo"); + if (!isTypeMatched(threadInfoV5CompositeType, type) && + !isTypeMatched(threadInfoV6CompositeType, type)) { + throw new IllegalArgumentException( + "Unexpected composite type for ThreadInfo"); } } diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/java.management/share/classes/sun/management/resources/agent.properties --- a/jdk/src/java.management/share/classes/sun/management/resources/agent.properties Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/java.management/share/classes/sun/management/resources/agent.properties Mon Mar 02 05:32:01 2015 -0800 @@ -1,4 +1,3 @@ -# # # Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,9 +23,6 @@ # questions. # -# Localizations for Level names. For the US locale -# these are the same as the non-localized level name. - agent.err.error = Error agent.err.exception = Exception thrown by the agent agent.err.warning = Warning @@ -67,27 +63,9 @@ agent.err.connector.server.io.error = JMX connector server communication error agent.err.invalid.option = Invalid option specified -agent.err.invalid.snmp.port = Invalid com.sun.management.snmp.port number -agent.err.invalid.snmp.trap.port = Invalid com.sun.management.snmp.trap number -agent.err.unknown.snmp.interface = Unknown SNMP interface -agent.err.acl.file.notset = No SNMP ACL file is specified but com.sun.management.snmp.acl=true -agent.err.acl.file.notfound = SNMP ACL file not found -agent.err.acl.file.not.readable = SNMP ACL file not readable -agent.err.acl.file.read.failed = Failed in reading SNMP ACL file -agent.err.acl.file.access.notrestricted = Password file read access must be restricted - -agent.err.snmp.adaptor.start.failed = Failed to start SNMP adaptor with address -agent.err.snmp.mib.init.failed = Failed to initialize SNMP MIB with error jmxremote.ConnectorBootstrap.starting = Starting JMX Connector Server: jmxremote.ConnectorBootstrap.noAuthentication = No Authentication jmxremote.ConnectorBootstrap.ready = JMX Connector ready at: {0} jmxremote.ConnectorBootstrap.password.readonly = Password file read access must be restricted: {0} jmxremote.ConnectorBootstrap.file.readonly = File read access must be restricted: {0} - -jmxremote.AdaptorBootstrap.getTargetList.processing = Processing ACL -jmxremote.AdaptorBootstrap.getTargetList.adding = Adding target: {0} -jmxremote.AdaptorBootstrap.getTargetList.starting = Starting Adaptor Server: -jmxremote.AdaptorBootstrap.getTargetList.initialize1 = Adaptor ready. -jmxremote.AdaptorBootstrap.getTargetList.initialize2 = SNMP Adaptor ready on: {0}:{1} -jmxremote.AdaptorBootstrap.getTargetList.terminate = terminate {0} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/jdk.attach/share/classes/com/sun/tools/attach/AttachOperationFailedException.java --- a/jdk/src/jdk.attach/share/classes/com/sun/tools/attach/AttachOperationFailedException.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/jdk.attach/share/classes/com/sun/tools/attach/AttachOperationFailedException.java Mon Mar 02 05:32:01 2015 -0800 @@ -46,7 +46,7 @@ * Constructs an AttachOperationFailedException with * the specified detail message. * - * @param s the detail message. + * @param message the detail message. */ public AttachOperationFailedException(String message) { super(message); diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_TW.java --- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_TW.java Fri Feb 27 12:48:06 2015 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,546 +0,0 @@ -/* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio.cs.ext; - -import java.io.*; -import java.nio.CharBuffer; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CoderResult; -import java.util.Arrays; -import sun.nio.cs.HistoricallyNamedCharset; -import static sun.nio.cs.CharsetMapping.*; - -public class EUC_TW extends Charset implements HistoricallyNamedCharset -{ - private static final int SS2 = 0x8E; - - /* - (1) EUC_TW - Second byte of EUC_TW for cs2 is in range of - 0xA1-0xB0 for plane 1-16. According to CJKV /163, - plane1 is coded in both cs1 and cs2. This impl - however does not decode the codepoints of plane1 - in cs2, so only p2-p7 and p15 are supported in cs2. - - Plane2 0xA2; - Plane3 0xA3; - Plane4 0xA4; - Plane5 0xA5; - Plane6 0xA6; - Plane7 0xA7; - Plane15 0xAF; - - (2) Mapping - The fact that all supplementary characters encoded in EUC_TW are - in 0x2xxxx range gives us the room to optimize the data tables. - - Decoding: - (1) save the lower 16-bit value of all codepoints of b->c mapping - in a String array table String[plane] b2c. - (2) save "codepoint is supplementary" info (one bit) in a - byte[] b2cIsSupp, so 8 codepoints (same codepoint value, different - plane No) share one byte. - - Encoding: - (1)c->b mappings are stored in - char[]c2b/char[]c2bIndex - char[]c2bSupp/char[]c2bIndexsupp (indexed by lower 16-bit - (2)byte[] c2bPlane stores the "plane info" of each euc-tw codepoints, - BMP and Supp share the low/high 4 bits of one byte. - - Mapping tables are stored separated in EUC_TWMapping, which - is generated by tool. - */ - - public EUC_TW() { - super("x-EUC-TW", ExtendedCharsets.aliasesFor("x-EUC-TW")); - } - - public String historicalName() { - return "EUC_TW"; - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof EUC_TW)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - public static class Decoder extends CharsetDecoder { - public Decoder(Charset cs) { - super(cs, 2.0f, 2.0f); - } - - char[] c1 = new char[1]; - char[] c2 = new char[2]; - public char[] toUnicode(int b1, int b2, int p) { - return decode(b1, b2, p, c1, c2); - } - - static final String[] b2c = EUC_TWMapping.b2c; - static final int b1Min = EUC_TWMapping.b1Min; - static final int b1Max = EUC_TWMapping.b1Max; - static final int b2Min = EUC_TWMapping.b2Min; - static final int b2Max = EUC_TWMapping.b2Max; - static final int dbSegSize = b2Max - b2Min + 1; - static final byte[] b2cIsSupp; - - // adjust from cns planeNo to the plane index of b2c - static final byte[] cnspToIndex = new byte[0x100]; - static { - Arrays.fill(cnspToIndex, (byte)-1); - cnspToIndex[0xa2] = 1; cnspToIndex[0xa3] = 2; cnspToIndex[0xa4] = 3; - cnspToIndex[0xa5] = 4; cnspToIndex[0xa6] = 5; cnspToIndex[0xa7] = 6; - cnspToIndex[0xaf] = 7; - } - - //static final BitSet b2cIsSupp; - static { - String b2cIsSuppStr = EUC_TWMapping.b2cIsSuppStr; - // work on a local copy is much faster than operate - // directly on b2cIsSupp - byte[] flag = new byte[b2cIsSuppStr.length() << 1]; - int off = 0; - for (int i = 0; i < b2cIsSuppStr.length(); i++) { - char c = b2cIsSuppStr.charAt(i); - flag[off++] = (byte)(c >> 8); - flag[off++] = (byte)(c & 0xff); - } - b2cIsSupp = flag; - } - - static boolean isLegalDB(int b) { - return b >= b1Min && b <= b1Max; - } - - static char[] decode(int b1, int b2, int p, char[] c1, char[] c2) - { - if (b1 < b1Min || b1 > b1Max || b2 < b2Min || b2 > b2Max) - return null; - int index = (b1 - b1Min) * dbSegSize + b2 - b2Min; - char c = b2c[p].charAt(index); - if (c == UNMAPPABLE_DECODING) - return null; - if ((b2cIsSupp[index] & (1 << p)) == 0) { - c1[0] = c; - return c1; - } else { - c2[0] = Character.highSurrogate(0x20000 + c); - c2[1] = Character.lowSurrogate(0x20000 + c); - return c2; - } - } - - private CoderResult decodeArrayLoop(ByteBuffer src, - CharBuffer dst) - { - byte[] sa = src.array(); - int sp = src.arrayOffset() + src.position(); - int sl = src.arrayOffset() + src.limit(); - - char[] da = dst.array(); - int dp = dst.arrayOffset() + dst.position(); - int dl = dst.arrayOffset() + dst.limit(); - try { - while (sp < sl) { - int byte1 = sa[sp] & 0xff; - if (byte1 == SS2) { // Codeset 2 G2 - if ( sl - sp < 4) - return CoderResult.UNDERFLOW; - int cnsPlane = cnspToIndex[sa[sp + 1] & 0xff]; - if (cnsPlane < 0) - return CoderResult.malformedForLength(2); - byte1 = sa[sp + 2] & 0xff; - int byte2 = sa[sp + 3] & 0xff; - char[] cc = toUnicode(byte1, byte2, cnsPlane); - if (cc == null) { - if (!isLegalDB(byte1) || !isLegalDB(byte2)) - return CoderResult.malformedForLength(4); - return CoderResult.unmappableForLength(4); - } - if (dl - dp < cc.length) - return CoderResult.OVERFLOW; - if (cc.length == 1) { - da[dp++] = cc[0]; - } else { - da[dp++] = cc[0]; - da[dp++] = cc[1]; - } - sp += 4; - } else if (byte1 < 0x80) { // ASCII G0 - if (dl - dp < 1) - return CoderResult.OVERFLOW; - da[dp++] = (char) byte1; - sp++; - } else { // Codeset 1 G1 - if ( sl - sp < 2) - return CoderResult.UNDERFLOW; - int byte2 = sa[sp + 1] & 0xff; - char[] cc = toUnicode(byte1, byte2, 0); - if (cc == null) { - if (!isLegalDB(byte1) || !isLegalDB(byte2)) - return CoderResult.malformedForLength(1); - return CoderResult.unmappableForLength(2); - } - if (dl - dp < 1) - return CoderResult.OVERFLOW; - da[dp++] = cc[0]; - sp += 2; - } - } - return CoderResult.UNDERFLOW; - } finally { - src.position(sp - src.arrayOffset()); - dst.position(dp - dst.arrayOffset()); - } - } - - private CoderResult decodeBufferLoop(ByteBuffer src, - CharBuffer dst) - { - int mark = src.position(); - try { - while (src.hasRemaining()) { - int byte1 = src.get() & 0xff; - if (byte1 == SS2) { // Codeset 2 G2 - if ( src.remaining() < 3) - return CoderResult.UNDERFLOW; - int cnsPlane = cnspToIndex[src.get() & 0xff]; - if (cnsPlane < 0) - return CoderResult.malformedForLength(2); - byte1 = src.get() & 0xff; - int byte2 = src.get() & 0xff; - char[] cc = toUnicode(byte1, byte2, cnsPlane); - if (cc == null) { - if (!isLegalDB(byte1) || !isLegalDB(byte2)) - return CoderResult.malformedForLength(4); - return CoderResult.unmappableForLength(4); - } - if (dst.remaining() < cc.length) - return CoderResult.OVERFLOW; - if (cc.length == 1) { - dst.put(cc[0]); - } else { - dst.put(cc[0]); - dst.put(cc[1]); - } - mark += 4; - } else if (byte1 < 0x80) { // ASCII G0 - if (!dst.hasRemaining()) - return CoderResult.OVERFLOW; - dst.put((char) byte1); - mark++; - } else { // Codeset 1 G1 - if (!src.hasRemaining()) - return CoderResult.UNDERFLOW; - int byte2 = src.get() & 0xff; - char[] cc = toUnicode(byte1, byte2, 0); - if (cc == null) { - if (!isLegalDB(byte1) || !isLegalDB(byte2)) - return CoderResult.malformedForLength(1); - return CoderResult.unmappableForLength(2); - } - if (!dst.hasRemaining()) - return CoderResult.OVERFLOW; - dst.put(cc[0]); - mark +=2; - } - } - return CoderResult.UNDERFLOW; - } finally { - src.position(mark); - } - } - - protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) - { - if (src.hasArray() && dst.hasArray()) - return decodeArrayLoop(src, dst); - else - return decodeBufferLoop(src, dst); - } - } - - public static class Encoder extends CharsetEncoder { - private byte[] bb = new byte[4]; - - public Encoder(Charset cs) { - super(cs, 4.0f, 4.0f); - } - - public boolean canEncode(char c) { - return (c <= '\u007f' || toEUC(c, bb) != -1); - } - - public boolean canEncode(CharSequence cs) { - int i = 0; - while (i < cs.length()) { - char c = cs.charAt(i++); - if (Character.isHighSurrogate(c)) { - if (i == cs.length()) - return false; - char low = cs.charAt(i++); - if (!Character.isLowSurrogate(low) || toEUC(c, low, bb) == -1) - return false; - } else if (!canEncode(c)) { - return false; - } - } - return true; - } - - public int toEUC(char hi, char low, byte[] bb) { - return encode(hi, low, bb); - } - - public int toEUC(char c, byte[] bb) { - return encode(c, bb); - } - - private CoderResult encodeArrayLoop(CharBuffer src, - ByteBuffer dst) - { - char[] sa = src.array(); - int sp = src.arrayOffset() + src.position(); - int sl = src.arrayOffset() + src.limit(); - - byte[] da = dst.array(); - int dp = dst.arrayOffset() + dst.position(); - int dl = dst.arrayOffset() + dst.limit(); - - int inSize; - int outSize; - - try { - while (sp < sl) { - char c = sa[sp]; - inSize = 1; - if (c < 0x80) { // ASCII - bb[0] = (byte)c; - outSize = 1; - } else { - outSize = toEUC(c, bb); - if (outSize == -1) { - // to check surrogates only after BMP failed - // has the benefit of improving the BMP encoding - // 10% faster, with the price of the slowdown of - // supplementary character encoding. given the use - // of supplementary characters is really rare, this - // is something worth doing. - if (Character.isHighSurrogate(c)) { - if ((sp + 1) == sl) - return CoderResult.UNDERFLOW; - if (!Character.isLowSurrogate(sa[sp + 1])) - return CoderResult.malformedForLength(1); - outSize = toEUC(c, sa[sp+1], bb); - inSize = 2; - } else if (Character.isLowSurrogate(c)) { - return CoderResult.malformedForLength(1); - } - } - } - if (outSize == -1) - return CoderResult.unmappableForLength(inSize); - if ( dl - dp < outSize) - return CoderResult.OVERFLOW; - for (int i = 0; i < outSize; i++) - da[dp++] = bb[i]; - sp += inSize; - } - return CoderResult.UNDERFLOW; - } finally { - src.position(sp - src.arrayOffset()); - dst.position(dp - dst.arrayOffset()); - } - } - - private CoderResult encodeBufferLoop(CharBuffer src, - ByteBuffer dst) - { - int outSize; - int inSize; - int mark = src.position(); - - try { - while (src.hasRemaining()) { - inSize = 1; - char c = src.get(); - if (c < 0x80) { // ASCII - outSize = 1; - bb[0] = (byte)c; - } else { - outSize = toEUC(c, bb); - if (outSize == -1) { - if (Character.isHighSurrogate(c)) { - if (!src.hasRemaining()) - return CoderResult.UNDERFLOW; - char c2 = src.get(); - if (!Character.isLowSurrogate(c2)) - return CoderResult.malformedForLength(1); - outSize = toEUC(c, c2, bb); - inSize = 2; - } else if (Character.isLowSurrogate(c)) { - return CoderResult.malformedForLength(1); - } - } - } - if (outSize == -1) - return CoderResult.unmappableForLength(inSize); - if (dst.remaining() < outSize) - return CoderResult.OVERFLOW; - for (int i = 0; i < outSize; i++) - dst.put(bb[i]); - mark += inSize; - } - return CoderResult.UNDERFLOW; - } finally { - src.position(mark); - } - } - - protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) - { - if (src.hasArray() && dst.hasArray()) - return encodeArrayLoop(src, dst); - else - return encodeBufferLoop(src, dst); - } - - static int encode(char hi, char low, byte[] bb) { - int c = Character.toCodePoint(hi, low); - if ((c & 0xf0000) != 0x20000) - return -1; - c -= 0x20000; - int index = c2bSuppIndex[c >> 8]; - if (index == UNMAPPABLE_ENCODING) - return -1; - index = index + (c & 0xff); - int db = c2bSupp[index]; - if (db == UNMAPPABLE_ENCODING) - return -1; - int p = (c2bPlane[index] >> 4) & 0xf; - bb[0] = (byte)SS2; - bb[1] = (byte)(0xa0 | p); - bb[2] = (byte)(db >> 8); - bb[3] = (byte)db; - return 4; - } - - static int encode(char c, byte[] bb) { - int index = c2bIndex[c >> 8]; - if (index == UNMAPPABLE_ENCODING) - return -1; - index = index + (c & 0xff); - int db = c2b[index]; - if (db == UNMAPPABLE_ENCODING) - return -1; - int p = c2bPlane[index] & 0xf; - if (p == 0) { - bb[0] = (byte)(db >> 8); - bb[1] = (byte)db; - return 2; - } else { - bb[0] = (byte)SS2; - bb[1] = (byte)(0xa0 | p); - bb[2] = (byte)(db >> 8); - bb[3] = (byte)db; - return 4; - } - } - - static final char[] c2b; - static final char[] c2bIndex; - static final char[] c2bSupp; - static final char[] c2bSuppIndex; - static final byte[] c2bPlane; - static { - int b1Min = Decoder.b1Min; - int b1Max = Decoder.b1Max; - int b2Min = Decoder.b2Min; - int b2Max = Decoder.b2Max; - int dbSegSize = Decoder.dbSegSize; - String[] b2c = Decoder.b2c; - byte[] b2cIsSupp = Decoder.b2cIsSupp; - - c2bIndex = EUC_TWMapping.c2bIndex; - c2bSuppIndex = EUC_TWMapping.c2bSuppIndex; - char[] c2b0 = new char[EUC_TWMapping.C2BSIZE]; - char[] c2bSupp0 = new char[EUC_TWMapping.C2BSUPPSIZE]; - byte[] c2bPlane0 = new byte[Math.max(EUC_TWMapping.C2BSIZE, - EUC_TWMapping.C2BSUPPSIZE)]; - - Arrays.fill(c2b0, (char)UNMAPPABLE_ENCODING); - Arrays.fill(c2bSupp0, (char)UNMAPPABLE_ENCODING); - - for (int p = 0; p < b2c.length; p++) { - String db = b2c[p]; - /* - adjust the "plane" from 0..7 to 0, 2, 3, 4, 5, 6, 7, 0xf, - which helps balance between footprint (to save the plane - info in 4 bits) and runtime performance (to require only - one operation "0xa0 | plane" to encode the plane byte) - */ - int plane = p; - if (plane == 7) - plane = 0xf; - else if (plane != 0) - plane = p + 1; - - int off = 0; - for (int b1 = b1Min; b1 <= b1Max; b1++) { - for (int b2 = b2Min; b2 <= b2Max; b2++) { - char c = db.charAt(off); - if (c != UNMAPPABLE_DECODING) { - if ((b2cIsSupp[off] & (1 << p)) != 0) { - int index = c2bSuppIndex[c >> 8] + (c&0xff); - c2bSupp0[index] = (char)((b1 << 8) + b2); - c2bPlane0[index] |= (byte)(plane << 4); - } else { - int index = c2bIndex[c >> 8] + (c&0xff); - c2b0[index] = (char)((b1 << 8) + b2); - c2bPlane0[index] |= (byte)plane; - } - } - off++; - } - } - } - c2b = c2b0; - c2bSupp = c2bSupp0; - c2bPlane = c2bPlane0; - } - } -} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_TW.java.template --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_TW.java.template Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,546 @@ +/* + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package $PACKAGE$; + +import java.io.*; +import java.nio.CharBuffer; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.CharsetDecoder; +import java.nio.charset.CharsetEncoder; +import java.nio.charset.CoderResult; +import java.util.Arrays; +import sun.nio.cs.HistoricallyNamedCharset; +import static sun.nio.cs.CharsetMapping.*; + +public class EUC_TW extends Charset implements HistoricallyNamedCharset +{ + private static final int SS2 = 0x8E; + + /* + (1) EUC_TW + Second byte of EUC_TW for cs2 is in range of + 0xA1-0xB0 for plane 1-16. According to CJKV /163, + plane1 is coded in both cs1 and cs2. This impl + however does not decode the codepoints of plane1 + in cs2, so only p2-p7 and p15 are supported in cs2. + + Plane2 0xA2; + Plane3 0xA3; + Plane4 0xA4; + Plane5 0xA5; + Plane6 0xA6; + Plane7 0xA7; + Plane15 0xAF; + + (2) Mapping + The fact that all supplementary characters encoded in EUC_TW are + in 0x2xxxx range gives us the room to optimize the data tables. + + Decoding: + (1) save the lower 16-bit value of all codepoints of b->c mapping + in a String array table String[plane] b2c. + (2) save "codepoint is supplementary" info (one bit) in a + byte[] b2cIsSupp, so 8 codepoints (same codepoint value, different + plane No) share one byte. + + Encoding: + (1)c->b mappings are stored in + char[]c2b/char[]c2bIndex + char[]c2bSupp/char[]c2bIndexsupp (indexed by lower 16-bit + (2)byte[] c2bPlane stores the "plane info" of each euc-tw codepoints, + BMP and Supp share the low/high 4 bits of one byte. + + Mapping tables are stored separated in EUC_TWMapping, which + is generated by tool. + */ + + public EUC_TW() { + super("x-EUC-TW", $ALIASES$); + } + + public String historicalName() { + return "EUC_TW"; + } + + public boolean contains(Charset cs) { + return ((cs.name().equals("US-ASCII")) + || (cs instanceof EUC_TW)); + } + + public CharsetDecoder newDecoder() { + return new Decoder(this); + } + + public CharsetEncoder newEncoder() { + return new Encoder(this); + } + + public static class Decoder extends CharsetDecoder { + public Decoder(Charset cs) { + super(cs, 2.0f, 2.0f); + } + + char[] c1 = new char[1]; + char[] c2 = new char[2]; + public char[] toUnicode(int b1, int b2, int p) { + return decode(b1, b2, p, c1, c2); + } + + static final String[] b2c = EUC_TWMapping.b2c; + static final int b1Min = EUC_TWMapping.b1Min; + static final int b1Max = EUC_TWMapping.b1Max; + static final int b2Min = EUC_TWMapping.b2Min; + static final int b2Max = EUC_TWMapping.b2Max; + static final int dbSegSize = b2Max - b2Min + 1; + static final byte[] b2cIsSupp; + + // adjust from cns planeNo to the plane index of b2c + static final byte[] cnspToIndex = new byte[0x100]; + static { + Arrays.fill(cnspToIndex, (byte)-1); + cnspToIndex[0xa2] = 1; cnspToIndex[0xa3] = 2; cnspToIndex[0xa4] = 3; + cnspToIndex[0xa5] = 4; cnspToIndex[0xa6] = 5; cnspToIndex[0xa7] = 6; + cnspToIndex[0xaf] = 7; + } + + //static final BitSet b2cIsSupp; + static { + String b2cIsSuppStr = EUC_TWMapping.b2cIsSuppStr; + // work on a local copy is much faster than operate + // directly on b2cIsSupp + byte[] flag = new byte[b2cIsSuppStr.length() << 1]; + int off = 0; + for (int i = 0; i < b2cIsSuppStr.length(); i++) { + char c = b2cIsSuppStr.charAt(i); + flag[off++] = (byte)(c >> 8); + flag[off++] = (byte)(c & 0xff); + } + b2cIsSupp = flag; + } + + static boolean isLegalDB(int b) { + return b >= b1Min && b <= b1Max; + } + + static char[] decode(int b1, int b2, int p, char[] c1, char[] c2) + { + if (b1 < b1Min || b1 > b1Max || b2 < b2Min || b2 > b2Max) + return null; + int index = (b1 - b1Min) * dbSegSize + b2 - b2Min; + char c = b2c[p].charAt(index); + if (c == UNMAPPABLE_DECODING) + return null; + if ((b2cIsSupp[index] & (1 << p)) == 0) { + c1[0] = c; + return c1; + } else { + c2[0] = Character.highSurrogate(0x20000 + c); + c2[1] = Character.lowSurrogate(0x20000 + c); + return c2; + } + } + + private CoderResult decodeArrayLoop(ByteBuffer src, + CharBuffer dst) + { + byte[] sa = src.array(); + int sp = src.arrayOffset() + src.position(); + int sl = src.arrayOffset() + src.limit(); + + char[] da = dst.array(); + int dp = dst.arrayOffset() + dst.position(); + int dl = dst.arrayOffset() + dst.limit(); + try { + while (sp < sl) { + int byte1 = sa[sp] & 0xff; + if (byte1 == SS2) { // Codeset 2 G2 + if ( sl - sp < 4) + return CoderResult.UNDERFLOW; + int cnsPlane = cnspToIndex[sa[sp + 1] & 0xff]; + if (cnsPlane < 0) + return CoderResult.malformedForLength(2); + byte1 = sa[sp + 2] & 0xff; + int byte2 = sa[sp + 3] & 0xff; + char[] cc = toUnicode(byte1, byte2, cnsPlane); + if (cc == null) { + if (!isLegalDB(byte1) || !isLegalDB(byte2)) + return CoderResult.malformedForLength(4); + return CoderResult.unmappableForLength(4); + } + if (dl - dp < cc.length) + return CoderResult.OVERFLOW; + if (cc.length == 1) { + da[dp++] = cc[0]; + } else { + da[dp++] = cc[0]; + da[dp++] = cc[1]; + } + sp += 4; + } else if (byte1 < 0x80) { // ASCII G0 + if (dl - dp < 1) + return CoderResult.OVERFLOW; + da[dp++] = (char) byte1; + sp++; + } else { // Codeset 1 G1 + if ( sl - sp < 2) + return CoderResult.UNDERFLOW; + int byte2 = sa[sp + 1] & 0xff; + char[] cc = toUnicode(byte1, byte2, 0); + if (cc == null) { + if (!isLegalDB(byte1) || !isLegalDB(byte2)) + return CoderResult.malformedForLength(1); + return CoderResult.unmappableForLength(2); + } + if (dl - dp < 1) + return CoderResult.OVERFLOW; + da[dp++] = cc[0]; + sp += 2; + } + } + return CoderResult.UNDERFLOW; + } finally { + src.position(sp - src.arrayOffset()); + dst.position(dp - dst.arrayOffset()); + } + } + + private CoderResult decodeBufferLoop(ByteBuffer src, + CharBuffer dst) + { + int mark = src.position(); + try { + while (src.hasRemaining()) { + int byte1 = src.get() & 0xff; + if (byte1 == SS2) { // Codeset 2 G2 + if ( src.remaining() < 3) + return CoderResult.UNDERFLOW; + int cnsPlane = cnspToIndex[src.get() & 0xff]; + if (cnsPlane < 0) + return CoderResult.malformedForLength(2); + byte1 = src.get() & 0xff; + int byte2 = src.get() & 0xff; + char[] cc = toUnicode(byte1, byte2, cnsPlane); + if (cc == null) { + if (!isLegalDB(byte1) || !isLegalDB(byte2)) + return CoderResult.malformedForLength(4); + return CoderResult.unmappableForLength(4); + } + if (dst.remaining() < cc.length) + return CoderResult.OVERFLOW; + if (cc.length == 1) { + dst.put(cc[0]); + } else { + dst.put(cc[0]); + dst.put(cc[1]); + } + mark += 4; + } else if (byte1 < 0x80) { // ASCII G0 + if (!dst.hasRemaining()) + return CoderResult.OVERFLOW; + dst.put((char) byte1); + mark++; + } else { // Codeset 1 G1 + if (!src.hasRemaining()) + return CoderResult.UNDERFLOW; + int byte2 = src.get() & 0xff; + char[] cc = toUnicode(byte1, byte2, 0); + if (cc == null) { + if (!isLegalDB(byte1) || !isLegalDB(byte2)) + return CoderResult.malformedForLength(1); + return CoderResult.unmappableForLength(2); + } + if (!dst.hasRemaining()) + return CoderResult.OVERFLOW; + dst.put(cc[0]); + mark +=2; + } + } + return CoderResult.UNDERFLOW; + } finally { + src.position(mark); + } + } + + protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) + { + if (src.hasArray() && dst.hasArray()) + return decodeArrayLoop(src, dst); + else + return decodeBufferLoop(src, dst); + } + } + + public static class Encoder extends CharsetEncoder { + private byte[] bb = new byte[4]; + + public Encoder(Charset cs) { + super(cs, 4.0f, 4.0f); + } + + public boolean canEncode(char c) { + return (c <= '\u007f' || toEUC(c, bb) != -1); + } + + public boolean canEncode(CharSequence cs) { + int i = 0; + while (i < cs.length()) { + char c = cs.charAt(i++); + if (Character.isHighSurrogate(c)) { + if (i == cs.length()) + return false; + char low = cs.charAt(i++); + if (!Character.isLowSurrogate(low) || toEUC(c, low, bb) == -1) + return false; + } else if (!canEncode(c)) { + return false; + } + } + return true; + } + + public int toEUC(char hi, char low, byte[] bb) { + return encode(hi, low, bb); + } + + public int toEUC(char c, byte[] bb) { + return encode(c, bb); + } + + private CoderResult encodeArrayLoop(CharBuffer src, + ByteBuffer dst) + { + char[] sa = src.array(); + int sp = src.arrayOffset() + src.position(); + int sl = src.arrayOffset() + src.limit(); + + byte[] da = dst.array(); + int dp = dst.arrayOffset() + dst.position(); + int dl = dst.arrayOffset() + dst.limit(); + + int inSize; + int outSize; + + try { + while (sp < sl) { + char c = sa[sp]; + inSize = 1; + if (c < 0x80) { // ASCII + bb[0] = (byte)c; + outSize = 1; + } else { + outSize = toEUC(c, bb); + if (outSize == -1) { + // to check surrogates only after BMP failed + // has the benefit of improving the BMP encoding + // 10% faster, with the price of the slowdown of + // supplementary character encoding. given the use + // of supplementary characters is really rare, this + // is something worth doing. + if (Character.isHighSurrogate(c)) { + if ((sp + 1) == sl) + return CoderResult.UNDERFLOW; + if (!Character.isLowSurrogate(sa[sp + 1])) + return CoderResult.malformedForLength(1); + outSize = toEUC(c, sa[sp+1], bb); + inSize = 2; + } else if (Character.isLowSurrogate(c)) { + return CoderResult.malformedForLength(1); + } + } + } + if (outSize == -1) + return CoderResult.unmappableForLength(inSize); + if ( dl - dp < outSize) + return CoderResult.OVERFLOW; + for (int i = 0; i < outSize; i++) + da[dp++] = bb[i]; + sp += inSize; + } + return CoderResult.UNDERFLOW; + } finally { + src.position(sp - src.arrayOffset()); + dst.position(dp - dst.arrayOffset()); + } + } + + private CoderResult encodeBufferLoop(CharBuffer src, + ByteBuffer dst) + { + int outSize; + int inSize; + int mark = src.position(); + + try { + while (src.hasRemaining()) { + inSize = 1; + char c = src.get(); + if (c < 0x80) { // ASCII + outSize = 1; + bb[0] = (byte)c; + } else { + outSize = toEUC(c, bb); + if (outSize == -1) { + if (Character.isHighSurrogate(c)) { + if (!src.hasRemaining()) + return CoderResult.UNDERFLOW; + char c2 = src.get(); + if (!Character.isLowSurrogate(c2)) + return CoderResult.malformedForLength(1); + outSize = toEUC(c, c2, bb); + inSize = 2; + } else if (Character.isLowSurrogate(c)) { + return CoderResult.malformedForLength(1); + } + } + } + if (outSize == -1) + return CoderResult.unmappableForLength(inSize); + if (dst.remaining() < outSize) + return CoderResult.OVERFLOW; + for (int i = 0; i < outSize; i++) + dst.put(bb[i]); + mark += inSize; + } + return CoderResult.UNDERFLOW; + } finally { + src.position(mark); + } + } + + protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) + { + if (src.hasArray() && dst.hasArray()) + return encodeArrayLoop(src, dst); + else + return encodeBufferLoop(src, dst); + } + + static int encode(char hi, char low, byte[] bb) { + int c = Character.toCodePoint(hi, low); + if ((c & 0xf0000) != 0x20000) + return -1; + c -= 0x20000; + int index = c2bSuppIndex[c >> 8]; + if (index == UNMAPPABLE_ENCODING) + return -1; + index = index + (c & 0xff); + int db = c2bSupp[index]; + if (db == UNMAPPABLE_ENCODING) + return -1; + int p = (c2bPlane[index] >> 4) & 0xf; + bb[0] = (byte)SS2; + bb[1] = (byte)(0xa0 | p); + bb[2] = (byte)(db >> 8); + bb[3] = (byte)db; + return 4; + } + + static int encode(char c, byte[] bb) { + int index = c2bIndex[c >> 8]; + if (index == UNMAPPABLE_ENCODING) + return -1; + index = index + (c & 0xff); + int db = c2b[index]; + if (db == UNMAPPABLE_ENCODING) + return -1; + int p = c2bPlane[index] & 0xf; + if (p == 0) { + bb[0] = (byte)(db >> 8); + bb[1] = (byte)db; + return 2; + } else { + bb[0] = (byte)SS2; + bb[1] = (byte)(0xa0 | p); + bb[2] = (byte)(db >> 8); + bb[3] = (byte)db; + return 4; + } + } + + static final char[] c2b; + static final char[] c2bIndex; + static final char[] c2bSupp; + static final char[] c2bSuppIndex; + static final byte[] c2bPlane; + static { + int b1Min = Decoder.b1Min; + int b1Max = Decoder.b1Max; + int b2Min = Decoder.b2Min; + int b2Max = Decoder.b2Max; + int dbSegSize = Decoder.dbSegSize; + String[] b2c = Decoder.b2c; + byte[] b2cIsSupp = Decoder.b2cIsSupp; + + c2bIndex = EUC_TWMapping.c2bIndex; + c2bSuppIndex = EUC_TWMapping.c2bSuppIndex; + char[] c2b0 = new char[EUC_TWMapping.C2BSIZE]; + char[] c2bSupp0 = new char[EUC_TWMapping.C2BSUPPSIZE]; + byte[] c2bPlane0 = new byte[Math.max(EUC_TWMapping.C2BSIZE, + EUC_TWMapping.C2BSUPPSIZE)]; + + Arrays.fill(c2b0, (char)UNMAPPABLE_ENCODING); + Arrays.fill(c2bSupp0, (char)UNMAPPABLE_ENCODING); + + for (int p = 0; p < b2c.length; p++) { + String db = b2c[p]; + /* + adjust the "plane" from 0..7 to 0, 2, 3, 4, 5, 6, 7, 0xf, + which helps balance between footprint (to save the plane + info in 4 bits) and runtime performance (to require only + one operation "0xa0 | plane" to encode the plane byte) + */ + int plane = p; + if (plane == 7) + plane = 0xf; + else if (plane != 0) + plane = p + 1; + + int off = 0; + for (int b1 = b1Min; b1 <= b1Max; b1++) { + for (int b2 = b2Min; b2 <= b2Max; b2++) { + char c = db.charAt(off); + if (c != UNMAPPABLE_DECODING) { + if ((b2cIsSupp[off] & (1 << p)) != 0) { + int index = c2bSuppIndex[c >> 8] + (c&0xff); + c2bSupp0[index] = (char)((b1 << 8) + b2); + c2bPlane0[index] |= (byte)(plane << 4); + } else { + int index = c2bIndex[c >> 8] + (c&0xff); + c2b0[index] = (char)((b1 << 8) + b2); + c2bPlane0[index] |= (byte)plane; + } + } + off++; + } + } + } + c2b = c2b0; + c2bSupp = c2bSupp0; + c2bPlane = c2bPlane0; + } + } +} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ExtendedCharsets.java.template --- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ExtendedCharsets.java.template Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ExtendedCharsets.java.template Mon Mar 02 05:32:01 2015 -0800 @@ -222,16 +222,6 @@ } } - String osName = getProperty("os.name"); - if ("SunOS".equals(osName) || "Linux".equals(osName) || "AIX".equals(osName) - || osName.contains("OS X")) { - charset("x-COMPOUND_TEXT", "COMPOUND_TEXT", - new String[] { - "COMPOUND_TEXT", // JDK historical - "x11-compound_text", - "x-compound-text" - }); - } initialized = true; } diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_CN_CNS.java --- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_CN_CNS.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_CN_CNS.java Mon Mar 02 05:32:01 2015 -0800 @@ -35,6 +35,7 @@ import java.nio.charset.CharsetEncoder; import java.nio.charset.CoderResult; import sun.nio.cs.HistoricallyNamedCharset; +import sun.nio.cs.*; public class ISO2022_CN_CNS extends ISO2022 implements HistoricallyNamedCharset { diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java --- a/jdk/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java Mon Mar 02 05:32:01 2015 -0800 @@ -31,7 +31,6 @@ import java.net.*; import javax.net.ssl.*; import java.util.*; -import sun.net.www.MessageHeader; /** * This class encapsulates a HTTP request received and a diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/AuthFilter.java --- a/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/AuthFilter.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/AuthFilter.java Mon Mar 02 05:32:01 2015 -0800 @@ -29,7 +29,6 @@ import java.io.*; import java.nio.*; import java.nio.channels.*; -import sun.net.www.MessageHeader; import java.util.*; import javax.security.auth.*; import javax.security.auth.callback.*; diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpExchangeImpl.java --- a/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpExchangeImpl.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpExchangeImpl.java Mon Mar 02 05:32:01 2015 -0800 @@ -31,7 +31,6 @@ import java.net.*; import javax.net.ssl.*; import java.util.*; -import sun.net.www.MessageHeader; import com.sun.net.httpserver.*; import com.sun.net.httpserver.spi.*; diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsExchangeImpl.java --- a/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsExchangeImpl.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsExchangeImpl.java Mon Mar 02 05:32:01 2015 -0800 @@ -31,7 +31,6 @@ import java.net.*; import javax.net.ssl.*; import java.util.*; -import sun.net.www.MessageHeader; import com.sun.net.httpserver.*; import com.sun.net.httpserver.spi.*; diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/jdk.jdi/share/classes/com/sun/jdi/InterfaceType.java --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InterfaceType.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InterfaceType.java Mon Mar 02 05:32:01 2015 -0800 @@ -145,7 +145,7 @@ * not be done from the client's event handler thread. *

    * The resumption of other threads during the invocation can be prevented - * by specifying the {@link #INVOKE_SINGLE_THREADED} + * by specifying the {@link ClassType#INVOKE_SINGLE_THREADED} * bit flag in the options argument; however, * there is no protection against or recovery from the deadlocks * described above, so this option should be used with great caution. diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/src/jdk.sctp/unix/native/libsctp/SctpNet.c --- a/jdk/src/jdk.sctp/unix/native/libsctp/SctpNet.c Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/src/jdk.sctp/unix/native/libsctp/SctpNet.c Mon Mar 02 05:32:01 2015 -0800 @@ -431,7 +431,7 @@ paddr = addr_buf; for (i=0; iAccessories->System Tools->System Information. - * 2. The value (reported in Kbytes) is in the "Page File Space" entry - * Windows 98/ME: - * Unknown. - * - * Usage: GetTotalSwapSpaceSize [trace] - */ - -import com.sun.management.OperatingSystemMXBean; -import java.lang.management.*; - -public class GetTotalSwapSpaceSize { - - private static OperatingSystemMXBean mbean = - (com.sun.management.OperatingSystemMXBean) - ManagementFactory.getOperatingSystemMXBean(); - - // Careful with these values. - // Min size for pass dynamically determined below. - // zero if no swap space is configured. - private static long min_size_for_pass = 0; - private static final long MAX_SIZE_FOR_PASS = Long.MAX_VALUE; - - private static boolean trace = false; - - public static void main(String args[]) throws Exception { - if (args.length > 1 && args[1].equals("trace")) { - trace = true; - } - - long expected_swap_size = 0; - - if (args.length < 1 || args.length > 2) { - throw new IllegalArgumentException("Unexpected number of args " + args.length); - } - - - long min_size = mbean.getFreeSwapSpaceSize(); - if (min_size > 0) { - min_size_for_pass = min_size; - } - - long size = mbean.getTotalSwapSpaceSize(); - - if (trace) { - System.out.println("Total swap space size in bytes: " + size); - } - - if (!args[0].matches("sanity-only")) { - expected_swap_size = Long.parseLong(args[0]); - if (size != expected_swap_size) { - throw new RuntimeException("Expected total swap size : " + - expected_swap_size + - " but getTotalSwapSpaceSize returned: " + - size); - } - } - - if (size < min_size_for_pass || size > MAX_SIZE_FOR_PASS) { - throw new RuntimeException("Total swap space size " + - "illegal value: " + size + " bytes " + - "(MIN = " + min_size_for_pass + "; " + - "MAX = " + MAX_SIZE_FOR_PASS + ")"); - } - - System.out.println("Test passed."); - } -} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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 4858522 + * @summary Basic unit test of OperatingSystemMXBean.getTotalSwapSpaceSize() + * + * @library /lib/testlibrary + * @build TestTotalSwap jdk.testlibrary.* + * @run main TestTotalSwap + * + * @author Steve Bohne + * @author Jaroslav Bachorik + */ + +/* + * This test tests the actual swap size on linux and solaris. + * The correct value should be checked manually: + * Solaris: + * 1. In a shell, enter the command: "swap -l" + * 2. The value (reported in blocks) is in the "blocks" column. + * Linux: + * 1. In a shell, enter the command: "cat /proc/meminfo" + * 2. The value (reported in bytes) is in "Swap" entry, "total" column. + * Windows NT/XP/2000: + * 1. Run Start->Accessories->System Tools->System Information. + * 2. The value (reported in Kbytes) is in the "Page File Space" entry + * Windows 98/ME: + * Unknown. + * + * Usage: GetTotalSwapSpaceSize [trace] + */ + +import com.sun.management.OperatingSystemMXBean; +import java.lang.management.*; + +import jdk.testlibrary.OSInfo; +import jdk.testlibrary.ProcessTools; +import jdk.testlibrary.OutputAnalyzer; + +public class TestTotalSwap { + + private static final OperatingSystemMXBean mbean = + (com.sun.management.OperatingSystemMXBean) + ManagementFactory.getOperatingSystemMXBean(); + + // Careful with these values. + // Min size for pass dynamically determined below. + // zero if no swap space is configured. + private static long min_size_for_pass = 0; + private static final long MAX_SIZE_FOR_PASS = Long.MAX_VALUE; + + public static void main(String args[]) throws Throwable { + + long expected_swap_size = getSwapSizeFromOs(); + + long min_size = mbean.getFreeSwapSpaceSize(); + if (min_size > 0) { + min_size_for_pass = min_size; + } + + long size = mbean.getTotalSwapSpaceSize(); + + System.out.println("Total swap space size in bytes: " + size); + + if (expected_swap_size > -1) { + if (size != expected_swap_size) { + throw new RuntimeException("Expected total swap size : " + + expected_swap_size + + " but getTotalSwapSpaceSize returned: " + + size); + } + } + + // sanity check + if (size < min_size_for_pass || size > MAX_SIZE_FOR_PASS) { + throw new RuntimeException("Total swap space size " + + "illegal value: " + size + " bytes " + + "(MIN = " + min_size_for_pass + "; " + + "MAX = " + MAX_SIZE_FOR_PASS + ")"); + } + + System.out.println("Test passed."); + } + + private static long getSwapSizeFromOs() throws Throwable { + OSInfo.OSType os = OSInfo.getOSType(); + + switch (os) { + // total used free shared buffers cached + // Mem: 16533540864 13638467584 2895073280 534040576 1630248960 6236909568 + // -/+ buffers/cache: 5771309056 10762231808 + // Swap: 15999168512 0 15999168512 + + case LINUX: { + String swapSizeStr = ProcessTools.executeCommand("free", "-b") + .firstMatch("Swap:\\s+([0-9]+)\\s+.*", 1); + return Long.parseLong(swapSizeStr); + } + case SOLARIS: { + // swapfile dev swaplo blocks free + // /dev/dsk/c0t0d0s1 136,1 16 1638608 1600528 + OutputAnalyzer out= ProcessTools.executeCommand( + "/usr/sbin/swap", + "-l" + ); + + long swapSize = 0; + + for (String line : out.asLines()) { + if (line.contains("swapfile")) continue; + + String[] vals = line.split("\\s+"); + if (vals.length == 5) { + swapSize += Long.parseLong(vals[3]) * 512; // size is reported in 512b blocks + } + } + + return swapSize; + } + case MACOSX: { + // total = 8192.00M used = 7471.11M free = 720.89M (encrypted) + String swapSizeStr = ProcessTools.executeCommand( + "/usr/sbin/sysctl", + "-n", + "vm.swapusage" + ).firstMatch("total\\s+=\\s+([0-9]+(\\.[0-9]+)?[Mm]?).*", 1); + if (swapSizeStr.toLowerCase().endsWith("m")) { + swapSizeStr = swapSizeStr.substring(0, swapSizeStr.length() - 1); + return (long)(Double.parseDouble(swapSizeStr) * 1024 * 1024); // size in MB + } + return (long)(Double.parseDouble(swapSizeStr) * 1024 * 1024); + } + default: { + System.err.println("Unsupported operating system: " + os); + } + } + + return -1; + } +} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.sh --- a/jdk/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.sh Fri Feb 27 12:48:06 2015 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -# -# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# 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 -# @summary Tests MM getTotalSwapSpaceSize() api. -# @author Swamy V -# @bug 6252770 -# -# @run build GetTotalSwapSpaceSize -# @run shell TestTotalSwap.sh -# - -# -# This test tests the actual swap size on linux and solaris. -# On windows this is just a sanity check and correct size should -# be checked manually: -# -# Windows NT/XP/2000: -# 1. Run Start->Accessories->System Tools->System Information. -# 2. The value (reported in Kbytes) is in the "Page File Space" entry -# Windows 98/ME: -# Unknown. -# - - -#set -x - -#Set appropriate jdk -# - -if [ ! -z "${TESTJAVA}" ] ; then - jdk="$TESTJAVA" -else - echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test." - exit 1 -fi - -runOne() -{ - echo "runOne $@" - $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ || exit 3 -} - -solaris_swap_size() -{ - total_swap=0 - for i in `/usr/sbin/swap -l | awk '{print $4}' | grep -v blocks` - do - # swap -l returns size in blocks of 512 bytes. - total_swap=`expr $i \* 512 + $total_swap` - done -} - -# Test GetTotalSwapSpaceSize if we are running on Unix -total_swap=0 -case `uname -s` in - SunOS ) - solaris_swap_size - runOne GetTotalSwapSpaceSize $total_swap - ;; - Linux ) - total_swap=`free -b | grep -i swap | awk '{print $2}'` - runOne GetTotalSwapSpaceSize $total_swap - ;; - Darwin ) - # $ sysctl -n vm.swapusage - # total = 8192.00M used = 7471.11M free = 720.89M (encrypted) - swap=`/usr/sbin/sysctl -n vm.swapusage | awk '{ print $3 }' | awk -F . '{ print $1 }'` || exit 2 - total_swap=`expr $swap \* 1024 \* 1024` || exit 2 - runOne GetTotalSwapSpaceSize $total_swap - ;; - * ) - runOne GetTotalSwapSpaceSize "sanity-only" - ;; -esac - -exit 0 - diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/lang/Class/getEnclosingConstructor/EnclosingConstructorWithSecurityManager.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/lang/Class/getEnclosingConstructor/EnclosingConstructorWithSecurityManager.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8014678 + * @run main EnclosingConstructorWithSecurityManager + * @run main/othervm EnclosingConstructorWithSecurityManager "WithSecurityManager" + */ + +public class EnclosingConstructorWithSecurityManager { + public static void main(String[] args) { + if (args.length == 1) { + System.setSecurityManager(new SecurityManager()); + } + + new Inner(); + Inner.theInner.getEnclosingConstructor(); + } + + public static class Inner { + public static Class theInner; + + public Inner() { + Object o = new Object() { + }; + Inner.theInner = o.getClass(); + } + } +} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/lang/Class/getEnclosingMethod/EnclosingMethodWithSecurityManager.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/lang/Class/getEnclosingMethod/EnclosingMethodWithSecurityManager.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8014678 + * @run main EnclosingMethodWithSecurityManager + * @run main/othervm EnclosingMethodWithSecurityManager "WithSecurityManager" + */ + +public class EnclosingMethodWithSecurityManager { + public static void main(String[] args) { + if (args.length == 1) { + System.setSecurityManager(new SecurityManager()); + } + + new Inner().setTheInner(); + Inner.theInner.getEnclosingMethod(); + } + + public static class Inner { + public static Class theInner; + + public void setTheInner() { + Object o = new Object() { + }; + Inner.theInner = o.getClass(); + } + } +} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/lang/invoke/8009222/Test8009222.java --- a/jdk/test/java/lang/invoke/8009222/Test8009222.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/java/lang/invoke/8009222/Test8009222.java Mon Mar 02 05:32:01 2015 -0800 @@ -33,6 +33,7 @@ import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; +import java.util.Objects; interface Intf { static int i = 0; @@ -40,9 +41,8 @@ public class Test8009222 { public static void main(String[] args) throws Exception { - MethodHandles.lookup() - .findStaticGetter(Intf.class, "i", int.class) - .getClass(); // null check + Objects.requireNonNull(MethodHandles.lookup() + .findStaticGetter(Intf.class, "i", int.class)); System.out.println("TEST PASSED"); } diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java --- a/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.function.Predicate; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -235,8 +236,23 @@ .filter(s -> s.startsWith("WARNING: Exception")) .count(), 2, "show error each capture"); - // dumpLong/com/example/nosense/nosense - assertEquals(Files.walk(Paths.get("dumpLong")).count(), 5, "Two lambda captured failed to log"); + // dumpLong/com/example/nonsense/nonsense + Path dumpPath = Paths.get("dumpLong/com/example/nonsense"); + Predicate filter = p -> p.getParent() == null || dumpPath.startsWith(p) || p.startsWith(dumpPath); + boolean debug = true; + if (debug) { + Files.walk(Paths.get("dumpLong")) + .forEachOrdered(p -> { + if (filter.test(p)) { + System.out.println("accepted: " + p.toString()); + } else { + System.out.println("filetered out: " + p.toString()); + } + }); + } + assertEquals(Files.walk(Paths.get("dumpLong")) + .filter(filter) + .count(), 5, "Two lambda captured failed to log"); tr.assertZero("Should still return 0"); } } diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/lang/management/CompositeData/ThreadInfoCompositeData.java --- a/jdk/test/java/lang/management/CompositeData/ThreadInfoCompositeData.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/java/lang/management/CompositeData/ThreadInfoCompositeData.java Mon Mar 02 05:32:01 2015 -0800 @@ -147,6 +147,11 @@ info.getLockOwnerName() + " expected = " + values[LOCK_OWNER_NAME]); } + if (!values[DAEMON].equals(info.isDaemon())) { + throw new RuntimeException("Daemon = " + + info.isDaemon() + " expected = " + + values[DAEMON]); + } checkStackTrace(info.getStackTrace()); @@ -258,8 +263,11 @@ private static final int SUSPENDED = 11; private static final int IN_NATIVE = 12; private static final int NUM_V5_ATTS = 13; - // JDK 6.0 ThreadInfo attribtues + // JDK 6.0 ThreadInfo attributes private static final int LOCK_INFO = 13; + // JDK 9.0 ThreadInfo attributes + private static final int DAEMON = 14; + private static final int PRIORITY = 15; private static final String[] validItemNames = { "threadId", @@ -276,6 +284,8 @@ "suspended", "inNative", "lockInfo", + "daemon", + "priority", }; private static OpenType[] validItemTypes = { @@ -293,6 +303,8 @@ SimpleType.BOOLEAN, SimpleType.BOOLEAN, null, // CompositeType for LockInfo + SimpleType.BOOLEAN, + SimpleType.INTEGER, }; private static Object[] values = { @@ -310,6 +322,8 @@ new Boolean(false), new Boolean(false), null, // To be initialized to lockInfoCD + new Boolean(false), + Thread.NORM_PRIORITY, }; private static final String[] steItemNames = { @@ -381,6 +395,8 @@ "suspended", "inNative", "lockInfo", + "daemon", + "priority", }; private static final OpenType[] badItemTypes = { SimpleType.LONG, @@ -397,6 +413,8 @@ SimpleType.BOOLEAN, SimpleType.BOOLEAN, SimpleType.LONG, // bad type + SimpleType.BOOLEAN, + SimpleType.INTEGER, }; } diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/lang/management/ThreadMXBean/ThreadDaemonTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadDaemonTest.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.lang.management.*; +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.*; + +/* + * @test + * @bug 6588467 + * @summary Basic test of ThreadInfo.isDaemon + * @author Jeremy Manson + */ +public class ThreadDaemonTest { + + public static void main(String[] args) throws Exception { + final int NUM_THREADS = 20; + final String THREAD_PREFIX = "ThreadDaemonTest-"; + + final CountDownLatch started = new CountDownLatch(NUM_THREADS); + final CountDownLatch finished = new CountDownLatch(1); + final AtomicReference fail = new AtomicReference<>(null); + + Thread[] allThreads = new Thread[NUM_THREADS]; + ThreadMXBean mbean = ManagementFactory.getThreadMXBean(); + Random rand = new Random(); + + for (int i = 0; i < NUM_THREADS; i++) { + allThreads[i] = new Thread(new Runnable() { + public void run() { + try { + started.countDown(); + finished.await(); + } catch (InterruptedException e) { + fail.set(new Exception( + "Unexpected InterruptedException")); + } + } + }, THREAD_PREFIX + i); + allThreads[i].setDaemon(rand.nextBoolean()); + allThreads[i].start(); + } + + started.await(); + try { + ThreadInfo[] allThreadInfos = mbean.dumpAllThreads(false, false); + int count = 0; + for (int i = 0; i < allThreadInfos.length; i++) { + String threadName = allThreadInfos[i].getThreadName(); + if (threadName.startsWith(THREAD_PREFIX)) { + count++; + String[] nameAndNumber = threadName.split("-"); + int threadNum = Integer.parseInt(nameAndNumber[1]); + if (allThreads[threadNum].isDaemon() != + allThreadInfos[i].isDaemon()) { + throw new RuntimeException( + allThreads[threadNum] + " is not like " + + allThreadInfos[i] + ". TEST FAILED."); + } + } + } + if (count != NUM_THREADS) { + throw new RuntimeException("Wrong number of threads examined"); + } + } + finally { finished.countDown(); } + + for (int i = 0; i < NUM_THREADS; i++) { + allThreads[i].join(); + } + if (fail.get() != null) { + throw fail.get(); + } + } +} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/lang/management/ThreadMXBean/ThreadDump.java --- a/jdk/test/java/lang/management/ThreadMXBean/ThreadDump.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadDump.java Mon Mar 02 05:32:01 2015 -0800 @@ -34,6 +34,7 @@ public static void printThreadInfo(ThreadInfo ti) { StringBuilder sb = new StringBuilder("\"" + ti.getThreadName() + "\"" + + (ti.isDaemon() ? " daemon" : "") + " Id=" + ti.getThreadId() + " in " + ti.getThreadState()); if (ti.getLockName() != null) { diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/net/Socks/BadProxySelector.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/net/Socks/BadProxySelector.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7178362 + * @run main/othervm BadProxySelector + */ + +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.ProxySelector; +import java.net.Socket; +import java.net.SocketAddress; +import java.net.ServerSocket; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import java.io.*; + +public class BadProxySelector { + public static void main(String[] args) throws Exception { + ProxySelector.setDefault(new HTTPProxySelector()); + try (ServerSocket ss = new ServerSocket(0); + Socket s1 = new Socket(ss.getInetAddress(), ss.getLocalPort()); + Socket s2 = ss.accept()) { + } + + ProxySelector.setDefault(new NullHTTPProxySelector()); + try (ServerSocket ss = new ServerSocket(0); + Socket s1 = new Socket(ss.getInetAddress(), ss.getLocalPort()); + Socket s2 = ss.accept()) { + } + } + + // always returns bogus HTTP proxies + private static class HTTPProxySelector extends ProxySelector { + @Override + public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {} + + @Override + public List select(URI uri) { + List proxies = new ArrayList<>(); + proxies.add(new Proxy(Proxy.Type.HTTP, + new InetSocketAddress("localhost", 0))); + proxies.add(new Proxy(Proxy.Type.HTTP, + new InetSocketAddress("localhost", 0))); + return proxies; + } + } + + private static class NullHTTPProxySelector extends ProxySelector { + @Override + public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {} + + @Override + public List select(URI uri) { + List proxies = new ArrayList<>(); + proxies.add(null); + proxies.add(new Proxy(Proxy.Type.HTTP, + new InetSocketAddress("localhost", 0))); + return proxies; + } + } +} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/net/spi/URLStreamHandlerProvider/Basic.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/net/spi/URLStreamHandlerProvider/Basic.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,313 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.function.Consumer; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.StandardJavaFileManager; +import javax.tools.StandardLocation; +import javax.tools.ToolProvider; +import jdk.testlibrary.FileUtils; +import jdk.testlibrary.JDKToolFinder; +import static java.lang.String.format; +import static java.util.Arrays.asList; + +/* + * @test + * @bug 8064924 + * @summary Basic test for URLStreamHandlerProvider + * @library /lib/testlibrary + * @build jdk.testlibrary.FileUtils jdk.testlibrary.JDKToolFinder + * @compile Basic.java Child.java + * @run main Basic + */ + +public class Basic { + + static final Path TEST_SRC = Paths.get(System.getProperty("test.src", ".")); + static final Path TEST_CLASSES = Paths.get(System.getProperty("test.classes", ".")); + + public static void main(String[] args) throws Throwable { + unknownProtocol("foo", UNKNOWN); + unknownProtocol("bar", UNKNOWN); + viaProvider("baz", KNOWN); + viaProvider("bert", KNOWN); + viaProvider("ernie", UNKNOWN, "-Djava.security.manager"); + viaProvider("curly", UNKNOWN, "-Djava.security.manager"); + viaProvider("larry", KNOWN, "-Djava.security.manager", + "-Djava.security.policy=" + TEST_SRC + File.separator + "basic.policy"); + viaProvider("moe", KNOWN, "-Djava.security.manager", + "-Djava.security.policy=" + TEST_SRC + File.separator + "basic.policy"); + viaBadProvider("tom", SCE); + viaBadProvider("jerry", SCE); + } + + static final Consumer KNOWN = r -> { + if (r.exitValue != 0 || !r.output.isEmpty()) + throw new RuntimeException(r.output); + }; + static final Consumer UNKNOWN = r -> { + if (r.exitValue == 0 || + !r.output.contains("java.net.MalformedURLException: unknown protocol")) { + throw new RuntimeException("exitValue: "+ r.exitValue + ", output:[" +r.output +"]"); + } + }; + static final Consumer SCE = r -> { + if (r.exitValue == 0 || + !r.output.contains("java.util.ServiceConfigurationError")) { + throw new RuntimeException("exitValue: "+ r.exitValue + ", output:[" +r.output +"]"); + } + }; + + static void unknownProtocol(String protocol, Consumer resultChecker) { + System.out.println("\nTesting " + protocol); + Result r = java(Collections.emptyList(), asList(TEST_CLASSES), + "Child", protocol); + resultChecker.accept(r); + } + + static void viaProvider(String protocol, Consumer resultChecker, + String... sysProps) + throws Exception + { + viaProviderWithTemplate(protocol, resultChecker, + TEST_SRC.resolve("provider.template"), + sysProps); + } + + static void viaBadProvider(String protocol, Consumer resultChecker, + String... sysProps) + throws Exception + { + viaProviderWithTemplate(protocol, resultChecker, + TEST_SRC.resolve("bad.provider.template"), + sysProps); + } + + static void viaProviderWithTemplate(String protocol, + Consumer resultChecker, + Path template, String... sysProps) + throws Exception + { + System.out.println("\nTesting " + protocol); + Path testRoot = Paths.get("URLStreamHandlerProvider-" + protocol); + if (Files.exists(testRoot)) + FileUtils.deleteFileTreeWithRetry(testRoot); + Files.createDirectory(testRoot); + + Path srcPath = Files.createDirectory(testRoot.resolve("src")); + Path srcClass = createProvider(protocol, template, srcPath); + + Path build = Files.createDirectory(testRoot.resolve("build")); + javac(build, srcClass); + createServices(build, protocol); + Path testJar = testRoot.resolve("test.jar"); + jar(testJar, build); + + List props = new ArrayList<>(); + for (String p : sysProps) + props.add(p); + + Result r = java(props, asList(testJar, TEST_CLASSES), + "Child", protocol); + + resultChecker.accept(r); + } + + static String platformPath(String p) { return p.replace("/", File.separator); } + static String binaryName(String name) { return name.replace(".", "/"); } + + static final String SERVICE_IMPL_PREFIX = "net.java.openjdk.test"; + + static void createServices(Path dst, String protocol) throws IOException { + Path services = Files.createDirectories(dst.resolve("META-INF") + .resolve("services")); + + final String implName = SERVICE_IMPL_PREFIX + "." + protocol + ".Provider"; + Path s = services.resolve("java.net.spi.URLStreamHandlerProvider"); + FileWriter fw = new FileWriter(s.toFile()); + try { + fw.write(implName); + } finally { + fw.close(); + } + } + + static Path createProvider(String protocol, Path srcTemplate, Path dst) + throws IOException + { + String pkg = SERVICE_IMPL_PREFIX + "." + protocol; + Path classDst = dst.resolve(platformPath(binaryName(pkg))); + Files.createDirectories(classDst); + Path classPath = classDst.resolve("Provider.java"); + + List lines = Files.lines(srcTemplate) + .map(s -> s.replaceAll("\\$package", pkg)) + .map(s -> s.replaceAll("\\$protocol", protocol)) + .collect(Collectors.toList()); + Files.write(classPath, lines); + + return classPath; + } + + static void jar(Path jarName, Path jarRoot) { String jar = getJDKTool("jar"); + ProcessBuilder p = new ProcessBuilder(jar, "cf", jarName.toString(), + "-C", jarRoot.toString(), "."); + quickFail(run(p)); + } + + static void javac(Path dest, Path... sourceFiles) throws IOException { + JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + try (StandardJavaFileManager fileManager = + compiler.getStandardFileManager(null, null, null)) { + + List files = Stream.of(sourceFiles) + .map(p -> p.toFile()) + .collect(Collectors.toList()); + List dests = Stream.of(dest) + .map(p -> p.toFile()) + .collect(Collectors.toList()); + Iterable compilationUnits = + fileManager.getJavaFileObjectsFromFiles(files); + fileManager.setLocation(StandardLocation.CLASS_OUTPUT, dests); + JavaCompiler.CompilationTask task = + compiler.getTask(null, fileManager, null, null, null, compilationUnits); + boolean passed = task.call(); + if (!passed) + throw new RuntimeException("Error compiling " + files); + } + } + + static void quickFail(Result r) { + if (r.exitValue != 0) + throw new RuntimeException(r.output); + } + + static Result java(List sysProps, Collection classpath, + String classname, String arg) { + String java = getJDKTool("java"); + + List commands = new ArrayList<>(); + commands.add(java); + for (String prop : sysProps) + commands.add(prop); + + String cp = classpath.stream() + .map(Path::toString) + .collect(Collectors.joining(File.pathSeparator)); + commands.add("-cp"); + commands.add(cp); + commands.add(classname); + commands.add(arg); + + return run(new ProcessBuilder(commands)); + } + + static Result run(ProcessBuilder pb) { + Process p = null; + System.out.println("running: " + pb.command()); + try { + p = pb.start(); + } catch (IOException e) { + throw new RuntimeException( + format("Couldn't start process '%s'", pb.command()), e); + } + + String output; + try { + output = toString(p.getInputStream(), p.getErrorStream()); + } catch (IOException e) { + throw new RuntimeException( + format("Couldn't read process output '%s'", pb.command()), e); + } + + try { + p.waitFor(); + } catch (InterruptedException e) { + throw new RuntimeException( + format("Process hasn't finished '%s'", pb.command()), e); + } + + return new Result(p.exitValue(), output); + } + + static final String DEFAULT_IMAGE_BIN = System.getProperty("java.home") + + File.separator + "bin" + File.separator; + + static String getJDKTool(String name) { + try { + return JDKToolFinder.getJDKTool(name); + } catch (Exception x) { + return DEFAULT_IMAGE_BIN + name; + } + } + + static String toString(InputStream... src) throws IOException { + StringWriter dst = new StringWriter(); + Reader concatenated = + new InputStreamReader( + new SequenceInputStream( + Collections.enumeration(asList(src)))); + copy(concatenated, dst); + return dst.toString(); + } + + static void copy(Reader src, Writer dst) throws IOException { + int len; + char[] buf = new char[1024]; + try { + while ((len = src.read(buf)) != -1) + dst.write(buf, 0, len); + } finally { + try { + src.close(); + } catch (IOException ignored1) { + } finally { + try { + dst.close(); + } catch (IOException ignored2) { + } + } + } + } + + static class Result { + final int exitValue; + final String output; + + private Result(int exitValue, String output) { + this.exitValue = exitValue; + this.output = output; + } + } +} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/net/spi/URLStreamHandlerProvider/Child.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/net/spi/URLStreamHandlerProvider/Child.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.net.MalformedURLException; +import java.net.URL; + +public class Child { + + public static void main(String[] args) throws MalformedURLException { + if (args.length != 1) { + System.err.println("Usage: java Child "); + return; + } + String protocol = args[0]; + URL url = new URL(protocol + "://"); + + // toExternalForm should return the protocol string + String s = url.toExternalForm(); + if (!s.equals(protocol)) { + System.err.println("Expected url.toExternalForm to return " + + protocol + ", but got: " + s); + System.exit(1); + } + } +} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/net/spi/URLStreamHandlerProvider/bad.provider.template --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/net/spi/URLStreamHandlerProvider/bad.provider.template Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package $package; + +import java.net.URL; +import java.net.URLConnection; +import java.net.URLStreamHandler; +import java.net.spi.URLStreamHandlerProvider; + +public class Provider extends URLStreamHandlerProvider { + + public Provider(String someRandomArg) { // No no-args constructor + super(); + } + + @Override + public URLStreamHandler createURLStreamHandler(String protocol) { + return null; + } +} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/net/spi/URLStreamHandlerProvider/basic.policy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/net/spi/URLStreamHandlerProvider/basic.policy Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + grant { + permission java.lang.RuntimePermission "setFactory"; +}; + diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/net/spi/URLStreamHandlerProvider/provider.template --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/net/spi/URLStreamHandlerProvider/provider.template Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package $package; + +import java.net.URL; +import java.net.URLConnection; +import java.net.URLStreamHandler; +import java.net.spi.URLStreamHandlerProvider; + +public class Provider extends URLStreamHandlerProvider { + + private static final String PROTOCOL = "$protocol"; + + @Override + public URLStreamHandler createURLStreamHandler(String protocol) { + if (!PROTOCOL.equals(protocol)) + return null; + + return new Handler(); + } + + static class Handler extends URLStreamHandler { + public URLConnection openConnection(URL u) throws java.io.IOException { + return null; + } + + public String toExternalForm(URL u) { return PROTOCOL; } + } +} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/nio/charset/Charset/NIOCharsetAvailabilityTest.java --- a/jdk/test/java/nio/charset/Charset/NIOCharsetAvailabilityTest.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/java/nio/charset/Charset/NIOCharsetAvailabilityTest.java Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,41 +23,63 @@ /* * @test - * @bug 4777124 6920545 6911753 + * @bug 4777124 6920545 6911753 8073924 * @summary Verify that all Charset subclasses are available through the API */ -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; +import java.net.URI; import java.nio.charset.Charset; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.Collection; +import java.nio.file.FileSystem; +import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.HashSet; -import java.util.Iterator; import java.util.Set; -import java.util.Vector; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - +import java.util.stream.Collectors; +import java.util.stream.Stream; public class NIOCharsetAvailabilityTest { public static void main(String[] args) throws Exception { + // build the set of all Charset subclasses in the // two known charset implementation packages - Set charsets = new HashSet(); - addCharsets(charsets, "sun.nio.cs"); - addCharsets(charsets, "sun.nio.cs.ext"); - + FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/")); + Set charsets = + Stream.concat(Files.walk(fs.getPath("/java.base/sun/nio/cs/")), + Files.walk(fs.getPath("/jdk.charsets/sun/nio/cs/ext/"))) + .map( p -> p.subpath(1, p.getNameCount()).toString()) + .filter( s -> s.indexOf("$") == -1 && s.endsWith(".class")) + .map( s -> { + try { + return Class.forName(s.substring(0, s.length() - 6) + .replace('/', '.')); + } catch (Exception x) { + throw new RuntimeException(x); + } + }) + .filter( clz -> { + Class superclazz = clz.getSuperclass(); + while (superclazz != null && !superclazz.equals(Object.class)) { + if (superclazz.equals(Charset.class)) { + return true; + } else { + superclazz = superclazz.getSuperclass(); + } + } + return false; + }) + .collect(Collectors.toCollection(HashSet::new)); // remove the charsets that the API says are available - Collection availableCharsets = Charset.availableCharsets().values(); - Iterator iter = availableCharsets.iterator(); - while (iter.hasNext()) { - charsets.remove(((Charset) iter.next()).getClass()); - } + Charset.availableCharsets() + .values() + .stream() + .forEach(cs -> { + if (!charsets.contains(cs.getClass())) { + System.out.println(" missing -> " + cs.getClass()); + } + charsets.remove(cs.getClass()); + }); // remove the known pseudo-charsets that serve only to implement // other charsets, but shouldn't be known to the public @@ -76,146 +98,12 @@ charsets.remove(Class.forName("sun.nio.cs.JIS_X_0208_Solaris")); charsets.remove(Class.forName("sun.nio.cs.JIS_X_0212_Solaris")); } - // report the charsets that are implemented but not available - iter = charsets.iterator(); - while (iter.hasNext()) { - System.out.println("Unused Charset subclass: " + ((Class) iter.next()).getName()); - } if (charsets.size() > 0) { + charsets.stream() + .forEach( clz -> + System.out.println("Unused Charset subclass: " + clz)); throw new RuntimeException(); } } - - private static Vector classPathSegments = new Vector(); - - private static void addCharsets(Set charsets, final String packageName) - throws Exception { - - String classPath = AccessController.doPrivileged( - (PrivilegedAction)() -> System.getProperty("sun.boot.class.path")); - String s = AccessController.doPrivileged( - (PrivilegedAction)() -> System.getProperty("java.class.path")); - - // Search combined system and application class path - if (s != null && s.length() != 0) { - classPath += File.pathSeparator + s; - } - while (classPath != null && classPath.length() != 0) { - int i = classPath.lastIndexOf(java.io.File.pathSeparatorChar); - String dir = classPath.substring(i + 1); - if (i == -1) { - classPath = null; - } else { - classPath = classPath.substring(0, i); - } - classPathSegments.insertElementAt(dir, 0); - } - - String[] classList = (String[]) - java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { - return getClassList(packageName, ""); - } - }); - - for (int i = 0; i < classList.length; i++) { - try { - Class clazz = Class.forName(packageName + "." + classList[i]); - Class superclazz = clazz.getSuperclass(); - while (superclazz != null && !superclazz.equals(Object.class)) { - if (superclazz.equals(Charset.class)) { - charsets.add(clazz); - break; - } else { - superclazz = superclazz.getSuperclass(); - } - } - } catch (ClassNotFoundException e) { - } - } - } - - private static final char ZIPSEPARATOR = '/'; - - /** - * Walk through CLASSPATH and find class list from a package. - * The class names start with prefix string - * @param package name, class name prefix - * @return class list in an array of String - */ - private static String[] getClassList(String pkgName, String prefix) { - Vector listBuffer = new Vector(); - String packagePath = pkgName.replace('.', File.separatorChar) - + File.separatorChar; - String zipPackagePath = pkgName.replace('.', ZIPSEPARATOR) - + ZIPSEPARATOR; - for (int i = 0; i < classPathSegments.size(); i++){ - String onePath = (String) classPathSegments.elementAt(i); - File f = new File(onePath); - if (!f.exists()) - continue; - if (f.isFile()) - scanFile(f, zipPackagePath, listBuffer, prefix); - else if (f.isDirectory()) { - String fullPath; - if (onePath.endsWith(File.separator)) - fullPath = onePath + packagePath; - else - fullPath = onePath + File.separatorChar + packagePath; - File dir = new File(fullPath); - if (dir.exists() && dir.isDirectory()) - scanDir(dir, listBuffer, prefix); - } - } - String[] classNames = new String[listBuffer.size()]; - listBuffer.copyInto(classNames); - return classNames; - } - - private static void addClass (String className, Vector listBuffer, String prefix) { - if (className != null && className.startsWith(prefix) - && !listBuffer.contains(className)) - listBuffer.addElement(className); - } - - private static String midString(String str, String pre, String suf) { - String midStr; - if (str.startsWith(pre) && str.endsWith(suf)) - midStr = str.substring(pre.length(), str.length() - suf.length()); - else - midStr = null; - return midStr; - } - - private static void scanDir(File dir, Vector listBuffer, String prefix) { - String[] fileList = dir.list(); - for (int i = 0; i < fileList.length; i++) { - addClass(midString(fileList[i], "", ".class"), listBuffer, prefix); - } - } - - private static void scanFile(File f, String packagePath, Vector listBuffer, - String prefix) { - try { - ZipInputStream zipFile = new ZipInputStream(new FileInputStream(f)); - ZipEntry entry; - while ((entry = zipFile.getNextEntry()) != null) { - String eName = entry.getName(); - if (eName.startsWith(packagePath)) { - if (eName.endsWith(".class")) { - addClass(midString(eName, packagePath, ".class"), - listBuffer, prefix); - } - } - } - } catch (FileNotFoundException e) { - System.out.println("file not found:" + e); - } catch (IOException e) { - System.out.println("file IO Exception:" + e); - } catch (Exception e) { - System.out.println("Exception:" + e); - } - } } diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/nio/charset/Charset/RegisteredCharsets.java --- a/jdk/test/java/nio/charset/Charset/RegisteredCharsets.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/java/nio/charset/Charset/RegisteredCharsets.java Mon Mar 02 05:32:01 2015 -0800 @@ -22,7 +22,8 @@ */ /* @test - * @bug 4473201 4696726 4652234 4482298 4784385 4966197 4267354 5015668 6911753 + * @bug 4473201 4696726 4652234 4482298 4784385 4966197 4267354 5015668 + 6911753 8071447 * @summary Check that registered charsets are actually registered */ @@ -135,6 +136,7 @@ "x-IBM1122", "x-IBM1123", "x-IBM1124", + "x-IBM1166", "x-IBM875", "x-IBM921", "x-IBM922", @@ -863,6 +865,14 @@ "1124" } ); + aliasCheck("x-IBM1166" , + new String[] { + "cp1166", // JDK historical + "ibm1166", + "ibm-1166", + "1166" + } ); + aliasCheck("IBM273" , new String[] { "cp273", // JDK historical diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/nio/charset/RemovingSunIO/SunioAlias.java --- a/jdk/test/java/nio/charset/RemovingSunIO/SunioAlias.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/java/nio/charset/RemovingSunIO/SunioAlias.java Mon Mar 02 05:32:01 2015 -0800 @@ -675,6 +675,12 @@ aliasTable.put("1124", "Cp1124"); // MIBenum: ???? + aliasTable.put("ibm1166", "Cp1166"); + aliasTable.put("ibm-1166", "Cp1166"); + aliasTable.put("cp1166", "Cp1166"); + aliasTable.put("1166", "Cp1166"); + + // MIBenum: ???? aliasTable.put("ibm1381", "Cp1381"); /* MDA */ aliasTable.put("ibm-1381", "Cp1381"); /* MDA */ aliasTable.put("cp1381", "Cp1381"); /* MDA */ diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/time/test/java/time/TestClock_System.java --- a/jdk/test/java/time/test/java/time/TestClock_System.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/java/time/test/java/time/TestClock_System.java Mon Mar 02 05:32:01 2015 -0800 @@ -66,8 +66,10 @@ import java.time.Clock; import java.time.Instant; import java.time.ZoneId; +import java.time.ZoneOffset; import org.testng.annotations.Test; +import org.testng.annotations.DataProvider; /** * Test system clock. @@ -76,6 +78,7 @@ public class TestClock_System { private static final ZoneId PARIS = ZoneId.of("Europe/Paris"); + private static final Clock systemUTC = Clock.systemUTC(); public void test_withZone_same() { Clock test = Clock.system(PARIS); @@ -90,6 +93,32 @@ } //----------------------------------------------------------------------- + @DataProvider(name="sampleSystemUTC") + Object[][] provider_sampleSystemUTC() { + return new Object[][] { + {"Clock.systemUTC()#1", Clock.systemUTC()}, + {"Clock.systemUTC()#2", Clock.systemUTC()}, + {"Clock.system(ZoneOffset.UTC)#1", Clock.system(ZoneOffset.UTC)}, + {"Clock.system(ZoneOffset.UTC)#2", Clock.system(ZoneOffset.UTC)} + }; + } + + // Test for 8073394 + @Test(dataProvider="sampleSystemUTC") + public void test_systemUTC(String s, Clock clock) { + if (clock != systemUTC) { + throw new RuntimeException("Unexpected clock instance for " + s + ": " + + "\n\texpected: " + toString(systemUTC) + + "\n\tactual: " + toString(clock)); + } + } + + private static String toString(Clock c) { + return c == null ? null : + c + " " + c.getClass().getName() + "@" + System.identityHashCode(c); + } + + //----------------------------------------------------------------------- private static String formatTime(String prefix, Instant time) { return prefix + ": " + time + " - seconds: " diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/util/Arrays/TimSortStackSize2.java --- a/jdk/test/java/util/Arrays/TimSortStackSize2.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/java/util/Arrays/TimSortStackSize2.java Mon Mar 02 05:32:01 2015 -0800 @@ -24,63 +24,59 @@ /* * @test * @bug 8072909 - * @run main/othervm -Xmx385m TimSortStackSize2 67108864 - * not for regular execution on all platforms: + * @run main/othervm -Xms385m TimSortStackSize2 67108864 + * @summary Test TimSort stack size on big arrays + * big tests not for regular execution on all platforms: * run main/othervm -Xmx8g TimSortStackSize2 1073741824 * run main/othervm -Xmx16g TimSortStackSize2 2147483644 - * @summary Test TimSort stack size on big arrays */ import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.List; +import java.util.function.Consumer; public class TimSortStackSize2 { public static void main(String[] args) { int lengthOfTest = Integer.parseInt(args[0]); - boolean passed = true; - try { - Integer [] a = new TimSortStackSize2(lengthOfTest).createArray(); - long begin = System.nanoTime(); - Arrays.sort(a, new Comparator() { - @SuppressWarnings("unchecked") - public int compare(Object first, Object second) { - return ((Comparable)first).compareTo(second); - } - }); - long end = System.nanoTime(); - System.out.println("TimSort: " + (end - begin)); - a = null; - } catch (ArrayIndexOutOfBoundsException e){ - System.out.println("TimSort broken:"); - e.printStackTrace(); - passed = false; - } - - try { - Integer [] a = new TimSortStackSize2(lengthOfTest).createArray(); - long begin = System.nanoTime(); - Arrays.sort(a); - long end = System.nanoTime(); - System.out.println("ComparableTimSort: " + (end - begin)); - a = null; - } catch (ArrayIndexOutOfBoundsException e){ - System.out.println("ComparableTimSort broken:"); - e.printStackTrace(); - passed = false; - } + boolean passed = doTest("TimSort", lengthOfTest, + (Integer [] a) -> Arrays.sort(a)); + passed = doTest("ComparableTimSort", lengthOfTest, (Integer [] a) -> + Arrays.sort(a, (Object first, Object second) -> { + return ((Comparable)first).compareTo(second); + })) + && passed; if ( !passed ){ throw new RuntimeException(); } } + private static boolean doTest(final String msg, final int lengthOfTest, + final Consumer c){ + Integer [] a = null; + try { + a = new TimSortStackSize2(lengthOfTest).createArray(); + long begin = System.nanoTime(); + c.accept(a); + long end = System.nanoTime(); + System.out.println(msg + " OK. Time: " + (end - begin) + "ns"); + } catch (ArrayIndexOutOfBoundsException e){ + System.out.println(msg + " broken:"); + e.printStackTrace(); + return false; + } finally { + a = null; + } + return true; + } + private static final int MIN_MERGE = 32; private final int minRun; private final int length; private final List runs = new ArrayList(); - public TimSortStackSize2(int len) { + public TimSortStackSize2(final int len) { this.length = len; minRun = minRunLength(len); fillRunsJDKWorstCase(); @@ -106,24 +102,24 @@ * @param X The sum of the sequence that should be added to runs. */ private void generateJDKWrongElem(long X) { - for(long newTotal; X >= 2*minRun+1; X = newTotal) { + for(long newTotal; X >= 2 * minRun + 1; X = newTotal) { //Default strategy - newTotal = X/2 + 1; + newTotal = X / 2 + 1; //Specialized strategies - if(3*minRun+3 <= X && X <= 4*minRun+1) { + if(3 * minRun + 3 <= X && X <= 4*minRun+1) { // add x_1=MIN+1, x_2=MIN, x_3=X-newTotal to runs - newTotal = 2*minRun+1; - } else if(5*minRun+5 <= X && X <= 6*minRun+5) { + newTotal = 2 * minRun + 1; + } else if (5 * minRun + 5 <= X && X <= 6 * minRun + 5) { // add x_1=MIN+1, x_2=MIN, x_3=MIN+2, x_4=X-newTotal to runs - newTotal = 3*minRun+3; - } else if(8*minRun+9 <= X && X <= 10*minRun+9) { + newTotal = 3 * minRun + 3; + } else if (8 * minRun + 9 <= X && X <= 10 * minRun + 9) { // add x_1=MIN+1, x_2=MIN, x_3=MIN+2, x_4=2MIN+2, x_5=X-newTotal to runs - newTotal = 5*minRun+5; - } else if(13*minRun+15 <= X && X <= 16*minRun+17) { + newTotal = 5 * minRun + 5; + } else if (13 * minRun + 15 <= X && X <= 16 * minRun + 17) { // add x_1=MIN+1, x_2=MIN, x_3=MIN+2, x_4=2MIN+2, x_5=3MIN+4, x_6=X-newTotal to runs - newTotal = 8*minRun+9; + newTotal = 8 * minRun + 9; } - runs.add(0, X-newTotal); + runs.add(0, X - newTotal); } runs.add(0, X); } @@ -144,10 +140,10 @@ long Y = minRun + 4; long X = minRun; - while(runningTotal+Y+X <= length) { + while (runningTotal + Y + X <= length) { runningTotal += X + Y; generateJDKWrongElem(X); - runs.add(0,Y); + runs.add(0, Y); // X_{i+1} = Y_i + x_{i,1} + 1, since runs.get(1) = x_{i,1} X = Y + runs.get(1) + 1; @@ -156,21 +152,22 @@ Y += X + 1; } - if(runningTotal + X <= length) { + if (runningTotal + X <= length) { runningTotal += X; generateJDKWrongElem(X); } - runs.add(length-runningTotal); + runs.add(length - runningTotal); } - private Integer[] createArray() { - Integer[] a = new Integer[length]; + private Integer [] createArray() { + Integer [] a = new Integer[length]; Arrays.fill(a, 0); int endRun = -1; - for(long len : runs) - a[endRun+=len] = 1; - a[length-1]=0; + for (long len : runs) { + a[endRun += len] = 1; + } + a[length - 1] = 0; return a; } diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/util/logging/FileHandlerLongLimit.java --- a/jdk/test/java/util/logging/FileHandlerLongLimit.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/java/util/logging/FileHandlerLongLimit.java Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -346,26 +346,29 @@ assertEquals(0, getWritten(metered), "written"); // now we're going to publish a series of log records + // we're using the same log record over and over to make + // sure we get the same amount of bytes. String msg = "this is at least 10 chars long"; - fh.publish(new LogRecord(Level.SEVERE, msg)); + LogRecord record = new LogRecord(Level.SEVERE, msg); + fh.publish(record); fh.flush(); long w = getWritten(metered); long offset = getWritten(metered); System.out.println("first offset is: " + offset); - fh.publish(new LogRecord(Level.SEVERE, msg)); + fh.publish(record); fh.flush(); offset = getWritten(metered) - w; w = getWritten(metered); System.out.println("second offset is: " + offset); - fh.publish(new LogRecord(Level.SEVERE, msg)); + fh.publish(record); fh.flush(); offset = getWritten(metered) - w; w = getWritten(metered); System.out.println("third offset is: " + offset); - fh.publish(new LogRecord(Level.SEVERE, msg)); + fh.publish(record); fh.flush(); offset = getWritten(metered) - w; System.out.println("fourth offset is: " + offset); @@ -377,7 +380,7 @@ // publish one more log record. we should still be just beneath // the limit - fh.publish(new LogRecord(Level.SEVERE, msg)); + fh.publish(record); fh.flush(); assertEquals(w+offset, getWritten(metered), "written"); @@ -392,9 +395,9 @@ // writing the first log record or just before writing the next // one. We publich two - so we're sure that the log must have // rotated. - fh.publish(new LogRecord(Level.SEVERE, msg)); + fh.publish(record); fh.flush(); - fh.publish(new LogRecord(Level.SEVERE, msg)); + fh.publish(record); fh.flush(); // Check that fh.meter is a different instance of MeteredStream. diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/util/logging/HigherResolutionTimeStamps/LogRecordWithNanos.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/util/logging/HigherResolutionTimeStamps/LogRecordWithNanos.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import java.util.logging.SimpleFormatter; + +/** + * @test + * @bug 8072645 + * @summary tests that LogRecord has nanos... + * @run main LogRecordWithNanos + * @author danielfuchs + */ +public class LogRecordWithNanos { + + static final int MILLIS_IN_SECOND = 1000; + static final int NANOS_IN_MILLI = 1000_000; + static final int NANOS_IN_SECOND = 1000_000_000; + + static final boolean verbose = false; + + static final class TestAssertException extends RuntimeException { + TestAssertException(String msg) { super(msg); } + } + + private static void assertEquals(long expected, long received, String msg) { + if (expected != received) { + throw new TestAssertException("Unexpected result for " + msg + + ".\n\texpected: " + expected + + "\n\tactual: " + received); + } else if (verbose) { + System.out.println("Got expected " + msg + ": " + received); + } + } + + /** + * Serializes a log record, then deserializes it and check that both + * records match. + * @param record the log record to serialize & deserialize. + * @throws IOException Unexpected. + * @throws ClassNotFoundException Unexpected. + */ + public static void test(LogRecord record) + throws IOException, ClassNotFoundException { + + // Format the given logRecord using the SimpleFormatter + SimpleFormatter formatter = new SimpleFormatter(); + String str = formatter.format(record); + + // Serialize the given LogRecord + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final ObjectOutputStream oos = new ObjectOutputStream(baos); + oos.writeObject(record); + oos.flush(); + oos.close(); + + // First checks that the log record can be deserialized + final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); + final ObjectInputStream ois = new ObjectInputStream(bais); + final LogRecord record2 = (LogRecord)ois.readObject(); + + assertEquals(record.getMillis(), record2.getMillis(), "getMillis()"); + assertEquals(record.getInstant().getEpochSecond(), + record2.getInstant().getEpochSecond(), + "getInstant().getEpochSecond()"); + assertEquals(record.getInstant().getNano(), + record2.getInstant().getNano(), + "getInstant().getNano()"); + assertEquals(record.getInstant().toEpochMilli(), + record2.getInstant().toEpochMilli(), + "getInstant().toEpochMilli()"); + assertEquals(record.getMillis(), + record.getInstant().toEpochMilli(), + "getMillis()/getInstant().toEpochMilli()"); + assertEquals(record2.getMillis(), + record2.getInstant().toEpochMilli(), + "getMillis()/getInstant().toEpochMilli()"); + assertEquals((record.getMillis()%MILLIS_IN_SECOND)*NANOS_IN_MILLI + + (record.getInstant().getNano() % NANOS_IN_MILLI), + record.getInstant().getNano(), + "record.getMillis()%1000)*1000_000" + + " + record.getInstant().getNano()%1000_000 / getInstant().getNano()"); + assertEquals((record2.getMillis()%MILLIS_IN_SECOND)*NANOS_IN_MILLI + + (record2.getInstant().getNano() % NANOS_IN_MILLI), + record2.getInstant().getNano(), + "record2.getMillis()%1000)*1000_000" + + " + record2.getInstant().getNano()%1000_000 / getInstant().getNano()"); + + // Format the deserialized LogRecord using the SimpleFormatter, and + // check that the string representation obtained matches the string + // representation of the original LogRecord + String str2 = formatter.format(record2); + if (!str.equals(str2)) + throw new RuntimeException("Unexpected values in deserialized object:" + + "\n\tExpected: " + str + + "\n\tRetrieved: "+str); + + } + + + public static void main(String[] args) throws Exception { + int count=0; + for (int i=0; i<1000; i++) { + LogRecord record = new LogRecord(Level.INFO, "Java Version: {0}"); + record.setLoggerName("test"); + record.setParameters(new Object[] {System.getProperty("java.version")}); + if (record.getInstant().getNano() % 1000_000 != 0) { + count++; + } + test(record); + } + if (count == 0) { + throw new RuntimeException("Expected at least one record to have nanos"); + } + System.out.println(count + "/1000 records had nano adjustment."); + } + +} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/util/logging/HigherResolutionTimeStamps/LogRecordWithNanosAPI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/util/logging/HigherResolutionTimeStamps/LogRecordWithNanosAPI.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,308 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.time.Instant; +import java.util.Objects; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import java.util.logging.SimpleFormatter; + +/** + * @test + * @bug 8072645 + * @summary tests the new methods added to LogRecord. + * @run main LogRecordWithNanosAPI + * @author danielfuchs + */ +public class LogRecordWithNanosAPI { + + static final int MILLIS_IN_SECOND = 1000; + static final int NANOS_IN_MILLI = 1000_000; + static final int NANOS_IN_SECOND = 1000_000_000; + + static final boolean verbose = true; + + static final class TestAssertException extends RuntimeException { + TestAssertException(String msg) { super(msg); } + } + + private static void assertEquals(long expected, long received, String msg) { + if (expected != received) { + throw new TestAssertException("Unexpected result for " + msg + + ".\n\texpected: " + expected + + "\n\tactual: " + received); + } else if (verbose) { + System.out.println("Got expected " + msg + ": " + received); + } + } + + private static void assertEquals(Object expected, Object received, String msg) { + if (!Objects.equals(expected, received)) { + throw new TestAssertException("Unexpected result for " + msg + + ".\n\texpected: " + expected + + "\n\tactual: " + received); + } else if (verbose) { + System.out.println("Got expected " + msg + ": " + received); + } + } + + // The nano second fractional part of a second, contained in a time expressed + // as a number of millisecond from the epoch. + private static long nanoInSecondFromEpochMilli(long millis) { + return (((millis%MILLIS_IN_SECOND) + MILLIS_IN_SECOND)%MILLIS_IN_SECOND)*NANOS_IN_MILLI; + } + + /** + * Serializes a log record, then deserializes it and check that both + * records match. + * @param record the log record to serialize & deserialize. + * @param hasExceedingNanos whether the record has a nano adjustment whose + * value exceeds 1ms. + * @throws IOException Unexpected. + * @throws ClassNotFoundException Unexpected. + */ + public static void test(LogRecord record, boolean hasExceedingNanos) + throws IOException, ClassNotFoundException { + + // Format the given logRecord using the SimpleFormatter + SimpleFormatter formatter = new SimpleFormatter(); + String str = formatter.format(record); + + // Serialize the given LogRecord + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final ObjectOutputStream oos = new ObjectOutputStream(baos); + oos.writeObject(record); + oos.flush(); + oos.close(); + + // First checks that the log record can be deserialized + final ByteArrayInputStream bais = + new ByteArrayInputStream(baos.toByteArray()); + final ObjectInputStream ois = new ObjectInputStream(bais); + final LogRecord record2 = (LogRecord)ois.readObject(); + + assertEquals(record.getMillis(), record2.getMillis(), "getMillis()"); + assertEquals(record.getInstant().getEpochSecond(), + record2.getInstant().getEpochSecond(), + "getInstant().getEpochSecond()"); + assertEquals(record.getInstant().getNano(), + record2.getInstant().getNano(), + "getInstant().getNano()"); + assertEquals(record.getInstant().toEpochMilli(), + record2.getInstant().toEpochMilli(), + "getInstant().toEpochMilli()"); + long millis = record.getMillis(); + millis = hasExceedingNanos + ? Instant.ofEpochSecond(millis/MILLIS_IN_SECOND, + (millis%MILLIS_IN_SECOND)*NANOS_IN_MILLI + + record.getInstant().getNano() % NANOS_IN_MILLI).toEpochMilli() + : millis; + assertEquals(millis, record.getInstant().toEpochMilli(), + "getMillis()/getInstant().toEpochMilli()"); + millis = record2.getMillis(); + millis = hasExceedingNanos + ? Instant.ofEpochSecond(millis/MILLIS_IN_SECOND, + (millis%MILLIS_IN_SECOND)*NANOS_IN_MILLI + + record2.getInstant().getNano() % NANOS_IN_MILLI).toEpochMilli() + : millis; + assertEquals(millis, record2.getInstant().toEpochMilli(), + "getMillis()/getInstant().toEpochMilli()"); + long nanos = nanoInSecondFromEpochMilli(record.getMillis()) + + record.getInstant().getNano() % NANOS_IN_MILLI; + assertEquals(nanos, record.getInstant().getNano(), + "nanoInSecondFromEpochMilli(record.getMillis())" + + " + record.getInstant().getNano() % NANOS_IN_MILLI /getInstant().getNano()"); + nanos = nanoInSecondFromEpochMilli(record2.getMillis()) + + record2.getInstant().getNano() % NANOS_IN_MILLI; + assertEquals(nanos, record2.getInstant().getNano(), + "nanoInSecondFromEpochMilli(record2.getMillis())" + + " + record2.getInstant().getNano() % NANOS_IN_MILLI /getInstant().getNano()"); + + // Format the deserialized LogRecord using the SimpleFormatter, and + // check that the string representation obtained matches the string + // representation of the original LogRecord + String str2 = formatter.format(record2); + if (!str.equals(str2)) + throw new RuntimeException("Unexpected values in deserialized object:" + + "\n\tExpected: " + str + + "\n\tRetrieved: "+str); + + } + + + public static void main(String[] args) throws Exception { + int count=0; + LogRecord record = new LogRecord(Level.INFO, "Java Version: {0}"); + record.setLoggerName("test"); + record.setParameters(new Object[] {System.getProperty("java.version")}); + final int nanos = record.getInstant().getNano() % NANOS_IN_MILLI; + final long millis = record.getMillis(); + final Instant instant = record.getInstant(); + if (millis != instant.toEpochMilli()) { + throw new RuntimeException("Unexpected millis: " + + record.getMillis()); + } + test(record, false); + + // nano adjustment < 1ms (canonical case) + int newNanos = (nanos + 111111) % NANOS_IN_MILLI; + record.setInstant(Instant.ofEpochSecond(millis/MILLIS_IN_SECOND, + (millis % MILLIS_IN_SECOND) * NANOS_IN_MILLI + newNanos)); + assertEquals(newNanos, record.getInstant().getNano() % NANOS_IN_MILLI, + "record.getInstant().getNano() % NANOS_IN_MILLI"); + assertEquals(millis, record.getMillis(), "record.getMillis()"); + assertEquals(Instant.ofEpochSecond(millis/MILLIS_IN_SECOND, + (millis%MILLIS_IN_SECOND)*NANOS_IN_MILLI + newNanos), + record.getInstant(), "record.getInstant()"); + test(record, false); + assertEquals(newNanos, record.getInstant().getNano() % NANOS_IN_MILLI, + "record.getInstant().getNano() % NANOS_IN_MILLI"); + assertEquals(millis, record.getMillis(), "record.getMillis()"); + assertEquals(Instant.ofEpochSecond(millis/MILLIS_IN_SECOND, + (millis%MILLIS_IN_SECOND)*NANOS_IN_MILLI + newNanos), + record.getInstant(), "record.getInstant()"); + + // nano adjustment > 1ms - non canonical - should still work + int newExceedingNanos = 2111_111; + record.setInstant(Instant.ofEpochSecond(millis/MILLIS_IN_SECOND, + (millis % MILLIS_IN_SECOND) * NANOS_IN_MILLI + newExceedingNanos)); + assertEquals(newExceedingNanos % NANOS_IN_MILLI, + record.getInstant().getNano() % NANOS_IN_MILLI, + "record.getInstant().getNano() % NANOS_IN_MILLI"); + assertEquals(millis + newExceedingNanos / NANOS_IN_MILLI, + record.getMillis(), "record.getMillis()"); + assertEquals(Instant.ofEpochSecond(millis/MILLIS_IN_SECOND, + (millis%MILLIS_IN_SECOND)*NANOS_IN_MILLI + newExceedingNanos), + record.getInstant(), "record.getInstant()"); + test(record, true); + assertEquals(newExceedingNanos % NANOS_IN_MILLI, + record.getInstant().getNano() % NANOS_IN_MILLI, + "record.getInstant().getNano() % NANOS_IN_MILLI"); + assertEquals(millis + newExceedingNanos / NANOS_IN_MILLI, + record.getMillis(), "record.getMillis()"); + assertEquals(Instant.ofEpochSecond(millis/MILLIS_IN_SECOND, + (millis%MILLIS_IN_SECOND)*NANOS_IN_MILLI + newExceedingNanos), + record.getInstant(), "record.getInstant()"); + + // nano adjustement > 1s - non canonical - should still work + newExceedingNanos = 1111_111_111; + record.setInstant(Instant.ofEpochSecond(millis/MILLIS_IN_SECOND, + (millis % MILLIS_IN_SECOND) * NANOS_IN_MILLI + newExceedingNanos)); + assertEquals(newExceedingNanos % NANOS_IN_MILLI, + record.getInstant().getNano() % NANOS_IN_MILLI, + "record.getInstant().getNano() % NANOS_IN_MILLI"); + assertEquals(millis + newExceedingNanos / NANOS_IN_MILLI, + record.getMillis(), "record.getMillis()"); + assertEquals(Instant.ofEpochSecond(millis/MILLIS_IN_SECOND, + (millis%MILLIS_IN_SECOND)*NANOS_IN_MILLI + newExceedingNanos), + record.getInstant(), "record.getInstant()"); + test(record, true); + assertEquals(newExceedingNanos % NANOS_IN_MILLI, + record.getInstant().getNano() % NANOS_IN_MILLI, + "record.getInstant().getNano() % NANOS_IN_MILLI"); + assertEquals(millis + newExceedingNanos / NANOS_IN_MILLI, + record.getMillis(), "record.getMillis()"); + assertEquals(Instant.ofEpochSecond(millis/MILLIS_IN_SECOND, + (millis%MILLIS_IN_SECOND)*NANOS_IN_MILLI + newExceedingNanos), + record.getInstant(), "record.getInstant()"); + + // nano adjustement < 0 - non canonical - should still work + newExceedingNanos = -1; + record.setInstant(Instant.ofEpochSecond(millis/MILLIS_IN_SECOND, + (millis % MILLIS_IN_SECOND) * NANOS_IN_MILLI + newExceedingNanos)); + assertEquals(newExceedingNanos + NANOS_IN_MILLI, + record.getInstant().getNano() % NANOS_IN_MILLI, + "record.getInstant().getNano() % NANOS_IN_MILLI"); + assertEquals(millis -1, record.getMillis(), "record.getMillis()"); + assertEquals(Instant.ofEpochSecond(millis/MILLIS_IN_SECOND, + (millis%MILLIS_IN_SECOND)*NANOS_IN_MILLI + newExceedingNanos), + record.getInstant(), "record.getInstant()"); + test(record, true); + record.setInstant(Instant.ofEpochSecond(millis/MILLIS_IN_SECOND, + (millis % MILLIS_IN_SECOND) * NANOS_IN_MILLI + newExceedingNanos)); + assertEquals(millis -1, record.getMillis(), "record.getMillis()"); + assertEquals(Instant.ofEpochSecond(millis/MILLIS_IN_SECOND, + (millis%MILLIS_IN_SECOND)*NANOS_IN_MILLI + newExceedingNanos), + record.getInstant(), "record.getInstant()"); + + // setMillis + record.setMillis(millis-1); + assertEquals(millis-1, record.getInstant().toEpochMilli(), + "record.getInstant().toEpochMilli()"); + assertEquals(millis-1, record.getMillis(), + "record.getMillis()"); + assertEquals(0, record.getInstant().getNano() % NANOS_IN_MILLI, + "record.getInstant().getNano() % NANOS_IN_MILLI"); + test(record, false); + assertEquals(millis-1, record.getInstant().toEpochMilli(), + "record.getInstant().toEpochMilli()"); + assertEquals(millis-1, record.getMillis(), + "record.getMillis()"); + assertEquals(0, record.getInstant().getNano() % NANOS_IN_MILLI, + "record.getInstant().getNano() % NANOS_IN_MILLI"); + + // setMillis to 0 + record.setMillis(0); + assertEquals(0, record.getInstant().toEpochMilli(), + "record.getInstant().toEpochMilli()"); + assertEquals(0, record.getMillis(), + "record.getMillis()"); + assertEquals(0, record.getInstant().getNano() % NANOS_IN_MILLI, + "record.getInstant().getNano() % NANOS_IN_MILLI"); + test(record, false); + assertEquals(0, record.getInstant().toEpochMilli(), + "record.getInstant().toEpochMilli()"); + assertEquals(0, record.getMillis(), + "record.getMillis()"); + assertEquals(0, record.getInstant().getNano() % NANOS_IN_MILLI, + "record.getInstant().getNano() % NANOS_IN_MILLI"); + + // setMillis to -1 + record.setMillis(-1); + assertEquals(-1, record.getInstant().toEpochMilli(), + "record.getInstant().toEpochMilli()"); + assertEquals(-1, record.getMillis(), + "record.getMillis()"); + assertEquals(0, record.getInstant().getNano() % NANOS_IN_MILLI, + "record.getInstant().getNano() % NANOS_IN_MILLI"); + test(record, false); + assertEquals(-1, record.getInstant().toEpochMilli(), + "record.getInstant().toEpochMilli()"); + assertEquals(-1, record.getMillis(), + "record.getMillis()"); + assertEquals(0, record.getInstant().getNano() % NANOS_IN_MILLI, + "record.getInstant().getNano() % NANOS_IN_MILLI"); + + try { + record.setInstant(null); + } catch (NullPointerException x) { + System.out.println("Got expected NPE when trying to call record.setInstant(null): " + x); + } + + } + +} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/util/logging/HigherResolutionTimeStamps/SerializeLogRecord.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/util/logging/HigherResolutionTimeStamps/SerializeLogRecord.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,363 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.time.ZoneId; +import java.util.Base64; +import java.util.Locale; +import java.util.TimeZone; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import java.util.logging.SimpleFormatter; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Stream; + +/** + * @test + * @bug 8072645 + * @summary tests the compatibility of LogRecord serial form between + * JDK 8 and JDK 9. Ideally this test should be run on both platforms. + * (It is designed to run on both). + * @run main/othervm SerializeLogRecord + * @author danielfuchs + */ +public class SerializeLogRecord { + + /** + * Serializes a log record, encode the serialized bytes in base 64, and + * prints pseudo java code that can be cut and pasted into this test. + * @param record the log record to serialize, encode in base 64, and for + * which test data will be generated. + * @return A string containing the generated pseudo java code. + * @throws IOException Unexpected. + * @throws ClassNotFoundException Unexpected. + */ + public static String generate(LogRecord record) throws IOException, ClassNotFoundException { + + // Format the given logRecord using the SimpleFormatter + SimpleFormatter formatter = new SimpleFormatter(); + String str = formatter.format(record); + + // Serialize the given LogRecord + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final ObjectOutputStream oos = new ObjectOutputStream(baos); + oos.writeObject(record); + oos.flush(); + oos.close(); + + // Now we're going to perform a number of smoke tests before + // generating the Java pseudo code. + // + // First checks that the log record can be deserialized + final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); + final ObjectInputStream ois = new ObjectInputStream(bais); + final LogRecord record2 = (LogRecord)ois.readObject(); + + // Format the deserialized LogRecord using the SimpleFormatter, and + // check that the string representation obtained matches the string + // representation of the original LogRecord + String str2 = formatter.format(record2); + if (!str.equals(str2)) throw new RuntimeException("Unexpected values in deserialized object:" + + "\n\tExpected: " + str + + "\n\tRetrieved: "+str); + + // Now get a Base64 string representation of the serialized bytes. + final String base64 = Base64.getEncoder().encodeToString(baos.toByteArray()); + + // Check that we can deserialize a log record from the Base64 string + // representation we just computed. + final ByteArrayInputStream bais2 = new ByteArrayInputStream(Base64.getDecoder().decode(base64)); + final ObjectInputStream ois2 = new ObjectInputStream(bais2); + final LogRecord record3 = (LogRecord)ois2.readObject(); + + // Format the new deserialized LogRecord using the SimpleFormatter, and + // check that the string representation obtained matches the string + // representation of the original LogRecord + String str3 = formatter.format(record3); + if (!str.equals(str3)) throw new RuntimeException("Unexpected values in deserialized object:" + + "\n\tExpected: " + str + + "\n\tRetrieved: "+str); + //System.out.println(base64); + //System.out.println(); + + // Generates the Java Pseudo code that can be cut & pasted into + // this test (see Jdk8SerializedLog and Jdk9SerializedLog below) + final StringBuilder sb = new StringBuilder(); + sb.append(" /**").append('\n'); + sb.append(" * Base64 encoded string for LogRecord object.").append('\n'); + sb.append(" * Java version: ").append(System.getProperty("java.version")).append('\n'); + sb.append(" **/").append('\n'); + sb.append(" final String base64 = ").append("\n "); + final int last = base64.length() - 1; + for (int i=0; i TestCase.valueOf(x)).forEach((x) -> { + switch(x) { + case GENERATE: generate(); break; + case TESTJDK8: Jdk8SerializedLog.test(); break; + case TESTJDK9: Jdk9SerializedLog.test(); break; + } + }); + } +} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/util/logging/HigherResolutionTimeStamps/SimpleFormatterNanos.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/util/logging/HigherResolutionTimeStamps/SimpleFormatterNanos.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +import java.time.Instant; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.util.Locale; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import java.util.logging.SimpleFormatter; + +/** + * @test + * @bug 8072645 + * @summary tests that SimpleFormatter can print out dates with the new + * nanosecond precision. + * @run main/othervm SimpleFormatterNanos + * @author danielfuchs + */ +public class SimpleFormatterNanos { + + static final int MILLIS_IN_SECOND = 1000; + static final int NANOS_IN_MILLI = 1000_000; + static final int NANOS_IN_MICRO = 1000; + static final int NANOS_IN_SECOND = 1000_000_000; + + static final boolean verbose = true; + + static final class TestAssertException extends RuntimeException { + TestAssertException(String msg) { super(msg); } + } + + private static void assertEquals(long expected, long received, String msg) { + if (expected != received) { + throw new TestAssertException("Unexpected result for " + msg + + ".\n\texpected: " + expected + + "\n\tactual: " + received); + } else if (verbose) { + System.out.println("Got expected " + msg + ": " + received); + } + } + + static int getNanoAdjustment(LogRecord record) { + return record.getInstant().getNano() % NANOS_IN_MILLI; + } + static void setNanoAdjustment(LogRecord record, int nanos) { + record.setInstant(Instant.ofEpochSecond(record.getInstant().getEpochSecond(), + (record.getInstant().getNano() / NANOS_IN_MILLI) * NANOS_IN_MILLI + nanos)); + } + + public static void main(String[] args) throws Exception { + + Locale.setDefault(Locale.ENGLISH); + LogRecord record = new LogRecord(Level.INFO, "Java Version: {0}"); + record.setLoggerName("test"); + record.setParameters(new Object[] {System.getProperty("java.version")}); + int nanos = getNanoAdjustment(record); + long millis = record.getMillis(); + // make sure we don't have leading zeros when printing below + // the second precision + if (millis % MILLIS_IN_SECOND < 100) millis = millis + 100; + // make sure we have some nanos + if (nanos % NANOS_IN_MICRO == 0) nanos = nanos + 999; + record.setMillis(millis); + setNanoAdjustment(record, nanos); + final Instant instant = record.getInstant(); + if (nanos < 0) { + throw new RuntimeException("Unexpected negative nano adjustment: " + + getNanoAdjustment(record)); + } + if (nanos >= NANOS_IN_MILLI) { + throw new RuntimeException("Nano adjustment exceeds 1ms: " + + getNanoAdjustment(record)); + } + if (millis != record.getMillis()) { + throw new RuntimeException("Unexpected millis: " + millis + " != " + + record.getMillis()); + } + if (millis != record.getInstant().toEpochMilli()) { + throw new RuntimeException("Unexpected millis: " + + record.getInstant().toEpochMilli()); + } + ZonedDateTime zdt = ZonedDateTime.ofInstant(instant, ZoneId.systemDefault()); + int zdtNanos = zdt.getNano(); + long expectedNanos = (millis % MILLIS_IN_SECOND) * NANOS_IN_MILLI + nanos; + assertEquals(expectedNanos, instant.getNano(), "Instant.getNano()"); + assertEquals(expectedNanos, zdtNanos, "ZonedDateTime.getNano()"); + String match = "."+expectedNanos+" "; + + System.out.println("Testing with default format..."); + + SimpleFormatter formatter = new SimpleFormatter(); + String str = formatter.format(record); + if (str.contains(match)) { + throw new RuntimeException("SimpleFormatter.format()" + + " string contains unexpected nanos: " + + "\n\tdid not expect match for: '" + match + "'" + + "\n\tin: " + str); + } + + System.out.println("Nanos omitted as expected: no '"+match+"' in "+str); + + + System.out.println("Changing format to print nanos..."); + System.setProperty("java.util.logging.SimpleFormatter.format", + "%1$tb %1$td, %1$tY %1$tl:%1$tM:%1$tS.%1$tN %1$Tp %2$s%n%4$s: %5$s%6$s%n"); + + SimpleFormatter formatter2 = new SimpleFormatter(); + str = formatter2.format(record); + if (!str.contains(match)) { + throw new RuntimeException("SimpleFormatter.format()" + + " string does not contain expected nanos: " + + "\n\texpected match for: '" + match + "'" + + "\n\tin: " + str); + } + System.out.println("Found expected match for '"+match+"' in "+str); + + + System.out.println("Changing format to omit nanos..."); + System.setProperty("java.util.logging.SimpleFormatter.format", + "%1$tb %1$td, %1$tY %1$tl:%1$tM:%1$tS %1$Tp %2$s%n%4$s: %5$s%6$s%n"); + + SimpleFormatter formatter3 = new SimpleFormatter(); + str = formatter3.format(record); + String notMatch = match; + if (str.contains(notMatch)) { + throw new RuntimeException("SimpleFormatter.format()" + + " string contains unexpected nanos: " + + "\n\tdid not expect match for: '" + notMatch + "'" + + "\n\tin: " + str); + } + System.out.println("Nanos omitted as expected: no '"+notMatch+"' in "+str); + + } + +} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/util/logging/HigherResolutionTimeStamps/XmlFormatterNanos.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/util/logging/HigherResolutionTimeStamps/XmlFormatterNanos.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,274 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.time.Instant; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Locale; +import java.util.Objects; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.LogManager; +import java.util.logging.LogRecord; +import java.util.logging.XMLFormatter; + +/** + * @test + * @bug 8072645 + * @summary tests that XmlFormatter will print out dates with the new + * nanosecond precision. + * @run main/othervm XmlFormatterNanos + * @author danielfuchs + */ +public class XmlFormatterNanos { + + static final int MILLIS_IN_SECOND = 1000; + static final int NANOS_IN_MILLI = 1000_000; + static final int NANOS_IN_MICRO = 1000; + static final int NANOS_IN_SECOND = 1000_000_000; + + static final boolean verbose = true; + + static final class TestAssertException extends RuntimeException { + TestAssertException(String msg) { super(msg); } + } + + private static void assertEquals(long expected, long received, String msg) { + if (expected != received) { + throw new TestAssertException("Unexpected result for " + msg + + ".\n\texpected: " + expected + + "\n\tactual: " + received); + } else if (verbose) { + System.out.println("Got expected " + msg + ": " + received); + } + } + + private static void assertEquals(Object expected, Object received, String msg) { + if (!Objects.equals(expected, received)) { + throw new TestAssertException("Unexpected result for " + msg + + ".\n\texpected: " + expected + + "\n\tactual: " + received); + } else if (verbose) { + System.out.println("Got expected " + msg + ": " + received); + } + } + + static class CustomXMLFormatter extends XMLFormatter {} + + static class Configuration { + final Properties propertyFile; + private Configuration(Properties properties) { + propertyFile = properties; + } + public Configuration apply() { + try { + ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + propertyFile.store(bytes, testName()); + ByteArrayInputStream bais = new ByteArrayInputStream(bytes.toByteArray()); + LogManager.getLogManager().readConfiguration(bais); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + return this; + } + + public static String useInstantProperty(Class type) { + return type.getName()+".useInstant"; + } + + public boolean useInstant(XMLFormatter formatter) { + return Boolean.parseBoolean(propertyFile.getProperty( + formatter.getClass().getName()+".useInstant", "true")); + } + + public String testName() { + return propertyFile.getProperty("test.name", "????"); + } + + public static Configuration of(Properties props) { + return new Configuration(props); + } + + public static Configuration apply(Properties props) { + return of(props).apply(); + } + } + + final static List properties; + static { + Properties props1 = new Properties(); + props1.setProperty("test.name", "with XML nano element (default)"); + Properties props2 = new Properties(); + props2.setProperty("test.name", "with XML nano element (standard=true, custom=false)"); + props2.setProperty(Configuration.useInstantProperty(XMLFormatter.class), "true"); + props2.setProperty(Configuration.useInstantProperty(CustomXMLFormatter.class), "false"); + Properties props3 = new Properties(); + props3.setProperty("test.name", "with XML nano element (standard=false, custom=true)"); + props3.setProperty(Configuration.useInstantProperty(XMLFormatter.class), "false"); + props3.setProperty(Configuration.useInstantProperty(CustomXMLFormatter.class), "true"); + + properties = Collections.unmodifiableList(Arrays.asList( + props1, + props2)); + } + + public static void main(String[] args) throws Exception { + Locale.setDefault(Locale.ENGLISH); + properties.stream().forEach(XmlFormatterNanos::test); + } + + static int getNanoAdjustment(LogRecord record) { + return record.getInstant().getNano() % NANOS_IN_MILLI; + } + static void setNanoAdjustment(LogRecord record, int nanos) { + record.setInstant(Instant.ofEpochSecond(record.getInstant().getEpochSecond(), + (record.getInstant().getNano() / NANOS_IN_MILLI) * NANOS_IN_MILLI + nanos)); + } + + public static void test(Properties props) { + Configuration conf = Configuration.apply(props); + + LogRecord record = new LogRecord(Level.INFO, "Test Name: {0}"); + record.setLoggerName("test"); + record.setParameters(new Object[] {conf.testName()}); + int nanos = record.getInstant().getNano() % NANOS_IN_MILLI; + long millis = record.getMillis(); + // make sure we don't have leading zeros when printing below + // the second precision + if (millis % MILLIS_IN_SECOND < 100) millis = millis + 100; + // make sure we some nanos - and make sure we don't have + // trailing zeros + if (nanos % 10 == 0) nanos = nanos + 7; + + record.setMillis(millis); + setNanoAdjustment(record, nanos); + final Instant instant = record.getInstant(); + if (nanos < 0) { + throw new RuntimeException("Unexpected negative nano adjustment: " + + getNanoAdjustment(record)); + } + if (nanos >= NANOS_IN_MILLI) { + throw new RuntimeException("Nano adjustment exceeds 1ms: " + + getNanoAdjustment(record)); + } + if (millis != record.getMillis()) { + throw new RuntimeException("Unexpected millis: " + millis + " != " + + record.getMillis()); + } + if (millis != record.getInstant().toEpochMilli()) { + throw new RuntimeException("Unexpected millis: " + + record.getInstant().toEpochMilli()); + } + long expectedNanos = (millis % MILLIS_IN_SECOND) * NANOS_IN_MILLI + nanos; + assertEquals(expectedNanos, instant.getNano(), "Instant.getNano()"); + + XMLFormatter formatter = new XMLFormatter(); + testMatching(formatter, record, instant, expectedNanos, conf.useInstant(formatter)); + + XMLFormatter custom = new CustomXMLFormatter(); + testMatching(custom, record, instant, expectedNanos, conf.useInstant(custom)); + } + + private static void testMatching(XMLFormatter formatter, + LogRecord record, Instant instant, long expectedNanos, + boolean useInstant) { + + ZonedDateTime zdt = ZonedDateTime.ofInstant(instant, ZoneId.systemDefault()); + int zdtNanos = zdt.getNano(); + assertEquals(expectedNanos, zdtNanos, "ZonedDateTime.getNano()"); + + String str = formatter.format(record); + + String match = "."+expectedNanos; + if (str.contains(match) != useInstant) { + throw new RuntimeException(formatter.getClass().getSimpleName() + + ".format()" + + " string does not contain expected nanos: " + + "\n\texpected match for: '" + match + "'" + + "\n\tin: \n" + str); + } + System.out.println("Found expected match for '"+match+"' in \n"+str); + + match = ""+instant.toEpochMilli()+""; + if (!str.contains(match)) { + throw new RuntimeException(formatter.getClass().getSimpleName() + + ".format()" + + " string does not contain expected millis: " + + "\n\texpected match for: '" + match + "'" + + "\n\tin: \n" + str); + } + System.out.println("Found expected match for '"+match+"' in \n"+str); + + match = ""; + if (str.contains(match) != useInstant) { + throw new RuntimeException(formatter.getClass().getSimpleName() + + ".format()" + + " string " + + (useInstant + ? "does not contain expected nanos: " + : "contains unexpected nanos: ") + + "\n\t" + (useInstant ? "expected" : "unexpected") + + " match for: '" + match + "'" + + "\n\tin: \n" + str); + } + match = ""+getNanoAdjustment(record)+""; + if (str.contains(match) != useInstant) { + throw new RuntimeException(formatter.getClass().getSimpleName() + + ".format()" + + " string " + + (useInstant + ? "does not contain expected nanos: " + : "contains unexpected nanos: ") + + "\n\t" + (useInstant ? "expected" : "unexpected") + + " match for: '" + match + "'" + + "\n\tin: \n" + str); + } + if (useInstant) { + System.out.println("Found expected match for '"+match+"' in \n"+str); + } else { + System.out.println("As expected '"+match+"' is not present in \n"+str); + } + + match = useInstant ? DateTimeFormatter.ISO_INSTANT.format(instant) + : zdt.truncatedTo(ChronoUnit.SECONDS) + .format(DateTimeFormatter.ISO_LOCAL_DATE_TIME); + match = ""+match+""; + if (!str.contains(match)) { + throw new RuntimeException(formatter.getClass().getSimpleName() + + ".format()" + + " string does not contain expected date: " + + "\n\texpected match for: '" + match + "'" + + "\n\tin: \n" + str); + } + System.out.println("Found expected match for '"+match+"' in \n"+str); + + } + +} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/java/util/zip/TestExtraTime.java --- a/jdk/test/java/util/zip/TestExtraTime.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/java/util/zip/TestExtraTime.java Mon Mar 02 05:32:01 2015 -0800 @@ -23,7 +23,7 @@ /** * @test - * @bug 4759491 6303183 7012868 8015666 8023713 + * @bug 4759491 6303183 7012868 8015666 8023713 8068790 * @summary Test ZOS and ZIS timestamp in extra field correctly */ @@ -69,6 +69,8 @@ test(mtime, atime, ctime, tz, extra); } } + + testNullHandling(); } static void test(FileTime mtime, FileTime atime, FileTime ctime, @@ -154,4 +156,26 @@ } } } + + static void testNullHandling() { + ZipEntry ze = new ZipEntry("TestExtraTime.java"); + try { + ze.setLastAccessTime(null); + throw new RuntimeException("setLastAccessTime(null) should throw NPE"); + } catch (NullPointerException ignored) { + // pass + } + try { + ze.setCreationTime(null); + throw new RuntimeException("setCreationTime(null) should throw NPE"); + } catch (NullPointerException ignored) { + // pass + } + try { + ze.setLastModifiedTime(null); + throw new RuntimeException("setLastModifiedTime(null) should throw NPE"); + } catch (NullPointerException ignored) { + // pass + } + } } diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/javax/net/ssl/FixingJavadocs/ComURLNulls.java --- a/jdk/test/javax/net/ssl/FixingJavadocs/ComURLNulls.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/javax/net/ssl/FixingJavadocs/ComURLNulls.java Mon Mar 02 05:32:01 2015 -0800 @@ -46,12 +46,23 @@ public class ComURLNulls { + private static class ComSunHTTPSHandlerFactory implements URLStreamHandlerFactory { + private static String SUPPORTED_PROTOCOL = "https"; + + public URLStreamHandler createURLStreamHandler(String protocol) { + if (!protocol.equalsIgnoreCase(SUPPORTED_PROTOCOL)) + return null; + + return new com.sun.net.ssl.internal.www.protocol.https.Handler(); + } + } + public static void main(String[] args) throws Exception { HostnameVerifier reservedHV = HttpsURLConnection.getDefaultHostnameVerifier(); try { - System.setProperty("java.protocol.handler.pkgs", - "com.sun.net.ssl.internal.www.protocol"); + URL.setURLStreamHandlerFactory(new ComSunHTTPSHandlerFactory()); + /** * This test does not establish any connection to the specified * URL, hence a dummy URL is used. diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/sun/management/AgentCheckTest.java --- a/jdk/test/sun/management/AgentCheckTest.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/sun/management/AgentCheckTest.java Mon Mar 02 05:32:01 2015 -0800 @@ -39,12 +39,6 @@ {"jmxremote.ConnectorBootstrap.noAuthentication", "", ""}, {"jmxremote.ConnectorBootstrap.ready", "Phony JMXServiceURL", ""}, {"jmxremote.ConnectorBootstrap.password.readonly", "Phony passwordFileName", ""}, - {"jmxremote.AdaptorBootstrap.getTargetList.processing", "", ""}, - {"jmxremote.AdaptorBootstrap.getTargetList.adding", "Phony target", ""}, - {"jmxremote.AdaptorBootstrap.getTargetList.starting", "", ""}, - {"jmxremote.AdaptorBootstrap.getTargetList.initialize1", "", ""}, - {"jmxremote.AdaptorBootstrap.getTargetList.initialize2", "Phony hostname", "Phony port"}, - {"jmxremote.AdaptorBootstrap.getTargetList.terminate", "Phony exception", ""}, }; boolean pass = true; diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/sun/net/www/protocol/https/NewImpl/ComHTTPSConnection.java --- a/jdk/test/sun/net/www/protocol/https/NewImpl/ComHTTPSConnection.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/sun/net/www/protocol/https/NewImpl/ComHTTPSConnection.java Mon Mar 02 05:32:01 2015 -0800 @@ -188,6 +188,17 @@ } } + private static class ComSunHTTPSHandlerFactory implements URLStreamHandlerFactory { + private static String SUPPORTED_PROTOCOL = "https"; + + public URLStreamHandler createURLStreamHandler(String protocol) { + if (!protocol.equalsIgnoreCase(SUPPORTED_PROTOCOL)) + return null; + + return new com.sun.net.ssl.internal.www.protocol.https.Handler(); + } + } + /* * Define the client side of the test. * @@ -205,8 +216,7 @@ HostnameVerifier reservedHV = HttpsURLConnection.getDefaultHostnameVerifier(); try { - System.setProperty("java.protocol.handler.pkgs", - "com.sun.net.ssl.internal.www.protocol"); + URL.setURLStreamHandlerFactory(new ComSunHTTPSHandlerFactory()); HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier()); URL url = new URL("https://" + "localhost:" + serverPort + diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/sun/net/www/protocol/https/NewImpl/ComHostnameVerifier.java --- a/jdk/test/sun/net/www/protocol/https/NewImpl/ComHostnameVerifier.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/sun/net/www/protocol/https/NewImpl/ComHostnameVerifier.java Mon Mar 02 05:32:01 2015 -0800 @@ -186,6 +186,17 @@ } } + private static class ComSunHTTPSHandlerFactory implements URLStreamHandlerFactory { + private static String SUPPORTED_PROTOCOL = "https"; + + public URLStreamHandler createURLStreamHandler(String protocol) { + if (!protocol.equalsIgnoreCase(SUPPORTED_PROTOCOL)) + return null; + + return new com.sun.net.ssl.internal.www.protocol.https.Handler(); + } + } + /* * Define the client side of the test. * @@ -200,8 +211,7 @@ Thread.sleep(50); } - System.setProperty("java.protocol.handler.pkgs", - "com.sun.net.ssl.internal.www.protocol"); + URL.setURLStreamHandlerFactory(new ComSunHTTPSHandlerFactory()); System.setProperty("https.cipherSuites", "SSL_DH_anon_WITH_3DES_EDE_CBC_SHA"); diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/sun/nio/cs/CheckHistoricalNames.java --- a/jdk/test/sun/nio/cs/CheckHistoricalNames.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/sun/nio/cs/CheckHistoricalNames.java Mon Mar 02 05:32:01 2015 -0800 @@ -196,6 +196,7 @@ checkMappedName("IBM1122", "Cp1122"); checkMappedName("IBM1123", "Cp1123"); checkMappedName("IBM1124", "Cp1124"); + checkMappedName("IBM1166", "Cp1166"); checkMappedName("IBM01140", "Cp1140"); checkMappedName("IBM01141", "Cp1141"); checkMappedName("IBM01142", "Cp1142"); diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/sun/nio/cs/X11CNS11643.java --- a/jdk/test/sun/nio/cs/X11CNS11643.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/sun/nio/cs/X11CNS11643.java Mon Mar 02 05:32:01 2015 -0800 @@ -24,7 +24,8 @@ import java.nio.CharBuffer; import java.nio.ByteBuffer; import java.nio.charset.*; -import sun.nio.cs.ext.EUC_TW; +import sun.nio.cs.*; +import sun.nio.cs.ext.*; public abstract class X11CNS11643 extends Charset { private final int plane; diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/sun/security/acl/PermissionImpl/PermissionEqualsHashCode.java --- a/jdk/test/sun/security/acl/PermissionImpl/PermissionEqualsHashCode.java Fri Feb 27 12:48:06 2015 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 1999, 2007, 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 - * @author Gary Ellison - * @bug 4170635 - * @summary Verify equals()/hashCode() contract honored - */ - -import java.io.*; - -import sun.security.acl.*; - - -public class PermissionEqualsHashCode { - - public static void main(String[] args) throws Exception { - - PermissionImpl p1 = new PermissionImpl("permissionPermission"); - PermissionImpl p2 = new PermissionImpl("permissionPermission"); - - - // the test - if ( (p1.equals(p2)) == (p1.hashCode()==p2.hashCode()) ) - System.out.println("PASSED"); - else - throw new Exception("Failed equals()/hashCode() contract"); - - } -} diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/sun/security/tools/keytool/KeyToolTest.java --- a/jdk/test/sun/security/tools/keytool/KeyToolTest.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/sun/security/tools/keytool/KeyToolTest.java Mon Mar 02 05:32:01 2015 -0800 @@ -42,7 +42,8 @@ * echo | java -Dsolaris KeyToolTest * * ATTENTION: - * Exception in thread "main" java.security.ProviderException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_KEY_SIZE_RANGE + * Exception in thread "main" java.security.ProviderException: + * sun.security.pkcs11.wrapper.PKCS11Exception: CKR_KEY_SIZE_RANGE * at sun.security.pkcs11.P11Signature.engineSign(P11Signature.java:420) * ... * Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_KEY_SIZE_RANGE @@ -78,15 +79,26 @@ System.getProperty("debug") != null; static final String NSS_P11_ARG = - "-keystore NONE -storetype PKCS11 -providerName SunPKCS11-nss -providerClass sun.security.pkcs11.SunPKCS11 -providerArg p11-nss.txt "; + "-keystore NONE -storetype PKCS11 -providerName SunPKCS11-nss " + + "-providerClass sun.security.pkcs11.SunPKCS11 " + + "-providerArg p11-nss.txt "; static final String NSS_SRC_P11_ARG = - "-srckeystore NONE -srcstoretype PKCS11 -srcproviderName SunPKCS11-nss -providerClass sun.security.pkcs11.SunPKCS11 -providerArg p11-nss.txt "; + "-srckeystore NONE -srcstoretype PKCS11 " + + "-srcproviderName SunPKCS11-nss " + + "-providerClass sun.security.pkcs11.SunPKCS11 " + + "-providerArg p11-nss.txt "; static final String NZZ_P11_ARG = - "-keystore NONE -storetype PKCS11 -providerName SunPKCS11-nzz -providerClass sun.security.pkcs11.SunPKCS11 -providerArg p11-nzz.txt "; + "-keystore NONE -storetype PKCS11 -providerName SunPKCS11-nzz " + + "-providerClass sun.security.pkcs11.SunPKCS11 " + + "-providerArg p11-nzz.txt "; static final String NZZ_SRC_P11_ARG = - "-srckeystore NONE -srcstoretype PKCS11 -srcproviderName SunPKCS11-nzz -providerClass sun.security.pkcs11.SunPKCS11 -providerArg p11-nzz.txt "; + "-srckeystore NONE -srcstoretype PKCS11 " + + "-srcproviderName SunPKCS11-nzz " + + "-providerClass sun.security.pkcs11.SunPKCS11 " + + "-providerArg p11-nzz.txt "; static final String SUN_P11_ARG = "-keystore NONE -storetype PKCS11 "; - static final String SUN_SRC_P11_ARG = "-srckeystore NONE -srcstoretype PKCS11 "; + static final String SUN_SRC_P11_ARG = + "-srckeystore NONE -srcstoretype PKCS11 "; String p11Arg, srcP11Arg; @@ -328,15 +340,22 @@ // name changes: genkeypair, importcert, exportcert remove("x.jks"); remove("x.jks.p1.cert"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -alias p1 -dname CN=olala"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -exportcert -alias p1 -file x.jks.p1.cert"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -alias p1 -dname CN=olala"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-exportcert -alias p1 -file x.jks.p1.cert"); ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(ks.getKey("p1", "changeit".toCharArray()) != null, "key not DSA"); assertTrue(new File("x.jks.p1.cert").exists(), "p1 export err"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias p1"); - testOK("y\n", "-keystore x.jks -storetype JKS -storepass changeit -importcert -alias c1 -file x.jks.p1.cert"); // importcert, prompt for Yes/No - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -importcert -alias c2 -file x.jks.p1.cert -noprompt"); // importcert, -noprompt + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-delete -alias p1"); + // importcert, prompt for Yes/No + testOK("y\n", "-keystore x.jks -storetype JKS -storepass changeit " + + "-importcert -alias c1 -file x.jks.p1.cert"); + // importcert, -noprompt + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-importcert -alias c2 -file x.jks.p1.cert -noprompt"); ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(ks.getCertificate("c1") != null, "import c1 err"); @@ -346,10 +365,15 @@ assertTrue(certImpl.getVersion() == 3, "Version is not 3"); // changealias and keyclone - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -alias p1 -dname CN=olala"); - testOK("changeit\n", "-keystore x.jks -storetype JKS -changealias -alias p1 -destalias p11"); - testOK("changeit\n", "-keystore x.jks -storetype JKS -changealias -alias c1 -destalias c11"); - testOK("changeit\n\n", "-keystore x.jks -storetype JKS -keyclone -alias p11 -destalias p111"); // press ENTER when prompt for p111's keypass + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -alias p1 -dname CN=olala"); + testOK("changeit\n", "-keystore x.jks -storetype JKS " + + "-changealias -alias p1 -destalias p11"); + testOK("changeit\n", "-keystore x.jks -storetype JKS " + + "-changealias -alias c1 -destalias c11"); + // press ENTER when prompt for p111's keypass + testOK("changeit\n\n", "-keystore x.jks -storetype JKS " + + "-keyclone -alias p11 -destalias p111"); ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(!ks.containsAlias("p1"), "there is no p1"); assertTrue(!ks.containsAlias("c1"), "there is no c1"); @@ -359,148 +383,283 @@ // genSecKey remove("x.jceks"); - testOK("changeit\nchangeit\n\n", "-keystore x.jceks -storetype JCEKS -genseckey -alias s1"); // DES, no need keysize - testFail("changeit\n\n", "-keystore x.jceks -storetype JCEKS -genseckey -alias s11 -keysize 128"); // DES, keysize cannot be 128 - testOK("changeit\n\n", "-keystore x.jceks -storetype JCEKS -genseckey -keyalg DESede -alias s2"); // DESede. no need keysize - testFail("changeit\n\n", "-keystore x.jceks -storetype AES -genseckey -keyalg Rijndael -alias s3"); // AES, need keysize - testOK("changeit\n\n", "-keystore x.jceks -storetype JCEKS -genseckey -keyalg AES -alias s3 -keysize 128"); - // about keypass - testOK("\n", "-keystore x.jceks -storetype JCEKS -storepass changeit -genseckey -alias s4"); // can accept storepass - testOK("keypass\nkeypass\n", "-keystore x.jceks -storetype JCEKS -storepass changeit -genseckey -alias s5"); // or a new one - testOK("bad\n\bad\nkeypass\nkeypass\n", "-keystore x.jceks -storetype JCEKS -storepass changeit -genseckey -alias s6"); // keypass must be valid (prompt 3 times) - testFail("bad\n\bad\nbad\n", "-keystore x.jceks -storetype JCEKS -storepass changeit -genseckey -alias s7"); // keypass must be valid (prompt 3 times) - testFail("bad\n\bad\nbad\nkeypass\n", "-keystore x.jceks -storetype JCEKS -storepass changeit -genseckey -alias s7"); // keypass must be valid (prompt 3 times) + // DES, no need keysize + testOK("changeit\nchangeit\n\n", "-keystore x.jceks -storetype JCEKS " + + "-genseckey -alias s1"); + // DES, keysize cannot be 128 + testFail("changeit\n\n", "-keystore x.jceks -storetype JCEKS " + + "-genseckey -alias s11 -keysize 128"); + // DESede. no need keysize + testOK("changeit\n\n", "-keystore x.jceks -storetype JCEKS " + + "-genseckey -keyalg DESede -alias s2"); + // AES, need keysize + testFail("changeit\n\n", "-keystore x.jceks -storetype AES " + + "-genseckey -keyalg Rijndael -alias s3"); + testOK("changeit\n\n", "-keystore x.jceks -storetype JCEKS " + + "-genseckey -keyalg AES -alias s3 -keysize 128"); + // about keypass + // can accept storepass + testOK("\n", "-keystore x.jceks -storetype JCEKS -storepass changeit " + + "-genseckey -alias s4"); + // or a new one + testOK("keypass\nkeypass\n", "-keystore x.jceks -storetype JCEKS " + + "-storepass changeit -genseckey -alias s5"); + // keypass must be valid (prompt 3 times) + testOK("bad\n\bad\nkeypass\nkeypass\n", "-keystore x.jceks " + + "-storetype JCEKS -storepass changeit -genseckey -alias s6"); + // keypass must be valid (prompt 3 times) + testFail("bad\n\bad\nbad\n", "-keystore x.jceks -storetype JCEKS " + + "-storepass changeit -genseckey -alias s7"); + // keypass must be valid (prompt 3 times) + testFail("bad\n\bad\nbad\nkeypass\n", "-keystore x.jceks " + + "-storetype JCEKS -storepass changeit -genseckey -alias s7"); ks = loadStore("x.jceks", "changeit", "JCEKS"); - assertTrue(ks.getKey("s1", "changeit".toCharArray()).getAlgorithm().equalsIgnoreCase("DES"), "s1 is DES"); - assertTrue(ks.getKey("s1", "changeit".toCharArray()).getEncoded().length == 8, "DES is 56"); - assertTrue(ks.getKey("s2", "changeit".toCharArray()).getEncoded().length == 24, "DESede is 168"); - assertTrue(ks.getKey("s2", "changeit".toCharArray()).getAlgorithm().equalsIgnoreCase("DESede"), "s2 is DESede"); - assertTrue(ks.getKey("s3", "changeit".toCharArray()).getAlgorithm().equalsIgnoreCase("AES"), "s3 is AES"); - assertTrue(ks.getKey("s4", "changeit".toCharArray()).getAlgorithm().equalsIgnoreCase("DES"), "s4 is DES"); - assertTrue(ks.getKey("s5", "keypass".toCharArray()).getAlgorithm().equalsIgnoreCase("DES"), "s5 is DES"); - assertTrue(ks.getKey("s6", "keypass".toCharArray()).getAlgorithm().equalsIgnoreCase("DES"), "s6 is DES"); + assertTrue(ks.getKey("s1", "changeit".toCharArray()) + .getAlgorithm().equalsIgnoreCase("DES"), "s1 is DES"); + assertTrue(ks.getKey("s1", "changeit".toCharArray()) + .getEncoded().length == 8, "DES is 56"); + assertTrue(ks.getKey("s2", "changeit".toCharArray()) + .getEncoded().length == 24, "DESede is 168"); + assertTrue(ks.getKey("s2", "changeit".toCharArray()) + .getAlgorithm().equalsIgnoreCase("DESede"), "s2 is DESede"); + assertTrue(ks.getKey("s3", "changeit".toCharArray()) + .getAlgorithm().equalsIgnoreCase("AES"), "s3 is AES"); + assertTrue(ks.getKey("s4", "changeit".toCharArray()) + .getAlgorithm().equalsIgnoreCase("DES"), "s4 is DES"); + assertTrue(ks.getKey("s5", "keypass".toCharArray()) + .getAlgorithm().equalsIgnoreCase("DES"), "s5 is DES"); + assertTrue(ks.getKey("s6", "keypass".toCharArray()) + .getAlgorithm().equalsIgnoreCase("DES"), "s6 is DES"); assertTrue(!ks.containsAlias("s7"), "s7 not created"); // maybe we needn't test this, one day JKS will support SecretKey - //testFail("changeit\nchangeit\n", "-keystore x.jks -storetype JKS -genseckey -keyalg AES -alias s3 -keysize 128"); + //testFail("changeit\nchangeit\n", "-keystore x.jks -storetype JKS " + + // "-genseckey -keyalg AES -alias s3 -keysize 128"); // importKeyStore remove("x.jks"); remove("x.jceks"); - testOK("changeit\nchangeit\n\n", "-keystore x.jceks -storetype JCEKS -genkeypair -alias p1 -dname CN=Olala"); // create 2 entries... - testOK("", "-keystore x.jceks -storetype JCEKS -storepass changeit -importcert -alias c1 -file x.jks.p1.cert -noprompt"); // ... + // create 2 entries... + testOK("changeit\nchangeit\n\n", "-keystore x.jceks -storetype JCEKS " + + "-genkeypair -alias p1 -dname CN=Olala"); + testOK("", "-keystore x.jceks -storetype JCEKS -storepass changeit " + + "-importcert -alias c1 -file x.jks.p1.cert -noprompt"); ks = loadStore("x.jceks", "changeit", "JCEKS"); assertTrue(ks.size() == 2, "2 entries in JCEKS"); - // import, shouldn't mention destalias/srckeypass/destkeypass if srcalias is no given - testFail("changeit\nchangeit\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS -destalias pp"); - testFail("changeit\nchangeit\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS -srckeypass changeit"); - testFail("changeit\nchangeit\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS -destkeypass changeit"); + // import, shouldn't mention destalias/srckeypass/destkeypass + // if srcalias is no given + testFail("changeit\nchangeit\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS -destalias pp"); + testFail("changeit\nchangeit\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS -srckeypass changeit"); + testFail("changeit\nchangeit\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS -destkeypass changeit"); // normal import - testOK("changeit\nchangeit\nchangeit\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS"); + testOK("changeit\nchangeit\nchangeit\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS"); ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(ks.size() == 2, "2 entries in JKS"); // import again, type yes to overwrite old entries - testOK("changeit\nchangeit\ny\ny\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS"); + testOK("changeit\nchangeit\ny\ny\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS"); ks = loadStore("x.jks", "changeit", "JKS"); // import again, specify -nopromt - testOK("changeit\nchangeit\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS -noprompt"); + testOK("changeit\nchangeit\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS -noprompt"); assertTrue(err.indexOf("Warning") != -1, "noprompt will warn"); ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(ks.size() == 2, "2 entries in JKS"); // import again, type into new aliases when prompted - testOK("changeit\nchangeit\n\ns1\n\ns2\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS"); + testOK("changeit\nchangeit\n\ns1\n\ns2\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS"); ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(ks.size() == 4, "4 entries in JKS"); // importkeystore single + // normal remove("x.jks"); - testOK("changeit\nchangeit\nchangeit\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS -srcalias p1"); // normal + testOK("changeit\nchangeit\nchangeit\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS -srcalias p1"); ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(ks.size() == 1, "1 entries in JKS"); - testOK("changeit\nchangeit\ny\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS -srcalias p1"); // overwrite + // overwrite + testOK("changeit\nchangeit\ny\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS -srcalias p1"); ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(ks.size() == 1, "1 entries in JKS"); - testOK("changeit\nchangeit\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS -srcalias p1 -noprompt"); // noprompt + // noprompt + testOK("changeit\nchangeit\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS " + + "-srcalias p1 -noprompt"); ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(ks.size() == 1, "1 entries in JKS"); - testOK("changeit\nchangeit\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS -srcalias p1 -destalias p2"); // rename + // rename + testOK("changeit\nchangeit\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS " + + "-srcalias p1 -destalias p2"); ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(ks.size() == 2, "2 entries in JKS"); - testOK("changeit\nchangeit\n\nnewalias\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS -srcalias p1"); // another rename + // another rename + testOK("changeit\nchangeit\n\nnewalias\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS -srcalias p1"); ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(ks.size() == 3, "3 entries in JKS"); // importkeystore single, different keypass remove("x.jks"); - testOK("changeit\nkeypass\nkeypass\n", "-keystore x.jceks -storetype JCEKS -genkeypair -alias p2 -dname CN=Olala"); // generate entry with different keypass - testOK("changeit\nchangeit\nchangeit\nkeypass\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS -srcalias p2"); // prompt + // generate entry with different keypass + testOK("changeit\nkeypass\nkeypass\n", "-keystore x.jceks " + + "-storetype JCEKS -genkeypair -alias p2 -dname CN=Olala"); + // prompt + testOK("changeit\nchangeit\nchangeit\nkeypass\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS -srcalias p2"); ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(ks.size() == 1, "1 entries in JKS"); - testOK("changeit\nchangeit\nkeypass\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS -srcalias p2 -destalias p3 -destkeypass keypass2"); // diff destkeypass + // diff destkeypass + testOK("changeit\nchangeit\nkeypass\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS " + + "-srcalias p2 -destalias p3 -destkeypass keypass2"); ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(ks.size() == 2, "2 entries in JKS"); - assertTrue(ks.getKey("p2", "keypass".toCharArray()) != null, "p2 has old password"); - assertTrue(ks.getKey("p3", "keypass2".toCharArray()) != null, "p3 has new password"); + assertTrue(ks.getKey("p2", "keypass".toCharArray()) != null, + "p2 has old password"); + assertTrue(ks.getKey("p3", "keypass2".toCharArray()) != null, + "p3 has new password"); // importkeystore single, cert remove("x.jks"); - testOK("changeit\nchangeit\nchangeit\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS -srcalias c1"); // normal - testOK("changeit\n\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS -srcalias c1 -destalias c2"); // in fact srcstorepass can be ignored + // normal + testOK("changeit\nchangeit\nchangeit\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS -srcalias c1"); + // in fact srcstorepass can be ignored + testOK("changeit\n\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS " + + "-srcalias c1 -destalias c2"); assertTrue(err.indexOf("WARNING") != -1, "But will warn"); - testOK("changeit\n\ny\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS -srcalias c1 -destalias c2"); // 2nd import, press y to overwrite ... - testOK("changeit\n\n\nc3\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS -srcalias c1 -destalias c2"); // ... or rename + // 2nd import, press y to overwrite ... + testOK("changeit\n\ny\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS " + + "-srcalias c1 -destalias c2"); + // ... or rename + testOK("changeit\n\n\nc3\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS " + + "-srcalias c1 -destalias c2"); ks = loadStore("x.jks", "changeit", "JKS"); - assertTrue(ks.size() == 3, "3 entries in JKS"); // c1, c2, c3 + // c1, c2, c3 + assertTrue(ks.size() == 3, "3 entries in JKS"); // importkeystore, secretkey remove("x.jks"); - testOK("changeit\n\n", "-keystore x.jceks -storetype JCEKS -genseckey -alias s1"); // create SecretKeyEntry - testOK("changeit\n\n", "-keystore x.jceks -storetype JCEKS -genseckey -alias s2"); // create SecretKeyEntry - testOK("changeit\n", "-keystore x.jceks -storetype JCEKS -delete -alias p2"); // remove the keypass!=storepass one + // create SecretKeyEntry + testOK("changeit\n\n", "-keystore x.jceks -storetype JCEKS " + + "-genseckey -alias s1"); + // create SecretKeyEntry + testOK("changeit\n\n", "-keystore x.jceks -storetype JCEKS " + + "-genseckey -alias s2"); + // remove the keypass!=storepass one + testOK("changeit\n", "-keystore x.jceks -storetype JCEKS " + + "-delete -alias p2"); ks = loadStore("x.jceks", "changeit", "JCEKS"); - assertTrue(ks.size() == 4, "4 entries in JCEKS"); // p1, c1, s1, s2 - testOK("changeit\nchangeit\nchangeit\n", "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS -srcalias s1"); // normal + // p1, c1, s1, s2 + assertTrue(ks.size() == 4, "4 entries in JCEKS"); + // normal + testOK("changeit\nchangeit\nchangeit\n", "-importkeystore " + + "-srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS -srcalias s1"); assertTrue(err.indexOf("not imported") != -1, "Not imported"); - assertTrue(err.indexOf("Cannot store non-PrivateKeys") != -1, "Not imported"); + assertTrue(err.indexOf("Cannot store non-PrivateKeys") != -1, + "Not imported"); - // Importing a JCEKS keystore to a JKS one. Will warn for the 2 SecretKey entries + // Importing a JCEKS keystore to a JKS one. Will warn + // for the 2 SecretKey entries remove("x.jks"); // Two "no" answers to bypass warnings - testOK("\n\n", "-srcstorepass changeit -deststorepass changeit -importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS"); // normal + // normal + testOK("\n\n", "-srcstorepass changeit -deststorepass changeit " + + "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS"); assertTrue(err.indexOf("s1 not") != -1, "s1 not"); assertTrue(err.indexOf("s2 not") != -1, "s2 not"); assertTrue(err.indexOf("c1 success") != -1, "c1 success"); assertTrue(err.indexOf("p1 success") != -1, "p1 success"); remove("x.jks"); // One "yes" to stop - testOK("yes\n", "-srcstorepass changeit -deststorepass changeit -importkeystore -srckeystore x.jceks -srcstoretype JCEKS -destkeystore x.jks -deststoretype JKS"); // normal - // maybe c1 or p1 has been imported before s1 or s2 is touched, anyway we know yesNo is only asked once. + // normal + testOK("yes\n", "-srcstorepass changeit -deststorepass changeit " + + "-importkeystore -srckeystore x.jceks -srcstoretype JCEKS " + + "-destkeystore x.jks -deststoretype JKS"); + // maybe c1 or p1 has been imported before s1 or s2 is touched, + // anyway we know yesNo is only asked once. // pkcs12 remove("x.jks"); - testFail("changeit\nchangeit\n", "-keystore x.jks -storetype JKS -genkeypair -alias p1 -dname CN=olala"); // JKS prompt for keypass + // JKS prompt for keypass + testFail("changeit\nchangeit\n", "-keystore x.jks -storetype JKS " + + "-genkeypair -alias p1 -dname CN=olala"); remove("x.jks"); - testOK("changeit\nchangeit\n\n", "-keystore x.jks -storetype JKS -genkeypair -alias p1 -dname CN=olala"); // just type ENTER means keypass=storepass + // just type ENTER means keypass=storepass + testOK("changeit\nchangeit\n\n", "-keystore x.jks -storetype JKS " + + "-genkeypair -alias p1 -dname CN=olala"); remove("x.p12"); - testOK("", "-keystore x.p12 -storetype PKCS12 -storepass changeit -genkeypair -alias p0 -dname CN=olala"); // PKCS12 only need storepass - testOK("changeit\n", "-keystore x.p12 -storetype PKCS12 -genkeypair -alias p1 -dname CN=olala"); - testOK("changeit\n", "-keystore x.p12 -keypass changeit -storetype PKCS12 -genkeypair -alias p3 -dname CN=olala"); // when specify keypass, make sure keypass==storepass... - assertTrue(err.indexOf("Warning") == -1, "PKCS12 silent when keypass == storepass"); - testOK("changeit\n", "-keystore x.p12 -keypass another -storetype PKCS12 -genkeypair -alias p2 -dname CN=olala"); // otherwise, print a warning - assertTrue(err.indexOf("Warning") != -1, "PKCS12 warning when keypass != storepass"); - testFail("", "-keystore x.p12 -storepass changeit -storetype PKCS12 -keypasswd -new changeit -alias p3"); // no -keypasswd for PKCS12 - testOK("", "-keystore x.p12 -storepass changeit -storetype PKCS12 -changealias -alias p3 -destalias p33"); - testOK("", "-keystore x.p12 -storepass changeit -storetype PKCS12 -keyclone -alias p33 -destalias p3"); + // PKCS12 only need storepass + testOK("", "-keystore x.p12 -storetype PKCS12 -storepass changeit " + + "-genkeypair -alias p0 -dname CN=olala"); + testOK("changeit\n", "-keystore x.p12 -storetype PKCS12 " + + "-genkeypair -alias p1 -dname CN=olala"); + // when specify keypass, make sure keypass==storepass... + testOK("changeit\n", "-keystore x.p12 -keypass changeit " + + "-storetype PKCS12 -genkeypair -alias p3 -dname CN=olala"); + assertTrue(err.indexOf("Warning") == -1, + "PKCS12 silent when keypass == storepass"); + // otherwise, print a warning + testOK("changeit\n", "-keystore x.p12 -keypass another" + + " -storetype PKCS12 -genkeypair -alias p2 -dname CN=olala"); + assertTrue(err.indexOf("Warning") != -1, + "PKCS12 warning when keypass != storepass"); + // no -keypasswd for PKCS12 + testFail("", "-keystore x.p12 -storepass changeit -storetype PKCS12" + + " -keypasswd -new changeit -alias p3"); + testOK("", "-keystore x.p12 -storepass changeit -storetype PKCS12 " + + "-changealias -alias p3 -destalias p33"); + testOK("", "-keystore x.p12 -storepass changeit -storetype PKCS12 " + + "-keyclone -alias p33 -destalias p3"); // pkcs12 remove("x.p12"); - testOK("", "-keystore x.p12 -storetype PKCS12 -storepass changeit -genkeypair -alias p0 -dname CN=olala"); // PKCS12 only need storepass - testOK("", "-storepass changeit -keystore x.p12 -storetype PKCS12 -genkeypair -alias p1 -dname CN=olala"); - testOK("", "-storepass changeit -keystore x.p12 -keypass changeit -storetype PKCS12 -genkeypair -alias p3 -dname CN=olala"); // when specify keypass, make sure keypass==storepass... - assertTrue(err.indexOf("Warning") == -1, "PKCS12 silent when keypass == storepass"); - testOK("", "-storepass changeit -keystore x.p12 -keypass another -storetype PKCS12 -genkeypair -alias p2 -dname CN=olala"); // otherwise, print a warning - assertTrue(err.indexOf("Warning") != -1, "PKCS12 warning when keypass != storepass"); + // PKCS12 only need storepass + testOK("", "-keystore x.p12 -storetype PKCS12 -storepass changeit " + + "-genkeypair -alias p0 -dname CN=olala"); + testOK("", "-storepass changeit -keystore x.p12 -storetype PKCS12 " + + "-genkeypair -alias p1 -dname CN=olala"); + // when specify keypass, make sure keypass==storepass... + testOK("", "-storepass changeit -keystore x.p12 -keypass changeit " + + "-storetype PKCS12 -genkeypair -alias p3 -dname CN=olala"); + assertTrue(err.indexOf("Warning") == -1, + "PKCS12 silent when keypass == storepass"); + // otherwise, print a warning + testOK("", "-storepass changeit -keystore x.p12 -keypass another " + + "-storetype PKCS12 -genkeypair -alias p2 -dname CN=olala"); + assertTrue(err.indexOf("Warning") != -1, + "PKCS12 warning when keypass != storepass"); remove("x.jks"); remove("x.jceks"); @@ -512,7 +671,7 @@ void testPKCS11() throws Exception { KeyStore ks; - // pkcs11, the password maybe different and maybe PKCS11 is not supported + // pkcs11, the password maybe different and maybe PKCS11 not supported // in case last test is not executed successfully testAnyway("", p11Arg + "-storepass test12 -delete -alias p1"); @@ -521,75 +680,97 @@ testAnyway("", p11Arg + "-storepass test12 -delete -alias nss"); testOK("", p11Arg + "-storepass test12 -list"); - assertTrue(out.indexOf("Your keystore contains 0 entries") != -1, "*** MAKE SURE YOU HAVE NO ENTRIES IN YOUR PKCS11 KEYSTORE BEFORE THIS TEST ***"); + assertTrue(out.indexOf("Your keystore contains 0 entries") != -1, + "*** MAKE SURE YOU HAVE NO ENTRIES IN YOUR PKCS11 KEYSTORE " + + "BEFORE THIS TEST ***"); - testOK("", p11Arg + "-storepass test12 -genkeypair -alias p1 -dname CN=olala"); + testOK("", p11Arg + + "-storepass test12 -genkeypair -alias p1 -dname CN=olala"); testOK("test12\n", p11Arg + "-genkeypair -alias p2 -dname CN=olala2"); - testFail("test12\n", p11Arg + "-keypass test12 -genkeypair -alias p3 -dname CN=olala3"); // cannot provide keypass for PKCS11 - testFail("test12\n", p11Arg + "-keypass nonsense -genkeypair -alias p3 -dname CN=olala3"); // cannot provide keypass for PKCS11 + // cannot provide keypass for PKCS11 + testFail("test12\n", p11Arg + + "-keypass test12 -genkeypair -alias p3 -dname CN=olala3"); + // cannot provide keypass for PKCS11 + testFail("test12\n", p11Arg + + "-keypass nonsense -genkeypair -alias p3 -dname CN=olala3"); testOK("", p11Arg + "-storepass test12 -list"); - assertTrue(out.indexOf("Your keystore contains 2 entries") != -1, "2 entries in p11"); + assertTrue(out.indexOf("Your keystore contains 2 entries") != -1, + "2 entries in p11"); testOK("test12\n", p11Arg + "-alias p1 -changealias -destalias p3"); testOK("", p11Arg + "-storepass test12 -list -alias p3"); testFail("", p11Arg + "-storepass test12 -list -alias p1"); testOK("test12\n", p11Arg + "-alias p3 -keyclone -destalias p1"); - testFail("", p11Arg + "-storepass test12 -list -alias p3"); // in PKCS11, keyclone will delete old + // in PKCS11, keyclone will delete old + testFail("", p11Arg + "-storepass test12 -list -alias p3"); testOK("", p11Arg + "-storepass test12 -list -alias p1"); - testFail("test12\n", p11Arg + "-alias p1 -keypasswd -new another"); // cannot change password for PKCS11 + // cannot change password for PKCS11 + testFail("test12\n", p11Arg + "-alias p1 -keypasswd -new another"); testOK("", p11Arg + "-storepass test12 -list"); - assertTrue(out.indexOf("Your keystore contains 2 entries") != -1, "2 entries in p11"); + assertTrue(out.indexOf("Your keystore contains 2 entries") != -1, + "2 entries in p11"); testOK("", p11Arg + "-storepass test12 -delete -alias p1"); testOK("", p11Arg + "-storepass test12 -delete -alias p2"); testOK("", p11Arg + "-storepass test12 -list"); - assertTrue(out.indexOf("Your keystore contains 0 entries") != -1, "*** MAKE SURE YOU HAVE NO ENTRIES IN YOUR PKCS11 KEYSTORE BEFORE THIS TEST ***"); + assertTrue(out.indexOf("Your keystore contains 0 entries") != -1, + "*** MAKE SURE YOU HAVE NO ENTRIES IN YOUR PKCS11 KEYSTORE" + + " BEFORE THIS TEST ***"); } void testPKCS11ImportKeyStore() throws Exception { KeyStore ks; - testOK("", p11Arg + "-storepass test12 -genkeypair -alias p1 -dname CN=olala"); + testOK("", p11Arg + + "-storepass test12 -genkeypair -alias p1 -dname CN=olala"); testOK("test12\n", p11Arg + "-genkeypair -alias p2 -dname CN=olala2"); // test importkeystore for pkcs11 remove("x.jks"); // pkcs11 -> jks - testOK("changeit\nchangeit\ntest12\n", srcP11Arg + "-importkeystore -destkeystore x.jks -deststoretype JKS -srcalias p1"); - assertTrue(err.indexOf("not imported") != -1, "cannot import key without destkeypass"); + testOK("changeit\nchangeit\ntest12\n", srcP11Arg + + ("-importkeystore -destkeystore x.jks -deststoretype JKS " + + "-srcalias p1")); + assertTrue(err.indexOf("not imported") != -1, + "cannot import key without destkeypass"); ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(!ks.containsAlias("p1"), "p1 is not imported"); - testOK("changeit\ntest12\n", srcP11Arg + "-importkeystore -destkeystore x.jks -deststoretype JKS -srcalias p1 -destkeypass changeit"); - testOK("changeit\ntest12\n", srcP11Arg + "-importkeystore -destkeystore x.jks -deststoretype JKS -srcalias p2 -destkeypass changeit"); + testOK("changeit\ntest12\n", srcP11Arg + + ("-importkeystore -destkeystore x.jks -deststoretype JKS " + + "-srcalias p1 -destkeypass changeit")); + testOK("changeit\ntest12\n", srcP11Arg + + ("-importkeystore -destkeystore x.jks -deststoretype JKS " + + "-srcalias p2 -destkeypass changeit")); ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(ks.containsAlias("p1"), "p1 is imported"); assertTrue(ks.containsAlias("p2"), "p2 is imported"); // jks -> pkcs11 testOK("", p11Arg + "-storepass test12 -delete -alias p1"); testOK("", p11Arg + "-storepass test12 -delete -alias p2"); - testOK("test12\nchangeit\n", p11Arg + "-importkeystore -srckeystore x.jks -srcstoretype JKS"); + testOK("test12\nchangeit\n", p11Arg + + "-importkeystore -srckeystore x.jks -srcstoretype JKS"); testOK("", p11Arg + "-storepass test12 -list -alias p1"); testOK("", p11Arg + "-storepass test12 -list -alias p2"); testOK("", p11Arg + "-storepass test12 -list"); - assertTrue(out.indexOf("Your keystore contains 2 entries") != -1, "2 entries in p11"); + assertTrue(out.indexOf("Your keystore contains 2 entries") != -1, + "2 entries in p11"); // clean up testOK("", p11Arg + "-storepass test12 -delete -alias p1"); testOK("", p11Arg + "-storepass test12 -delete -alias p2"); testOK("", p11Arg + "-storepass test12 -list"); - assertTrue(out.indexOf("Your keystore contains 0 entries") != -1, "empty p11"); + assertTrue(out.indexOf("Your keystore contains 0 entries") != -1, + "empty p11"); remove("x.jks"); } - // The sqeTest reflects the test suggested by judy.gao and bill.situ at - // /net/sqesvr-nfs/global/nfs/sec/ws_6.0_int/security/src/SecurityTools/Keytool - // + // Selected sqeTest void sqeTest() throws Exception { FileOutputStream fos = new FileOutputStream("badkeystore"); for (int i=0; i<100; i++) { @@ -616,79 +797,131 @@ void sqeImportTest() throws Exception { KeyStore ks; remove("x.jks"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -exportcert -file x.jks.p1.cert"); - /* deleted */ testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file x.jks.p1.cert -noprompt"); - /* deleted */ testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey"); - testOK("yes\n", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file x.jks.p1.cert"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-exportcert -file x.jks.p1.cert"); + /* deleted */ testOK("", "-keystore x.jks -storetype JKS " + + "-storepass changeit -delete -alias mykey"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-importcert -file x.jks.p1.cert -noprompt"); + /* deleted */ testOK("", "-keystore x.jks -storetype JKS " + + "-storepass changeit -delete -alias mykey"); + testOK("yes\n", "-keystore x.jks -storetype JKS -storepass changeit " + + "-importcert -file x.jks.p1.cert"); ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(ks.containsAlias("mykey"), "imported"); - /* deleted */ testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey"); - testOK("\n", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file x.jks.p1.cert"); + /* deleted */ testOK("", "-keystore x.jks -storetype JKS " + + "-storepass changeit -delete -alias mykey"); + testOK("\n", "-keystore x.jks -storetype JKS -storepass changeit " + + "-importcert -file x.jks.p1.cert"); ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(!ks.containsAlias("mykey"), "imported"); - testOK("no\n", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file x.jks.p1.cert"); + testOK("no\n", "-keystore x.jks -storetype JKS -storepass changeit " + + "-importcert -file x.jks.p1.cert"); ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(!ks.containsAlias("mykey"), "imported"); - testFail("no\n", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file nonexist"); - testFail("no\n", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file x.jks"); + testFail("no\n", "-keystore x.jks -storetype JKS -storepass changeit " + + "-importcert -file nonexist"); + testFail("no\n", "-keystore x.jks -storetype JKS -storepass changeit " + + "-importcert -file x.jks"); remove("x.jks"); } // keyclone: exist. nonexist err, cert err, dest exist, misc void sqeKeyclonetest() throws Exception { remove("x.jks"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -new newpass -keyclone -dest p0"); // new pass - testOK("\n", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -keyclone -dest p1"); // new pass - testOK("\n", "-keystore x.jks -storetype JKS -storepass changeit -keyclone -dest p2"); - testFail("\n", "-keystore x.jks -storetype JKS -storepass changeit -keyclone -dest p2"); - testFail("\n", "-keystore x.jks -storetype JKS -storepass changeit -keyclone -dest p3 -alias noexist"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala"); + // new pass + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -new newpass -keyclone -dest p0"); + // new pass + testOK("\n", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -keyclone -dest p1"); + testOK("\n", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keyclone -dest p2"); + testFail("\n", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keyclone -dest p2"); + testFail("\n", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keyclone -dest p3 -alias noexist"); // no cert - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -exportcert -file x.jks.p1.cert"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file x.jks.p1.cert -noprompt"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -new newpass -keyclone -dest p0"); // new pass + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-exportcert -file x.jks.p1.cert"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-delete -alias mykey"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-importcert -file x.jks.p1.cert -noprompt"); + // new pass + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -new newpass -keyclone -dest p0"); remove("x.jks"); } // keypasswd: exist, short, nonexist err, cert err, misc void sqeKeypasswdTest() throws Exception { remove("x.jks"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -keypasswd -new newpass"); - /*change back*/ testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass newpass -keypasswd -new changeit"); - testOK("newpass\nnewpass\n", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -keypasswd"); - /*change back*/ testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass newpass -keypasswd -new changeit"); - testOK("new\nnew\nnewpass\nnewpass\n", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -keypasswd"); - /*change back*/ testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass newpass -keypasswd -new changeit"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypasswd -new newpass"); - /*change back*/ testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass newpass -keypasswd -new changeit"); - testOK("changeit\n", "-keystore x.jks -storetype JKS -keypasswd -new newpass"); - /*change back*/ testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass newpass -keypasswd -new changeit"); - testFail("", "-keystore x.jks -storetype JKS -storepass badpass -keypass changeit -keypasswd -new newpass"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass bad -keypasswd -new newpass"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -keypasswd -new newpass"); + /*change back*/ testOK("", "-keystore x.jks -storetype JKS " + + "-storepass changeit -keypass newpass -keypasswd -new changeit"); + testOK("newpass\nnewpass\n", "-keystore x.jks -storetype JKS " + + "-storepass changeit -keypass changeit -keypasswd"); + /*change back*/ testOK("", "-keystore x.jks -storetype JKS " + + "-storepass changeit -keypass newpass -keypasswd -new changeit"); + testOK("new\nnew\nnewpass\nnewpass\n", "-keystore x.jks " + + "-storetype JKS -storepass changeit -keypass changeit -keypasswd"); + /*change back*/ testOK("", "-keystore x.jks -storetype JKS " + + "-storepass changeit -keypass newpass -keypasswd -new changeit"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypasswd -new newpass"); + /*change back*/ testOK("", "-keystore x.jks -storetype JKS " + + "-storepass changeit -keypass newpass -keypasswd -new changeit"); + testOK("changeit\n", "-keystore x.jks -storetype JKS " + + "-keypasswd -new newpass"); + /*change back*/ testOK("", "-keystore x.jks -storetype JKS " + + "-storepass changeit -keypass newpass -keypasswd -new changeit"); + testFail("", "-keystore x.jks -storetype JKS -storepass badpass " + + "-keypass changeit -keypasswd -new newpass"); + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass bad -keypasswd -new newpass"); // no cert - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -exportcert -file x.jks.p1.cert"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file x.jks.p1.cert -noprompt"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -keypasswd -new newpass"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-exportcert -file x.jks.p1.cert"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-delete -alias mykey"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-importcert -file x.jks.p1.cert -noprompt"); + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -keypasswd -new newpass"); // diff pass - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass keypass -genkeypair -dname CN=olala"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypasswd -new newpass"); - testOK("keypass\n", "-keystore x.jks -storetype JKS -storepass changeit -keypasswd -new newpass"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-delete -alias mykey"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass keypass -genkeypair -dname CN=olala"); + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypasswd -new newpass"); + testOK("keypass\n", "-keystore x.jks -storetype JKS " + + "-storepass changeit -keypasswd -new newpass"); // i hate those misc test remove("x.jks"); } - // list: -f -alias, exist, nonexist err; otherwise, check all shows, -rfc shows more, and misc + // list: -f -alias, exist, nonexist err; + // otherwise, check all shows, -rfc shows more, and misc void sqeListTest() throws Exception { remove("x.jks"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala"); testOK("", "-keystore x.jks -storetype JKS -storepass changeit -list"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -list -alias mykey"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -list -alias notexist"); - testFail("", "-keystore x.jks -storetype JKS -storepass badpass -list -alias mykey"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass badpass -list -alias mykey"); // keypass ignore + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-list -alias mykey"); + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-list -alias notexist"); + testFail("", "-keystore x.jks -storetype JKS -storepass badpass " + + "-list -alias mykey"); + // keypass ignore + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass badpass -list -alias mykey"); testOK("\n", "-keystore x.jks -storetype JKS -list"); assertTrue(err.indexOf("WARNING") != -1, "no storepass"); testOK("changeit\n", "-keystore x.jks -storetype JKS -list"); @@ -700,92 +933,182 @@ testFail("", "-keystore badkeystore -storepass changeit -list"); remove("x.jks"); } - // selfcert: exist, non-exist err, cert err, sig..., dname, wrong keypass, misc + // selfcert: exist, non-exist err, cert err, sig, dname, wrong keypass, misc void sqeSelfCertTest() throws Exception { remove("x.jks"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala"); testOK("", "-keystore x.jks -storetype JKS -storepass changeit -selfcert"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -selfcert"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -selfcert -alias nonexisting"); // not exist - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -selfcert -dname CN=NewName"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -selfcert -sigalg MD5withRSA"); // sig not compatible - testFail("", "-keystore x.jks -storetype JKS -storepass wrong -keypass changeit -selfcert"); // bad pass - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass wrong -selfcert"); // bad pass + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -selfcert"); + // not exist + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -selfcert -alias nonexisting"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -selfcert -dname CN=NewName"); + // sig not compatible + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -selfcert -sigalg MD5withRSA"); + // bad pass + testFail("", "-keystore x.jks -storetype JKS -storepass wrong " + + "-keypass changeit -selfcert"); + // bad pass + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass wrong -selfcert"); //misc - testFail("", "-keystore nonexist -storepass changeit -keypass changeit -selfcert"); - testFail("", "-keystore aa//dd\\gg -storepass changeit -keypass changeit -selfcert"); + testFail("", "-keystore nonexist -storepass changeit " + + "-keypass changeit -selfcert"); + testFail("", "-keystore aa//dd\\gg -storepass changeit " + + "-keypass changeit -selfcert"); // diff pass remove("x.jks"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass keypass -genkeypair -dname CN=olala"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -selfcert"); - testOK("keypass\n", "-keystore x.jks -storetype JKS -storepass changeit -selfcert"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass keypass -genkeypair -dname CN=olala"); + testFail("", "-keystore x.jks -storetype JKS " + + "-storepass changeit -selfcert"); + testOK("keypass\n", "-keystore x.jks -storetype JKS " + + "-storepass changeit -selfcert"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -exportcert -file x.jks.p1.cert"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file x.jks.p1.cert -noprompt"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -selfcert"); // certentry cannot do selfcert + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-exportcert -file x.jks.p1.cert"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-delete -alias mykey"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-importcert -file x.jks.p1.cert -noprompt"); + // certentry cannot do selfcert + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-selfcert"); remove("x.jks"); } // storepass: bad old, short new, misc void sqeStorepassTest() throws Exception { remove("x.jks"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala"); - testOK("", "-storepasswd -keystore x.jks -storetype JKS -storepass changeit -new newstore"); // all in arg - /* Change back */ testOK("", "-storepasswd -keystore x.jks -storetype JKS -storepass newstore -new changeit"); - testOK("changeit\nnewstore\nnewstore\n", "-storepasswd -keystore x.jks -storetype JKS"); // all not in arg, new twice - /* Change back */ testOK("", "-storepasswd -keystore x.jks -storetype JKS -storepass newstore -new changeit"); - testOK("changeit\n", "-storepasswd -keystore x.jks -storetype JKS -new newstore"); // new in arg - /* Change back */ testOK("", "-storepasswd -keystore x.jks -storetype JKS -storepass newstore -new changeit"); - testOK("newstore\nnewstore\n", "-storepasswd -keystore x.jks -storetype JKS -storepass changeit"); // old in arg - /* Change back */ testOK("", "-storepasswd -keystore x.jks -storetype JKS -storepass newstore -new changeit"); - testOK("new\nnew\nnewstore\nnewstore\n", "-storepasswd -keystore x.jks -storetype JKS -storepass changeit"); // old in arg - /* Change back */ testOK("", "-storepasswd -keystore x.jks -storetype JKS -storepass newstore -new changeit"); - testFail("", "-storepasswd -keystore x.jks -storetype JKS -storepass badold -new newstore"); // bad old - testFail("", "-storepasswd -keystore x.jks -storetype JKS -storepass changeit -new new"); // short new + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala"); + // all in arg + testOK("", "-storepasswd -keystore x.jks -storetype JKS " + + "-storepass changeit -new newstore"); + /* Change back */ testOK("", "-storepasswd -keystore x.jks" + + " -storetype JKS -storepass newstore -new changeit"); + // all not in arg, new twice + testOK("changeit\nnewstore\nnewstore\n", "-storepasswd " + + "-keystore x.jks -storetype JKS"); + /* Change back */ testOK("", "-storepasswd -keystore x.jks " + + "-storetype JKS -storepass newstore -new changeit"); + // new in arg + testOK("changeit\n", "-storepasswd -keystore x.jks " + + "-storetype JKS -new newstore"); + /* Change back */ testOK("", "-storepasswd -keystore x.jks " + + "-storetype JKS -storepass newstore -new changeit"); + // old in arg + testOK("newstore\nnewstore\n", "-storepasswd -keystore x.jks " + + "-storetype JKS -storepass changeit"); + /* Change back */ testOK("", "-storepasswd -keystore x.jks " + + "-storetype JKS -storepass newstore -new changeit"); + // old in arg + testOK("new\nnew\nnewstore\nnewstore\n", "-storepasswd " + + "-keystore x.jks -storetype JKS -storepass changeit"); + /* Change back */ testOK("", "-storepasswd -keystore x.jks " + + "-storetype JKS -storepass newstore -new changeit"); + // bad old + testFail("", "-storepasswd -keystore x.jks -storetype JKS " + + "-storepass badold -new newstore"); + // short new + testFail("", "-storepasswd -keystore x.jks -storetype JKS " + + "-storepass changeit -new new"); // misc - testFail("", "-storepasswd -keystore nonexist -storepass changeit -new newstore"); // non exist - testFail("", "-storepasswd -keystore badkeystore -storepass changeit -new newstore"); // bad file - testFail("", "-storepasswd -keystore aa\\bb//cc//dd -storepass changeit -new newstore"); // bad file + // non exist + testFail("", "-storepasswd -keystore nonexist " + + "-storepass changeit -new newstore"); + // bad file + testFail("", "-storepasswd -keystore badkeystore " + + "-storepass changeit -new newstore"); + // bad file + testFail("", "-storepasswd -keystore aa\\bb//cc//dd " + + "-storepass changeit -new newstore"); remove("x.jks"); } void sqeGenkeyTest() throws Exception { remove("x.jks"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -alias newentry"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -alias newentry"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg DSA -alias n1"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg RSA -alias n2"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg NoSuchAlg -alias n3"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keysize 56 -alias n4"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keysize 999 -alias n5"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keysize 512 -alias n6"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keysize 1024 -alias n7"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -sigalg NoSuchAlg -alias n8"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg RSA -sigalg MD2withRSA -alias n9"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg RSA -sigalg MD5withRSA -alias n10"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg RSA -sigalg SHA1withRSA -alias n11"); - testFail("", "-keystore aa\\bb//cc\\dd -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg RSA -sigalg NoSuchAlg -alias n12"); - testFail("", "-keystore badkeystore -storepass changeit -keypass changeit -genkeypair -dname CN=olala -alias n14"); - testFail("", "-keystore x.jks -storetype JKS -storepass badpass -keypass changeit -genkeypair -dname CN=olala -alias n16"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CNN=olala -alias n17"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala"); + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala -alias newentry"); + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala -alias newentry"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala -keyalg DSA " + + "-alias n1"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala -keyalg RSA " + + "-alias n2"); + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala " + + "-keyalg NoSuchAlg -alias n3"); + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala -keysize 56 " + + "-alias n4"); + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala -keysize 999 " + + "-alias n5"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala -keysize 512 " + + "-alias n6"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala -keysize 1024 " + + "-alias n7"); + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala " + + "-sigalg NoSuchAlg -alias n8"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala -keyalg RSA " + + "-sigalg MD2withRSA -alias n9"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala -keyalg RSA " + + "-sigalg MD5withRSA -alias n10"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala -keyalg RSA " + + "-sigalg SHA1withRSA -alias n11"); + testFail("", "-keystore aa\\bb//cc\\dd -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala -keyalg RSA " + + "-sigalg NoSuchAlg -alias n12"); + testFail("", "-keystore badkeystore -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala " + + "-alias n14"); + testFail("", "-keystore x.jks -storetype JKS -storepass badpass " + + "-keypass changeit -genkeypair -dname CN=olala -alias n16"); + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CNN=olala -alias n17"); remove("x.jks"); } void sqeExportTest() throws Exception { remove("x.jks"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -export -file mykey.cert -alias mykey"); // nonexist - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -export -file mykey.cert -alias mykey"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -import -file mykey.cert -noprompt -alias c1"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -export -file mykey.cert2 -alias c1"); - testFail("", "-keystore aa\\bb//cc\\dd -storepass changeit -export -file mykey.cert2 -alias c1"); - testFail("", "-keystore nonexistkeystore -storepass changeit -export -file mykey.cert2 -alias c1"); - testFail("", "-keystore badkeystore -storepass changeit -export -file mykey.cert2 -alias c1"); - testFail("", "-keystore x.jks -storetype JKS -storepass badpass -export -file mykey.cert2 -alias c1"); + // nonexist + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-export -file mykey.cert -alias mykey"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-export -file mykey.cert -alias mykey"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-delete -alias mykey"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-import -file mykey.cert -noprompt -alias c1"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-export -file mykey.cert2 -alias c1"); + testFail("", "-keystore aa\\bb//cc\\dd -storepass changeit " + + "-export -file mykey.cert2 -alias c1"); + testFail("", "-keystore nonexistkeystore -storepass changeit " + + "-export -file mykey.cert2 -alias c1"); + testFail("", "-keystore badkeystore -storepass changeit " + + "-export -file mykey.cert2 -alias c1"); + testFail("", "-keystore x.jks -storetype JKS -storepass badpass " + + "-export -file mykey.cert2 -alias c1"); remove("mykey.cert"); remove("mykey.cert2"); remove("x.jks"); @@ -793,14 +1116,27 @@ void sqeDeleteTest() throws Exception { remove("x.jks"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey"); // nonexist - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala"); - testFail("", "-keystore aa\\bb//cc\\dd -storepass changeit -delete -alias mykey"); // keystore name illegal - testFail("", "-keystore nonexistkeystore -storepass changeit -delete -alias mykey"); // keystore not exist - testFail("", "-keystore badkeystore -storepass changeit -delete -alias mykey"); // keystore invalid - testFail("", "-keystore x.jks -storetype JKS -storepass xxxxxxxx -delete -alias mykey"); // wrong pass + // nonexist + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-delete -alias mykey"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-delete -alias mykey"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala"); + // keystore name illegal + testFail("", "-keystore aa\\bb//cc\\dd -storepass changeit " + + "-delete -alias mykey"); + // keystore not exist + testFail("", "-keystore nonexistkeystore -storepass changeit " + + "-delete -alias mykey"); + // keystore invalid + testFail("", "-keystore badkeystore -storepass changeit " + + "-delete -alias mykey"); + // wrong pass + testFail("", "-keystore x.jks -storetype JKS -storepass xxxxxxxx " + + "-delete -alias mykey"); remove("x.jks"); } @@ -809,31 +1145,61 @@ remove("x.jks.p1.cert"); remove("csr1"); // PrivateKeyEntry can do certreq - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keysize 1024"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1 -alias mykey"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1 -sigalg SHA1withDSA"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1 -sigalg MD5withRSA"); // unmatched sigalg + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala -keysize 1024"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-certreq -file csr1 -alias mykey"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-certreq -file csr1"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-certreq -file csr1 -sigalg SHA1withDSA"); + // unmatched sigalg + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-certreq -file csr1 -sigalg MD5withRSA"); // misc test - testFail("", "-keystore x.jks -storetype JKS -storepass badstorepass -certreq -file csr1"); // bad storepass - testOK("changeit\n", "-keystore x.jks -storetype JKS -certreq -file csr1"); // storepass from terminal - testFail("\n", "-keystore x.jks -storetype JKS -certreq -file csr1"); // must provide storepass - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -keypass badkeypass -certreq -file csr1"); // bad keypass - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file aa\\bb//cc\\dd"); // bad filepath - testFail("", "-keystore noexistks -storepass changeit -certreq -file csr1"); // non-existing keystore + // bad storepass + testFail("", "-keystore x.jks -storetype JKS -storepass badstorepass " + + "-certreq -file csr1"); + // storepass from terminal + testOK("changeit\n", "-keystore x.jks -storetype JKS " + + "-certreq -file csr1"); + // must provide storepass + testFail("\n", "-keystore x.jks -storetype JKS " + + "-certreq -file csr1"); + // bad keypass + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass badkeypass -certreq -file csr1"); + // bad filepath + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-certreq -file aa\\bb//cc\\dd"); + // non-existing keystore + testFail("", "-keystore noexistks -storepass changeit " + + "-certreq -file csr1"); // Try the RSA private key - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala -keyalg RSA"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1 -alias mykey"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1 -sigalg SHA1withDSA"); // unmatched sigalg - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1 -sigalg MD5withRSA"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-delete -alias mykey"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala -keyalg RSA"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-certreq -file csr1 -alias mykey"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-certreq -file csr1"); + // unmatched sigalg + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-certreq -file csr1 -sigalg SHA1withDSA"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-certreq -file csr1 -sigalg MD5withRSA"); // TrustedCertificateEntry cannot do certreq - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -exportcert -file x.jks.p1.cert"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -delete -alias mykey"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -importcert -file x.jks.p1.cert -noprompt"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1 -alias mykey"); - testFail("", "-keystore x.jks -storetype JKS -storepass changeit -certreq -file csr1"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-exportcert -file x.jks.p1.cert"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-delete -alias mykey"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-importcert -file x.jks.p1.cert -noprompt"); + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-certreq -file csr1 -alias mykey"); + testFail("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-certreq -file csr1"); remove("x.jks"); remove("x.jks.p1.cert"); remove("csr1"); @@ -842,8 +1208,10 @@ void sqePrintcertTest() throws Exception { remove("x.jks"); remove("mykey.cert"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -genkeypair -dname CN=olala"); - testOK("", "-keystore x.jks -storetype JKS -storepass changeit -export -file mykey.cert -alias mykey"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -genkeypair -dname CN=olala"); + testOK("", "-keystore x.jks -storetype JKS -storepass changeit " + + "-export -file mykey.cert -alias mykey"); testFail("", "-printcert -file badkeystore"); testFail("", "-printcert -file a/b/c/d"); testOK("", "-printcert -file mykey.cert"); @@ -857,7 +1225,8 @@ void v3extTest(String keyAlg) throws Exception { KeyStore ks; remove("x.jks"); - String simple = "-keystore x.jks -storetype JKS -storepass changeit -keypass changeit -noprompt -keyalg " + keyAlg + " "; + String simple = "-keystore x.jks -storetype JKS -storepass changeit " + + "-keypass changeit -noprompt -keyalg " + keyAlg + " "; String pre = simple + "-genkeypair -dname CN=Olala -alias "; // Version and SKID @@ -865,7 +1234,8 @@ ks = loadStore("x.jks", "changeit", "JKS"); assertTrue(((X509Certificate)ks.getCertificate("o1")).getVersion() == 3); - assertTrue(((X509CertImpl)ks.getCertificate("o1")).getSubjectKeyIdentifierExtension() != null); + assertTrue(((X509CertImpl)ks.getCertificate("o1")) + .getSubjectKeyIdentifierExtension() != null); // BC testOK("", pre + "b1 -ext BC:critical"); @@ -879,29 +1249,44 @@ testOK("", pre + "b9 -ext BC=12"); ks = loadStore("x.jks", "changeit", "JKS"); - assertTrue(((X509CertImpl)ks.getCertificate("b1")).getBasicConstraintsExtension().isCritical()); - assertTrue(!((X509CertImpl)ks.getCertificate("b2")).getBasicConstraintsExtension().isCritical()); - assertTrue(((X509CertImpl)ks.getCertificate("b8")).getBasicConstraintsExtension().isCritical()); - assertTrue(((X509Certificate)ks.getCertificate("b1")).getBasicConstraints() == Integer.MAX_VALUE); - assertTrue(((X509Certificate)ks.getCertificate("b2")).getBasicConstraints() == Integer.MAX_VALUE); - assertTrue(((X509Certificate)ks.getCertificate("b3")).getBasicConstraints() == Integer.MAX_VALUE); - assertTrue(((X509Certificate)ks.getCertificate("b4")).getBasicConstraints() == Integer.MAX_VALUE); - assertTrue(((X509Certificate)ks.getCertificate("b5")).getBasicConstraints() == Integer.MAX_VALUE); - assertTrue(((X509Certificate)ks.getCertificate("b6")).getBasicConstraints() == 12); - assertTrue(((X509Certificate)ks.getCertificate("b7")).getBasicConstraints() == -1); - assertTrue(((X509Certificate)ks.getCertificate("b9")).getBasicConstraints() == 12); + assertTrue(((X509CertImpl)ks.getCertificate("b1")) + .getBasicConstraintsExtension().isCritical()); + assertTrue(!((X509CertImpl)ks.getCertificate("b2")) + .getBasicConstraintsExtension().isCritical()); + assertTrue(((X509CertImpl)ks.getCertificate("b8")) + .getBasicConstraintsExtension().isCritical()); + assertTrue(((X509Certificate)ks.getCertificate("b1")) + .getBasicConstraints() == Integer.MAX_VALUE); + assertTrue(((X509Certificate)ks.getCertificate("b2")) + .getBasicConstraints() == Integer.MAX_VALUE); + assertTrue(((X509Certificate)ks.getCertificate("b3")) + .getBasicConstraints() == Integer.MAX_VALUE); + assertTrue(((X509Certificate)ks.getCertificate("b4")) + .getBasicConstraints() == Integer.MAX_VALUE); + assertTrue(((X509Certificate)ks.getCertificate("b5")) + .getBasicConstraints() == Integer.MAX_VALUE); + assertTrue(((X509Certificate)ks.getCertificate("b6")) + .getBasicConstraints() == 12); + assertTrue(((X509Certificate)ks.getCertificate("b7")) + .getBasicConstraints() == -1); + assertTrue(((X509Certificate)ks.getCertificate("b9")) + .getBasicConstraints() == 12); // KU testOK("", pre + "ku1 -ext KeyUsage:critical=digitalsignature"); testOK("", pre + "ku2 -ext KU=digitalSignature"); testOK("", pre + "ku3 -ext KU=ds"); testOK("", pre + "ku4 -ext KU=dig"); - testFail("", pre + "ku5 -ext KU=d"); // ambigous value - testFail("", pre + "ku6 -ext KU=cs"); // cRLSign cannot be cs + // ambigous value + testFail("", pre + "ku5 -ext KU=d"); + // cRLSign cannot be cs + testFail("", pre + "ku6 -ext KU=cs"); testOK("", pre + "ku11 -ext KU=nr"); - testFail("", pre + "ku12 -ext KU=ke"); // ke also means keyAgreement + // ke also means keyAgreement + testFail("", pre + "ku12 -ext KU=ke"); testOK("", pre + "ku12 -ext KU=keyE"); - testFail("", pre + "ku13 -ext KU=de"); // de also means decipherOnly + // de also means decipherOnly + testFail("", pre + "ku13 -ext KU=de"); testOK("", pre + "ku13 -ext KU=dataE"); testOK("", pre + "ku14 -ext KU=ka"); testOK("", pre + "ku15 -ext KU=kcs"); @@ -919,7 +1304,8 @@ class CheckKU { void check(KeyStore ks, String alias, int... pos) throws Exception { System.err.print("x"); - boolean[] bs = ((X509Certificate)ks.getCertificate(alias)).getKeyUsage(); + boolean[] bs = ((X509Certificate)ks.getCertificate(alias)) + .getKeyUsage(); bs = Arrays.copyOf(bs, 9); for (int i=0; i bs = ((X509Certificate)ks.getCertificate(alias)).getExtendedKeyUsage(); + List bs = ((X509Certificate)ks.getCertificate(alias)) + .getExtendedKeyUsage(); int found = 0; for (String p: pos) { if (bs.contains(p)) { @@ -991,8 +1380,10 @@ } } CheckEKU cx = new CheckEKU(); - assertTrue(((X509CertImpl)ks.getCertificate("eku1")).getExtension(PKIXExtensions.ExtendedKeyUsage_Id).isCritical()); - assertTrue(!((X509CertImpl)ks.getCertificate("eku2")).getExtension(PKIXExtensions.ExtendedKeyUsage_Id).isCritical()); + assertTrue(((X509CertImpl)ks.getCertificate("eku1")) + .getExtension(PKIXExtensions.ExtendedKeyUsage_Id).isCritical()); + assertTrue(!((X509CertImpl)ks.getCertificate("eku2")) + .getExtension(PKIXExtensions.ExtendedKeyUsage_Id).isCritical()); cx.check(ks, "eku1", "1.3.6.1.5.5.7.3.1"); cx.check(ks, "eku2", "1.3.6.1.5.5.7.3.2"); cx.check(ks, "eku3", "1.3.6.1.5.5.7.3.3"); @@ -1013,12 +1404,15 @@ ks = loadStore("x.jks", "changeit", "JKS"); class CheckSAN { // Please sort items with name type - void check(KeyStore ks, String alias, int type, Object... items) throws Exception { + void check(KeyStore ks, String alias, int type, Object... items) + throws Exception { int pos = 0; System.err.print("x"); Object[] names = null; - if (type == 0) names = ((X509Certificate)ks.getCertificate(alias)).getSubjectAlternativeNames().toArray(); - else names = ((X509Certificate)ks.getCertificate(alias)).getIssuerAlternativeNames().toArray(); + if (type == 0) names = ((X509Certificate)ks.getCertificate(alias)) + .getSubjectAlternativeNames().toArray(); + else names = ((X509Certificate)ks.getCertificate(alias)) + .getIssuerAlternativeNames().toArray(); Arrays.sort(names, new Comparator() { public int compare(Object o1, Object o2) { int i1 = (Integer)((List)o1).get(0); @@ -1041,8 +1435,10 @@ } } CheckSAN csan = new CheckSAN(); - assertTrue(((X509CertImpl)ks.getCertificate("san1")).getSubjectAlternativeNameExtension().isCritical()); - assertTrue(!((X509CertImpl)ks.getCertificate("san2")).getSubjectAlternativeNameExtension().isCritical()); + assertTrue(((X509CertImpl)ks.getCertificate("san1")) + .getSubjectAlternativeNameExtension().isCritical()); + assertTrue(!((X509CertImpl)ks.getCertificate("san2")) + .getSubjectAlternativeNameExtension().isCritical()); csan.check(ks, "san1", 0, 1, "me@me.org"); csan.check(ks, "san2", 0, 6, "http://me.org"); csan.check(ks, "san3", 0, 2, "me.org"); @@ -1059,8 +1455,10 @@ testOK("", pre+"ian235 -ext ian=uri:http://me.org,dns:me.org,oid:1.2.3.4"); ks = loadStore("x.jks", "changeit", "JKS"); - assertTrue(((X509CertImpl)ks.getCertificate("ian1")).getIssuerAlternativeNameExtension().isCritical()); - assertTrue(!((X509CertImpl)ks.getCertificate("ian2")).getIssuerAlternativeNameExtension().isCritical()); + assertTrue(((X509CertImpl)ks.getCertificate("ian1")) + .getIssuerAlternativeNameExtension().isCritical()); + assertTrue(!((X509CertImpl)ks.getCertificate("ian2")) + .getIssuerAlternativeNameExtension().isCritical()); csan.check(ks, "ian1", 1, 1, "me@me.org"); csan.check(ks, "ian2", 1, 6, "http://me.org"); csan.check(ks, "ian3", 1, 2, "me.org"); @@ -1071,63 +1469,85 @@ // SIA testOK("", pre+"sia1 -ext sia=care:uri:ldap://ca.com/cn=CA"); testOK("", pre+"sia2 -ext sia=ts:email:ts@ca.com"); - testFail("SIA never critical", pre+"sia3 -ext sia:critical=ts:email:ts@ca.com"); + testFail("SIA never critical", pre + + "sia3 -ext sia:critical=ts:email:ts@ca.com"); ks = loadStore("x.jks", "changeit", "JKS"); class CheckSia { - void check(KeyStore ks, String alias, int type, Object... items) throws Exception { + void check(KeyStore ks, String alias, int type, Object... items) + throws Exception { int pos = 0; System.err.print("x"); AccessDescription[] ads = null; if (type == 0) { - SubjectInfoAccessExtension siae = (SubjectInfoAccessExtension)((X509CertImpl)ks.getCertificate(alias)).getExtension(PKIXExtensions.SubjectInfoAccess_Id); - ads = siae.getAccessDescriptions().toArray(new AccessDescription[0]); + SubjectInfoAccessExtension siae = (SubjectInfoAccessExtension) + ((X509CertImpl)ks.getCertificate(alias)) + .getExtension(PKIXExtensions.SubjectInfoAccess_Id); + ads = siae.getAccessDescriptions() + .toArray(new AccessDescription[0]); } else { - AuthorityInfoAccessExtension aiae = (AuthorityInfoAccessExtension)((X509CertImpl)ks.getCertificate(alias)).getExtension(PKIXExtensions.AuthInfoAccess_Id); - ads = aiae.getAccessDescriptions().toArray(new AccessDescription[0]); + AuthorityInfoAccessExtension aiae = + (AuthorityInfoAccessExtension) + ((X509CertImpl)ks.getCertificate(alias)) + .getExtension(PKIXExtensions.AuthInfoAccess_Id); + ads = aiae.getAccessDescriptions() + .toArray(new AccessDescription[0]); } Arrays.sort(ads, new Comparator() { @Override - public int compare(AccessDescription o1, AccessDescription o2) { - return o1.getAccessMethod().toString().compareTo(o2.getAccessMethod().toString()); + public int compare(AccessDescription o1, + AccessDescription o2) { + return o1.getAccessMethod().toString() + .compareTo(o2.getAccessMethod().toString()); } }); for (AccessDescription ad: ads) { if (!ad.getAccessMethod().equals(items[pos++]) || - !new Integer(ad.getAccessLocation().getType()).equals(items[pos++])) { + !new Integer(ad.getAccessLocation().getType()) + .equals(items[pos++])) { throw new RuntimeException("Not same type at " + pos); } String name = null; switch (ad.getAccessLocation().getType()) { case 1: - name = ((RFC822Name)ad.getAccessLocation().getName()).getName(); + name = ((RFC822Name)ad.getAccessLocation() + .getName()).getName(); break; case 6: - name = ((URIName)ad.getAccessLocation().getName()).getURI().toString(); + name = ((URIName)ad.getAccessLocation() + .getName()).getURI().toString(); break; default: throw new RuntimeException("Not implemented: " + ad); } if (!name.equals(items[pos++])) { - throw new Exception("Name not same for " + ad + " at pos " + pos); + throw new Exception("Name not same for " + ad + + " at pos " + pos); } } } } CheckSia csia = new CheckSia(); - assertTrue(!((X509CertImpl)ks.getCertificate("sia1")).getExtension(PKIXExtensions.SubjectInfoAccess_Id).isCritical()); - csia.check(ks, "sia1", 0, AccessDescription.Ad_CAREPOSITORY_Id, 6, "ldap://ca.com/cn=CA"); - csia.check(ks, "sia2", 0, AccessDescription.Ad_TIMESTAMPING_Id, 1, "ts@ca.com"); + assertTrue(!((X509CertImpl)ks.getCertificate("sia1")) + .getExtension(PKIXExtensions.SubjectInfoAccess_Id).isCritical()); + csia.check(ks, "sia1", 0, + AccessDescription.Ad_CAREPOSITORY_Id, 6, "ldap://ca.com/cn=CA"); + csia.check(ks, "sia2", + 0, AccessDescription.Ad_TIMESTAMPING_Id, 1, "ts@ca.com"); // AIA testOK("", pre+"aia1 -ext aia=cai:uri:ldap://ca.com/cn=CA"); testOK("", pre+"aia2 -ext aia=ocsp:email:ocsp@ca.com"); - testFail("AIA never critical", pre+"aia3 -ext aia:critical=ts:email:ts@ca.com"); + testFail("AIA never critical", pre + + "aia3 -ext aia:critical=ts:email:ts@ca.com"); ks = loadStore("x.jks", "changeit", "JKS"); - assertTrue(!((X509CertImpl)ks.getCertificate("aia1")).getExtension(PKIXExtensions.AuthInfoAccess_Id).isCritical()); - csia.check(ks, "aia1", 1, AccessDescription.Ad_CAISSUERS_Id, 6, "ldap://ca.com/cn=CA"); - csia.check(ks, "aia2", 1, AccessDescription.Ad_OCSP_Id, 1, "ocsp@ca.com"); + assertTrue(!((X509CertImpl)ks.getCertificate("aia1")) + .getExtension(PKIXExtensions.AuthInfoAccess_Id).isCritical()); + csia.check(ks, "aia1", 1, + AccessDescription.Ad_CAISSUERS_Id, 6, "ldap://ca.com/cn=CA"); + csia.check(ks, "aia2", 1, + AccessDescription.Ad_OCSP_Id, 1, "ocsp@ca.com"); // OID testOK("", pre+"oid1 -ext 1.2.3:critical=0102"); @@ -1136,18 +1556,23 @@ ks = loadStore("x.jks", "changeit", "JKS"); class CheckOid { - void check(KeyStore ks, String alias, String oid, byte[] value) throws Exception { + void check(KeyStore ks, String alias, String oid, byte[] value) + throws Exception { int pos = 0; System.err.print("x"); - Extension ex = ((X509CertImpl)ks.getCertificate(alias)).getExtension(new ObjectIdentifier(oid)); + Extension ex = ((X509CertImpl)ks.getCertificate(alias)) + .getExtension(new ObjectIdentifier(oid)); if (!Arrays.equals(value, ex.getValue())) { - throw new RuntimeException("Not same content in " + alias + " for " + oid); + throw new RuntimeException("Not same content in " + + alias + " for " + oid); } } } CheckOid coid = new CheckOid(); - assertTrue(((X509CertImpl)ks.getCertificate("oid1")).getExtension(new ObjectIdentifier("1.2.3")).isCritical()); - assertTrue(!((X509CertImpl)ks.getCertificate("oid2")).getExtension(new ObjectIdentifier("1.2.3")).isCritical()); + assertTrue(((X509CertImpl)ks.getCertificate("oid1")) + .getExtension(new ObjectIdentifier("1.2.3")).isCritical()); + assertTrue(!((X509CertImpl)ks.getCertificate("oid2")) + .getExtension(new ObjectIdentifier("1.2.3")).isCritical()); coid.check(ks, "oid1", "1.2.3", new byte[]{1,2}); coid.check(ks, "oid2", "1.2.3", new byte[]{}); coid.check(ks, "oid12", "1.2.3", new byte[]{}); @@ -1163,7 +1588,8 @@ "-rfc -file test.req"); // printcertreq testOK("", "-printcertreq -file test.req"); - // issue: deny KU, change criticality of 1.2.3 and 1.2.4, change content of BC, add 2.3.4 + // issue: deny KU, change criticality of 1.2.3 and 1.2.4, + // change content of BC, add 2.3.4 testOK("", simple+"-gencert -alias ca -infile test.req -ext " + "honored=all,-KU,1.2.3:critical,1.2.4:non-critical " + "-ext BC=2 -ext 2.3.4=01020304 " + @@ -1184,6 +1610,22 @@ assertTrue(!a.getExtension(new ObjectIdentifier("2.3.4")).isCritical()); assertTrue(a.getExtensionValue("2.3.4").length == 6); + // 8073181: keytool -ext honored not working correctly + testOK("", simple+"-gencert -alias ca -infile test.req -ext " + + "honored=1.2.3,1.2.4:critical " + + "-debug -rfc -outfile test2.cert"); + testOK("", simple+"-importcert -file test2.cert -alias b"); + ks = loadStore("x.jks", "changeit", "JKS"); + X509CertImpl b = (X509CertImpl)ks.getCertificate("b"); + assertTrue(!b.getExtension(new ObjectIdentifier("1.2.3")).isCritical()); + assertTrue(b.getExtension(new ObjectIdentifier("1.2.4")).isCritical()); + + // 8073182: keytool may generate duplicate extensions + testOK("", pre+"dup -ext bc=2 -ext 2.5.29.19=30030101FF -ext bc=3"); + ks = loadStore("x.jks", "changeit", "JKS"); + X509CertImpl dup = (X509CertImpl)ks.getCertificate("dup"); + assertTrue(dup.getBasicConstraints() == 3); + remove("x.jks"); remove("test.req"); remove("test.cert"); @@ -1194,64 +1636,100 @@ remove("x.jks"); testOK("", "-help"); - // 2. keytool -genkey -v -keysize 512 Enter "a" for the keystore password. Check error (password too short). Enter "password" for the keystore password. Hit 'return' for "first and last name", "organizational unit", "City", "State", and "Country Code". Type "yes" when they ask you if everything is correct. Type 'return' for new key password. - testOK("a\npassword\npassword\nMe\nHere\nNow\nPlace\nPlace\nUS\nyes\n\n", "-genkey -v -keysize 512 -keystore x.jks -storetype JKS"); + // 2. keytool -genkey -v -keysize 512 Enter "a" for the keystore + // password. Check error (password too short). Enter "password" for + // the keystore password. Hit 'return' for "first and last name", + // "organizational unit", "City", "State", and "Country Code". + // Type "yes" when they ask you if everything is correct. + // Type 'return' for new key password. + testOK("a\npassword\npassword\nMe\nHere\nNow\nPlace\nPlace\nUS\nyes\n\n", + "-genkey -v -keysize 512 -keystore x.jks -storetype JKS"); // 3. keytool -list -v -storepass password testOK("", "-list -v -storepass password -keystore x.jks -storetype JKS"); - // 4. keytool -list -v Type "a" for the keystore password. Check error (wrong keystore password). + // 4. keytool -list -v Type "a" for the keystore password. + // Check error (wrong keystore password). testFail("a\n", "-list -v -keystore x.jks -storetype JKS"); assertTrue(ex.indexOf("password was incorrect") != -1); - // 5. keytool -genkey -v -keysize 512 Enter "password" as the password. Check error (alias 'mykey' already exists). - testFail("password\n", "-genkey -v -keysize 512 -keystore x.jks -storetype JKS"); + // 5. keytool -genkey -v -keysize 512 Enter "password" as the password. + // Check error (alias 'mykey' already exists). + testFail("password\n", "-genkey -v -keysize 512" + + " -keystore x.jks -storetype JKS"); assertTrue(ex.indexOf("alias already exists") != -1); - // 6. keytool -genkey -v -keysize 512 -alias mykey2 -storepass password Hit 'return' for "first and last name", "organizational unit", "City", "State", and "Country Code". Type "yes" when they ask you if everything is correct. Type 'return' for new key password. - testOK("\n\n\n\n\n\nyes\n\n", "-genkey -v -keysize 512 -alias mykey2 -storepass password -keystore x.jks -storetype JKS"); + // 6. keytool -genkey -v -keysize 512 -alias mykey2 -storepass password + // Hit 'return' for "first and last name", "organizational unit", "City", + // "State", and "Country Code". Type "yes" when they ask you if + // everything is correct. Type 'return' for new key password. + testOK("\n\n\n\n\n\nyes\n\n", "-genkey -v -keysize 512 -alias mykey2" + + " -storepass password -keystore x.jks -storetype JKS"); // 7. keytool -list -v Type 'password' for the store password. testOK("password\n", "-list -v -keystore x.jks -storetype JKS"); - // 8. keytool -keypasswd -v -alias mykey2 -storepass password Type "a" for the new key password. Type "aaaaaa" for the new key password. Type "bbbbbb" when re-entering the new key password. Type "a" for the new key password. Check Error (too many failures). - testFail("a\naaaaaa\nbbbbbb\na\n", "-keypasswd -v -alias mykey2 -storepass password -keystore x.jks -storetype JKS"); + // 8. keytool -keypasswd -v -alias mykey2 -storepass password + // Type "a" for the new key password. Type "aaaaaa" for the new key + // password. Type "bbbbbb" when re-entering the new key password. + // Type "a" for the new key password. Check Error (too many failures). + testFail("a\naaaaaa\nbbbbbb\na\n", "-keypasswd -v -alias mykey2" + + " -storepass password -keystore x.jks -storetype JKS"); assertTrue(ex.indexOf("Too many failures - try later") != -1); - // 9. keytool -keypasswd -v -alias mykey2 -storepass password Type "aaaaaa" for the new key password. Type "aaaaaa" when re-entering the new key password. - testOK("aaaaaa\naaaaaa\n", "-keypasswd -v -alias mykey2 -storepass password -keystore x.jks -storetype JKS"); + // 9. keytool -keypasswd -v -alias mykey2 -storepass password + // Type "aaaaaa" for the new key password. Type "aaaaaa" + // when re-entering the new key password. + testOK("aaaaaa\naaaaaa\n", "-keypasswd -v -alias mykey2 " + + "-storepass password -keystore x.jks -storetype JKS"); // 10. keytool -selfcert -v -alias mykey -storepass password - testOK("", "-selfcert -v -alias mykey -storepass password -keystore x.jks -storetype JKS"); + testOK("", "-selfcert -v -alias mykey -storepass password " + + "-keystore x.jks -storetype JKS"); // 11. keytool -list -v -storepass password testOK("", "-list -v -storepass password -keystore x.jks -storetype JKS"); // 12. keytool -export -v -alias mykey -file cert -storepass password remove("cert"); - testOK("", "-export -v -alias mykey -file cert -storepass password -keystore x.jks -storetype JKS"); - // 13. keytool -import -v -file cert -storepass password Check error (Certificate reply and cert are the same) - testFail("", "-import -v -file cert -storepass password -keystore x.jks -storetype JKS"); - assertTrue(ex.indexOf("Certificate reply and certificate in keystore are identical") != -1); + testOK("", "-export -v -alias mykey -file cert -storepass password " + + "-keystore x.jks -storetype JKS"); + // 13. keytool -import -v -file cert -storepass password + // Check error (Certificate reply and cert are the same) + testFail("", "-import -v -file cert -storepass password" + + " -keystore x.jks -storetype JKS"); + assertTrue(ex.indexOf("Certificate reply and certificate" + + " in keystore are identical") != -1); // 14. keytool -printcert -file cert testOK("", "-printcert -file cert -keystore x.jks -storetype JKS"); remove("cert"); // 15. keytool -list -storepass password -provider sun.security.provider.Sun - testOK("", "-list -storepass password -provider sun.security.provider.Sun -keystore x.jks -storetype JKS"); + testOK("", "-list -storepass password" + + " -provider sun.security.provider.Sun" + + " -keystore x.jks -storetype JKS"); //Error tests - // 1. keytool -storepasswd -storepass password -new abc Check error (password too short) + // 1. keytool -storepasswd -storepass password -new abc + // Check error (password too short) testFail("", "-storepasswd -storepass password -new abc"); assertTrue(ex.indexOf("New password must be at least 6 characters") != -1); // Changed, no NONE needed now // 2. keytool -list -storetype PKCS11 Check error (-keystore must be NONE) //testFail("", "-list -storetype PKCS11"); //assertTrue(err.indexOf("keystore must be NONE") != -1); - // 3. keytool -storepasswd -storetype PKCS11 -keystore NONE Check error (unsupported operation) + // 3. keytool -storepasswd -storetype PKCS11 -keystore NONE + // Check error (unsupported operation) testFail("", "-storepasswd -storetype PKCS11 -keystore NONE"); assertTrue(ex.indexOf("UnsupportedOperationException") != -1); - // 4. keytool -keypasswd -storetype PKCS11 -keystore NONE Check error (unsupported operation) + // 4. keytool -keypasswd -storetype PKCS11 -keystore NONE + // Check error (unsupported operation) testFail("", "-keypasswd -storetype PKCS11 -keystore NONE"); assertTrue(ex.indexOf("UnsupportedOperationException") != -1); - // 5. keytool -list -protected -storepass password Check error (password can not be specified with -protected) - testFail("", "-list -protected -storepass password -keystore x.jks -storetype JKS"); + // 5. keytool -list -protected -storepass password + // Check error (password can not be specified with -protected) + testFail("", "-list -protected -storepass password " + + "-keystore x.jks -storetype JKS"); assertTrue(ex.indexOf("if -protected is specified, then") != -1); - // 6. keytool -keypasswd -protected -keypass password Check error (password can not be specified with -protected) - testFail("", "-keypasswd -protected -keypass password -keystore x.jks -storetype JKS"); + // 6. keytool -keypasswd -protected -keypass password + // Check error (password can not be specified with -protected) + testFail("", "-keypasswd -protected -keypass password " + + "-keystore x.jks -storetype JKS"); assertTrue(ex.indexOf("if -protected is specified, then") != -1); - // 7. keytool -keypasswd -protected -new password Check error (password can not be specified with -protected) - testFail("", "-keypasswd -protected -new password -keystore x.jks -storetype JKS"); + // 7. keytool -keypasswd -protected -new password + // Check error (password can not be specified with -protected) + testFail("", "-keypasswd -protected -new password " + + "-keystore x.jks -storetype JKS"); assertTrue(ex.indexOf("if -protected is specified, then") != -1); remove("x.jks"); } @@ -1261,14 +1739,19 @@ // 1. sccs edit cert8.db key3.db //Runtime.getRuntime().exec("/usr/ccs/bin/sccs edit cert8.db key3.db"); - testOK("", p11Arg + "-storepass test12 -genkey -alias genkey -dname cn=genkey -keysize 512 -keyalg rsa"); + testOK("", p11Arg + ("-storepass test12 -genkey -alias genkey" + + " -dname cn=genkey -keysize 512 -keyalg rsa")); testOK("", p11Arg + "-storepass test12 -list"); testOK("", p11Arg + "-storepass test12 -list -alias genkey"); - testOK("", p11Arg + "-storepass test12 -certreq -alias genkey -file genkey.certreq"); - testOK("", p11Arg + "-storepass test12 -export -alias genkey -file genkey.cert"); + testOK("", p11Arg + + "-storepass test12 -certreq -alias genkey -file genkey.certreq"); + testOK("", p11Arg + + "-storepass test12 -export -alias genkey -file genkey.cert"); testOK("", "-printcert -file genkey.cert"); - testOK("", p11Arg + "-storepass test12 -selfcert -alias genkey -dname cn=selfCert"); - testOK("", p11Arg + "-storepass test12 -list -alias genkey -v"); + testOK("", p11Arg + + "-storepass test12 -selfcert -alias genkey -dname cn=selfCert"); + testOK("", p11Arg + + "-storepass test12 -list -alias genkey -v"); assertTrue(out.indexOf("Owner: CN=selfCert") != -1); //(check that cert subject DN is [cn=selfCert]) testOK("", p11Arg + "-storepass test12 -delete -alias genkey"); @@ -1285,7 +1768,8 @@ void sszzTest() throws Exception { testAnyway("", NSS_P11_ARG+"-delete -alias nss -storepass test12"); testAnyway("", NZZ_P11_ARG+"-delete -alias nss -storepass test12"); - testOK("", NSS_P11_ARG+"-genkeypair -dname CN=NSS -alias nss -storepass test12"); + testOK("", NSS_P11_ARG+"-genkeypair -dname CN=NSS " + + "-alias nss -storepass test12"); testOK("", NSS_SRC_P11_ARG + NZZ_P11_ARG + "-importkeystore -srcstorepass test12 -deststorepass test12"); testAnyway("", NSS_P11_ARG+"-delete -alias nss -storepass test12"); @@ -1323,11 +1807,13 @@ // FAIL: // 1. we still don't have srcprovidername yet // 2. cannot store privatekey into NSS keystore - // java.security.KeyStoreException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_TEMPLATE_INCOMPLETE. + // java.security.KeyStoreException: sun.security.pkcs11 + // .wrapper.PKCS11Exception: CKR_TEMPLATE_INCOMPLETE. //t.testPKCS11ImportKeyStore(); t.i18nPKCS11Test(); - //FAIL: currently PKCS11-NSS does not support 2 NSS KeyStores to be loaded at the same time + //FAIL: currently PKCS11-NSS does not support + // 2 NSS KeyStores to be loaded at the same time //t.sszzTest(); } diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/tools/launcher/TestSpecialArgs.java --- a/jdk/test/tools/launcher/TestSpecialArgs.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/tools/launcher/TestSpecialArgs.java Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,12 +23,14 @@ /* * @test - * @bug 7124089 7131021 8042469 - * @summary Checks for MacOSX specific flags are accepted or rejected, and - * MacOSX platforms specific environment is consistent. + * @bug 7124089 7131021 8042469 8066185 + * @summary Checks for Launcher special flags, such as MacOSX specific flags, + * and JVM NativeMemoryTracking flags. * @compile -XDignore.symbol.file TestSpecialArgs.java EnvironmentVariables.java * @run main TestSpecialArgs */ +import java.io.File; +import java.io.FileNotFoundException; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -36,10 +38,14 @@ public class TestSpecialArgs extends TestHelper { - public static void main(String... args) { + public static void main(String... args) throws Exception { + new TestSpecialArgs().run(args); + } + + @Test + void testDocking() { final Map envMap = new HashMap<>(); envMap.put("_JAVA_LAUNCHER_DEBUG", "true"); - TestResult tr = doExec(envMap, javaCmd, "-XstartOnFirstThread", "-version"); if (isMacOSX) { if (!tr.contains("In same thread")) { @@ -69,140 +75,10 @@ throw new RuntimeException("Error: argument was accepted ????"); } } - - /* - * test argument : -XX:NativeMemoryTracking=value - * A JVM flag, comsumed by the JVM, but requiring launcher - * to set an environmental variable if and only if value is supplied. - * Test and order: - * 1) execute with valid parameter: -XX:NativeMemoryTracking=MyValue - * a) check for correct env variable name: "NMT_LEVEL_" + pid - * b) check that "MyValue" was found in local env. - * 2) execute with invalid parameter: -XX:NativeMemoryTracking= - * !) Won't find "NativeMemoryTracking:" - * Code to create env variable not executed. - * 3) execute with invalid parameter: -XX:NativeMemoryTracking - * !) Won't find "NativeMemoryTracking:" - * Code to create env variable not executed. - * 4) give and invalid value and check to make sure JVM commented - */ - { // NativeMemoryTracking - String launcherPidString = "launcher.pid="; - String envVarPidString = "TRACER_MARKER: NativeMemoryTracking: env var is NMT_LEVEL_"; - String NMT_Option_Value = "off"; - String myClassName = "helloworld"; - boolean haveLauncherPid = false; - - // === Run the tests === - - // ---Test 1a - tr = doExec(envMap,javaCmd, "-XX:NativeMemoryTracking=" + NMT_Option_Value, - "-version"); - - // get the PID from the env var we set for the JVM - String envVarPid = null; - for (String line : tr.testOutput) { - if (line.contains(envVarPidString)) { - int sindex = envVarPidString.length(); - envVarPid = line.substring(sindex); - break; - } - } - // did we find envVarPid? - if (envVarPid == null) { - System.out.println(tr); - throw new RuntimeException("Error: failed to find env Var Pid in tracking info"); - } - // we think we found the pid string. min test, not "". - if (envVarPid.length() < 1) { - System.out.println(tr); - throw new RuntimeException("Error: env Var Pid in tracking info is empty string"); - } - - /* - * On Linux, Launcher Tracking will print the PID. Use this info - * to validate what we got as the PID in the Launcher itself. - * Linux is the only one that prints this, and trying to get it - * here for win is awful. So let the linux test make sure we get - * the valid pid, and for non-linux, just make sure pid string is - * non-zero. - */ - if (isLinux) { - // get what the test says is the launcher pid - String launcherPid = null; - for (String line : tr.testOutput) { - int index = line.indexOf(launcherPidString); - if (index >= 0) { - int sindex = index + launcherPidString.length(); - int tindex = sindex + line.substring(sindex).indexOf("'"); - System.out.println("DEBUG INFO: sindex = " + sindex); - System.out.println("DEBUG INFO: searching substring: " + line.substring(sindex)); - System.out.println("DEBUG INFO: tindex = " + tindex); - // DEBUG INFO - System.out.println(tr); - launcherPid = line.substring(sindex, tindex); - break; - } - } - if (launcherPid == null) { - System.out.println(tr); - throw new RuntimeException("Error: failed to find launcher Pid in launcher tracking info"); - } - - // did we create the env var with the correct pid? - if (!launcherPid.equals(envVarPid)) { - System.out.println(tr); - System.out.println("Error: wrong pid in creating env var"); - System.out.println("Error Info: launcherPid = " + launcherPid); - System.out.println("Error Info: envVarPid = " + envVarPid); - throw new RuntimeException("Error: wrong pid in creating env var"); - } - } - - - // --- Test 1b - if (!tr.contains("NativeMemoryTracking: got value " + NMT_Option_Value)) { - System.out.println(tr); - throw new RuntimeException("Error: Valid param failed to set env variable"); - } - - // --- Test 2 - tr = doExec(envMap,javaCmd, "-XX:NativeMemoryTracking=", - "-version"); - if (tr.contains("NativeMemoryTracking:")) { - System.out.println(tr); - throw new RuntimeException("Error: invalid param caused env variable to be erroneously created"); - } - if (!tr.contains("Syntax error, expecting -XX:NativeMemoryTracking=")) { - System.out.println(tr); - throw new RuntimeException("Error: invalid param not checked by JVM"); - } - - // --- Test 3 - tr = doExec(envMap,javaCmd, "-XX:NativeMemoryTracking", - "-version"); - if (tr.contains("NativeMemoryTracking:")) { - System.out.println(tr); - throw new RuntimeException("Error: invalid param caused env variable to be erroneously created"); - } - if (!tr.contains("Syntax error, expecting -XX:NativeMemoryTracking=")) { - System.out.println(tr); - throw new RuntimeException("Error: invalid param not checked by JVM"); - } - // --- Test 4 - tr = doExec(envMap,javaCmd, "-XX:NativeMemoryTracking=BADVALUE", - "-version"); - if (!tr.contains("expecting -XX:NativeMemoryTracking")) { - System.out.println(tr); - throw new RuntimeException("Error: invalid param did not get JVM Syntax error message"); - } - - } // NativeMemoryTracking - - // MacOSX specific tests ensue...... - if (!isMacOSX) + if (!isMacOSX) { return; + } Set envToRemove = new HashSet<>(); Map map = System.getenv(); for (String s : map.keySet()) { @@ -225,11 +101,187 @@ "APP_ICON_*", "TestAppIcon"); } - static void runTest(Set envToRemove, String... args) { + void runTest(Set envToRemove, String... args) { TestResult tr = doExec(null, envToRemove, args); if (!tr.isOK()) { System.err.println(tr.toString()); throw new RuntimeException("Test Fails"); } } + + @Test + void testNativeMemoryTracking() { + final Map envMap = new HashMap<>(); + envMap.put("_JAVA_LAUNCHER_DEBUG", "true"); + TestResult tr; + /* + * test argument : -XX:NativeMemoryTracking=value + * A JVM flag, comsumed by the JVM, but requiring launcher + * to set an environmental variable if and only if value is supplied. + * Test and order: + * 1) execute with valid parameter: -XX:NativeMemoryTracking=MyValue + * a) check for correct env variable name: "NMT_LEVEL_" + pid + * b) check that "MyValue" was found in local env. + * 2) execute with invalid parameter: -XX:NativeMemoryTracking= + * !) Won't find "NativeMemoryTracking:" + * Code to create env variable not executed. + * 3) execute with invalid parameter: -XX:NativeMemoryTracking + * !) Won't find "NativeMemoryTracking:" + * Code to create env variable not executed. + * 4) give and invalid value and check to make sure JVM commented + */ + String launcherPidString = "launcher.pid="; + String envVarPidString = "TRACER_MARKER: NativeMemoryTracking: env var is NMT_LEVEL_"; + String NMT_Option_Value = "off"; + String myClassName = "helloworld"; + boolean haveLauncherPid = false; + + // === Run the tests === + // ---Test 1a + tr = doExec(envMap, javaCmd, "-XX:NativeMemoryTracking=" + NMT_Option_Value, + "-version"); + + // get the PID from the env var we set for the JVM + String envVarPid = null; + for (String line : tr.testOutput) { + if (line.contains(envVarPidString)) { + int sindex = envVarPidString.length(); + envVarPid = line.substring(sindex); + break; + } + } + // did we find envVarPid? + if (envVarPid == null) { + System.out.println(tr); + throw new RuntimeException("Error: failed to find env Var Pid in tracking info"); + } + // we think we found the pid string. min test, not "". + if (envVarPid.length() < 1) { + System.out.println(tr); + throw new RuntimeException("Error: env Var Pid in tracking info is empty string"); + } + + /* + * On Linux, Launcher Tracking will print the PID. Use this info + * to validate what we got as the PID in the Launcher itself. + * Linux is the only one that prints this, and trying to get it + * here for win is awful. So let the linux test make sure we get + * the valid pid, and for non-linux, just make sure pid string is + * non-zero. + */ + if (isLinux) { + // get what the test says is the launcher pid + String launcherPid = null; + for (String line : tr.testOutput) { + int index = line.indexOf(launcherPidString); + if (index >= 0) { + int sindex = index + launcherPidString.length(); + int tindex = sindex + line.substring(sindex).indexOf("'"); + System.out.println("DEBUG INFO: sindex = " + sindex); + System.out.println("DEBUG INFO: searching substring: " + line.substring(sindex)); + System.out.println("DEBUG INFO: tindex = " + tindex); + // DEBUG INFO + System.out.println(tr); + launcherPid = line.substring(sindex, tindex); + break; + } + } + if (launcherPid == null) { + System.out.println(tr); + throw new RuntimeException("Error: failed to find launcher Pid in launcher tracking info"); + } + + // did we create the env var with the correct pid? + if (!launcherPid.equals(envVarPid)) { + System.out.println(tr); + System.out.println("Error: wrong pid in creating env var"); + System.out.println("Error Info: launcherPid = " + launcherPid); + System.out.println("Error Info: envVarPid = " + envVarPid); + throw new RuntimeException("Error: wrong pid in creating env var"); + } + } + + // --- Test 1b + if (!tr.contains("NativeMemoryTracking: got value " + NMT_Option_Value)) { + System.out.println(tr); + throw new RuntimeException("Error: Valid param failed to set env variable"); + } + + // --- Test 2 + tr = doExec(envMap, javaCmd, "-XX:NativeMemoryTracking=", + "-version"); + if (tr.contains("NativeMemoryTracking:")) { + System.out.println(tr); + throw new RuntimeException("Error: invalid param caused env variable to be erroneously created"); + } + if (!tr.contains("Syntax error, expecting -XX:NativeMemoryTracking=")) { + System.out.println(tr); + throw new RuntimeException("Error: invalid param not checked by JVM"); + } + + // --- Test 3 + tr = doExec(envMap, javaCmd, "-XX:NativeMemoryTracking", + "-version"); + if (tr.contains("NativeMemoryTracking:")) { + System.out.println(tr); + throw new RuntimeException("Error: invalid param caused env variable to be erroneously created"); + } + if (!tr.contains("Syntax error, expecting -XX:NativeMemoryTracking=")) { + System.out.println(tr); + throw new RuntimeException("Error: invalid param not checked by JVM"); + } + // --- Test 4 + tr = doExec(envMap, javaCmd, "-XX:NativeMemoryTracking=BADVALUE", + "-version"); + if (!tr.contains("expecting -XX:NativeMemoryTracking")) { + System.out.println(tr); + throw new RuntimeException("Error: invalid param did not get JVM Syntax error message"); + } + } + + @Test + void testNMArgumentProcessing() throws FileNotFoundException { + TestResult tr = null; + // the direct invokers of the VM + String options[] = { + "-version", "-fullversion", "-help", "-?", "-X" + }; + for (String option : options) { + tr = doExec(javaCmd, option, "-XX:NativeMemoryTracking=summary"); + checkTestResult(tr); + } + + // create a test jar + File jarFile = new File("test.jar"); + createJar(jarFile, "public static void main(String... args){}"); + + // ones that involve main-class of some sort + tr = doExec(javaCmd, "-jar", jarFile.getName(), + "-XX:NativeMemoryTracking=summary"); + checkTestResult(tr); + + tr = doExec(javaCmd, "-cp", jarFile.getName(), "Foo", + "-XX:NativeMemoryTracking=summary"); + checkTestResult(tr); + + final Map envMap = new HashMap<>(); + // checkwith CLASSPATH set ie. no -cp or -classpath + envMap.put("CLASSPATH", "."); + tr = doExec(envMap, javaCmd, "Foo", "-XX:NativeMemoryTracking=summary"); + checkTestResult(tr); + + // make sure a missing class is handled correctly, because the class + // resolution is performed by the JVM. + tr = doExec(javaCmd, "AbsentClass", "-XX:NativeMemoryTracking=summary"); + if (!tr.contains("Error: Could not find or load main class AbsentClass")) { + throw new RuntimeException("Test Fails"); + } + } + + void checkTestResult(TestResult tr) { + if (!tr.isOK()) { + System.err.println(tr.toString()); + throw new RuntimeException("Test Fails"); + } + } } diff -r 54c7d4e5261f -r d4bd9341ded3 jdk/test/tools/pack200/pack200-verifier/src/xmlkit/XMLKit.java --- a/jdk/test/tools/pack200/pack200-verifier/src/xmlkit/XMLKit.java Fri Feb 27 12:48:06 2015 -0500 +++ b/jdk/test/tools/pack200/pack200-verifier/src/xmlkit/XMLKit.java Mon Mar 02 05:32:01 2015 -0800 @@ -739,7 +739,7 @@ if (i >= size) { badIndex(i); } - e.getClass(); // null check + Objects.requireNonNull(e); checkNotFrozen(); Object old = parts[i]; setRaw(i, e); @@ -861,7 +861,7 @@ public void add(int i, Object e) { // (The shape of this method is tweaked for common cases.) - e.getClass(); // force a null check on e + Objects.requireNonNull(e); if (hasNulls(1 + NEED_SLOP)) { // Common case: Have some slop space. if (i == size) { @@ -2943,7 +2943,7 @@ } public static Filter elementFilter(final Collection nameSet) { - nameSet.getClass(); // null check + Objects.requireNonNull(nameSet); return new ElementFilter() { @Override @@ -3299,7 +3299,7 @@ } public static Filter replaceInTree(Filter f) { - f.getClass(); // null check + Objects.requireNonNull(f); return replaceInTree(f, null); } diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/.hgtags --- a/langtools/.hgtags Fri Feb 27 12:48:06 2015 -0500 +++ b/langtools/.hgtags Mon Mar 02 05:32:01 2015 -0800 @@ -294,3 +294,4 @@ 15c79f28e30a1be561abe0d67674232ad5034d32 jdk9-b49 1ccb6ef2f40bf9961b27adac390a6fc5181aa1fc jdk9-b50 7c44d9a33bbea75f5d91625df9bbccea360aea2a jdk9-b51 +ee20efe0255d7ac6e06e88e06f7c72f6c6da7bf9 jdk9-b52 diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java Fri Feb 27 12:48:06 2015 -0500 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java Mon Mar 02 05:32:01 2015 -0800 @@ -798,6 +798,10 @@ prependSubScope(new FilterImportScope(types, origin, null, filter, staticImport)); } + public boolean isFilled() { + return subScopes.nonEmpty(); + } + } public interface ImportFilter { diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java Fri Feb 27 12:48:06 2015 -0500 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java Mon Mar 02 05:32:01 2015 -0800 @@ -477,6 +477,14 @@ && (tsym.flags() & COMPOUND) != 0; } + public boolean isIntersection() { + return false; + } + + public boolean isUnion() { + return false; + } + public boolean isInterface() { return (tsym.flags() & INTERFACE) != 0; } @@ -1079,6 +1087,11 @@ return Collections.unmodifiableList(alternatives_field); } + @Override + public boolean isUnion() { + return true; + } + @Override @DefinedBy(Api.LANGUAGE_MODEL) public TypeKind getKind() { return TypeKind.UNION; @@ -1125,6 +1138,11 @@ return interfaces_field.prepend(supertype_field); } + @Override + public boolean isIntersection() { + return true; + } + public List getExplicitComponents() { return allInterfaces ? interfaces_field : diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java Fri Feb 27 12:48:06 2015 -0500 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java Mon Mar 02 05:32:01 2015 -0800 @@ -1402,8 +1402,7 @@ return isSameWildcard(t, s) || isCaptureOf(s, t) || ((t.isExtendsBound() || isSubtypeNoCapture(wildLowerBound(t), wildLowerBound(s))) && - // TODO: JDK-8039214, cvarUpperBound call here is incorrect - (t.isSuperBound() || isSubtypeNoCapture(cvarUpperBound(wildUpperBound(s)), wildUpperBound(t)))); + (t.isSuperBound() || isSubtypeNoCapture(wildUpperBound(s), wildUpperBound(t)))); } } @@ -1517,8 +1516,8 @@ } } - if (t.isCompound() || s.isCompound()) { - return !t.isCompound() ? + if (t.isIntersection() || s.isIntersection()) { + return !t.isIntersection() ? visitIntersectionType((IntersectionClassType)s, t, true) : visitIntersectionType((IntersectionClassType)t, s, false); } @@ -2246,19 +2245,28 @@ } // - // + // /** - * Make a compound type from non-empty list of types. The list should be - * ordered according to {@link Symbol#precedes(TypeSymbol,Types)}. + * Make an intersection type from non-empty list of types. The list should be ordered according to + * {@link TypeSymbol#precedes(TypeSymbol, Types)}. Note that this might cause a symbol completion. + * Hence, this version of makeIntersectionType may not be called during a classfile read. * - * @param bounds the types from which the compound type is formed - * @param supertype is objectType if all bounds are interfaces, - * null otherwise. + * @param bounds the types from which the intersection type is formed */ - public Type makeCompoundType(List bounds) { - return makeCompoundType(bounds, bounds.head.tsym.isInterface()); + public IntersectionClassType makeIntersectionType(List bounds) { + return makeIntersectionType(bounds, bounds.head.tsym.isInterface()); } - public Type makeCompoundType(List bounds, boolean allInterfaces) { + + /** + * Make an intersection type from non-empty list of types. The list should be ordered according to + * {@link TypeSymbol#precedes(TypeSymbol, Types)}. This does not cause symbol completion as + * an extra parameter indicates as to whether all bounds are interfaces - in which case the + * supertype is implicitly assumed to be 'Object'. + * + * @param bounds the types from which the intersection type is formed + * @param allInterfaces are all bounds interface types? + */ + public IntersectionClassType makeIntersectionType(List bounds, boolean allInterfaces) { Assert.check(bounds.nonEmpty()); Type firstExplicitBound = bounds.head; if (allInterfaces) { @@ -2271,23 +2279,13 @@ : names.empty, null, syms.noSymbol); - bc.type = new IntersectionClassType(bounds, bc, allInterfaces); + IntersectionClassType intersectionType = new IntersectionClassType(bounds, bc, allInterfaces); + bc.type = intersectionType; bc.erasure_field = (bounds.head.hasTag(TYPEVAR)) ? syms.objectType : // error condition, recover erasure(firstExplicitBound); bc.members_field = WriteableScope.create(bc); - return bc.type; - } - - /** - * A convenience wrapper for {@link #makeCompoundType(List)}; the - * arguments are converted to a list and passed to the other - * method. Note that this might cause a symbol completion. - * Hence, this version of makeCompoundType may not be called - * during a classfile read. - */ - public Type makeCompoundType(Type bound1, Type bound2) { - return makeCompoundType(List.of(bound1, bound2)); + return intersectionType; } // @@ -2427,7 +2425,7 @@ private final UnaryVisitor> directSupertypes = new UnaryVisitor>() { public List visitType(final Type type, final Void ignored) { - if (!type.isCompound()) { + if (!type.isIntersection()) { final Type sup = supertype(type); return (sup == Type.noType || sup == type || sup == null) ? interfaces(type) @@ -2481,30 +2479,32 @@ // /** - * Set the bounds field of the given type variable to reflect a - * (possibly multiple) list of bounds. - * @param t a type variable - * @param bounds the bounds, must be nonempty - * @param supertype is objectType if all bounds are interfaces, - * null otherwise. + * Same as {@link Types#setBounds(TypeVar, List, boolean)}, except that third parameter is computed directly, + * as follows: if all all bounds are interface types, the computed supertype is Object,otherwise + * the supertype is simply left null (in this case, the supertype is assumed to be the head of + * the bound list passed as second argument). Note that this check might cause a symbol completion. + * Hence, this version of setBounds may not be called during a classfile read. + * + * @param t a type variable + * @param bounds the bounds, must be nonempty */ public void setBounds(TypeVar t, List bounds) { setBounds(t, bounds, bounds.head.tsym.isInterface()); } /** - * Same as {@link #setBounds(Type.TypeVar,List,Type)}, except that - * third parameter is computed directly, as follows: if all - * all bounds are interface types, the computed supertype is Object, - * otherwise the supertype is simply left null (in this case, the supertype - * is assumed to be the head of the bound list passed as second argument). - * Note that this check might cause a symbol completion. Hence, this version of - * setBounds may not be called during a classfile read. + * Set the bounds field of the given type variable to reflect a (possibly multiple) list of bounds. + * This does not cause symbol completion as an extra parameter indicates as to whether all bounds + * are interfaces - in which case the supertype is implicitly assumed to be 'Object'. + * + * @param t a type variable + * @param bounds the bounds, must be nonempty + * @param allInterfaces are all bounds interface types? */ public void setBounds(TypeVar t, List bounds, boolean allInterfaces) { t.bound = bounds.tail.isEmpty() ? bounds.head : - makeCompoundType(bounds, allInterfaces); + makeIntersectionType(bounds, allInterfaces); t.rank_field = -1; } // @@ -3036,7 +3036,7 @@ if (st == supertype(t) && is == interfaces(t)) return t; else - return makeCompoundType(is.prepend(st)); + return makeIntersectionType(is.prepend(st)); } } @@ -3545,7 +3545,7 @@ else if (compound.tail.isEmpty()) return compound.head; else - return makeCompoundType(compound); + return makeIntersectionType(compound); } /** @@ -3723,8 +3723,8 @@ synchronized (this) { if (arraySuperType == null) { // JLS 10.8: all arrays implement Cloneable and Serializable. - arraySuperType = makeCompoundType(List.of(syms.serializableType, - syms.cloneableType), true); + arraySuperType = makeIntersectionType(List.of(syms.serializableType, + syms.cloneableType), true); } } } @@ -3790,7 +3790,7 @@ return glbFlattened(union(bounds, lowers), errT); } } - return makeCompoundType(bounds); + return makeIntersectionType(bounds); } // diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Fri Feb 27 12:48:06 2015 -0500 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Mon Mar 02 05:32:01 2015 -0800 @@ -2355,7 +2355,7 @@ @Override public Type visitClassType(ClassType t, DiagnosticPosition pos) { - return t.isCompound() ? + return t.isIntersection() ? visitIntersectionClassType((IntersectionClassType)t, pos) : t; } @@ -2386,8 +2386,7 @@ } supertypes.append(i.tsym.type); } - IntersectionClassType notionalIntf = - (IntersectionClassType)types.makeCompoundType(supertypes.toList()); + IntersectionClassType notionalIntf = types.makeIntersectionType(supertypes.toList()); notionalIntf.allparams_field = targs.toList(); notionalIntf.tsym.flags_field |= INTERFACE; return notionalIntf.tsym; @@ -3947,7 +3946,7 @@ } else if (bounds.length() == 1) { return bounds.head.type; } else { - Type owntype = types.makeCompoundType(TreeInfo.types(bounds)); + Type owntype = types.makeIntersectionType(TreeInfo.types(bounds)); // ... the variable's bound is a class type flagged COMPOUND // (see comment for TypeVar.bound). // In this case, generate a class tree that represents the diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Fri Feb 27 12:48:06 2015 -0500 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Mon Mar 02 05:32:01 2015 -0800 @@ -3528,7 +3528,7 @@ for (Symbol sym : tsym.members().getSymbolsByName(name)) { if (sym.isStatic() && - staticImportAccessible(sym, packge) && + importAccessible(sym, packge) && sym.isMemberOf(origin, types)) { return true; } @@ -3538,17 +3538,23 @@ } // is the sym accessible everywhere in packge? - public boolean staticImportAccessible(Symbol sym, PackageSymbol packge) { - int flags = (int)(sym.flags() & AccessFlags); - switch (flags) { - default: - case PUBLIC: - return true; - case PRIVATE: + public boolean importAccessible(Symbol sym, PackageSymbol packge) { + try { + int flags = (int)(sym.flags() & AccessFlags); + switch (flags) { + default: + case PUBLIC: + return true; + case PRIVATE: + return false; + case 0: + case PROTECTED: + return sym.packge() == packge; + } + } catch (ClassFinder.BadClassFile err) { + throw err; + } catch (CompletionFailure ex) { return false; - case 0: - case PROTECTED: - return sym.packge() == packge; } } diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java Fri Feb 27 12:48:06 2015 -0500 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java Mon Mar 02 05:32:01 2015 -0800 @@ -417,7 +417,7 @@ List upperBounds = uv.getBounds(InferenceBound.UPPER); if (Type.containsAny(upperBounds, vars)) { TypeSymbol fresh_tvar = new TypeVariableSymbol(Flags.SYNTHETIC, uv.qtype.tsym.name, null, uv.qtype.tsym.owner); - fresh_tvar.type = new TypeVar(fresh_tvar, types.makeCompoundType(uv.getBounds(InferenceBound.UPPER)), null); + fresh_tvar.type = new TypeVar(fresh_tvar, types.makeIntersectionType(uv.getBounds(InferenceBound.UPPER)), null); todo.append(uv); uv.inst = fresh_tvar.type; } else if (upperBounds.nonEmpty()) { @@ -670,7 +670,7 @@ if (lubResult == syms.errType || lubResult == syms.botType) { return List.nil(); } - List supertypesToCheck = lubResult.isCompound() ? + List supertypesToCheck = lubResult.isIntersection() ? ((IntersectionClassType)lubResult).getComponents() : List.of(lubResult); ListBuffer> commonSupertypes = new ListBuffer<>(); diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Fri Feb 27 12:48:06 2015 -0500 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Mon Mar 02 05:32:01 2015 -0800 @@ -1667,7 +1667,7 @@ * This class is used to store important information regarding translation of * lambda expression/method references (see subclasses). */ - private abstract class TranslationContext { + abstract class TranslationContext { /** the underlying (untranslated) tree */ final T tree; @@ -1746,7 +1746,7 @@ * and the used by the main translation routines in order to adjust references * to captured locals/members, etc. */ - private class LambdaTranslationContext extends TranslationContext { + class LambdaTranslationContext extends TranslationContext { /** variable in the enclosing context to which this lambda is assigned */ final Symbol self; @@ -2040,7 +2040,7 @@ * and the used by the main translation routines in order to adjust method * references (i.e. in case a bridge is needed) */ - private final class ReferenceTranslationContext extends TranslationContext { + final class ReferenceTranslationContext extends TranslationContext { final boolean isSuper; final Symbol sigPolySym; diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Fri Feb 27 12:48:06 2015 -0500 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Mon Mar 02 05:32:01 2015 -0800 @@ -1098,10 +1098,17 @@ DeferredType.SpeculativeCache.Entry e = dt.speculativeCache.get(deferredAttrContext.msym, deferredAttrContext.phase); if (e != null && e.speculativeTree != deferredAttr.stuckTree) { - return functionalInterfaceMostSpecific(found, req, e.speculativeTree, warn); + return functionalInterfaceMostSpecific(found, req, e.speculativeTree); } } - return super.compatible(found, req, warn); + return compatibleBySubtyping(found, req); + } + + private boolean compatibleBySubtyping(Type found, Type req) { + if (!strict && found.isPrimitive() != req.isPrimitive()) { + found = found.isPrimitive() ? types.boxedClass(found).type : types.unboxedType(found); + } + return types.isSubtypeNoCapture(found, deferredAttrContext.inferenceContext.asUndetVar(req)); } /** Whether {@code t} and {@code s} are unrelated functional interface types. */ @@ -1113,8 +1120,8 @@ } /** Parameters {@code t} and {@code s} are unrelated functional interface types. */ - private boolean functionalInterfaceMostSpecific(Type t, Type s, JCTree tree, Warner warn) { - FunctionalInterfaceMostSpecificChecker msc = new FunctionalInterfaceMostSpecificChecker(t, s, warn); + private boolean functionalInterfaceMostSpecific(Type t, Type s, JCTree tree) { + FunctionalInterfaceMostSpecificChecker msc = new FunctionalInterfaceMostSpecificChecker(t, s); msc.scan(tree); return msc.result; } @@ -1127,14 +1134,12 @@ final Type t; final Type s; - final Warner warn; boolean result; /** Parameters {@code t} and {@code s} are unrelated functional interface types. */ - FunctionalInterfaceMostSpecificChecker(Type t, Type s, Warner warn) { + FunctionalInterfaceMostSpecificChecker(Type t, Type s) { this.t = t; this.s = s; - this.warn = warn; result = true; } @@ -1172,7 +1177,7 @@ result &= (retValIsPrimitive == ret_t.isPrimitive()) && (retValIsPrimitive != ret_s.isPrimitive()); } else { - result &= MostSpecificCheckContext.super.compatible(ret_t, ret_s, warn); + result &= compatibleBySubtyping(ret_t, ret_s); } } } @@ -1195,7 +1200,7 @@ result &= false; } else if (unrelatedFunctionalInterfaces(ret_t, ret_s)) { for (JCExpression expr : lambdaResults(tree)) { - result &= functionalInterfaceMostSpecific(ret_t, ret_s, expr, warn); + result &= functionalInterfaceMostSpecific(ret_t, ret_s, expr); } } else if (ret_t.isPrimitive() != ret_s.isPrimitive()) { for (JCExpression expr : lambdaResults(tree)) { @@ -1204,7 +1209,7 @@ (retValIsPrimitive != ret_s.isPrimitive()); } } else { - result &= MostSpecificCheckContext.super.compatible(ret_t, ret_s, warn); + result &= compatibleBySubtyping(ret_t, ret_s); } } } diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java Fri Feb 27 12:48:06 2015 -0500 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java Mon Mar 02 05:32:01 2015 -0800 @@ -764,7 +764,7 @@ ? typeCast.expr : newExpression; } - if (originalTarget.isCompound()) { + if (originalTarget.isIntersection()) { Type.IntersectionClassType ict = (Type.IntersectionClassType)originalTarget; for (Type c : ict.getExplicitComponents()) { Type ec = erasure(c); diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java Fri Feb 27 12:48:06 2015 -0500 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java Mon Mar 02 05:32:01 2015 -0800 @@ -160,7 +160,7 @@ // if there remain any unimported toplevels (these must have // no classes at all), process their import statements as well. for (JCCompilationUnit tree : trees) { - if (tree.starImportScope.isEmpty()) { + if (!tree.starImportScope.isFilled()) { Env topEnv = enter.topLevelEnv(tree); finishImports(tree, () -> { completeClass.resolveImports(tree, topEnv); }); } @@ -280,12 +280,7 @@ Env env; ImportFilter staticImportFilter; - ImportFilter typeImportFilter = new ImportFilter() { - @Override - public boolean accepts(Scope origin, Symbol t) { - return t.kind == TYP; - } - }; + ImportFilter typeImportFilter; @Override protected void doRunPhase(Env env) { @@ -304,26 +299,26 @@ } private void resolveImports(JCCompilationUnit tree, Env env) { - if (!tree.starImportScope.isEmpty()) { + if (tree.starImportScope.isFilled()) { // we must have already processed this toplevel return; } ImportFilter prevStaticImportFilter = staticImportFilter; + ImportFilter prevTypeImportFilter = typeImportFilter; DiagnosticPosition prevLintPos = deferredLintHandler.immediate(); Lint prevLint = chk.setLint(lint); Env prevEnv = this.env; try { this.env = env; final PackageSymbol packge = env.toplevel.packge; - this.staticImportFilter = new ImportFilter() { - @Override - public boolean accepts(Scope origin, Symbol sym) { - return sym.isStatic() && - chk.staticImportAccessible(sym, packge) && - sym.isMemberOf((TypeSymbol) origin.owner, types); - } - }; + this.staticImportFilter = + (origin, sym) -> sym.isStatic() && + chk.importAccessible(sym, packge) && + sym.isMemberOf((TypeSymbol) origin.owner, types); + this.typeImportFilter = + (origin, sym) -> sym.kind == TYP && + chk.importAccessible(sym, packge); // Import-on-demand java.lang. importAll(tree.pos, syms.enterPackage(names.java_lang), env); @@ -340,6 +335,7 @@ chk.setLint(prevLint); deferredLintHandler.setPos(prevLintPos); this.staticImportFilter = prevStaticImportFilter; + this.typeImportFilter = prevTypeImportFilter; } } diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/ct.properties --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/ct.properties Fri Feb 27 12:48:06 2015 -0500 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/ct.properties Mon Mar 02 05:32:01 2015 -0800 @@ -687,7 +687,6 @@ sun.rmi.transport.*: proprietary compact2 sun.rmi.transport.proxy.*: proprietary compact2 sun.rmi.transport.tcp.*: proprietary compact2 -sun.security.acl.*: proprietary compact1 sun.security.action.*: proprietary compact1 sun.security.jca.*: proprietary compact1 sun.security.jgss.*: proprietary compact3 diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/legacy.properties --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/legacy.properties Fri Feb 27 12:48:06 2015 -0500 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/legacy.properties Mon Mar 02 05:32:01 2015 -0800 @@ -532,7 +532,6 @@ sun.rmi.transport = tiger legacy sun.rmi.transport.proxy = tiger legacy sun.rmi.transport.tcp = tiger legacy -sun.security.acl = tiger legacy sun.security.action = tiger legacy sun.security.jca = tiger legacy sun.security.jgss = tiger legacy diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/RootDocImpl.java --- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/RootDocImpl.java Fri Feb 27 12:48:06 2015 -0500 +++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/RootDocImpl.java Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -382,8 +382,9 @@ } public boolean isFunctionalInterface(AnnotationDesc annotationDesc) { - return annotationDesc.annotationType().qualifiedName().equals( - env.syms.functionalInterfaceType.toString()) && env.source.allowLambda(); + return env.source.allowLambda() + && annotationDesc.annotationType().qualifiedName().equals( + env.syms.functionalInterfaceType.toString()); } public boolean showTagMessages() { diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/test/tools/javac/generics/inference/CaptureLowerBound.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/generics/inference/CaptureLowerBound.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 8039214 + * @summary Capture variable as an inference variable's lower bound + * @compile CaptureLowerBound.java + */ + +public class CaptureLowerBound { + + interface I {} + static class C implements I {} + + void m(I arg) {} + + void test(C arg) { + m(arg); + } + +} diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/test/tools/javac/generics/inference/CaptureLowerBoundNeg.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/generics/inference/CaptureLowerBoundNeg.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,19 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8039214 + * @summary Capture variable as an inference variable's lower bound + * @compile/fail/ref=CaptureLowerBoundNeg.out -XDrawDiagnostics CaptureLowerBoundNeg.java + */ + +public class CaptureLowerBoundNeg { + + static class D { + void take(T arg) {} + static D make(Class c) { return new D(); } + } + + void test(Object o) { + D.make(o.getClass()).take(o); + } + +} diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/test/tools/javac/generics/inference/CaptureLowerBoundNeg.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/generics/inference/CaptureLowerBoundNeg.out Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,2 @@ +CaptureLowerBoundNeg.java:16:29: compiler.err.cant.apply.symbol: kindname.method, take, compiler.misc.type.captureof: 1, ? extends java.lang.Object, java.lang.Object, kindname.class, CaptureLowerBoundNeg.D, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, compiler.misc.type.captureof: 1, ? extends java.lang.Object)) +1 error diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/test/tools/javac/generics/inference/NestedCapture.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/generics/inference/NestedCapture.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 8039214 + * @summary Capture variable passed through multiple levels of nested inference + * @compile NestedCapture.java + */ + +abstract class NestedCapture { + interface List {} + abstract List copyOf(List lx); + abstract List filter(List lx); + + void test1(List lx) { + copyOf(filter(lx)); + } + + void test2(List lx) { + copyOf(filter(lx)); + } + +} diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/test/tools/javac/generics/inference/NestedWildcards.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/generics/inference/NestedWildcards.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 8039214 + * @summary Nested generic methods that work on wildcard-parameterized types + * @compile NestedWildcards.java + */ + +public class NestedWildcards { + + public static void test(Box b) { + foo(bar(b)); + } + private static Box foo(Box ts) { + return null; + } + public static Box bar(Box language) { + return null; + } + + interface Box {} +} diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/test/tools/javac/generics/wildcards/SubtypeCaptureLeak.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/generics/wildcards/SubtypeCaptureLeak.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 8039214 + * @summary Capture variables used for subtyping should not leak out of inference + * @compile SubtypeCaptureLeak.java + */ + +public class SubtypeCaptureLeak { + + interface Parent {} + interface Child extends Parent {} + interface Box {} + interface SubBox extends Box {} + + // applicability inference + + void m1(Parent arg) {} + + void testApplicable(Child arg) { + m1(arg); + } + + // applicability inference, nested + + void m2(Box> arg) {} + + void testApplicable(Box> arg) { + m2(arg); + } + + // most specific inference + + void m3(Parent arg) {} + void m3(Child arg) {} + + void testMostSpecific(Child arg) { + m3(arg); + } + + // most specific inference, nested + + void m4(Box> arg) {} + void m4(SubBox> arg) {} + + void testMostSpecificNested(SubBox> arg) { + m4(arg); + } + +} diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/test/tools/javac/importscope/ImportInaccessible.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/importscope/ImportInaccessible.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 8067886 + * @summary Verify that type import on demand won't put inaccessible types into the Scope + * @compile/fail/ref=ImportInaccessible.out -XDrawDiagnostics ImportInaccessible.java + */ +package p; +import p.ImportInaccessible.Nested.*; + +class ImportInaccessible { + static class Nested { + private static class Inner{} + } +} diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/test/tools/javac/importscope/ImportInaccessible.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/importscope/ImportInaccessible.out Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,2 @@ +ImportInaccessible.java:34:35: compiler.err.cant.resolve.location: kindname.class, Inner, , , (compiler.misc.location: kindname.class, p.ImportInaccessible, null) +1 error diff -r 54c7d4e5261f -r d4bd9341ded3 langtools/test/tools/javac/multicatch/8071291/T8071291.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/multicatch/8071291/T8071291.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8071291 + * @summary Compiler crashes trying to cast UnionType to IntersectionClassType + * @compile T8071291.java + */ + +class T8071291 { + + interface A { } + class Exception1 extends Exception implements A { } + class Exception2 extends Exception implements A { } + + void test(boolean cond) { + try { + if (cond) { + throw new Exception1(); + } else { + throw new Exception2(); + } + } + catch (Exception1|Exception2 x) { + if (x instanceof Exception1) { } + } + } +} diff -r 54c7d4e5261f -r d4bd9341ded3 make/MakeHelpers.gmk --- a/make/MakeHelpers.gmk Fri Feb 27 12:48:06 2015 -0500 +++ b/make/MakeHelpers.gmk Mon Mar 02 05:32:01 2015 -0800 @@ -382,7 +382,7 @@ && $(MAKE) $(MAKE_ARGS) \ -f $$($1_FILE_PREFIX)-$2.gmk \ $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \ - $$(addsuffix /$3, $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \ + $$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \ MODULE=$2) endif diff -r 54c7d4e5261f -r d4bd9341ded3 make/common/CORE_PKGS.gmk --- a/make/common/CORE_PKGS.gmk Fri Feb 27 12:48:06 2015 -0500 +++ b/make/common/CORE_PKGS.gmk Mon Mar 02 05:32:01 2015 -0800 @@ -103,6 +103,7 @@ java.lang.reflect \ java.math \ java.net \ + java.net.spi \ java.nio \ java.nio.channels \ java.nio.channels.spi \ diff -r 54c7d4e5261f -r d4bd9341ded3 make/jprt.properties --- a/make/jprt.properties Fri Feb 27 12:48:06 2015 -0500 +++ b/make/jprt.properties Mon Mar 02 05:32:01 2015 -0800 @@ -1,5 +1,5 @@ # -# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -86,7 +86,8 @@ --with-output-sync=recurse \ --with-boot-jdk=$ALT_BOOTDIR \ --with-jobs=$ALT_PARALLEL_COMPILE_JOBS \ - ${my.additional.build.configure.args.${jprt.test.set}} + ${my.additional.build.configure.args.${jprt.test.set}} \ + ${my.custom.build.configure.args} # i586 is often cross-compiled from 64-bit machines, so need to set target bits explicitly jprt.i586.build.configure.args= \ diff -r 54c7d4e5261f -r d4bd9341ded3 nashorn/.hgtags --- a/nashorn/.hgtags Fri Feb 27 12:48:06 2015 -0500 +++ b/nashorn/.hgtags Mon Mar 02 05:32:01 2015 -0800 @@ -285,3 +285,4 @@ 2ae58b5f05f803a469f0f6c1ed72c6b5313f4ff0 jdk9-b49 32e48a0d59e186df8a041e1e5f8bfb0b8d2bc4cd jdk9-b50 10b32cc48ccc2592621b28558a1cf70a0ce22fe5 jdk9-b51 +fada76c29db9c792ad7127e674ef5337e15d2225 jdk9-b52 diff -r 54c7d4e5261f -r d4bd9341ded3 nashorn/make/BuildNashorn.gmk --- a/nashorn/make/BuildNashorn.gmk Fri Feb 27 12:48:06 2015 -0500 +++ b/nashorn/make/BuildNashorn.gmk Mon Mar 02 05:32:01 2015 -0800 @@ -44,11 +44,11 @@ endif endif -# Need to use source and target 7 for nasgen to work. +# Need to use source and target 8 for nasgen to work. $(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE_DEBUG, \ JVM := $(JAVA), \ JAVAC := $(NEW_JAVAC), \ - FLAGS := -g -source 7 -target 7 -bootclasspath "$(JDK_CLASSES)", \ + FLAGS := -g -source 8 -target 8 -bootclasspath "$(JDK_CLASSES)", \ SERVER_DIR := $(SJAVAC_SERVER_DIR), \ SERVER_JVM := $(SJAVAC_SERVER_JAVA))) diff -r 54c7d4e5261f -r d4bd9341ded3 nashorn/make/nbproject/project.xml --- a/nashorn/make/nbproject/project.xml Fri Feb 27 12:48:06 2015 -0500 +++ b/nashorn/make/nbproject/project.xml Mon Mar 02 05:32:01 2015 -0800 @@ -160,16 +160,16 @@ ../test/src ../test/lib/testng.jar:../build/classes:../src/jdk.scripting.nashorn/share/classes - 1.7 + 1.8 ../buildtools/nasgen/src ../build/classes:../src - 1.7 + 1.8 ../src/jdk.scripting.nashorn/share/classes - 1.7 + 1.8 diff -r 54c7d4e5261f -r d4bd9341ded3 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/DefaultValueImpl.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/DefaultValueImpl.java Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.nashorn.api.scripting; + +import jdk.nashorn.internal.runtime.JSType; + +/** + * Default implementation of {@link JSObject#getDefaultValue(Class)}. Isolated into a separate class mostly so + * that we can have private static instances of function name arrays, something we couldn't declare without it + * being visible in {@link JSObject} interface. + */ +class DefaultValueImpl { + private static final String[] DEFAULT_VALUE_FNS_NUMBER = new String[] { "valueOf", "toString" }; + private static final String[] DEFAULT_VALUE_FNS_STRING = new String[] { "toString", "valueOf" }; + + static Object getDefaultValue(final JSObject jsobj, final Class hint) throws UnsupportedOperationException { + final boolean isNumber = hint == null || hint == Number.class; + for(final String methodName: isNumber ? DEFAULT_VALUE_FNS_NUMBER : DEFAULT_VALUE_FNS_STRING) { + final Object objMember = jsobj.getMember(methodName); + if (objMember instanceof JSObject) { + final JSObject member = (JSObject)objMember; + if (member.isFunction()) { + final Object value = member.call(jsobj); + if (JSType.isPrimitive(value)) { + return value; + } + } + } + } + throw new UnsupportedOperationException(isNumber ? "cannot.get.default.number" : "cannot.get.default.string"); + } +} diff -r 54c7d4e5261f -r d4bd9341ded3 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/JSObject.java --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/JSObject.java Fri Feb 27 12:48:06 2015 -0500 +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/JSObject.java Mon Mar 02 05:32:01 2015 -0800 @@ -27,6 +27,7 @@ import java.util.Collection; import java.util.Set; +import jdk.nashorn.internal.runtime.JSType; /** * This interface can be implemented by an arbitrary Java class. Nashorn will @@ -186,6 +187,22 @@ * Returns this object's numeric value. * * @return this object's numeric value. + * @deprecated use {@link #getDefaultValue(Class)} with {@link Number} hint instead. */ - public double toNumber(); + @Deprecated + default double toNumber() { + return JSType.toNumber(JSType.toPrimitive(this, Number.class)); + } + + /** + * Implements this object's {@code [[DefaultValue]]} method as per ECMAScript 5.1 section 8.6.2. + * + * @param hint the type hint. Should be either {@code null}, {@code Number.class} or {@code String.class}. + * @return this object's default value. + * @throws UnsupportedOperationException if the conversion can't be performed. The engine will convert this + * exception into a JavaScript {@code TypeError}. + */ + default Object getDefaultValue(final Class hint) throws UnsupportedOperationException { + return DefaultValueImpl.getDefaultValue(this, hint); + } } diff -r 54c7d4e5261f -r d4bd9341ded3 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/ScriptObjectMirror.java --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/ScriptObjectMirror.java Fri Feb 27 12:48:06 2015 -0500 +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/ScriptObjectMirror.java Mon Mar 02 05:32:01 2015 -0800 @@ -46,6 +46,7 @@ import jdk.nashorn.internal.objects.Global; import jdk.nashorn.internal.runtime.ConsString; import jdk.nashorn.internal.runtime.Context; +import jdk.nashorn.internal.runtime.ECMAException; import jdk.nashorn.internal.runtime.JSType; import jdk.nashorn.internal.runtime.ScriptFunction; import jdk.nashorn.internal.runtime.ScriptObject; @@ -820,4 +821,21 @@ } }); } + + @Override + public Object getDefaultValue(Class hint) { + return inGlobal(new Callable() { + @Override public Object call() { + try { + return sobj.getDefaultValue(hint); + } catch (final ECMAException e) { + // We're catching ECMAException (likely TypeError), and translating it to + // UnsupportedOperationException. This in turn will be translated into TypeError of the + // caller's Global by JSType#toPrimitive(JSObject,Class) therefore ensuring that it's + // recognized as "instanceof TypeError" in the caller. + throw new UnsupportedOperationException(e.getMessage(), e); + } + } + }); + } } diff -r 54c7d4e5261f -r d4bd9341ded3 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AstDeserializer.java --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AstDeserializer.java Fri Feb 27 12:48:06 2015 -0500 +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AstDeserializer.java Mon Mar 02 05:32:01 2015 -0800 @@ -38,7 +38,6 @@ */ final class AstDeserializer { static FunctionNode deserialize(final byte[] serializedAst) { - // FIXME: do we need this doPrivileged block at all? return AccessController.doPrivileged(new PrivilegedAction() { @Override public FunctionNode run() { diff -r 54c7d4e5261f -r d4bd9341ded3 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java Fri Feb 27 12:48:06 2015 -0500 +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java Mon Mar 02 05:32:01 2015 -0800 @@ -29,6 +29,7 @@ import static jdk.nashorn.internal.codegen.ObjectClassGenerator.OBJECT_FIELDS_ONLY; import static jdk.nashorn.internal.lookup.Lookup.MH; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; + import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.reflect.Array; @@ -210,7 +211,6 @@ /** Method handle for void returns. */ public static final Call VOID_RETURN = staticCall(JSTYPE_LOOKUP, JSType.class, "voidReturn", void.class); - /** * The list of available accessor types in width order. This order is used for type guesses narrow{@literal ->} wide * in the dual--fields world @@ -480,17 +480,47 @@ * @return the primitive form of the object */ public static Object toPrimitive(final Object obj, final Class hint) { - return obj instanceof ScriptObject ? toPrimitive((ScriptObject)obj, hint) : obj; + if (obj instanceof ScriptObject) { + return toPrimitive((ScriptObject)obj, hint); + } else if (isPrimitive(obj)) { + return obj; + } else if (obj instanceof JSObject) { + return toPrimitive((JSObject)obj, hint); + } else if (obj instanceof StaticClass) { + final String name = ((StaticClass)obj).getRepresentedClass().getName(); + return new StringBuilder(12 + name.length()).append("[JavaClass ").append(name).append(']').toString(); + } + return obj.toString(); } private static Object toPrimitive(final ScriptObject sobj, final Class hint) { - final Object result = sobj.getDefaultValue(hint); + return requirePrimitive(sobj.getDefaultValue(hint)); + } + private static Object requirePrimitive(final Object result) { if (!isPrimitive(result)) { throw typeError("bad.default.value", result.toString()); } + return result; + } - return result; + /** + * Primitive converter for a {@link JSObject} including type hint. Invokes + * {@link JSObject#getDefaultValue(Class)} and translates any thrown {@link UnsupportedOperationException} + * to a ECMAScript {@code TypeError}. + * See ECMA 9.1 ToPrimitive + * + * @param jsobj a JSObject + * @param hint a type hint + * + * @return the primitive form of the JSObject + */ + public static Object toPrimitive(final JSObject jsobj, final Class hint) { + try { + return requirePrimitive(jsobj.getDefaultValue(hint)); + } catch (final UnsupportedOperationException e) { + throw new ECMAException(Context.getGlobal().newTypeError(e.getMessage()), e); + } } /** @@ -725,6 +755,18 @@ /** + * JavaScript compliant conversion of Boolean to number + * See ECMA 9.3 ToNumber + * + * @param b a boolean + * + * @return JS numeric value of the boolean: 1.0 or 0.0 + */ + public static double toNumber(final Boolean b) { + return b ? 1d : +0d; + } + + /** * JavaScript compliant conversion of Object to number * See ECMA 9.3 ToNumber * @@ -1301,6 +1343,10 @@ return (String)obj; } + if (obj instanceof ConsString) { + return obj.toString(); + } + if (obj instanceof Number) { return toString(((Number)obj).doubleValue()); } @@ -1313,23 +1359,19 @@ return "null"; } - if (obj instanceof ScriptObject) { - if (safe) { - final ScriptObject sobj = (ScriptObject)obj; - final Global gobj = Context.getGlobal(); - return gobj.isError(sobj) ? - ECMAException.safeToString(sobj) : - sobj.safeToString(); - } - - return toString(toPrimitive(obj, String.class)); + if (obj instanceof Boolean) { + return obj.toString(); } - if (obj instanceof StaticClass) { - return "[JavaClass " + ((StaticClass)obj).getRepresentedClass().getName() + "]"; + if (safe && obj instanceof ScriptObject) { + final ScriptObject sobj = (ScriptObject)obj; + final Global gobj = Context.getGlobal(); + return gobj.isError(sobj) ? + ECMAException.safeToString(sobj) : + sobj.safeToString(); } - return obj.toString(); + return toString(toPrimitive(obj, String.class)); } // trim from left for JS whitespaces. @@ -1822,18 +1864,18 @@ } if (obj instanceof Boolean) { - return (Boolean)obj ? 1 : +0.0; + return toNumber((Boolean)obj); } if (obj instanceof ScriptObject) { return toNumber((ScriptObject)obj); } - if (obj instanceof JSObject) { - return ((JSObject)obj).toNumber(); + if (obj instanceof Undefined) { + return Double.NaN; } - return Double.NaN; + return toNumber(toPrimitive(obj, Number.class)); } private static Object invoke(final MethodHandle mh, final Object arg) { diff -r 54c7d4e5261f -r d4bd9341ded3 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptRuntime.java --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptRuntime.java Fri Feb 27 12:48:06 2015 -0500 +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptRuntime.java Mon Mar 02 05:32:01 2015 -0800 @@ -32,6 +32,7 @@ import static jdk.nashorn.internal.runtime.ECMAErrors.syntaxError; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; import static jdk.nashorn.internal.runtime.JSType.isRepresentableAsInt; + import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.SwitchPoint; @@ -720,7 +721,7 @@ return true; } if (x instanceof ScriptObject && y instanceof ScriptObject) { - return x == y; + return false; // x != y } if (x instanceof ScriptObjectMirror || y instanceof ScriptObjectMirror) { return ScriptObjectMirror.identical(x, y); @@ -784,37 +785,55 @@ * @return true if they're equal */ private static boolean equalDifferentTypeValues(final Object x, final Object y, final JSType xType, final JSType yType) { - if (xType == JSType.UNDEFINED && yType == JSType.NULL || xType == JSType.NULL && yType == JSType.UNDEFINED) { + if (isUndefinedAndNull(xType, yType) || isUndefinedAndNull(yType, xType)) { return true; - } - - if (xType == JSType.NUMBER && yType == JSType.STRING) { - return equals(x, JSType.toNumber(y)); - } - - if (xType == JSType.STRING && yType == JSType.NUMBER) { - return equals(JSType.toNumber(x), y); - } - - if (xType == JSType.BOOLEAN) { - return equals(JSType.toNumber(x), y); - } - - if (yType == JSType.BOOLEAN) { - return equals(x, JSType.toNumber(y)); - } - - if ((xType == JSType.STRING || xType == JSType.NUMBER) && y instanceof ScriptObject) { - return equals(x, JSType.toPrimitive(y)); - } - - if (x instanceof ScriptObject && (yType == JSType.STRING || yType == JSType.NUMBER)) { - return equals(JSType.toPrimitive(x), y); + } else if (isNumberAndString(xType, yType)) { + return equalNumberToString(x, y); + } else if (isNumberAndString(yType, xType)) { + // Can reverse order as both are primitives + return equalNumberToString(y, x); + } else if (xType == JSType.BOOLEAN) { + return equalBooleanToAny(x, y); + } else if (yType == JSType.BOOLEAN) { + // Can reverse order as y is primitive + return equalBooleanToAny(y, x); + } else if (isNumberOrStringAndObject(xType, yType)) { + return equalNumberOrStringToObject(x, y); + } else if (isNumberOrStringAndObject(yType, xType)) { + // Can reverse order as y is primitive + return equalNumberOrStringToObject(y, x); } return false; } + private static boolean isUndefinedAndNull(final JSType xType, final JSType yType) { + return xType == JSType.UNDEFINED && yType == JSType.NULL; + } + + private static boolean isNumberAndString(final JSType xType, final JSType yType) { + return xType == JSType.NUMBER && yType == JSType.STRING; + } + + private static boolean isNumberOrStringAndObject(final JSType xType, final JSType yType) { + return (xType == JSType.NUMBER || xType == JSType.STRING) && yType == JSType.OBJECT; + } + + private static boolean equalNumberToString(final Object num, final Object str) { + // Specification says comparing a number to string should be done as "equals(num, JSType.toNumber(str))". We + // can short circuit it to this as we know that "num" is a number, so it'll end up being a number-number + // comparison. + return ((Number)num).doubleValue() == JSType.toNumber(str.toString()); + } + + private static boolean equalBooleanToAny(final Object bool, final Object any) { + return equals(JSType.toNumber((Boolean)bool), any); + } + + private static boolean equalNumberOrStringToObject(final Object numOrStr, final Object any) { + return equals(numOrStr, JSType.toPrimitive(any)); + } + /** * ECMA 11.9.4 - The strict equal operator (===) - generic implementation * diff -r 54c7d4e5261f -r d4bd9341ded3 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java Fri Feb 27 12:48:06 2015 -0500 +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java Mon Mar 02 05:32:01 2015 -0800 @@ -27,14 +27,10 @@ import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodType; -import java.util.HashMap; import java.util.Map; import javax.script.Bindings; import jdk.internal.dynalink.CallSiteDescriptor; import jdk.internal.dynalink.linker.GuardedInvocation; -import jdk.internal.dynalink.linker.GuardedTypeConversion; -import jdk.internal.dynalink.linker.GuardingTypeConverterFactory; import jdk.internal.dynalink.linker.LinkRequest; import jdk.internal.dynalink.linker.LinkerServices; import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker; @@ -49,7 +45,7 @@ * A Dynalink linker to handle web browser built-in JS (DOM etc.) objects as well * as ScriptObjects from other Nashorn contexts. */ -final class JSObjectLinker implements TypeBasedGuardingDynamicLinker, GuardingTypeConverterFactory { +final class JSObjectLinker implements TypeBasedGuardingDynamicLinker { private final NashornBeansLinker nashornBeansLinker; JSObjectLinker(final NashornBeansLinker nashornBeansLinker) { @@ -95,22 +91,6 @@ return Bootstrap.asTypeSafeReturn(inv, linkerServices, desc); } - @Override - public GuardedTypeConversion convertToType(final Class sourceType, final Class targetType) throws Exception { - final boolean sourceIsAlwaysJSObject = JSObject.class.isAssignableFrom(sourceType); - if(!sourceIsAlwaysJSObject && !sourceType.isAssignableFrom(JSObject.class)) { - return null; - } - - final MethodHandle converter = CONVERTERS.get(targetType); - if(converter == null) { - return null; - } - - return new GuardedTypeConversion(new GuardedInvocation(converter, sourceIsAlwaysJSObject ? null : IS_JSOBJECT_GUARD).asType(MethodType.methodType(targetType, sourceType)), true); - } - - private GuardedInvocation lookup(final CallSiteDescriptor desc, final LinkRequest request, final LinkerServices linkerServices) throws Exception { final String operator = CallSiteDescriptorFactory.tokenizeOperators(desc).get(0); final int c = desc.getNameTokenCount(); @@ -208,25 +188,6 @@ } } - @SuppressWarnings("unused") - private static int toInt32(final JSObject obj) { - return JSType.toInt32(toNumber(obj)); - } - - @SuppressWarnings("unused") - private static long toLong(final JSObject obj) { - return JSType.toLong(toNumber(obj)); - } - - private static double toNumber(final JSObject obj) { - return obj == null ? 0 : obj.toNumber(); - } - - @SuppressWarnings("unused") - private static boolean toBoolean(final JSObject obj) { - return obj != null; - } - private static int getIndex(final Number n) { final double value = n.doubleValue(); return JSType.isRepresentableAsInt(value) ? (int)value : -1; @@ -261,14 +222,6 @@ private static final MethodHandle JSOBJECT_CALL_TO_APPLY = findOwnMH_S("callToApply", Object.class, MethodHandle.class, JSObject.class, Object.class, Object[].class); private static final MethodHandle JSOBJECT_NEW = findJSObjectMH_V("newObject", Object.class, Object[].class); - private static final Map, MethodHandle> CONVERTERS = new HashMap<>(); - static { - CONVERTERS.put(boolean.class, findOwnMH_S("toBoolean", boolean.class, JSObject.class)); - CONVERTERS.put(int.class, findOwnMH_S("toInt32", int.class, JSObject.class)); - CONVERTERS.put(long.class, findOwnMH_S("toLong", long.class, JSObject.class)); - CONVERTERS.put(double.class, findOwnMH_S("toNumber", double.class, JSObject.class)); - } - private static MethodHandle findJSObjectMH_V(final String name, final Class rtype, final Class... types) { return MH.findVirtual(MethodHandles.lookup(), JSObject.class, name, MH.type(rtype, types)); } diff -r 54c7d4e5261f -r d4bd9341ded3 nashorn/test/script/basic/JDK-8023026.js.EXPECTED --- a/nashorn/test/script/basic/JDK-8023026.js.EXPECTED Fri Feb 27 12:48:06 2015 -0500 +++ b/nashorn/test/script/basic/JDK-8023026.js.EXPECTED Mon Mar 02 05:32:01 2015 -0800 @@ -26,7 +26,7 @@ reduceRight 15 1 right sum 16 squared 1,9,25,49 -iterating on [object Array] +iterating on 2,4,6,8 forEach 2 forEach 4 forEach 6 diff -r 54c7d4e5261f -r d4bd9341ded3 nashorn/test/script/basic/JDK-8024847.js --- a/nashorn/test/script/basic/JDK-8024847.js Fri Feb 27 12:48:06 2015 -0500 +++ b/nashorn/test/script/basic/JDK-8024847.js Mon Mar 02 05:32:01 2015 -0800 @@ -102,7 +102,18 @@ print(jlist); var obj = new JSObject() { - toNumber: function() { return 42; } + getMember: function(name) { + if (name == "valueOf") { + return new JSObject() { + isFunction: function() { + return true; + }, + call: function(thiz) { + return 42; + } + }; + } + } }; print(32 + obj); diff -r 54c7d4e5261f -r d4bd9341ded3 nashorn/test/script/basic/JDK-8072426.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/basic/JDK-8072426.js Mon Mar 02 05:32:01 2015 -0800 @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * JDK-8072426: Can't compare Java objects to strings or numbers + * + * @test + * @run + */ + +Assert.assertTrue(java.math.RoundingMode.UP == "UP"); + +var JSObject = Java.type("jdk.nashorn.api.scripting.JSObject"); + +// Adds an "isFunction" member to the JSObject that returns the specified value +function addIsFunction(isFunction, obj) { + obj.isFunction = function() { + return isFunction; + }; + return obj; +} + +function makeJSObjectConstantFunction(value) { + return new JSObject(addIsFunction(true, { + call: function() { + return value; + } + })); +} + +function makeJSObjectWithMembers(mapping) { + return new JSObject({ + getMember: function(name) { + Assert.assertTrue(mapping.hasOwnProperty(name)); + return mapping[name]; + }, + toNumber: function() { + // toNumber no longer invoked + Assert.fail(); + } + }); +} + +// Test JSObjectLinker toInt32/toLong/toNumber +function testNumericJSObject(kind, value) { + var obj = makeJSObjectWithMembers({ + valueOf: makeJSObjectConstantFunction(value) + }); + + if (kind === "double") { + // There's no assertEquals(double actual, double expected). There's only + // assertEquals(double actual, double expected, double delta). + Assert["assertEquals(double,double,double)"](value, obj, 0); + } else { + Assert["assertEquals(" + kind + ", " + kind + ")"](value, obj); + } + Assert.assertTrue(value == Number(obj)); +} +testNumericJSObject("int", 42); +testNumericJSObject("long", 4294967296); +testNumericJSObject("double", 1.2); + +// Test fallback from toNumber to toString for numeric conversion when toNumber doesn't exist +(function() { + var obj = makeJSObjectWithMembers({ + valueOf: null, // Explicitly no valueOf + toString: makeJSObjectConstantFunction("123") + }); + Assert["assertEquals(int,int)"](123, obj); +})(); + +// Test fallback from toNumber to toString for numeric conversion when toNumber isn't a callable +(function() { + var obj = makeJSObjectWithMembers({ + valueOf: new JSObject(addIsFunction(false, {})), + toString: makeJSObjectConstantFunction("124") + }); + Assert["assertEquals(int,int)"](124, obj); +})(); + +// Test fallback from toNumber to toString for numeric conversion when toNumber returns a non-primitive +(function() { + var obj = makeJSObjectWithMembers({ + valueOf: makeJSObjectConstantFunction({}), + toString: makeJSObjectConstantFunction("125") + }); + Assert["assertEquals(int,int)"](125, obj); +})(); + +// Test TypeError from toNumber to toString when both return a non-primitive +(function() { + var obj = makeJSObjectWithMembers({ + valueOf: makeJSObjectConstantFunction({}), + toString: makeJSObjectConstantFunction({}) + }); + try { + Number(obj); + Assert.fail(); // must throw + } catch(e) { + Assert.assertTrue(e instanceof TypeError); + } +})(); + +// Test toString for string conversion +(function() { + var obj = makeJSObjectWithMembers({ + toString: makeJSObjectConstantFunction("Hello") + }); + Assert.assertTrue("Hello" === String(obj)); + Assert["assertEquals(String,String)"]("Hello", obj); +})(); + +// Test fallback from toString to valueOf for string conversion when toString doesn't exist +(function() { + var obj = makeJSObjectWithMembers({ + toString: null, + valueOf: makeJSObjectConstantFunction("Hello1") + }); + Assert.assertTrue("Hello1" === String(obj)); + Assert["assertEquals(String,String)"]("Hello1", obj); +})(); + +// Test fallback from toString to valueOf for string conversion when toString is not callable +(function() { + var obj = makeJSObjectWithMembers({ + toString: new JSObject(addIsFunction(false, {})), + valueOf: makeJSObjectConstantFunction("Hello2") + }); + Assert["assertEquals(String,String)"]("Hello2", obj); +})(); + +// Test fallback from toString to valueOf for string conversion when toString returns non-primitive +(function() { + var obj = makeJSObjectWithMembers({ + toString: makeJSObjectConstantFunction({}), + valueOf: makeJSObjectConstantFunction("Hello3") + }); + Assert["assertEquals(String,String)"]("Hello3", obj); +})(); + +// Test toBoolean for JSObject +(function() { + Assert["assertEquals(boolean,boolean)"](true, new JSObject({})); +})();