Merge
This commit is contained in:
commit
c7158d2f86
@ -394,3 +394,4 @@ a22e2671d88f6b22a4aa82e3966986542ed2a381 jdk-9+146
|
|||||||
b119012d1c2ab2570fe8718633840d0c1f1f441d jdk-9+149
|
b119012d1c2ab2570fe8718633840d0c1f1f441d jdk-9+149
|
||||||
6234069ff9789f7582e1faa32cb6283cbd1a5a2d jdk-9+150
|
6234069ff9789f7582e1faa32cb6283cbd1a5a2d jdk-9+150
|
||||||
71a766d4c18041a7f833ee22823125b02e1a7f1e jdk-9+151
|
71a766d4c18041a7f833ee22823125b02e1a7f1e jdk-9+151
|
||||||
|
ef056360ddf3977d7d2ddbeb456a4d612d19ea05 jdk-9+152
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -1011,6 +1011,8 @@ AC_DEFUN([BASIC_CHECK_TAR],
|
|||||||
# Test which kind of tar was found
|
# Test which kind of tar was found
|
||||||
if test "x$($TAR --version | $GREP "GNU tar")" != "x"; then
|
if test "x$($TAR --version | $GREP "GNU tar")" != "x"; then
|
||||||
TAR_TYPE="gnu"
|
TAR_TYPE="gnu"
|
||||||
|
elif test "x$($TAR --version | $GREP "bsdtar")" != "x"; then
|
||||||
|
TAR_TYPE="bsd"
|
||||||
elif test "x$($TAR -v | $GREP "bsdtar")" != "x"; then
|
elif test "x$($TAR -v | $GREP "bsdtar")" != "x"; then
|
||||||
TAR_TYPE="bsd"
|
TAR_TYPE="bsd"
|
||||||
elif test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
|
elif test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
|
||||||
@ -1038,12 +1040,36 @@ AC_DEFUN([BASIC_CHECK_TAR],
|
|||||||
AC_SUBST(TAR_SUPPORTS_TRANSFORM)
|
AC_SUBST(TAR_SUPPORTS_TRANSFORM)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([BASIC_CHECK_GREP],
|
||||||
|
[
|
||||||
|
# Test that grep supports -Fx with a list of pattern which includes null pattern.
|
||||||
|
# This is a problem for the grep resident on AIX.
|
||||||
|
AC_MSG_CHECKING([that grep ($GREP) -Fx handles empty lines in the pattern list correctly])
|
||||||
|
# Multiple subsequent spaces..
|
||||||
|
STACK_SPACES='aaa bbb ccc'
|
||||||
|
# ..converted to subsequent newlines, causes STACK_LIST to be a list with some empty
|
||||||
|
# patterns in it.
|
||||||
|
STACK_LIST=${STACK_SPACES// /$'\n'}
|
||||||
|
NEEDLE_SPACES='ccc bbb aaa'
|
||||||
|
NEEDLE_LIST=${NEEDLE_SPACES// /$'\n'}
|
||||||
|
RESULT="$($GREP -Fvx "$STACK_LIST" <<< "$NEEDLE_LIST")"
|
||||||
|
if test "x$RESULT" == "x"; then
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
else
|
||||||
|
if test "x$OPENJDK_TARGET_OS" = "xaix"; then
|
||||||
|
ADDINFO="Please make sure you use GNU grep, usually found at /opt/freeware/bin."
|
||||||
|
fi
|
||||||
|
AC_MSG_ERROR([grep does not handle -Fx correctly. ${ADDINFO}])
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
|
AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
|
||||||
[
|
[
|
||||||
BASIC_CHECK_GNU_MAKE
|
BASIC_CHECK_GNU_MAKE
|
||||||
|
|
||||||
BASIC_CHECK_FIND_DELETE
|
BASIC_CHECK_FIND_DELETE
|
||||||
BASIC_CHECK_TAR
|
BASIC_CHECK_TAR
|
||||||
|
BASIC_CHECK_GREP
|
||||||
|
|
||||||
# These tools might not be installed by default,
|
# These tools might not be installed by default,
|
||||||
# need hint on how to install them.
|
# need hint on how to install them.
|
||||||
|
@ -68,7 +68,6 @@ LDFLAGS_JDKLIB := @OPENJDK_BUILD_LDFLAGS_JDKLIB@
|
|||||||
CFLAGS_JDKEXE := @OPENJDK_BUILD_CFLAGS_JDKEXE@
|
CFLAGS_JDKEXE := @OPENJDK_BUILD_CFLAGS_JDKEXE@
|
||||||
CXXFLAGS_JDKEXE := @OPENJDK_BUILD_CXXFLAGS_JDKEXE@
|
CXXFLAGS_JDKEXE := @OPENJDK_BUILD_CXXFLAGS_JDKEXE@
|
||||||
LDFLAGS_JDKEXE := @OPENJDK_BUILD_LDFLAGS_JDKEXE@
|
LDFLAGS_JDKEXE := @OPENJDK_BUILD_LDFLAGS_JDKEXE@
|
||||||
OPENJDK_TARGET_CPU_JLI_CFLAGS := @OPENJDK_BUILD_CPU_JLI_CFLAGS@
|
|
||||||
|
|
||||||
JVM_CFLAGS := @OPENJDK_BUILD_JVM_CFLAGS@
|
JVM_CFLAGS := @OPENJDK_BUILD_JVM_CFLAGS@
|
||||||
JVM_LDFLAGS := @OPENJDK_BUILD_JVM_LDFLAGS@
|
JVM_LDFLAGS := @OPENJDK_BUILD_JVM_LDFLAGS@
|
||||||
|
@ -815,11 +815,6 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
|
|||||||
$2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -D__solaris__"
|
$2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -D__solaris__"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
|
||||||
$2CFLAGS_JDK="${$2CFLAGS_JDK} -D__solaris__"
|
|
||||||
$2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -D__solaris__"
|
|
||||||
fi
|
|
||||||
|
|
||||||
$2CFLAGS_JDK="${$2CFLAGS_JDK} ${$2EXTRA_CFLAGS}"
|
$2CFLAGS_JDK="${$2CFLAGS_JDK} ${$2EXTRA_CFLAGS}"
|
||||||
$2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} ${$2EXTRA_CXXFLAGS}"
|
$2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} ${$2EXTRA_CXXFLAGS}"
|
||||||
$2LDFLAGS_JDK="${$2LDFLAGS_JDK} ${$2EXTRA_LDFLAGS}"
|
$2LDFLAGS_JDK="${$2LDFLAGS_JDK} ${$2EXTRA_LDFLAGS}"
|
||||||
|
@ -3564,7 +3564,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
|
|||||||
|
|
||||||
# Include these first...
|
# Include these first...
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -3731,6 +3731,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check if build directory is on local disk. If not possible to determine,
|
# Check if build directory is on local disk. If not possible to determine,
|
||||||
# we prefer to claim it's local.
|
# we prefer to claim it's local.
|
||||||
# Argument 1: directory to test
|
# Argument 1: directory to test
|
||||||
@ -4122,7 +4124,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
|
|||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -4237,6 +4239,17 @@ yum_help() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
brew_help() {
|
||||||
|
case $1 in
|
||||||
|
openjdk)
|
||||||
|
PKGHANDLER_COMMAND="brew cask install java" ;;
|
||||||
|
freetype)
|
||||||
|
PKGHANDLER_COMMAND="brew install freetype" ;;
|
||||||
|
ccache)
|
||||||
|
PKGHANDLER_COMMAND="brew install ccache" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
port_help() {
|
port_help() {
|
||||||
PKGHANDLER_COMMAND=""
|
PKGHANDLER_COMMAND=""
|
||||||
}
|
}
|
||||||
@ -4362,7 +4375,7 @@ VALID_JVM_VARIANTS="server client minimal core zero zeroshark custom"
|
|||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -4667,7 +4680,7 @@ VALID_JVM_VARIANTS="server client minimal core zero zeroshark custom"
|
|||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -5167,7 +5180,7 @@ VS_SDK_PLATFORM_NAME_2013=
|
|||||||
#CUSTOM_AUTOCONF_INCLUDE
|
#CUSTOM_AUTOCONF_INCLUDE
|
||||||
|
|
||||||
# Do not change or remove the following line, it is needed for consistency checks:
|
# Do not change or remove the following line, it is needed for consistency checks:
|
||||||
DATE_WHEN_GENERATED=1483542685
|
DATE_WHEN_GENERATED=1484571183
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
@ -17544,7 +17557,7 @@ $as_echo "$as_me: The path of OUTPUT_ROOT, which resolves as \"$path\", is inval
|
|||||||
|
|
||||||
# Must be done before we can call HELP_MSG_MISSING_DEPENDENCY.
|
# Must be done before we can call HELP_MSG_MISSING_DEPENDENCY.
|
||||||
|
|
||||||
for ac_prog in apt-get yum port pkgutil pkgadd
|
for ac_prog in apt-get yum brew port pkgutil pkgadd
|
||||||
do
|
do
|
||||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||||
set dummy $ac_prog; ac_word=$2
|
set dummy $ac_prog; ac_word=$2
|
||||||
@ -21209,6 +21222,8 @@ $as_echo "yes" >&6; }
|
|||||||
# Test which kind of tar was found
|
# Test which kind of tar was found
|
||||||
if test "x$($TAR --version | $GREP "GNU tar")" != "x"; then
|
if test "x$($TAR --version | $GREP "GNU tar")" != "x"; then
|
||||||
TAR_TYPE="gnu"
|
TAR_TYPE="gnu"
|
||||||
|
elif test "x$($TAR --version | $GREP "bsdtar")" != "x"; then
|
||||||
|
TAR_TYPE="bsd"
|
||||||
elif test "x$($TAR -v | $GREP "bsdtar")" != "x"; then
|
elif test "x$($TAR -v | $GREP "bsdtar")" != "x"; then
|
||||||
TAR_TYPE="bsd"
|
TAR_TYPE="bsd"
|
||||||
elif test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
|
elif test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
|
||||||
@ -21238,6 +21253,29 @@ $as_echo "$TAR_TYPE" >&6; }
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Test that grep supports -Fx with a list of pattern which includes null pattern.
|
||||||
|
# This is a problem for the grep resident on AIX.
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that grep ($GREP) -Fx handles empty lines in the pattern list correctly" >&5
|
||||||
|
$as_echo_n "checking that grep ($GREP) -Fx handles empty lines in the pattern list correctly... " >&6; }
|
||||||
|
# Multiple subsequent spaces..
|
||||||
|
STACK_SPACES='aaa bbb ccc'
|
||||||
|
# ..converted to subsequent newlines, causes STACK_LIST to be a list with some empty
|
||||||
|
# patterns in it.
|
||||||
|
STACK_LIST=${STACK_SPACES// /$'\n'}
|
||||||
|
NEEDLE_SPACES='ccc bbb aaa'
|
||||||
|
NEEDLE_LIST=${NEEDLE_SPACES// /$'\n'}
|
||||||
|
RESULT="$($GREP -Fvx "$STACK_LIST" <<< "$NEEDLE_LIST")"
|
||||||
|
if test "x$RESULT" == "x"; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||||
|
$as_echo "yes" >&6; }
|
||||||
|
else
|
||||||
|
if test "x$OPENJDK_TARGET_OS" = "xaix"; then
|
||||||
|
ADDINFO="Please make sure you use GNU grep, usually found at /opt/freeware/bin."
|
||||||
|
fi
|
||||||
|
as_fn_error $? "grep does not handle -Fx correctly. ${ADDINFO}" "$LINENO" 5
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# These tools might not be installed by default,
|
# These tools might not be installed by default,
|
||||||
# need hint on how to install them.
|
# need hint on how to install them.
|
||||||
|
|
||||||
@ -24359,15 +24397,13 @@ if test "${enable_keep_packaged_modules+set}" = set; then :
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if test "x$enable_keep_packaged_modules" = "xyes"; then
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if packaged modules are kept" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if packaged modules are kept" >&5
|
||||||
$as_echo_n "checking if packaged modules are kept... " >&6; }
|
$as_echo_n "checking if packaged modules are kept... " >&6; }
|
||||||
|
if test "x$enable_keep_packaged_modules" = "xyes"; then
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||||
$as_echo "yes" >&6; }
|
$as_echo "yes" >&6; }
|
||||||
JLINK_KEEP_PACKAGED_MODULES=true
|
JLINK_KEEP_PACKAGED_MODULES=true
|
||||||
elif test "x$enable_keep_packaged_modules" = "xno"; then
|
elif test "x$enable_keep_packaged_modules" = "xno"; then
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if packaged modules are kept" >&5
|
|
||||||
$as_echo_n "checking if packaged modules are kept... " >&6; }
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
$as_echo "no" >&6; }
|
$as_echo "no" >&6; }
|
||||||
JLINK_KEEP_PACKAGED_MODULES=false
|
JLINK_KEEP_PACKAGED_MODULES=false
|
||||||
@ -24376,6 +24412,8 @@ $as_echo "no" >&6; }
|
|||||||
$as_echo "yes (default)" >&6; }
|
$as_echo "yes (default)" >&6; }
|
||||||
JLINK_KEEP_PACKAGED_MODULES=true
|
JLINK_KEEP_PACKAGED_MODULES=true
|
||||||
else
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: error" >&5
|
||||||
|
$as_echo "error" >&6; }
|
||||||
as_fn_error $? "--enable-keep-packaged-modules accepts no argument" "$LINENO" 5
|
as_fn_error $? "--enable-keep-packaged-modules accepts no argument" "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -29942,6 +29980,8 @@ $as_echo "$BOOT_JDK_VERSION" >&6; }
|
|||||||
apt_help $MISSING_DEPENDENCY ;;
|
apt_help $MISSING_DEPENDENCY ;;
|
||||||
yum)
|
yum)
|
||||||
yum_help $MISSING_DEPENDENCY ;;
|
yum_help $MISSING_DEPENDENCY ;;
|
||||||
|
brew)
|
||||||
|
brew_help $MISSING_DEPENDENCY ;;
|
||||||
port)
|
port)
|
||||||
port_help $MISSING_DEPENDENCY ;;
|
port_help $MISSING_DEPENDENCY ;;
|
||||||
pkgutil)
|
pkgutil)
|
||||||
@ -33235,6 +33275,8 @@ done
|
|||||||
apt_help $MISSING_DEPENDENCY ;;
|
apt_help $MISSING_DEPENDENCY ;;
|
||||||
yum)
|
yum)
|
||||||
yum_help $MISSING_DEPENDENCY ;;
|
yum_help $MISSING_DEPENDENCY ;;
|
||||||
|
brew)
|
||||||
|
brew_help $MISSING_DEPENDENCY ;;
|
||||||
port)
|
port)
|
||||||
port_help $MISSING_DEPENDENCY ;;
|
port_help $MISSING_DEPENDENCY ;;
|
||||||
pkgutil)
|
pkgutil)
|
||||||
@ -34534,6 +34576,8 @@ done
|
|||||||
apt_help $MISSING_DEPENDENCY ;;
|
apt_help $MISSING_DEPENDENCY ;;
|
||||||
yum)
|
yum)
|
||||||
yum_help $MISSING_DEPENDENCY ;;
|
yum_help $MISSING_DEPENDENCY ;;
|
||||||
|
brew)
|
||||||
|
brew_help $MISSING_DEPENDENCY ;;
|
||||||
port)
|
port)
|
||||||
port_help $MISSING_DEPENDENCY ;;
|
port_help $MISSING_DEPENDENCY ;;
|
||||||
pkgutil)
|
pkgutil)
|
||||||
@ -48601,6 +48645,8 @@ $as_echo "$as_me: Failed to compile stdio.h. This likely implies missing compile
|
|||||||
apt_help $MISSING_DEPENDENCY ;;
|
apt_help $MISSING_DEPENDENCY ;;
|
||||||
yum)
|
yum)
|
||||||
yum_help $MISSING_DEPENDENCY ;;
|
yum_help $MISSING_DEPENDENCY ;;
|
||||||
|
brew)
|
||||||
|
brew_help $MISSING_DEPENDENCY ;;
|
||||||
port)
|
port)
|
||||||
port_help $MISSING_DEPENDENCY ;;
|
port_help $MISSING_DEPENDENCY ;;
|
||||||
pkgutil)
|
pkgutil)
|
||||||
@ -48762,6 +48808,8 @@ $as_echo "$as_me: The tested number of bits in the target ($TESTED_TARGET_CPU_BI
|
|||||||
apt_help $MISSING_DEPENDENCY ;;
|
apt_help $MISSING_DEPENDENCY ;;
|
||||||
yum)
|
yum)
|
||||||
yum_help $MISSING_DEPENDENCY ;;
|
yum_help $MISSING_DEPENDENCY ;;
|
||||||
|
brew)
|
||||||
|
brew_help $MISSING_DEPENDENCY ;;
|
||||||
port)
|
port)
|
||||||
port_help $MISSING_DEPENDENCY ;;
|
port_help $MISSING_DEPENDENCY ;;
|
||||||
pkgutil)
|
pkgutil)
|
||||||
@ -49897,11 +49945,6 @@ $as_echo "$supports" >&6; }
|
|||||||
CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
|
CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
|
||||||
CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
|
|
||||||
CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
|
|
||||||
fi
|
|
||||||
|
|
||||||
CFLAGS_JDK="${CFLAGS_JDK} ${EXTRA_CFLAGS}"
|
CFLAGS_JDK="${CFLAGS_JDK} ${EXTRA_CFLAGS}"
|
||||||
CXXFLAGS_JDK="${CXXFLAGS_JDK} ${EXTRA_CXXFLAGS}"
|
CXXFLAGS_JDK="${CXXFLAGS_JDK} ${EXTRA_CXXFLAGS}"
|
||||||
LDFLAGS_JDK="${LDFLAGS_JDK} ${EXTRA_LDFLAGS}"
|
LDFLAGS_JDK="${LDFLAGS_JDK} ${EXTRA_LDFLAGS}"
|
||||||
@ -50720,11 +50763,6 @@ $as_echo "$supports" >&6; }
|
|||||||
OPENJDK_BUILD_CXXFLAGS_JDK="${OPENJDK_BUILD_CXXFLAGS_JDK} -D__solaris__"
|
OPENJDK_BUILD_CXXFLAGS_JDK="${OPENJDK_BUILD_CXXFLAGS_JDK} -D__solaris__"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
|
||||||
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -D__solaris__"
|
|
||||||
OPENJDK_BUILD_CXXFLAGS_JDK="${OPENJDK_BUILD_CXXFLAGS_JDK} -D__solaris__"
|
|
||||||
fi
|
|
||||||
|
|
||||||
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} ${OPENJDK_BUILD_EXTRA_CFLAGS}"
|
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} ${OPENJDK_BUILD_EXTRA_CFLAGS}"
|
||||||
OPENJDK_BUILD_CXXFLAGS_JDK="${OPENJDK_BUILD_CXXFLAGS_JDK} ${OPENJDK_BUILD_EXTRA_CXXFLAGS}"
|
OPENJDK_BUILD_CXXFLAGS_JDK="${OPENJDK_BUILD_CXXFLAGS_JDK} ${OPENJDK_BUILD_EXTRA_CXXFLAGS}"
|
||||||
OPENJDK_BUILD_LDFLAGS_JDK="${OPENJDK_BUILD_LDFLAGS_JDK} ${OPENJDK_BUILD_EXTRA_LDFLAGS}"
|
OPENJDK_BUILD_LDFLAGS_JDK="${OPENJDK_BUILD_LDFLAGS_JDK} ${OPENJDK_BUILD_EXTRA_LDFLAGS}"
|
||||||
@ -52844,6 +52882,8 @@ $as_echo "no, missing dependencies" >&6; }
|
|||||||
apt_help $MISSING_DEPENDENCY ;;
|
apt_help $MISSING_DEPENDENCY ;;
|
||||||
yum)
|
yum)
|
||||||
yum_help $MISSING_DEPENDENCY ;;
|
yum_help $MISSING_DEPENDENCY ;;
|
||||||
|
brew)
|
||||||
|
brew_help $MISSING_DEPENDENCY ;;
|
||||||
port)
|
port)
|
||||||
port_help $MISSING_DEPENDENCY ;;
|
port_help $MISSING_DEPENDENCY ;;
|
||||||
pkgutil)
|
pkgutil)
|
||||||
@ -56649,6 +56689,8 @@ fi
|
|||||||
apt_help $MISSING_DEPENDENCY ;;
|
apt_help $MISSING_DEPENDENCY ;;
|
||||||
yum)
|
yum)
|
||||||
yum_help $MISSING_DEPENDENCY ;;
|
yum_help $MISSING_DEPENDENCY ;;
|
||||||
|
brew)
|
||||||
|
brew_help $MISSING_DEPENDENCY ;;
|
||||||
port)
|
port)
|
||||||
port_help $MISSING_DEPENDENCY ;;
|
port_help $MISSING_DEPENDENCY ;;
|
||||||
pkgutil)
|
pkgutil)
|
||||||
@ -56721,6 +56763,8 @@ done
|
|||||||
apt_help $MISSING_DEPENDENCY ;;
|
apt_help $MISSING_DEPENDENCY ;;
|
||||||
yum)
|
yum)
|
||||||
yum_help $MISSING_DEPENDENCY ;;
|
yum_help $MISSING_DEPENDENCY ;;
|
||||||
|
brew)
|
||||||
|
brew_help $MISSING_DEPENDENCY ;;
|
||||||
port)
|
port)
|
||||||
port_help $MISSING_DEPENDENCY ;;
|
port_help $MISSING_DEPENDENCY ;;
|
||||||
pkgutil)
|
pkgutil)
|
||||||
@ -56864,6 +56908,8 @@ done
|
|||||||
apt_help $MISSING_DEPENDENCY ;;
|
apt_help $MISSING_DEPENDENCY ;;
|
||||||
yum)
|
yum)
|
||||||
yum_help $MISSING_DEPENDENCY ;;
|
yum_help $MISSING_DEPENDENCY ;;
|
||||||
|
brew)
|
||||||
|
brew_help $MISSING_DEPENDENCY ;;
|
||||||
port)
|
port)
|
||||||
port_help $MISSING_DEPENDENCY ;;
|
port_help $MISSING_DEPENDENCY ;;
|
||||||
pkgutil)
|
pkgutil)
|
||||||
@ -60683,6 +60729,345 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
|
|||||||
fi
|
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
|
||||||
|
POTENTIAL_FREETYPE_LIB_PATH="$new_path"
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
|
||||||
|
$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH 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="$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
|
||||||
|
|
||||||
|
if test -d "$path"; then
|
||||||
|
POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`"
|
||||||
|
else
|
||||||
|
dir="`$DIRNAME "$path"`"
|
||||||
|
base="`$BASENAME "$path"`"
|
||||||
|
POTENTIAL_FREETYPE_LIB_PATH="`cd "$dir"; $THEPWDCMD -L`/$base"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype includes" >&5
|
||||||
|
$as_echo_n "checking for freetype includes... " >&6; }
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_INCLUDE_PATH" >&5
|
||||||
|
$as_echo "$FREETYPE_INCLUDE_PATH" >&6; }
|
||||||
|
FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype libraries" >&5
|
||||||
|
$as_echo_n "checking for freetype libraries... " >&6; }
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_LIB_PATH" >&5
|
||||||
|
$as_echo "$FREETYPE_LIB_PATH" >&6; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
if test "x$FOUND_FREETYPE" != xyes; then
|
||||||
|
FREETYPE_BASE_DIR="$SYSROOT/usr/local"
|
||||||
|
|
||||||
|
POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include"
|
||||||
|
POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib"
|
||||||
|
METHOD="well-known location"
|
||||||
|
|
||||||
|
# Let's start with an optimistic view of the world :-)
|
||||||
|
FOUND_FREETYPE=yes
|
||||||
|
|
||||||
|
# First look for the canonical freetype main include file ft2build.h.
|
||||||
|
if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
|
||||||
|
# Oh no! Let's try in the freetype2 directory. This is needed at least at Mac OS X Yosemite.
|
||||||
|
POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
|
||||||
|
if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
|
||||||
|
# Fail.
|
||||||
|
FOUND_FREETYPE=no
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$FOUND_FREETYPE" = xyes; then
|
||||||
|
# Include file found, let's continue the sanity check.
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
|
||||||
|
$as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
|
||||||
|
|
||||||
|
# Reset to default value
|
||||||
|
FREETYPE_BASE_NAME=freetype
|
||||||
|
FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
|
||||||
|
if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
|
||||||
|
if test "x$OPENJDK_TARGET_OS" = xmacosx \
|
||||||
|
&& test -s "$POTENTIAL_FREETYPE_LIB_PATH/${LIBRARY_PREFIX}freetype.6${SHARED_LIBRARY_SUFFIX}"; then
|
||||||
|
# On Mac OS X Yosemite, the symlink from libfreetype.dylib to libfreetype.6.dylib disappeared. Check
|
||||||
|
# for the .6 version explicitly.
|
||||||
|
FREETYPE_BASE_NAME=freetype.6
|
||||||
|
FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: Compensating for missing symlink by using version 6 explicitly" >&5
|
||||||
|
$as_echo "$as_me: Compensating for missing symlink by using version 6 explicitly" >&6;}
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
|
||||||
|
$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
|
||||||
|
FOUND_FREETYPE=no
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if test "x$OPENJDK_TARGET_OS" = xwindows; then
|
||||||
|
# On Windows, we will need both .lib and .dll file.
|
||||||
|
if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib"; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&5
|
||||||
|
$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&6;}
|
||||||
|
FOUND_FREETYPE=no
|
||||||
|
fi
|
||||||
|
elif test "x$OPENJDK_TARGET_OS" = xsolaris \
|
||||||
|
&& test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
|
||||||
|
# Found lib in isa dir, use that instead.
|
||||||
|
POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&5
|
||||||
|
$as_echo "$as_me: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&6;}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$FOUND_FREETYPE" = xyes; 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.
|
||||||
|
path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
|
||||||
|
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 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 $? "Cannot locate the the path of POTENTIAL_FREETYPE_INCLUDE_PATH" "$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-style (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
|
||||||
|
POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
|
||||||
|
$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
|
||||||
|
|
||||||
|
path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
|
||||||
|
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
|
||||||
|
POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
|
||||||
|
$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH 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="$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
|
||||||
|
|
||||||
|
if test -d "$path"; then
|
||||||
|
POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`"
|
||||||
|
else
|
||||||
|
dir="`$DIRNAME "$path"`"
|
||||||
|
base="`$BASENAME "$path"`"
|
||||||
|
POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$dir"; $THEPWDCMD -L`/$base"
|
||||||
|
fi
|
||||||
|
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.
|
||||||
|
path="$POTENTIAL_FREETYPE_LIB_PATH"
|
||||||
|
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 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 $? "Cannot locate the the path of POTENTIAL_FREETYPE_LIB_PATH" "$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-style (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
|
||||||
|
POTENTIAL_FREETYPE_LIB_PATH="$new_path"
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
|
||||||
|
$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
|
||||||
|
|
||||||
|
path="$POTENTIAL_FREETYPE_LIB_PATH"
|
||||||
|
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"
|
windows_path="$new_path"
|
||||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||||
unix_path=`$CYGPATH -u "$windows_path"`
|
unix_path=`$CYGPATH -u "$windows_path"`
|
||||||
@ -62122,6 +62507,8 @@ $as_echo "$FREETYPE_LIB_PATH" >&6; }
|
|||||||
apt_help $MISSING_DEPENDENCY ;;
|
apt_help $MISSING_DEPENDENCY ;;
|
||||||
yum)
|
yum)
|
||||||
yum_help $MISSING_DEPENDENCY ;;
|
yum_help $MISSING_DEPENDENCY ;;
|
||||||
|
brew)
|
||||||
|
brew_help $MISSING_DEPENDENCY ;;
|
||||||
port)
|
port)
|
||||||
port_help $MISSING_DEPENDENCY ;;
|
port_help $MISSING_DEPENDENCY ;;
|
||||||
pkgutil)
|
pkgutil)
|
||||||
@ -62477,6 +62864,8 @@ $as_echo "$as_me: Using FREETYPE_CFLAGS=$FREETYPE_CFLAGS and FREETYPE_LIBS=$FREE
|
|||||||
apt_help $MISSING_DEPENDENCY ;;
|
apt_help $MISSING_DEPENDENCY ;;
|
||||||
yum)
|
yum)
|
||||||
yum_help $MISSING_DEPENDENCY ;;
|
yum_help $MISSING_DEPENDENCY ;;
|
||||||
|
brew)
|
||||||
|
brew_help $MISSING_DEPENDENCY ;;
|
||||||
port)
|
port)
|
||||||
port_help $MISSING_DEPENDENCY ;;
|
port_help $MISSING_DEPENDENCY ;;
|
||||||
pkgutil)
|
pkgutil)
|
||||||
@ -62682,6 +63071,8 @@ done
|
|||||||
apt_help $MISSING_DEPENDENCY ;;
|
apt_help $MISSING_DEPENDENCY ;;
|
||||||
yum)
|
yum)
|
||||||
yum_help $MISSING_DEPENDENCY ;;
|
yum_help $MISSING_DEPENDENCY ;;
|
||||||
|
brew)
|
||||||
|
brew_help $MISSING_DEPENDENCY ;;
|
||||||
port)
|
port)
|
||||||
port_help $MISSING_DEPENDENCY ;;
|
port_help $MISSING_DEPENDENCY ;;
|
||||||
pkgutil)
|
pkgutil)
|
||||||
@ -62870,6 +63261,8 @@ done
|
|||||||
apt_help $MISSING_DEPENDENCY ;;
|
apt_help $MISSING_DEPENDENCY ;;
|
||||||
yum)
|
yum)
|
||||||
yum_help $MISSING_DEPENDENCY ;;
|
yum_help $MISSING_DEPENDENCY ;;
|
||||||
|
brew)
|
||||||
|
brew_help $MISSING_DEPENDENCY ;;
|
||||||
port)
|
port)
|
||||||
port_help $MISSING_DEPENDENCY ;;
|
port_help $MISSING_DEPENDENCY ;;
|
||||||
pkgutil)
|
pkgutil)
|
||||||
@ -62949,6 +63342,8 @@ $as_echo "$LIBFFI_WORKS" >&6; }
|
|||||||
apt_help $MISSING_DEPENDENCY ;;
|
apt_help $MISSING_DEPENDENCY ;;
|
||||||
yum)
|
yum)
|
||||||
yum_help $MISSING_DEPENDENCY ;;
|
yum_help $MISSING_DEPENDENCY ;;
|
||||||
|
brew)
|
||||||
|
brew_help $MISSING_DEPENDENCY ;;
|
||||||
port)
|
port)
|
||||||
port_help $MISSING_DEPENDENCY ;;
|
port_help $MISSING_DEPENDENCY ;;
|
||||||
pkgutil)
|
pkgutil)
|
||||||
@ -64058,6 +64453,8 @@ done
|
|||||||
apt_help $MISSING_DEPENDENCY ;;
|
apt_help $MISSING_DEPENDENCY ;;
|
||||||
yum)
|
yum)
|
||||||
yum_help $MISSING_DEPENDENCY ;;
|
yum_help $MISSING_DEPENDENCY ;;
|
||||||
|
brew)
|
||||||
|
brew_help $MISSING_DEPENDENCY ;;
|
||||||
port)
|
port)
|
||||||
port_help $MISSING_DEPENDENCY ;;
|
port_help $MISSING_DEPENDENCY ;;
|
||||||
pkgutil)
|
pkgutil)
|
||||||
@ -64142,6 +64539,8 @@ $as_echo "$LIBELF_WORKS" >&6; }
|
|||||||
apt_help $MISSING_DEPENDENCY ;;
|
apt_help $MISSING_DEPENDENCY ;;
|
||||||
yum)
|
yum)
|
||||||
yum_help $MISSING_DEPENDENCY ;;
|
yum_help $MISSING_DEPENDENCY ;;
|
||||||
|
brew)
|
||||||
|
brew_help $MISSING_DEPENDENCY ;;
|
||||||
port)
|
port)
|
||||||
port_help $MISSING_DEPENDENCY ;;
|
port_help $MISSING_DEPENDENCY ;;
|
||||||
pkgutil)
|
pkgutil)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
AC_DEFUN_ONCE([HELP_SETUP_DEPENDENCY_HELP],
|
AC_DEFUN_ONCE([HELP_SETUP_DEPENDENCY_HELP],
|
||||||
[
|
[
|
||||||
AC_CHECK_PROGS(PKGHANDLER, apt-get yum port pkgutil pkgadd)
|
AC_CHECK_PROGS(PKGHANDLER, apt-get yum brew port pkgutil pkgadd)
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_DEFUN([HELP_MSG_MISSING_DEPENDENCY],
|
AC_DEFUN([HELP_MSG_MISSING_DEPENDENCY],
|
||||||
@ -46,6 +46,8 @@ AC_DEFUN([HELP_MSG_MISSING_DEPENDENCY],
|
|||||||
apt_help $MISSING_DEPENDENCY ;;
|
apt_help $MISSING_DEPENDENCY ;;
|
||||||
yum)
|
yum)
|
||||||
yum_help $MISSING_DEPENDENCY ;;
|
yum_help $MISSING_DEPENDENCY ;;
|
||||||
|
brew)
|
||||||
|
brew_help $MISSING_DEPENDENCY ;;
|
||||||
port)
|
port)
|
||||||
port_help $MISSING_DEPENDENCY ;;
|
port_help $MISSING_DEPENDENCY ;;
|
||||||
pkgutil)
|
pkgutil)
|
||||||
@ -147,6 +149,17 @@ yum_help() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
brew_help() {
|
||||||
|
case $1 in
|
||||||
|
openjdk)
|
||||||
|
PKGHANDLER_COMMAND="brew cask install java" ;;
|
||||||
|
freetype)
|
||||||
|
PKGHANDLER_COMMAND="brew install freetype" ;;
|
||||||
|
ccache)
|
||||||
|
PKGHANDLER_COMMAND="brew install ccache" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
port_help() {
|
port_help() {
|
||||||
PKGHANDLER_COMMAND=""
|
PKGHANDLER_COMMAND=""
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -382,18 +382,18 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JLINK_OPTIONS],
|
|||||||
AC_ARG_ENABLE([keep-packaged-modules], [AS_HELP_STRING([--disable-keep-packaged-modules],
|
AC_ARG_ENABLE([keep-packaged-modules], [AS_HELP_STRING([--disable-keep-packaged-modules],
|
||||||
[Do not keep packaged modules in jdk image @<:@enable@:>@])])
|
[Do not keep packaged modules in jdk image @<:@enable@:>@])])
|
||||||
|
|
||||||
if test "x$enable_keep_packaged_modules" = "xyes"; then
|
|
||||||
AC_MSG_CHECKING([if packaged modules are kept])
|
AC_MSG_CHECKING([if packaged modules are kept])
|
||||||
|
if test "x$enable_keep_packaged_modules" = "xyes"; then
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
JLINK_KEEP_PACKAGED_MODULES=true
|
JLINK_KEEP_PACKAGED_MODULES=true
|
||||||
elif test "x$enable_keep_packaged_modules" = "xno"; then
|
elif test "x$enable_keep_packaged_modules" = "xno"; then
|
||||||
AC_MSG_CHECKING([if packaged modules are kept])
|
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
JLINK_KEEP_PACKAGED_MODULES=false
|
JLINK_KEEP_PACKAGED_MODULES=false
|
||||||
elif test "x$enable_keep_packaged_modules" = "x"; then
|
elif test "x$enable_keep_packaged_modules" = "x"; then
|
||||||
AC_MSG_RESULT([yes (default)])
|
AC_MSG_RESULT([yes (default)])
|
||||||
JLINK_KEEP_PACKAGED_MODULES=true
|
JLINK_KEEP_PACKAGED_MODULES=true
|
||||||
else
|
else
|
||||||
|
AC_MSG_RESULT([error])
|
||||||
AC_MSG_ERROR([--enable-keep-packaged-modules accepts no argument])
|
AC_MSG_ERROR([--enable-keep-packaged-modules accepts no argument])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -348,6 +348,10 @@ AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
|
|||||||
FREETYPE_BASE_DIR="$SYSROOT/usr/X11"
|
FREETYPE_BASE_DIR="$SYSROOT/usr/X11"
|
||||||
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
|
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
|
||||||
fi
|
fi
|
||||||
|
if test "x$FOUND_FREETYPE" != xyes; then
|
||||||
|
FREETYPE_BASE_DIR="$SYSROOT/usr/local"
|
||||||
|
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
|
||||||
|
fi
|
||||||
|
|
||||||
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||||
if test "x$FOUND_FREETYPE" != xyes; then
|
if test "x$FOUND_FREETYPE" != xyes; then
|
||||||
|
@ -274,8 +274,6 @@ JAVADOC_OUTPUTDIR = $(DOCS_IMAGE_DIR)
|
|||||||
CONFIGURESUPPORT_OUTPUTDIR:=@CONFIGURESUPPORT_OUTPUTDIR@
|
CONFIGURESUPPORT_OUTPUTDIR:=@CONFIGURESUPPORT_OUTPUTDIR@
|
||||||
BUILDJDK_OUTPUTDIR=$(BUILD_OUTPUT)/buildjdk
|
BUILDJDK_OUTPUTDIR=$(BUILD_OUTPUT)/buildjdk
|
||||||
|
|
||||||
BUILD_HOTSPOT=@BUILD_HOTSPOT@
|
|
||||||
|
|
||||||
BUILD_FAILURE_HANDLER := @BUILD_FAILURE_HANDLER@
|
BUILD_FAILURE_HANDLER := @BUILD_FAILURE_HANDLER@
|
||||||
|
|
||||||
ENABLE_GENERATE_CLASSLIST := @ENABLE_GENERATE_CLASSLIST@
|
ENABLE_GENERATE_CLASSLIST := @ENABLE_GENERATE_CLASSLIST@
|
||||||
@ -642,7 +640,6 @@ NAWK:=@NAWK@
|
|||||||
NICE:=@NICE@
|
NICE:=@NICE@
|
||||||
PATCH:=@PATCH@
|
PATCH:=@PATCH@
|
||||||
PRINTF:=@PRINTF@
|
PRINTF:=@PRINTF@
|
||||||
PWD:=@THEPWDCMD@
|
|
||||||
RM:=@RM@
|
RM:=@RM@
|
||||||
RMDIR:=@RMDIR@
|
RMDIR:=@RMDIR@
|
||||||
SED:=@SED@
|
SED:=@SED@
|
||||||
@ -778,11 +775,18 @@ OS_VERSION_MICRO:=@OS_VERSION_MICRO@
|
|||||||
# Images directory definitions
|
# Images directory definitions
|
||||||
JDK_IMAGE_SUBDIR:=jdk
|
JDK_IMAGE_SUBDIR:=jdk
|
||||||
JRE_IMAGE_SUBDIR:=jre
|
JRE_IMAGE_SUBDIR:=jre
|
||||||
|
JRE_COMPACT1_IMAGE_SUBDIR := jre-compact1
|
||||||
|
JRE_COMPACT2_IMAGE_SUBDIR := jre-compact2
|
||||||
|
JRE_COMPACT3_IMAGE_SUBDIR := jre-compact3
|
||||||
|
|
||||||
# Colon left out to be able to override output dir for bootcycle-images
|
# Colon left out to be able to override output dir for bootcycle-images
|
||||||
JDK_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_IMAGE_SUBDIR)
|
JDK_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_IMAGE_SUBDIR)
|
||||||
JRE_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_IMAGE_SUBDIR)
|
JRE_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_IMAGE_SUBDIR)
|
||||||
|
|
||||||
|
JRE_COMPACT1_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/$(JRE_COMPACT1_IMAGE_SUBDIR)
|
||||||
|
JRE_COMPACT2_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/$(JRE_COMPACT2_IMAGE_SUBDIR)
|
||||||
|
JRE_COMPACT3_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/$(JRE_COMPACT3_IMAGE_SUBDIR)
|
||||||
|
|
||||||
# Test image, as above
|
# Test image, as above
|
||||||
TEST_IMAGE_SUBDIR:=test
|
TEST_IMAGE_SUBDIR:=test
|
||||||
TEST_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(TEST_IMAGE_SUBDIR)
|
TEST_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(TEST_IMAGE_SUBDIR)
|
||||||
@ -818,6 +822,12 @@ else ifneq ($(DEBUG_LEVEL), release)
|
|||||||
endif
|
endif
|
||||||
JDK_BUNDLE_NAME := jdk-$(BASE_NAME)_bin$(DEBUG_PART).tar.gz
|
JDK_BUNDLE_NAME := jdk-$(BASE_NAME)_bin$(DEBUG_PART).tar.gz
|
||||||
JRE_BUNDLE_NAME := jre-$(BASE_NAME)_bin$(DEBUG_PART).tar.gz
|
JRE_BUNDLE_NAME := jre-$(BASE_NAME)_bin$(DEBUG_PART).tar.gz
|
||||||
|
JRE_COMPACT1_BUNDLE_NAME := \
|
||||||
|
jre-$(VERSION_SHORT)+$(VERSION_BUILD)-compact1_$(OPENJDK_TARGET_BUNDLE_PLATFORM)_bin$(DEBUG_PART).tar.gz
|
||||||
|
JRE_COMPACT2_BUNDLE_NAME := \
|
||||||
|
jre-$(VERSION_SHORT)+$(VERSION_BUILD)-compact2_$(OPENJDK_TARGET_BUNDLE_PLATFORM)_bin$(DEBUG_PART).tar.gz
|
||||||
|
JRE_COMPACT3_BUNDLE_NAME := \
|
||||||
|
jre-$(VERSION_SHORT)+$(VERSION_BUILD)-compact3_$(OPENJDK_TARGET_BUNDLE_PLATFORM)_bin$(DEBUG_PART).tar.gz
|
||||||
JDK_SYMBOLS_BUNDLE_NAME := jdk-$(BASE_NAME)_bin$(DEBUG_PART)-symbols.tar.gz
|
JDK_SYMBOLS_BUNDLE_NAME := jdk-$(BASE_NAME)_bin$(DEBUG_PART)-symbols.tar.gz
|
||||||
JRE_SYMBOLS_BUNDLE_NAME := jre-$(BASE_NAME)_bin$(DEBUG_PART)-symbols.tar.gz
|
JRE_SYMBOLS_BUNDLE_NAME := jre-$(BASE_NAME)_bin$(DEBUG_PART)-symbols.tar.gz
|
||||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||||
|
@ -501,7 +501,7 @@ var getJibProfilesProfiles = function (input, common, data) {
|
|||||||
// extra default target.
|
// extra default target.
|
||||||
var openOnlyProfilesExtra = {
|
var openOnlyProfilesExtra = {
|
||||||
"linux-x86-open": {
|
"linux-x86-open": {
|
||||||
default_make_targets: "profiles",
|
default_make_targets: "profiles-bundles",
|
||||||
configure_args: "--with-jvm-variants=client,server"
|
configure_args: "--with-jvm-variants=client,server"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -587,6 +587,7 @@ var getJibProfilesProfiles = function (input, common, data) {
|
|||||||
],
|
],
|
||||||
work_dir: input.get("src.full", "install_path") + "/test",
|
work_dir: input.get("src.full", "install_path") + "/test",
|
||||||
environment: {
|
environment: {
|
||||||
|
"JT_JAVA": common.boot_jdk_home,
|
||||||
"PRODUCT_HOME": input.get(testedProfile + ".jdk", "home_path"),
|
"PRODUCT_HOME": input.get(testedProfile + ".jdk", "home_path"),
|
||||||
"TEST_IMAGE_DIR": input.get(testedProfile + ".test", "home_path"),
|
"TEST_IMAGE_DIR": input.get(testedProfile + ".test", "home_path"),
|
||||||
"TEST_OUTPUT_DIR": input.src_top_dir
|
"TEST_OUTPUT_DIR": input.src_top_dir
|
||||||
@ -710,10 +711,15 @@ var getJibProfilesProfiles = function (input, common, data) {
|
|||||||
local: "bundles/\\(jdk.*bin.tar.gz\\)",
|
local: "bundles/\\(jdk.*bin.tar.gz\\)",
|
||||||
remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
|
remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
|
||||||
},
|
},
|
||||||
jre: {
|
jdk_symbols: {
|
||||||
local: "bundles/\\(jre.*[0-9]_linux-x86_bin.tar.gz\\)",
|
local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
|
||||||
remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
|
remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
|
||||||
},/* The build does not create these
|
},
|
||||||
|
jre: {
|
||||||
|
// This regexp needs to not match the compact* files below
|
||||||
|
local: "bundles/\\(jre.*[+][0-9]\\{1,\\}_linux-x86_bin.tar.gz\\)",
|
||||||
|
remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
|
||||||
|
},
|
||||||
jre_compact1: {
|
jre_compact1: {
|
||||||
local: "bundles/\\(jre.*-compact1_linux-x86_bin.tar.gz\\)",
|
local: "bundles/\\(jre.*-compact1_linux-x86_bin.tar.gz\\)",
|
||||||
remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
|
remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
|
||||||
@ -725,7 +731,7 @@ var getJibProfilesProfiles = function (input, common, data) {
|
|||||||
jre_compact3: {
|
jre_compact3: {
|
||||||
local: "bundles/\\(jre.*-compact3_linux-x86_bin.tar.gz\\)",
|
local: "bundles/\\(jre.*-compact3_linux-x86_bin.tar.gz\\)",
|
||||||
remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
|
remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
|
||||||
},*/
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -864,7 +870,7 @@ var getJibProfilesDependencies = function (input, common) {
|
|||||||
jtreg: {
|
jtreg: {
|
||||||
server: "javare",
|
server: "javare",
|
||||||
revision: "4.2",
|
revision: "4.2",
|
||||||
build_number: "b04",
|
build_number: "b05",
|
||||||
checksum_file: "MD5_VALUES",
|
checksum_file: "MD5_VALUES",
|
||||||
file: "jtreg_bin-4.2.zip",
|
file: "jtreg_bin-4.2.zip",
|
||||||
environment_name: "JT_HOME",
|
environment_name: "JT_HOME",
|
||||||
|
@ -394,3 +394,4 @@ f95cc86b6ac22ec1ade5d4f825dc7782adeea228 jdk-9+148
|
|||||||
00b19338e505690abe93d5995ed74a473d969c2c jdk-9+149
|
00b19338e505690abe93d5995ed74a473d969c2c jdk-9+149
|
||||||
9205e980062a5c4530b51021c6e274025f4ccbdf jdk-9+150
|
9205e980062a5c4530b51021c6e274025f4ccbdf jdk-9+150
|
||||||
77f827f5bbad3ef795664bc675f72d98d156b9f8 jdk-9+151
|
77f827f5bbad3ef795664bc675f72d98d156b9f8 jdk-9+151
|
||||||
|
ff8cb43c07c069b1debdee44cb88ca22db1ec757 jdk-9+152
|
||||||
|
@ -554,3 +554,4 @@ a82cb5350cad96a0b4de496afebe3ded89f27efa jdk-9+146
|
|||||||
30e1996bd55da36183434f24ed964adebf9ca71e jdk-9+149
|
30e1996bd55da36183434f24ed964adebf9ca71e jdk-9+149
|
||||||
98fe046473c90204cbc9b34c512b9fc10dfb8479 jdk-9+150
|
98fe046473c90204cbc9b34c512b9fc10dfb8479 jdk-9+150
|
||||||
2a2ac7d9f52c8cb2b80077e515b5840b947e640c jdk-9+151
|
2a2ac7d9f52c8cb2b80077e515b5840b947e640c jdk-9+151
|
||||||
|
31f1d26c60df7b2e516a4f84160d76ba017d4e09 jdk-9+152
|
||||||
|
@ -394,3 +394,4 @@ c41140100bf1e5c10c7b8f3bde91c16eff7485f5 jdk-9+147
|
|||||||
5a846396a24c7aff01d6a8feaa7afc0a6369f04d jdk-9+149
|
5a846396a24c7aff01d6a8feaa7afc0a6369f04d jdk-9+149
|
||||||
71e198ef3839045e829a879af1d709be16ab0f88 jdk-9+150
|
71e198ef3839045e829a879af1d709be16ab0f88 jdk-9+150
|
||||||
d27bab22ff62823902d93d1d35ca397cfd50d059 jdk-9+151
|
d27bab22ff62823902d93d1d35ca397cfd50d059 jdk-9+151
|
||||||
|
a20f2cf90762673e1bc4980fd6597e70a2578045 jdk-9+152
|
||||||
|
@ -436,15 +436,15 @@ sequence.fallback=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin
|
|||||||
|
|
||||||
filename.-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arial.ttf
|
filename.-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arial.ttf
|
||||||
filename.-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/ariali.ttf
|
filename.-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/ariali.ttf
|
||||||
filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arialb.ttf
|
filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arialbd.ttf
|
||||||
filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arialbi.ttf
|
filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arialbi.ttf
|
||||||
filename.-monotype-courier_new-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/cour.ttf
|
filename.-monotype-courier_new-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/cour.ttf
|
||||||
filename.-monotype-courier_new-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/couri.ttf
|
filename.-monotype-courier_new-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/couri.ttf
|
||||||
filename.-monotype-courier_new-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/courb.ttf
|
filename.-monotype-courier_new-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/courbd.ttf
|
||||||
filename.-monotype-courier_new-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/courbi.ttf
|
filename.-monotype-courier_new-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/courbi.ttf
|
||||||
filename.-monotype-times_new_roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/times.ttf
|
filename.-monotype-times_new_roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/times.ttf
|
||||||
filename.-monotype-times_new_roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesi.ttf
|
filename.-monotype-times_new_roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesi.ttf
|
||||||
filename.-monotype-times_new_roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesb.ttf
|
filename.-monotype-times_new_roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesbd.ttf
|
||||||
filename.-monotype-times_new_roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesbi.ttf
|
filename.-monotype-times_new_roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesbi.ttf
|
||||||
|
|
||||||
filename.-monotype-angsana_new-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/angsa.ttf
|
filename.-monotype-angsana_new-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/angsa.ttf
|
||||||
|
@ -222,6 +222,8 @@ endif
|
|||||||
# applies to debug builds.
|
# applies to debug builds.
|
||||||
ifeq ($(TOOLCHAIN_TYPE), gcc)
|
ifeq ($(TOOLCHAIN_TYPE), gcc)
|
||||||
BUILD_LIBAWT_debug_mem.c_CFLAGS := -w
|
BUILD_LIBAWT_debug_mem.c_CFLAGS := -w
|
||||||
|
# This option improves performance of MaskFill in Java2D by 20% for some gcc
|
||||||
|
LIBAWT_CFLAGS += -fgcse-after-reload
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(eval $(call SetupNativeCompilation,BUILD_LIBAWT, \
|
$(eval $(call SetupNativeCompilation,BUILD_LIBAWT, \
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -1962,6 +1962,9 @@ public class File
|
|||||||
name = sb.toString();
|
name = sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Normalize the path component
|
||||||
|
name = fs.normalize(name);
|
||||||
|
|
||||||
File f = new File(dir, name);
|
File f = new File(dir, name);
|
||||||
if (!name.equals(f.getName()) || f.isInvalid()) {
|
if (!name.equals(f.getName()) || f.isInvalid()) {
|
||||||
if (System.getSecurityManager() != null)
|
if (System.getSecurityManager() != null)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -2477,7 +2477,7 @@ public final class Class<T> implements java.io.Serializable,
|
|||||||
* <ul>
|
* <ul>
|
||||||
*
|
*
|
||||||
* <li> If the {@code name} begins with a {@code '/'}
|
* <li> If the {@code name} begins with a {@code '/'}
|
||||||
* (<tt>'\u002f'</tt>), then the absolute name of the resource is the
|
* (<code>'\u002f'</code>), then the absolute name of the resource is the
|
||||||
* portion of the {@code name} following the {@code '/'}.
|
* portion of the {@code name} following the {@code '/'}.
|
||||||
*
|
*
|
||||||
* <li> Otherwise, the absolute name is of the following form:
|
* <li> Otherwise, the absolute name is of the following form:
|
||||||
@ -2488,7 +2488,7 @@ public final class Class<T> implements java.io.Serializable,
|
|||||||
*
|
*
|
||||||
* <p> Where the {@code modified_package_name} is the package name of this
|
* <p> Where the {@code modified_package_name} is the package name of this
|
||||||
* object with {@code '/'} substituted for {@code '.'}
|
* object with {@code '/'} substituted for {@code '.'}
|
||||||
* (<tt>'\u002e'</tt>).
|
* (<code>'\u002e'</code>).
|
||||||
*
|
*
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
@ -2570,7 +2570,7 @@ public final class Class<T> implements java.io.Serializable,
|
|||||||
* <ul>
|
* <ul>
|
||||||
*
|
*
|
||||||
* <li> If the {@code name} begins with a {@code '/'}
|
* <li> If the {@code name} begins with a {@code '/'}
|
||||||
* (<tt>'\u002f'</tt>), then the absolute name of the resource is the
|
* (<code>'\u002f'</code>), then the absolute name of the resource is the
|
||||||
* portion of the {@code name} following the {@code '/'}.
|
* portion of the {@code name} following the {@code '/'}.
|
||||||
*
|
*
|
||||||
* <li> Otherwise, the absolute name is of the following form:
|
* <li> Otherwise, the absolute name is of the following form:
|
||||||
@ -2581,7 +2581,7 @@ public final class Class<T> implements java.io.Serializable,
|
|||||||
*
|
*
|
||||||
* <p> Where the {@code modified_package_name} is the package name of this
|
* <p> Where the {@code modified_package_name} is the package name of this
|
||||||
* object with {@code '/'} substituted for {@code '.'}
|
* object with {@code '/'} substituted for {@code '.'}
|
||||||
* (<tt>'\u002e'</tt>).
|
* (<code>'\u002e'</code>).
|
||||||
*
|
*
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -70,34 +70,34 @@ import sun.security.util.SecurityConstants;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A class loader is an object that is responsible for loading classes. The
|
* A class loader is an object that is responsible for loading classes. The
|
||||||
* class <tt>ClassLoader</tt> is an abstract class. Given the <a
|
* class {@code ClassLoader} is an abstract class. Given the <a
|
||||||
* href="#name">binary name</a> of a class, a class loader should attempt to
|
* href="#name">binary name</a> of a class, a class loader should attempt to
|
||||||
* locate or generate data that constitutes a definition for the class. A
|
* locate or generate data that constitutes a definition for the class. A
|
||||||
* typical strategy is to transform the name into a file name and then read a
|
* typical strategy is to transform the name into a file name and then read a
|
||||||
* "class file" of that name from a file system.
|
* "class file" of that name from a file system.
|
||||||
*
|
*
|
||||||
* <p> Every {@link Class <tt>Class</tt>} object contains a {@link
|
* <p> Every {@link java.lang.Class Class} object contains a {@link
|
||||||
* Class#getClassLoader() reference} to the <tt>ClassLoader</tt> that defined
|
* Class#getClassLoader() reference} to the {@code ClassLoader} that defined
|
||||||
* it.
|
* it.
|
||||||
*
|
*
|
||||||
* <p> <tt>Class</tt> objects for array classes are not created by class
|
* <p> {@code Class} objects for array classes are not created by class
|
||||||
* loaders, but are created automatically as required by the Java runtime.
|
* loaders, but are created automatically as required by the Java runtime.
|
||||||
* The class loader for an array class, as returned by {@link
|
* The class loader for an array class, as returned by {@link
|
||||||
* Class#getClassLoader()} is the same as the class loader for its element
|
* Class#getClassLoader()} is the same as the class loader for its element
|
||||||
* type; if the element type is a primitive type, then the array class has no
|
* type; if the element type is a primitive type, then the array class has no
|
||||||
* class loader.
|
* class loader.
|
||||||
*
|
*
|
||||||
* <p> Applications implement subclasses of <tt>ClassLoader</tt> in order to
|
* <p> Applications implement subclasses of {@code ClassLoader} in order to
|
||||||
* extend the manner in which the Java virtual machine dynamically loads
|
* extend the manner in which the Java virtual machine dynamically loads
|
||||||
* classes.
|
* classes.
|
||||||
*
|
*
|
||||||
* <p> Class loaders may typically be used by security managers to indicate
|
* <p> Class loaders may typically be used by security managers to indicate
|
||||||
* security domains.
|
* security domains.
|
||||||
*
|
*
|
||||||
* <p> The <tt>ClassLoader</tt> class uses a delegation model to search for
|
* <p> The {@code ClassLoader} class uses a delegation model to search for
|
||||||
* classes and resources. Each instance of <tt>ClassLoader</tt> has an
|
* classes and resources. Each instance of {@code ClassLoader} has an
|
||||||
* associated parent class loader. When requested to find a class or
|
* associated parent class loader. When requested to find a class or
|
||||||
* resource, a <tt>ClassLoader</tt> instance will delegate the search for the
|
* resource, a {@code ClassLoader} instance will delegate the search for the
|
||||||
* class or resource to its parent class loader before attempting to find the
|
* class or resource to its parent class loader before attempting to find the
|
||||||
* class or resource itself.
|
* class or resource itself.
|
||||||
*
|
*
|
||||||
@ -105,15 +105,15 @@ import sun.security.util.SecurityConstants;
|
|||||||
* <em>{@linkplain #isRegisteredAsParallelCapable() parallel capable}</em> class
|
* <em>{@linkplain #isRegisteredAsParallelCapable() parallel capable}</em> class
|
||||||
* loaders and are required to register themselves at their class initialization
|
* loaders and are required to register themselves at their class initialization
|
||||||
* time by invoking the {@link
|
* time by invoking the {@link
|
||||||
* #registerAsParallelCapable <tt>ClassLoader.registerAsParallelCapable</tt>}
|
* #registerAsParallelCapable ClassLoader.registerAsParallelCapable}
|
||||||
* method. Note that the <tt>ClassLoader</tt> class is registered as parallel
|
* method. Note that the {@code ClassLoader} class is registered as parallel
|
||||||
* capable by default. However, its subclasses still need to register themselves
|
* capable by default. However, its subclasses still need to register themselves
|
||||||
* if they are parallel capable.
|
* if they are parallel capable.
|
||||||
* In environments in which the delegation model is not strictly
|
* In environments in which the delegation model is not strictly
|
||||||
* hierarchical, class loaders need to be parallel capable, otherwise class
|
* hierarchical, class loaders need to be parallel capable, otherwise class
|
||||||
* loading can lead to deadlocks because the loader lock is held for the
|
* loading can lead to deadlocks because the loader lock is held for the
|
||||||
* duration of the class loading process (see {@link #loadClass
|
* duration of the class loading process (see {@link #loadClass
|
||||||
* <tt>loadClass</tt>} methods).
|
* loadClass} methods).
|
||||||
*
|
*
|
||||||
* <h3> <a name="builtinLoaders">Run-time Built-in Class Loaders</a></h3>
|
* <h3> <a name="builtinLoaders">Run-time Built-in Class Loaders</a></h3>
|
||||||
*
|
*
|
||||||
@ -143,13 +143,13 @@ import sun.security.util.SecurityConstants;
|
|||||||
* However, some classes may not originate from a file; they may originate
|
* However, some classes may not originate from a file; they may originate
|
||||||
* from other sources, such as the network, or they could be constructed by an
|
* from other sources, such as the network, or they could be constructed by an
|
||||||
* application. The method {@link #defineClass(String, byte[], int, int)
|
* application. The method {@link #defineClass(String, byte[], int, int)
|
||||||
* <tt>defineClass</tt>} converts an array of bytes into an instance of class
|
* defineClass} converts an array of bytes into an instance of class
|
||||||
* <tt>Class</tt>. Instances of this newly defined class can be created using
|
* {@code Class}. Instances of this newly defined class can be created using
|
||||||
* {@link Class#newInstance <tt>Class.newInstance</tt>}.
|
* {@link Class#newInstance Class.newInstance}.
|
||||||
*
|
*
|
||||||
* <p> The methods and constructors of objects created by a class loader may
|
* <p> The methods and constructors of objects created by a class loader may
|
||||||
* reference other classes. To determine the class(es) referred to, the Java
|
* reference other classes. To determine the class(es) referred to, the Java
|
||||||
* virtual machine invokes the {@link #loadClass <tt>loadClass</tt>} method of
|
* virtual machine invokes the {@link #loadClass loadClass} method of
|
||||||
* the class loader that originally created the class.
|
* the class loader that originally created the class.
|
||||||
*
|
*
|
||||||
* <p> For example, an application could create a network class loader to
|
* <p> For example, an application could create a network class loader to
|
||||||
@ -162,9 +162,9 @@ import sun.security.util.SecurityConstants;
|
|||||||
* </pre></blockquote>
|
* </pre></blockquote>
|
||||||
*
|
*
|
||||||
* <p> The network class loader subclass must define the methods {@link
|
* <p> The network class loader subclass must define the methods {@link
|
||||||
* #findClass <tt>findClass</tt>} and <tt>loadClassData</tt> to load a class
|
* #findClass findClass} and {@code loadClassData} to load a class
|
||||||
* from the network. Once it has downloaded the bytes that make up the class,
|
* from the network. Once it has downloaded the bytes that make up the class,
|
||||||
* it should use the method {@link #defineClass <tt>defineClass</tt>} to
|
* it should use the method {@link #defineClass defineClass} to
|
||||||
* create a class instance. A sample implementation is:
|
* create a class instance. A sample implementation is:
|
||||||
*
|
*
|
||||||
* <blockquote><pre>
|
* <blockquote><pre>
|
||||||
@ -392,7 +392,7 @@ public abstract class ClassLoader {
|
|||||||
*
|
*
|
||||||
* <p> If there is a security manager, its {@link
|
* <p> If there is a security manager, its {@link
|
||||||
* SecurityManager#checkCreateClassLoader()
|
* SecurityManager#checkCreateClassLoader()
|
||||||
* <tt>checkCreateClassLoader</tt>} method is invoked. This may result in
|
* checkCreateClassLoader} method is invoked. This may result in
|
||||||
* a security exception. </p>
|
* a security exception. </p>
|
||||||
*
|
*
|
||||||
* @param parent
|
* @param parent
|
||||||
@ -400,7 +400,7 @@ public abstract class ClassLoader {
|
|||||||
*
|
*
|
||||||
* @throws SecurityException
|
* @throws SecurityException
|
||||||
* If a security manager exists and its
|
* If a security manager exists and its
|
||||||
* <tt>checkCreateClassLoader</tt> method doesn't allow creation
|
* {@code checkCreateClassLoader} method doesn't allow creation
|
||||||
* of a new class loader.
|
* of a new class loader.
|
||||||
*
|
*
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
@ -410,18 +410,18 @@ public abstract class ClassLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new class loader using the <tt>ClassLoader</tt> returned by
|
* Creates a new class loader using the {@code ClassLoader} returned by
|
||||||
* the method {@link #getSystemClassLoader()
|
* the method {@link #getSystemClassLoader()
|
||||||
* <tt>getSystemClassLoader()</tt>} as the parent class loader.
|
* getSystemClassLoader()} as the parent class loader.
|
||||||
*
|
*
|
||||||
* <p> If there is a security manager, its {@link
|
* <p> If there is a security manager, its {@link
|
||||||
* SecurityManager#checkCreateClassLoader()
|
* SecurityManager#checkCreateClassLoader()
|
||||||
* <tt>checkCreateClassLoader</tt>} method is invoked. This may result in
|
* checkCreateClassLoader} method is invoked. This may result in
|
||||||
* a security exception. </p>
|
* a security exception. </p>
|
||||||
*
|
*
|
||||||
* @throws SecurityException
|
* @throws SecurityException
|
||||||
* If a security manager exists and its
|
* If a security manager exists and its
|
||||||
* <tt>checkCreateClassLoader</tt> method doesn't allow creation
|
* {@code checkCreateClassLoader} method doesn't allow creation
|
||||||
* of a new class loader.
|
* of a new class loader.
|
||||||
*/
|
*/
|
||||||
protected ClassLoader() {
|
protected ClassLoader() {
|
||||||
@ -458,13 +458,13 @@ public abstract class ClassLoader {
|
|||||||
* This method searches for classes in the same manner as the {@link
|
* This method searches for classes in the same manner as the {@link
|
||||||
* #loadClass(String, boolean)} method. It is invoked by the Java virtual
|
* #loadClass(String, boolean)} method. It is invoked by the Java virtual
|
||||||
* machine to resolve class references. Invoking this method is equivalent
|
* machine to resolve class references. Invoking this method is equivalent
|
||||||
* to invoking {@link #loadClass(String, boolean) <tt>loadClass(name,
|
* to invoking {@link #loadClass(String, boolean) loadClass(name,
|
||||||
* false)</tt>}.
|
* false)}.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* The <a href="#name">binary name</a> of the class
|
* The <a href="#name">binary name</a> of the class
|
||||||
*
|
*
|
||||||
* @return The resulting <tt>Class</tt> object
|
* @return The resulting {@code Class} object
|
||||||
*
|
*
|
||||||
* @throws ClassNotFoundException
|
* @throws ClassNotFoundException
|
||||||
* If the class was not found
|
* If the class was not found
|
||||||
@ -483,8 +483,8 @@ public abstract class ClassLoader {
|
|||||||
* <li><p> Invoke {@link #findLoadedClass(String)} to check if the class
|
* <li><p> Invoke {@link #findLoadedClass(String)} to check if the class
|
||||||
* has already been loaded. </p></li>
|
* has already been loaded. </p></li>
|
||||||
*
|
*
|
||||||
* <li><p> Invoke the {@link #loadClass(String) <tt>loadClass</tt>} method
|
* <li><p> Invoke the {@link #loadClass(String) loadClass} method
|
||||||
* on the parent class loader. If the parent is <tt>null</tt> the class
|
* on the parent class loader. If the parent is {@code null} the class
|
||||||
* loader built-in to the virtual machine is used, instead. </p></li>
|
* loader built-in to the virtual machine is used, instead. </p></li>
|
||||||
*
|
*
|
||||||
* <li><p> Invoke the {@link #findClass(String)} method to find the
|
* <li><p> Invoke the {@link #findClass(String)} method to find the
|
||||||
@ -493,23 +493,23 @@ public abstract class ClassLoader {
|
|||||||
* </ol>
|
* </ol>
|
||||||
*
|
*
|
||||||
* <p> If the class was found using the above steps, and the
|
* <p> If the class was found using the above steps, and the
|
||||||
* <tt>resolve</tt> flag is true, this method will then invoke the {@link
|
* {@code resolve} flag is true, this method will then invoke the {@link
|
||||||
* #resolveClass(Class)} method on the resulting <tt>Class</tt> object.
|
* #resolveClass(Class)} method on the resulting {@code Class} object.
|
||||||
*
|
*
|
||||||
* <p> Subclasses of <tt>ClassLoader</tt> are encouraged to override {@link
|
* <p> Subclasses of {@code ClassLoader} are encouraged to override {@link
|
||||||
* #findClass(String)}, rather than this method. </p>
|
* #findClass(String)}, rather than this method. </p>
|
||||||
*
|
*
|
||||||
* <p> Unless overridden, this method synchronizes on the result of
|
* <p> Unless overridden, this method synchronizes on the result of
|
||||||
* {@link #getClassLoadingLock <tt>getClassLoadingLock</tt>} method
|
* {@link #getClassLoadingLock getClassLoadingLock} method
|
||||||
* during the entire class loading process.
|
* during the entire class loading process.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* The <a href="#name">binary name</a> of the class
|
* The <a href="#name">binary name</a> of the class
|
||||||
*
|
*
|
||||||
* @param resolve
|
* @param resolve
|
||||||
* If <tt>true</tt> then resolve the class
|
* If {@code true} then resolve the class
|
||||||
*
|
*
|
||||||
* @return The resulting <tt>Class</tt> object
|
* @return The resulting {@code Class} object
|
||||||
*
|
*
|
||||||
* @throws ClassNotFoundException
|
* @throws ClassNotFoundException
|
||||||
* If the class could not be found
|
* If the class could not be found
|
||||||
@ -606,7 +606,7 @@ public abstract class ClassLoader {
|
|||||||
* @return the lock for class loading operations
|
* @return the lock for class loading operations
|
||||||
*
|
*
|
||||||
* @throws NullPointerException
|
* @throws NullPointerException
|
||||||
* If registered as parallel capable and <tt>className</tt> is null
|
* If registered as parallel capable and {@code className} is null
|
||||||
*
|
*
|
||||||
* @see #loadClass(String, boolean)
|
* @see #loadClass(String, boolean)
|
||||||
*
|
*
|
||||||
@ -667,14 +667,14 @@ public abstract class ClassLoader {
|
|||||||
* Finds the class with the specified <a href="#name">binary name</a>.
|
* Finds the class with the specified <a href="#name">binary name</a>.
|
||||||
* This method should be overridden by class loader implementations that
|
* This method should be overridden by class loader implementations that
|
||||||
* follow the delegation model for loading classes, and will be invoked by
|
* follow the delegation model for loading classes, and will be invoked by
|
||||||
* the {@link #loadClass <tt>loadClass</tt>} method after checking the
|
* the {@link #loadClass loadClass} method after checking the
|
||||||
* parent class loader for the requested class. The default implementation
|
* parent class loader for the requested class. The default implementation
|
||||||
* throws a <tt>ClassNotFoundException</tt>.
|
* throws a {@code ClassNotFoundException}.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* The <a href="#name">binary name</a> of the class
|
* The <a href="#name">binary name</a> of the class
|
||||||
*
|
*
|
||||||
* @return The resulting <tt>Class</tt> object
|
* @return The resulting {@code Class} object
|
||||||
*
|
*
|
||||||
* @throws ClassNotFoundException
|
* @throws ClassNotFoundException
|
||||||
* If the class could not be found
|
* If the class could not be found
|
||||||
@ -722,32 +722,32 @@ public abstract class ClassLoader {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts an array of bytes into an instance of class <tt>Class</tt>.
|
* Converts an array of bytes into an instance of class {@code Class}.
|
||||||
* Before the <tt>Class</tt> can be used it must be resolved. This method
|
* Before the {@code Class} can be used it must be resolved. This method
|
||||||
* is deprecated in favor of the version that takes a <a
|
* is deprecated in favor of the version that takes a <a
|
||||||
* href="#name">binary name</a> as its first argument, and is more secure.
|
* href="#name">binary name</a> as its first argument, and is more secure.
|
||||||
*
|
*
|
||||||
* @param b
|
* @param b
|
||||||
* The bytes that make up the class data. The bytes in positions
|
* The bytes that make up the class data. The bytes in positions
|
||||||
* <tt>off</tt> through <tt>off+len-1</tt> should have the format
|
* {@code off} through {@code off+len-1} should have the format
|
||||||
* of a valid class file as defined by
|
* of a valid class file as defined by
|
||||||
* <cite>The Java™ Virtual Machine Specification</cite>.
|
* <cite>The Java™ Virtual Machine Specification</cite>.
|
||||||
*
|
*
|
||||||
* @param off
|
* @param off
|
||||||
* The start offset in <tt>b</tt> of the class data
|
* The start offset in {@code b} of the class data
|
||||||
*
|
*
|
||||||
* @param len
|
* @param len
|
||||||
* The length of the class data
|
* The length of the class data
|
||||||
*
|
*
|
||||||
* @return The <tt>Class</tt> object that was created from the specified
|
* @return The {@code Class} object that was created from the specified
|
||||||
* class data
|
* class data
|
||||||
*
|
*
|
||||||
* @throws ClassFormatError
|
* @throws ClassFormatError
|
||||||
* If the data did not contain a valid class
|
* If the data did not contain a valid class
|
||||||
*
|
*
|
||||||
* @throws IndexOutOfBoundsException
|
* @throws IndexOutOfBoundsException
|
||||||
* If either <tt>off</tt> or <tt>len</tt> is negative, or if
|
* If either {@code off} or {@code len} is negative, or if
|
||||||
* <tt>off+len</tt> is greater than <tt>b.length</tt>.
|
* {@code off+len} is greater than {@code b.length}.
|
||||||
*
|
*
|
||||||
* @throws SecurityException
|
* @throws SecurityException
|
||||||
* If an attempt is made to add this class to a package that
|
* If an attempt is made to add this class to a package that
|
||||||
@ -994,11 +994,11 @@ public abstract class ClassLoader {
|
|||||||
* #defineClass(String, byte[], int, int, ProtectionDomain)}.
|
* #defineClass(String, byte[], int, int, ProtectionDomain)}.
|
||||||
*
|
*
|
||||||
* <p> An invocation of this method of the form
|
* <p> An invocation of this method of the form
|
||||||
* <i>cl</i><tt>.defineClass(</tt><i>name</i><tt>,</tt>
|
* <i>cl</i>{@code .defineClass(}<i>name</i>{@code ,}
|
||||||
* <i>bBuffer</i><tt>,</tt> <i>pd</i><tt>)</tt> yields exactly the same
|
* <i>bBuffer</i>{@code ,} <i>pd</i>{@code )} yields exactly the same
|
||||||
* result as the statements
|
* result as the statements
|
||||||
*
|
*
|
||||||
*<p> <tt>
|
*<p> <code>
|
||||||
* ...<br>
|
* ...<br>
|
||||||
* byte[] temp = new byte[bBuffer.{@link
|
* byte[] temp = new byte[bBuffer.{@link
|
||||||
* java.nio.ByteBuffer#remaining remaining}()];<br>
|
* java.nio.ByteBuffer#remaining remaining}()];<br>
|
||||||
@ -1007,16 +1007,16 @@ public abstract class ClassLoader {
|
|||||||
* return {@link #defineClass(String, byte[], int, int, ProtectionDomain)
|
* return {@link #defineClass(String, byte[], int, int, ProtectionDomain)
|
||||||
* cl.defineClass}(name, temp, 0,
|
* cl.defineClass}(name, temp, 0,
|
||||||
* temp.length, pd);<br>
|
* temp.length, pd);<br>
|
||||||
* </tt></p>
|
* </code></p>
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* The expected <a href="#name">binary name</a>. of the class, or
|
* The expected <a href="#name">binary name</a>. of the class, or
|
||||||
* <tt>null</tt> if not known
|
* {@code null} if not known
|
||||||
*
|
*
|
||||||
* @param b
|
* @param b
|
||||||
* The bytes that make up the class data. The bytes from positions
|
* The bytes that make up the class data. The bytes from positions
|
||||||
* <tt>b.position()</tt> through <tt>b.position() + b.limit() -1
|
* {@code b.position()} through {@code b.position() + b.limit() -1
|
||||||
* </tt> should have the format of a valid class file as defined by
|
* } should have the format of a valid class file as defined by
|
||||||
* <cite>The Java™ Virtual Machine Specification</cite>.
|
* <cite>The Java™ Virtual Machine Specification</cite>.
|
||||||
*
|
*
|
||||||
* @param protectionDomain
|
* @param protectionDomain
|
||||||
@ -1158,7 +1158,7 @@ public abstract class ClassLoader {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Links the specified class. This (misleadingly named) method may be
|
* Links the specified class. This (misleadingly named) method may be
|
||||||
* used by a class loader to link a class. If the class <tt>c</tt> has
|
* used by a class loader to link a class. If the class {@code c} has
|
||||||
* already been linked, then this method simply returns. Otherwise, the
|
* already been linked, then this method simply returns. Otherwise, the
|
||||||
* class is linked as described in the "Execution" chapter of
|
* class is linked as described in the "Execution" chapter of
|
||||||
* <cite>The Java™ Language Specification</cite>.
|
* <cite>The Java™ Language Specification</cite>.
|
||||||
@ -1167,7 +1167,7 @@ public abstract class ClassLoader {
|
|||||||
* The class to link
|
* The class to link
|
||||||
*
|
*
|
||||||
* @throws NullPointerException
|
* @throws NullPointerException
|
||||||
* If <tt>c</tt> is <tt>null</tt>.
|
* If {@code c} is {@code null}.
|
||||||
*
|
*
|
||||||
* @see #defineClass(String, byte[], int, int)
|
* @see #defineClass(String, byte[], int, int)
|
||||||
*/
|
*/
|
||||||
@ -1182,16 +1182,16 @@ public abstract class ClassLoader {
|
|||||||
* loading it if necessary.
|
* loading it if necessary.
|
||||||
*
|
*
|
||||||
* <p> This method loads the class through the system class loader (see
|
* <p> This method loads the class through the system class loader (see
|
||||||
* {@link #getSystemClassLoader()}). The <tt>Class</tt> object returned
|
* {@link #getSystemClassLoader()}). The {@code Class} object returned
|
||||||
* might have more than one <tt>ClassLoader</tt> associated with it.
|
* might have more than one {@code ClassLoader} associated with it.
|
||||||
* Subclasses of <tt>ClassLoader</tt> need not usually invoke this method,
|
* Subclasses of {@code ClassLoader} need not usually invoke this method,
|
||||||
* because most class loaders need to override just {@link
|
* because most class loaders need to override just {@link
|
||||||
* #findClass(String)}. </p>
|
* #findClass(String)}. </p>
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* The <a href="#name">binary name</a> of the class
|
* The <a href="#name">binary name</a> of the class
|
||||||
*
|
*
|
||||||
* @return The <tt>Class</tt> object for the specified <tt>name</tt>
|
* @return The {@code Class} object for the specified {@code name}
|
||||||
*
|
*
|
||||||
* @throws ClassNotFoundException
|
* @throws ClassNotFoundException
|
||||||
* If the class could not be found
|
* If the class could not be found
|
||||||
@ -1222,12 +1222,12 @@ public abstract class ClassLoader {
|
|||||||
* Returns the class with the given <a href="#name">binary name</a> if this
|
* Returns the class with the given <a href="#name">binary name</a> if this
|
||||||
* loader has been recorded by the Java virtual machine as an initiating
|
* loader has been recorded by the Java virtual machine as an initiating
|
||||||
* loader of a class with that <a href="#name">binary name</a>. Otherwise
|
* loader of a class with that <a href="#name">binary name</a>. Otherwise
|
||||||
* <tt>null</tt> is returned.
|
* {@code null} is returned.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* The <a href="#name">binary name</a> of the class
|
* The <a href="#name">binary name</a> of the class
|
||||||
*
|
*
|
||||||
* @return The <tt>Class</tt> object, or <tt>null</tt> if the class has
|
* @return The {@code Class} object, or {@code null} if the class has
|
||||||
* not been loaded
|
* not been loaded
|
||||||
*
|
*
|
||||||
* @since 1.1
|
* @since 1.1
|
||||||
@ -1245,7 +1245,7 @@ public abstract class ClassLoader {
|
|||||||
* class.
|
* class.
|
||||||
*
|
*
|
||||||
* @param c
|
* @param c
|
||||||
* The <tt>Class</tt> object
|
* The {@code Class} object
|
||||||
*
|
*
|
||||||
* @param signers
|
* @param signers
|
||||||
* The signers for the class
|
* The signers for the class
|
||||||
@ -1306,11 +1306,11 @@ public abstract class ClassLoader {
|
|||||||
* (images, audio, text, etc) that can be accessed by class code in a way
|
* (images, audio, text, etc) that can be accessed by class code in a way
|
||||||
* that is independent of the location of the code.
|
* that is independent of the location of the code.
|
||||||
*
|
*
|
||||||
* <p> The name of a resource is a '<tt>/</tt>'-separated path name that
|
* <p> The name of a resource is a '{@code /}'-separated path name that
|
||||||
* identifies the resource.
|
* identifies the resource.
|
||||||
*
|
*
|
||||||
* <p> This method will first search the parent class loader for the
|
* <p> This method will first search the parent class loader for the
|
||||||
* resource; if the parent is <tt>null</tt> the path of the class loader
|
* resource; if the parent is {@code null} the path of the class loader
|
||||||
* built-in to the virtual machine is searched. That failing, this method
|
* built-in to the virtual machine is searched. That failing, this method
|
||||||
* will invoke {@link #findResource(String)} to find the resource. </p>
|
* will invoke {@link #findResource(String)} to find the resource. </p>
|
||||||
*
|
*
|
||||||
@ -1362,7 +1362,7 @@ public abstract class ClassLoader {
|
|||||||
* (images, audio, text, etc) that can be accessed by class code in a way
|
* (images, audio, text, etc) that can be accessed by class code in a way
|
||||||
* that is independent of the location of the code.
|
* that is independent of the location of the code.
|
||||||
*
|
*
|
||||||
* <p> The name of a resource is a <tt>/</tt>-separated path name that
|
* <p> The name of a resource is a {@code /}-separated path name that
|
||||||
* identifies the resource.
|
* identifies the resource.
|
||||||
*
|
*
|
||||||
* <p> The delegation order for searching is described in the documentation
|
* <p> The delegation order for searching is described in the documentation
|
||||||
@ -1389,7 +1389,7 @@ public abstract class ClassLoader {
|
|||||||
* @param name
|
* @param name
|
||||||
* The resource name
|
* The resource name
|
||||||
*
|
*
|
||||||
* @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for
|
* @return An enumeration of {@link java.net.URL URL} objects for
|
||||||
* the resource. If no resources could be found, the enumeration
|
* the resource. If no resources could be found, the enumeration
|
||||||
* will be empty. Resources for which a {@code URL} cannot be
|
* will be empty. Resources for which a {@code URL} cannot be
|
||||||
* constructed, are in package that is not opened unconditionally,
|
* constructed, are in package that is not opened unconditionally,
|
||||||
@ -1505,7 +1505,7 @@ public abstract class ClassLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an enumeration of {@link java.net.URL <tt>URL</tt>} objects
|
* Returns an enumeration of {@link java.net.URL URL} objects
|
||||||
* representing all the resources with the given name. Class loader
|
* representing all the resources with the given name. Class loader
|
||||||
* implementations should override this method to specify where to load
|
* implementations should override this method to specify where to load
|
||||||
* resources from.
|
* resources from.
|
||||||
@ -1520,7 +1520,7 @@ public abstract class ClassLoader {
|
|||||||
* @param name
|
* @param name
|
||||||
* The resource name
|
* The resource name
|
||||||
*
|
*
|
||||||
* @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for
|
* @return An enumeration of {@link java.net.URL URL} objects for
|
||||||
* the resource. If no resources could be found, the enumeration
|
* the resource. If no resources could be found, the enumeration
|
||||||
* will be empty. Resources for which a {@code URL} cannot be
|
* will be empty. Resources for which a {@code URL} cannot be
|
||||||
* constructed, are in a package that is not opened unconditionally,
|
* constructed, are in a package that is not opened unconditionally,
|
||||||
@ -1594,7 +1594,7 @@ public abstract class ClassLoader {
|
|||||||
* @param name
|
* @param name
|
||||||
* The resource name
|
* The resource name
|
||||||
*
|
*
|
||||||
* @return A {@link java.net.URL <tt>URL</tt>} to the resource; {@code
|
* @return A {@link java.net.URL URL} to the resource; {@code
|
||||||
* null} if the resource could not be found, a URL could not be
|
* null} if the resource could not be found, a URL could not be
|
||||||
* constructed to locate the resource, the resource is in a package
|
* constructed to locate the resource, the resource is in a package
|
||||||
* that is not opened unconditionally or access to the resource is
|
* that is not opened unconditionally or access to the resource is
|
||||||
@ -1609,8 +1609,8 @@ public abstract class ClassLoader {
|
|||||||
/**
|
/**
|
||||||
* Finds all resources of the specified name from the search path used to
|
* Finds all resources of the specified name from the search path used to
|
||||||
* load classes. The resources thus found are returned as an
|
* load classes. The resources thus found are returned as an
|
||||||
* {@link java.util.Enumeration <tt>Enumeration</tt>} of {@link
|
* {@link java.util.Enumeration Enumeration} of {@link
|
||||||
* java.net.URL <tt>URL</tt>} objects.
|
* java.net.URL URL} objects.
|
||||||
*
|
*
|
||||||
* <p> The search order is described in the documentation for {@link
|
* <p> The search order is described in the documentation for {@link
|
||||||
* #getSystemResource(String)}. </p>
|
* #getSystemResource(String)}. </p>
|
||||||
@ -1625,7 +1625,7 @@ public abstract class ClassLoader {
|
|||||||
* @param name
|
* @param name
|
||||||
* The resource name
|
* The resource name
|
||||||
*
|
*
|
||||||
* @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for
|
* @return An enumeration of {@link java.net.URL URL} objects for
|
||||||
* the resource. If no resources could be found, the enumeration
|
* the resource. If no resources could be found, the enumeration
|
||||||
* will be empty. Resources for which a {@code URL} cannot be
|
* will be empty. Resources for which a {@code URL} cannot be
|
||||||
* constructed, are in a package that is not opened unconditionally,
|
* constructed, are in a package that is not opened unconditionally,
|
||||||
@ -1714,11 +1714,11 @@ public abstract class ClassLoader {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the parent class loader for delegation. Some implementations may
|
* Returns the parent class loader for delegation. Some implementations may
|
||||||
* use <tt>null</tt> to represent the bootstrap class loader. This method
|
* use {@code null} to represent the bootstrap class loader. This method
|
||||||
* will return <tt>null</tt> in such implementations if this class loader's
|
* will return {@code null} in such implementations if this class loader's
|
||||||
* parent is the bootstrap class loader.
|
* parent is the bootstrap class loader.
|
||||||
*
|
*
|
||||||
* @return The parent <tt>ClassLoader</tt>
|
* @return The parent {@code ClassLoader}
|
||||||
*
|
*
|
||||||
* @throws SecurityException
|
* @throws SecurityException
|
||||||
* If a security manager is present, and the caller's class loader
|
* If a security manager is present, and the caller's class loader
|
||||||
@ -1785,7 +1785,7 @@ public abstract class ClassLoader {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the system class loader for delegation. This is the default
|
* Returns the system class loader for delegation. This is the default
|
||||||
* delegation parent for new <tt>ClassLoader</tt> instances, and is
|
* delegation parent for new {@code ClassLoader} instances, and is
|
||||||
* typically the class loader used to start the application.
|
* typically the class loader used to start the application.
|
||||||
*
|
*
|
||||||
* <p> This method is first invoked early in the runtime's startup
|
* <p> This method is first invoked early in the runtime's startup
|
||||||
@ -1797,12 +1797,12 @@ public abstract class ClassLoader {
|
|||||||
* <p> The default system class loader is an implementation-dependent
|
* <p> The default system class loader is an implementation-dependent
|
||||||
* instance of this class.
|
* instance of this class.
|
||||||
*
|
*
|
||||||
* <p> If the system property "<tt>java.system.class.loader</tt>" is defined
|
* <p> If the system property "{@code java.system.class.loader}" is defined
|
||||||
* when this method is first invoked then the value of that property is
|
* when this method is first invoked then the value of that property is
|
||||||
* taken to be the name of a class that will be returned as the system
|
* taken to be the name of a class that will be returned as the system
|
||||||
* class loader. The class is loaded using the default system class loader
|
* class loader. The class is loaded using the default system class loader
|
||||||
* and must define a public constructor that takes a single parameter of
|
* and must define a public constructor that takes a single parameter of
|
||||||
* type <tt>ClassLoader</tt> which is used as the delegation parent. An
|
* type {@code ClassLoader} which is used as the delegation parent. An
|
||||||
* instance is then created using this constructor with the default system
|
* instance is then created using this constructor with the default system
|
||||||
* class loader as the parameter. The resulting class loader is defined
|
* class loader as the parameter. The resulting class loader is defined
|
||||||
* to be the system class loader. During construction, the class loader
|
* to be the system class loader. During construction, the class loader
|
||||||
@ -1825,7 +1825,7 @@ public abstract class ClassLoader {
|
|||||||
* the application module path then the class path defaults to
|
* the application module path then the class path defaults to
|
||||||
* the current working directory.
|
* the current working directory.
|
||||||
*
|
*
|
||||||
* @return The system <tt>ClassLoader</tt> for delegation
|
* @return The system {@code ClassLoader} for delegation
|
||||||
*
|
*
|
||||||
* @throws SecurityException
|
* @throws SecurityException
|
||||||
* If a security manager is present, and the caller's class loader
|
* If a security manager is present, and the caller's class loader
|
||||||
@ -1835,11 +1835,11 @@ public abstract class ClassLoader {
|
|||||||
*
|
*
|
||||||
* @throws IllegalStateException
|
* @throws IllegalStateException
|
||||||
* If invoked recursively during the construction of the class
|
* If invoked recursively during the construction of the class
|
||||||
* loader specified by the "<tt>java.system.class.loader</tt>"
|
* loader specified by the "{@code java.system.class.loader}"
|
||||||
* property.
|
* property.
|
||||||
*
|
*
|
||||||
* @throws Error
|
* @throws Error
|
||||||
* If the system property "<tt>java.system.class.loader</tt>"
|
* If the system property "{@code java.system.class.loader}"
|
||||||
* is defined but the named class could not be loaded, the
|
* is defined but the named class could not be loaded, the
|
||||||
* provider class does not define the required constructor, or an
|
* provider class does not define the required constructor, or an
|
||||||
* exception is thrown by that constructor when it is invoked. The
|
* exception is thrown by that constructor when it is invoked. The
|
||||||
@ -2249,9 +2249,9 @@ public abstract class ClassLoader {
|
|||||||
/**
|
/**
|
||||||
* Returns the absolute path name of a native library. The VM invokes this
|
* Returns the absolute path name of a native library. The VM invokes this
|
||||||
* method to locate the native libraries that belong to classes loaded with
|
* method to locate the native libraries that belong to classes loaded with
|
||||||
* this class loader. If this method returns <tt>null</tt>, the VM
|
* this class loader. If this method returns {@code null}, the VM
|
||||||
* searches the library along the path specified as the
|
* searches the library along the path specified as the
|
||||||
* "<tt>java.library.path</tt>" property.
|
* "{@code java.library.path}" property.
|
||||||
*
|
*
|
||||||
* @param libname
|
* @param libname
|
||||||
* The library name
|
* The library name
|
||||||
@ -2270,12 +2270,12 @@ public abstract class ClassLoader {
|
|||||||
/**
|
/**
|
||||||
* The inner class NativeLibrary denotes a loaded native library instance.
|
* The inner class NativeLibrary denotes a loaded native library instance.
|
||||||
* Every classloader contains a vector of loaded native libraries in the
|
* Every classloader contains a vector of loaded native libraries in the
|
||||||
* private field <tt>nativeLibraries</tt>. The native libraries loaded
|
* private field {@code nativeLibraries}. The native libraries loaded
|
||||||
* into the system are entered into the <tt>systemNativeLibraries</tt>
|
* into the system are entered into the {@code systemNativeLibraries}
|
||||||
* vector.
|
* vector.
|
||||||
*
|
*
|
||||||
* <p> Every native library requires a particular version of JNI. This is
|
* <p> Every native library requires a particular version of JNI. This is
|
||||||
* denoted by the private <tt>jniVersion</tt> field. This field is set by
|
* denoted by the private {@code jniVersion} field. This field is set by
|
||||||
* the VM when it loads the library, and used by the VM to pass the correct
|
* the VM when it loads the library, and used by the VM to pass the correct
|
||||||
* version of JNI to the native methods. </p>
|
* version of JNI to the native methods. </p>
|
||||||
*
|
*
|
||||||
@ -2592,8 +2592,8 @@ public abstract class ClassLoader {
|
|||||||
* #setClassAssertionStatus(String, boolean)}.
|
* #setClassAssertionStatus(String, boolean)}.
|
||||||
*
|
*
|
||||||
* @param enabled
|
* @param enabled
|
||||||
* <tt>true</tt> if classes loaded by this class loader will
|
* {@code true} if classes loaded by this class loader will
|
||||||
* henceforth have assertions enabled by default, <tt>false</tt>
|
* henceforth have assertions enabled by default, {@code false}
|
||||||
* if they will have assertions disabled by default.
|
* if they will have assertions disabled by default.
|
||||||
*
|
*
|
||||||
* @since 1.4
|
* @since 1.4
|
||||||
@ -2614,16 +2614,16 @@ public abstract class ClassLoader {
|
|||||||
* any of its "subpackages".
|
* any of its "subpackages".
|
||||||
*
|
*
|
||||||
* <p> A subpackage of a package named p is any package whose name begins
|
* <p> A subpackage of a package named p is any package whose name begins
|
||||||
* with "<tt>p.</tt>". For example, <tt>javax.swing.text</tt> is a
|
* with "{@code p.}". For example, {@code javax.swing.text} is a
|
||||||
* subpackage of <tt>javax.swing</tt>, and both <tt>java.util</tt> and
|
* subpackage of {@code javax.swing}, and both {@code java.util} and
|
||||||
* <tt>java.lang.reflect</tt> are subpackages of <tt>java</tt>.
|
* {@code java.lang.reflect} are subpackages of {@code java}.
|
||||||
*
|
*
|
||||||
* <p> In the event that multiple package defaults apply to a given class,
|
* <p> In the event that multiple package defaults apply to a given class,
|
||||||
* the package default pertaining to the most specific package takes
|
* the package default pertaining to the most specific package takes
|
||||||
* precedence over the others. For example, if <tt>javax.lang</tt> and
|
* precedence over the others. For example, if {@code javax.lang} and
|
||||||
* <tt>javax.lang.reflect</tt> both have package defaults associated with
|
* {@code javax.lang.reflect} both have package defaults associated with
|
||||||
* them, the latter package default applies to classes in
|
* them, the latter package default applies to classes in
|
||||||
* <tt>javax.lang.reflect</tt>.
|
* {@code javax.lang.reflect}.
|
||||||
*
|
*
|
||||||
* <p> Package defaults take precedence over the class loader's default
|
* <p> Package defaults take precedence over the class loader's default
|
||||||
* assertion status, and may be overridden on a per-class basis by invoking
|
* assertion status, and may be overridden on a per-class basis by invoking
|
||||||
@ -2631,15 +2631,15 @@ public abstract class ClassLoader {
|
|||||||
*
|
*
|
||||||
* @param packageName
|
* @param packageName
|
||||||
* The name of the package whose package default assertion status
|
* The name of the package whose package default assertion status
|
||||||
* is to be set. A <tt>null</tt> value indicates the unnamed
|
* is to be set. A {@code null} value indicates the unnamed
|
||||||
* package that is "current"
|
* package that is "current"
|
||||||
* (see section 7.4.2 of
|
* (see section 7.4.2 of
|
||||||
* <cite>The Java™ Language Specification</cite>.)
|
* <cite>The Java™ Language Specification</cite>.)
|
||||||
*
|
*
|
||||||
* @param enabled
|
* @param enabled
|
||||||
* <tt>true</tt> if classes loaded by this classloader and
|
* {@code true} if classes loaded by this classloader and
|
||||||
* belonging to the named package or any of its subpackages will
|
* belonging to the named package or any of its subpackages will
|
||||||
* have assertions enabled by default, <tt>false</tt> if they will
|
* have assertions enabled by default, {@code false} if they will
|
||||||
* have assertions disabled by default.
|
* have assertions disabled by default.
|
||||||
*
|
*
|
||||||
* @since 1.4
|
* @since 1.4
|
||||||
@ -2670,8 +2670,8 @@ public abstract class ClassLoader {
|
|||||||
* assertion status is to be set.
|
* assertion status is to be set.
|
||||||
*
|
*
|
||||||
* @param enabled
|
* @param enabled
|
||||||
* <tt>true</tt> if the named class is to have assertions
|
* {@code true} if the named class is to have assertions
|
||||||
* enabled when (and if) it is initialized, <tt>false</tt> if the
|
* enabled when (and if) it is initialized, {@code false} if the
|
||||||
* class is to have assertions disabled.
|
* class is to have assertions disabled.
|
||||||
*
|
*
|
||||||
* @since 1.4
|
* @since 1.4
|
||||||
@ -2687,7 +2687,7 @@ public abstract class ClassLoader {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the default assertion status for this class loader to
|
* Sets the default assertion status for this class loader to
|
||||||
* <tt>false</tt> and discards any package defaults or class assertion
|
* {@code false} and discards any package defaults or class assertion
|
||||||
* status settings associated with the class loader. This method is
|
* status settings associated with the class loader. This method is
|
||||||
* provided so that class loaders can be made to ignore any command line or
|
* provided so that class loaders can be made to ignore any command line or
|
||||||
* persistent assertion status settings and "start with a clean slate."
|
* persistent assertion status settings and "start with a clean slate."
|
||||||
|
@ -30,8 +30,10 @@ import java.io.InputStream;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.security.PrivilegedAction;
|
import java.security.PrivilegedAction;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.ServiceConfigurationError;
|
import java.util.ServiceConfigurationError;
|
||||||
import java.util.ServiceLoader;
|
import java.util.ServiceLoader;
|
||||||
@ -231,7 +233,7 @@ public abstract class URLConnection {
|
|||||||
*/
|
*/
|
||||||
protected boolean allowUserInteraction = defaultAllowUserInteraction;
|
protected boolean allowUserInteraction = defaultAllowUserInteraction;
|
||||||
|
|
||||||
private static boolean defaultUseCaches = true;
|
private static volatile boolean defaultUseCaches = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If {@code true}, the protocol is allowed to use caching
|
* If {@code true}, the protocol is allowed to use caching
|
||||||
@ -243,12 +245,18 @@ public abstract class URLConnection {
|
|||||||
* <p>
|
* <p>
|
||||||
* Its default value is the value given in the last invocation of the
|
* Its default value is the value given in the last invocation of the
|
||||||
* {@code setDefaultUseCaches} method.
|
* {@code setDefaultUseCaches} method.
|
||||||
|
* <p>
|
||||||
|
* The default setting may be overridden per protocol with
|
||||||
|
* {@link #setDefaultUseCaches(String,boolean)}.
|
||||||
*
|
*
|
||||||
* @see java.net.URLConnection#setUseCaches(boolean)
|
* @see java.net.URLConnection#setUseCaches(boolean)
|
||||||
* @see java.net.URLConnection#getUseCaches()
|
* @see java.net.URLConnection#getUseCaches()
|
||||||
* @see java.net.URLConnection#setDefaultUseCaches(boolean)
|
* @see java.net.URLConnection#setDefaultUseCaches(boolean)
|
||||||
*/
|
*/
|
||||||
protected boolean useCaches = defaultUseCaches;
|
protected boolean useCaches;
|
||||||
|
|
||||||
|
private static final ConcurrentHashMap<String,Boolean> defaultCaching =
|
||||||
|
new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some protocols support skipping the fetching of the object unless
|
* Some protocols support skipping the fetching of the object unless
|
||||||
@ -460,6 +468,11 @@ public abstract class URLConnection {
|
|||||||
*/
|
*/
|
||||||
protected URLConnection(URL url) {
|
protected URLConnection(URL url) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
|
if (url == null) {
|
||||||
|
this.useCaches = defaultUseCaches;
|
||||||
|
} else {
|
||||||
|
this.useCaches = getDefaultUseCaches(url.getProtocol());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -981,7 +994,8 @@ public abstract class URLConnection {
|
|||||||
* is true, the connection is allowed to use whatever caches it can.
|
* is true, the connection is allowed to use whatever caches it can.
|
||||||
* If false, caches are to be ignored.
|
* If false, caches are to be ignored.
|
||||||
* The default value comes from DefaultUseCaches, which defaults to
|
* The default value comes from DefaultUseCaches, which defaults to
|
||||||
* true.
|
* true. A default value can also be set per-protocol using
|
||||||
|
* {@link #setDefaultUseCaches(String,boolean)}.
|
||||||
*
|
*
|
||||||
* @param usecaches a {@code boolean} indicating whether
|
* @param usecaches a {@code boolean} indicating whether
|
||||||
* or not to allow caching
|
* or not to allow caching
|
||||||
@ -1032,9 +1046,10 @@ public abstract class URLConnection {
|
|||||||
* Returns the default value of a {@code URLConnection}'s
|
* Returns the default value of a {@code URLConnection}'s
|
||||||
* {@code useCaches} flag.
|
* {@code useCaches} flag.
|
||||||
* <p>
|
* <p>
|
||||||
* Ths default is "sticky", being a part of the static state of all
|
* This default is "sticky", being a part of the static state of all
|
||||||
* URLConnections. This flag applies to the next, and all following
|
* URLConnections. This flag applies to the next, and all following
|
||||||
* URLConnections that are created.
|
* URLConnections that are created. This default value can be over-ridden
|
||||||
|
* per protocol using {@link #setDefaultUseCaches(String,boolean)}
|
||||||
*
|
*
|
||||||
* @return the default value of a {@code URLConnection}'s
|
* @return the default value of a {@code URLConnection}'s
|
||||||
* {@code useCaches} flag.
|
* {@code useCaches} flag.
|
||||||
@ -1046,7 +1061,8 @@ public abstract class URLConnection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the default value of the {@code useCaches} field to the
|
* Sets the default value of the {@code useCaches} field to the
|
||||||
* specified value.
|
* specified value. This default value can be over-ridden
|
||||||
|
* per protocol using {@link #setDefaultUseCaches(String,boolean)}
|
||||||
*
|
*
|
||||||
* @param defaultusecaches the new value.
|
* @param defaultusecaches the new value.
|
||||||
* @see #getDefaultUseCaches()
|
* @see #getDefaultUseCaches()
|
||||||
@ -1055,6 +1071,43 @@ public abstract class URLConnection {
|
|||||||
defaultUseCaches = defaultusecaches;
|
defaultUseCaches = defaultusecaches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the default value of the {@code useCaches} field for the named
|
||||||
|
* protocol to the given value. This value overrides any default setting
|
||||||
|
* set by {@link #setDefaultUseCaches(boolean)} for the given protocol.
|
||||||
|
* Successive calls to this method change the setting and affect the
|
||||||
|
* default value for all future connections of that protocol. The protocol
|
||||||
|
* name is case insensitive.
|
||||||
|
*
|
||||||
|
* @param protocol the protocol to set the default for
|
||||||
|
* @param defaultVal whether caching is enabled by default for the given protocol
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
public static void setDefaultUseCaches(String protocol, boolean defaultVal) {
|
||||||
|
protocol = protocol.toLowerCase(Locale.US);
|
||||||
|
defaultCaching.put(protocol, defaultVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the default value of the {@code useCaches} flag for the given protocol. If
|
||||||
|
* {@link #setDefaultUseCaches(String,boolean)} was called for the given protocol,
|
||||||
|
* then that value is returned. Otherwise, if {@link #setDefaultUseCaches(boolean)}
|
||||||
|
* was called, then that value is returned. If neither method was called,
|
||||||
|
* the return value is {@code true}. The protocol name is case insensitive.
|
||||||
|
*
|
||||||
|
* @param protocol the protocol whose defaultUseCaches setting is required
|
||||||
|
* @return the default value of the {@code useCaches} flag for the given protocol.
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
public static boolean getDefaultUseCaches(String protocol) {
|
||||||
|
Boolean protoDefault = defaultCaching.get(protocol.toLowerCase(Locale.US));
|
||||||
|
if (protoDefault != null) {
|
||||||
|
return protoDefault.booleanValue();
|
||||||
|
} else {
|
||||||
|
return defaultUseCaches;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the general request property. If a property with the key already
|
* Sets the general request property. If a property with the key already
|
||||||
* exists, overwrite its value with the new value.
|
* exists, overwrite its value with the new value.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -4354,6 +4354,11 @@ public class Collections {
|
|||||||
private Object readResolve() {
|
private Object readResolve() {
|
||||||
return EMPTY_SET;
|
return EMPTY_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -4786,6 +4791,10 @@ public class Collections {
|
|||||||
public boolean removeIf(Predicate<? super E> filter) {
|
public boolean removeIf(Predicate<? super E> filter) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hashCode(element);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -4848,6 +4857,10 @@ public class Collections {
|
|||||||
public Spliterator<E> spliterator() {
|
public Spliterator<E> spliterator() {
|
||||||
return singletonSpliterator(element);
|
return singletonSpliterator(element);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return 31 + Objects.hashCode(element);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -4970,6 +4983,11 @@ public class Collections {
|
|||||||
BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
|
BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hashCode(k) ^ Objects.hashCode(v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
|
@ -82,17 +82,19 @@ import sun.util.calendar.ZoneInfo;
|
|||||||
* well; for example, the time scale used by the satellite-based
|
* well; for example, the time scale used by the satellite-based
|
||||||
* global positioning system (GPS) is synchronized to UTC but is
|
* global positioning system (GPS) is synchronized to UTC but is
|
||||||
* <i>not</i> adjusted for leap seconds. An interesting source of
|
* <i>not</i> adjusted for leap seconds. An interesting source of
|
||||||
* further information is the U.S. Naval Observatory, particularly
|
* further information is the United States Naval Observatory (USNO):
|
||||||
* the Directorate of Time at:
|
|
||||||
* <blockquote><pre>
|
* <blockquote><pre>
|
||||||
* <a href="http://www.usno.navy.mil">http://www.usno.navy.mil</a>
|
* <a href="http://www.usno.navy.mil/USNO">http://www.usno.navy.mil/USNO</a>
|
||||||
* </pre></blockquote>
|
* </pre></blockquote>
|
||||||
* <p>
|
* <p>
|
||||||
* and their definitions of "Systems of Time" at:
|
* and the material regarding "Systems of Time" at:
|
||||||
* <blockquote><pre>
|
* <blockquote><pre>
|
||||||
* <a href="http://www.usno.navy.mil/USNO/time/master-clock/systems-of-time">http://www.usno.navy.mil/USNO/time/master-clock/systems-of-time</a>
|
* <a href="http://www.usno.navy.mil/USNO/time/master-clock/systems-of-time">http://www.usno.navy.mil/USNO/time/master-clock/systems-of-time</a>
|
||||||
* </pre></blockquote>
|
* </pre></blockquote>
|
||||||
* <p>
|
* <p>
|
||||||
|
* which has descriptions of various different time systems including
|
||||||
|
* UT, UT1, and UTC.
|
||||||
|
* <p>
|
||||||
* In all methods of class {@code Date} that accept or return
|
* In all methods of class {@code Date} that accept or return
|
||||||
* year, month, date, hours, minutes, and seconds values, the
|
* year, month, date, hours, minutes, and seconds values, the
|
||||||
* following representations are used:
|
* following representations are used:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -35,6 +35,7 @@ import java.util.function.BiFunction;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.function.UnaryOperator;
|
import java.util.function.UnaryOperator;
|
||||||
|
import jdk.internal.vm.annotation.Stable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Container class for immutable collections. Not part of the public API.
|
* Container class for immutable collections. Not part of the public API.
|
||||||
@ -105,6 +106,11 @@ class ImmutableCollections {
|
|||||||
return null; // but the compiler doesn't know this
|
return null; // but the compiler doesn't know this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterator<E> iterator() {
|
||||||
|
return Collections.emptyIterator();
|
||||||
|
}
|
||||||
|
|
||||||
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||||
throw new InvalidObjectException("not serial proxy");
|
throw new InvalidObjectException("not serial proxy");
|
||||||
}
|
}
|
||||||
@ -112,9 +118,26 @@ class ImmutableCollections {
|
|||||||
private Object writeReplace() {
|
private Object writeReplace() {
|
||||||
return new CollSer(CollSer.IMM_LIST);
|
return new CollSer(CollSer.IMM_LIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean contains(Object o) {
|
||||||
|
Objects.requireNonNull(o);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean containsAll(Collection<?> o) {
|
||||||
|
return o.isEmpty(); // implicit nullcheck of o
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static final class List1<E> extends AbstractImmutableList<E> {
|
static final class List1<E> extends AbstractImmutableList<E> {
|
||||||
|
@Stable
|
||||||
private final E e0;
|
private final E e0;
|
||||||
|
|
||||||
List1(E e0) {
|
List1(E e0) {
|
||||||
@ -129,7 +152,6 @@ class ImmutableCollections {
|
|||||||
@Override
|
@Override
|
||||||
public E get(int index) {
|
public E get(int index) {
|
||||||
Objects.checkIndex(index, 1);
|
Objects.checkIndex(index, 1);
|
||||||
// assert index == 0
|
|
||||||
return e0;
|
return e0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,10 +162,22 @@ class ImmutableCollections {
|
|||||||
private Object writeReplace() {
|
private Object writeReplace() {
|
||||||
return new CollSer(CollSer.IMM_LIST, e0);
|
return new CollSer(CollSer.IMM_LIST, e0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean contains(Object o) {
|
||||||
|
return o.equals(e0); // implicit nullcheck of o
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return 31 + e0.hashCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static final class List2<E> extends AbstractImmutableList<E> {
|
static final class List2<E> extends AbstractImmutableList<E> {
|
||||||
|
@Stable
|
||||||
private final E e0;
|
private final E e0;
|
||||||
|
@Stable
|
||||||
private final E e1;
|
private final E e1;
|
||||||
|
|
||||||
List2(E e0, E e1) {
|
List2(E e0, E e1) {
|
||||||
@ -166,6 +200,17 @@ class ImmutableCollections {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean contains(Object o) {
|
||||||
|
return o.equals(e0) || o.equals(e1); // implicit nullcheck of o
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 31 + e0.hashCode();
|
||||||
|
return 31 * hash + e1.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||||
throw new InvalidObjectException("not serial proxy");
|
throw new InvalidObjectException("not serial proxy");
|
||||||
}
|
}
|
||||||
@ -176,6 +221,7 @@ class ImmutableCollections {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static final class ListN<E> extends AbstractImmutableList<E> {
|
static final class ListN<E> extends AbstractImmutableList<E> {
|
||||||
|
@Stable
|
||||||
private final E[] elements;
|
private final E[] elements;
|
||||||
|
|
||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
@ -200,6 +246,25 @@ class ImmutableCollections {
|
|||||||
return elements[index];
|
return elements[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean contains(Object o) {
|
||||||
|
for (E e : elements) {
|
||||||
|
if (o.equals(e)) { // implicit nullcheck of o
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 1;
|
||||||
|
for (E e : elements) {
|
||||||
|
hash = 31 * hash + e.hashCode();
|
||||||
|
}
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||||
throw new InvalidObjectException("not serial proxy");
|
throw new InvalidObjectException("not serial proxy");
|
||||||
}
|
}
|
||||||
@ -238,7 +303,13 @@ class ImmutableCollections {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(Object o) {
|
public boolean contains(Object o) {
|
||||||
return super.contains(Objects.requireNonNull(o));
|
Objects.requireNonNull(o);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean containsAll(Collection<?> o) {
|
||||||
|
return o.isEmpty(); // implicit nullcheck of o
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -253,9 +324,15 @@ class ImmutableCollections {
|
|||||||
private Object writeReplace() {
|
private Object writeReplace() {
|
||||||
return new CollSer(CollSer.IMM_SET);
|
return new CollSer(CollSer.IMM_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static final class Set1<E> extends AbstractImmutableSet<E> {
|
static final class Set1<E> extends AbstractImmutableSet<E> {
|
||||||
|
@Stable
|
||||||
private final E e0;
|
private final E e0;
|
||||||
|
|
||||||
Set1(E e0) {
|
Set1(E e0) {
|
||||||
@ -269,7 +346,7 @@ class ImmutableCollections {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(Object o) {
|
public boolean contains(Object o) {
|
||||||
return super.contains(Objects.requireNonNull(o));
|
return o.equals(e0); // implicit nullcheck of o
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -284,17 +361,21 @@ class ImmutableCollections {
|
|||||||
private Object writeReplace() {
|
private Object writeReplace() {
|
||||||
return new CollSer(CollSer.IMM_SET, e0);
|
return new CollSer(CollSer.IMM_SET, e0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return e0.hashCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static final class Set2<E> extends AbstractImmutableSet<E> {
|
static final class Set2<E> extends AbstractImmutableSet<E> {
|
||||||
private final E e0;
|
@Stable
|
||||||
private final E e1;
|
final E e0;
|
||||||
|
@Stable
|
||||||
|
final E e1;
|
||||||
|
|
||||||
Set2(E e0, E e1) {
|
Set2(E e0, E e1) {
|
||||||
Objects.requireNonNull(e0);
|
if (e0.equals(Objects.requireNonNull(e1))) { // implicit nullcheck of e0
|
||||||
Objects.requireNonNull(e1);
|
|
||||||
|
|
||||||
if (e0.equals(e1)) {
|
|
||||||
throw new IllegalArgumentException("duplicate element: " + e0);
|
throw new IllegalArgumentException("duplicate element: " + e0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,7 +395,12 @@ class ImmutableCollections {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(Object o) {
|
public boolean contains(Object o) {
|
||||||
return super.contains(Objects.requireNonNull(o));
|
return o.equals(e0) || o.equals(e1); // implicit nullcheck of o
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return e0.hashCode() + e1.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -358,8 +444,10 @@ class ImmutableCollections {
|
|||||||
* @param <E> the element type
|
* @param <E> the element type
|
||||||
*/
|
*/
|
||||||
static final class SetN<E> extends AbstractImmutableSet<E> {
|
static final class SetN<E> extends AbstractImmutableSet<E> {
|
||||||
private final E[] elements;
|
@Stable
|
||||||
private final int size;
|
final E[] elements;
|
||||||
|
@Stable
|
||||||
|
final int size;
|
||||||
|
|
||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -368,8 +456,8 @@ class ImmutableCollections {
|
|||||||
|
|
||||||
elements = (E[])new Object[EXPAND_FACTOR * input.length];
|
elements = (E[])new Object[EXPAND_FACTOR * input.length];
|
||||||
for (int i = 0; i < input.length; i++) {
|
for (int i = 0; i < input.length; i++) {
|
||||||
E e = Objects.requireNonNull(input[i]);
|
E e = input[i];
|
||||||
int idx = probe(e);
|
int idx = probe(e); // implicit nullcheck of e
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
throw new IllegalArgumentException("duplicate element: " + e);
|
throw new IllegalArgumentException("duplicate element: " + e);
|
||||||
} else {
|
} else {
|
||||||
@ -385,8 +473,7 @@ class ImmutableCollections {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(Object o) {
|
public boolean contains(Object o) {
|
||||||
Objects.requireNonNull(o);
|
return probe(o) >= 0; // implicit nullcheck of o
|
||||||
return probe(o) >= 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -414,8 +501,21 @@ class ImmutableCollections {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int h = 0;
|
||||||
|
for (E e : elements) {
|
||||||
|
if (e != null) {
|
||||||
|
h += e.hashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
// returns index at which element is present; or if absent,
|
// returns index at which element is present; or if absent,
|
||||||
// (-i - 1) where i is location where element should be inserted
|
// (-i - 1) where i is location where element should be inserted.
|
||||||
|
// Callers are relying on this method to perform an implicit nullcheck
|
||||||
|
// of pe
|
||||||
private int probe(Object pe) {
|
private int probe(Object pe) {
|
||||||
int idx = Math.floorMod(pe.hashCode() ^ SALT, elements.length);
|
int idx = Math.floorMod(pe.hashCode() ^ SALT, elements.length);
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -481,12 +581,14 @@ class ImmutableCollections {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsKey(Object o) {
|
public boolean containsKey(Object o) {
|
||||||
return super.containsKey(Objects.requireNonNull(o));
|
Objects.requireNonNull(o);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsValue(Object o) {
|
public boolean containsValue(Object o) {
|
||||||
return super.containsValue(Objects.requireNonNull(o));
|
Objects.requireNonNull(o);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||||
@ -496,10 +598,17 @@ class ImmutableCollections {
|
|||||||
private Object writeReplace() {
|
private Object writeReplace() {
|
||||||
return new CollSer(CollSer.IMM_MAP);
|
return new CollSer(CollSer.IMM_MAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static final class Map1<K,V> extends AbstractImmutableMap<K,V> {
|
static final class Map1<K,V> extends AbstractImmutableMap<K,V> {
|
||||||
|
@Stable
|
||||||
private final K k0;
|
private final K k0;
|
||||||
|
@Stable
|
||||||
private final V v0;
|
private final V v0;
|
||||||
|
|
||||||
Map1(K k0, V v0) {
|
Map1(K k0, V v0) {
|
||||||
@ -514,12 +623,12 @@ class ImmutableCollections {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsKey(Object o) {
|
public boolean containsKey(Object o) {
|
||||||
return super.containsKey(Objects.requireNonNull(o));
|
return o.equals(k0); // implicit nullcheck of o
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsValue(Object o) {
|
public boolean containsValue(Object o) {
|
||||||
return super.containsValue(Objects.requireNonNull(o));
|
return o.equals(v0); // implicit nullcheck of o
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||||
@ -529,6 +638,11 @@ class ImmutableCollections {
|
|||||||
private Object writeReplace() {
|
private Object writeReplace() {
|
||||||
return new CollSer(CollSer.IMM_MAP, k0, v0);
|
return new CollSer(CollSer.IMM_MAP, k0, v0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return k0.hashCode() ^ v0.hashCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -541,12 +655,13 @@ class ImmutableCollections {
|
|||||||
* @param <V> the value type
|
* @param <V> the value type
|
||||||
*/
|
*/
|
||||||
static final class MapN<K,V> extends AbstractImmutableMap<K,V> {
|
static final class MapN<K,V> extends AbstractImmutableMap<K,V> {
|
||||||
private final Object[] table; // pairs of key, value
|
@Stable
|
||||||
private final int size; // number of pairs
|
final Object[] table; // pairs of key, value
|
||||||
|
@Stable
|
||||||
|
final int size; // number of pairs
|
||||||
|
|
||||||
MapN(Object... input) {
|
MapN(Object... input) {
|
||||||
Objects.requireNonNull(input);
|
if ((input.length & 1) != 0) { // implicit nullcheck of input
|
||||||
if ((input.length & 1) != 0) {
|
|
||||||
throw new InternalError("length is odd");
|
throw new InternalError("length is odd");
|
||||||
}
|
}
|
||||||
size = input.length >> 1;
|
size = input.length >> 1;
|
||||||
@ -573,12 +688,30 @@ class ImmutableCollections {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsKey(Object o) {
|
public boolean containsKey(Object o) {
|
||||||
return probe(Objects.requireNonNull(o)) >= 0;
|
return probe(o) >= 0; // implicit nullcheck of o
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsValue(Object o) {
|
public boolean containsValue(Object o) {
|
||||||
return super.containsValue(Objects.requireNonNull(o));
|
for (int i = 1; i < table.length; i += 2) {
|
||||||
|
Object v = table[i];
|
||||||
|
if (v != null && o.equals(v)) { // implicit nullcheck of o
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 0;
|
||||||
|
for (int i = 0; i < table.length; i += 2) {
|
||||||
|
Object k = table[i];
|
||||||
|
if (k != null) {
|
||||||
|
hash += k.hashCode() ^ table[i + 1].hashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -638,7 +771,9 @@ class ImmutableCollections {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// returns index at which the probe key is present; or if absent,
|
// returns index at which the probe key is present; or if absent,
|
||||||
// (-i - 1) where i is location where element should be inserted
|
// (-i - 1) where i is location where element should be inserted.
|
||||||
|
// Callers are relying on this method to perform an implicit nullcheck
|
||||||
|
// of pk.
|
||||||
private int probe(Object pk) {
|
private int probe(Object pk) {
|
||||||
int idx = Math.floorMod(pk.hashCode() ^ SALT, table.length >> 1) << 1;
|
int idx = Math.floorMod(pk.hashCode() ^ SALT, table.length >> 1) << 1;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
package java.util;
|
package java.util;
|
||||||
|
|
||||||
|
import jdk.internal.vm.annotation.Stable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An immutable container for a key and a value, suitable for use
|
* An immutable container for a key and a value, suitable for use
|
||||||
* in creating and populating {@code Map} instances.
|
* in creating and populating {@code Map} instances.
|
||||||
@ -48,7 +50,9 @@ package java.util;
|
|||||||
* @since 9
|
* @since 9
|
||||||
*/
|
*/
|
||||||
final class KeyValueHolder<K,V> implements Map.Entry<K,V> {
|
final class KeyValueHolder<K,V> implements Map.Entry<K,V> {
|
||||||
|
@Stable
|
||||||
final K key;
|
final K key;
|
||||||
|
@Stable
|
||||||
final V value;
|
final V value;
|
||||||
|
|
||||||
KeyValueHolder(K k, V v) {
|
KeyValueHolder(K k, V v) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -1027,8 +1027,7 @@ public interface List<E> extends Collection<E> {
|
|||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
@SuppressWarnings("varargs")
|
@SuppressWarnings("varargs")
|
||||||
static <E> List<E> of(E... elements) {
|
static <E> List<E> of(E... elements) {
|
||||||
Objects.requireNonNull(elements);
|
switch (elements.length) { // implicit null check of elements
|
||||||
switch (elements.length) {
|
|
||||||
case 0:
|
case 0:
|
||||||
return ImmutableCollections.List0.instance();
|
return ImmutableCollections.List0.instance();
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -1602,8 +1602,7 @@ public interface Map<K, V> {
|
|||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
@SuppressWarnings("varargs")
|
@SuppressWarnings("varargs")
|
||||||
static <K, V> Map<K, V> ofEntries(Entry<? extends K, ? extends V>... entries) {
|
static <K, V> Map<K, V> ofEntries(Entry<? extends K, ? extends V>... entries) {
|
||||||
Objects.requireNonNull(entries);
|
if (entries.length == 0) { // implicit null check of entries
|
||||||
if (entries.length == 0) {
|
|
||||||
return ImmutableCollections.Map0.instance();
|
return ImmutableCollections.Map0.instance();
|
||||||
} else if (entries.length == 1) {
|
} else if (entries.length == 1) {
|
||||||
return new ImmutableCollections.Map1<>(entries[0].getKey(),
|
return new ImmutableCollections.Map1<>(entries[0].getKey(),
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -689,8 +689,7 @@ public interface Set<E> extends Collection<E> {
|
|||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
@SuppressWarnings("varargs")
|
@SuppressWarnings("varargs")
|
||||||
static <E> Set<E> of(E... elements) {
|
static <E> Set<E> of(E... elements) {
|
||||||
Objects.requireNonNull(elements);
|
switch (elements.length) { // implicit null check of elements
|
||||||
switch (elements.length) {
|
|
||||||
case 0:
|
case 0:
|
||||||
return ImmutableCollections.Set0.instance();
|
return ImmutableCollections.Set0.instance();
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -0,0 +1,312 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation. Oracle designates this
|
||||||
|
* particular file as subject to the "Classpath" exception as provided
|
||||||
|
* by Oracle in the LICENSE file that accompanied this code.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package jdk.internal.module;
|
||||||
|
|
||||||
|
import java.io.PrintStream;
|
||||||
|
import java.lang.module.Configuration;
|
||||||
|
import java.lang.module.ResolvedModule;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Deque;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import static java.util.stream.Collectors.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Builder to compute ModuleHashes from a given configuration
|
||||||
|
*/
|
||||||
|
public class ModuleHashesBuilder {
|
||||||
|
private final Configuration configuration;
|
||||||
|
private final Set<String> hashModuleCandidates;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a ModuleHashesBuilder that finds the packaged modules
|
||||||
|
* from the location of ModuleReference found from the given Configuration.
|
||||||
|
*
|
||||||
|
* @param config Configuration for building module hashes
|
||||||
|
* @param modules the candidate modules to be hashed
|
||||||
|
*/
|
||||||
|
public ModuleHashesBuilder(Configuration config, Set<String> modules) {
|
||||||
|
this.configuration = config;
|
||||||
|
this.hashModuleCandidates = modules;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a map of a module M to ModuleHashes for the modules
|
||||||
|
* that depend upon M directly or indirectly.
|
||||||
|
*
|
||||||
|
* The key for each entry in the returned map is a module M that has
|
||||||
|
* no outgoing edges to any of the candidate modules to be hashed
|
||||||
|
* i.e. M is a leaf node in a connected subgraph containing M and
|
||||||
|
* other candidate modules from the module graph filtering
|
||||||
|
* the outgoing edges from M to non-candidate modules.
|
||||||
|
*/
|
||||||
|
public Map<String, ModuleHashes> computeHashes(Set<String> roots) {
|
||||||
|
// build a graph containing the the packaged modules and
|
||||||
|
// its transitive dependences matching --hash-modules
|
||||||
|
Graph.Builder<String> builder = new Graph.Builder<>();
|
||||||
|
Deque<ResolvedModule> deque = new ArrayDeque<>(configuration.modules());
|
||||||
|
Set<ResolvedModule> visited = new HashSet<>();
|
||||||
|
while (!deque.isEmpty()) {
|
||||||
|
ResolvedModule rm = deque.pop();
|
||||||
|
if (!visited.contains(rm)) {
|
||||||
|
visited.add(rm);
|
||||||
|
builder.addNode(rm.name());
|
||||||
|
for (ResolvedModule dm : rm.reads()) {
|
||||||
|
if (!visited.contains(dm)) {
|
||||||
|
deque.push(dm);
|
||||||
|
}
|
||||||
|
builder.addEdge(rm.name(), dm.name());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// each node in a transposed graph is a matching packaged module
|
||||||
|
// in which the hash of the modules that depend upon it is recorded
|
||||||
|
Graph<String> transposedGraph = builder.build().transpose();
|
||||||
|
|
||||||
|
// traverse the modules in topological order that will identify
|
||||||
|
// the modules to record the hashes - it is the first matching
|
||||||
|
// module and has not been hashed during the traversal.
|
||||||
|
Set<String> mods = new HashSet<>();
|
||||||
|
Map<String, ModuleHashes> hashes = new HashMap<>();
|
||||||
|
builder.build()
|
||||||
|
.orderedNodes()
|
||||||
|
.filter(mn -> roots.contains(mn) && !mods.contains(mn))
|
||||||
|
.forEach(mn -> {
|
||||||
|
// Compute hashes of the modules that depend on mn directly and
|
||||||
|
// indirectly excluding itself.
|
||||||
|
Set<String> ns = transposedGraph.dfs(mn)
|
||||||
|
.stream()
|
||||||
|
.filter(n -> !n.equals(mn) && hashModuleCandidates.contains(n))
|
||||||
|
.collect(toSet());
|
||||||
|
mods.add(mn);
|
||||||
|
mods.addAll(ns);
|
||||||
|
|
||||||
|
if (!ns.isEmpty()) {
|
||||||
|
Map<String, Path> moduleToPath = ns.stream()
|
||||||
|
.collect(toMap(Function.identity(), this::moduleToPath));
|
||||||
|
hashes.put(mn, ModuleHashes.generate(moduleToPath, "SHA-256"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return hashes;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Path moduleToPath(String name) {
|
||||||
|
ResolvedModule rm = configuration.findModule(name).orElseThrow(
|
||||||
|
() -> new InternalError("Selected module " + name + " not on module path"));
|
||||||
|
|
||||||
|
URI uri = rm.reference().location().get();
|
||||||
|
Path path = Paths.get(uri);
|
||||||
|
String fn = path.getFileName().toString();
|
||||||
|
if (!fn.endsWith(".jar") && !fn.endsWith(".jmod")) {
|
||||||
|
throw new UnsupportedOperationException(path + " is not a modular JAR or jmod file");
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Utilty class
|
||||||
|
*/
|
||||||
|
static class Graph<T> {
|
||||||
|
private final Set<T> nodes;
|
||||||
|
private final Map<T, Set<T>> edges;
|
||||||
|
|
||||||
|
public Graph(Set<T> nodes, Map<T, Set<T>> edges) {
|
||||||
|
this.nodes = Collections.unmodifiableSet(nodes);
|
||||||
|
this.edges = Collections.unmodifiableMap(edges);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<T> nodes() {
|
||||||
|
return nodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<T, Set<T>> edges() {
|
||||||
|
return edges;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<T> adjacentNodes(T u) {
|
||||||
|
return edges.get(u);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains(T u) {
|
||||||
|
return nodes.contains(u);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns nodes sorted in topological order.
|
||||||
|
*/
|
||||||
|
public Stream<T> orderedNodes() {
|
||||||
|
TopoSorter<T> sorter = new TopoSorter<>(this);
|
||||||
|
return sorter.result.stream();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Traverse this graph and performs the given action in topological order
|
||||||
|
*/
|
||||||
|
public void ordered(Consumer<T> action) {
|
||||||
|
TopoSorter<T> sorter = new TopoSorter<>(this);
|
||||||
|
sorter.ordered(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Traverses this graph and performs the given action in reverse topological order
|
||||||
|
*/
|
||||||
|
public void reverse(Consumer<T> action) {
|
||||||
|
TopoSorter<T> sorter = new TopoSorter<>(this);
|
||||||
|
sorter.reverse(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a transposed graph from this graph
|
||||||
|
*/
|
||||||
|
public Graph<T> transpose() {
|
||||||
|
Builder<T> builder = new Builder<>();
|
||||||
|
nodes.stream().forEach(builder::addNode);
|
||||||
|
// reverse edges
|
||||||
|
edges.keySet().forEach(u -> {
|
||||||
|
edges.get(u).stream()
|
||||||
|
.forEach(v -> builder.addEdge(v, u));
|
||||||
|
});
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all nodes reachable from the given root.
|
||||||
|
*/
|
||||||
|
public Set<T> dfs(T root) {
|
||||||
|
return dfs(Set.of(root));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all nodes reachable from the given set of roots.
|
||||||
|
*/
|
||||||
|
public Set<T> dfs(Set<T> roots) {
|
||||||
|
Deque<T> deque = new LinkedList<>(roots);
|
||||||
|
Set<T> visited = new HashSet<>();
|
||||||
|
while (!deque.isEmpty()) {
|
||||||
|
T u = deque.pop();
|
||||||
|
if (!visited.contains(u)) {
|
||||||
|
visited.add(u);
|
||||||
|
if (contains(u)) {
|
||||||
|
adjacentNodes(u).stream()
|
||||||
|
.filter(v -> !visited.contains(v))
|
||||||
|
.forEach(deque::push);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return visited;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void printGraph(PrintStream out) {
|
||||||
|
out.println("graph for " + nodes);
|
||||||
|
nodes.stream()
|
||||||
|
.forEach(u -> adjacentNodes(u).stream()
|
||||||
|
.forEach(v -> out.format(" %s -> %s%n", u, v)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Builder<T> {
|
||||||
|
final Set<T> nodes = new HashSet<>();
|
||||||
|
final Map<T, Set<T>> edges = new HashMap<>();
|
||||||
|
|
||||||
|
public void addNode(T node) {
|
||||||
|
if (nodes.contains(node)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
nodes.add(node);
|
||||||
|
edges.computeIfAbsent(node, _e -> new HashSet<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addEdge(T u, T v) {
|
||||||
|
addNode(u);
|
||||||
|
addNode(v);
|
||||||
|
edges.get(u).add(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Graph<T> build() {
|
||||||
|
return new Graph<T>(nodes, edges);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Topological sort
|
||||||
|
*/
|
||||||
|
private static class TopoSorter<T> {
|
||||||
|
final Deque<T> result = new LinkedList<>();
|
||||||
|
final Deque<T> nodes;
|
||||||
|
final Graph<T> graph;
|
||||||
|
|
||||||
|
TopoSorter(Graph<T> graph) {
|
||||||
|
this.graph = graph;
|
||||||
|
this.nodes = new LinkedList<>(graph.nodes);
|
||||||
|
sort();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ordered(Consumer<T> action) {
|
||||||
|
result.iterator().forEachRemaining(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reverse(Consumer<T> action) {
|
||||||
|
result.descendingIterator().forEachRemaining(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sort() {
|
||||||
|
Deque<T> visited = new LinkedList<>();
|
||||||
|
Deque<T> done = new LinkedList<>();
|
||||||
|
T node;
|
||||||
|
while ((node = nodes.poll()) != null) {
|
||||||
|
if (!visited.contains(node)) {
|
||||||
|
visit(node, visited, done);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void visit(T node, Deque<T> visited, Deque<T> done) {
|
||||||
|
if (visited.contains(node)) {
|
||||||
|
if (!done.contains(node)) {
|
||||||
|
throw new IllegalArgumentException("Cyclic detected: " +
|
||||||
|
node + " " + graph.edges().get(node));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
visited.add(node);
|
||||||
|
graph.edges().get(node).stream()
|
||||||
|
.forEach(x -> visit(x, visited, done));
|
||||||
|
done.add(node);
|
||||||
|
result.addLast(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -64,9 +64,9 @@ DEF_JNI_OnLoad(JavaVM *vm, void *reserved)
|
|||||||
preferIPv4Stack = (*env)->CallStaticBooleanMethod(env, iCls, mid, s);
|
preferIPv4Stack = (*env)->CallStaticBooleanMethod(env, iCls, mid, s);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Since we have initialized and loaded the Socket library we will
|
* Since we have initialized and loaded the socket library we will
|
||||||
check now to whether we have IPv6 on this platform and if the
|
* check now whether we have IPv6 on this platform and if the
|
||||||
supporting socket APIs are available
|
* supporting socket APIs are available
|
||||||
*/
|
*/
|
||||||
IPv6_available = IPv6_supported() & (!preferIPv4Stack);
|
IPv6_available = IPv6_supported() & (!preferIPv4Stack);
|
||||||
|
|
||||||
@ -120,16 +120,16 @@ jboolean setInet6Address_scopeifname(JNIEnv *env, jobject iaObj, jobject scopeif
|
|||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getInet6Address_scopeid_set(JNIEnv *env, jobject iaObj) {
|
jboolean getInet6Address_scopeid_set(JNIEnv *env, jobject iaObj) {
|
||||||
jobject holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
|
jobject holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
|
||||||
CHECK_NULL_RETURN(holder, -1);
|
CHECK_NULL_RETURN(holder, JNI_FALSE);
|
||||||
return (*env)->GetBooleanField(env, holder, ia6_scopeidsetID);
|
return (*env)->GetBooleanField(env, holder, ia6_scopeidsetID);
|
||||||
}
|
}
|
||||||
|
|
||||||
int getInet6Address_scopeid(JNIEnv *env, jobject iaObj) {
|
unsigned int getInet6Address_scopeid(JNIEnv *env, jobject iaObj) {
|
||||||
jobject holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
|
jobject holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
|
||||||
CHECK_NULL_RETURN(holder, -1);
|
CHECK_NULL_RETURN(holder, 0);
|
||||||
return (*env)->GetIntField(env, holder, ia6_scopeidID);
|
return (unsigned int)(*env)->GetIntField(env, holder, ia6_scopeidID);
|
||||||
}
|
}
|
||||||
|
|
||||||
jboolean setInet6Address_scopeid(JNIEnv *env, jobject iaObj, int scopeid) {
|
jboolean setInet6Address_scopeid(JNIEnv *env, jobject iaObj, int scopeid) {
|
||||||
@ -201,11 +201,10 @@ jobject getInetAddress_hostName(JNIEnv *env, jobject iaObj) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jobject JNICALL
|
JNIEXPORT jobject JNICALL
|
||||||
NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) {
|
NET_SockaddrToInetAddress(JNIEnv *env, SOCKETADDRESS *sa, int *port) {
|
||||||
jobject iaObj;
|
jobject iaObj;
|
||||||
if (him->sa_family == AF_INET6) {
|
if (sa->sa.sa_family == AF_INET6) {
|
||||||
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
|
jbyte *caddr = (jbyte *)&sa->sa6.sin6_addr;
|
||||||
jbyte *caddr = (jbyte *)&(him6->sin6_addr);
|
|
||||||
if (NET_IsIPv4Mapped(caddr)) {
|
if (NET_IsIPv4Mapped(caddr)) {
|
||||||
int address;
|
int address;
|
||||||
iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
|
iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
|
||||||
@ -214,42 +213,35 @@ NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) {
|
|||||||
setInetAddress_addr(env, iaObj, address);
|
setInetAddress_addr(env, iaObj, address);
|
||||||
setInetAddress_family(env, iaObj, java_net_InetAddress_IPv4);
|
setInetAddress_family(env, iaObj, java_net_InetAddress_IPv4);
|
||||||
} else {
|
} else {
|
||||||
jint scope;
|
|
||||||
jboolean ret;
|
jboolean ret;
|
||||||
iaObj = (*env)->NewObject(env, ia6_class, ia6_ctrID);
|
iaObj = (*env)->NewObject(env, ia6_class, ia6_ctrID);
|
||||||
CHECK_NULL_RETURN(iaObj, NULL);
|
CHECK_NULL_RETURN(iaObj, NULL);
|
||||||
ret = setInet6Address_ipaddress(env, iaObj, (char *)&(him6->sin6_addr));
|
ret = setInet6Address_ipaddress(env, iaObj, (char *)&sa->sa6.sin6_addr);
|
||||||
if (ret == JNI_FALSE)
|
if (ret == JNI_FALSE)
|
||||||
return NULL;
|
return NULL;
|
||||||
setInetAddress_family(env, iaObj, java_net_InetAddress_IPv6);
|
setInetAddress_family(env, iaObj, java_net_InetAddress_IPv6);
|
||||||
scope = getScopeID(him);
|
setInet6Address_scopeid(env, iaObj, sa->sa6.sin6_scope_id);
|
||||||
setInet6Address_scopeid(env, iaObj, scope);
|
|
||||||
}
|
}
|
||||||
*port = ntohs(him6->sin6_port);
|
*port = ntohs(sa->sa6.sin6_port);
|
||||||
} else {
|
} else {
|
||||||
struct sockaddr_in *him4 = (struct sockaddr_in *)him;
|
|
||||||
iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
|
iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
|
||||||
CHECK_NULL_RETURN(iaObj, NULL);
|
CHECK_NULL_RETURN(iaObj, NULL);
|
||||||
setInetAddress_family(env, iaObj, java_net_InetAddress_IPv4);
|
setInetAddress_family(env, iaObj, java_net_InetAddress_IPv4);
|
||||||
setInetAddress_addr(env, iaObj, ntohl(him4->sin_addr.s_addr));
|
setInetAddress_addr(env, iaObj, ntohl(sa->sa4.sin_addr.s_addr));
|
||||||
*port = ntohs(him4->sin_port);
|
*port = ntohs(sa->sa4.sin_port);
|
||||||
}
|
}
|
||||||
return iaObj;
|
return iaObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jboolean JNICALL
|
||||||
NET_SockaddrEqualsInetAddress(JNIEnv *env, struct sockaddr *him, jobject iaObj)
|
NET_SockaddrEqualsInetAddress(JNIEnv *env, SOCKETADDRESS *sa, jobject iaObj)
|
||||||
{
|
{
|
||||||
jint family = AF_INET;
|
jint family = getInetAddress_family(env, iaObj) ==
|
||||||
|
java_net_InetAddress_IPv4 ? AF_INET : AF_INET6;
|
||||||
family = getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4 ?
|
if (sa->sa.sa_family == AF_INET6) {
|
||||||
AF_INET : AF_INET6;
|
jbyte *caddrNew = (jbyte *)&sa->sa6.sin6_addr;
|
||||||
if (him->sa_family == AF_INET6) {
|
|
||||||
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
|
|
||||||
jbyte *caddrNew = (jbyte *)&(him6->sin6_addr);
|
|
||||||
if (NET_IsIPv4Mapped(caddrNew)) {
|
if (NET_IsIPv4Mapped(caddrNew)) {
|
||||||
int addrNew;
|
int addrNew, addrCur;
|
||||||
int addrCur;
|
|
||||||
if (family == AF_INET6) {
|
if (family == AF_INET6) {
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
@ -262,26 +254,24 @@ NET_SockaddrEqualsInetAddress(JNIEnv *env, struct sockaddr *him, jobject iaObj)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
jbyte caddrCur[16];
|
jbyte caddrCur[16];
|
||||||
int scope;
|
|
||||||
|
|
||||||
if (family == AF_INET) {
|
if (family == AF_INET) {
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
scope = getInet6Address_scopeid(env, iaObj);
|
|
||||||
getInet6Address_ipaddress(env, iaObj, (char *)caddrCur);
|
getInet6Address_ipaddress(env, iaObj, (char *)caddrCur);
|
||||||
if (NET_IsEqual(caddrNew, caddrCur) && cmpScopeID(scope, him)) {
|
if (NET_IsEqual(caddrNew, caddrCur) &&
|
||||||
|
sa->sa6.sin6_scope_id == getInet6Address_scopeid(env, iaObj))
|
||||||
|
{
|
||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
} else {
|
} else {
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
struct sockaddr_in *him4 = (struct sockaddr_in *)him;
|
|
||||||
int addrNew, addrCur;
|
int addrNew, addrCur;
|
||||||
if (family != AF_INET) {
|
if (family != AF_INET) {
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
addrNew = ntohl(him4->sin_addr.s_addr);
|
addrNew = ntohl(sa->sa4.sin_addr.s_addr);
|
||||||
addrCur = getInetAddress_addr(env, iaObj);
|
addrCur = getInetAddress_addr(env, iaObj);
|
||||||
if (addrNew == addrCur) {
|
if (addrNew == addrCur) {
|
||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
@ -291,6 +281,15 @@ NET_SockaddrEqualsInetAddress(JNIEnv *env, struct sockaddr *him, jobject iaObj)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
NET_GetPortFromSockaddr(SOCKETADDRESS *sa) {
|
||||||
|
if (sa->sa.sa_family == AF_INET6) {
|
||||||
|
return ntohs(sa->sa6.sin6_port);
|
||||||
|
} else {
|
||||||
|
return ntohs(sa->sa4.sin_port);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unsigned short
|
unsigned short
|
||||||
in_cksum(unsigned short *addr, int len) {
|
in_cksum(unsigned short *addr, int len) {
|
||||||
int nleft = len;
|
int nleft = len;
|
||||||
|
@ -63,8 +63,8 @@ JNIEXPORT void JNICALL initInetAddressIDs(JNIEnv *env);
|
|||||||
*/
|
*/
|
||||||
extern jobject getInet6Address_scopeifname(JNIEnv *env, jobject ia6Obj);
|
extern jobject getInet6Address_scopeifname(JNIEnv *env, jobject ia6Obj);
|
||||||
extern jboolean setInet6Address_scopeifname(JNIEnv *env, jobject ia6Obj, jobject scopeifname);
|
extern jboolean setInet6Address_scopeifname(JNIEnv *env, jobject ia6Obj, jobject scopeifname);
|
||||||
extern int getInet6Address_scopeid_set(JNIEnv *env, jobject ia6Obj);
|
extern jboolean getInet6Address_scopeid_set(JNIEnv *env, jobject ia6Obj);
|
||||||
extern int getInet6Address_scopeid(JNIEnv *env, jobject ia6Obj);
|
extern unsigned int getInet6Address_scopeid(JNIEnv *env, jobject ia6Obj);
|
||||||
extern jboolean setInet6Address_scopeid(JNIEnv *env, jobject ia6Obj, int scopeid);
|
extern jboolean setInet6Address_scopeid(JNIEnv *env, jobject ia6Obj, int scopeid);
|
||||||
extern jboolean getInet6Address_ipaddress(JNIEnv *env, jobject ia6Obj, char *dest);
|
extern jboolean getInet6Address_ipaddress(JNIEnv *env, jobject ia6Obj, char *dest);
|
||||||
extern jboolean setInet6Address_ipaddress(JNIEnv *env, jobject ia6Obj, char *address);
|
extern jboolean setInet6Address_ipaddress(JNIEnv *env, jobject ia6Obj, char *address);
|
||||||
@ -132,24 +132,41 @@ JNIEXPORT jint JNICALL ipv6_available();
|
|||||||
|
|
||||||
JNIEXPORT jint JNICALL reuseport_available();
|
JNIEXPORT jint JNICALL reuseport_available();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function will fill a SOCKETADDRESS structure from an InetAddress
|
||||||
|
* object.
|
||||||
|
*
|
||||||
|
* The parameter 'sa' must point to valid storage of size
|
||||||
|
* 'sizeof(SOCKETADDRESS)'.
|
||||||
|
*
|
||||||
|
* The parameter 'len' is a pointer to an int and is used for returning
|
||||||
|
* the actual sockaddr length, e.g. 'sizeof(struct sockaddr_in)' or
|
||||||
|
* 'sizeof(struct sockaddr_in6)'.
|
||||||
|
*
|
||||||
|
* If the type of the InetAddress object is IPv6, the function will fill a
|
||||||
|
* sockaddr_in6 structure. IPv6 must be available in that case, otherwise an
|
||||||
|
* exception is thrown.
|
||||||
|
* In the case of an IPv4 InetAddress, when IPv6 is available and
|
||||||
|
* v4MappedAddress is TRUE, this method will fill a sockaddr_in6 structure
|
||||||
|
* containing an IPv4 mapped IPv6 address. Otherwise a sockaddr_in
|
||||||
|
* structure will be filled.
|
||||||
|
*/
|
||||||
JNIEXPORT int JNICALL
|
JNIEXPORT int JNICALL
|
||||||
NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port,
|
NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port,
|
||||||
struct sockaddr *him, int *len,
|
SOCKETADDRESS *sa, int *len,
|
||||||
jboolean v4MappedAddress);
|
jboolean v4MappedAddress);
|
||||||
|
|
||||||
JNIEXPORT jobject JNICALL
|
JNIEXPORT jobject JNICALL
|
||||||
NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port);
|
NET_SockaddrToInetAddress(JNIEnv *env, SOCKETADDRESS *sa, int *port);
|
||||||
|
|
||||||
void platformInit();
|
void platformInit();
|
||||||
|
|
||||||
void parseExclusiveBindProperty(JNIEnv *env);
|
void parseExclusiveBindProperty(JNIEnv *env);
|
||||||
|
|
||||||
void NET_SetTrafficClass(struct sockaddr *him, int trafficClass);
|
JNIEXPORT jint JNICALL NET_GetPortFromSockaddr(SOCKETADDRESS *sa);
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL NET_GetPortFromSockaddr(struct sockaddr *him);
|
JNIEXPORT jboolean JNICALL
|
||||||
|
NET_SockaddrEqualsInetAddress(JNIEnv *env, SOCKETADDRESS *sa, jobject iaObj);
|
||||||
JNIEXPORT jint JNICALL
|
|
||||||
NET_SockaddrEqualsInetAddress(JNIEnv *env,struct sockaddr *him, jobject iaObj);
|
|
||||||
|
|
||||||
int NET_IsIPv4Mapped(jbyte* caddr);
|
int NET_IsIPv4Mapped(jbyte* caddr);
|
||||||
|
|
||||||
@ -172,7 +189,7 @@ JNIEXPORT int JNICALL
|
|||||||
NET_SetSockOpt(int fd, int level, int opt, const void *arg, int len);
|
NET_SetSockOpt(int fd, int level, int opt, const void *arg, int len);
|
||||||
|
|
||||||
JNIEXPORT int JNICALL
|
JNIEXPORT int JNICALL
|
||||||
NET_Bind(int fd, struct sockaddr *him, int len);
|
NET_Bind(int fd, SOCKETADDRESS *sa, int len);
|
||||||
|
|
||||||
JNIEXPORT int JNICALL
|
JNIEXPORT int JNICALL
|
||||||
NET_MapSocketOption(jint cmd, int *level, int *optname);
|
NET_MapSocketOption(jint cmd, int *level, int *optname);
|
||||||
@ -183,10 +200,6 @@ NET_MapSocketOptionV6(jint cmd, int *level, int *optname);
|
|||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
NET_EnableFastTcpLoopback(int fd);
|
NET_EnableFastTcpLoopback(int fd);
|
||||||
|
|
||||||
int getScopeID(struct sockaddr *);
|
|
||||||
|
|
||||||
int cmpScopeID(unsigned int, struct sockaddr *);
|
|
||||||
|
|
||||||
unsigned short in_cksum(unsigned short *addr, int len);
|
unsigned short in_cksum(unsigned short *addr, int len);
|
||||||
|
|
||||||
jint NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout);
|
jint NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout);
|
||||||
|
@ -211,7 +211,8 @@ lookupIfLocalhost(JNIEnv *env, const char *hostname, jboolean includeV6)
|
|||||||
{
|
{
|
||||||
int port;
|
int port;
|
||||||
int index = (family == AF_INET) ? i++ : j++;
|
int index = (family == AF_INET) ? i++ : j++;
|
||||||
jobject o = NET_SockaddrToInetAddress(env, iter->ifa_addr, &port);
|
jobject o = NET_SockaddrToInetAddress(env,
|
||||||
|
(SOCKETADDRESS *)iter->ifa_addr, &port);
|
||||||
if (!o) {
|
if (!o) {
|
||||||
freeifaddrs(ifa);
|
freeifaddrs(ifa);
|
||||||
if (!(*env)->ExceptionCheck(env))
|
if (!(*env)->ExceptionCheck(env))
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -791,7 +791,7 @@ static netif *enumInterfaces(JNIEnv *env) {
|
|||||||
int sock;
|
int sock;
|
||||||
|
|
||||||
sock = openSocket(env, AF_INET);
|
sock = openSocket(env, AF_INET);
|
||||||
if (sock < 0 && (*env)->ExceptionOccurred(env)) {
|
if (sock < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -809,7 +809,7 @@ static netif *enumInterfaces(JNIEnv *env) {
|
|||||||
// so we have to call ipv6_available()
|
// so we have to call ipv6_available()
|
||||||
if (ipv6_available()) {
|
if (ipv6_available()) {
|
||||||
sock = openSocket(env, AF_INET6);
|
sock = openSocket(env, AF_INET6);
|
||||||
if (sock < 0 && (*env)->ExceptionOccurred(env)) {
|
if (sock < 0) {
|
||||||
freeif(ifs);
|
freeif(ifs);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ static jobject createInteger(JNIEnv *env, int i) {
|
|||||||
CHECK_NULL_RETURN(i_class, NULL);
|
CHECK_NULL_RETURN(i_class, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( (*env)->NewObject(env, i_class, i_ctrID, i) );
|
return (*env)->NewObject(env, i_class, i_ctrID, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -118,10 +118,9 @@ static jobject createBoolean(JNIEnv *env, int b) {
|
|||||||
CHECK_NULL_RETURN(b_class, NULL);
|
CHECK_NULL_RETURN(b_class, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return( (*env)->NewObject(env, b_class, b_ctrID, (jboolean)(b!=0)) );
|
return (*env)->NewObject(env, b_class, b_ctrID, (jboolean)(b != 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the fd for a PlainDatagramSocketImpl or -1
|
* Returns the fd for a PlainDatagramSocketImpl or -1
|
||||||
* if closed.
|
* if closed.
|
||||||
@ -134,7 +133,6 @@ static int getFD(JNIEnv *env, jobject this) {
|
|||||||
return (*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
return (*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: java_net_PlainDatagramSocketImpl
|
* Class: java_net_PlainDatagramSocketImpl
|
||||||
* Method: init
|
* Method: init
|
||||||
@ -166,7 +164,6 @@ Java_java_net_PlainDatagramSocketImpl_init(JNIEnv *env, jclass cls) {
|
|||||||
initInetAddressIDs(env);
|
initInetAddressIDs(env);
|
||||||
JNU_CHECK_EXCEPTION(env);
|
JNU_CHECK_EXCEPTION(env);
|
||||||
Java_java_net_NetworkInterface_init(env, 0);
|
Java_java_net_NetworkInterface_init(env, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -182,7 +179,7 @@ Java_java_net_PlainDatagramSocketImpl_bind0(JNIEnv *env, jobject this,
|
|||||||
/* fd is an int field on fdObj */
|
/* fd is an int field on fdObj */
|
||||||
int fd;
|
int fd;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
SOCKETADDRESS him;
|
SOCKETADDRESS sa;
|
||||||
socklen_t slen = sizeof(SOCKETADDRESS);
|
socklen_t slen = sizeof(SOCKETADDRESS);
|
||||||
|
|
||||||
if (IS_NULL(fdObj)) {
|
if (IS_NULL(fdObj)) {
|
||||||
@ -199,12 +196,13 @@ Java_java_net_PlainDatagramSocketImpl_bind0(JNIEnv *env, jobject this,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* bind */
|
/* bind */
|
||||||
if (NET_InetAddressToSockaddr(env, iaObj, localport, &him.sa, &len, JNI_TRUE) != 0) {
|
if (NET_InetAddressToSockaddr(env, iaObj, localport, &sa, &len,
|
||||||
|
JNI_TRUE) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setDefaultScopeID(env, &him.sa);
|
setDefaultScopeID(env, &sa.sa);
|
||||||
|
|
||||||
if (NET_Bind(fd, &him.sa, len) < 0) {
|
if (NET_Bind(fd, &sa, len) < 0) {
|
||||||
if (errno == EADDRINUSE || errno == EADDRNOTAVAIL ||
|
if (errno == EADDRINUSE || errno == EADDRNOTAVAIL ||
|
||||||
errno == EPERM || errno == EACCES) {
|
errno == EPERM || errno == EACCES) {
|
||||||
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "BindException",
|
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "BindException",
|
||||||
@ -221,13 +219,13 @@ Java_java_net_PlainDatagramSocketImpl_bind0(JNIEnv *env, jobject this,
|
|||||||
/* Now that we're a connected socket, let's extract the port number
|
/* Now that we're a connected socket, let's extract the port number
|
||||||
* that the system chose for us and store it in the Socket object.
|
* that the system chose for us and store it in the Socket object.
|
||||||
*/
|
*/
|
||||||
if (getsockname(fd, &him.sa, &slen) == -1) {
|
if (getsockname(fd, &sa.sa, &slen) == -1) {
|
||||||
JNU_ThrowByNameWithMessageAndLastError
|
JNU_ThrowByNameWithMessageAndLastError
|
||||||
(env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
|
(env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
localport = NET_GetPortFromSockaddr(&him.sa);
|
localport = NET_GetPortFromSockaddr(&sa);
|
||||||
|
|
||||||
(*env)->SetIntField(env, this, pdsi_localPortID, localport);
|
(*env)->SetIntField(env, this, pdsi_localPortID, localport);
|
||||||
} else {
|
} else {
|
||||||
@ -263,7 +261,8 @@ Java_java_net_PlainDatagramSocketImpl_connect0(JNIEnv *env, jobject this,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NET_InetAddressToSockaddr(env, address, port, &rmtaddr.sa, &len, JNI_TRUE) != 0) {
|
if (NET_InetAddressToSockaddr(env, address, port, &rmtaddr, &len,
|
||||||
|
JNI_TRUE) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,6 +289,9 @@ Java_java_net_PlainDatagramSocketImpl_disconnect0(JNIEnv *env, jobject this, jin
|
|||||||
#if defined(__linux__) || defined(_ALLBSD_SOURCE)
|
#if defined(__linux__) || defined(_ALLBSD_SOURCE)
|
||||||
SOCKETADDRESS addr;
|
SOCKETADDRESS addr;
|
||||||
socklen_t len;
|
socklen_t len;
|
||||||
|
#if defined(__linux__)
|
||||||
|
int localPort = 0;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (IS_NULL(fdObj)) {
|
if (IS_NULL(fdObj)) {
|
||||||
@ -308,12 +310,11 @@ Java_java_net_PlainDatagramSocketImpl_disconnect0(JNIEnv *env, jobject this, jin
|
|||||||
}
|
}
|
||||||
NET_Connect(fd, &addr.sa, len);
|
NET_Connect(fd, &addr.sa, len);
|
||||||
|
|
||||||
#ifdef __linux__
|
#if defined(__linux__)
|
||||||
int localPort = 0;
|
|
||||||
if (getsockname(fd, &addr.sa, &len) == -1)
|
if (getsockname(fd, &addr.sa, &len) == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
localPort = NET_GetPortFromSockaddr(&addr.sa);
|
localPort = NET_GetPortFromSockaddr(&addr);
|
||||||
if (localPort == 0) {
|
if (localPort == 0) {
|
||||||
localPort = (*env)->GetIntField(env, this, pdsi_localPortID);
|
localPort = (*env)->GetIntField(env, this, pdsi_localPortID);
|
||||||
if (addr.sa.sa_family == AF_INET6) {
|
if (addr.sa.sa_family == AF_INET6) {
|
||||||
@ -322,7 +323,7 @@ Java_java_net_PlainDatagramSocketImpl_disconnect0(JNIEnv *env, jobject this, jin
|
|||||||
addr.sa4.sin_port = htons(localPort);
|
addr.sa4.sin_port = htons(localPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
NET_Bind(fd, &addr.sa, len);
|
NET_Bind(fd, &addr, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -355,8 +356,9 @@ Java_java_net_PlainDatagramSocketImpl_send(JNIEnv *env, jobject this,
|
|||||||
/* The fdObj'fd */
|
/* The fdObj'fd */
|
||||||
jint fd;
|
jint fd;
|
||||||
|
|
||||||
SOCKETADDRESS rmtaddr, *rmtaddrP = &rmtaddr;
|
SOCKETADDRESS rmtaddr;
|
||||||
int len;
|
struct sockaddr *rmtaddrP = 0;
|
||||||
|
int len = 0;
|
||||||
|
|
||||||
if (IS_NULL(fdObj)) {
|
if (IS_NULL(fdObj)) {
|
||||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||||
@ -382,15 +384,14 @@ Java_java_net_PlainDatagramSocketImpl_send(JNIEnv *env, jobject this,
|
|||||||
packetBufferOffset = (*env)->GetIntField(env, packet, dp_offsetID);
|
packetBufferOffset = (*env)->GetIntField(env, packet, dp_offsetID);
|
||||||
packetBufferLen = (*env)->GetIntField(env, packet, dp_lengthID);
|
packetBufferLen = (*env)->GetIntField(env, packet, dp_lengthID);
|
||||||
|
|
||||||
if (connected) {
|
// arg to NET_Sendto() null, if connected
|
||||||
/* arg to NET_Sendto () null in this case */
|
if (!connected) {
|
||||||
len = 0;
|
|
||||||
rmtaddrP = 0;
|
|
||||||
} else {
|
|
||||||
packetPort = (*env)->GetIntField(env, packet, dp_portID);
|
packetPort = (*env)->GetIntField(env, packet, dp_portID);
|
||||||
if (NET_InetAddressToSockaddr(env, packetAddress, packetPort, &rmtaddr.sa, &len, JNI_TRUE) != 0) {
|
if (NET_InetAddressToSockaddr(env, packetAddress, packetPort, &rmtaddr,
|
||||||
|
&len, JNI_TRUE) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
rmtaddrP = &rmtaddr.sa;
|
||||||
}
|
}
|
||||||
setDefaultScopeID(env, &rmtaddr.sa);
|
setDefaultScopeID(env, &rmtaddr.sa);
|
||||||
|
|
||||||
@ -427,7 +428,7 @@ Java_java_net_PlainDatagramSocketImpl_send(JNIEnv *env, jobject this,
|
|||||||
(*env)->GetByteArrayRegion(env, packetBuffer, packetBufferOffset, packetBufferLen,
|
(*env)->GetByteArrayRegion(env, packetBuffer, packetBufferOffset, packetBufferLen,
|
||||||
(jbyte *)fullPacket);
|
(jbyte *)fullPacket);
|
||||||
if (trafficClass != 0 && ipv6_available()) {
|
if (trafficClass != 0 && ipv6_available()) {
|
||||||
NET_SetTrafficClass(&rmtaddr.sa, trafficClass);
|
NET_SetTrafficClass(&rmtaddr, trafficClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -437,8 +438,7 @@ Java_java_net_PlainDatagramSocketImpl_send(JNIEnv *env, jobject this,
|
|||||||
* ECONNREFUSED indicating that an ICMP port unreachable has
|
* ECONNREFUSED indicating that an ICMP port unreachable has
|
||||||
* received.
|
* received.
|
||||||
*/
|
*/
|
||||||
ret = NET_SendTo(fd, fullPacket, packetBufferLen, 0,
|
ret = NET_SendTo(fd, fullPacket, packetBufferLen, 0, rmtaddrP, len);
|
||||||
(struct sockaddr *)rmtaddrP, len);
|
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (errno == ECONNREFUSED) {
|
if (errno == ECONNREFUSED) {
|
||||||
@ -510,7 +510,7 @@ Java_java_net_PlainDatagramSocketImpl_peek(JNIEnv *env, jobject this,
|
|||||||
#ifdef __solaris__
|
#ifdef __solaris__
|
||||||
if (errno == ECONNREFUSED) {
|
if (errno == ECONNREFUSED) {
|
||||||
int orig_errno = errno;
|
int orig_errno = errno;
|
||||||
(void) recv(fd, buf, 1, 0);
|
recv(fd, buf, 1, 0);
|
||||||
errno = orig_errno;
|
errno = orig_errno;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -528,7 +528,7 @@ Java_java_net_PlainDatagramSocketImpl_peek(JNIEnv *env, jobject this,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
iaObj = NET_SockaddrToInetAddress(env, &rmtaddr.sa, &port);
|
iaObj = NET_SockaddrToInetAddress(env, &rmtaddr, &port);
|
||||||
family = getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4 ?
|
family = getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4 ?
|
||||||
AF_INET : AF_INET6;
|
AF_INET : AF_INET6;
|
||||||
if (family == AF_INET) { /* this API can't handle IPV6 addresses */
|
if (family == AF_INET) { /* this API can't handle IPV6 addresses */
|
||||||
@ -676,18 +676,18 @@ Java_java_net_PlainDatagramSocketImpl_peekData(JNIEnv *env, jobject this,
|
|||||||
*/
|
*/
|
||||||
packetAddress = (*env)->GetObjectField(env, packet, dp_addressID);
|
packetAddress = (*env)->GetObjectField(env, packet, dp_addressID);
|
||||||
if (packetAddress != NULL) {
|
if (packetAddress != NULL) {
|
||||||
if (!NET_SockaddrEqualsInetAddress(env, &rmtaddr.sa, packetAddress)) {
|
if (!NET_SockaddrEqualsInetAddress(env, &rmtaddr, packetAddress)) {
|
||||||
/* force a new InetAddress to be created */
|
/* force a new InetAddress to be created */
|
||||||
packetAddress = NULL;
|
packetAddress = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (packetAddress == NULL) {
|
if (packetAddress == NULL) {
|
||||||
packetAddress = NET_SockaddrToInetAddress(env, &rmtaddr.sa, &port);
|
packetAddress = NET_SockaddrToInetAddress(env, &rmtaddr, &port);
|
||||||
/* stuff the new Inetaddress in the packet */
|
/* stuff the new Inetaddress in the packet */
|
||||||
(*env)->SetObjectField(env, packet, dp_addressID, packetAddress);
|
(*env)->SetObjectField(env, packet, dp_addressID, packetAddress);
|
||||||
} else {
|
} else {
|
||||||
/* only get the new port number */
|
/* only get the new port number */
|
||||||
port = NET_GetPortFromSockaddr(&rmtaddr.sa);
|
port = NET_GetPortFromSockaddr(&rmtaddr);
|
||||||
}
|
}
|
||||||
/* and fill in the data, remote address/port and such */
|
/* and fill in the data, remote address/port and such */
|
||||||
(*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, n,
|
(*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, n,
|
||||||
@ -857,18 +857,19 @@ Java_java_net_PlainDatagramSocketImpl_receive0(JNIEnv *env, jobject this,
|
|||||||
*/
|
*/
|
||||||
packetAddress = (*env)->GetObjectField(env, packet, dp_addressID);
|
packetAddress = (*env)->GetObjectField(env, packet, dp_addressID);
|
||||||
if (packetAddress != NULL) {
|
if (packetAddress != NULL) {
|
||||||
if (!NET_SockaddrEqualsInetAddress(env, &rmtaddr.sa, packetAddress)) {
|
if (!NET_SockaddrEqualsInetAddress(env, &rmtaddr,
|
||||||
|
packetAddress)) {
|
||||||
/* force a new InetAddress to be created */
|
/* force a new InetAddress to be created */
|
||||||
packetAddress = NULL;
|
packetAddress = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (packetAddress == NULL) {
|
if (packetAddress == NULL) {
|
||||||
packetAddress = NET_SockaddrToInetAddress(env, &rmtaddr.sa, &port);
|
packetAddress = NET_SockaddrToInetAddress(env, &rmtaddr, &port);
|
||||||
/* stuff the new Inetaddress in the packet */
|
/* stuff the new Inetaddress in the packet */
|
||||||
(*env)->SetObjectField(env, packet, dp_addressID, packetAddress);
|
(*env)->SetObjectField(env, packet, dp_addressID, packetAddress);
|
||||||
} else {
|
} else {
|
||||||
/* only get the new port number */
|
/* only get the new port number */
|
||||||
port = NET_GetPortFromSockaddr(&rmtaddr.sa);
|
port = NET_GetPortFromSockaddr(&rmtaddr);
|
||||||
}
|
}
|
||||||
/* and fill in the data, remote address/port and such */
|
/* and fill in the data, remote address/port and such */
|
||||||
(*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, n,
|
(*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, n,
|
||||||
@ -1040,6 +1041,7 @@ static void mcast_set_if_by_if_v4(JNIEnv *env, jobject this, int fd, jobject val
|
|||||||
/*
|
/*
|
||||||
* We need an ipv4 address here
|
* We need an ipv4 address here
|
||||||
*/
|
*/
|
||||||
|
in.s_addr = 0;
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
addr = (*env)->GetObjectArrayElement(env, addrArray, i);
|
addr = (*env)->GetObjectArrayElement(env, addrArray, i);
|
||||||
if (getInetAddress_family(env, addr) == java_net_InetAddress_IPv4) {
|
if (getInetAddress_family(env, addr) == java_net_InetAddress_IPv4) {
|
||||||
@ -1670,17 +1672,17 @@ Java_java_net_PlainDatagramSocketImpl_socketGetOption
|
|||||||
*/
|
*/
|
||||||
if (opt == java_net_SocketOptions_SO_BINDADDR) {
|
if (opt == java_net_SocketOptions_SO_BINDADDR) {
|
||||||
/* find out local IP address */
|
/* find out local IP address */
|
||||||
SOCKETADDRESS him;
|
SOCKETADDRESS sa;
|
||||||
socklen_t len = sizeof(SOCKETADDRESS);
|
socklen_t len = sizeof(SOCKETADDRESS);
|
||||||
int port;
|
int port;
|
||||||
jobject iaObj;
|
jobject iaObj;
|
||||||
|
|
||||||
if (getsockname(fd, &him.sa, &len) == -1) {
|
if (getsockname(fd, &sa.sa, &len) == -1) {
|
||||||
JNU_ThrowByNameWithMessageAndLastError
|
JNU_ThrowByNameWithMessageAndLastError
|
||||||
(env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
|
(env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
iaObj = NET_SockaddrToInetAddress(env, &him.sa, &port);
|
iaObj = NET_SockaddrToInetAddress(env, &sa, &port);
|
||||||
|
|
||||||
return iaObj;
|
return iaObj;
|
||||||
}
|
}
|
||||||
@ -1969,6 +1971,7 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
|
|||||||
mname.imr_multiaddr.s_addr = htonl(getInetAddress_addr(env, iaObj));
|
mname.imr_multiaddr.s_addr = htonl(getInetAddress_addr(env, iaObj));
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
mname.imr_address.s_addr = htonl(getInetAddress_addr(env, addr));
|
mname.imr_address.s_addr = htonl(getInetAddress_addr(env, addr));
|
||||||
|
mname.imr_ifindex = 0;
|
||||||
#else
|
#else
|
||||||
mname.imr_interface.s_addr = htonl(getInetAddress_addr(env, addr));
|
mname.imr_interface.s_addr = htonl(getInetAddress_addr(env, addr));
|
||||||
#endif
|
#endif
|
||||||
@ -2023,7 +2026,7 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
|
|||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
mname.imr_address.s_addr = in.s_addr;
|
mname.imr_address.s_addr = in.s_addr;
|
||||||
|
mname.imr_ifindex = 0;
|
||||||
#else
|
#else
|
||||||
mname.imr_interface.s_addr = in.s_addr;
|
mname.imr_interface.s_addr = in.s_addr;
|
||||||
#endif
|
#endif
|
||||||
|
@ -244,7 +244,7 @@ Java_java_net_PlainSocketImpl_socketConnect(JNIEnv *env, jobject this,
|
|||||||
/* fd is an int field on iaObj */
|
/* fd is an int field on iaObj */
|
||||||
jint fd;
|
jint fd;
|
||||||
|
|
||||||
SOCKETADDRESS him;
|
SOCKETADDRESS sa;
|
||||||
/* The result of the connection */
|
/* The result of the connection */
|
||||||
int connect_rv = -1;
|
int connect_rv = -1;
|
||||||
|
|
||||||
@ -260,17 +260,18 @@ Java_java_net_PlainSocketImpl_socketConnect(JNIEnv *env, jobject this,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* connect */
|
/* connect */
|
||||||
if (NET_InetAddressToSockaddr(env, iaObj, port, &him.sa, &len, JNI_TRUE) != 0) {
|
if (NET_InetAddressToSockaddr(env, iaObj, port, &sa, &len,
|
||||||
|
JNI_TRUE) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setDefaultScopeID(env, &him.sa);
|
setDefaultScopeID(env, &sa.sa);
|
||||||
|
|
||||||
if (trafficClass != 0 && ipv6_available()) {
|
if (trafficClass != 0 && ipv6_available()) {
|
||||||
NET_SetTrafficClass(&him.sa, trafficClass);
|
NET_SetTrafficClass(&sa, trafficClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeout <= 0) {
|
if (timeout <= 0) {
|
||||||
connect_rv = NET_Connect(fd, &him.sa, len);
|
connect_rv = NET_Connect(fd, &sa.sa, len);
|
||||||
#ifdef __solaris__
|
#ifdef __solaris__
|
||||||
if (connect_rv == -1 && errno == EINPROGRESS ) {
|
if (connect_rv == -1 && errno == EINPROGRESS ) {
|
||||||
|
|
||||||
@ -319,7 +320,7 @@ Java_java_net_PlainSocketImpl_socketConnect(JNIEnv *env, jobject this,
|
|||||||
SET_NONBLOCKING(fd);
|
SET_NONBLOCKING(fd);
|
||||||
|
|
||||||
/* no need to use NET_Connect as non-blocking */
|
/* no need to use NET_Connect as non-blocking */
|
||||||
connect_rv = connect(fd, &him.sa, len);
|
connect_rv = connect(fd, &sa.sa, len);
|
||||||
|
|
||||||
/* connection not established immediately */
|
/* connection not established immediately */
|
||||||
if (connect_rv != 0) {
|
if (connect_rv != 0) {
|
||||||
@ -467,11 +468,11 @@ Java_java_net_PlainSocketImpl_socketConnect(JNIEnv *env, jobject this,
|
|||||||
* that the system chose for us and store it in the Socket object.
|
* that the system chose for us and store it in the Socket object.
|
||||||
*/
|
*/
|
||||||
socklen_t slen = sizeof(SOCKETADDRESS);
|
socklen_t slen = sizeof(SOCKETADDRESS);
|
||||||
if (getsockname(fd, &him.sa, &slen) == -1) {
|
if (getsockname(fd, &sa.sa, &slen) == -1) {
|
||||||
JNU_ThrowByNameWithMessageAndLastError
|
JNU_ThrowByNameWithMessageAndLastError
|
||||||
(env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
|
(env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
|
||||||
} else {
|
} else {
|
||||||
localport = NET_GetPortFromSockaddr(&him.sa);
|
localport = NET_GetPortFromSockaddr(&sa);
|
||||||
(*env)->SetIntField(env, this, psi_localportID, localport);
|
(*env)->SetIntField(env, this, psi_localportID, localport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -490,8 +491,8 @@ Java_java_net_PlainSocketImpl_socketBind(JNIEnv *env, jobject this,
|
|||||||
jobject fdObj = (*env)->GetObjectField(env, this, psi_fdID);
|
jobject fdObj = (*env)->GetObjectField(env, this, psi_fdID);
|
||||||
/* fd is an int field on fdObj */
|
/* fd is an int field on fdObj */
|
||||||
int fd;
|
int fd;
|
||||||
int len;
|
int len = 0;
|
||||||
SOCKETADDRESS him;
|
SOCKETADDRESS sa;
|
||||||
|
|
||||||
if (IS_NULL(fdObj)) {
|
if (IS_NULL(fdObj)) {
|
||||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||||
@ -506,13 +507,13 @@ Java_java_net_PlainSocketImpl_socketBind(JNIEnv *env, jobject this,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* bind */
|
/* bind */
|
||||||
if (NET_InetAddressToSockaddr(env, iaObj, localport, &him.sa,
|
if (NET_InetAddressToSockaddr(env, iaObj, localport, &sa,
|
||||||
&len, JNI_TRUE) != 0) {
|
&len, JNI_TRUE) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setDefaultScopeID(env, &him.sa);
|
setDefaultScopeID(env, &sa.sa);
|
||||||
|
|
||||||
if (NET_Bind(fd, &him.sa, len) < 0) {
|
if (NET_Bind(fd, &sa, len) < 0) {
|
||||||
if (errno == EADDRINUSE || errno == EADDRNOTAVAIL ||
|
if (errno == EADDRINUSE || errno == EADDRNOTAVAIL ||
|
||||||
errno == EPERM || errno == EACCES) {
|
errno == EPERM || errno == EACCES) {
|
||||||
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "BindException",
|
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "BindException",
|
||||||
@ -533,12 +534,12 @@ Java_java_net_PlainSocketImpl_socketBind(JNIEnv *env, jobject this,
|
|||||||
/* Now that we're a connected socket, let's extract the port number
|
/* Now that we're a connected socket, let's extract the port number
|
||||||
* that the system chose for us and store it in the Socket object.
|
* that the system chose for us and store it in the Socket object.
|
||||||
*/
|
*/
|
||||||
if (getsockname(fd, &him.sa, &slen) == -1) {
|
if (getsockname(fd, &sa.sa, &slen) == -1) {
|
||||||
JNU_ThrowByNameWithMessageAndLastError
|
JNU_ThrowByNameWithMessageAndLastError
|
||||||
(env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
|
(env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
localport = NET_GetPortFromSockaddr(&him.sa);
|
localport = NET_GetPortFromSockaddr(&sa);
|
||||||
(*env)->SetIntField(env, this, psi_localportID, localport);
|
(*env)->SetIntField(env, this, psi_localportID, localport);
|
||||||
} else {
|
} else {
|
||||||
(*env)->SetIntField(env, this, psi_localportID, localport);
|
(*env)->SetIntField(env, this, psi_localportID, localport);
|
||||||
@ -606,7 +607,7 @@ Java_java_net_PlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
|
|||||||
/* accepted fd */
|
/* accepted fd */
|
||||||
jint newfd;
|
jint newfd;
|
||||||
|
|
||||||
SOCKETADDRESS him;
|
SOCKETADDRESS sa;
|
||||||
socklen_t slen = sizeof(SOCKETADDRESS);
|
socklen_t slen = sizeof(SOCKETADDRESS);
|
||||||
|
|
||||||
if (IS_NULL(fdObj)) {
|
if (IS_NULL(fdObj)) {
|
||||||
@ -661,7 +662,7 @@ Java_java_net_PlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
newfd = NET_Accept(fd, &him.sa, &slen);
|
newfd = NET_Accept(fd, &sa.sa, &slen);
|
||||||
|
|
||||||
/* connection accepted */
|
/* connection accepted */
|
||||||
if (newfd >= 0) {
|
if (newfd >= 0) {
|
||||||
@ -709,7 +710,7 @@ Java_java_net_PlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
|
|||||||
/*
|
/*
|
||||||
* fill up the remote peer port and address in the new socket structure.
|
* fill up the remote peer port and address in the new socket structure.
|
||||||
*/
|
*/
|
||||||
socketAddressObj = NET_SockaddrToInetAddress(env, &him.sa, &port);
|
socketAddressObj = NET_SockaddrToInetAddress(env, &sa, &port);
|
||||||
if (socketAddressObj == NULL) {
|
if (socketAddressObj == NULL) {
|
||||||
/* should be pending exception */
|
/* should be pending exception */
|
||||||
close(newfd);
|
close(newfd);
|
||||||
@ -944,19 +945,19 @@ Java_java_net_PlainSocketImpl_socketGetOption
|
|||||||
* SO_BINDADDR isn't a socket option
|
* SO_BINDADDR isn't a socket option
|
||||||
*/
|
*/
|
||||||
if (cmd == java_net_SocketOptions_SO_BINDADDR) {
|
if (cmd == java_net_SocketOptions_SO_BINDADDR) {
|
||||||
SOCKETADDRESS him;
|
SOCKETADDRESS sa;
|
||||||
socklen_t len = sizeof(SOCKETADDRESS);
|
socklen_t len = sizeof(SOCKETADDRESS);
|
||||||
int port;
|
int port;
|
||||||
jobject iaObj;
|
jobject iaObj;
|
||||||
jclass iaCntrClass;
|
jclass iaCntrClass;
|
||||||
jfieldID iaFieldID;
|
jfieldID iaFieldID;
|
||||||
|
|
||||||
if (getsockname(fd, &him.sa, &len) < 0) {
|
if (getsockname(fd, &sa.sa, &len) < 0) {
|
||||||
JNU_ThrowByNameWithMessageAndLastError
|
JNU_ThrowByNameWithMessageAndLastError
|
||||||
(env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
|
(env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
iaObj = NET_SockaddrToInetAddress(env, &him.sa, &port);
|
iaObj = NET_SockaddrToInetAddress(env, &sa, &port);
|
||||||
CHECK_NULL_RETURN(iaObj, -1);
|
CHECK_NULL_RETURN(iaObj, -1);
|
||||||
|
|
||||||
iaCntrClass = (*env)->GetObjectClass(env, iaContainerObj);
|
iaCntrClass = (*env)->GetObjectClass(env, iaContainerObj);
|
||||||
|
@ -234,29 +234,6 @@ int kernelIsV24 () {
|
|||||||
}
|
}
|
||||||
return kernelV24;
|
return kernelV24;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getScopeID (struct sockaddr *him) {
|
|
||||||
struct sockaddr_in6 *hext = (struct sockaddr_in6 *)him;
|
|
||||||
return hext->sin6_scope_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cmpScopeID (unsigned int scope, struct sockaddr *him) {
|
|
||||||
struct sockaddr_in6 *hext = (struct sockaddr_in6 *)him;
|
|
||||||
return hext->sin6_scope_id == scope;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
int getScopeID (struct sockaddr *him) {
|
|
||||||
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
|
|
||||||
return him6->sin6_scope_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cmpScopeID (unsigned int scope, struct sockaddr *him) {
|
|
||||||
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
|
|
||||||
return him6->sin6_scope_id == scope;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -775,19 +752,21 @@ NET_EnableFastTcpLoopback(int fd) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In the case of an IPv4 Inetaddress this method will return an
|
/**
|
||||||
* IPv4 mapped address where IPv6 is available and v4MappedAddress is TRUE.
|
* See net_util.h for documentation
|
||||||
* Otherwise it will return a sockaddr_in structure for an IPv4 InetAddress.
|
|
||||||
*/
|
*/
|
||||||
JNIEXPORT int JNICALL
|
JNIEXPORT int JNICALL
|
||||||
NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr *him,
|
NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port,
|
||||||
int *len, jboolean v4MappedAddress) {
|
SOCKETADDRESS *sa, int *len,
|
||||||
jint family;
|
jboolean v4MappedAddress)
|
||||||
family = getInetAddress_family(env, iaObj);
|
{
|
||||||
/* needs work. 1. family 2. clean up him6 etc deallocate memory */
|
jint family = getInetAddress_family(env, iaObj);
|
||||||
if (ipv6_available() && !(family == java_net_InetAddress_IPv4 &&
|
memset((char *)sa, 0, sizeof(SOCKETADDRESS));
|
||||||
v4MappedAddress == JNI_FALSE)) {
|
|
||||||
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
|
if (ipv6_available() &&
|
||||||
|
!(family == java_net_InetAddress_IPv4 &&
|
||||||
|
v4MappedAddress == JNI_FALSE))
|
||||||
|
{
|
||||||
jbyte caddr[16];
|
jbyte caddr[16];
|
||||||
jint address;
|
jint address;
|
||||||
|
|
||||||
@ -797,8 +776,8 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
|
|||||||
address = getInetAddress_addr(env, iaObj);
|
address = getInetAddress_addr(env, iaObj);
|
||||||
if (address == INADDR_ANY) {
|
if (address == INADDR_ANY) {
|
||||||
/* we would always prefer IPv6 wildcard address
|
/* we would always prefer IPv6 wildcard address
|
||||||
caddr[10] = 0xff;
|
* caddr[10] = 0xff;
|
||||||
caddr[11] = 0xff; */
|
* caddr[11] = 0xff; */
|
||||||
} else {
|
} else {
|
||||||
caddr[10] = 0xff;
|
caddr[10] = 0xff;
|
||||||
caddr[11] = 0xff;
|
caddr[11] = 0xff;
|
||||||
@ -810,22 +789,19 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
|
|||||||
} else {
|
} else {
|
||||||
getInet6Address_ipaddress(env, iaObj, (char *)caddr);
|
getInet6Address_ipaddress(env, iaObj, (char *)caddr);
|
||||||
}
|
}
|
||||||
memset((char *)him6, 0, sizeof(struct sockaddr_in6));
|
sa->sa6.sin6_port = htons(port);
|
||||||
him6->sin6_port = htons(port);
|
memcpy((void *)&sa->sa6.sin6_addr, caddr, sizeof(struct in6_addr));
|
||||||
memcpy((void *)&(him6->sin6_addr), caddr, sizeof(struct in6_addr) );
|
sa->sa6.sin6_family = AF_INET6;
|
||||||
him6->sin6_family = AF_INET6;
|
if (len != NULL) {
|
||||||
*len = sizeof(struct sockaddr_in6);
|
*len = sizeof(struct sockaddr_in6);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(_ALLBSD_SOURCE)
|
#ifdef __linux__
|
||||||
// XXXBSD: should we do something with scope id here ? see below linux comment
|
|
||||||
/* MMM: Come back to this! */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* On Linux if we are connecting to a link-local address
|
* On Linux if we are connecting to a link-local address
|
||||||
* we need to specify the interface in the scope_id (2.4 kernel only)
|
* we need to specify the interface in the scope_id (2.4 kernel only)
|
||||||
*
|
*
|
||||||
* If the scope was cached the we use the cached value. If not cached but
|
* If the scope was cached then we use the cached value. If not cached but
|
||||||
* specified in the Inet6Address we use that, but we first check if the
|
* specified in the Inet6Address we use that, but we first check if the
|
||||||
* address needs to be routed via the loopback interface. In this case,
|
* address needs to be routed via the loopback interface. In this case,
|
||||||
* we override the specified value with that of the loopback interface.
|
* we override the specified value with that of the loopback interface.
|
||||||
@ -833,9 +809,8 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
|
|||||||
* we try to determine a value from the routing table. In all these
|
* we try to determine a value from the routing table. In all these
|
||||||
* cases the used value is cached for further use.
|
* cases the used value is cached for further use.
|
||||||
*/
|
*/
|
||||||
#ifdef __linux__
|
if (IN6_IS_ADDR_LINKLOCAL(&sa->sa6.sin6_addr)) {
|
||||||
if (IN6_IS_ADDR_LINKLOCAL(&(him6->sin6_addr))) {
|
unsigned int cached_scope_id = 0, scope_id = 0;
|
||||||
int cached_scope_id = 0, scope_id = 0;
|
|
||||||
|
|
||||||
if (ia6_cachedscopeidID) {
|
if (ia6_cachedscopeidID) {
|
||||||
cached_scope_id = (int)(*env)->GetIntField(env, iaObj, ia6_cachedscopeidID);
|
cached_scope_id = (int)(*env)->GetIntField(env, iaObj, ia6_cachedscopeidID);
|
||||||
@ -850,7 +825,7 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
|
|||||||
/* check user-specified value for loopback case
|
/* check user-specified value for loopback case
|
||||||
* that needs to be overridden
|
* that needs to be overridden
|
||||||
*/
|
*/
|
||||||
if (kernelIsV24() && needsLoopbackRoute (&him6->sin6_addr)) {
|
if (kernelIsV24() && needsLoopbackRoute(&sa->sa6.sin6_addr)) {
|
||||||
cached_scope_id = lo_scope_id;
|
cached_scope_id = lo_scope_id;
|
||||||
(*env)->SetIntField(env, iaObj, ia6_cachedscopeidID, cached_scope_id);
|
(*env)->SetIntField(env, iaObj, ia6_cachedscopeidID, cached_scope_id);
|
||||||
}
|
}
|
||||||
@ -860,11 +835,11 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
|
|||||||
* try determine the appropriate interface.
|
* try determine the appropriate interface.
|
||||||
*/
|
*/
|
||||||
if (kernelIsV24()) {
|
if (kernelIsV24()) {
|
||||||
cached_scope_id = getDefaultIPv6Interface(&(him6->sin6_addr));
|
cached_scope_id = getDefaultIPv6Interface(&sa->sa6.sin6_addr);
|
||||||
} else {
|
} else {
|
||||||
cached_scope_id = getLocalScopeID((char *)&(him6->sin6_addr));
|
cached_scope_id = getLocalScopeID((char *)&(sa->sa6.sin6_addr));
|
||||||
if (cached_scope_id == 0) {
|
if (cached_scope_id == 0) {
|
||||||
cached_scope_id = getDefaultIPv6Interface(&(him6->sin6_addr));
|
cached_scope_id = getDefaultIPv6Interface(&sa->sa6.sin6_addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(*env)->SetIntField(env, iaObj, ia6_cachedscopeidID, cached_scope_id);
|
(*env)->SetIntField(env, iaObj, ia6_cachedscopeidID, cached_scope_id);
|
||||||
@ -876,53 +851,37 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
|
|||||||
* If we have a scope_id use the extended form
|
* If we have a scope_id use the extended form
|
||||||
* of sockaddr_in6.
|
* of sockaddr_in6.
|
||||||
*/
|
*/
|
||||||
|
sa->sa6.sin6_scope_id = cached_scope_id == 0 ? scope_id : cached_scope_id;
|
||||||
struct sockaddr_in6 *him6 =
|
|
||||||
(struct sockaddr_in6 *)him;
|
|
||||||
him6->sin6_scope_id = cached_scope_id != 0 ?
|
|
||||||
cached_scope_id : scope_id;
|
|
||||||
*len = sizeof(struct sockaddr_in6);
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* handle scope_id for solaris */
|
/* handle scope_id */
|
||||||
|
|
||||||
if (family != java_net_InetAddress_IPv4) {
|
if (family != java_net_InetAddress_IPv4) {
|
||||||
if (ia6_scopeidID) {
|
if (ia6_scopeidID) {
|
||||||
him6->sin6_scope_id = getInet6Address_scopeid(env, iaObj);
|
sa->sa6.sin6_scope_id = getInet6Address_scopeid(env, iaObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
struct sockaddr_in *him4 = (struct sockaddr_in *)him;
|
|
||||||
jint address;
|
jint address;
|
||||||
if (family == java_net_InetAddress_IPv6) {
|
if (family != java_net_InetAddress_IPv4) {
|
||||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Protocol family unavailable");
|
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Protocol family unavailable");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memset((char *)him4, 0, sizeof(struct sockaddr_in));
|
|
||||||
address = getInetAddress_addr(env, iaObj);
|
address = getInetAddress_addr(env, iaObj);
|
||||||
him4->sin_port = htons((short) port);
|
sa->sa4.sin_port = htons(port);
|
||||||
him4->sin_addr.s_addr = htonl(address);
|
sa->sa4.sin_addr.s_addr = htonl(address);
|
||||||
him4->sin_family = AF_INET;
|
sa->sa4.sin_family = AF_INET;
|
||||||
|
if (len != NULL) {
|
||||||
*len = sizeof(struct sockaddr_in);
|
*len = sizeof(struct sockaddr_in);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NET_SetTrafficClass(struct sockaddr *him, int trafficClass) {
|
NET_SetTrafficClass(SOCKETADDRESS *sa, int trafficClass) {
|
||||||
if (him->sa_family == AF_INET6) {
|
if (sa->sa.sa_family == AF_INET6) {
|
||||||
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
|
sa->sa6.sin6_flowinfo = htonl((trafficClass & 0xff) << 20);
|
||||||
him6->sin6_flowinfo = htonl((trafficClass & 0xff) << 20);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
|
||||||
NET_GetPortFromSockaddr(struct sockaddr *him) {
|
|
||||||
if (him->sa_family == AF_INET6) {
|
|
||||||
return ntohs(((struct sockaddr_in6*)him)->sin6_port);
|
|
||||||
} else {
|
|
||||||
return ntohs(((struct sockaddr_in*)him)->sin_port);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1488,7 +1447,7 @@ NET_SetSockOpt(int fd, int level, int opt, const void *arg,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
NET_Bind(int fd, struct sockaddr *him, int len)
|
NET_Bind(int fd, SOCKETADDRESS *sa, int len)
|
||||||
{
|
{
|
||||||
#if defined(__solaris__)
|
#if defined(__solaris__)
|
||||||
int level = -1;
|
int level = -1;
|
||||||
@ -1503,9 +1462,8 @@ NET_Bind(int fd, struct sockaddr *him, int len)
|
|||||||
* ## When IPv6 is enabled this will be an IPv4-mapped
|
* ## When IPv6 is enabled this will be an IPv4-mapped
|
||||||
* ## with family set to AF_INET6
|
* ## with family set to AF_INET6
|
||||||
*/
|
*/
|
||||||
if (him->sa_family == AF_INET) {
|
if (sa->sa.sa_family == AF_INET) {
|
||||||
struct sockaddr_in *sa = (struct sockaddr_in *)him;
|
if ((ntohl(sa->sa4.sin_addr.s_addr) & 0x7f0000ff) == 0x7f0000ff) {
|
||||||
if ((ntohl(sa->sin_addr.s_addr) & 0x7f0000ff) == 0x7f0000ff) {
|
|
||||||
errno = EADDRNOTAVAIL;
|
errno = EADDRNOTAVAIL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1524,8 +1482,9 @@ NET_Bind(int fd, struct sockaddr *him, int len)
|
|||||||
*/
|
*/
|
||||||
alen = sizeof(arg);
|
alen = sizeof(arg);
|
||||||
|
|
||||||
if (useExclBind || getsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
|
if (useExclBind ||
|
||||||
(char *)&arg, &alen) == 0) {
|
getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&arg, &alen) == 0)
|
||||||
|
{
|
||||||
if (useExclBind || arg == 0) {
|
if (useExclBind || arg == 0) {
|
||||||
/*
|
/*
|
||||||
* SO_REUSEADDR is disabled or sun.net.useExclusiveBind
|
* SO_REUSEADDR is disabled or sun.net.useExclusiveBind
|
||||||
@ -1533,8 +1492,8 @@ NET_Bind(int fd, struct sockaddr *him, int len)
|
|||||||
* UDP_EXCLBIND
|
* UDP_EXCLBIND
|
||||||
*/
|
*/
|
||||||
alen = sizeof(arg);
|
alen = sizeof(arg);
|
||||||
if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&arg,
|
if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&arg, &alen) == 0)
|
||||||
&alen) == 0) {
|
{
|
||||||
if (arg == SOCK_STREAM) {
|
if (arg == SOCK_STREAM) {
|
||||||
level = IPPROTO_TCP;
|
level = IPPROTO_TCP;
|
||||||
exclbind = TCP_EXCLBIND;
|
exclbind = TCP_EXCLBIND;
|
||||||
@ -1545,14 +1504,13 @@ NET_Bind(int fd, struct sockaddr *him, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
arg = 1;
|
arg = 1;
|
||||||
setsockopt(fd, level, exclbind, (char *)&arg,
|
setsockopt(fd, level, exclbind, (char *)&arg, sizeof(arg));
|
||||||
sizeof(arg));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rv = bind(fd, him, len);
|
rv = bind(fd, &sa->sa, len);
|
||||||
|
|
||||||
#if defined(__solaris__)
|
#if defined(__solaris__)
|
||||||
if (rv < 0) {
|
if (rv < 0) {
|
||||||
|
@ -30,32 +30,6 @@
|
|||||||
#include <sys/poll.h>
|
#include <sys/poll.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
int NET_Timeout(int s, long timeout);
|
|
||||||
int NET_Timeout0(int s, long timeout, long currentTime);
|
|
||||||
int NET_Read(int s, void* buf, size_t len);
|
|
||||||
int NET_NonBlockingRead(int s, void* buf, size_t len);
|
|
||||||
int NET_TimeoutWithCurrentTime(int s, long timeout, long currentTime);
|
|
||||||
long NET_GetCurrentTime();
|
|
||||||
int NET_RecvFrom(int s, void *buf, int len, unsigned int flags,
|
|
||||||
struct sockaddr *from, socklen_t *fromlen);
|
|
||||||
int NET_ReadV(int s, const struct iovec * vector, int count);
|
|
||||||
int NET_Send(int s, void *msg, int len, unsigned int flags);
|
|
||||||
int NET_SendTo(int s, const void *msg, int len, unsigned int
|
|
||||||
flags, const struct sockaddr *to, int tolen);
|
|
||||||
int NET_Writev(int s, const struct iovec * vector, int count);
|
|
||||||
int NET_Connect(int s, struct sockaddr *addr, int addrlen);
|
|
||||||
int NET_Accept(int s, struct sockaddr *addr, socklen_t *addrlen);
|
|
||||||
int NET_SocketClose(int s);
|
|
||||||
int NET_Dup2(int oldfd, int newfd);
|
|
||||||
int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout);
|
|
||||||
int NET_SocketAvailable(int s, jint *pbytes);
|
|
||||||
|
|
||||||
void NET_ThrowUnknownHostExceptionWithGaiError(JNIEnv *env,
|
|
||||||
const char* hostname,
|
|
||||||
int gai_error);
|
|
||||||
void NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
|
|
||||||
const char *defaultDetail);
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Macros and constants
|
* Macros and constants
|
||||||
*/
|
*/
|
||||||
@ -91,9 +65,36 @@ typedef union {
|
|||||||
} SOCKETADDRESS;
|
} SOCKETADDRESS;
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Utilities
|
* Functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
int NET_Timeout(int s, long timeout);
|
||||||
|
int NET_Timeout0(int s, long timeout, long currentTime);
|
||||||
|
int NET_Read(int s, void* buf, size_t len);
|
||||||
|
int NET_NonBlockingRead(int s, void* buf, size_t len);
|
||||||
|
int NET_TimeoutWithCurrentTime(int s, long timeout, long currentTime);
|
||||||
|
long NET_GetCurrentTime();
|
||||||
|
int NET_RecvFrom(int s, void *buf, int len, unsigned int flags,
|
||||||
|
struct sockaddr *from, socklen_t *fromlen);
|
||||||
|
int NET_ReadV(int s, const struct iovec * vector, int count);
|
||||||
|
int NET_Send(int s, void *msg, int len, unsigned int flags);
|
||||||
|
int NET_SendTo(int s, const void *msg, int len, unsigned int
|
||||||
|
flags, const struct sockaddr *to, int tolen);
|
||||||
|
int NET_Writev(int s, const struct iovec * vector, int count);
|
||||||
|
int NET_Connect(int s, struct sockaddr *addr, int addrlen);
|
||||||
|
int NET_Accept(int s, struct sockaddr *addr, socklen_t *addrlen);
|
||||||
|
int NET_SocketClose(int s);
|
||||||
|
int NET_Dup2(int oldfd, int newfd);
|
||||||
|
int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout);
|
||||||
|
int NET_SocketAvailable(int s, jint *pbytes);
|
||||||
|
|
||||||
|
void NET_ThrowUnknownHostExceptionWithGaiError(JNIEnv *env,
|
||||||
|
const char* hostname,
|
||||||
|
int gai_error);
|
||||||
|
void NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
|
||||||
|
const char *defaultDetail);
|
||||||
|
void NET_SetTrafficClass(SOCKETADDRESS *sa, int trafficClass);
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
int kernelIsV24();
|
int kernelIsV24();
|
||||||
int getDefaultIPv6Interface(struct in6_addr *target_addr);
|
int getDefaultIPv6Interface(struct in6_addr *target_addr);
|
||||||
|
@ -181,11 +181,11 @@ Java_sun_nio_ch_DatagramChannelImpl_receive0(JNIEnv *env, jobject this,
|
|||||||
*/
|
*/
|
||||||
senderAddr = (*env)->GetObjectField(env, this, dci_senderAddrID);
|
senderAddr = (*env)->GetObjectField(env, this, dci_senderAddrID);
|
||||||
if (senderAddr != NULL) {
|
if (senderAddr != NULL) {
|
||||||
if (!NET_SockaddrEqualsInetAddress(env, &sa.sa, senderAddr)) {
|
if (!NET_SockaddrEqualsInetAddress(env, &sa, senderAddr)) {
|
||||||
senderAddr = NULL;
|
senderAddr = NULL;
|
||||||
} else {
|
} else {
|
||||||
jint port = (*env)->GetIntField(env, this, dci_senderPortID);
|
jint port = (*env)->GetIntField(env, this, dci_senderPortID);
|
||||||
if (port != NET_GetPortFromSockaddr(&sa.sa)) {
|
if (port != NET_GetPortFromSockaddr(&sa)) {
|
||||||
senderAddr = NULL;
|
senderAddr = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ Java_sun_nio_ch_DatagramChannelImpl_receive0(JNIEnv *env, jobject this,
|
|||||||
if (senderAddr == NULL) {
|
if (senderAddr == NULL) {
|
||||||
jobject isa = NULL;
|
jobject isa = NULL;
|
||||||
int port = 0;
|
int port = 0;
|
||||||
jobject ia = NET_SockaddrToInetAddress(env, &sa.sa, &port);
|
jobject ia = NET_SockaddrToInetAddress(env, &sa, &port);
|
||||||
if (ia != NULL) {
|
if (ia != NULL) {
|
||||||
isa = (*env)->NewObject(env, isa_class, isa_ctorID, ia, port);
|
isa = (*env)->NewObject(env, isa_class, isa_ctorID, ia, port);
|
||||||
}
|
}
|
||||||
@ -201,7 +201,7 @@ Java_sun_nio_ch_DatagramChannelImpl_receive0(JNIEnv *env, jobject this,
|
|||||||
|
|
||||||
(*env)->SetObjectField(env, this, dci_senderAddrID, ia);
|
(*env)->SetObjectField(env, this, dci_senderAddrID, ia);
|
||||||
(*env)->SetIntField(env, this, dci_senderPortID,
|
(*env)->SetIntField(env, this, dci_senderPortID,
|
||||||
NET_GetPortFromSockaddr(&sa.sa));
|
NET_GetPortFromSockaddr(&sa));
|
||||||
(*env)->SetObjectField(env, this, dci_senderID, isa);
|
(*env)->SetObjectField(env, this, dci_senderID, isa);
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
@ -215,14 +215,14 @@ Java_sun_nio_ch_DatagramChannelImpl_send0(JNIEnv *env, jobject this,
|
|||||||
jint fd = fdval(env, fdo);
|
jint fd = fdval(env, fdo);
|
||||||
void *buf = (void *)jlong_to_ptr(address);
|
void *buf = (void *)jlong_to_ptr(address);
|
||||||
SOCKETADDRESS sa;
|
SOCKETADDRESS sa;
|
||||||
int sa_len = sizeof(SOCKETADDRESS);
|
int sa_len = 0;
|
||||||
jint n = 0;
|
jint n = 0;
|
||||||
|
|
||||||
if (len > MAX_PACKET_LEN) {
|
if (len > MAX_PACKET_LEN) {
|
||||||
len = MAX_PACKET_LEN;
|
len = MAX_PACKET_LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NET_InetAddressToSockaddr(env, destAddress, destPort, &sa.sa,
|
if (NET_InetAddressToSockaddr(env, destAddress, destPort, &sa,
|
||||||
&sa_len, preferIPv6) != 0) {
|
&sa_len, preferIPv6) != 0) {
|
||||||
return IOS_THROWN;
|
return IOS_THROWN;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ Java_sun_nio_ch_InheritedChannel_peerAddress0(JNIEnv *env, jclass cla, jint fd)
|
|||||||
|
|
||||||
if (getpeername(fd, &sa.sa, &len) == 0) {
|
if (getpeername(fd, &sa.sa, &len) == 0) {
|
||||||
if (matchFamily(&sa.sa)) {
|
if (matchFamily(&sa.sa)) {
|
||||||
remote_ia = NET_SockaddrToInetAddress(env, &sa.sa, (int *)&remote_port);
|
remote_ia = NET_SockaddrToInetAddress(env, &sa, (int *)&remote_port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ Java_sun_nio_ch_InheritedChannel_peerPort0(JNIEnv *env, jclass cla, jint fd)
|
|||||||
|
|
||||||
if (getpeername(fd, &sa.sa, &len) == 0) {
|
if (getpeername(fd, &sa.sa, &len) == 0) {
|
||||||
if (matchFamily(&sa.sa)) {
|
if (matchFamily(&sa.sa)) {
|
||||||
NET_SockaddrToInetAddress(env, &sa.sa, (int *)&remote_port);
|
NET_SockaddrToInetAddress(env, &sa, (int *)&remote_port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,15 +274,15 @@ Java_sun_nio_ch_Net_bind0(JNIEnv *env, jclass clazz, jobject fdo, jboolean prefe
|
|||||||
jboolean useExclBind, jobject iao, int port)
|
jboolean useExclBind, jobject iao, int port)
|
||||||
{
|
{
|
||||||
SOCKETADDRESS sa;
|
SOCKETADDRESS sa;
|
||||||
int sa_len = sizeof(SOCKETADDRESS);
|
int sa_len = 0;
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
if (NET_InetAddressToSockaddr(env, iao, port, &sa.sa, &sa_len,
|
if (NET_InetAddressToSockaddr(env, iao, port, &sa, &sa_len,
|
||||||
preferIPv6) != 0) {
|
preferIPv6) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = NET_Bind(fdval(env, fdo), &sa.sa, sa_len);
|
rv = NET_Bind(fdval(env, fdo), &sa, sa_len);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
handleSocketError(env, errno);
|
handleSocketError(env, errno);
|
||||||
}
|
}
|
||||||
@ -300,10 +300,10 @@ Java_sun_nio_ch_Net_connect0(JNIEnv *env, jclass clazz, jboolean preferIPv6,
|
|||||||
jobject fdo, jobject iao, jint port)
|
jobject fdo, jobject iao, jint port)
|
||||||
{
|
{
|
||||||
SOCKETADDRESS sa;
|
SOCKETADDRESS sa;
|
||||||
int sa_len = sizeof(SOCKETADDRESS);
|
int sa_len = 0;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
if (NET_InetAddressToSockaddr(env, iao, port, &sa.sa, &sa_len,
|
if (NET_InetAddressToSockaddr(env, iao, port, &sa, &sa_len,
|
||||||
preferIPv6) != 0) {
|
preferIPv6) != 0) {
|
||||||
return IOS_THROWN;
|
return IOS_THROWN;
|
||||||
}
|
}
|
||||||
@ -349,7 +349,7 @@ Java_sun_nio_ch_Net_localPort(JNIEnv *env, jclass clazz, jobject fdo)
|
|||||||
return -1;
|
return -1;
|
||||||
#endif /* _ALLBSD_SOURCE */
|
#endif /* _ALLBSD_SOURCE */
|
||||||
}
|
}
|
||||||
return NET_GetPortFromSockaddr(&sa.sa);
|
return NET_GetPortFromSockaddr(&sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jobject JNICALL
|
JNIEXPORT jobject JNICALL
|
||||||
@ -382,7 +382,7 @@ Java_sun_nio_ch_Net_localInetAddress(JNIEnv *env, jclass clazz, jobject fdo)
|
|||||||
return NULL;
|
return NULL;
|
||||||
#endif /* _ALLBSD_SOURCE */
|
#endif /* _ALLBSD_SOURCE */
|
||||||
}
|
}
|
||||||
return NET_SockaddrToInetAddress(env, &sa.sa, &port);
|
return NET_SockaddrToInetAddress(env, &sa, &port);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
|
@ -112,7 +112,7 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this,
|
|||||||
}
|
}
|
||||||
|
|
||||||
(*env)->SetIntField(env, newfdo, fd_fdID, newfd);
|
(*env)->SetIntField(env, newfdo, fd_fdID, newfd);
|
||||||
remote_ia = NET_SockaddrToInetAddress(env, &sa.sa, (int *)&remote_port);
|
remote_ia = NET_SockaddrToInetAddress(env, &sa, (int *)&remote_port);
|
||||||
CHECK_NULL_RETURN(remote_ia, IOS_THROWN);
|
CHECK_NULL_RETURN(remote_ia, IOS_THROWN);
|
||||||
isa = (*env)->NewObject(env, isa_class, isa_ctorID, remote_ia, remote_port);
|
isa = (*env)->NewObject(env, isa_class, isa_ctorID, remote_ia, remote_port);
|
||||||
CHECK_NULL_RETURN(isa, IOS_THROWN);
|
CHECK_NULL_RETURN(isa, IOS_THROWN);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -233,11 +233,14 @@ class WinNTFileSystem extends FileSystem {
|
|||||||
int childStart = 0;
|
int childStart = 0;
|
||||||
int parentEnd = pn;
|
int parentEnd = pn;
|
||||||
|
|
||||||
|
boolean isDirectoryRelative =
|
||||||
|
pn == 2 && isLetter(parent.charAt(0)) && parent.charAt(1) == ':';
|
||||||
|
|
||||||
if ((cn > 1) && (c.charAt(0) == slash)) {
|
if ((cn > 1) && (c.charAt(0) == slash)) {
|
||||||
if (c.charAt(1) == slash) {
|
if (c.charAt(1) == slash) {
|
||||||
/* Drop prefix when child is a UNC pathname */
|
/* Drop prefix when child is a UNC pathname */
|
||||||
childStart = 2;
|
childStart = 2;
|
||||||
} else {
|
} else if (!isDirectoryRelative) {
|
||||||
/* Drop prefix when child is drive-relative */
|
/* Drop prefix when child is drive-relative */
|
||||||
childStart = 1;
|
childStart = 1;
|
||||||
|
|
||||||
@ -254,7 +257,7 @@ class WinNTFileSystem extends FileSystem {
|
|||||||
|
|
||||||
int strlen = parentEnd + cn - childStart;
|
int strlen = parentEnd + cn - childStart;
|
||||||
char[] theChars = null;
|
char[] theChars = null;
|
||||||
if (child.charAt(childStart) == slash) {
|
if (child.charAt(childStart) == slash || isDirectoryRelative) {
|
||||||
theChars = new char[strlen];
|
theChars = new char[strlen];
|
||||||
parent.getChars(0, parentEnd, theChars, 0);
|
parent.getChars(0, parentEnd, theChars, 0);
|
||||||
child.getChars(childStart, cn, theChars, parentEnd);
|
child.getChars(childStart, cn, theChars, parentEnd);
|
||||||
|
@ -53,7 +53,7 @@ static jboolean purgeOutstandingICMP(JNIEnv *env, jint fd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (recvfrom(fd, buf, 1, MSG_PEEK,
|
if (recvfrom(fd, buf, 1, MSG_PEEK,
|
||||||
(struct sockaddr *)&rmtaddr, &addrlen) != SOCKET_ERROR) {
|
&rmtaddr.sa, &addrlen) != SOCKET_ERROR) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (WSAGetLastError() != WSAECONNRESET) {
|
if (WSAGetLastError() != WSAECONNRESET) {
|
||||||
@ -61,7 +61,7 @@ static jboolean purgeOutstandingICMP(JNIEnv *env, jint fd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
recvfrom(fd, buf, 1, 0, (struct sockaddr *)&rmtaddr, &addrlen);
|
recvfrom(fd, buf, 1, 0, &rmtaddr.sa, &addrlen);
|
||||||
got_icmp = JNI_TRUE;
|
got_icmp = JNI_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,14 +134,13 @@ JNIEXPORT jint JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketCrea
|
|||||||
JNIEXPORT void JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketBind
|
JNIEXPORT void JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketBind
|
||||||
(JNIEnv *env, jclass clazz, jint fd, jobject iaObj, jint port, jboolean exclBind) {
|
(JNIEnv *env, jclass clazz, jint fd, jobject iaObj, jint port, jboolean exclBind) {
|
||||||
SOCKETADDRESS sa;
|
SOCKETADDRESS sa;
|
||||||
int rv;
|
int rv, sa_len = 0;
|
||||||
int sa_len = sizeof(sa);
|
|
||||||
|
|
||||||
if (NET_InetAddressToSockaddr(env, iaObj, port, (struct sockaddr *)&sa,
|
if (NET_InetAddressToSockaddr(env, iaObj, port, &sa,
|
||||||
&sa_len, JNI_TRUE) != 0) {
|
&sa_len, JNI_TRUE) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rv = NET_WinBind(fd, (struct sockaddr *)&sa, sa_len, exclBind);
|
rv = NET_WinBind(fd, &sa, sa_len, exclBind);
|
||||||
|
|
||||||
if (rv == SOCKET_ERROR) {
|
if (rv == SOCKET_ERROR) {
|
||||||
if (WSAGetLastError() == WSAEACCES) {
|
if (WSAGetLastError() == WSAEACCES) {
|
||||||
@ -159,17 +158,15 @@ JNIEXPORT void JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketBind
|
|||||||
JNIEXPORT void JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketConnect
|
JNIEXPORT void JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketConnect
|
||||||
(JNIEnv *env, jclass clazz, jint fd, jobject iaObj, jint port) {
|
(JNIEnv *env, jclass clazz, jint fd, jobject iaObj, jint port) {
|
||||||
SOCKETADDRESS sa;
|
SOCKETADDRESS sa;
|
||||||
int rv;
|
int rv, sa_len = 0, t = TRUE;
|
||||||
int sa_len = sizeof(sa);
|
|
||||||
DWORD x1, x2; /* ignored result codes */
|
DWORD x1, x2; /* ignored result codes */
|
||||||
int t = TRUE;
|
|
||||||
|
|
||||||
if (NET_InetAddressToSockaddr(env, iaObj, port, (struct sockaddr *)&sa,
|
if (NET_InetAddressToSockaddr(env, iaObj, port, &sa,
|
||||||
&sa_len, JNI_TRUE) != 0) {
|
&sa_len, JNI_TRUE) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = connect(fd, (struct sockaddr *)&sa, sa_len);
|
rv = connect(fd, &sa.sa, sa_len);
|
||||||
if (rv == SOCKET_ERROR) {
|
if (rv == SOCKET_ERROR) {
|
||||||
NET_ThrowNew(env, WSAGetLastError(), "connect");
|
NET_ThrowNew(env, WSAGetLastError(), "connect");
|
||||||
return;
|
return;
|
||||||
@ -192,7 +189,7 @@ JNIEXPORT void JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketDisc
|
|||||||
int t = FALSE;
|
int t = FALSE;
|
||||||
|
|
||||||
memset(&sa, 0, sa_len);
|
memset(&sa, 0, sa_len);
|
||||||
connect(fd, (struct sockaddr *)&sa, sa_len);
|
connect(fd, &sa.sa, sa_len);
|
||||||
|
|
||||||
/* see comment in socketCreate */
|
/* see comment in socketCreate */
|
||||||
WSAIoctl(fd, SIO_UDP_CONNRESET, &t, sizeof(t), &x1, sizeof(x1), &x2, 0, 0);
|
WSAIoctl(fd, SIO_UDP_CONNRESET, &t, sizeof(t), &x1, sizeof(x1), &x2, 0, 0);
|
||||||
@ -219,7 +216,7 @@ JNIEXPORT jint JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketLoca
|
|||||||
SOCKETADDRESS sa;
|
SOCKETADDRESS sa;
|
||||||
int len = sizeof(sa);
|
int len = sizeof(sa);
|
||||||
|
|
||||||
if (getsockname(fd, (struct sockaddr *)&sa, &len) == SOCKET_ERROR) {
|
if (getsockname(fd, &sa.sa, &len) == SOCKET_ERROR) {
|
||||||
NET_ThrowNew(env, WSAGetLastError(), "getsockname");
|
NET_ThrowNew(env, WSAGetLastError(), "getsockname");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -238,12 +235,12 @@ JNIEXPORT jobject JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketL
|
|||||||
jobject iaObj;
|
jobject iaObj;
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
if (getsockname(fd, (struct sockaddr *)&sa, &len) == SOCKET_ERROR) {
|
if (getsockname(fd, &sa.sa, &len) == SOCKET_ERROR) {
|
||||||
NET_ThrowNew(env, WSAGetLastError(), "Error getting socket name");
|
NET_ThrowNew(env, WSAGetLastError(), "Error getting socket name");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
iaObj = NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa, &port);
|
iaObj = NET_SockaddrToInetAddress(env, &sa, &port);
|
||||||
return iaObj;
|
return iaObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,7 +313,7 @@ JNIEXPORT jint JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketRece
|
|||||||
|
|
||||||
/* receive the packet */
|
/* receive the packet */
|
||||||
rv = recvfrom(fd, fullPacket, packetBufferLen, flags,
|
rv = recvfrom(fd, fullPacket, packetBufferLen, flags,
|
||||||
(struct sockaddr *)&sa, &sa_len);
|
&sa.sa, &sa_len);
|
||||||
|
|
||||||
if (rv == SOCKET_ERROR && (WSAGetLastError() == WSAECONNRESET)) {
|
if (rv == SOCKET_ERROR && (WSAGetLastError() == WSAECONNRESET)) {
|
||||||
/* An icmp port unreachable - we must receive this as Windows
|
/* An icmp port unreachable - we must receive this as Windows
|
||||||
@ -383,15 +380,13 @@ JNIEXPORT jint JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketRece
|
|||||||
*/
|
*/
|
||||||
packetAddress = (*env)->GetObjectField(env, dpObj, dp_addressID);
|
packetAddress = (*env)->GetObjectField(env, dpObj, dp_addressID);
|
||||||
if (packetAddress != NULL) {
|
if (packetAddress != NULL) {
|
||||||
if (!NET_SockaddrEqualsInetAddress(env, (struct sockaddr *)&sa,
|
if (!NET_SockaddrEqualsInetAddress(env, &sa, packetAddress)) {
|
||||||
packetAddress)) {
|
|
||||||
/* force a new InetAddress to be created */
|
/* force a new InetAddress to be created */
|
||||||
packetAddress = NULL;
|
packetAddress = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (packetAddress == NULL) {
|
if (packetAddress == NULL) {
|
||||||
packetAddress = NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa,
|
packetAddress = NET_SockaddrToInetAddress(env, &sa, &port);
|
||||||
&port);
|
|
||||||
if (packetAddress != NULL) {
|
if (packetAddress != NULL) {
|
||||||
/* stuff the new Inetaddress into the packet */
|
/* stuff the new Inetaddress into the packet */
|
||||||
(*env)->SetObjectField(env, dpObj, dp_addressID, packetAddress);
|
(*env)->SetObjectField(env, dpObj, dp_addressID, packetAddress);
|
||||||
@ -422,20 +417,18 @@ JNIEXPORT void JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketSend
|
|||||||
(JNIEnv *env, jclass clazz, jint fd, jbyteArray data, jint offset, jint length,
|
(JNIEnv *env, jclass clazz, jint fd, jbyteArray data, jint offset, jint length,
|
||||||
jobject iaObj, jint port, jboolean connected) {
|
jobject iaObj, jint port, jboolean connected) {
|
||||||
SOCKETADDRESS sa;
|
SOCKETADDRESS sa;
|
||||||
int sa_len = sizeof(sa);
|
int rv, sa_len = 0;
|
||||||
SOCKETADDRESS *sap = &sa;
|
struct sockaddr *sap = 0;
|
||||||
char BUF[MAX_BUFFER_LEN];
|
char BUF[MAX_BUFFER_LEN];
|
||||||
char *fullPacket;
|
char *fullPacket;
|
||||||
int rv;
|
|
||||||
|
|
||||||
if (connected) {
|
// if already connected, sap arg to sendto() is null
|
||||||
sap = 0; /* arg to sendto () null in this case */
|
if (!connected) {
|
||||||
sa_len = 0;
|
if (NET_InetAddressToSockaddr(env, iaObj, port, &sa,
|
||||||
} else {
|
|
||||||
if (NET_InetAddressToSockaddr(env, iaObj, port, (struct sockaddr *)&sa,
|
|
||||||
&sa_len, JNI_TRUE) != 0) {
|
&sa_len, JNI_TRUE) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
sap = &sa.sa;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length > MAX_BUFFER_LEN) {
|
if (length > MAX_BUFFER_LEN) {
|
||||||
@ -456,7 +449,7 @@ JNIEXPORT void JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketSend
|
|||||||
|
|
||||||
(*env)->GetByteArrayRegion(env, data, offset, length,
|
(*env)->GetByteArrayRegion(env, data, offset, length,
|
||||||
(jbyte *)fullPacket);
|
(jbyte *)fullPacket);
|
||||||
rv = sendto(fd, fullPacket, length, 0, (struct sockaddr *)sap, sa_len);
|
rv = sendto(fd, fullPacket, length, 0, sap, sa_len);
|
||||||
if (rv == SOCKET_ERROR) {
|
if (rv == SOCKET_ERROR) {
|
||||||
if (rv == -1) {
|
if (rv == -1) {
|
||||||
NET_ThrowNew(env, WSAGetLastError(), "Datagram send failed");
|
NET_ThrowNew(env, WSAGetLastError(), "Datagram send failed");
|
||||||
|
@ -89,15 +89,14 @@ JNIEXPORT void JNICALL Java_java_net_DualStackPlainSocketImpl_bind0
|
|||||||
jboolean exclBind)
|
jboolean exclBind)
|
||||||
{
|
{
|
||||||
SOCKETADDRESS sa;
|
SOCKETADDRESS sa;
|
||||||
int rv;
|
int rv, sa_len = 0;
|
||||||
int sa_len = sizeof(sa);
|
|
||||||
|
|
||||||
if (NET_InetAddressToSockaddr(env, iaObj, port, (struct sockaddr *)&sa,
|
if (NET_InetAddressToSockaddr(env, iaObj, port, &sa,
|
||||||
&sa_len, JNI_TRUE) != 0) {
|
&sa_len, JNI_TRUE) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = NET_WinBind(fd, (struct sockaddr *)&sa, sa_len, exclBind);
|
rv = NET_WinBind(fd, &sa, sa_len, exclBind);
|
||||||
|
|
||||||
if (rv == SOCKET_ERROR)
|
if (rv == SOCKET_ERROR)
|
||||||
NET_ThrowNew(env, WSAGetLastError(), "NET_Bind");
|
NET_ThrowNew(env, WSAGetLastError(), "NET_Bind");
|
||||||
@ -111,15 +110,14 @@ JNIEXPORT void JNICALL Java_java_net_DualStackPlainSocketImpl_bind0
|
|||||||
JNIEXPORT jint JNICALL Java_java_net_DualStackPlainSocketImpl_connect0
|
JNIEXPORT jint JNICALL Java_java_net_DualStackPlainSocketImpl_connect0
|
||||||
(JNIEnv *env, jclass clazz, jint fd, jobject iaObj, jint port) {
|
(JNIEnv *env, jclass clazz, jint fd, jobject iaObj, jint port) {
|
||||||
SOCKETADDRESS sa;
|
SOCKETADDRESS sa;
|
||||||
int rv;
|
int rv, sa_len = 0;
|
||||||
int sa_len = sizeof(sa);
|
|
||||||
|
|
||||||
if (NET_InetAddressToSockaddr(env, iaObj, port, (struct sockaddr *)&sa,
|
if (NET_InetAddressToSockaddr(env, iaObj, port, &sa,
|
||||||
&sa_len, JNI_TRUE) != 0) {
|
&sa_len, JNI_TRUE) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = connect(fd, (struct sockaddr *)&sa, sa_len);
|
rv = connect(fd, &sa.sa, sa_len);
|
||||||
if (rv == SOCKET_ERROR) {
|
if (rv == SOCKET_ERROR) {
|
||||||
int err = WSAGetLastError();
|
int err = WSAGetLastError();
|
||||||
if (err == WSAEWOULDBLOCK) {
|
if (err == WSAEWOULDBLOCK) {
|
||||||
@ -217,7 +215,7 @@ JNIEXPORT jint JNICALL Java_java_net_DualStackPlainSocketImpl_localPort0
|
|||||||
SOCKETADDRESS sa;
|
SOCKETADDRESS sa;
|
||||||
int len = sizeof(sa);
|
int len = sizeof(sa);
|
||||||
|
|
||||||
if (getsockname(fd, (struct sockaddr *)&sa, &len) == SOCKET_ERROR) {
|
if (getsockname(fd, &sa.sa, &len) == SOCKET_ERROR) {
|
||||||
if (WSAGetLastError() == WSAENOTSOCK) {
|
if (WSAGetLastError() == WSAENOTSOCK) {
|
||||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||||
"Socket closed");
|
"Socket closed");
|
||||||
@ -243,11 +241,11 @@ JNIEXPORT void JNICALL Java_java_net_DualStackPlainSocketImpl_localAddress
|
|||||||
jclass iaContainerClass;
|
jclass iaContainerClass;
|
||||||
jfieldID iaFieldID;
|
jfieldID iaFieldID;
|
||||||
|
|
||||||
if (getsockname(fd, (struct sockaddr *)&sa, &len) == SOCKET_ERROR) {
|
if (getsockname(fd, &sa.sa, &len) == SOCKET_ERROR) {
|
||||||
NET_ThrowNew(env, WSAGetLastError(), "Error getting socket name");
|
NET_ThrowNew(env, WSAGetLastError(), "Error getting socket name");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
iaObj = NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa, &port);
|
iaObj = NET_SockaddrToInetAddress(env, &sa, &port);
|
||||||
CHECK_NULL(iaObj);
|
CHECK_NULL(iaObj);
|
||||||
|
|
||||||
iaContainerClass = (*env)->GetObjectClass(env, iaContainerObj);
|
iaContainerClass = (*env)->GetObjectClass(env, iaContainerObj);
|
||||||
@ -283,7 +281,7 @@ JNIEXPORT jint JNICALL Java_java_net_DualStackPlainSocketImpl_accept0
|
|||||||
int len = sizeof(sa);
|
int len = sizeof(sa);
|
||||||
|
|
||||||
memset((char *)&sa, 0, len);
|
memset((char *)&sa, 0, len);
|
||||||
newfd = accept(fd, (struct sockaddr *)&sa, &len);
|
newfd = accept(fd, &sa.sa, &len);
|
||||||
|
|
||||||
if (newfd == INVALID_SOCKET) {
|
if (newfd == INVALID_SOCKET) {
|
||||||
if (WSAGetLastError() == -2) {
|
if (WSAGetLastError() == -2) {
|
||||||
@ -298,7 +296,7 @@ JNIEXPORT jint JNICALL Java_java_net_DualStackPlainSocketImpl_accept0
|
|||||||
|
|
||||||
SetHandleInformation((HANDLE)(UINT_PTR)newfd, HANDLE_FLAG_INHERIT, 0);
|
SetHandleInformation((HANDLE)(UINT_PTR)newfd, HANDLE_FLAG_INHERIT, 0);
|
||||||
|
|
||||||
ia = NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa, &port);
|
ia = NET_SockaddrToInetAddress(env, &sa, &port);
|
||||||
isa = (*env)->NewObject(env, isa_class, isa_ctorID, ia, port);
|
isa = (*env)->NewObject(env, isa_class, isa_ctorID, ia, port);
|
||||||
(*env)->SetObjectArrayElement(env, isaa, 0, isa);
|
(*env)->SetObjectArrayElement(env, isaa, 0, isa);
|
||||||
|
|
||||||
|
@ -420,18 +420,13 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_bind0(JNIEnv *env, jobject this,
|
|||||||
jboolean exclBind) {
|
jboolean exclBind) {
|
||||||
jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
|
jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
|
||||||
jobject fd1Obj = (*env)->GetObjectField(env, this, pdsi_fd1ID);
|
jobject fd1Obj = (*env)->GetObjectField(env, this, pdsi_fd1ID);
|
||||||
|
|
||||||
int fd, fd1 = -1, family;
|
|
||||||
int ipv6_supported = ipv6_available();
|
int ipv6_supported = ipv6_available();
|
||||||
|
int fd, fd1 = -1, lcladdrlen = 0;
|
||||||
SOCKETADDRESS lcladdr;
|
SOCKETADDRESS lcladdr;
|
||||||
int lcladdrlen = sizeof(SOCKETADDRESS);
|
|
||||||
int address;
|
|
||||||
|
|
||||||
memset((char *)&lcladdr, 0, sizeof(lcladdr));
|
if (getInetAddress_family(env, addressObj) == java_net_InetAddress_IPv6 &&
|
||||||
|
!ipv6_supported)
|
||||||
family = getInetAddress_family(env, addressObj);
|
{
|
||||||
if (family == java_net_InetAddress_IPv6 && !ipv6_supported) {
|
|
||||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||||
"Protocol family not supported");
|
"Protocol family not supported");
|
||||||
return;
|
return;
|
||||||
@ -446,14 +441,13 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_bind0(JNIEnv *env, jobject this,
|
|||||||
fd1 = (*env)->GetIntField(env, fd1Obj, IO_fd_fdID);
|
fd1 = (*env)->GetIntField(env, fd1Obj, IO_fd_fdID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_NULL(addressObj)) {
|
if (IS_NULL(addressObj)) {
|
||||||
JNU_ThrowNullPointerException(env, "argument address");
|
JNU_ThrowNullPointerException(env, "argument address");
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
address = getInetAddress_addr(env, addressObj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NET_InetAddressToSockaddr(env, addressObj, port, &lcladdr.sa,
|
if (NET_InetAddressToSockaddr(env, addressObj, port, &lcladdr,
|
||||||
&lcladdrlen, JNI_FALSE) != 0) {
|
&lcladdrlen, JNI_FALSE) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -493,7 +487,7 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_bind0(JNIEnv *env, jobject this,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (NET_WinBind(fd, &lcladdr.sa, lcladdrlen, exclBind) == -1) {
|
if (NET_WinBind(fd, &lcladdr, lcladdrlen, exclBind) == -1) {
|
||||||
if (WSAGetLastError() == WSAEACCES) {
|
if (WSAGetLastError() == WSAEACCES) {
|
||||||
WSASetLastError(WSAEADDRINUSE);
|
WSASetLastError(WSAEADDRINUSE);
|
||||||
}
|
}
|
||||||
@ -520,27 +514,25 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_bind0(JNIEnv *env, jobject this,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_java_net_TwoStacksPlainDatagramSocketImpl_connect0(JNIEnv *env, jobject this,
|
Java_java_net_TwoStacksPlainDatagramSocketImpl_connect0
|
||||||
jobject address, jint port) {
|
(JNIEnv *env, jobject this, jobject address, jint port)
|
||||||
/* The object's field */
|
{
|
||||||
jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
|
jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
|
||||||
jobject fd1Obj = (*env)->GetObjectField(env, this, pdsi_fd1ID);
|
jobject fd1Obj = (*env)->GetObjectField(env, this, pdsi_fd1ID);
|
||||||
/* The fdObj'fd */
|
jint fd = -1, fd1 = -1, fdc, family;
|
||||||
jint fd=-1, fd1=-1, fdc;
|
|
||||||
/* The packetAddress address, family and port */
|
|
||||||
jint addr, family;
|
|
||||||
SOCKETADDRESS rmtaddr;
|
SOCKETADDRESS rmtaddr;
|
||||||
int rmtaddrlen;
|
int rmtaddrlen = 0;
|
||||||
int ipv6_supported = ipv6_available();
|
|
||||||
|
|
||||||
if (IS_NULL(fdObj) && IS_NULL(fd1Obj)) {
|
if (IS_NULL(fdObj) && IS_NULL(fd1Obj)) {
|
||||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||||
"Socket closed");
|
"Socket closed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IS_NULL(fdObj)) {
|
if (!IS_NULL(fdObj)) {
|
||||||
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IS_NULL(fd1Obj)) {
|
if (!IS_NULL(fd1Obj)) {
|
||||||
fd1 = (*env)->GetIntField(env, fd1Obj, IO_fd_fdID);
|
fd1 = (*env)->GetIntField(env, fd1Obj, IO_fd_fdID);
|
||||||
}
|
}
|
||||||
@ -550,10 +542,8 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_connect0(JNIEnv *env, jobject thi
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
addr = getInetAddress_addr(env, address);
|
|
||||||
|
|
||||||
family = getInetAddress_family(env, address);
|
family = getInetAddress_family(env, address);
|
||||||
if (family == java_net_InetAddress_IPv6 && !ipv6_supported) {
|
if (family == java_net_InetAddress_IPv6 && !ipv6_available()) {
|
||||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||||
"Protocol family not supported");
|
"Protocol family not supported");
|
||||||
return;
|
return;
|
||||||
@ -572,12 +562,12 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_connect0(JNIEnv *env, jobject thi
|
|||||||
res = WSAIoctl(fdc,SIO_UDP_CONNRESET,&t,sizeof(t),&x1,sizeof(x1),&x2,0,0);
|
res = WSAIoctl(fdc,SIO_UDP_CONNRESET,&t,sizeof(t),&x1,sizeof(x1),&x2,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NET_InetAddressToSockaddr(env, address, port, &rmtaddr.sa,
|
if (NET_InetAddressToSockaddr(env, address, port, &rmtaddr,
|
||||||
&rmtaddrlen, JNI_FALSE) != 0) {
|
&rmtaddrlen, JNI_FALSE) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connect(fdc, &rmtaddr.sa, sizeof(rmtaddr)) == -1) {
|
if (connect(fdc, &rmtaddr.sa, rmtaddrlen) == -1) {
|
||||||
NET_ThrowCurrent(env, "connect");
|
NET_ThrowCurrent(env, "connect");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -631,9 +621,9 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_disconnect0(JNIEnv *env, jobject
|
|||||||
* Signature: (Ljava/net/DatagramPacket;)V
|
* Signature: (Ljava/net/DatagramPacket;)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_java_net_TwoStacksPlainDatagramSocketImpl_send(JNIEnv *env, jobject this,
|
Java_java_net_TwoStacksPlainDatagramSocketImpl_send
|
||||||
jobject packet) {
|
(JNIEnv *env, jobject this, jobject packet)
|
||||||
|
{
|
||||||
char BUF[MAX_BUFFER_LEN];
|
char BUF[MAX_BUFFER_LEN];
|
||||||
char *fullPacket;
|
char *fullPacket;
|
||||||
jobject fdObj;
|
jobject fdObj;
|
||||||
@ -647,11 +637,10 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_send(JNIEnv *env, jobject this,
|
|||||||
jbyteArray packetBuffer;
|
jbyteArray packetBuffer;
|
||||||
jboolean connected;
|
jboolean connected;
|
||||||
|
|
||||||
SOCKETADDRESS rmtaddr, *addrp = &rmtaddr;
|
SOCKETADDRESS rmtaddr;
|
||||||
|
struct sockaddr *addrp = 0;
|
||||||
int addrlen = 0;
|
int addrlen = 0;
|
||||||
|
|
||||||
memset((char *)&rmtaddr, 0, sizeof(rmtaddr));
|
|
||||||
|
|
||||||
if (IS_NULL(packet)) {
|
if (IS_NULL(packet)) {
|
||||||
JNU_ThrowNullPointerException(env, "null packet");
|
JNU_ThrowNullPointerException(env, "null packet");
|
||||||
return;
|
return;
|
||||||
@ -696,14 +685,13 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_send(JNIEnv *env, jobject this,
|
|||||||
packetBufferLen = MAX_PACKET_LEN;
|
packetBufferLen = MAX_PACKET_LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connected) {
|
// sockaddr arg to sendto() is null if already connected
|
||||||
addrp = 0; /* arg to sendto () null in this case */
|
if (!connected) {
|
||||||
addrlen = 0;
|
if (NET_InetAddressToSockaddr(env, iaObj, packetPort, &rmtaddr,
|
||||||
} else {
|
|
||||||
if (NET_InetAddressToSockaddr(env, iaObj, packetPort, &rmtaddr.sa,
|
|
||||||
&addrlen, JNI_FALSE) != 0) {
|
&addrlen, JNI_FALSE) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
addrp = &rmtaddr.sa;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packetBufferLen > MAX_BUFFER_LEN) {
|
if (packetBufferLen > MAX_BUFFER_LEN) {
|
||||||
@ -753,10 +741,11 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_send(JNIEnv *env, jobject this,
|
|||||||
fullPacket = &(BUF[0]);
|
fullPacket = &(BUF[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
(*env)->GetByteArrayRegion(env, packetBuffer, packetBufferOffset, packetBufferLen,
|
(*env)->GetByteArrayRegion(env, packetBuffer, packetBufferOffset,
|
||||||
(jbyte *)fullPacket);
|
packetBufferLen, (jbyte *)fullPacket);
|
||||||
if (sendto(fd, fullPacket, packetBufferLen, 0,
|
if (sendto(fd, fullPacket, packetBufferLen, 0, addrp,
|
||||||
(struct sockaddr *)addrp, addrlen) == SOCKET_ERROR) {
|
addrlen) == SOCKET_ERROR)
|
||||||
|
{
|
||||||
NET_ThrowCurrent(env, "Datagram send failed");
|
NET_ThrowCurrent(env, "Datagram send failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1147,14 +1136,14 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_peekData(JNIEnv *env, jobject thi
|
|||||||
*/
|
*/
|
||||||
packetAddress = (*env)->GetObjectField(env, packet, dp_addressID);
|
packetAddress = (*env)->GetObjectField(env, packet, dp_addressID);
|
||||||
if (packetAddress != NULL) {
|
if (packetAddress != NULL) {
|
||||||
if (!NET_SockaddrEqualsInetAddress(env, &remote_addr.sa,
|
if (!NET_SockaddrEqualsInetAddress(env, &remote_addr,
|
||||||
packetAddress)) {
|
packetAddress)) {
|
||||||
/* force a new InetAddress to be created */
|
/* force a new InetAddress to be created */
|
||||||
packetAddress = NULL;
|
packetAddress = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (packetAddress == NULL) {
|
if (packetAddress == NULL) {
|
||||||
packetAddress = NET_SockaddrToInetAddress(env, &remote_addr.sa,
|
packetAddress = NET_SockaddrToInetAddress(env, &remote_addr,
|
||||||
&port);
|
&port);
|
||||||
/* stuff the new Inetaddress in the packet */
|
/* stuff the new Inetaddress in the packet */
|
||||||
(*env)->SetObjectField(env, packet, dp_addressID, packetAddress);
|
(*env)->SetObjectField(env, packet, dp_addressID, packetAddress);
|
||||||
@ -1431,20 +1420,21 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_receive0(JNIEnv *env, jobject thi
|
|||||||
* can't update any existing InetAddress because it is immutable
|
* can't update any existing InetAddress because it is immutable
|
||||||
*/
|
*/
|
||||||
packetAddress = (*env)->GetObjectField(env, packet, dp_addressID);
|
packetAddress = (*env)->GetObjectField(env, packet, dp_addressID);
|
||||||
|
|
||||||
if (packetAddress != NULL) {
|
if (packetAddress != NULL) {
|
||||||
if (!NET_SockaddrEqualsInetAddress(env, &remote_addr.sa, packetAddress)) {
|
if (!NET_SockaddrEqualsInetAddress(env, &remote_addr,
|
||||||
|
packetAddress)) {
|
||||||
/* force a new InetAddress to be created */
|
/* force a new InetAddress to be created */
|
||||||
packetAddress = NULL;
|
packetAddress = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (packetAddress == NULL) {
|
if (packetAddress == NULL) {
|
||||||
packetAddress = NET_SockaddrToInetAddress(env, &remote_addr.sa, &port);
|
packetAddress = NET_SockaddrToInetAddress(env, &remote_addr,
|
||||||
|
&port);
|
||||||
/* stuff the new Inetaddress in the packet */
|
/* stuff the new Inetaddress in the packet */
|
||||||
(*env)->SetObjectField(env, packet, dp_addressID, packetAddress);
|
(*env)->SetObjectField(env, packet, dp_addressID, packetAddress);
|
||||||
} else {
|
} else {
|
||||||
/* only get the new port number */
|
/* only get the new port number */
|
||||||
port = NET_GetPortFromSockaddr(&remote_addr.sa);
|
port = NET_GetPortFromSockaddr(&remote_addr);
|
||||||
}
|
}
|
||||||
/* populate the packet */
|
/* populate the packet */
|
||||||
(*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, n,
|
(*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, n,
|
||||||
@ -2255,7 +2245,7 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_socketLocalAddress
|
|||||||
(JNIEnv *env, jobject this, jint family)
|
(JNIEnv *env, jobject this, jint family)
|
||||||
{
|
{
|
||||||
int fd = -1, fd1 = -1;
|
int fd = -1, fd1 = -1;
|
||||||
SOCKETADDRESS him;
|
SOCKETADDRESS sa;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int port;
|
int port;
|
||||||
jobject iaObj;
|
jobject iaObj;
|
||||||
@ -2288,12 +2278,12 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_socketLocalAddress
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getsockname(fd, &him.sa, &len) == -1) {
|
if (getsockname(fd, &sa.sa, &len) == -1) {
|
||||||
JNU_ThrowByNameWithMessageAndLastError
|
JNU_ThrowByNameWithMessageAndLastError
|
||||||
(env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
|
(env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
iaObj = NET_SockaddrToInetAddress(env, &him.sa, &port);
|
iaObj = NET_SockaddrToInetAddress(env, &sa, &port);
|
||||||
|
|
||||||
return iaObj;
|
return iaObj;
|
||||||
}
|
}
|
||||||
@ -2452,7 +2442,7 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NET_InetAddressToSockaddr(env, iaObj, 0, &name.sa, &len, JNI_FALSE) != 0) {
|
if (NET_InetAddressToSockaddr(env, iaObj, 0, &name, &len, JNI_FALSE) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,11 +193,11 @@ Java_java_net_TwoStacksPlainSocketImpl_socketConnect(JNIEnv *env, jobject this,
|
|||||||
jobject fdObj = (*env)->GetObjectField(env, this, psi_fdID);
|
jobject fdObj = (*env)->GetObjectField(env, this, psi_fdID);
|
||||||
jobject fd1Obj = (*env)->GetObjectField(env, this, psi_fd1ID);
|
jobject fd1Obj = (*env)->GetObjectField(env, this, psi_fd1ID);
|
||||||
|
|
||||||
SOCKETADDRESS him;
|
SOCKETADDRESS sa;
|
||||||
|
|
||||||
/* The result of the connection */
|
/* The result of the connection */
|
||||||
int connect_res;
|
int connect_res;
|
||||||
memset((char *)&him, 0, sizeof(him));
|
memset((char *)&sa, 0, sizeof(sa));
|
||||||
|
|
||||||
if (!IS_NULL(fdObj)) {
|
if (!IS_NULL(fdObj)) {
|
||||||
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
||||||
@ -212,11 +212,12 @@ Java_java_net_TwoStacksPlainSocketImpl_socketConnect(JNIEnv *env, jobject this,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NET_InetAddressToSockaddr(env, iaObj, port, &him.sa, &len, JNI_FALSE) != 0) {
|
if (NET_InetAddressToSockaddr(env, iaObj, port, &sa, &len,
|
||||||
|
JNI_FALSE) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
family = him.sa.sa_family;
|
family = sa.sa.sa_family;
|
||||||
if (family == AF_INET6) {
|
if (family == AF_INET6) {
|
||||||
if (!ipv6_supported) {
|
if (!ipv6_supported) {
|
||||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||||
@ -248,7 +249,7 @@ Java_java_net_TwoStacksPlainSocketImpl_socketConnect(JNIEnv *env, jobject this,
|
|||||||
(*env)->SetObjectField(env, this, psi_fd1ID, NULL);
|
(*env)->SetObjectField(env, this, psi_fd1ID, NULL);
|
||||||
|
|
||||||
if (timeout <= 0) {
|
if (timeout <= 0) {
|
||||||
connect_res = connect(fd, &him.sa, sizeof(SOCKETADDRESS));
|
connect_res = connect(fd, &sa.sa, sizeof(SOCKETADDRESS));
|
||||||
if (connect_res == SOCKET_ERROR) {
|
if (connect_res == SOCKET_ERROR) {
|
||||||
connect_res = WSAGetLastError();
|
connect_res = WSAGetLastError();
|
||||||
}
|
}
|
||||||
@ -261,7 +262,7 @@ Java_java_net_TwoStacksPlainSocketImpl_socketConnect(JNIEnv *env, jobject this,
|
|||||||
ioctlsocket(fd, FIONBIO, &optval);
|
ioctlsocket(fd, FIONBIO, &optval);
|
||||||
|
|
||||||
/* initiate the connect */
|
/* initiate the connect */
|
||||||
connect_res = connect(fd, &him.sa, sizeof(SOCKETADDRESS));
|
connect_res = connect(fd, &sa.sa, sizeof(SOCKETADDRESS));
|
||||||
if (connect_res == SOCKET_ERROR) {
|
if (connect_res == SOCKET_ERROR) {
|
||||||
if (WSAGetLastError() != WSAEWOULDBLOCK) {
|
if (WSAGetLastError() != WSAEWOULDBLOCK) {
|
||||||
connect_res = WSAGetLastError();
|
connect_res = WSAGetLastError();
|
||||||
@ -362,7 +363,7 @@ Java_java_net_TwoStacksPlainSocketImpl_socketConnect(JNIEnv *env, jobject this,
|
|||||||
*/
|
*/
|
||||||
u_short port;
|
u_short port;
|
||||||
int len = sizeof(SOCKETADDRESS);
|
int len = sizeof(SOCKETADDRESS);
|
||||||
if (getsockname(fd, &him.sa, &len) == -1) {
|
if (getsockname(fd, &sa.sa, &len) == -1) {
|
||||||
if (WSAGetLastError() == WSAENOTSOCK) {
|
if (WSAGetLastError() == WSAENOTSOCK) {
|
||||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||||
"Socket closed");
|
"Socket closed");
|
||||||
@ -371,7 +372,7 @@ Java_java_net_TwoStacksPlainSocketImpl_socketConnect(JNIEnv *env, jobject this,
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
port = ntohs((u_short)GET_PORT(&him));
|
port = ntohs((u_short)GET_PORT(&sa));
|
||||||
(*env)->SetIntField(env, this, psi_localportID, (int) port);
|
(*env)->SetIntField(env, this, psi_localportID, (int) port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -396,7 +397,7 @@ Java_java_net_TwoStacksPlainSocketImpl_socketBind(JNIEnv *env, jobject this,
|
|||||||
int family;
|
int family;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
SOCKETADDRESS him;
|
SOCKETADDRESS sa;
|
||||||
|
|
||||||
fdObj = (*env)->GetObjectField(env, this, psi_fdID);
|
fdObj = (*env)->GetObjectField(env, this, psi_fdID);
|
||||||
fd1Obj = (*env)->GetObjectField(env, this, psi_fd1ID);
|
fd1Obj = (*env)->GetObjectField(env, this, psi_fd1ID);
|
||||||
@ -424,13 +425,13 @@ Java_java_net_TwoStacksPlainSocketImpl_socketBind(JNIEnv *env, jobject this,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NET_InetAddressToSockaddr(env, iaObj, localport, &him.sa, &len,
|
if (NET_InetAddressToSockaddr(env, iaObj, localport, &sa, &len,
|
||||||
JNI_FALSE) != 0) {
|
JNI_FALSE) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ipv6_supported) {
|
if (ipv6_supported) {
|
||||||
struct ipv6bind v6bind;
|
struct ipv6bind v6bind;
|
||||||
v6bind.addr = &him;
|
v6bind.addr = &sa.sa;
|
||||||
v6bind.ipv4_fd = fd;
|
v6bind.ipv4_fd = fd;
|
||||||
v6bind.ipv6_fd = fd1;
|
v6bind.ipv6_fd = fd1;
|
||||||
rv = NET_BindV6(&v6bind, exclBind);
|
rv = NET_BindV6(&v6bind, exclBind);
|
||||||
@ -462,7 +463,7 @@ Java_java_net_TwoStacksPlainSocketImpl_socketBind(JNIEnv *env, jobject this,
|
|||||||
(*env)->SetObjectField(env, this, psi_fd1ID, NULL);
|
(*env)->SetObjectField(env, this, psi_fd1ID, NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rv = NET_WinBind(fd, &him.sa, len, exclBind);
|
rv = NET_WinBind(fd, &sa, len, exclBind);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rv == -1) {
|
if (rv == -1) {
|
||||||
@ -481,11 +482,11 @@ Java_java_net_TwoStacksPlainSocketImpl_socketBind(JNIEnv *env, jobject this,
|
|||||||
int len = sizeof(SOCKETADDRESS);
|
int len = sizeof(SOCKETADDRESS);
|
||||||
u_short port;
|
u_short port;
|
||||||
|
|
||||||
if (getsockname(him.sa.sa_family == AF_INET ? fd: fd1, &him.sa, &len) == -1) {
|
if (getsockname(sa.sa.sa_family == AF_INET ? fd : fd1, &sa.sa, &len) == -1) {
|
||||||
NET_ThrowCurrent(env, "getsockname in plain socketBind");
|
NET_ThrowCurrent(env, "getsockname in plain socketBind");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
port = ntohs((u_short) GET_PORT (&him));
|
port = ntohs((u_short) GET_PORT (&sa));
|
||||||
|
|
||||||
(*env)->SetIntField(env, this, psi_localportID, (int)port);
|
(*env)->SetIntField(env, this, psi_localportID, (int)port);
|
||||||
} else {
|
} else {
|
||||||
@ -529,7 +530,7 @@ Java_java_net_TwoStacksPlainSocketImpl_socketListen
|
|||||||
JNU_ThrowNullPointerException(env, "socket address");
|
JNU_ThrowNullPointerException(env, "socket address");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NET_InetAddressToSockaddr(env, address, 0, &addr.sa, &addrlen,
|
if (NET_InetAddressToSockaddr(env, address, 0, &addr, &addrlen,
|
||||||
JNI_FALSE) != 0) {
|
JNI_FALSE) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -585,7 +586,7 @@ Java_java_net_TwoStacksPlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
|
|||||||
/* the fd int field on fdObj */
|
/* the fd int field on fdObj */
|
||||||
jint fd=-1, fd1=-1;
|
jint fd=-1, fd1=-1;
|
||||||
|
|
||||||
SOCKETADDRESS him;
|
SOCKETADDRESS sa;
|
||||||
jint len;
|
jint len;
|
||||||
|
|
||||||
if (IS_NULL(fdObj) && IS_NULL(fd1Obj)) {
|
if (IS_NULL(fdObj) && IS_NULL(fd1Obj)) {
|
||||||
@ -676,7 +677,7 @@ Java_java_net_TwoStacksPlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fd = accept(fd, &him.sa, &len);
|
fd = accept(fd, &sa.sa, &len);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
/* REMIND: SOCKET CLOSED PROBLEM */
|
/* REMIND: SOCKET CLOSED PROBLEM */
|
||||||
if (fd == -2) {
|
if (fd == -2) {
|
||||||
@ -691,7 +692,7 @@ Java_java_net_TwoStacksPlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
|
|||||||
SetHandleInformation((HANDLE)(UINT_PTR)fd, HANDLE_FLAG_INHERIT, 0);
|
SetHandleInformation((HANDLE)(UINT_PTR)fd, HANDLE_FLAG_INHERIT, 0);
|
||||||
(*env)->SetIntField(env, socketFdObj, IO_fd_fdID, fd);
|
(*env)->SetIntField(env, socketFdObj, IO_fd_fdID, fd);
|
||||||
|
|
||||||
if (him.sa.sa_family == AF_INET) {
|
if (sa.sa.sa_family == AF_INET) {
|
||||||
if (inet4Cls == NULL) {
|
if (inet4Cls == NULL) {
|
||||||
jclass c = (*env)->FindClass(env, "java/net/Inet4Address");
|
jclass c = (*env)->FindClass(env, "java/net/Inet4Address");
|
||||||
if (c != NULL) {
|
if (c != NULL) {
|
||||||
@ -717,7 +718,7 @@ Java_java_net_TwoStacksPlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setInetAddress_addr(env, socketAddressObj, ntohl(him.sa4.sin_addr.s_addr));
|
setInetAddress_addr(env, socketAddressObj, ntohl(sa.sa4.sin_addr.s_addr));
|
||||||
setInetAddress_family(env, socketAddressObj, java_net_InetAddress_IPv4);
|
setInetAddress_family(env, socketAddressObj, java_net_InetAddress_IPv4);
|
||||||
(*env)->SetObjectField(env, socket, psi_addressID, socketAddressObj);
|
(*env)->SetObjectField(env, socket, psi_addressID, socketAddressObj);
|
||||||
} else {
|
} else {
|
||||||
@ -743,14 +744,14 @@ Java_java_net_TwoStacksPlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
|
|||||||
NET_SocketClose(fd);
|
NET_SocketClose(fd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setInet6Address_ipaddress(env, socketAddressObj, (char *)&him.sa6.sin6_addr);
|
setInet6Address_ipaddress(env, socketAddressObj, (char *)&sa.sa6.sin6_addr);
|
||||||
setInetAddress_family(env, socketAddressObj, java_net_InetAddress_IPv6);
|
setInetAddress_family(env, socketAddressObj, java_net_InetAddress_IPv6);
|
||||||
setInet6Address_scopeid(env, socketAddressObj, him.sa6.sin6_scope_id);
|
setInet6Address_scopeid(env, socketAddressObj, sa.sa6.sin6_scope_id);
|
||||||
|
|
||||||
}
|
}
|
||||||
/* fields common to AF_INET and AF_INET6 */
|
/* fields common to AF_INET and AF_INET6 */
|
||||||
|
|
||||||
port = ntohs ((u_short) GET_PORT (&him));
|
port = ntohs ((u_short)GET_PORT(&sa));
|
||||||
(*env)->SetIntField(env, socket, psi_portID, (int)port);
|
(*env)->SetIntField(env, socket, psi_portID, (int)port);
|
||||||
port = (*env)->GetIntField(env, this, psi_localportID);
|
port = (*env)->GetIntField(env, this, psi_localportID);
|
||||||
(*env)->SetIntField(env, socket, psi_localportID, port);
|
(*env)->SetIntField(env, socket, psi_localportID, port);
|
||||||
@ -1025,14 +1026,14 @@ Java_java_net_TwoStacksPlainSocketImpl_socketGetOption
|
|||||||
* SO_BINDADDR isn't a socket option
|
* SO_BINDADDR isn't a socket option
|
||||||
*/
|
*/
|
||||||
if (opt == java_net_SocketOptions_SO_BINDADDR) {
|
if (opt == java_net_SocketOptions_SO_BINDADDR) {
|
||||||
SOCKETADDRESS him;
|
SOCKETADDRESS sa;
|
||||||
int len = sizeof(SOCKETADDRESS);
|
int len = sizeof(SOCKETADDRESS);
|
||||||
int port;
|
int port;
|
||||||
jobject iaObj;
|
jobject iaObj;
|
||||||
jclass iaCntrClass;
|
jclass iaCntrClass;
|
||||||
jfieldID iaFieldID;
|
jfieldID iaFieldID;
|
||||||
|
|
||||||
memset((char *)&him, 0, len);
|
memset((char *)&sa, 0, len);
|
||||||
|
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
/* must be an IPV6 only socket. Case where both sockets are != -1
|
/* must be an IPV6 only socket. Case where both sockets are != -1
|
||||||
@ -1041,12 +1042,12 @@ Java_java_net_TwoStacksPlainSocketImpl_socketGetOption
|
|||||||
fd = getFD1 (env, this);
|
fd = getFD1 (env, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getsockname(fd, &him.sa, &len) < 0) {
|
if (getsockname(fd, &sa.sa, &len) < 0) {
|
||||||
JNU_ThrowByNameWithMessageAndLastError
|
JNU_ThrowByNameWithMessageAndLastError
|
||||||
(env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
|
(env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
iaObj = NET_SockaddrToInetAddress(env, &him.sa, &port);
|
iaObj = NET_SockaddrToInetAddress(env, &sa, &port);
|
||||||
CHECK_NULL_RETURN(iaObj, -1);
|
CHECK_NULL_RETURN(iaObj, -1);
|
||||||
|
|
||||||
iaCntrClass = (*env)->GetObjectClass(env, iaContainerObj);
|
iaCntrClass = (*env)->GetObjectClass(env, iaContainerObj);
|
||||||
|
@ -488,10 +488,10 @@ void setExclusiveBind(int fd) {
|
|||||||
* Should be only called by the wrapper method NET_WinBind
|
* Should be only called by the wrapper method NET_WinBind
|
||||||
*/
|
*/
|
||||||
JNIEXPORT int JNICALL
|
JNIEXPORT int JNICALL
|
||||||
NET_Bind(int s, struct sockaddr *him, int len)
|
NET_Bind(int s, SOCKETADDRESS *sa, int len)
|
||||||
{
|
{
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
rv = bind(s, him, len);
|
rv = bind(s, &sa->sa, len);
|
||||||
|
|
||||||
if (rv == SOCKET_ERROR) {
|
if (rv == SOCKET_ERROR) {
|
||||||
/*
|
/*
|
||||||
@ -511,11 +511,11 @@ NET_Bind(int s, struct sockaddr *him, int len)
|
|||||||
* if required, and then calls NET_BIND
|
* if required, and then calls NET_BIND
|
||||||
*/
|
*/
|
||||||
JNIEXPORT int JNICALL
|
JNIEXPORT int JNICALL
|
||||||
NET_WinBind(int s, struct sockaddr *him, int len, jboolean exclBind)
|
NET_WinBind(int s, SOCKETADDRESS *sa, int len, jboolean exclBind)
|
||||||
{
|
{
|
||||||
if (exclBind == JNI_TRUE)
|
if (exclBind == JNI_TRUE)
|
||||||
setExclusiveBind(s);
|
setExclusiveBind(s);
|
||||||
return NET_Bind(s, him, len);
|
return NET_Bind(s, sa, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT int JNICALL
|
JNIEXPORT int JNICALL
|
||||||
@ -677,7 +677,7 @@ NET_BindV6(struct ipv6bind *b, jboolean exclBind) {
|
|||||||
if (family == AF_INET && (b->addr->sa4.sin_addr.s_addr != INADDR_ANY)) {
|
if (family == AF_INET && (b->addr->sa4.sin_addr.s_addr != INADDR_ANY)) {
|
||||||
/* bind to v4 only */
|
/* bind to v4 only */
|
||||||
int ret;
|
int ret;
|
||||||
ret = NET_WinBind((int)b->ipv4_fd, (struct sockaddr *)b->addr,
|
ret = NET_WinBind((int)b->ipv4_fd, b->addr,
|
||||||
sizeof(SOCKETADDRESS), exclBind);
|
sizeof(SOCKETADDRESS), exclBind);
|
||||||
if (ret == SOCKET_ERROR) {
|
if (ret == SOCKET_ERROR) {
|
||||||
CLOSE_SOCKETS_AND_RETURN;
|
CLOSE_SOCKETS_AND_RETURN;
|
||||||
@ -689,7 +689,7 @@ NET_BindV6(struct ipv6bind *b, jboolean exclBind) {
|
|||||||
if (family == AF_INET6 && (!IN6_IS_ADDR_ANY(&b->addr->sa6.sin6_addr))) {
|
if (family == AF_INET6 && (!IN6_IS_ADDR_ANY(&b->addr->sa6.sin6_addr))) {
|
||||||
/* bind to v6 only */
|
/* bind to v6 only */
|
||||||
int ret;
|
int ret;
|
||||||
ret = NET_WinBind((int)b->ipv6_fd, (struct sockaddr *)b->addr,
|
ret = NET_WinBind((int)b->ipv6_fd, b->addr,
|
||||||
sizeof(SOCKETADDRESS), exclBind);
|
sizeof(SOCKETADDRESS), exclBind);
|
||||||
if (ret == SOCKET_ERROR) {
|
if (ret == SOCKET_ERROR) {
|
||||||
CLOSE_SOCKETS_AND_RETURN;
|
CLOSE_SOCKETS_AND_RETURN;
|
||||||
@ -719,7 +719,7 @@ NET_BindV6(struct ipv6bind *b, jboolean exclBind) {
|
|||||||
oaddr.sa4.sin_addr.s_addr = INADDR_ANY;
|
oaddr.sa4.sin_addr.s_addr = INADDR_ANY;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = NET_WinBind(fd, (struct sockaddr *)b->addr, sizeof(SOCKETADDRESS), exclBind);
|
rv = NET_WinBind(fd, b->addr, sizeof(SOCKETADDRESS), exclBind);
|
||||||
if (rv == SOCKET_ERROR) {
|
if (rv == SOCKET_ERROR) {
|
||||||
CLOSE_SOCKETS_AND_RETURN;
|
CLOSE_SOCKETS_AND_RETURN;
|
||||||
}
|
}
|
||||||
@ -731,7 +731,7 @@ NET_BindV6(struct ipv6bind *b, jboolean exclBind) {
|
|||||||
}
|
}
|
||||||
bound_port = GET_PORT (b->addr);
|
bound_port = GET_PORT (b->addr);
|
||||||
SET_PORT (&oaddr, bound_port);
|
SET_PORT (&oaddr, bound_port);
|
||||||
if ((rv = NET_WinBind(ofd, &oaddr.sa,
|
if ((rv = NET_WinBind(ofd, &oaddr,
|
||||||
sizeof(SOCKETADDRESS), exclBind)) == SOCKET_ERROR) {
|
sizeof(SOCKETADDRESS), exclBind)) == SOCKET_ERROR) {
|
||||||
int retries;
|
int retries;
|
||||||
int sotype, arglen=sizeof(sotype);
|
int sotype, arglen=sizeof(sotype);
|
||||||
@ -768,7 +768,7 @@ NET_BindV6(struct ipv6bind *b, jboolean exclBind) {
|
|||||||
|
|
||||||
/* bind random port on first socket */
|
/* bind random port on first socket */
|
||||||
SET_PORT (&oaddr, 0);
|
SET_PORT (&oaddr, 0);
|
||||||
rv = NET_WinBind(ofd, &oaddr.sa, sizeof(SOCKETADDRESS), exclBind);
|
rv = NET_WinBind(ofd, &oaddr, sizeof(SOCKETADDRESS), exclBind);
|
||||||
if (rv == SOCKET_ERROR) {
|
if (rv == SOCKET_ERROR) {
|
||||||
CLOSE_SOCKETS_AND_RETURN;
|
CLOSE_SOCKETS_AND_RETURN;
|
||||||
}
|
}
|
||||||
@ -784,8 +784,7 @@ NET_BindV6(struct ipv6bind *b, jboolean exclBind) {
|
|||||||
}
|
}
|
||||||
bound_port = GET_PORT (&oaddr);
|
bound_port = GET_PORT (&oaddr);
|
||||||
SET_PORT (b->addr, bound_port);
|
SET_PORT (b->addr, bound_port);
|
||||||
rv = NET_WinBind(fd, (struct sockaddr *)b->addr,
|
rv = NET_WinBind(fd, b->addr, sizeof(SOCKETADDRESS), exclBind);
|
||||||
sizeof(SOCKETADDRESS), exclBind);
|
|
||||||
|
|
||||||
if (rv != SOCKET_ERROR) {
|
if (rv != SOCKET_ERROR) {
|
||||||
if (family == AF_INET) {
|
if (family == AF_INET) {
|
||||||
@ -853,31 +852,33 @@ NET_EnableFastTcpLoopback(int fd) {
|
|||||||
return result == SOCKET_ERROR ? WSAGetLastError() : 0;
|
return result == SOCKET_ERROR ? WSAGetLastError() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If address types is IPv6, then IPv6 must be available. Otherwise
|
/**
|
||||||
* no address can be generated. In the case of an IPv4 Inetaddress this
|
* See net_util.h for documentation
|
||||||
* method will return an IPv4 mapped address where IPv6 is available and
|
|
||||||
* v4MappedAddress is TRUE. Otherwise it will return a sockaddr_in
|
|
||||||
* structure for an IPv4 InetAddress.
|
|
||||||
*/
|
*/
|
||||||
JNIEXPORT int JNICALL
|
JNIEXPORT int JNICALL
|
||||||
NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr *him,
|
NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port,
|
||||||
int *len, jboolean v4MappedAddress) {
|
SOCKETADDRESS *sa, int *len,
|
||||||
jint family, iafam;
|
jboolean v4MappedAddress)
|
||||||
iafam = getInetAddress_family(env, iaObj);
|
{
|
||||||
family = (iafam == java_net_InetAddress_IPv4)? AF_INET : AF_INET6;
|
jint family = getInetAddress_family(env, iaObj);
|
||||||
if (ipv6_available() && !(family == AF_INET && v4MappedAddress == JNI_FALSE)) {
|
memset((char *)sa, 0, sizeof(SOCKETADDRESS));
|
||||||
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
|
|
||||||
jbyte caddr[16];
|
|
||||||
jint address, scopeid = 0;
|
|
||||||
jint cached_scope_id = 0;
|
|
||||||
|
|
||||||
if (family == AF_INET) { /* will convert to IPv4-mapped address */
|
if (ipv6_available() &&
|
||||||
|
!(family == java_net_InetAddress_IPv4 &&
|
||||||
|
v4MappedAddress == JNI_FALSE))
|
||||||
|
{
|
||||||
|
jbyte caddr[16];
|
||||||
|
jint address;
|
||||||
|
unsigned int scopeid = 0, cached_scope_id = 0;
|
||||||
|
|
||||||
|
if (family == java_net_InetAddress_IPv4) {
|
||||||
|
// convert to IPv4-mapped address
|
||||||
memset((char *)caddr, 0, 16);
|
memset((char *)caddr, 0, 16);
|
||||||
address = getInetAddress_addr(env, iaObj);
|
address = getInetAddress_addr(env, iaObj);
|
||||||
if (address == INADDR_ANY) {
|
if (address == INADDR_ANY) {
|
||||||
/* we would always prefer IPv6 wildcard address
|
/* we would always prefer IPv6 wildcard address
|
||||||
caddr[10] = 0xff;
|
* caddr[10] = 0xff;
|
||||||
caddr[11] = 0xff; */
|
* caddr[11] = 0xff; */
|
||||||
} else {
|
} else {
|
||||||
caddr[10] = 0xff;
|
caddr[10] = 0xff;
|
||||||
caddr[11] = 0xff;
|
caddr[11] = 0xff;
|
||||||
@ -889,46 +890,39 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
|
|||||||
} else {
|
} else {
|
||||||
getInet6Address_ipaddress(env, iaObj, (char *)caddr);
|
getInet6Address_ipaddress(env, iaObj, (char *)caddr);
|
||||||
scopeid = getInet6Address_scopeid(env, iaObj);
|
scopeid = getInet6Address_scopeid(env, iaObj);
|
||||||
cached_scope_id = (jint)(*env)->GetIntField(env, iaObj, ia6_cachedscopeidID);
|
cached_scope_id = (unsigned int)(*env)->GetIntField(env, iaObj, ia6_cachedscopeidID);
|
||||||
}
|
}
|
||||||
|
sa->sa6.sin6_port = (u_short)htons((u_short)port);
|
||||||
memset((char *)him6, 0, sizeof(struct sockaddr_in6));
|
memcpy((void *)&sa->sa6.sin6_addr, caddr, sizeof(struct in6_addr));
|
||||||
him6->sin6_port = (u_short) htons((u_short)port);
|
sa->sa6.sin6_family = AF_INET6;
|
||||||
memcpy((void *)&(him6->sin6_addr), caddr, sizeof(struct in6_addr) );
|
if ((family == java_net_InetAddress_IPv6) &&
|
||||||
him6->sin6_family = AF_INET6;
|
IN6_IS_ADDR_LINKLOCAL(&sa->sa6.sin6_addr) &&
|
||||||
if ((family == AF_INET6) && IN6_IS_ADDR_LINKLOCAL( &(him6->sin6_addr) )
|
(!scopeid && !cached_scope_id))
|
||||||
&& (!scopeid && !cached_scope_id)) {
|
{
|
||||||
cached_scope_id = getDefaultIPv6Interface(env, him6);
|
cached_scope_id = getDefaultIPv6Interface(env, &sa->sa6);
|
||||||
(*env)->SetIntField(env, iaObj, ia6_cachedscopeidID, cached_scope_id);
|
(*env)->SetIntField(env, iaObj, ia6_cachedscopeidID, cached_scope_id);
|
||||||
}
|
}
|
||||||
him6->sin6_scope_id = scopeid != 0 ? scopeid : cached_scope_id;
|
sa->sa6.sin6_scope_id = scopeid == 0 ? cached_scope_id : scopeid;
|
||||||
|
if (len != NULL) {
|
||||||
*len = sizeof(struct sockaddr_in6);
|
*len = sizeof(struct sockaddr_in6);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
struct sockaddr_in *him4 = (struct sockaddr_in *)him;
|
|
||||||
jint address;
|
jint address;
|
||||||
if (family != AF_INET) {
|
if (family != java_net_InetAddress_IPv4) {
|
||||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Protocol family unavailable");
|
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Protocol family unavailable");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memset((char *)him4, 0, sizeof(struct sockaddr_in));
|
|
||||||
address = getInetAddress_addr(env, iaObj);
|
address = getInetAddress_addr(env, iaObj);
|
||||||
him4->sin_port = htons((short) port);
|
sa->sa4.sin_port = htons((short)port);
|
||||||
him4->sin_addr.s_addr = (u_long) htonl(address);
|
sa->sa4.sin_addr.s_addr = (u_long)htonl(address);
|
||||||
him4->sin_family = AF_INET;
|
sa->sa4.sin_family = AF_INET;
|
||||||
|
if (len != NULL) {
|
||||||
*len = sizeof(struct sockaddr_in);
|
*len = sizeof(struct sockaddr_in);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
|
||||||
NET_GetPortFromSockaddr(struct sockaddr *him) {
|
|
||||||
if (him->sa_family == AF_INET6) {
|
|
||||||
return ntohs(((struct sockaddr_in6 *)him)->sin6_port);
|
|
||||||
} else {
|
|
||||||
return ntohs(((struct sockaddr_in *)him)->sin_port);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
NET_IsIPv4Mapped(jbyte* caddr) {
|
NET_IsIPv4Mapped(jbyte* caddr) {
|
||||||
int i;
|
int i;
|
||||||
@ -961,16 +955,6 @@ NET_IsEqual(jbyte* caddr1, jbyte* caddr2) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getScopeID(struct sockaddr *him) {
|
|
||||||
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
|
|
||||||
return him6->sin6_scope_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cmpScopeID(unsigned int scope, struct sockaddr *him) {
|
|
||||||
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
|
|
||||||
return him6->sin6_scope_id == scope;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for select/poll with timeout on a single file descriptor.
|
* Wrapper for select/poll with timeout on a single file descriptor.
|
||||||
*
|
*
|
||||||
|
@ -121,7 +121,7 @@ JNIEXPORT int JNICALL NET_Timeout2(int fd, int fd1, long timeout, int *fdret);
|
|||||||
|
|
||||||
JNIEXPORT int JNICALL NET_BindV6(struct ipv6bind *b, jboolean exclBind);
|
JNIEXPORT int JNICALL NET_BindV6(struct ipv6bind *b, jboolean exclBind);
|
||||||
|
|
||||||
JNIEXPORT int JNICALL NET_WinBind(int s, struct sockaddr *him, int len,
|
JNIEXPORT int JNICALL NET_WinBind(int s, SOCKETADDRESS *sa, int len,
|
||||||
jboolean exclBind);
|
jboolean exclBind);
|
||||||
|
|
||||||
/* XP versions of the native routines */
|
/* XP versions of the native routines */
|
||||||
|
@ -96,7 +96,7 @@ jboolean purgeOutstandingICMP(JNIEnv *env, jclass clazz, jint fd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (recvfrom(fd, buf, 1, MSG_PEEK,
|
if (recvfrom(fd, buf, 1, MSG_PEEK,
|
||||||
(struct sockaddr *)&sa, &addrlen) != SOCKET_ERROR) {
|
&sa.sa, &addrlen) != SOCKET_ERROR) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (WSAGetLastError() != WSAECONNRESET) {
|
if (WSAGetLastError() != WSAECONNRESET) {
|
||||||
@ -104,7 +104,7 @@ jboolean purgeOutstandingICMP(JNIEnv *env, jclass clazz, jint fd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
recvfrom(fd, buf, 1, 0, (struct sockaddr *)&sa, &addrlen);
|
recvfrom(fd, buf, 1, 0, &sa.sa, &addrlen);
|
||||||
got_icmp = JNI_TRUE;
|
got_icmp = JNI_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ Java_sun_nio_ch_DatagramChannelImpl_disconnect0(JNIEnv *env, jobject this,
|
|||||||
|
|
||||||
memset(&sa, 0, sa_len);
|
memset(&sa, 0, sa_len);
|
||||||
|
|
||||||
rv = connect((SOCKET)fd, (struct sockaddr *)&sa, sa_len);
|
rv = connect((SOCKET)fd, &sa.sa, sa_len);
|
||||||
if (rv == SOCKET_ERROR) {
|
if (rv == SOCKET_ERROR) {
|
||||||
handleSocketError(env, WSAGetLastError());
|
handleSocketError(env, WSAGetLastError());
|
||||||
} else {
|
} else {
|
||||||
@ -153,7 +153,7 @@ Java_sun_nio_ch_DatagramChannelImpl_receive0(JNIEnv *env, jobject this,
|
|||||||
(char *)buf,
|
(char *)buf,
|
||||||
len,
|
len,
|
||||||
0,
|
0,
|
||||||
(struct sockaddr *)&sa,
|
&sa.sa,
|
||||||
&sa_len);
|
&sa_len);
|
||||||
|
|
||||||
if (n == SOCKET_ERROR) {
|
if (n == SOCKET_ERROR) {
|
||||||
@ -182,12 +182,11 @@ Java_sun_nio_ch_DatagramChannelImpl_receive0(JNIEnv *env, jobject this,
|
|||||||
*/
|
*/
|
||||||
senderAddr = (*env)->GetObjectField(env, this, dci_senderAddrID);
|
senderAddr = (*env)->GetObjectField(env, this, dci_senderAddrID);
|
||||||
if (senderAddr != NULL) {
|
if (senderAddr != NULL) {
|
||||||
if (!NET_SockaddrEqualsInetAddress(env, (struct sockaddr *)&sa,
|
if (!NET_SockaddrEqualsInetAddress(env, &sa, senderAddr)) {
|
||||||
senderAddr)) {
|
|
||||||
senderAddr = NULL;
|
senderAddr = NULL;
|
||||||
} else {
|
} else {
|
||||||
jint port = (*env)->GetIntField(env, this, dci_senderPortID);
|
jint port = (*env)->GetIntField(env, this, dci_senderPortID);
|
||||||
if (port != NET_GetPortFromSockaddr((struct sockaddr *)&sa)) {
|
if (port != NET_GetPortFromSockaddr(&sa)) {
|
||||||
senderAddr = NULL;
|
senderAddr = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -195,7 +194,7 @@ Java_sun_nio_ch_DatagramChannelImpl_receive0(JNIEnv *env, jobject this,
|
|||||||
if (senderAddr == NULL) {
|
if (senderAddr == NULL) {
|
||||||
jobject isa = NULL;
|
jobject isa = NULL;
|
||||||
int port;
|
int port;
|
||||||
jobject ia = NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa, &port);
|
jobject ia = NET_SockaddrToInetAddress(env, &sa, &port);
|
||||||
if (ia != NULL) {
|
if (ia != NULL) {
|
||||||
isa = (*env)->NewObject(env, isa_class, isa_ctorID, ia, port);
|
isa = (*env)->NewObject(env, isa_class, isa_ctorID, ia, port);
|
||||||
}
|
}
|
||||||
@ -204,7 +203,7 @@ Java_sun_nio_ch_DatagramChannelImpl_receive0(JNIEnv *env, jobject this,
|
|||||||
// update cachedSenderInetAddress/cachedSenderPort
|
// update cachedSenderInetAddress/cachedSenderPort
|
||||||
(*env)->SetObjectField(env, this, dci_senderAddrID, ia);
|
(*env)->SetObjectField(env, this, dci_senderAddrID, ia);
|
||||||
(*env)->SetIntField(env, this, dci_senderPortID,
|
(*env)->SetIntField(env, this, dci_senderPortID,
|
||||||
NET_GetPortFromSockaddr((struct sockaddr *)&sa));
|
NET_GetPortFromSockaddr(&sa));
|
||||||
(*env)->SetObjectField(env, this, dci_senderID, isa);
|
(*env)->SetObjectField(env, this, dci_senderID, isa);
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
@ -219,21 +218,15 @@ Java_sun_nio_ch_DatagramChannelImpl_send0(JNIEnv *env, jobject this,
|
|||||||
jint fd = fdval(env, fdo);
|
jint fd = fdval(env, fdo);
|
||||||
void *buf = (void *)jlong_to_ptr(address);
|
void *buf = (void *)jlong_to_ptr(address);
|
||||||
SOCKETADDRESS sa;
|
SOCKETADDRESS sa;
|
||||||
int sa_len;
|
int sa_len = 0;
|
||||||
jint rv = 0;
|
jint rv = 0;
|
||||||
|
|
||||||
if (NET_InetAddressToSockaddr(env, destAddress, destPort,
|
if (NET_InetAddressToSockaddr(env, destAddress, destPort, &sa,
|
||||||
(struct sockaddr *)&sa,
|
|
||||||
&sa_len, preferIPv6) != 0) {
|
&sa_len, preferIPv6) != 0) {
|
||||||
return IOS_THROWN;
|
return IOS_THROWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = sendto((SOCKET)fd,
|
rv = sendto((SOCKET)fd, buf, len, 0, &sa.sa, sa_len);
|
||||||
buf,
|
|
||||||
len,
|
|
||||||
0,
|
|
||||||
(struct sockaddr *)&sa,
|
|
||||||
sa_len);
|
|
||||||
if (rv == SOCKET_ERROR) {
|
if (rv == SOCKET_ERROR) {
|
||||||
int theErr = (jint)WSAGetLastError();
|
int theErr = (jint)WSAGetLastError();
|
||||||
if (theErr == WSAEWOULDBLOCK) {
|
if (theErr == WSAEWOULDBLOCK) {
|
||||||
|
@ -168,13 +168,13 @@ Java_sun_nio_ch_Net_bind0(JNIEnv *env, jclass clazz, jobject fdo, jboolean prefe
|
|||||||
{
|
{
|
||||||
SOCKETADDRESS sa;
|
SOCKETADDRESS sa;
|
||||||
int rv;
|
int rv;
|
||||||
int sa_len;
|
int sa_len = 0;
|
||||||
|
|
||||||
if (NET_InetAddressToSockaddr(env, iao, port, (struct sockaddr *)&sa, &sa_len, preferIPv6) != 0) {
|
if (NET_InetAddressToSockaddr(env, iao, port, &sa, &sa_len, preferIPv6) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = NET_WinBind(fdval(env, fdo), (struct sockaddr *)&sa, sa_len, isExclBind);
|
rv = NET_WinBind(fdval(env, fdo), &sa, sa_len, isExclBind);
|
||||||
if (rv == SOCKET_ERROR)
|
if (rv == SOCKET_ERROR)
|
||||||
NET_ThrowNew(env, WSAGetLastError(), "bind");
|
NET_ThrowNew(env, WSAGetLastError(), "bind");
|
||||||
}
|
}
|
||||||
@ -194,14 +194,14 @@ Java_sun_nio_ch_Net_connect0(JNIEnv *env, jclass clazz, jboolean preferIPv6, job
|
|||||||
{
|
{
|
||||||
SOCKETADDRESS sa;
|
SOCKETADDRESS sa;
|
||||||
int rv;
|
int rv;
|
||||||
int sa_len;
|
int sa_len = 0;
|
||||||
SOCKET s = (SOCKET)fdval(env, fdo);
|
SOCKET s = (SOCKET)fdval(env, fdo);
|
||||||
|
|
||||||
if (NET_InetAddressToSockaddr(env, iao, port, (struct sockaddr *)&sa, &sa_len, preferIPv6) != 0) {
|
if (NET_InetAddressToSockaddr(env, iao, port, &sa, &sa_len, preferIPv6) != 0) {
|
||||||
return IOS_THROWN;
|
return IOS_THROWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = connect(s, (struct sockaddr *)&sa, sa_len);
|
rv = connect(s, &sa.sa, sa_len);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
int err = WSAGetLastError();
|
int err = WSAGetLastError();
|
||||||
if (err == WSAEINPROGRESS || err == WSAEWOULDBLOCK) {
|
if (err == WSAEINPROGRESS || err == WSAEWOULDBLOCK) {
|
||||||
@ -226,7 +226,7 @@ Java_sun_nio_ch_Net_localPort(JNIEnv *env, jclass clazz, jobject fdo)
|
|||||||
SOCKETADDRESS sa;
|
SOCKETADDRESS sa;
|
||||||
int sa_len = sizeof(sa);
|
int sa_len = sizeof(sa);
|
||||||
|
|
||||||
if (getsockname(fdval(env, fdo), (struct sockaddr *)&sa, &sa_len) < 0) {
|
if (getsockname(fdval(env, fdo), &sa.sa, &sa_len) < 0) {
|
||||||
int error = WSAGetLastError();
|
int error = WSAGetLastError();
|
||||||
if (error == WSAEINVAL) {
|
if (error == WSAEINVAL) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -234,7 +234,7 @@ Java_sun_nio_ch_Net_localPort(JNIEnv *env, jclass clazz, jobject fdo)
|
|||||||
NET_ThrowNew(env, error, "getsockname");
|
NET_ThrowNew(env, error, "getsockname");
|
||||||
return IOS_THROWN;
|
return IOS_THROWN;
|
||||||
}
|
}
|
||||||
return NET_GetPortFromSockaddr((struct sockaddr *)&sa);
|
return NET_GetPortFromSockaddr(&sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jobject JNICALL
|
JNIEXPORT jobject JNICALL
|
||||||
@ -244,11 +244,11 @@ Java_sun_nio_ch_Net_localInetAddress(JNIEnv *env, jclass clazz, jobject fdo)
|
|||||||
int sa_len = sizeof(sa);
|
int sa_len = sizeof(sa);
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
if (getsockname(fdval(env, fdo), (struct sockaddr *)&sa, &sa_len) < 0) {
|
if (getsockname(fdval(env, fdo), &sa.sa, &sa_len) < 0) {
|
||||||
NET_ThrowNew(env, WSAGetLastError(), "getsockname");
|
NET_ThrowNew(env, WSAGetLastError(), "getsockname");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa, &port);
|
return NET_SockaddrToInetAddress(env, &sa, &port);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
@ -257,7 +257,7 @@ Java_sun_nio_ch_Net_remotePort(JNIEnv *env, jclass clazz, jobject fdo)
|
|||||||
SOCKETADDRESS sa;
|
SOCKETADDRESS sa;
|
||||||
int sa_len = sizeof(sa);
|
int sa_len = sizeof(sa);
|
||||||
|
|
||||||
if (getpeername(fdval(env, fdo), (struct sockaddr *)&sa, &sa_len) < 0) {
|
if (getpeername(fdval(env, fdo), &sa.sa, &sa_len) < 0) {
|
||||||
int error = WSAGetLastError();
|
int error = WSAGetLastError();
|
||||||
if (error == WSAEINVAL) {
|
if (error == WSAEINVAL) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -265,7 +265,7 @@ Java_sun_nio_ch_Net_remotePort(JNIEnv *env, jclass clazz, jobject fdo)
|
|||||||
NET_ThrowNew(env, error, "getsockname");
|
NET_ThrowNew(env, error, "getsockname");
|
||||||
return IOS_THROWN;
|
return IOS_THROWN;
|
||||||
}
|
}
|
||||||
return NET_GetPortFromSockaddr((struct sockaddr *)&sa);
|
return NET_GetPortFromSockaddr(&sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jobject JNICALL
|
JNIEXPORT jobject JNICALL
|
||||||
@ -275,11 +275,11 @@ Java_sun_nio_ch_Net_remoteInetAddress(JNIEnv *env, jclass clazz, jobject fdo)
|
|||||||
int sa_len = sizeof(sa);
|
int sa_len = sizeof(sa);
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
if (getpeername(fdval(env, fdo), (struct sockaddr *)&sa, &sa_len) < 0) {
|
if (getpeername(fdval(env, fdo), &sa.sa, &sa_len) < 0) {
|
||||||
NET_ThrowNew(env, WSAGetLastError(), "getsockname");
|
NET_ThrowNew(env, WSAGetLastError(), "getsockname");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa, &port);
|
return NET_SockaddrToInetAddress(env, &sa, &port);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
|
@ -95,7 +95,7 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this,
|
|||||||
int addrlen = sizeof(sa);
|
int addrlen = sizeof(sa);
|
||||||
|
|
||||||
memset((char *)&sa, 0, sizeof(sa));
|
memset((char *)&sa, 0, sizeof(sa));
|
||||||
newfd = (jint)accept(ssfd, (struct sockaddr *)&sa, &addrlen);
|
newfd = (jint)accept(ssfd, &sa.sa, &addrlen);
|
||||||
if (newfd == INVALID_SOCKET) {
|
if (newfd == INVALID_SOCKET) {
|
||||||
int theErr = (jint)WSAGetLastError();
|
int theErr = (jint)WSAGetLastError();
|
||||||
if (theErr == WSAEWOULDBLOCK) {
|
if (theErr == WSAEWOULDBLOCK) {
|
||||||
@ -107,7 +107,7 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this,
|
|||||||
|
|
||||||
SetHandleInformation((HANDLE)(UINT_PTR)newfd, HANDLE_FLAG_INHERIT, 0);
|
SetHandleInformation((HANDLE)(UINT_PTR)newfd, HANDLE_FLAG_INHERIT, 0);
|
||||||
(*env)->SetIntField(env, newfdo, fd_fdID, newfd);
|
(*env)->SetIntField(env, newfdo, fd_fdID, newfd);
|
||||||
remote_ia = NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa, (int *)&remote_port);
|
remote_ia = NET_SockaddrToInetAddress(env, &sa, (int *)&remote_port);
|
||||||
CHECK_NULL_RETURN(remote_ia, IOS_THROWN);
|
CHECK_NULL_RETURN(remote_ia, IOS_THROWN);
|
||||||
|
|
||||||
isa = (*env)->NewObject(env, isa_class, isa_ctorID, remote_ia, remote_port);
|
isa = (*env)->NewObject(env, isa_class, isa_ctorID, remote_ia, remote_port);
|
||||||
|
@ -92,22 +92,17 @@ Java_sun_nio_ch_WindowsAsynchronousSocketChannelImpl_connect0(JNIEnv* env, jclas
|
|||||||
OVERLAPPED *lpOverlapped = (OVERLAPPED *)jlong_to_ptr(ov);
|
OVERLAPPED *lpOverlapped = (OVERLAPPED *)jlong_to_ptr(ov);
|
||||||
|
|
||||||
SOCKETADDRESS sa;
|
SOCKETADDRESS sa;
|
||||||
int sa_len;
|
int sa_len = 0;
|
||||||
BOOL res;
|
BOOL res;
|
||||||
|
|
||||||
if (NET_InetAddressToSockaddr(env, iao, port, (struct sockaddr *)&sa, &sa_len, preferIPv6) != 0) {
|
if (NET_InetAddressToSockaddr(env, iao, port, &sa, &sa_len,
|
||||||
|
preferIPv6) != 0) {
|
||||||
return IOS_THROWN;
|
return IOS_THROWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroMemory((PVOID)lpOverlapped, sizeof(OVERLAPPED));
|
ZeroMemory((PVOID)lpOverlapped, sizeof(OVERLAPPED));
|
||||||
|
|
||||||
res = (*ConnectEx_func)(s,
|
res = (*ConnectEx_func)(s, &sa.sa, sa_len, NULL, 0, NULL, lpOverlapped);
|
||||||
(struct sockaddr *)&sa,
|
|
||||||
sa_len,
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
lpOverlapped);
|
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
int error = GetLastError();
|
int error = GetLastError();
|
||||||
if (error == ERROR_IO_PENDING) {
|
if (error == ERROR_IO_PENDING) {
|
||||||
|
@ -231,6 +231,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
private boolean isFullScreenAnimationOn;
|
private boolean isFullScreenAnimationOn;
|
||||||
|
|
||||||
private volatile boolean isInFullScreen;
|
private volatile boolean isInFullScreen;
|
||||||
|
private volatile boolean isIconifyAnimationActive;
|
||||||
|
|
||||||
private Window target;
|
private Window target;
|
||||||
private LWWindowPeer peer;
|
private LWWindowPeer peer;
|
||||||
@ -997,6 +998,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
if (peer != null) {
|
if (peer != null) {
|
||||||
peer.notifyIconify(iconify);
|
peer.notifyIconify(iconify);
|
||||||
}
|
}
|
||||||
|
if (iconify) {
|
||||||
|
isIconifyAnimationActive = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deliverZoom(final boolean isZoomed) {
|
private void deliverZoom(final boolean isZoomed) {
|
||||||
@ -1071,6 +1075,17 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isIconified() {
|
||||||
|
boolean isIconified = false;
|
||||||
|
if (target instanceof Frame) {
|
||||||
|
int state = ((Frame)target).getExtendedState();
|
||||||
|
if ((state & Frame.ICONIFIED) != 0) {
|
||||||
|
isIconified = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isIconifyAnimationActive || isIconified;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isOneOfOwnersOrSelf(CPlatformWindow window) {
|
private boolean isOneOfOwnersOrSelf(CPlatformWindow window) {
|
||||||
while (window != null) {
|
while (window != null) {
|
||||||
if (this == window) {
|
if (this == window) {
|
||||||
@ -1094,12 +1109,15 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
// the windows are ordered above their nearest owner; ancestors of the window,
|
// the windows are ordered above their nearest owner; ancestors of the window,
|
||||||
// which is going to become 'main window', are placed above their siblings.
|
// which is going to become 'main window', are placed above their siblings.
|
||||||
CPlatformWindow rootOwner = getRootOwner();
|
CPlatformWindow rootOwner = getRootOwner();
|
||||||
if (rootOwner.isVisible()) {
|
if (rootOwner.isVisible() && !rootOwner.isIconified()) {
|
||||||
CWrapper.NSWindow.orderFront(rootOwner.getNSWindowPtr());
|
CWrapper.NSWindow.orderFront(rootOwner.getNSWindowPtr());
|
||||||
}
|
}
|
||||||
|
// Do not order child windows of iconified owner.
|
||||||
|
if (!rootOwner.isIconified()) {
|
||||||
final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();
|
final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();
|
||||||
orderAboveSiblingsImpl(windowAccessor.getOwnedWindows(rootOwner.target));
|
orderAboveSiblingsImpl(windowAccessor.getOwnedWindows(rootOwner.target));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void orderAboveSiblingsImpl(Window[] windows) {
|
private void orderAboveSiblingsImpl(Window[] windows) {
|
||||||
ArrayList<Window> childWindows = new ArrayList<Window>();
|
ArrayList<Window> childWindows = new ArrayList<Window>();
|
||||||
@ -1109,10 +1127,12 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
|
|
||||||
// Go through the list of windows and perform ordering.
|
// Go through the list of windows and perform ordering.
|
||||||
for (Window w : windows) {
|
for (Window w : windows) {
|
||||||
|
boolean iconified = false;
|
||||||
final Object p = componentAccessor.getPeer(w);
|
final Object p = componentAccessor.getPeer(w);
|
||||||
if (p instanceof LWWindowPeer) {
|
if (p instanceof LWWindowPeer) {
|
||||||
CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
|
CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
|
||||||
if (pw != null && pw.isVisible()) {
|
iconified = isIconified();
|
||||||
|
if (pw != null && pw.isVisible() && !iconified) {
|
||||||
// If the window is one of ancestors of 'main window' or is going to become main by itself,
|
// If the window is one of ancestors of 'main window' or is going to become main by itself,
|
||||||
// the window should be ordered above its siblings; otherwise the window is just ordered
|
// the window should be ordered above its siblings; otherwise the window is just ordered
|
||||||
// above its nearest parent.
|
// above its nearest parent.
|
||||||
@ -1125,11 +1145,14 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
pw.applyWindowLevel(w);
|
pw.applyWindowLevel(w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Retrieve the child windows for each window from the list and store them for future use.
|
// Retrieve the child windows for each window from the list except iconified ones
|
||||||
|
// and store them for future use.
|
||||||
// Note: we collect data about child windows even for invisible owners, since they may have
|
// Note: we collect data about child windows even for invisible owners, since they may have
|
||||||
// visible children.
|
// visible children.
|
||||||
|
if (!iconified) {
|
||||||
childWindows.addAll(Arrays.asList(windowAccessor.getOwnedWindows(w)));
|
childWindows.addAll(Arrays.asList(windowAccessor.getOwnedWindows(w)));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// If some windows, which have just been ordered, have any child windows, let's start new iteration
|
// If some windows, which have just been ordered, have any child windows, let's start new iteration
|
||||||
// and order these child windows.
|
// and order these child windows.
|
||||||
if (!childWindows.isEmpty()) {
|
if (!childWindows.isEmpty()) {
|
||||||
@ -1149,6 +1172,10 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
// NATIVE CALLBACKS
|
// NATIVE CALLBACKS
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
private void windowWillMiniaturize() {
|
||||||
|
isIconifyAnimationActive = true;
|
||||||
|
}
|
||||||
|
|
||||||
private void windowDidBecomeMain() {
|
private void windowDidBecomeMain() {
|
||||||
if (checkBlockingAndOrder()) return;
|
if (checkBlockingAndOrder()) return;
|
||||||
// If it's not blocked, make sure it's above its siblings
|
// If it's not blocked, make sure it's above its siblings
|
||||||
|
@ -327,10 +327,43 @@ AWT_ASSERT_APPKIT_THREAD;
|
|||||||
return [window isKindOfClass: [AWTWindow_Panel class]] || [window isKindOfClass: [AWTWindow_Normal class]];
|
return [window isKindOfClass: [AWTWindow_Panel class]] || [window isKindOfClass: [AWTWindow_Normal class]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Retrieves the list of possible window layers (levels)
|
||||||
|
+ (NSArray*) getWindowLayers {
|
||||||
|
static NSArray *windowLayers;
|
||||||
|
static dispatch_once_t token;
|
||||||
|
|
||||||
|
// Initialize the list of possible window layers
|
||||||
|
dispatch_once(&token, ^{
|
||||||
|
// The layers are ordered from front to back, (i.e. the toppest one is the first)
|
||||||
|
windowLayers = [NSArray arrayWithObjects:
|
||||||
|
[NSNumber numberWithInt:CGWindowLevelForKey(kCGPopUpMenuWindowLevelKey)],
|
||||||
|
[NSNumber numberWithInt:CGWindowLevelForKey(kCGFloatingWindowLevelKey)],
|
||||||
|
[NSNumber numberWithInt:CGWindowLevelForKey(kCGNormalWindowLevelKey)],
|
||||||
|
nil
|
||||||
|
];
|
||||||
|
[windowLayers retain];
|
||||||
|
});
|
||||||
|
return windowLayers;
|
||||||
|
}
|
||||||
|
|
||||||
// returns id for the topmost window under mouse
|
// returns id for the topmost window under mouse
|
||||||
+ (NSInteger) getTopmostWindowUnderMouseID {
|
+ (NSInteger) getTopmostWindowUnderMouseID {
|
||||||
NSInteger result = -1;
|
NSInteger result = -1;
|
||||||
|
|
||||||
|
NSArray *windowLayers = [AWTWindow getWindowLayers];
|
||||||
|
// Looking for the window under mouse starting from the toppest layer
|
||||||
|
for (NSNumber *layer in windowLayers) {
|
||||||
|
result = [AWTWindow getTopmostWindowUnderMouseIDImpl:[layer integerValue]];
|
||||||
|
if (result != -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSInteger) getTopmostWindowUnderMouseIDImpl:(NSInteger)windowLayer {
|
||||||
|
NSInteger result = -1;
|
||||||
|
|
||||||
NSRect screenRect = [[NSScreen mainScreen] frame];
|
NSRect screenRect = [[NSScreen mainScreen] frame];
|
||||||
NSPoint nsMouseLocation = [NSEvent mouseLocation];
|
NSPoint nsMouseLocation = [NSEvent mouseLocation];
|
||||||
CGPoint cgMouseLocation = CGPointMake(nsMouseLocation.x, screenRect.size.height - nsMouseLocation.y);
|
CGPoint cgMouseLocation = CGPointMake(nsMouseLocation.x, screenRect.size.height - nsMouseLocation.y);
|
||||||
@ -339,7 +372,7 @@ AWT_ASSERT_APPKIT_THREAD;
|
|||||||
|
|
||||||
for (NSDictionary *window in windows) {
|
for (NSDictionary *window in windows) {
|
||||||
NSInteger layer = [[window objectForKey:(id)kCGWindowLayer] integerValue];
|
NSInteger layer = [[window objectForKey:(id)kCGWindowLayer] integerValue];
|
||||||
if (layer == 0) {
|
if (layer == windowLayer) {
|
||||||
CGRect rect;
|
CGRect rect;
|
||||||
CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)[window objectForKey:(id)kCGWindowBounds], &rect);
|
CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)[window objectForKey:(id)kCGWindowBounds], &rect);
|
||||||
if (CGRectContainsPoint(rect, cgMouseLocation)) {
|
if (CGRectContainsPoint(rect, cgMouseLocation)) {
|
||||||
@ -639,6 +672,14 @@ AWT_ASSERT_APPKIT_THREAD;
|
|||||||
AWT_ASSERT_APPKIT_THREAD;
|
AWT_ASSERT_APPKIT_THREAD;
|
||||||
|
|
||||||
self.isMinimizing = YES;
|
self.isMinimizing = YES;
|
||||||
|
|
||||||
|
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||||
|
jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
|
||||||
|
if (platformWindow != NULL) {
|
||||||
|
static JNF_MEMBER_CACHE(jm_windowWillMiniaturize, jc_CPlatformWindow, "windowWillMiniaturize", "()V");
|
||||||
|
JNFCallVoidMethod(env, platformWindow, jm_windowWillMiniaturize);
|
||||||
|
(*env)->DeleteLocalRef(env, platformWindow);
|
||||||
|
}
|
||||||
// Excplicitly make myself a key window to avoid possible
|
// Excplicitly make myself a key window to avoid possible
|
||||||
// negative visual effects during iconify operation
|
// negative visual effects during iconify operation
|
||||||
[self.nsWindow makeKeyAndOrderFront:self.nsWindow];
|
[self.nsWindow makeKeyAndOrderFront:self.nsWindow];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -730,18 +730,47 @@ public class TIFFImageReader extends ImageReader {
|
|||||||
// to use it if the data layout is component type.
|
// to use it if the data layout is component type.
|
||||||
if (iccProfileField != null
|
if (iccProfileField != null
|
||||||
&& itsRaw.getColorModel() instanceof ComponentColorModel) {
|
&& itsRaw.getColorModel() instanceof ComponentColorModel) {
|
||||||
// Create a ColorSpace from the profile.
|
|
||||||
byte[] iccProfileValue = iccProfileField.getAsBytes();
|
|
||||||
ICC_Profile iccProfile
|
|
||||||
= ICC_Profile.getInstance(iccProfileValue);
|
|
||||||
ICC_ColorSpace iccColorSpace
|
|
||||||
= new ICC_ColorSpace(iccProfile);
|
|
||||||
|
|
||||||
// Get the raw sample and color information.
|
// Get the raw sample and color information.
|
||||||
ColorModel cmRaw = itsRaw.getColorModel();
|
ColorModel cmRaw = itsRaw.getColorModel();
|
||||||
ColorSpace csRaw = cmRaw.getColorSpace();
|
ColorSpace csRaw = cmRaw.getColorSpace();
|
||||||
SampleModel smRaw = itsRaw.getSampleModel();
|
SampleModel smRaw = itsRaw.getSampleModel();
|
||||||
|
|
||||||
|
ColorSpace iccColorSpace = null;
|
||||||
|
try {
|
||||||
|
// Create a ColorSpace from the profile.
|
||||||
|
byte[] iccProfileValue = iccProfileField.getAsBytes();
|
||||||
|
ICC_Profile iccProfile
|
||||||
|
= ICC_Profile.getInstance(iccProfileValue);
|
||||||
|
iccColorSpace = new ICC_ColorSpace(iccProfile);
|
||||||
|
|
||||||
|
// Workaround for JDK-8145241: test a conversion and fall
|
||||||
|
// back to a standard ColorSpace if it fails. This
|
||||||
|
// workaround could be removed if JDK-8145241 is fixed.
|
||||||
|
float[] rgb =
|
||||||
|
iccColorSpace.toRGB(new float[] {1.0F, 1.0F, 1.0F});
|
||||||
|
} catch (Exception iccProfileException) {
|
||||||
|
processWarningOccurred("Superseding bad ICC profile: "
|
||||||
|
+ iccProfileException.getMessage());
|
||||||
|
|
||||||
|
if (iccColorSpace != null) {
|
||||||
|
switch (iccColorSpace.getType()) {
|
||||||
|
case ColorSpace.TYPE_GRAY:
|
||||||
|
iccColorSpace =
|
||||||
|
ColorSpace.getInstance(ColorSpace.CS_GRAY);
|
||||||
|
break;
|
||||||
|
case ColorSpace.TYPE_RGB:
|
||||||
|
iccColorSpace =
|
||||||
|
ColorSpace.getInstance(ColorSpace.CS_sRGB);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
iccColorSpace = csRaw;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
iccColorSpace = csRaw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get the number of samples per pixel and the number
|
// Get the number of samples per pixel and the number
|
||||||
// of color components.
|
// of color components.
|
||||||
int numBands = smRaw.getNumBands();
|
int numBands = smRaw.getNumBands();
|
||||||
|
@ -30,21 +30,20 @@ import java.applet.Applet;
|
|||||||
import java.beans.beancontext.BeanContext;
|
import java.beans.beancontext.BeanContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
|
||||||
* This interface is designed to work in collusion with java.beans.Beans.instantiate.
|
* This interface is designed to work in collusion with java.beans.Beans.instantiate.
|
||||||
* The interface is intended to provide mechanism to allow the proper
|
* The interface is intended to provide mechanism to allow the proper
|
||||||
* initialization of JavaBeans that are also Applets, during their
|
* initialization of JavaBeans that are also Applets, during their
|
||||||
* instantiation by java.beans.Beans.instantiate().
|
* instantiation by java.beans.Beans.instantiate().
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
* @see java.beans.Beans#instantiate
|
* @see java.beans.Beans#instantiate
|
||||||
*
|
*
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*
|
*
|
||||||
|
* @deprecated The Applet API is deprecated. See the
|
||||||
|
* <a href="../applet/package-summary.html"> java.applet package
|
||||||
|
* documentation</a> for further information.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(since = "9")
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public interface AppletInitializer {
|
public interface AppletInitializer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,7 +73,6 @@ public interface AppletInitializer {
|
|||||||
* @param bCtxt The BeanContext intended for this Applet, or
|
* @param bCtxt The BeanContext intended for this Applet, or
|
||||||
* null.
|
* null.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void initialize(Applet newAppletBean, BeanContext bCtxt);
|
void initialize(Applet newAppletBean, BeanContext bCtxt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -86,6 +84,5 @@ public interface AppletInitializer {
|
|||||||
*
|
*
|
||||||
* @param newApplet The newly instantiated JavaBean
|
* @param newApplet The newly instantiated JavaBean
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void activate(Applet newApplet);
|
void activate(Applet newApplet);
|
||||||
}
|
}
|
||||||
|
@ -97,8 +97,10 @@ public class Beans {
|
|||||||
* @exception IOException if an I/O error occurs.
|
* @exception IOException if an I/O error occurs.
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext) throws IOException, ClassNotFoundException {
|
public static Object instantiate(ClassLoader cls, String beanName,
|
||||||
|
BeanContext beanContext)
|
||||||
|
throws IOException, ClassNotFoundException {
|
||||||
return Beans.instantiate(cls, beanName, beanContext, null);
|
return Beans.instantiate(cls, beanName, beanContext, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,9 +155,17 @@ public class Beans {
|
|||||||
* object could not be found.
|
* object could not be found.
|
||||||
* @exception IOException if an I/O error occurs.
|
* @exception IOException if an I/O error occurs.
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
|
*
|
||||||
|
* @deprecated It is recommended to use
|
||||||
|
* {@link #instantiate(ClassLoader, String, BeanContext)},
|
||||||
|
* because the Applet API is deprecated. See the
|
||||||
|
* <a href="../../java/applet/package-summary.html"> java.applet package
|
||||||
|
* documentation</a> for further information.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@Deprecated(since = "9")
|
||||||
public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext, AppletInitializer initializer)
|
public static Object instantiate(ClassLoader cls, String beanName,
|
||||||
|
BeanContext beanContext,
|
||||||
|
AppletInitializer initializer)
|
||||||
throws IOException, ClassNotFoundException {
|
throws IOException, ClassNotFoundException {
|
||||||
|
|
||||||
InputStream ins;
|
InputStream ins;
|
||||||
@ -501,7 +511,7 @@ class ObjectInputStreamWithLoader extends ObjectInputStream
|
|||||||
* Package private support class. This provides a default AppletContext
|
* Package private support class. This provides a default AppletContext
|
||||||
* for beans which are applets.
|
* for beans which are applets.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@Deprecated(since = "9")
|
||||||
class BeansAppletContext implements AppletContext {
|
class BeansAppletContext implements AppletContext {
|
||||||
Applet target;
|
Applet target;
|
||||||
Hashtable<URL,Object> imageCache = new Hashtable<>();
|
Hashtable<URL,Object> imageCache = new Hashtable<>();
|
||||||
@ -586,7 +596,7 @@ class BeansAppletContext implements AppletContext {
|
|||||||
* Package private support class. This provides an AppletStub
|
* Package private support class. This provides an AppletStub
|
||||||
* for beans which are applets.
|
* for beans which are applets.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@Deprecated(since = "9")
|
||||||
class BeansAppletStub implements AppletStub {
|
class BeansAppletStub implements AppletStub {
|
||||||
transient boolean active;
|
transient boolean active;
|
||||||
transient Applet target;
|
transient Applet target;
|
||||||
|
@ -260,6 +260,7 @@ public class PopupFactory {
|
|||||||
* Obtains the appropriate <code>Popup</code> based on
|
* Obtains the appropriate <code>Popup</code> based on
|
||||||
* <code>popupType</code>.
|
* <code>popupType</code>.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private Popup getPopup(Component owner, Component contents,
|
private Popup getPopup(Component owner, Component contents,
|
||||||
int ownerX, int ownerY, int popupType) {
|
int ownerX, int ownerY, int popupType) {
|
||||||
if (GraphicsEnvironment.isHeadless()) {
|
if (GraphicsEnvironment.isHeadless()) {
|
||||||
|
@ -525,8 +525,12 @@ public class RepaintManager
|
|||||||
* @param h Height of the region to repaint
|
* @param h Height of the region to repaint
|
||||||
* @see JApplet#repaint
|
* @see JApplet#repaint
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
|
*
|
||||||
|
* @deprecated The Applet API is deprecated. See the
|
||||||
|
* <a href="../../java/applet/package-summary.html"> java.applet package
|
||||||
|
* documentation</a> for further information.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@Deprecated(since = "9")
|
||||||
public void addDirtyRegion(Applet applet, int x, int y, int w, int h) {
|
public void addDirtyRegion(Applet applet, int x, int y, int w, int h) {
|
||||||
addDirtyRegion0(applet, x, y, w, h);
|
addDirtyRegion0(applet, x, y, w, h);
|
||||||
}
|
}
|
||||||
|
@ -380,6 +380,12 @@ class TablePrintable implements Printable {
|
|||||||
// print the current section of the table
|
// print the current section of the table
|
||||||
g2d.translate(-clip.x, -clip.y);
|
g2d.translate(-clip.x, -clip.y);
|
||||||
g2d.clip(clip);
|
g2d.clip(clip);
|
||||||
|
|
||||||
|
// set a property so that BasicTableUI#paint can know JTable printMode
|
||||||
|
// is FIT_WIDTH since TablePrintable.printMode is not accessible from BasicTableUI
|
||||||
|
if (printMode == JTable.PrintMode.FIT_WIDTH) {
|
||||||
|
table.putClientProperty("Table.printMode", JTable.PrintMode.FIT_WIDTH);
|
||||||
|
}
|
||||||
table.print(g2d);
|
table.print(g2d);
|
||||||
|
|
||||||
// restore the original transform and clip
|
// restore the original transform and clip
|
||||||
@ -407,8 +413,18 @@ class TablePrintable implements Printable {
|
|||||||
for(int visrow = rMin; visrow < rMax; visrow++) {
|
for(int visrow = rMin; visrow < rMax; visrow++) {
|
||||||
rowHeight += table.getRowHeight(visrow);
|
rowHeight += table.getRowHeight(visrow);
|
||||||
}
|
}
|
||||||
|
// If PrintMode is FIT_WIDTH, then draw rect for entire column width while
|
||||||
|
// printing irrespective of how many columns are visible in console
|
||||||
|
if (printMode == JTable.PrintMode.FIT_WIDTH) {
|
||||||
|
g2d.drawRect(0, 0, clip.width, hclip.height + rowHeight);
|
||||||
|
} else {
|
||||||
g2d.drawRect(0, 0, visibleBounds.width, hclip.height + rowHeight);
|
g2d.drawRect(0, 0, visibleBounds.width, hclip.height + rowHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
// clear the property
|
||||||
|
if (printMode == JTable.PrintMode.FIT_WIDTH) {
|
||||||
|
table.putClientProperty("Table.printMode", null);
|
||||||
|
}
|
||||||
// dispose the graphics copy
|
// dispose the graphics copy
|
||||||
g2d.dispose();
|
g2d.dispose();
|
||||||
|
|
||||||
@ -534,5 +550,4 @@ class TablePrintable implements Printable {
|
|||||||
} while (clip.width + colWidth <= pw);
|
} while (clip.width + colWidth <= pw);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1812,11 +1812,11 @@ public class BasicTableUI extends TableUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean ltr = table.getComponentOrientation().isLeftToRight();
|
boolean ltr = table.getComponentOrientation().isLeftToRight();
|
||||||
|
Point upperLeft, lowerRight;
|
||||||
// compute the visible part of table which needs to be painted
|
// compute the visible part of table which needs to be painted
|
||||||
Rectangle visibleBounds = clip.intersection(bounds);
|
Rectangle visibleBounds = clip.intersection(bounds);
|
||||||
Point upperLeft = visibleBounds.getLocation();
|
upperLeft = visibleBounds.getLocation();
|
||||||
Point lowerRight = new Point(visibleBounds.x + visibleBounds.width - 1,
|
lowerRight = new Point(visibleBounds.x + visibleBounds.width - 1,
|
||||||
visibleBounds.y + visibleBounds.height - 1);
|
visibleBounds.y + visibleBounds.height - 1);
|
||||||
|
|
||||||
int rMin = table.rowAtPoint(upperLeft);
|
int rMin = table.rowAtPoint(upperLeft);
|
||||||
@ -1834,6 +1834,18 @@ public class BasicTableUI extends TableUI
|
|||||||
rMax = table.getRowCount()-1;
|
rMax = table.getRowCount()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For FIT_WIDTH, all columns should be printed irrespective of
|
||||||
|
// how many columns are visible. So, we used clip which is already set to
|
||||||
|
// total col width instead of visible region
|
||||||
|
// Since JTable.PrintMode is not accessible
|
||||||
|
// from here, we aet "Table.printMode" in TablePrintable#print and
|
||||||
|
// access from here.
|
||||||
|
Object printMode = table.getClientProperty("Table.printMode");
|
||||||
|
if ((printMode == JTable.PrintMode.FIT_WIDTH)) {
|
||||||
|
upperLeft = clip.getLocation();
|
||||||
|
lowerRight = new Point(clip.x + clip.width - 1,
|
||||||
|
clip.y + clip.height - 1);
|
||||||
|
}
|
||||||
int cMin = table.columnAtPoint(ltr ? upperLeft : lowerRight);
|
int cMin = table.columnAtPoint(ltr ? upperLeft : lowerRight);
|
||||||
int cMax = table.columnAtPoint(ltr ? lowerRight : upperLeft);
|
int cMax = table.columnAtPoint(ltr ? lowerRight : upperLeft);
|
||||||
// This should never happen.
|
// This should never happen.
|
||||||
@ -2018,7 +2030,7 @@ public class BasicTableUI extends TableUI
|
|||||||
int y = damagedArea.y;
|
int y = damagedArea.y;
|
||||||
for (int row = rMin; row <= rMax; row++) {
|
for (int row = rMin; row <= rMax; row++) {
|
||||||
y += table.getRowHeight(row);
|
y += table.getRowHeight(row);
|
||||||
g.drawLine(damagedArea.x, y - 1, tableWidth - 1, y - 1);
|
SwingUtilities2.drawHLine(g, damagedArea.x, tableWidth - 1, y - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (table.getShowVerticalLines()) {
|
if (table.getShowVerticalLines()) {
|
||||||
@ -2030,14 +2042,14 @@ public class BasicTableUI extends TableUI
|
|||||||
for (int column = cMin; column <= cMax; column++) {
|
for (int column = cMin; column <= cMax; column++) {
|
||||||
int w = cm.getColumn(column).getWidth();
|
int w = cm.getColumn(column).getWidth();
|
||||||
x += w;
|
x += w;
|
||||||
g.drawLine(x - 1, 0, x - 1, tableHeight - 1);
|
SwingUtilities2.drawVLine(g, x - 1, 0, tableHeight - 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
x = damagedArea.x;
|
x = damagedArea.x;
|
||||||
for (int column = cMax; column >= cMin; column--) {
|
for (int column = cMax; column >= cMin; column--) {
|
||||||
int w = cm.getColumn(column).getWidth();
|
int w = cm.getColumn(column).getWidth();
|
||||||
x += w;
|
x += w;
|
||||||
g.drawLine(x - 1, 0, x - 1, tableHeight - 1);
|
SwingUtilities2.drawVLine(g, x - 1, 0, tableHeight - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,10 +27,7 @@ package javax.swing.text;
|
|||||||
import sun.swing.SwingUtilities2;
|
import sun.swing.SwingUtilities2;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.font.FontRenderContext;
|
import java.awt.font.FontRenderContext;
|
||||||
import java.security.AccessController;
|
|
||||||
import java.security.PrivilegedAction;
|
|
||||||
import javax.swing.JPasswordField;
|
import javax.swing.JPasswordField;
|
||||||
import static javax.swing.text.PlainView.isFPMethodOverriden;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements a View suitable for use in JPasswordField
|
* Implements a View suitable for use in JPasswordField
|
||||||
@ -332,22 +329,6 @@ public class PasswordView extends FieldView {
|
|||||||
|
|
||||||
static char[] ONE = new char[1];
|
static char[] ONE = new char[1];
|
||||||
|
|
||||||
private final boolean drawEchoCharacterOverridden;
|
private final boolean drawEchoCharacterOverridden =
|
||||||
|
getFPMethodOverridden(getClass(), "drawEchoCharacter", FPMethodArgs.GNNC);
|
||||||
{
|
|
||||||
final Class<?> CLS = getClass();
|
|
||||||
final Class<?> INT = Integer.TYPE;
|
|
||||||
final Class<?> FP = Float.TYPE;
|
|
||||||
final Class<?> CHAR = Character.TYPE;
|
|
||||||
|
|
||||||
drawEchoCharacterOverridden = AccessController
|
|
||||||
.doPrivileged(new PrivilegedAction<Boolean>() {
|
|
||||||
@Override
|
|
||||||
public Boolean run() {
|
|
||||||
Class<?>[] intTypes = {Graphics.class, INT, INT, CHAR};
|
|
||||||
Class<?>[] fpTypes = {Graphics2D.class, FP, FP, CHAR};
|
|
||||||
return isFPMethodOverriden("drawEchoCharacter", CLS, intTypes, fpTypes);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,8 @@ import java.security.PrivilegedAction;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import javax.swing.event.*;
|
import javax.swing.event.*;
|
||||||
import java.lang.reflect.Module;
|
import java.lang.reflect.Module;
|
||||||
|
import java.lang.ref.SoftReference;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements View interface for a simple multi-line text view
|
* Implements View interface for a simple multi-line text view
|
||||||
@ -818,7 +820,42 @@ public class PlainView extends View implements TabExpander {
|
|||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean isFPMethodOverriden(String method,
|
static boolean getFPMethodOverridden(Class<?> cls, String method,
|
||||||
|
FPMethodArgs methodArgs) {
|
||||||
|
HashMap<FPMethodItem, Boolean> map = null;
|
||||||
|
boolean initialized = methodsOverriddenMapRef != null
|
||||||
|
&& (map = methodsOverriddenMapRef.get()) != null;
|
||||||
|
|
||||||
|
if (!initialized) {
|
||||||
|
map = new HashMap<>();
|
||||||
|
methodsOverriddenMapRef = new SoftReference<>(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
FPMethodItem key = new FPMethodItem(cls, method);
|
||||||
|
Boolean isFPMethodOverridden = map.get(key);
|
||||||
|
if (isFPMethodOverridden == null) {
|
||||||
|
isFPMethodOverridden = checkFPMethodOverridden(cls, method, methodArgs);
|
||||||
|
map.put(key, isFPMethodOverridden);
|
||||||
|
}
|
||||||
|
return isFPMethodOverridden;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean checkFPMethodOverridden(final Class<?> className,
|
||||||
|
final String methodName,
|
||||||
|
final FPMethodArgs methodArgs) {
|
||||||
|
|
||||||
|
return AccessController
|
||||||
|
.doPrivileged(new PrivilegedAction<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public Boolean run() {
|
||||||
|
return isFPMethodOverridden(methodName, className,
|
||||||
|
methodArgs.getMethodArguments(false),
|
||||||
|
methodArgs.getMethodArguments(true));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isFPMethodOverridden(String method,
|
||||||
Class<?> cls,
|
Class<?> cls,
|
||||||
Class<?>[] intTypes,
|
Class<?>[] intTypes,
|
||||||
Class<?>[] fpTypes)
|
Class<?>[] fpTypes)
|
||||||
@ -840,6 +877,57 @@ public class PlainView extends View implements TabExpander {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum FPMethodArgs {
|
||||||
|
|
||||||
|
IGNN,
|
||||||
|
IIGNN,
|
||||||
|
GNNII,
|
||||||
|
GNNC;
|
||||||
|
|
||||||
|
public Class<?>[] getMethodArguments(boolean isFPType) {
|
||||||
|
Class<?> N = (isFPType) ? Float.TYPE : Integer.TYPE;
|
||||||
|
Class<?> G = (isFPType) ? Graphics2D.class : Graphics.class;
|
||||||
|
switch (this) {
|
||||||
|
case IGNN:
|
||||||
|
return new Class<?>[]{Integer.TYPE, G, N, N};
|
||||||
|
case IIGNN:
|
||||||
|
return new Class<?>[]{Integer.TYPE, Integer.TYPE, G, N, N};
|
||||||
|
case GNNII:
|
||||||
|
return new Class<?>[]{G, N, N, Integer.TYPE, Integer.TYPE};
|
||||||
|
case GNNC:
|
||||||
|
return new Class<?>[]{G, N, N, Character.TYPE};
|
||||||
|
default:
|
||||||
|
throw new RuntimeException("Unknown method arguments!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class FPMethodItem {
|
||||||
|
|
||||||
|
final Class<?> className;
|
||||||
|
final String methodName;
|
||||||
|
|
||||||
|
public FPMethodItem(Class<?> className, String methodName) {
|
||||||
|
this.className = className;
|
||||||
|
this.methodName = methodName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (obj instanceof FPMethodItem) {
|
||||||
|
FPMethodItem that = (FPMethodItem) obj;
|
||||||
|
return this.className.equals(that.className)
|
||||||
|
&& this.methodName.equals(that.methodName);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return 31 * methodName.hashCode() + className.hashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// --- member variables -----------------------------------------------
|
// --- member variables -----------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -878,46 +966,13 @@ public class PlainView extends View implements TabExpander {
|
|||||||
*/
|
*/
|
||||||
int firstLineOffset;
|
int firstLineOffset;
|
||||||
|
|
||||||
final boolean drawLineOverridden;
|
private static SoftReference<HashMap<FPMethodItem, Boolean>> methodsOverriddenMapRef;
|
||||||
final boolean drawSelectedTextOverridden;
|
final boolean drawLineOverridden =
|
||||||
final boolean drawUnselectedTextOverridden;
|
getFPMethodOverridden(getClass(), "drawLine", FPMethodArgs.IGNN);
|
||||||
final boolean useFloatingPointAPI;
|
final boolean drawSelectedTextOverridden =
|
||||||
|
getFPMethodOverridden(getClass(), "drawSelectedText", FPMethodArgs.GNNII);
|
||||||
{
|
final boolean drawUnselectedTextOverridden =
|
||||||
final Class<?> CLS = getClass();
|
getFPMethodOverridden(getClass(), "drawUnselectedText", FPMethodArgs.GNNII);
|
||||||
final Class<?> INT = Integer.TYPE;
|
final boolean useFloatingPointAPI =
|
||||||
final Class<?> FP = Float.TYPE;
|
drawUnselectedTextOverridden || drawSelectedTextOverridden;
|
||||||
|
|
||||||
drawLineOverridden = AccessController
|
|
||||||
.doPrivileged(new PrivilegedAction<Boolean>() {
|
|
||||||
@Override
|
|
||||||
public Boolean run() {
|
|
||||||
Class<?>[] intTypes = {INT, Graphics.class, INT, INT};
|
|
||||||
Class<?>[] fpTypes = {INT, Graphics2D.class, FP, FP};
|
|
||||||
return isFPMethodOverriden("drawLine", CLS, intTypes, fpTypes);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
drawUnselectedTextOverridden = AccessController
|
|
||||||
.doPrivileged(new PrivilegedAction<Boolean>() {
|
|
||||||
@Override
|
|
||||||
public Boolean run() {
|
|
||||||
Class<?>[] intTypes = {Graphics.class, INT, INT, INT, INT};
|
|
||||||
Class<?>[] fpTypes = {Graphics2D.class, FP, FP, INT, INT};
|
|
||||||
return isFPMethodOverriden("drawUnselectedText", CLS, intTypes, fpTypes);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
drawSelectedTextOverridden = AccessController
|
|
||||||
.doPrivileged(new PrivilegedAction<Boolean>() {
|
|
||||||
@Override
|
|
||||||
public Boolean run() {
|
|
||||||
Class<?>[] intTypes = {Graphics.class, INT, INT, INT, INT};
|
|
||||||
Class<?>[] fpTypes = {Graphics2D.class, FP, FP, INT, INT};
|
|
||||||
return isFPMethodOverriden("drawSelectedText", CLS, intTypes, fpTypes);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
useFloatingPointAPI = drawUnselectedTextOverridden || drawSelectedTextOverridden;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -28,10 +28,9 @@ import java.awt.*;
|
|||||||
import java.awt.font.FontRenderContext;
|
import java.awt.font.FontRenderContext;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.lang.ref.SoftReference;
|
import java.lang.ref.SoftReference;
|
||||||
import java.security.AccessController;
|
|
||||||
import java.security.PrivilegedAction;
|
|
||||||
import javax.swing.event.*;
|
import javax.swing.event.*;
|
||||||
import static javax.swing.text.PlainView.isFPMethodOverriden;
|
import static javax.swing.text.PlainView.FPMethodArgs.*;
|
||||||
|
import static javax.swing.text.PlainView.getFPMethodOverridden;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View of plain text (text with only one font and color)
|
* View of plain text (text with only one font and color)
|
||||||
@ -989,46 +988,12 @@ public class WrappedPlainView extends BoxView implements TabExpander {
|
|||||||
SoftReference<int[]> lineCache = null;
|
SoftReference<int[]> lineCache = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final boolean drawLineOverridden;
|
private final boolean drawLineOverridden =
|
||||||
private final boolean drawSelectedTextOverridden;
|
getFPMethodOverridden(getClass(), "drawLine", IIGNN);
|
||||||
private final boolean drawUnselectedTextOverridden;
|
private final boolean drawSelectedTextOverridden =
|
||||||
private final boolean useFloatingPointAPI;
|
getFPMethodOverridden(getClass(), "drawSelectedText", GNNII);
|
||||||
|
private final boolean drawUnselectedTextOverridden =
|
||||||
{
|
getFPMethodOverridden(getClass(), "drawUnselectedText", GNNII);
|
||||||
final Class<?> CLS = getClass();
|
private final boolean useFloatingPointAPI =
|
||||||
final Class<?> INT = Integer.TYPE;
|
drawUnselectedTextOverridden || drawSelectedTextOverridden;
|
||||||
final Class<?> FP = Float.TYPE;
|
|
||||||
|
|
||||||
drawLineOverridden = AccessController
|
|
||||||
.doPrivileged(new PrivilegedAction<Boolean>() {
|
|
||||||
@Override
|
|
||||||
public Boolean run() {
|
|
||||||
Class<?>[] intTypes = {INT, INT, Graphics.class, INT, INT};
|
|
||||||
Class<?>[] fpTypes = {INT, INT, Graphics2D.class, FP, FP};
|
|
||||||
return isFPMethodOverriden("drawLine", CLS, intTypes, fpTypes);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
drawUnselectedTextOverridden = AccessController
|
|
||||||
.doPrivileged(new PrivilegedAction<Boolean>() {
|
|
||||||
@Override
|
|
||||||
public Boolean run() {
|
|
||||||
Class<?>[] intTypes = {Graphics.class, INT, INT, INT, INT};
|
|
||||||
Class<?>[] fpTypes = {Graphics2D.class, FP, FP, INT, INT};
|
|
||||||
return isFPMethodOverriden("drawUnselectedText", CLS, intTypes, fpTypes);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
drawSelectedTextOverridden = AccessController
|
|
||||||
.doPrivileged(new PrivilegedAction<Boolean>() {
|
|
||||||
@Override
|
|
||||||
public Boolean run() {
|
|
||||||
Class<?>[] intTypes = {Graphics.class, INT, INT, INT, INT};
|
|
||||||
Class<?>[] fpTypes = {Graphics2D.class, FP, FP, INT, INT};
|
|
||||||
return isFPMethodOverriden("drawSelectedText", CLS, intTypes, fpTypes);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
useFloatingPointAPI = drawUnselectedTextOverridden || drawSelectedTextOverridden;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,13 @@ import java.util.EventObject;
|
|||||||
* AppletEvent class.
|
* AppletEvent class.
|
||||||
*
|
*
|
||||||
* @author Sunita Mani
|
* @author Sunita Mani
|
||||||
|
*
|
||||||
|
* @deprecated The Applet API is deprecated. See the
|
||||||
|
* <a href="../../java/applet/package-summary.html"> java.applet package
|
||||||
|
* documentation</a> for further information.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial") // JDK-implementation class
|
@SuppressWarnings("serial") // JDK-implementation class
|
||||||
|
@Deprecated(since = "9")
|
||||||
public class AppletEvent extends EventObject {
|
public class AppletEvent extends EventObject {
|
||||||
|
|
||||||
private Object arg;
|
private Object arg;
|
||||||
|
@ -36,7 +36,12 @@ import java.io.IOException;
|
|||||||
* responsible for dispatching events to them.
|
* responsible for dispatching events to them.
|
||||||
*
|
*
|
||||||
* @author Sunita Mani
|
* @author Sunita Mani
|
||||||
|
*
|
||||||
|
* @deprecated The Applet API is deprecated. See the
|
||||||
|
* <a href="../../java/applet/package-summary.html"> java.applet package
|
||||||
|
* documentation</a> for further information.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(since = "9")
|
||||||
public class AppletEventMulticaster implements AppletListener {
|
public class AppletEventMulticaster implements AppletListener {
|
||||||
|
|
||||||
private final AppletListener a, b;
|
private final AppletListener a, b;
|
||||||
|
@ -31,10 +31,14 @@ import java.io.IOException;
|
|||||||
* An applet IO exception.
|
* An applet IO exception.
|
||||||
*
|
*
|
||||||
* @author Koji Uno
|
* @author Koji Uno
|
||||||
|
*
|
||||||
|
* @deprecated The Applet API is deprecated. See the
|
||||||
|
* <a href="../../java/applet/package-summary.html"> java.applet package
|
||||||
|
* documentation</a> for further information.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial") // JDK implementation class
|
@SuppressWarnings("serial") // JDK implementation class
|
||||||
public
|
@Deprecated(since = "9")
|
||||||
class AppletIOException extends IOException {
|
public class AppletIOException extends IOException {
|
||||||
private String key = null;
|
private String key = null;
|
||||||
private Object msgobj = null;
|
private Object msgobj = null;
|
||||||
|
|
||||||
|
@ -29,10 +29,14 @@ package sun.applet;
|
|||||||
* An applet security exception.
|
* An applet security exception.
|
||||||
*
|
*
|
||||||
* @author Arthur van Hoff
|
* @author Arthur van Hoff
|
||||||
|
*
|
||||||
|
* @deprecated The Applet API is deprecated. See the
|
||||||
|
* <a href="../../java/applet/package-summary.html"> java.applet package
|
||||||
|
* documentation</a> for further information.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial") // JDK implementation class
|
@SuppressWarnings("serial") // JDK implementation class
|
||||||
public
|
@Deprecated(since = "9")
|
||||||
class AppletIllegalArgumentException extends IllegalArgumentException {
|
public class AppletIllegalArgumentException extends IllegalArgumentException {
|
||||||
private String key = null;
|
private String key = null;
|
||||||
|
|
||||||
public AppletIllegalArgumentException(String key) {
|
public AppletIllegalArgumentException(String key) {
|
||||||
|
@ -31,6 +31,7 @@ import java.lang.ref.SoftReference;
|
|||||||
import sun.awt.image.URLImageSource;
|
import sun.awt.image.URLImageSource;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
@Deprecated(since = "9")
|
||||||
class AppletImageRef {
|
class AppletImageRef {
|
||||||
private SoftReference<Image> soft = null;
|
private SoftReference<Image> soft = null;
|
||||||
|
|
||||||
|
@ -32,8 +32,12 @@ import java.util.EventListener;
|
|||||||
* by objects interested in AppletEvents.
|
* by objects interested in AppletEvents.
|
||||||
*
|
*
|
||||||
* @author Sunita Mani
|
* @author Sunita Mani
|
||||||
|
*
|
||||||
|
* @deprecated The Applet API is deprecated. See the
|
||||||
|
* <a href="../../java/applet/package-summary.html"> java.applet package
|
||||||
|
* documentation</a> for further information.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(since = "9")
|
||||||
public interface AppletListener extends EventListener {
|
public interface AppletListener extends EventListener {
|
||||||
public void appletStateChanged(AppletEvent e);
|
public void appletStateChanged(AppletEvent e);
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,12 @@ import java.lang.reflect.Array;
|
|||||||
/**
|
/**
|
||||||
* This subclass of ObjectInputStream delegates loading of classes to
|
* This subclass of ObjectInputStream delegates loading of classes to
|
||||||
* an existing ClassLoader.
|
* an existing ClassLoader.
|
||||||
|
*
|
||||||
|
* @deprecated The Applet API is deprecated. See the
|
||||||
|
* <a href="../../java/applet/package-summary.html"> java.applet package
|
||||||
|
* documentation</a> for further information.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(since = "9")
|
||||||
class AppletObjectInputStream extends ObjectInputStream
|
class AppletObjectInputStream extends ObjectInputStream
|
||||||
{
|
{
|
||||||
private AppletClassLoader loader;
|
private AppletClassLoader loader;
|
||||||
|
@ -52,9 +52,14 @@ import sun.security.util.SecurityConstants;
|
|||||||
* thread group to call the applet's init(), start(), stop(), and
|
* thread group to call the applet's init(), start(), stop(), and
|
||||||
* destroy() methods.
|
* destroy() methods.
|
||||||
*
|
*
|
||||||
|
* @deprecated The Applet API is deprecated. See the
|
||||||
|
* <a href="../../java/applet/package-summary.html"> java.applet package
|
||||||
|
* documentation</a> for further information.
|
||||||
|
*
|
||||||
* @author Arthur van Hoff
|
* @author Arthur van Hoff
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"serial", "deprecation"}) // JDK implementation class
|
@SuppressWarnings({"serial"}) // JDK implementation class
|
||||||
|
@Deprecated(since = "9")
|
||||||
public
|
public
|
||||||
abstract class AppletPanel extends Panel implements AppletStub, Runnable {
|
abstract class AppletPanel extends Panel implements AppletStub, Runnable {
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ import java.security.PrivilegedActionException;
|
|||||||
import sun.security.action.*;
|
import sun.security.action.*;
|
||||||
|
|
||||||
@SuppressWarnings("serial") // JDK implementation class
|
@SuppressWarnings("serial") // JDK implementation class
|
||||||
|
@Deprecated(since = "9")
|
||||||
class AppletProps extends Frame {
|
class AppletProps extends Frame {
|
||||||
|
|
||||||
TextField proxyHost;
|
TextField proxyHost;
|
||||||
@ -197,6 +198,7 @@ class AppletProps extends Frame {
|
|||||||
/* 4066432 */
|
/* 4066432 */
|
||||||
/* Dialog class to display property-related errors to user */
|
/* Dialog class to display property-related errors to user */
|
||||||
@SuppressWarnings("serial") // JDK implementation class
|
@SuppressWarnings("serial") // JDK implementation class
|
||||||
|
@Deprecated(since = "9")
|
||||||
class AppletPropsErrorDialog extends Dialog {
|
class AppletPropsErrorDialog extends Dialog {
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public AppletPropsErrorDialog(Frame parent, String title, String message,
|
public AppletPropsErrorDialog(Frame parent, String title, String message,
|
||||||
|
@ -43,6 +43,7 @@ import sun.awt.AppContext;
|
|||||||
* A frame to show the applet tag in.
|
* A frame to show the applet tag in.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial") // JDK-implementation class
|
@SuppressWarnings("serial") // JDK-implementation class
|
||||||
|
@Deprecated(since = "9")
|
||||||
final class TextFrame extends Frame {
|
final class TextFrame extends Frame {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,6 +92,7 @@ final class TextFrame extends Frame {
|
|||||||
/**
|
/**
|
||||||
* Lets us construct one using unix-style one shot behaviors.
|
* Lets us construct one using unix-style one shot behaviors.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(since = "9")
|
||||||
final class StdAppletViewerFactory implements AppletViewerFactory {
|
final class StdAppletViewerFactory implements AppletViewerFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -116,8 +118,13 @@ final class StdAppletViewerFactory implements AppletViewerFactory {
|
|||||||
* <a href="../../../docs/tooldocs/appletviewertags.html">AppletViewer Tags</a>.
|
* <a href="../../../docs/tooldocs/appletviewertags.html">AppletViewer Tags</a>.
|
||||||
* (The document named appletviewertags.html in the JDK's docs/tooldocs directory,
|
* (The document named appletviewertags.html in the JDK's docs/tooldocs directory,
|
||||||
* once the JDK docs have been installed.)
|
* once the JDK docs have been installed.)
|
||||||
|
*
|
||||||
|
* @deprecated The Applet API is deprecated. See the
|
||||||
|
* <a href="../../java/applet/package-summary.html"> java.applet package
|
||||||
|
* documentation</a> for further information.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"serial", "deprecation"}) // JDK-implementation class
|
@SuppressWarnings({"serial"}) // JDK-implementation class
|
||||||
|
@Deprecated(since = "9")
|
||||||
public class AppletViewer extends Frame implements AppletContext, Printable {
|
public class AppletViewer extends Frame implements AppletContext, Printable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,7 +153,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable {
|
|||||||
*/
|
*/
|
||||||
AppletViewerFactory factory;
|
AppletViewerFactory factory;
|
||||||
|
|
||||||
|
@Deprecated(since = "9")
|
||||||
private final class UserActionListener implements ActionListener {
|
private final class UserActionListener implements ActionListener {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent evt) {
|
public void actionPerformed(ActionEvent evt) {
|
||||||
@ -219,6 +226,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@Deprecated(since = "9")
|
||||||
class AppletEventListener implements AppletListener
|
class AppletEventListener implements AppletListener
|
||||||
{
|
{
|
||||||
final Frame frame;
|
final Frame frame;
|
||||||
|
@ -33,8 +33,8 @@ import java.util.Hashtable;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.awt.MenuBar;
|
import java.awt.MenuBar;
|
||||||
|
|
||||||
public
|
@Deprecated(since = "9")
|
||||||
interface AppletViewerFactory {
|
public interface AppletViewerFactory {
|
||||||
public AppletViewer createAppletViewer(int x, int y, URL doc,
|
public AppletViewer createAppletViewer(int x, int y, URL doc,
|
||||||
Hashtable<String, String> atts);
|
Hashtable<String, String> atts);
|
||||||
public MenuBar getBaseMenuBar();
|
public MenuBar getBaseMenuBar();
|
||||||
|
@ -40,7 +40,12 @@ import java.applet.*;
|
|||||||
* destroy() methods.
|
* destroy() methods.
|
||||||
*
|
*
|
||||||
* @author Arthur van Hoff
|
* @author Arthur van Hoff
|
||||||
|
*
|
||||||
|
* @deprecated The Applet API is deprecated. See the
|
||||||
|
* <a href="../../java/applet/package-summary.html"> java.applet package
|
||||||
|
* documentation</a> for further information.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(since = "9")
|
||||||
class AppletViewerPanel extends AppletPanel {
|
class AppletViewerPanel extends AppletPanel {
|
||||||
|
|
||||||
/* Are we debugging? */
|
/* Are we debugging? */
|
||||||
|
@ -39,7 +39,12 @@ import sun.net.www.ParseUtil;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The main entry point into AppletViewer.
|
* The main entry point into AppletViewer.
|
||||||
|
*
|
||||||
|
* @deprecated The Applet API is deprecated. See the
|
||||||
|
* <a href="../../java/applet/package-summary.html"> java.applet package
|
||||||
|
* documentation</a> for further information.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(since = "9")
|
||||||
public class Main {
|
public class Main {
|
||||||
/**
|
/**
|
||||||
* The file which contains all of the AppletViewer specific properties.
|
* The file which contains all of the AppletViewer specific properties.
|
||||||
|
@ -496,10 +496,14 @@ public abstract class EmbeddedFrame extends Frame
|
|||||||
* Checks if the component is in an EmbeddedFrame. If so,
|
* Checks if the component is in an EmbeddedFrame. If so,
|
||||||
* returns the applet found in the hierarchy or null if
|
* returns the applet found in the hierarchy or null if
|
||||||
* not found.
|
* not found.
|
||||||
* @return the parent applet or {@ null}
|
* @return the parent applet or {@code null}
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
|
*
|
||||||
|
* @deprecated The Applet API is deprecated. See the
|
||||||
|
* <a href="../../java/applet/package-summary.html"> java.applet package
|
||||||
|
* documentation</a> for further information.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@Deprecated(since = "9")
|
||||||
public static Applet getAppletIfAncestorOf(Component comp) {
|
public static Applet getAppletIfAncestorOf(Component comp) {
|
||||||
Container parent = comp.getParent();
|
Container parent = comp.getParent();
|
||||||
Applet applet = null;
|
Applet applet = null;
|
||||||
|
@ -2419,7 +2419,7 @@ allocateRasterArray(JNIEnv *env, RasterS_t *rasterP,
|
|||||||
case sun_awt_image_IntegerComponentRaster_TYPE_INT_8BIT_SAMPLES:
|
case sun_awt_image_IntegerComponentRaster_TYPE_INT_8BIT_SAMPLES:
|
||||||
if (!((rasterP->chanOffsets[0] == 0 || SAFE_TO_ALLOC_2(rasterP->chanOffsets[0], 4)) &&
|
if (!((rasterP->chanOffsets[0] == 0 || SAFE_TO_ALLOC_2(rasterP->chanOffsets[0], 4)) &&
|
||||||
SAFE_TO_ALLOC_2(width, 4) &&
|
SAFE_TO_ALLOC_2(width, 4) &&
|
||||||
SAFE_TO_ALLOC_3(height, rasterP->scanlineStride, 4)))
|
SAFE_TO_ALLOC_3(rasterP->scanlineStride, height, 4)))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2428,7 +2428,7 @@ allocateRasterArray(JNIEnv *env, RasterS_t *rasterP,
|
|||||||
|
|
||||||
if (offset < 0 || offset >= dataSize ||
|
if (offset < 0 || offset >= dataSize ||
|
||||||
width > rasterP->scanlineStride ||
|
width > rasterP->scanlineStride ||
|
||||||
height * rasterP->scanlineStride * 4 > dataSize - offset)
|
((width + (height - 1) * rasterP->scanlineStride) * 4) > dataSize - offset)
|
||||||
{
|
{
|
||||||
// raster data buffer is too short
|
// raster data buffer is too short
|
||||||
return -1;
|
return -1;
|
||||||
@ -2446,7 +2446,7 @@ allocateRasterArray(JNIEnv *env, RasterS_t *rasterP,
|
|||||||
return 0;
|
return 0;
|
||||||
case sun_awt_image_IntegerComponentRaster_TYPE_BYTE_SAMPLES:
|
case sun_awt_image_IntegerComponentRaster_TYPE_BYTE_SAMPLES:
|
||||||
if (!(SAFE_TO_ALLOC_2(width, rasterP->numBands) &&
|
if (!(SAFE_TO_ALLOC_2(width, rasterP->numBands) &&
|
||||||
SAFE_TO_ALLOC_2(height, rasterP->scanlineStride)))
|
SAFE_TO_ALLOC_2(rasterP->scanlineStride, height)))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2455,7 +2455,8 @@ allocateRasterArray(JNIEnv *env, RasterS_t *rasterP,
|
|||||||
|
|
||||||
if (offset < 0 || offset >= dataSize ||
|
if (offset < 0 || offset >= dataSize ||
|
||||||
width * rasterP->numBands > rasterP->scanlineStride ||
|
width * rasterP->numBands > rasterP->scanlineStride ||
|
||||||
height * rasterP->scanlineStride > dataSize - offset)
|
((width * rasterP->numBands) +
|
||||||
|
(height - 1) * rasterP->scanlineStride) > dataSize - offset)
|
||||||
{
|
{
|
||||||
// raster data buffer is too short
|
// raster data buffer is too short
|
||||||
return -1;
|
return -1;
|
||||||
@ -2474,7 +2475,7 @@ allocateRasterArray(JNIEnv *env, RasterS_t *rasterP,
|
|||||||
case sun_awt_image_IntegerComponentRaster_TYPE_USHORT_SAMPLES:
|
case sun_awt_image_IntegerComponentRaster_TYPE_USHORT_SAMPLES:
|
||||||
if (!((rasterP->chanOffsets[0] == 0 || SAFE_TO_ALLOC_2(rasterP->chanOffsets[0], 2)) &&
|
if (!((rasterP->chanOffsets[0] == 0 || SAFE_TO_ALLOC_2(rasterP->chanOffsets[0], 2)) &&
|
||||||
SAFE_TO_ALLOC_3(width, rasterP->numBands, 2) &&
|
SAFE_TO_ALLOC_3(width, rasterP->numBands, 2) &&
|
||||||
SAFE_TO_ALLOC_3(height, rasterP->scanlineStride, 2)))
|
SAFE_TO_ALLOC_3(rasterP->scanlineStride, height, 2)))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2483,7 +2484,8 @@ allocateRasterArray(JNIEnv *env, RasterS_t *rasterP,
|
|||||||
|
|
||||||
if (offset < 0 || offset >= dataSize ||
|
if (offset < 0 || offset >= dataSize ||
|
||||||
width * rasterP->numBands > rasterP->scanlineStride ||
|
width * rasterP->numBands > rasterP->scanlineStride ||
|
||||||
height * rasterP->scanlineStride * 2 > dataSize - offset)
|
(((width * rasterP->numBands) +
|
||||||
|
(height - 1) * rasterP->scanlineStride)) * 2 > dataSize - offset)
|
||||||
{
|
{
|
||||||
// raster data buffer is too short
|
// raster data buffer is too short
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -35,10 +35,10 @@
|
|||||||
*/
|
*/
|
||||||
#define SAFE_TO_ALLOC_2(c, sz) \
|
#define SAFE_TO_ALLOC_2(c, sz) \
|
||||||
(((c) > 0) && ((sz) > 0) && \
|
(((c) > 0) && ((sz) > 0) && \
|
||||||
((0xffffffffu / ((juint)(c))) > ((juint)(sz))))
|
((0x7fffffff / (c)) > (sz)))
|
||||||
|
|
||||||
#define SAFE_TO_ALLOC_3(w, h, sz) \
|
#define SAFE_TO_ALLOC_3(w, h, sz) \
|
||||||
(((w) > 0) && ((h) > 0) && ((sz) > 0) && \
|
(((w) > 0) && ((h) > 0) && ((sz) > 0) && \
|
||||||
(((0xffffffffu / ((juint)(w))) / ((juint)(h))) > ((juint)(sz))))
|
(((0x7fffffff / (w)) / (h)) > (sz)))
|
||||||
|
|
||||||
#endif // __SAFE_ALLOC_H__
|
#endif // __SAFE_ALLOC_H__
|
||||||
|
@ -51,9 +51,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
boolean insets_corrected;
|
boolean insets_corrected;
|
||||||
|
|
||||||
XIconWindow iconWindow;
|
XIconWindow iconWindow;
|
||||||
WindowDimensions dimensions;
|
volatile WindowDimensions dimensions;
|
||||||
XContentWindow content;
|
XContentWindow content;
|
||||||
Insets currentInsets;
|
volatile Insets currentInsets;
|
||||||
XFocusProxyWindow focusProxy;
|
XFocusProxyWindow focusProxy;
|
||||||
static final Map<Class<?>,Insets> lastKnownInsets =
|
static final Map<Class<?>,Insets> lastKnownInsets =
|
||||||
Collections.synchronizedMap(new HashMap<>());
|
Collections.synchronizedMap(new HashMap<>());
|
||||||
@ -106,7 +106,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
|
|
||||||
// The lines that follow need to be in a postInit, so they
|
// The lines that follow need to be in a postInit, so they
|
||||||
// happen after the X window is created.
|
// happen after the X window is created.
|
||||||
initResizability();
|
setResizable(winAttr.initialResizability);
|
||||||
XWM.requestWMExtents(getWindow());
|
XWM.requestWMExtents(getWindow());
|
||||||
|
|
||||||
content = XContentWindow.createContent(this);
|
content = XContentWindow.createContent(this);
|
||||||
@ -130,7 +130,12 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
|
|
||||||
public void updateMinimumSize() {
|
public void updateMinimumSize() {
|
||||||
super.updateMinimumSize();
|
super.updateMinimumSize();
|
||||||
|
XToolkit.awtLock();
|
||||||
|
try {
|
||||||
updateMinSizeHints();
|
updateMinSizeHints();
|
||||||
|
} finally {
|
||||||
|
XToolkit.awtUnlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMinSizeHints() {
|
private void updateMinSizeHints() {
|
||||||
@ -193,8 +198,13 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||||
log.fine("Title is " + title);
|
log.fine("Title is " + title);
|
||||||
}
|
}
|
||||||
|
XToolkit.awtLock();
|
||||||
|
try {
|
||||||
winAttr.title = title;
|
winAttr.title = title;
|
||||||
updateWMName();
|
updateWMName();
|
||||||
|
} finally {
|
||||||
|
XToolkit.awtUnlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getWMName() {
|
protected String getWMName() {
|
||||||
@ -206,10 +216,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void updateWMName() {
|
void updateWMName() {
|
||||||
super.updateWMName();
|
|
||||||
String name = getWMName();
|
|
||||||
XToolkit.awtLock();
|
XToolkit.awtLock();
|
||||||
try {
|
try {
|
||||||
|
super.updateWMName();
|
||||||
|
String name = getWMName();
|
||||||
if (name == null || name.trim().equals("")) {
|
if (name == null || name.trim().equals("")) {
|
||||||
name = "Java";
|
name = "Java";
|
||||||
}
|
}
|
||||||
@ -304,6 +314,8 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
if (XWM.getWMID() != XWM.UNITY_COMPIZ_WM) {
|
if (XWM.getWMID() != XWM.UNITY_COMPIZ_WM) {
|
||||||
currentInsets = new Insets(0, 0, 0, 0);
|
currentInsets = new Insets(0, 0, 0, 0);
|
||||||
wm_set_insets = null;
|
wm_set_insets = null;
|
||||||
|
} else {
|
||||||
|
insets_corrected = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,8 +389,6 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
insLog.fine(xe.toString());
|
insLog.fine(xe.toString());
|
||||||
}
|
}
|
||||||
reparent_serial = xe.get_serial();
|
reparent_serial = xe.get_serial();
|
||||||
XToolkit.awtLock();
|
|
||||||
try {
|
|
||||||
long root = XlibWrapper.RootWindow(XToolkit.getDisplay(), getScreenNumber());
|
long root = XlibWrapper.RootWindow(XToolkit.getDisplay(), getScreenNumber());
|
||||||
|
|
||||||
if (isEmbedded()) {
|
if (isEmbedded()) {
|
||||||
@ -386,7 +396,6 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
insets_corrected = true;
|
insets_corrected = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Component t = target;
|
|
||||||
if (getDecorations() == XWindowAttributesData.AWT_DECOR_NONE) {
|
if (getDecorations() == XWindowAttributesData.AWT_DECOR_NONE) {
|
||||||
setReparented(true);
|
setReparented(true);
|
||||||
insets_corrected = true;
|
insets_corrected = true;
|
||||||
@ -448,14 +457,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
handleCorrectInsets(correctWM);
|
handleCorrectInsets(correctWM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
XToolkit.awtUnlock();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleCorrectInsets(Insets correctWM) {
|
private void handleCorrectInsets(Insets correctWM) {
|
||||||
XToolkit.awtLock();
|
|
||||||
try {
|
|
||||||
/*
|
/*
|
||||||
* Ok, now see if we need adjust window size because
|
* Ok, now see if we need adjust window size because
|
||||||
* initial insets were wrong (most likely they were).
|
* initial insets were wrong (most likely they were).
|
||||||
@ -476,8 +480,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
|
if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
|
||||||
insLog.finer("Dimensions before reparent: " + dimensions);
|
insLog.finer("Dimensions before reparent: " + dimensions);
|
||||||
}
|
}
|
||||||
|
WindowDimensions newDimensions = new WindowDimensions(dimensions);
|
||||||
dimensions.setInsets(getRealInsets());
|
newDimensions.setInsets(getRealInsets());
|
||||||
|
dimensions = newDimensions;
|
||||||
insets_corrected = true;
|
insets_corrected = true;
|
||||||
|
|
||||||
if (isMaximized()) {
|
if (isMaximized()) {
|
||||||
@ -495,19 +500,16 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
} else {
|
} else {
|
||||||
reshape(dimensions, SET_SIZE, false);
|
reshape(dimensions, SET_SIZE, false);
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
XToolkit.awtUnlock();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleMoved(WindowDimensions dims) {
|
void handleMoved(WindowDimensions dims) {
|
||||||
Point loc = dims.getLocation();
|
Point loc = dims.getLocation();
|
||||||
AWTAccessor.getComponentAccessor().setLocation(target, loc.x, loc.y);
|
AWTAccessor.getComponentAccessor().setLocation(target, loc.x, loc.y);
|
||||||
postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_MOVED));
|
postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_MOVED));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected Insets guessInsets() {
|
private Insets guessInsets() {
|
||||||
if (isEmbedded() || isTargetUndecorated()) {
|
if (isEmbedded() || isTargetUndecorated()) {
|
||||||
return new Insets(0, 0, 0, 0);
|
return new Insets(0, 0, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
@ -532,16 +534,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
currentInsets = copy(guessed);
|
currentInsets = copy(guessed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void revalidate() {
|
private Insets getRealInsets() {
|
||||||
XToolkit.executeOnEventHandlerThread(target, new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
target.invalidate();
|
|
||||||
target.validate();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Insets getRealInsets() {
|
|
||||||
if (isNull(currentInsets)) {
|
if (isNull(currentInsets)) {
|
||||||
applyGuessedInsets();
|
applyGuessedInsets();
|
||||||
}
|
}
|
||||||
@ -578,7 +571,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
|
|
||||||
// Coordinates are that of the target
|
// Coordinates are that of the target
|
||||||
// Called only on Toolkit thread
|
// Called only on Toolkit thread
|
||||||
public void reshape(WindowDimensions newDimensions, int op,
|
private void reshape(WindowDimensions newDimensions, int op,
|
||||||
boolean userReshape)
|
boolean userReshape)
|
||||||
{
|
{
|
||||||
if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
|
if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
|
||||||
@ -599,8 +592,6 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
}
|
}
|
||||||
newDimensions = new WindowDimensions(newBounds, insets, newDimensions.isClientSizeSet());
|
newDimensions = new WindowDimensions(newBounds, insets, newDimensions.isClientSizeSet());
|
||||||
}
|
}
|
||||||
XToolkit.awtLock();
|
|
||||||
try {
|
|
||||||
if (!isReparented() || !isVisible()) {
|
if (!isReparented() || !isVisible()) {
|
||||||
if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
|
if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
|
||||||
insLog.fine("- not reparented({0}) or not visible({1}), default reshape",
|
insLog.fine("- not reparented({0}) or not visible({1}), default reshape",
|
||||||
@ -633,7 +624,6 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wm = XWM.getWMID();
|
|
||||||
updateChildrenSizes();
|
updateChildrenSizes();
|
||||||
applyGuessedInsets();
|
applyGuessedInsets();
|
||||||
|
|
||||||
@ -671,9 +661,6 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reconfigureContentWindow(newDimensions);
|
reconfigureContentWindow(newDimensions);
|
||||||
} finally {
|
|
||||||
XToolkit.awtUnlock();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -682,8 +669,6 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
private void reshape(int x, int y, int width, int height, int operation,
|
private void reshape(int x, int y, int width, int height, int operation,
|
||||||
boolean userReshape)
|
boolean userReshape)
|
||||||
{
|
{
|
||||||
Rectangle newRec;
|
|
||||||
boolean setClient = false;
|
|
||||||
WindowDimensions dims = new WindowDimensions(dimensions);
|
WindowDimensions dims = new WindowDimensions(dimensions);
|
||||||
switch (operation & (~NO_EMBEDDED_CHECK)) {
|
switch (operation & (~NO_EMBEDDED_CHECK)) {
|
||||||
case SET_LOCATION:
|
case SET_LOCATION:
|
||||||
@ -726,7 +711,12 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
*/
|
*/
|
||||||
public void setBounds(int x, int y, int width, int height, int op) {
|
public void setBounds(int x, int y, int width, int height, int op) {
|
||||||
// TODO: Rewrite with WindowDimensions
|
// TODO: Rewrite with WindowDimensions
|
||||||
|
XToolkit.awtLock();
|
||||||
|
try {
|
||||||
reshape(x, y, width, height, op, true);
|
reshape(x, y, width, height, op, true);
|
||||||
|
} finally {
|
||||||
|
XToolkit.awtUnlock();
|
||||||
|
}
|
||||||
validateSurface();
|
validateSurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -861,54 +851,37 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
checkShellRectPos(shellRect);
|
checkShellRectPos(shellRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setShellBounds(Rectangle rec) {
|
private void setShellBounds(Rectangle rec) {
|
||||||
if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
|
if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
|
||||||
insLog.fine("Setting shell bounds on " + this + " to " + rec);
|
insLog.fine("Setting shell bounds on " + this + " to " + rec);
|
||||||
}
|
}
|
||||||
XToolkit.awtLock();
|
|
||||||
try {
|
|
||||||
updateSizeHints(rec.x, rec.y, rec.width, rec.height);
|
updateSizeHints(rec.x, rec.y, rec.width, rec.height);
|
||||||
XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), getShell(),
|
XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), getShell(),
|
||||||
scaleUp(rec.x), scaleUp(rec.y),
|
scaleUp(rec.x), scaleUp(rec.y),
|
||||||
scaleUp(rec.width), scaleUp(rec.height));
|
scaleUp(rec.width), scaleUp(rec.height));
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
XToolkit.awtUnlock();
|
private void setShellSize(Rectangle rec) {
|
||||||
}
|
|
||||||
}
|
|
||||||
public void setShellSize(Rectangle rec) {
|
|
||||||
if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
|
if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
|
||||||
insLog.fine("Setting shell size on " + this + " to " + rec);
|
insLog.fine("Setting shell size on " + this + " to " + rec);
|
||||||
}
|
}
|
||||||
XToolkit.awtLock();
|
|
||||||
try {
|
|
||||||
updateSizeHints(rec.x, rec.y, rec.width, rec.height);
|
updateSizeHints(rec.x, rec.y, rec.width, rec.height);
|
||||||
XlibWrapper.XResizeWindow(XToolkit.getDisplay(), getShell(),
|
XlibWrapper.XResizeWindow(XToolkit.getDisplay(), getShell(),
|
||||||
scaleUp(rec.width), scaleUp(rec.height));
|
scaleUp(rec.width), scaleUp(rec.height));
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
XToolkit.awtUnlock();
|
private void setShellPosition(Rectangle rec) {
|
||||||
}
|
|
||||||
}
|
|
||||||
public void setShellPosition(Rectangle rec) {
|
|
||||||
if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
|
if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
|
||||||
insLog.fine("Setting shell position on " + this + " to " + rec);
|
insLog.fine("Setting shell position on " + this + " to " + rec);
|
||||||
}
|
}
|
||||||
XToolkit.awtLock();
|
|
||||||
try {
|
|
||||||
updateSizeHints(rec.x, rec.y, rec.width, rec.height);
|
updateSizeHints(rec.x, rec.y, rec.width, rec.height);
|
||||||
XlibWrapper.XMoveWindow(XToolkit.getDisplay(), getShell(),
|
XlibWrapper.XMoveWindow(XToolkit.getDisplay(), getShell(),
|
||||||
scaleUp(rec.x), scaleUp(rec.y));
|
scaleUp(rec.x), scaleUp(rec.y));
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
XToolkit.awtUnlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void initResizability() {
|
|
||||||
setResizable(winAttr.initialResizability);
|
|
||||||
}
|
|
||||||
public void setResizable(boolean resizable) {
|
public void setResizable(boolean resizable) {
|
||||||
|
XToolkit.awtLock();
|
||||||
|
try {
|
||||||
int fs = winAttr.functions;
|
int fs = winAttr.functions;
|
||||||
if (!isResizable() && resizable) {
|
if (!isResizable() && resizable) {
|
||||||
resetWMSetInsets();
|
resetWMSetInsets();
|
||||||
@ -917,9 +890,11 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
}
|
}
|
||||||
winAttr.isResizable = resizable;
|
winAttr.isResizable = resizable;
|
||||||
if ((fs & MWMConstants.MWM_FUNC_ALL) != 0) {
|
if ((fs & MWMConstants.MWM_FUNC_ALL) != 0) {
|
||||||
fs &= ~(MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
|
fs &= ~(MWMConstants.MWM_FUNC_RESIZE
|
||||||
|
| MWMConstants.MWM_FUNC_MAXIMIZE);
|
||||||
} else {
|
} else {
|
||||||
fs |= (MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
|
fs |= (MWMConstants.MWM_FUNC_RESIZE
|
||||||
|
| MWMConstants.MWM_FUNC_MAXIMIZE);
|
||||||
}
|
}
|
||||||
winAttr.functions = fs;
|
winAttr.functions = fs;
|
||||||
XWM.setShellResizable(this);
|
XWM.setShellResizable(this);
|
||||||
@ -930,12 +905,20 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
}
|
}
|
||||||
winAttr.isResizable = resizable;
|
winAttr.isResizable = resizable;
|
||||||
if ((fs & MWMConstants.MWM_FUNC_ALL) != 0) {
|
if ((fs & MWMConstants.MWM_FUNC_ALL) != 0) {
|
||||||
fs |= (MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
|
fs |= (MWMConstants.MWM_FUNC_RESIZE
|
||||||
|
| MWMConstants.MWM_FUNC_MAXIMIZE);
|
||||||
} else {
|
} else {
|
||||||
fs &= ~(MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
|
fs &= ~(MWMConstants.MWM_FUNC_RESIZE
|
||||||
|
| MWMConstants.MWM_FUNC_MAXIMIZE);
|
||||||
}
|
}
|
||||||
winAttr.functions = fs;
|
winAttr.functions = fs;
|
||||||
XWM.setShellNotResizable(this, dimensions, dimensions.getBounds(), false);
|
XWM.setShellNotResizable(this, dimensions,
|
||||||
|
XWM.getWMID() == XWM.UNITY_COMPIZ_WM && configure_seen ?
|
||||||
|
dimensions.getScreenBounds() :
|
||||||
|
dimensions.getBounds(), false);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
XToolkit.awtUnlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -990,7 +973,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
try {
|
try {
|
||||||
if (configure_seen) {
|
if (configure_seen) {
|
||||||
return toGlobal(0,0);
|
return toGlobal(0,0);
|
||||||
} else {
|
}
|
||||||
|
} finally {
|
||||||
|
XToolkit.awtUnlock();
|
||||||
|
}
|
||||||
Point location = target.getLocation();
|
Point location = target.getLocation();
|
||||||
if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
|
if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
|
||||||
insLog.fine("getLocationOnScreen {0} not reparented: {1} ",
|
insLog.fine("getLocationOnScreen {0} not reparented: {1} ",
|
||||||
@ -998,10 +984,6 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
}
|
}
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
XToolkit.awtUnlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
@ -1134,7 +1116,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
|||||||
return focusProxy;
|
return focusProxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleQuit() {
|
private void handleQuit() {
|
||||||
postEvent(new WindowEvent((Window)target, WindowEvent.WINDOW_CLOSING));
|
postEvent(new WindowEvent((Window)target, WindowEvent.WINDOW_CLOSING));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1029,8 +1029,14 @@ final class XWM
|
|||||||
}
|
}
|
||||||
XToolkit.awtLock();
|
XToolkit.awtLock();
|
||||||
try {
|
try {
|
||||||
Rectangle shellBounds = window.getShellBounds();
|
Rectangle shellBounds;
|
||||||
shellBounds.translate(-window.currentInsets.left, -window.currentInsets.top);
|
if (getWMID() != UNITY_COMPIZ_WM) {
|
||||||
|
shellBounds = window.getShellBounds();
|
||||||
|
shellBounds.translate(-window.currentInsets.left,
|
||||||
|
-window.currentInsets.top);
|
||||||
|
} else {
|
||||||
|
shellBounds = window.getDimensions().getScreenBounds();
|
||||||
|
}
|
||||||
window.updateSizeHints(window.getDimensions());
|
window.updateSizeHints(window.getDimensions());
|
||||||
requestWMExtents(window.getWindow());
|
requestWMExtents(window.getWindow());
|
||||||
XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(),
|
XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(),
|
||||||
|
@ -1053,15 +1053,8 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
|
|||||||
// of setting it, it is a safe assumption to just always
|
// of setting it, it is a safe assumption to just always
|
||||||
// include SheetCollate as supported attribute.
|
// include SheetCollate as supported attribute.
|
||||||
|
|
||||||
/*
|
|
||||||
In Linux, we use Postscript for rendering but Linux still
|
|
||||||
has issues in propagating Postscript-embedded setpagedevice
|
|
||||||
setting like collation. Therefore, we temporarily exclude
|
|
||||||
Linux.
|
|
||||||
*/
|
|
||||||
if (!PrintServiceLookupProvider.isLinux()) {
|
|
||||||
catList.add(SheetCollate.class);
|
catList.add(SheetCollate.class);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// With the assumption that Chromaticity is equivalent to
|
// With the assumption that Chromaticity is equivalent to
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -362,18 +362,26 @@ public class RegistryImpl extends java.rmi.server.RemoteServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main program to start a registry. <br>
|
* Return a new RegistryImpl on the requested port and export it to serve
|
||||||
* The port number can be specified on the command line.
|
* registry requests. A classloader is initialized from the system property
|
||||||
|
* "env.class.path" and a security manager is set unless one is already set.
|
||||||
|
* <p>
|
||||||
|
* The returned Registry is fully functional within the current process and
|
||||||
|
* is usable for internal and testing purposes.
|
||||||
|
*
|
||||||
|
* @param regPort port on which the rmiregistry accepts requests;
|
||||||
|
* if 0, an implementation specific port is assigned
|
||||||
|
* @return a RegistryImpl instance
|
||||||
|
* @exception RemoteException If remote operation failed.
|
||||||
|
* @since 9
|
||||||
*/
|
*/
|
||||||
public static void main(String args[])
|
public static RegistryImpl createRegistry(int regPort) throws RemoteException {
|
||||||
{
|
|
||||||
// Create and install the security manager if one is not installed
|
// Create and install the security manager if one is not installed
|
||||||
// already.
|
// already.
|
||||||
if (System.getSecurityManager() == null) {
|
if (System.getSecurityManager() == null) {
|
||||||
System.setSecurityManager(new SecurityManager());
|
System.setSecurityManager(new SecurityManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
/*
|
/*
|
||||||
* Fix bugid 4147561: When JDK tools are executed, the value of
|
* Fix bugid 4147561: When JDK tools are executed, the value of
|
||||||
* the CLASSPATH environment variable for the shell in which they
|
* the CLASSPATH environment variable for the shell in which they
|
||||||
@ -403,10 +411,9 @@ public class RegistryImpl extends java.rmi.server.RemoteServer
|
|||||||
|
|
||||||
Thread.currentThread().setContextClassLoader(cl);
|
Thread.currentThread().setContextClassLoader(cl);
|
||||||
|
|
||||||
final int regPort = (args.length >= 1) ? Integer.parseInt(args[0])
|
RegistryImpl registryImpl = null;
|
||||||
: Registry.REGISTRY_PORT;
|
|
||||||
try {
|
try {
|
||||||
registry = AccessController.doPrivileged(
|
registryImpl = AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<RegistryImpl>() {
|
new PrivilegedExceptionAction<RegistryImpl>() {
|
||||||
public RegistryImpl run() throws RemoteException {
|
public RegistryImpl run() throws RemoteException {
|
||||||
return new RegistryImpl(regPort);
|
return new RegistryImpl(regPort);
|
||||||
@ -416,6 +423,21 @@ public class RegistryImpl extends java.rmi.server.RemoteServer
|
|||||||
throw (RemoteException) ex.getException();
|
throw (RemoteException) ex.getException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return registryImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main program to start a registry. <br>
|
||||||
|
* The port number can be specified on the command line.
|
||||||
|
*/
|
||||||
|
public static void main(String args[])
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
final int regPort = (args.length >= 1) ? Integer.parseInt(args[0])
|
||||||
|
: Registry.REGISTRY_PORT;
|
||||||
|
|
||||||
|
registry = createRegistry(regPort);
|
||||||
|
|
||||||
// prevent registry from exiting
|
// prevent registry from exiting
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
|
@ -102,26 +102,26 @@ JNIEXPORT jint JNICALL Java_jdk_internal_jline_WindowsTerminal_getConsoleOutputC
|
|||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_jdk_internal_jline_WindowsTerminal_getWindowsTerminalWidth
|
JNIEXPORT jint JNICALL Java_jdk_internal_jline_WindowsTerminal_getWindowsTerminalWidth
|
||||||
(JNIEnv *, jobject) {
|
(JNIEnv *, jobject) {
|
||||||
HANDLE hStdIn;
|
HANDLE hStdOut;
|
||||||
if ((hStdIn = GetStdHandle(STD_INPUT_HANDLE)) == INVALID_HANDLE_VALUE) {
|
if ((hStdOut = GetStdHandle(STD_OUTPUT_HANDLE)) == INVALID_HANDLE_VALUE) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
CONSOLE_SCREEN_BUFFER_INFO info;
|
CONSOLE_SCREEN_BUFFER_INFO info;
|
||||||
if (! GetConsoleScreenBufferInfo(hStdIn, &info)) {
|
if (! GetConsoleScreenBufferInfo(hStdOut, &info)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return info.dwSize.X;
|
return info.srWindow.Right - info.srWindow.Left;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_jdk_internal_jline_WindowsTerminal_getWindowsTerminalHeight
|
JNIEXPORT jint JNICALL Java_jdk_internal_jline_WindowsTerminal_getWindowsTerminalHeight
|
||||||
(JNIEnv *, jobject) {
|
(JNIEnv *, jobject) {
|
||||||
HANDLE hStdIn;
|
HANDLE hStdOut;
|
||||||
if ((hStdIn = GetStdHandle(STD_INPUT_HANDLE)) == INVALID_HANDLE_VALUE) {
|
if ((hStdOut = GetStdHandle(STD_OUTPUT_HANDLE)) == INVALID_HANDLE_VALUE) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
CONSOLE_SCREEN_BUFFER_INFO info;
|
CONSOLE_SCREEN_BUFFER_INFO info;
|
||||||
if (! GetConsoleScreenBufferInfo(hStdIn, &info)) {
|
if (! GetConsoleScreenBufferInfo(hStdOut, &info)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return info.dwSize.Y;
|
return info.srWindow.Bottom - info.srWindow.Top + 1;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -34,6 +34,8 @@ import java.nio.file.Path;
|
|||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.regex.PatternSyntaxException;
|
import java.util.regex.PatternSyntaxException;
|
||||||
|
|
||||||
|
import jdk.internal.module.ModulePath;
|
||||||
import jdk.internal.module.ModuleResolution;
|
import jdk.internal.module.ModuleResolution;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -155,8 +157,8 @@ class GNUStyleOptions {
|
|||||||
for (String dir : dirs) {
|
for (String dir : dirs) {
|
||||||
paths[i++] = Paths.get(dir);
|
paths[i++] = Paths.get(dir);
|
||||||
}
|
}
|
||||||
jartool.moduleFinder = ModuleFinder.compose(jartool.moduleFinder,
|
jartool.moduleFinder =
|
||||||
ModuleFinder.of(paths));
|
new ModulePath(Runtime.version(), true, paths);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Option(false, OptionType.CREATE_UPDATE, "--do-not-resolve-by-default") {
|
new Option(false, OptionType.CREATE_UPDATE, "--do-not-resolve-by-default") {
|
||||||
@ -169,9 +171,9 @@ class GNUStyleOptions {
|
|||||||
new Option(true, OptionType.CREATE_UPDATE, "--warn-if-resolved") {
|
new Option(true, OptionType.CREATE_UPDATE, "--warn-if-resolved") {
|
||||||
void process(Main jartool, String opt, String arg) throws BadArgs {
|
void process(Main jartool, String opt, String arg) throws BadArgs {
|
||||||
ModuleResolution mres = ModuleResolution.empty();
|
ModuleResolution mres = ModuleResolution.empty();
|
||||||
if (jartool.moduleResolution.doNotResolveByDefault())
|
if (jartool.moduleResolution.doNotResolveByDefault()) {
|
||||||
mres.withDoNotResolveByDefault();
|
mres.withDoNotResolveByDefault();
|
||||||
|
}
|
||||||
if (arg.equals("deprecated")) {
|
if (arg.equals("deprecated")) {
|
||||||
jartool.moduleResolution = mres.withDeprecated();
|
jartool.moduleResolution = mres.withDeprecated();
|
||||||
} else if (arg.equals("deprecated-for-removal")) {
|
} else if (arg.equals("deprecated-for-removal")) {
|
||||||
@ -201,26 +203,27 @@ class GNUStyleOptions {
|
|||||||
// Other options
|
// Other options
|
||||||
new Option(true, true, OptionType.OTHER, "--help", "-h") {
|
new Option(true, true, OptionType.OTHER, "--help", "-h") {
|
||||||
void process(Main jartool, String opt, String arg) throws BadArgs {
|
void process(Main jartool, String opt, String arg) throws BadArgs {
|
||||||
|
if (jartool.info == null) {
|
||||||
if (arg == null) {
|
if (arg == null) {
|
||||||
jartool.info = Main.Info.HELP;
|
jartool.info = GNUStyleOptions::printHelp; // Main.Info.HELP;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arg.equals("compat"))
|
if (!arg.equals("compat"))
|
||||||
throw new BadArgs("error.illegal.option", arg).showUsage(true);
|
throw new BadArgs("error.illegal.option", arg).showUsage(true);
|
||||||
|
// jartool.info = Main.Info.COMPAT_HELP;
|
||||||
jartool.info = Main.Info.COMPAT_HELP;
|
jartool.info = GNUStyleOptions::printCompatHelp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Option(false, OptionType.OTHER, "--help-extra") {
|
new Option(false, OptionType.OTHER, "--help-extra") {
|
||||||
void process(Main jartool, String opt, String arg) throws BadArgs {
|
void process(Main jartool, String opt, String arg) throws BadArgs {
|
||||||
jartool.info = Main.Info.HELP_EXTRA;
|
jartool.info = GNUStyleOptions::printHelpExtra;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Option(false, OptionType.OTHER, "--version") {
|
new Option(false, OptionType.OTHER, "--version") {
|
||||||
void process(Main jartool, String opt, String arg) {
|
void process(Main jartool, String opt, String arg) {
|
||||||
if (jartool.info == null)
|
if (jartool.info == null)
|
||||||
jartool.info = Main.Info.VERSION;
|
jartool.info = GNUStyleOptions::printVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -279,14 +282,14 @@ class GNUStyleOptions {
|
|||||||
static int parseOptions(Main jartool, String[] args) throws BadArgs {
|
static int parseOptions(Main jartool, String[] args) throws BadArgs {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
jartool.info = Main.Info.USAGE_TRYHELP;
|
jartool.info = GNUStyleOptions::printUsageTryHelp; // never be here
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// process options
|
// process options
|
||||||
for (; count < args.length; count++) {
|
for (; count < args.length; count++) {
|
||||||
if (args[count].charAt(0) != '-' || args[count].equals("-C")
|
if (args[count].charAt(0) != '-' || args[count].equals("-C") ||
|
||||||
|| args[count].equals("--release"))
|
args[count].equals("--release"))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
String name = args[count];
|
String name = args[count];
|
||||||
@ -322,15 +325,15 @@ class GNUStyleOptions {
|
|||||||
throw new BadArgs("error.unrecognized.option", name).showUsage(true);
|
throw new BadArgs("error.unrecognized.option", name).showUsage(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void printHelp(PrintWriter out) {
|
|
||||||
printHelp(out, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void printHelpExtra(PrintWriter out) {
|
static void printHelpExtra(PrintWriter out) {
|
||||||
printHelp(out, true);
|
printHelp0(out, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void printHelp(PrintWriter out, boolean printExtra) {
|
static void printHelp(PrintWriter out) {
|
||||||
|
printHelp0(out, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void printHelp0(PrintWriter out, boolean printExtra) {
|
||||||
out.format("%s%n", Main.getMsg("main.help.preopt"));
|
out.format("%s%n", Main.getMsg("main.help.preopt"));
|
||||||
for (OptionType type : OptionType.values()) {
|
for (OptionType type : OptionType.values()) {
|
||||||
boolean typeHeadingWritten = false;
|
boolean typeHeadingWritten = false;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,33 +25,121 @@
|
|||||||
|
|
||||||
package sun.tools.jar;
|
package sun.tools.jar;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.lang.module.InvalidModuleDescriptorException;
|
||||||
|
import java.lang.module.ModuleDescriptor;
|
||||||
|
import java.lang.module.ModuleDescriptor.Exports;
|
||||||
|
import java.lang.module.InvalidModuleDescriptorException;
|
||||||
|
import java.lang.module.ModuleDescriptor.Opens;
|
||||||
|
import java.lang.module.ModuleDescriptor.Provides;
|
||||||
|
import java.lang.module.ModuleDescriptor.Requires;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
|
||||||
final class Validator implements Consumer<JarEntry> {
|
import static java.util.jar.JarFile.MANIFEST_NAME;
|
||||||
|
import static sun.tools.jar.Main.VERSIONS_DIR;
|
||||||
|
import static sun.tools.jar.Main.MODULE_INFO;
|
||||||
|
import static sun.tools.jar.Main.getMsg;
|
||||||
|
import static sun.tools.jar.Main.formatMsg;
|
||||||
|
import static sun.tools.jar.Main.formatMsg2;
|
||||||
|
import static sun.tools.jar.Main.toBinaryName;
|
||||||
|
import static sun.tools.jar.Main.isModuleInfoEntry;
|
||||||
|
|
||||||
|
final class Validator {
|
||||||
private final static boolean DEBUG = Boolean.getBoolean("jar.debug");
|
private final static boolean DEBUG = Boolean.getBoolean("jar.debug");
|
||||||
private final Map<String,FingerPrint> fps = new HashMap<>();
|
private final Map<String,FingerPrint> fps = new HashMap<>();
|
||||||
private final int vdlen = Main.VERSIONS_DIR.length();
|
private static final int vdlen = VERSIONS_DIR.length();
|
||||||
private final Main main;
|
private final Main main;
|
||||||
private final JarFile jf;
|
private final JarFile jf;
|
||||||
private int oldVersion = -1;
|
private int oldVersion = -1;
|
||||||
private String currentTopLevelName;
|
private String currentTopLevelName;
|
||||||
private boolean isValid = true;
|
private boolean isValid = true;
|
||||||
|
private Set<String> concealedPkgs;
|
||||||
|
private ModuleDescriptor md;
|
||||||
|
|
||||||
Validator(Main main, JarFile jf) {
|
private Validator(Main main, JarFile jf) {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
this.jf = jf;
|
this.jf = jf;
|
||||||
|
loadModuleDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isValid() {
|
static boolean validate(Main main, JarFile jf) throws IOException {
|
||||||
return isValid;
|
return new Validator(main, jf).validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean validate() {
|
||||||
|
try {
|
||||||
|
jf.stream()
|
||||||
|
.filter(e -> !e.isDirectory() &&
|
||||||
|
!e.getName().equals(MANIFEST_NAME))
|
||||||
|
.sorted(entryComparator)
|
||||||
|
.forEachOrdered(e -> validate(e));
|
||||||
|
return isValid;
|
||||||
|
} catch (InvalidJarException e) {
|
||||||
|
error(formatMsg("error.validator.bad.entry.name", e.getMessage()));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class InvalidJarException extends RuntimeException {
|
||||||
|
private static final long serialVersionUID = -3642329147299217726L;
|
||||||
|
InvalidJarException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// sort base entries before versioned entries, and sort entry classes with
|
||||||
|
// nested classes so that the top level class appears before the associated
|
||||||
|
// nested class
|
||||||
|
private static Comparator<JarEntry> entryComparator = (je1, je2) -> {
|
||||||
|
String s1 = je1.getName();
|
||||||
|
String s2 = je2.getName();
|
||||||
|
if (s1.equals(s2)) return 0;
|
||||||
|
boolean b1 = s1.startsWith(VERSIONS_DIR);
|
||||||
|
boolean b2 = s2.startsWith(VERSIONS_DIR);
|
||||||
|
if (b1 && !b2) return 1;
|
||||||
|
if (!b1 && b2) return -1;
|
||||||
|
int n = 0; // starting char for String compare
|
||||||
|
if (b1 && b2) {
|
||||||
|
// normally strings would be sorted so "10" goes before "9", but
|
||||||
|
// version number strings need to be sorted numerically
|
||||||
|
n = VERSIONS_DIR.length(); // skip the common prefix
|
||||||
|
int i1 = s1.indexOf('/', n);
|
||||||
|
int i2 = s1.indexOf('/', n);
|
||||||
|
if (i1 == -1) throw new InvalidJarException(s1);
|
||||||
|
if (i2 == -1) throw new InvalidJarException(s2);
|
||||||
|
// shorter version numbers go first
|
||||||
|
if (i1 != i2) return i1 - i2;
|
||||||
|
// otherwise, handle equal length numbers below
|
||||||
|
}
|
||||||
|
int l1 = s1.length();
|
||||||
|
int l2 = s2.length();
|
||||||
|
int lim = Math.min(l1, l2);
|
||||||
|
for (int k = n; k < lim; k++) {
|
||||||
|
char c1 = s1.charAt(k);
|
||||||
|
char c2 = s2.charAt(k);
|
||||||
|
if (c1 != c2) {
|
||||||
|
// change natural ordering so '.' comes before '$'
|
||||||
|
// i.e. top level classes come before nested classes
|
||||||
|
if (c1 == '$' && c2 == '.') return 1;
|
||||||
|
if (c1 == '.' && c2 == '$') return -1;
|
||||||
|
return c1 - c2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return l1 - l2;
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Validator has state and assumes entries provided to accept are ordered
|
* Validator has state and assumes entries provided to accept are ordered
|
||||||
* from base entries first and then through the versioned entries in
|
* from base entries first and then through the versioned entries in
|
||||||
@ -59,7 +147,7 @@ final class Validator implements Consumer<JarEntry> {
|
|||||||
* classes must be ordered so that the top level class is before the associated
|
* classes must be ordered so that the top level class is before the associated
|
||||||
* nested class(es).
|
* nested class(es).
|
||||||
*/
|
*/
|
||||||
public void accept(JarEntry je) {
|
public void validate(JarEntry je) {
|
||||||
String entryName = je.getName();
|
String entryName = je.getName();
|
||||||
|
|
||||||
// directories are always accepted
|
// directories are always accepted
|
||||||
@ -68,13 +156,20 @@ final class Validator implements Consumer<JarEntry> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// validate the versioned module-info
|
||||||
|
if (isModuleInfoEntry(entryName)) {
|
||||||
|
if (entryName.length() != MODULE_INFO.length())
|
||||||
|
checkModuleDescriptor(je);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// figure out the version and basename from the JarEntry
|
// figure out the version and basename from the JarEntry
|
||||||
int version;
|
int version;
|
||||||
String basename;
|
String basename;
|
||||||
if (entryName.startsWith(Main.VERSIONS_DIR)) {
|
if (entryName.startsWith(VERSIONS_DIR)) {
|
||||||
int n = entryName.indexOf("/", vdlen);
|
int n = entryName.indexOf("/", vdlen);
|
||||||
if (n == -1) {
|
if (n == -1) {
|
||||||
main.error(Main.formatMsg("error.validator.version.notnumber", entryName));
|
error(formatMsg("error.validator.version.notnumber", entryName));
|
||||||
isValid = false;
|
isValid = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -82,12 +177,12 @@ final class Validator implements Consumer<JarEntry> {
|
|||||||
try {
|
try {
|
||||||
version = Integer.parseInt(v);
|
version = Integer.parseInt(v);
|
||||||
} catch (NumberFormatException x) {
|
} catch (NumberFormatException x) {
|
||||||
main.error(Main.formatMsg("error.validator.version.notnumber", entryName));
|
error(formatMsg("error.validator.version.notnumber", entryName));
|
||||||
isValid = false;
|
isValid = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (n == entryName.length()) {
|
if (n == entryName.length()) {
|
||||||
main.error(Main.formatMsg("error.validator.entryname.tooshort", entryName));
|
error(formatMsg("error.validator.entryname.tooshort", entryName));
|
||||||
isValid = false;
|
isValid = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -108,7 +203,7 @@ final class Validator implements Consumer<JarEntry> {
|
|||||||
try (InputStream is = jf.getInputStream(je)) {
|
try (InputStream is = jf.getInputStream(je)) {
|
||||||
fp = new FingerPrint(basename, is.readAllBytes());
|
fp = new FingerPrint(basename, is.readAllBytes());
|
||||||
} catch (IOException x) {
|
} catch (IOException x) {
|
||||||
main.error(x.getMessage());
|
error(x.getMessage());
|
||||||
isValid = false;
|
isValid = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -123,7 +218,7 @@ final class Validator implements Consumer<JarEntry> {
|
|||||||
fps.put(internalName, fp);
|
fps.put(internalName, fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
main.error(Main.formatMsg("error.validator.isolated.nested.class", entryName));
|
error(formatMsg("error.validator.isolated.nested.class", entryName));
|
||||||
isValid = false;
|
isValid = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -153,11 +248,11 @@ final class Validator implements Consumer<JarEntry> {
|
|||||||
}
|
}
|
||||||
if (fp.isPublicClass()) {
|
if (fp.isPublicClass()) {
|
||||||
if (!isConcealed(internalName)) {
|
if (!isConcealed(internalName)) {
|
||||||
main.error(Main.formatMsg("error.validator.new.public.class", entryName));
|
error(Main.formatMsg("error.validator.new.public.class", entryName));
|
||||||
isValid = false;
|
isValid = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
main.warn(Main.formatMsg("warn.validator.concealed.public.class", entryName));
|
warn(formatMsg("warn.validator.concealed.public.class", entryName));
|
||||||
debug("%s is a public class entry in a concealed package", entryName);
|
debug("%s is a public class entry in a concealed package", entryName);
|
||||||
}
|
}
|
||||||
debug("%s is a non-public class entry", entryName);
|
debug("%s is a non-public class entry", entryName);
|
||||||
@ -173,7 +268,7 @@ final class Validator implements Consumer<JarEntry> {
|
|||||||
|
|
||||||
// are the two classes/resources identical?
|
// are the two classes/resources identical?
|
||||||
if (fp.isIdentical(matchFp)) {
|
if (fp.isIdentical(matchFp)) {
|
||||||
main.warn(Main.formatMsg("warn.validator.identical.entry", entryName));
|
warn(formatMsg("warn.validator.identical.entry", entryName));
|
||||||
return; // it's okay, just takes up room
|
return; // it's okay, just takes up room
|
||||||
}
|
}
|
||||||
debug("sha1 not equal -- different bytes");
|
debug("sha1 not equal -- different bytes");
|
||||||
@ -188,12 +283,12 @@ final class Validator implements Consumer<JarEntry> {
|
|||||||
}
|
}
|
||||||
debug("%s is a class entry", entryName);
|
debug("%s is a class entry", entryName);
|
||||||
if (!fp.isCompatibleVersion(matchFp)) {
|
if (!fp.isCompatibleVersion(matchFp)) {
|
||||||
main.error(Main.formatMsg("error.validator.incompatible.class.version", entryName));
|
error(formatMsg("error.validator.incompatible.class.version", entryName));
|
||||||
isValid = false;
|
isValid = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!fp.isSameAPI(matchFp)) {
|
if (!fp.isSameAPI(matchFp)) {
|
||||||
main.error(Main.formatMsg("error.validator.different.api", entryName));
|
error(formatMsg("error.validator.different.api", entryName));
|
||||||
isValid = false;
|
isValid = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -208,17 +303,118 @@ final class Validator implements Consumer<JarEntry> {
|
|||||||
}
|
}
|
||||||
debug("%s is a resource", entryName);
|
debug("%s is a resource", entryName);
|
||||||
|
|
||||||
main.warn(Main.formatMsg("warn.validator.resources.with.same.name", entryName));
|
warn(formatMsg("warn.validator.resources.with.same.name", entryName));
|
||||||
fps.put(internalName, fp);
|
fps.put(internalName, fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadModuleDescriptor() {
|
||||||
|
ZipEntry je = jf.getEntry(MODULE_INFO);
|
||||||
|
if (je != null) {
|
||||||
|
try (InputStream jis = jf.getInputStream(je)) {
|
||||||
|
md = ModuleDescriptor.read(jis);
|
||||||
|
concealedPkgs = new HashSet<>(md.packages());
|
||||||
|
md.exports().stream().map(Exports::source).forEach(concealedPkgs::remove);
|
||||||
|
md.opens().stream().map(Opens::source).forEach(concealedPkgs::remove);
|
||||||
|
return;
|
||||||
|
} catch (Exception x) {
|
||||||
|
error(x.getMessage() + " : " + je.getName());
|
||||||
|
this.isValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
md = null;
|
||||||
|
concealedPkgs = Collections.emptySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isPlatformModule(String name) {
|
||||||
|
return name.startsWith("java.") || name.startsWith("jdk.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether or not the given versioned module descriptor's attributes
|
||||||
|
* are valid when compared against the root module descriptor.
|
||||||
|
*
|
||||||
|
* A versioned module descriptor must be identical to the root module
|
||||||
|
* descriptor, with two exceptions:
|
||||||
|
* - A versioned descriptor can have different non-public `requires`
|
||||||
|
* clauses of platform ( `java.*` and `jdk.*` ) modules, and
|
||||||
|
* - A versioned descriptor can have different `uses` clauses, even of
|
||||||
|
* service types defined outside of the platform modules.
|
||||||
|
*/
|
||||||
|
private void checkModuleDescriptor(JarEntry je) {
|
||||||
|
try (InputStream is = jf.getInputStream(je)) {
|
||||||
|
ModuleDescriptor root = this.md;
|
||||||
|
ModuleDescriptor md = null;
|
||||||
|
try {
|
||||||
|
md = ModuleDescriptor.read(is);
|
||||||
|
} catch (InvalidModuleDescriptorException x) {
|
||||||
|
error(x.getMessage());
|
||||||
|
isValid = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (root == null) {
|
||||||
|
this.md = md;
|
||||||
|
} else {
|
||||||
|
if (!root.name().equals(md.name())) {
|
||||||
|
error(getMsg("error.versioned.info.name.notequal"));
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
if (!root.requires().equals(md.requires())) {
|
||||||
|
Set<Requires> rootRequires = root.requires();
|
||||||
|
for (Requires r : md.requires()) {
|
||||||
|
if (rootRequires.contains(r))
|
||||||
|
continue;
|
||||||
|
if (r.modifiers().contains(Requires.Modifier.TRANSITIVE)) {
|
||||||
|
error(getMsg("error.versioned.info.requires.transitive"));
|
||||||
|
isValid = false;
|
||||||
|
} else if (!isPlatformModule(r.name())) {
|
||||||
|
error(getMsg("error.versioned.info.requires.added"));
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (Requires r : rootRequires) {
|
||||||
|
Set<Requires> mdRequires = md.requires();
|
||||||
|
if (mdRequires.contains(r))
|
||||||
|
continue;
|
||||||
|
if (!isPlatformModule(r.name())) {
|
||||||
|
error(getMsg("error.versioned.info.requires.dropped"));
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!root.exports().equals(md.exports())) {
|
||||||
|
error(getMsg("error.versioned.info.exports.notequal"));
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
if (!root.opens().equals(md.opens())) {
|
||||||
|
error(getMsg("error.versioned.info.opens.notequal"));
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
if (!root.provides().equals(md.provides())) {
|
||||||
|
error(getMsg("error.versioned.info.provides.notequal"));
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
if (!root.mainClass().equals(md.mainClass())) {
|
||||||
|
error(formatMsg("error.validator.info.manclass.notequal", je.getName()));
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
if (!root.version().equals(md.version())) {
|
||||||
|
error(formatMsg("error.validator.info.version.notequal", je.getName()));
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException x) {
|
||||||
|
error(x.getMessage());
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean checkInternalName(String entryName, String basename, String internalName) {
|
private boolean checkInternalName(String entryName, String basename, String internalName) {
|
||||||
String className = className(basename);
|
String className = className(basename);
|
||||||
if (internalName.equals(className)) {
|
if (internalName.equals(className)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
main.error(Main.formatMsg2("error.validator.names.mismatch",
|
error(formatMsg2("error.validator.names.mismatch",
|
||||||
entryName, internalName.replace("/", ".")));
|
entryName, internalName.replace("/", ".")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -231,7 +427,7 @@ final class Validator implements Consumer<JarEntry> {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
debug("top level class was not accepted");
|
debug("top level class was not accepted");
|
||||||
main.error(Main.formatMsg("error.validator.isolated.nested.class", entryName));
|
error(formatMsg("error.validator.isolated.nested.class", entryName));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,16 +436,24 @@ final class Validator implements Consumer<JarEntry> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isConcealed(String internalName) {
|
private boolean isConcealed(String internalName) {
|
||||||
if (main.concealedPackages.isEmpty()) {
|
if (concealedPkgs.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int idx = internalName.lastIndexOf('/');
|
int idx = internalName.lastIndexOf('/');
|
||||||
String pkgName = idx != -1 ? internalName.substring(0, idx).replace('/', '.') : "";
|
String pkgName = idx != -1 ? internalName.substring(0, idx).replace('/', '.') : "";
|
||||||
return main.concealedPackages.contains(pkgName);
|
return concealedPkgs.contains(pkgName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void debug(String fmt, Object... args) {
|
private void debug(String fmt, Object... args) {
|
||||||
if (DEBUG) System.err.format(fmt, args);
|
if (DEBUG) System.err.format(fmt, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void error(String msg) {
|
||||||
|
main.error(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void warn(String msg) {
|
||||||
|
main.warn(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -66,23 +66,6 @@ error.unexpected.module-info=\
|
|||||||
Unexpected module descriptor {0}
|
Unexpected module descriptor {0}
|
||||||
error.module.descriptor.not.found=\
|
error.module.descriptor.not.found=\
|
||||||
Module descriptor not found
|
Module descriptor not found
|
||||||
error.versioned.info.without.root=\
|
|
||||||
module-info.class found in a versioned directory without module-info.class \
|
|
||||||
in the root
|
|
||||||
error.versioned.info.name.notequal=\
|
|
||||||
module-info.class in a versioned directory contains incorrect name
|
|
||||||
error.versioned.info.requires.transitive=\
|
|
||||||
module-info.class in a versioned directory contains additional "requires transitive"
|
|
||||||
error.versioned.info.requires.added=\
|
|
||||||
module-info.class in a versioned directory contains additional "requires"
|
|
||||||
error.versioned.info.requires.dropped=\
|
|
||||||
module-info.class in a versioned directory contains missing "requires"
|
|
||||||
error.versioned.info.exports.notequal=\
|
|
||||||
module-info.class in a versioned directory contains different "exports"
|
|
||||||
error.versioned.info.opens.notequal=\
|
|
||||||
module-info.class in a versioned directory contains different "opens"
|
|
||||||
error.versioned.info.provides.notequal=\
|
|
||||||
module-info.class in a versioned directory contains different "provides"
|
|
||||||
error.invalid.versioned.module.attribute=\
|
error.invalid.versioned.module.attribute=\
|
||||||
Invalid module descriptor attribute {0}
|
Invalid module descriptor attribute {0}
|
||||||
error.missing.provider=\
|
error.missing.provider=\
|
||||||
@ -113,6 +96,24 @@ error.validator.different.api=\
|
|||||||
entry: {0}, contains a class with different api from earlier version
|
entry: {0}, contains a class with different api from earlier version
|
||||||
error.validator.names.mismatch=\
|
error.validator.names.mismatch=\
|
||||||
entry: {0}, contains a class with internal name {1}, names do not match
|
entry: {0}, contains a class with internal name {1}, names do not match
|
||||||
|
error.validator.info.name.notequal=\
|
||||||
|
module-info.class in a versioned directory contains incorrect name
|
||||||
|
error.validator.info.requires.transitive=\
|
||||||
|
module-info.class in a versioned directory contains additional "requires transitive"
|
||||||
|
error.validator.info.requires.added=\
|
||||||
|
module-info.class in a versioned directory contains additional "requires"
|
||||||
|
error.validator.info.requires.dropped=\
|
||||||
|
module-info.class in a versioned directory contains missing "requires"
|
||||||
|
error.validator.info.exports.notequal=\
|
||||||
|
module-info.class in a versioned directory contains different "exports"
|
||||||
|
error.validator.info.opens.notequal=\
|
||||||
|
module-info.class in a versioned directory contains different "opens"
|
||||||
|
error.validator.info.provides.notequal=\
|
||||||
|
module-info.class in a versioned directory contains different "provides"
|
||||||
|
error.validator.info.version.notequal=\
|
||||||
|
{0}: module-info.class in a versioned directory contains different "version"
|
||||||
|
error.validator.info.manclass.notequal=\
|
||||||
|
{0}: module-info.class in a versioned directory contains different "main-class"
|
||||||
warn.validator.identical.entry=\
|
warn.validator.identical.entry=\
|
||||||
Warning: entry {0} contains a class that\n\
|
Warning: entry {0} contains a class that\n\
|
||||||
is identical to an entry already in the jar
|
is identical to an entry already in the jar
|
||||||
@ -122,6 +123,8 @@ warn.validator.concealed.public.class=\
|
|||||||
Warning: entry {0} is a public class\n\
|
Warning: entry {0} is a public class\n\
|
||||||
in a concealed package, placing this jar on the class path will result\n\
|
in a concealed package, placing this jar on the class path will result\n\
|
||||||
in incompatible public interfaces
|
in incompatible public interfaces
|
||||||
|
warn.release.unexpected.versioned.entry=\
|
||||||
|
unexpected versioned entry {0}
|
||||||
out.added.manifest=\
|
out.added.manifest=\
|
||||||
added manifest
|
added manifest
|
||||||
out.added.module-info=\
|
out.added.module-info=\
|
||||||
|
@ -42,13 +42,13 @@ error.hash.dep=Abh\u00E4ngigkeiten bei Hashing-Modul {0}. Modul {1} kann nicht i
|
|||||||
error.module.options.without.info=--module-version oder --hash-modules ohne module-info.class
|
error.module.options.without.info=--module-version oder --hash-modules ohne module-info.class
|
||||||
error.unexpected.module-info=Unerwarteter Moduldeskriptor {0}
|
error.unexpected.module-info=Unerwarteter Moduldeskriptor {0}
|
||||||
error.module.descriptor.not.found=Moduldeskriptor nicht gefunden
|
error.module.descriptor.not.found=Moduldeskriptor nicht gefunden
|
||||||
error.versioned.info.without.root=module-info.class in einem versionierten Verzeichnis gefunden, in der Root ist module-info.class jedoch nicht vorhanden
|
error.validator.info.without.root=module-info.class in einem versionierten Verzeichnis gefunden, in der Root ist module-info.class jedoch nicht vorhanden
|
||||||
error.versioned.info.name.notequal=module-info.class in einem versionierten Verzeichnis enth\u00E4lt falschen Namen
|
error.validator.info.name.notequal=module-info.class in einem versionierten Verzeichnis enth\u00E4lt falschen Namen
|
||||||
error.versioned.info.requires.public=module-info.class in einem versionierten Verzeichnis enth\u00E4lt zus\u00E4tzlichen "requires public"
|
error.validator.info.requires.public=module-info.class in einem versionierten Verzeichnis enth\u00E4lt zus\u00E4tzlichen "requires public"
|
||||||
error.versioned.info.requires.added=module-info.class in einem versionierten Verzeichnis enth\u00E4lt zus\u00E4tzlichen "requires"
|
error.validator.info.requires.added=module-info.class in einem versionierten Verzeichnis enth\u00E4lt zus\u00E4tzlichen "requires"
|
||||||
error.versioned.info.requires.dropped=module-info.class in einem versionierten Verzeichnis enth\u00E4lt fehlenden "requires"
|
error.validator.info.requires.dropped=module-info.class in einem versionierten Verzeichnis enth\u00E4lt fehlenden "requires"
|
||||||
error.versioned.info.exports.notequal=module-info.class in einem versionierten Verzeichnis enth\u00E4lt unterschiedliche "exports"
|
error.validator.info.exports.notequal=module-info.class in einem versionierten Verzeichnis enth\u00E4lt unterschiedliche "exports"
|
||||||
error.versioned.info.provides.notequal=module-info.class in einem versionierten Verzeichnis enth\u00E4lt unterschiedliche "provides"
|
error.validator.info.provides.notequal=module-info.class in einem versionierten Verzeichnis enth\u00E4lt unterschiedliche "provides"
|
||||||
error.invalid.versioned.module.attribute=Ung\u00FCltiges Moduldeskriptorattribut {0}
|
error.invalid.versioned.module.attribute=Ung\u00FCltiges Moduldeskriptorattribut {0}
|
||||||
error.missing.provider=Serviceprovider nicht gefunden: {0}
|
error.missing.provider=Serviceprovider nicht gefunden: {0}
|
||||||
error.release.value.notnumber=Release {0} nicht g\u00FCltig
|
error.release.value.notnumber=Release {0} nicht g\u00FCltig
|
||||||
|
@ -42,13 +42,13 @@ error.hash.dep=Aplicando hash a las dependencias del m\u00F3dulo {0}, no se ha e
|
|||||||
error.module.options.without.info=Uno de --module-version o -hash-modules sin module-info.class
|
error.module.options.without.info=Uno de --module-version o -hash-modules sin module-info.class
|
||||||
error.unexpected.module-info=Descriptor de m\u00F3dulo inesperado {0}
|
error.unexpected.module-info=Descriptor de m\u00F3dulo inesperado {0}
|
||||||
error.module.descriptor.not.found=No se ha encontrado el descriptor de m\u00F3dulo
|
error.module.descriptor.not.found=No se ha encontrado el descriptor de m\u00F3dulo
|
||||||
error.versioned.info.without.root=Se ha encontrado module-info.class en un directorio con versi\u00F3n sin module-info.class en la ra\u00EDz
|
error.validator.info.without.root=Se ha encontrado module-info.class en un directorio con versi\u00F3n sin module-info.class en la ra\u00EDz
|
||||||
error.versioned.info.name.notequal=module-info.class en un directorio con versi\u00F3n contiene un nombre incorrecto
|
error.validator.info.name.notequal=module-info.class en un directorio con versi\u00F3n contiene un nombre incorrecto
|
||||||
error.versioned.info.requires.public=module-info.class en un directorio con versiones contiene "requires public" adicionales
|
error.validator.info.requires.public=module-info.class en un directorio con versiones contiene "requires public" adicionales
|
||||||
error.versioned.info.requires.added=module-info.class en un directorio con versi\u00F3n contiene "requires" adicionales
|
error.validator.info.requires.added=module-info.class en un directorio con versi\u00F3n contiene "requires" adicionales
|
||||||
error.versioned.info.requires.dropped=module-info.class en un directorio con versiones contiene "requires" que faltan
|
error.validator.info.requires.dropped=module-info.class en un directorio con versiones contiene "requires" que faltan
|
||||||
error.versioned.info.exports.notequal=module-info.class en un directorio con versiones contiene "exports" diferentes
|
error.validator.info.exports.notequal=module-info.class en un directorio con versiones contiene "exports" diferentes
|
||||||
error.versioned.info.provides.notequal=module-info.class en un directorio con versiones contiene "provides" diferentes
|
error.validator.info.provides.notequal=module-info.class en un directorio con versiones contiene "provides" diferentes
|
||||||
error.invalid.versioned.module.attribute=Atributo de descriptor de m\u00F3dulo no v\u00E1lido {0}
|
error.invalid.versioned.module.attribute=Atributo de descriptor de m\u00F3dulo no v\u00E1lido {0}
|
||||||
error.missing.provider=No se ha encontrado el proveedor de servicios: {0}
|
error.missing.provider=No se ha encontrado el proveedor de servicios: {0}
|
||||||
error.release.value.notnumber=versi\u00F3n {0} no v\u00E1lida
|
error.release.value.notnumber=versi\u00F3n {0} no v\u00E1lida
|
||||||
|
@ -42,13 +42,13 @@ error.hash.dep=Hachage des d\u00E9pendances du module {0}, module {1} introuvabl
|
|||||||
error.module.options.without.info=Une des options --module-version ou --hash-modules sans module-info.class
|
error.module.options.without.info=Une des options --module-version ou --hash-modules sans module-info.class
|
||||||
error.unexpected.module-info=Descripteur de module {0} inattendu
|
error.unexpected.module-info=Descripteur de module {0} inattendu
|
||||||
error.module.descriptor.not.found=Descripteur de module introuvable
|
error.module.descriptor.not.found=Descripteur de module introuvable
|
||||||
error.versioned.info.without.root=module-info.class a \u00E9t\u00E9 d\u00E9tect\u00E9 dans un r\u00E9pertoire avec num\u00E9ro de version sans module-info.class dans la racine
|
error.validator.info.without.root=module-info.class a \u00E9t\u00E9 d\u00E9tect\u00E9 dans un r\u00E9pertoire avec num\u00E9ro de version sans module-info.class dans la racine
|
||||||
error.versioned.info.name.notequal=module-info.class dans un r\u00E9pertoire avec num\u00E9ro de version contient un nom incorrect
|
error.validator.info.name.notequal=module-info.class dans un r\u00E9pertoire avec num\u00E9ro de version contient un nom incorrect
|
||||||
error.versioned.info.requires.public=module-info.class dans un r\u00E9pertoire avec num\u00E9ro de version contient des mots-cl\u00E9s "requires public" suppl\u00E9mentaires
|
error.validator.info.requires.public=module-info.class dans un r\u00E9pertoire avec num\u00E9ro de version contient des mots-cl\u00E9s "requires public" suppl\u00E9mentaires
|
||||||
error.versioned.info.requires.added=module-info.class dans un r\u00E9pertoire avec num\u00E9ro de version contient des mots-cl\u00E9s "requires" suppl\u00E9mentaires
|
error.validator.info.requires.added=module-info.class dans un r\u00E9pertoire avec num\u00E9ro de version contient des mots-cl\u00E9s "requires" suppl\u00E9mentaires
|
||||||
error.versioned.info.requires.dropped=module-info.class dans un r\u00E9pertoire avec num\u00E9ro de version contient des mots-cl\u00E9s "requires" manquants
|
error.validator.info.requires.dropped=module-info.class dans un r\u00E9pertoire avec num\u00E9ro de version contient des mots-cl\u00E9s "requires" manquants
|
||||||
error.versioned.info.exports.notequal=module-info.class dans un r\u00E9pertoire avec num\u00E9ro de version contient des mots-cl\u00E9s "exports" diff\u00E9rents
|
error.validator.info.exports.notequal=module-info.class dans un r\u00E9pertoire avec num\u00E9ro de version contient des mots-cl\u00E9s "exports" diff\u00E9rents
|
||||||
error.versioned.info.provides.notequal=module-info.class dans un r\u00E9pertoire avec num\u00E9ro de version contient des mots-cl\u00E9s "provides" diff\u00E9rents
|
error.validator.info.provides.notequal=module-info.class dans un r\u00E9pertoire avec num\u00E9ro de version contient des mots-cl\u00E9s "provides" diff\u00E9rents
|
||||||
error.invalid.versioned.module.attribute=Attribut de descripteur de module non valide {0}
|
error.invalid.versioned.module.attribute=Attribut de descripteur de module non valide {0}
|
||||||
error.missing.provider=Fournisseur de services introuvable : {0}
|
error.missing.provider=Fournisseur de services introuvable : {0}
|
||||||
error.release.value.notnumber=version {0} non valide
|
error.release.value.notnumber=version {0} non valide
|
||||||
|
@ -42,13 +42,13 @@ error.hash.dep={0} dipendenze del modulo di hashing. Impossibile trovare il modu
|
|||||||
error.module.options.without.info=Una delle opzioni --module-version o --hash-modules non contiene module-info.class
|
error.module.options.without.info=Una delle opzioni --module-version o --hash-modules non contiene module-info.class
|
||||||
error.unexpected.module-info=Descrittore di modulo {0} imprevisto
|
error.unexpected.module-info=Descrittore di modulo {0} imprevisto
|
||||||
error.module.descriptor.not.found=Descrittore di modulo non trovato
|
error.module.descriptor.not.found=Descrittore di modulo non trovato
|
||||||
error.versioned.info.without.root=module-info.class trovato in una directory con controllo delle versioni senza module-info.class nella radice
|
error.validator.info.without.root=module-info.class trovato in una directory con controllo delle versioni senza module-info.class nella radice
|
||||||
error.versioned.info.name.notequal=module-info.class in una directory con controllo delle versioni contiene un nome errato
|
error.validator.info.name.notequal=module-info.class in una directory con controllo delle versioni contiene un nome errato
|
||||||
error.versioned.info.requires.public=module-info.class in una directory con controllo delle versioni contiene valori "requires public" aggiuntivi
|
error.validator.info.requires.public=module-info.class in una directory con controllo delle versioni contiene valori "requires public" aggiuntivi
|
||||||
error.versioned.info.requires.added=module-info.class in una directory con controllo delle versioni contiene valori "requires" aggiuntivi
|
error.validator.info.requires.added=module-info.class in una directory con controllo delle versioni contiene valori "requires" aggiuntivi
|
||||||
error.versioned.info.requires.dropped=module-info.class in una directory con controllo delle versioni contiene valori "requires" mancanti
|
error.validator.info.requires.dropped=module-info.class in una directory con controllo delle versioni contiene valori "requires" mancanti
|
||||||
error.versioned.info.exports.notequal=module-info.class in una directory con controllo delle versioni contiene "exports" differenti
|
error.validator.info.exports.notequal=module-info.class in una directory con controllo delle versioni contiene "exports" differenti
|
||||||
error.versioned.info.provides.notequal=module-info.class in una directory con controllo delle versioni contiene valori "provides" differenti
|
error.validator.info.provides.notequal=module-info.class in una directory con controllo delle versioni contiene valori "provides" differenti
|
||||||
error.invalid.versioned.module.attribute=Attributo descrittore del modulo {0} non valido.
|
error.invalid.versioned.module.attribute=Attributo descrittore del modulo {0} non valido.
|
||||||
error.missing.provider=Provider di servizi non trovato: {0}
|
error.missing.provider=Provider di servizi non trovato: {0}
|
||||||
error.release.value.notnumber=release {0} non valida
|
error.release.value.notnumber=release {0} non valida
|
||||||
|
@ -42,13 +42,13 @@ error.hash.dep=\u30E2\u30B8\u30E5\u30FC\u30EB{0}\u4F9D\u5B58\u6027\u306E\u30CF\u
|
|||||||
error.module.options.without.info=--module-version\u307E\u305F\u306F--hash-modules\u306E\u3044\u305A\u308C\u304B\u3067module-info.class\u304C\u3042\u308A\u307E\u305B\u3093
|
error.module.options.without.info=--module-version\u307E\u305F\u306F--hash-modules\u306E\u3044\u305A\u308C\u304B\u3067module-info.class\u304C\u3042\u308A\u307E\u305B\u3093
|
||||||
error.unexpected.module-info=\u4E88\u671F\u3057\u306A\u3044\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30C7\u30A3\u30B9\u30AF\u30EA\u30D7\u30BF{0}
|
error.unexpected.module-info=\u4E88\u671F\u3057\u306A\u3044\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30C7\u30A3\u30B9\u30AF\u30EA\u30D7\u30BF{0}
|
||||||
error.module.descriptor.not.found=\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30C7\u30A3\u30B9\u30AF\u30EA\u30D7\u30BF\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
|
error.module.descriptor.not.found=\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30C7\u30A3\u30B9\u30AF\u30EA\u30D7\u30BF\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
|
||||||
error.versioned.info.without.root=module-info.class\u304C\u3001\u30EB\u30FC\u30C8\u306Bmodule-info.class\u306E\u306A\u3044\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u3055\u308C\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u898B\u3064\u304B\u308A\u307E\u3057\u305F
|
error.validator.info.without.root=module-info.class\u304C\u3001\u30EB\u30FC\u30C8\u306Bmodule-info.class\u306E\u306A\u3044\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u3055\u308C\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u898B\u3064\u304B\u308A\u307E\u3057\u305F
|
||||||
error.versioned.info.name.notequal=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u3055\u308C\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306Emodule-info.class\u306B\u6B63\u3057\u304F\u306A\u3044\u540D\u524D\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
|
error.validator.info.name.notequal=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u3055\u308C\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306Emodule-info.class\u306B\u6B63\u3057\u304F\u306A\u3044\u540D\u524D\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
|
||||||
error.versioned.info.requires.public=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u3055\u308C\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306Emodule-info.class\u306B\u8FFD\u52A0\u306E"requires public"\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
|
error.validator.info.requires.public=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u3055\u308C\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306Emodule-info.class\u306B\u8FFD\u52A0\u306E"requires public"\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
|
||||||
error.versioned.info.requires.added=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u3055\u308C\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306Emodule-info.class\u306B\u8FFD\u52A0\u306E"requires"\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
|
error.validator.info.requires.added=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u3055\u308C\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306Emodule-info.class\u306B\u8FFD\u52A0\u306E"requires"\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
|
||||||
error.versioned.info.requires.dropped=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u3055\u308C\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306Emodule-info.class\u306B\u6B20\u843D\u3057\u3066\u3044\u308B"requires"\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
|
error.validator.info.requires.dropped=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u3055\u308C\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306Emodule-info.class\u306B\u6B20\u843D\u3057\u3066\u3044\u308B"requires"\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
|
||||||
error.versioned.info.exports.notequal=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u3055\u308C\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306Emodule-info.class\u306B\u7570\u306A\u308B"exports"\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
|
error.validator.info.exports.notequal=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u3055\u308C\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306Emodule-info.class\u306B\u7570\u306A\u308B"exports"\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
|
||||||
error.versioned.info.provides.notequal=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u3055\u308C\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306Emodule-info.class\u306B\u7570\u306A\u308B"provides"\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
|
error.validator.info.provides.notequal=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u3055\u308C\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306Emodule-info.class\u306B\u7570\u306A\u308B"provides"\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
|
||||||
error.invalid.versioned.module.attribute=\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30C7\u30A3\u30B9\u30AF\u30EA\u30D7\u30BF\u5C5E\u6027{0}\u304C\u7121\u52B9\u3067\u3059
|
error.invalid.versioned.module.attribute=\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30C7\u30A3\u30B9\u30AF\u30EA\u30D7\u30BF\u5C5E\u6027{0}\u304C\u7121\u52B9\u3067\u3059
|
||||||
error.missing.provider=\u30B5\u30FC\u30D3\u30B9\u30FB\u30D7\u30ED\u30D0\u30A4\u30C0\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0}
|
error.missing.provider=\u30B5\u30FC\u30D3\u30B9\u30FB\u30D7\u30ED\u30D0\u30A4\u30C0\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0}
|
||||||
error.release.value.notnumber=\u30EA\u30EA\u30FC\u30B9{0}\u306F\u6709\u52B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093
|
error.release.value.notnumber=\u30EA\u30EA\u30FC\u30B9{0}\u306F\u6709\u52B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093
|
||||||
|
@ -42,13 +42,13 @@ error.hash.dep=\uBAA8\uB4C8 {0} \uC885\uC18D\uC131\uC744 \uD574\uC2DC\uD558\uB29
|
|||||||
error.module.options.without.info=module-info.class \uC5C6\uC774 --module-version \uB610\uB294 --hash-modules \uC911 \uD558\uB098
|
error.module.options.without.info=module-info.class \uC5C6\uC774 --module-version \uB610\uB294 --hash-modules \uC911 \uD558\uB098
|
||||||
error.unexpected.module-info=\uC608\uC0C1\uCE58 \uC54A\uC740 \uBAA8\uB4C8 \uAE30\uC220\uC790 {0}
|
error.unexpected.module-info=\uC608\uC0C1\uCE58 \uC54A\uC740 \uBAA8\uB4C8 \uAE30\uC220\uC790 {0}
|
||||||
error.module.descriptor.not.found=\uBAA8\uB4C8 \uAE30\uC220\uC790\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC74C
|
error.module.descriptor.not.found=\uBAA8\uB4C8 \uAE30\uC220\uC790\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC74C
|
||||||
error.versioned.info.without.root=\uB8E8\uD2B8\uC5D0\uC11C module-info.class \uC5C6\uC774 \uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC5D0\uC11C module-info.class\uAC00 \uBC1C\uACAC\uB428
|
error.validator.info.without.root=\uB8E8\uD2B8\uC5D0\uC11C module-info.class \uC5C6\uC774 \uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC5D0\uC11C module-info.class\uAC00 \uBC1C\uACAC\uB428
|
||||||
error.versioned.info.name.notequal=\uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC758 module-info.class\uC5D0 \uC798\uBABB\uB41C \uC774\uB984\uC774 \uD3EC\uD568\uB428
|
error.validator.info.name.notequal=\uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC758 module-info.class\uC5D0 \uC798\uBABB\uB41C \uC774\uB984\uC774 \uD3EC\uD568\uB428
|
||||||
error.versioned.info.requires.public=\uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC758 module-info.class\uC5D0 \uCD94\uAC00 "requires public" \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
|
error.validator.info.requires.public=\uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC758 module-info.class\uC5D0 \uCD94\uAC00 "requires public" \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
|
||||||
error.versioned.info.requires.added=\uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC758 module-info.class\uC5D0 \uCD94\uAC00 "requires" \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
|
error.validator.info.requires.added=\uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC758 module-info.class\uC5D0 \uCD94\uAC00 "requires" \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
|
||||||
error.versioned.info.requires.dropped=\uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC758 module-info.class\uC5D0 \uB204\uB77D\uB41C "requires" \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
|
error.validator.info.requires.dropped=\uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC758 module-info.class\uC5D0 \uB204\uB77D\uB41C "requires" \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
|
||||||
error.versioned.info.exports.notequal=\uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC758 module-info.class\uC5D0 \uB2E4\uB978 "exports" \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
|
error.validator.info.exports.notequal=\uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC758 module-info.class\uC5D0 \uB2E4\uB978 "exports" \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
|
||||||
error.versioned.info.provides.notequal=\uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC758 module-info.class\uC5D0 \uB2E4\uB978 "provides" \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
|
error.validator.info.provides.notequal=\uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC758 module-info.class\uC5D0 \uB2E4\uB978 "provides" \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
|
||||||
error.invalid.versioned.module.attribute=\uBD80\uC801\uD569\uD55C \uBAA8\uB4C8 \uAE30\uC220\uC790 \uC18D\uC131 {0}
|
error.invalid.versioned.module.attribute=\uBD80\uC801\uD569\uD55C \uBAA8\uB4C8 \uAE30\uC220\uC790 \uC18D\uC131 {0}
|
||||||
error.missing.provider=\uC11C\uBE44\uC2A4 \uC81C\uACF5\uC790\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC74C: {0}
|
error.missing.provider=\uC11C\uBE44\uC2A4 \uC81C\uACF5\uC790\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC74C: {0}
|
||||||
error.release.value.notnumber=\uB9B4\uB9AC\uC2A4 {0}\uC774(\uAC00) \uBD80\uC801\uD569\uD568
|
error.release.value.notnumber=\uB9B4\uB9AC\uC2A4 {0}\uC774(\uAC00) \uBD80\uC801\uD569\uD568
|
||||||
|
@ -42,13 +42,13 @@ error.hash.dep=M\u00F3dulo de hashing com {0} depend\u00EAncias. N\u00E3o \u00E9
|
|||||||
error.module.options.without.info=Um dentre --module-version ou --hash-modules est\u00E1 sem module-info.class
|
error.module.options.without.info=Um dentre --module-version ou --hash-modules est\u00E1 sem module-info.class
|
||||||
error.unexpected.module-info=Descritor de m\u00F3dulo inesperado {0}
|
error.unexpected.module-info=Descritor de m\u00F3dulo inesperado {0}
|
||||||
error.module.descriptor.not.found=Descritor de m\u00F3dulo n\u00E3o encontrado
|
error.module.descriptor.not.found=Descritor de m\u00F3dulo n\u00E3o encontrado
|
||||||
error.versioned.info.without.root=module-info.class encontrado em um diret\u00F3rio com controle de vers\u00E3o sem module-info.class na raiz
|
error.validator.info.without.root=module-info.class encontrado em um diret\u00F3rio com controle de vers\u00E3o sem module-info.class na raiz
|
||||||
error.versioned.info.name.notequal=module-info.class em um diret\u00F3rio com controle de vers\u00E3o cont\u00E9m nome incorreto
|
error.validator.info.name.notequal=module-info.class em um diret\u00F3rio com controle de vers\u00E3o cont\u00E9m nome incorreto
|
||||||
error.versioned.info.requires.public=module-info.class em um diret\u00F3rio com controle de vers\u00E3o cont\u00E9m "requires public" adicional
|
error.validator.info.requires.public=module-info.class em um diret\u00F3rio com controle de vers\u00E3o cont\u00E9m "requires public" adicional
|
||||||
error.versioned.info.requires.added=module-info.class em um diret\u00F3rio com controle de vers\u00E3o cont\u00E9m "requires" adicional
|
error.validator.info.requires.added=module-info.class em um diret\u00F3rio com controle de vers\u00E3o cont\u00E9m "requires" adicional
|
||||||
error.versioned.info.requires.dropped=module-info.class em um diret\u00F3rio com controle de vers\u00E3o falta "requires"
|
error.validator.info.requires.dropped=module-info.class em um diret\u00F3rio com controle de vers\u00E3o falta "requires"
|
||||||
error.versioned.info.exports.notequal=module-info.class em um diret\u00F3rio com controle de vers\u00E3o cont\u00E9m "exports" diferente
|
error.validator.info.exports.notequal=module-info.class em um diret\u00F3rio com controle de vers\u00E3o cont\u00E9m "exports" diferente
|
||||||
error.versioned.info.provides.notequal=module-info.class em um diret\u00F3rio com controle de vers\u00E3o cont\u00E9m "provides" diferente
|
error.validator.info.provides.notequal=module-info.class em um diret\u00F3rio com controle de vers\u00E3o cont\u00E9m "provides" diferente
|
||||||
error.invalid.versioned.module.attribute=Atributo {0} de descritor de m\u00F3dulo inv\u00E1lido
|
error.invalid.versioned.module.attribute=Atributo {0} de descritor de m\u00F3dulo inv\u00E1lido
|
||||||
error.missing.provider=Prestador de servi\u00E7os n\u00E3o encontrado: {0}
|
error.missing.provider=Prestador de servi\u00E7os n\u00E3o encontrado: {0}
|
||||||
error.release.value.notnumber=release {0} n\u00E3o v\u00E1lida
|
error.release.value.notnumber=release {0} n\u00E3o v\u00E1lida
|
||||||
|
@ -42,13 +42,13 @@ error.hash.dep={0}-beroenden f\u00F6r hashningsmodulen, kan inte hitta modulen {
|
|||||||
error.module.options.without.info=--module-version eller --hash-modules utan module-info.class
|
error.module.options.without.info=--module-version eller --hash-modules utan module-info.class
|
||||||
error.unexpected.module-info=Ov\u00E4ntad moduldeskriptor, {0}
|
error.unexpected.module-info=Ov\u00E4ntad moduldeskriptor, {0}
|
||||||
error.module.descriptor.not.found=Moduldeskriptorn hittades inte
|
error.module.descriptor.not.found=Moduldeskriptorn hittades inte
|
||||||
error.versioned.info.without.root=module-info.class hittades i en versionshanterad katalog utan module-info.class i roten
|
error.validator.info.without.root=module-info.class hittades i en versionshanterad katalog utan module-info.class i roten
|
||||||
error.versioned.info.name.notequal=module-info.class i en versionshanterad katalog inneh\u00E5ller ett felaktigt namn
|
error.validator.info.name.notequal=module-info.class i en versionshanterad katalog inneh\u00E5ller ett felaktigt namn
|
||||||
error.versioned.info.requires.public=module-info.class i en versionshanterad katalog inneh\u00E5ller fler "requires public"
|
error.validator.info.requires.public=module-info.class i en versionshanterad katalog inneh\u00E5ller fler "requires public"
|
||||||
error.versioned.info.requires.added=module-info.class i en versionshanterad katalog inneh\u00E5ller fler "requires"
|
error.validator.info.requires.added=module-info.class i en versionshanterad katalog inneh\u00E5ller fler "requires"
|
||||||
error.versioned.info.requires.dropped=module-info.class i en versionshanterad katalog inneh\u00E5ller saknade "requires"
|
error.validator.info.requires.dropped=module-info.class i en versionshanterad katalog inneh\u00E5ller saknade "requires"
|
||||||
error.versioned.info.exports.notequal=module-info.class i en versionshanterad katalog inneh\u00E5ller olika "exports"
|
error.validator.info.exports.notequal=module-info.class i en versionshanterad katalog inneh\u00E5ller olika "exports"
|
||||||
error.versioned.info.provides.notequal=module-info.class i en versionshanterad katalog inneh\u00E5ller olika "provides"
|
error.validator.info.provides.notequal=module-info.class i en versionshanterad katalog inneh\u00E5ller olika "provides"
|
||||||
error.invalid.versioned.module.attribute=Ogiltigt attribut f\u00F6r moduldeskriptor, {0}
|
error.invalid.versioned.module.attribute=Ogiltigt attribut f\u00F6r moduldeskriptor, {0}
|
||||||
error.missing.provider=Tj\u00E4nsteleverant\u00F6ren hittades inte: {0}
|
error.missing.provider=Tj\u00E4nsteleverant\u00F6ren hittades inte: {0}
|
||||||
error.release.value.notnumber=utg\u00E5va {0} \u00E4r inte giltig
|
error.release.value.notnumber=utg\u00E5va {0} \u00E4r inte giltig
|
||||||
|
@ -42,13 +42,13 @@ error.hash.dep=\u6B63\u5728\u5BF9\u6A21\u5757 {0} \u7684\u88AB\u4F9D\u8D56\u5BF9
|
|||||||
error.module.options.without.info=--module-version \u6216 --hash-modules \u4E4B\u4E00\u6CA1\u6709 module-info.class
|
error.module.options.without.info=--module-version \u6216 --hash-modules \u4E4B\u4E00\u6CA1\u6709 module-info.class
|
||||||
error.unexpected.module-info=\u610F\u5916\u7684\u6A21\u5757\u63CF\u8FF0\u7B26 {0}
|
error.unexpected.module-info=\u610F\u5916\u7684\u6A21\u5757\u63CF\u8FF0\u7B26 {0}
|
||||||
error.module.descriptor.not.found=\u627E\u4E0D\u5230\u6A21\u5757\u63CF\u8FF0\u7B26
|
error.module.descriptor.not.found=\u627E\u4E0D\u5230\u6A21\u5757\u63CF\u8FF0\u7B26
|
||||||
error.versioned.info.without.root=\u5728\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u627E\u5230\u4E86 module-info.class, \u4F46\u6839\u4E2D\u6CA1\u6709 module-info.class
|
error.validator.info.without.root=\u5728\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u627E\u5230\u4E86 module-info.class, \u4F46\u6839\u4E2D\u6CA1\u6709 module-info.class
|
||||||
error.versioned.info.name.notequal=\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u6B63\u786E\u7684\u540D\u79F0
|
error.validator.info.name.notequal=\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u6B63\u786E\u7684\u540D\u79F0
|
||||||
error.versioned.info.requires.public=\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u7684 module-info.class \u5305\u542B\u989D\u5916\u7684 "requires public"
|
error.validator.info.requires.public=\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u7684 module-info.class \u5305\u542B\u989D\u5916\u7684 "requires public"
|
||||||
error.versioned.info.requires.added=\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u7684 module-info.class \u5305\u542B\u989D\u5916\u7684 "requires"
|
error.validator.info.requires.added=\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u7684 module-info.class \u5305\u542B\u989D\u5916\u7684 "requires"
|
||||||
error.versioned.info.requires.dropped=\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u7684 module-info.class \u5305\u542B\u7F3A\u5C11\u7684 "requires"
|
error.validator.info.requires.dropped=\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u7684 module-info.class \u5305\u542B\u7F3A\u5C11\u7684 "requires"
|
||||||
error.versioned.info.exports.notequal=\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u540C\u7684 "exports"
|
error.validator.info.exports.notequal=\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u540C\u7684 "exports"
|
||||||
error.versioned.info.provides.notequal=\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u540C\u7684 "provides"
|
error.validator.info.provides.notequal=\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u540C\u7684 "provides"
|
||||||
error.invalid.versioned.module.attribute=\u65E0\u6548\u7684\u6A21\u5757\u63CF\u8FF0\u7B26\u5C5E\u6027 {0}
|
error.invalid.versioned.module.attribute=\u65E0\u6548\u7684\u6A21\u5757\u63CF\u8FF0\u7B26\u5C5E\u6027 {0}
|
||||||
error.missing.provider=\u672A\u627E\u5230\u670D\u52A1\u63D0\u4F9B\u65B9: {0}
|
error.missing.provider=\u672A\u627E\u5230\u670D\u52A1\u63D0\u4F9B\u65B9: {0}
|
||||||
error.release.value.notnumber=\u53D1\u884C\u7248 {0} \u65E0\u6548
|
error.release.value.notnumber=\u53D1\u884C\u7248 {0} \u65E0\u6548
|
||||||
|
@ -42,13 +42,13 @@ error.hash.dep=\u96DC\u6E4A\u6A21\u7D44 {0} \u76F8\u4F9D\u6027\uFF0C\u5728\u6A21
|
|||||||
error.module.options.without.info=--module-version \u6216 --hash-modules \u5176\u4E2D\u4E00\u500B\u6C92\u6709 module-info.class
|
error.module.options.without.info=--module-version \u6216 --hash-modules \u5176\u4E2D\u4E00\u500B\u6C92\u6709 module-info.class
|
||||||
error.unexpected.module-info=\u672A\u9810\u671F\u7684\u6A21\u7D44\u63CF\u8FF0\u5340 {0}
|
error.unexpected.module-info=\u672A\u9810\u671F\u7684\u6A21\u7D44\u63CF\u8FF0\u5340 {0}
|
||||||
error.module.descriptor.not.found=\u627E\u4E0D\u5230\u6A21\u7D44\u63CF\u8FF0\u5340
|
error.module.descriptor.not.found=\u627E\u4E0D\u5230\u6A21\u7D44\u63CF\u8FF0\u5340
|
||||||
error.versioned.info.without.root=\u5728\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u767C\u73FE module-info.class\uFF0C\u4F46\u662F\u6839\u4E2D\u6C92\u6709 module-info.class
|
error.validator.info.without.root=\u5728\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u767C\u73FE module-info.class\uFF0C\u4F46\u662F\u6839\u4E2D\u6C92\u6709 module-info.class
|
||||||
error.versioned.info.name.notequal=\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u6B63\u78BA\u7684\u540D\u7A31
|
error.validator.info.name.notequal=\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u6B63\u78BA\u7684\u540D\u7A31
|
||||||
error.versioned.info.requires.public=\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u7684 module-info.class \u5305\u542B\u984D\u5916\u7684 "requires public"
|
error.validator.info.requires.public=\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u7684 module-info.class \u5305\u542B\u984D\u5916\u7684 "requires public"
|
||||||
error.versioned.info.requires.added=\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u7684 module-info.class \u5305\u542B\u984D\u5916\u7684 "requires"
|
error.validator.info.requires.added=\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u7684 module-info.class \u5305\u542B\u984D\u5916\u7684 "requires"
|
||||||
error.versioned.info.requires.dropped=\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u7684 module-info.class \u5305\u542B\u907A\u6F0F\u7684 "requires"
|
error.validator.info.requires.dropped=\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u7684 module-info.class \u5305\u542B\u907A\u6F0F\u7684 "requires"
|
||||||
error.versioned.info.exports.notequal=\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u540C\u7684 "exports"
|
error.validator.info.exports.notequal=\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u540C\u7684 "exports"
|
||||||
error.versioned.info.provides.notequal=\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u540C\u7684 "provides"
|
error.validator.info.provides.notequal=\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u540C\u7684 "provides"
|
||||||
error.invalid.versioned.module.attribute=\u6A21\u7D44\u63CF\u8FF0\u5340\u5C6C\u6027 {0} \u7121\u6548
|
error.invalid.versioned.module.attribute=\u6A21\u7D44\u63CF\u8FF0\u5340\u5C6C\u6027 {0} \u7121\u6548
|
||||||
error.missing.provider=\u627E\u4E0D\u5230\u670D\u52D9\u63D0\u4F9B\u8005: {0}
|
error.missing.provider=\u627E\u4E0D\u5230\u670D\u52D9\u63D0\u4F9B\u8005: {0}
|
||||||
error.release.value.notnumber=\u7248\u672C {0} \u7121\u6548
|
error.release.value.notnumber=\u7248\u672C {0} \u7121\u6548
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -58,13 +58,10 @@ import java.nio.file.SimpleFileVisitor;
|
|||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.nio.file.attribute.BasicFileAttributes;
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayDeque;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Deque;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -101,6 +98,7 @@ import jdk.internal.joptsimple.OptionSpec;
|
|||||||
import jdk.internal.joptsimple.ValueConverter;
|
import jdk.internal.joptsimple.ValueConverter;
|
||||||
import jdk.internal.loader.ResourceHelper;
|
import jdk.internal.loader.ResourceHelper;
|
||||||
import jdk.internal.module.ModuleHashes;
|
import jdk.internal.module.ModuleHashes;
|
||||||
|
import jdk.internal.module.ModuleHashesBuilder;
|
||||||
import jdk.internal.module.ModuleInfo;
|
import jdk.internal.module.ModuleInfo;
|
||||||
import jdk.internal.module.ModuleInfoExtender;
|
import jdk.internal.module.ModuleInfoExtender;
|
||||||
import jdk.internal.module.ModulePath;
|
import jdk.internal.module.ModulePath;
|
||||||
@ -286,7 +284,27 @@ public class JmodTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean hashModules() {
|
private boolean hashModules() {
|
||||||
return new Hasher(options.moduleFinder).run();
|
if (options.dryrun) {
|
||||||
|
out.println("Dry run:");
|
||||||
|
}
|
||||||
|
|
||||||
|
Hasher hasher = new Hasher(options.moduleFinder);
|
||||||
|
hasher.computeHashes().forEach((mn, hashes) -> {
|
||||||
|
if (options.dryrun) {
|
||||||
|
out.format("%s%n", mn);
|
||||||
|
hashes.names().stream()
|
||||||
|
.sorted()
|
||||||
|
.forEach(name -> out.format(" hashes %s %s %s%n",
|
||||||
|
name, hashes.algorithm(), toHex(hashes.hashFor(name))));
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
hasher.updateModuleInfo(mn, hashes);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new UncheckedIOException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean describe() throws IOException {
|
private boolean describe() throws IOException {
|
||||||
@ -377,7 +395,7 @@ public class JmodTask {
|
|||||||
// create jmod with temporary name to avoid it being examined
|
// create jmod with temporary name to avoid it being examined
|
||||||
// when scanning the module path
|
// when scanning the module path
|
||||||
Path target = options.jmodFile;
|
Path target = options.jmodFile;
|
||||||
Path tempTarget = target.resolveSibling(target.getFileName() + ".tmp");
|
Path tempTarget = Files.createTempFile(target.getFileName().toString(), ".tmp");
|
||||||
try {
|
try {
|
||||||
try (JmodOutputStream jos = JmodOutputStream.newOutputStream(tempTarget)) {
|
try (JmodOutputStream jos = JmodOutputStream.newOutputStream(tempTarget)) {
|
||||||
jmod.write(jos);
|
jmod.write(jos);
|
||||||
@ -411,7 +429,6 @@ public class JmodTask {
|
|||||||
final String osArch = options.osArch;
|
final String osArch = options.osArch;
|
||||||
final String osVersion = options.osVersion;
|
final String osVersion = options.osVersion;
|
||||||
final List<PathMatcher> excludes = options.excludes;
|
final List<PathMatcher> excludes = options.excludes;
|
||||||
final Hasher hasher = hasher();
|
|
||||||
final ModuleResolution moduleResolution = options.moduleResolution;
|
final ModuleResolution moduleResolution = options.moduleResolution;
|
||||||
|
|
||||||
JmodFileWriter() { }
|
JmodFileWriter() { }
|
||||||
@ -514,8 +531,17 @@ public class JmodTask {
|
|||||||
if (moduleVersion != null)
|
if (moduleVersion != null)
|
||||||
extender.version(moduleVersion);
|
extender.version(moduleVersion);
|
||||||
|
|
||||||
if (hasher != null) {
|
// --hash-modules
|
||||||
ModuleHashes moduleHashes = hasher.computeHashes(descriptor.name());
|
if (options.modulesToHash != null) {
|
||||||
|
// To compute hashes, it creates a Configuration to resolve
|
||||||
|
// a module graph. The post-resolution check requires
|
||||||
|
// the packages in ModuleDescriptor be available for validation.
|
||||||
|
ModuleDescriptor md;
|
||||||
|
try (InputStream is = miSupplier.get()) {
|
||||||
|
md = ModuleDescriptor.read(is, () -> packages);
|
||||||
|
}
|
||||||
|
|
||||||
|
ModuleHashes moduleHashes = computeHashes(md);
|
||||||
if (moduleHashes != null) {
|
if (moduleHashes != null) {
|
||||||
extender.hashes(moduleHashes);
|
extender.hashes(moduleHashes);
|
||||||
} else {
|
} else {
|
||||||
@ -557,26 +583,13 @@ public class JmodTask {
|
|||||||
* The jmod file is being created and does not exist in the
|
* The jmod file is being created and does not exist in the
|
||||||
* given modulepath.
|
* given modulepath.
|
||||||
*/
|
*/
|
||||||
private Hasher hasher() {
|
private ModuleHashes computeHashes(ModuleDescriptor descriptor) {
|
||||||
if (options.modulesToHash == null)
|
String mn = descriptor.name();
|
||||||
return null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
Supplier<InputStream> miSupplier = newModuleInfoSupplier();
|
|
||||||
if (miSupplier == null) {
|
|
||||||
throw new IOException(MODULE_INFO + " not found");
|
|
||||||
}
|
|
||||||
|
|
||||||
ModuleDescriptor descriptor;
|
|
||||||
try (InputStream in = miSupplier.get()) {
|
|
||||||
descriptor = ModuleDescriptor.read(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
URI uri = options.jmodFile.toUri();
|
URI uri = options.jmodFile.toUri();
|
||||||
ModuleReference mref = new ModuleReference(descriptor, uri) {
|
ModuleReference mref = new ModuleReference(descriptor, uri) {
|
||||||
@Override
|
@Override
|
||||||
public ModuleReader open() {
|
public ModuleReader open() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException("opening " + mn);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -597,10 +610,7 @@ public class JmodTask {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return new Hasher(finder);
|
return new Hasher(mn, finder).computeHashes().get(mn);
|
||||||
} catch (IOException e) {
|
|
||||||
throw new UncheckedIOException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -789,193 +799,94 @@ public class JmodTask {
|
|||||||
* Compute and record hashes
|
* Compute and record hashes
|
||||||
*/
|
*/
|
||||||
private class Hasher {
|
private class Hasher {
|
||||||
final ModuleFinder moduleFinder;
|
|
||||||
final Map<String, Path> moduleNameToPath;
|
|
||||||
final Set<String> modules;
|
|
||||||
final Configuration configuration;
|
final Configuration configuration;
|
||||||
final boolean dryrun = options.dryrun;
|
final ModuleHashesBuilder hashesBuilder;
|
||||||
|
final Set<String> modules;
|
||||||
|
final String moduleName; // a specific module to record hashes, if set
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This constructor is for jmod hash command.
|
||||||
|
*
|
||||||
|
* This Hasher will determine which modules to record hashes, i.e.
|
||||||
|
* the module in a subgraph of modules to be hashed and that
|
||||||
|
* has no outgoing edges. It will record in each of these modules,
|
||||||
|
* say `M`, with the the hashes of modules that depend upon M
|
||||||
|
* directly or indirectly matching the specified --hash-modules pattern.
|
||||||
|
*/
|
||||||
Hasher(ModuleFinder finder) {
|
Hasher(ModuleFinder finder) {
|
||||||
this.moduleFinder = finder;
|
this(null, finder);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a Hasher to compute hashes.
|
||||||
|
*
|
||||||
|
* If a module name `M` is specified, it will compute the hashes of
|
||||||
|
* modules that depend upon M directly or indirectly matching the
|
||||||
|
* specified --hash-modules pattern and record in the ModuleHashes
|
||||||
|
* attribute in M's module-info.class.
|
||||||
|
*
|
||||||
|
* @param name name of the module to record hashes
|
||||||
|
* @param finder module finder for the specified --module-path
|
||||||
|
*/
|
||||||
|
Hasher(String name, ModuleFinder finder) {
|
||||||
// Determine the modules that matches the pattern {@code modulesToHash}
|
// Determine the modules that matches the pattern {@code modulesToHash}
|
||||||
this.modules = moduleFinder.findAll().stream()
|
Set<String> roots = finder.findAll().stream()
|
||||||
.map(mref -> mref.descriptor().name())
|
.map(mref -> mref.descriptor().name())
|
||||||
.filter(mn -> options.modulesToHash.matcher(mn).find())
|
.filter(mn -> options.modulesToHash.matcher(mn).find())
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
// a map from a module name to Path of the packaged module
|
// use system module path unless it creates a JMOD file for
|
||||||
this.moduleNameToPath = moduleFinder.findAll().stream()
|
// a module that is present in the system image e.g. upgradeable
|
||||||
.map(mref -> mref.descriptor().name())
|
// module
|
||||||
.collect(Collectors.toMap(Function.identity(), mn -> moduleToPath(mn)));
|
ModuleFinder system;
|
||||||
|
if (name != null && ModuleFinder.ofSystem().find(name).isPresent()) {
|
||||||
|
system = ModuleFinder.of();
|
||||||
|
} else {
|
||||||
|
system = ModuleFinder.ofSystem();
|
||||||
|
}
|
||||||
// get a resolved module graph
|
// get a resolved module graph
|
||||||
Configuration config = null;
|
Configuration config = null;
|
||||||
try {
|
try {
|
||||||
config = Configuration.empty()
|
config = Configuration.empty().resolveRequires(system, finder, roots);
|
||||||
.resolveRequires(ModuleFinder.ofSystem(), moduleFinder, modules);
|
|
||||||
} catch (ResolutionException e) {
|
} catch (ResolutionException e) {
|
||||||
warning("warn.module.resolution.fail", e.getMessage());
|
throw new CommandException("err.module.resolution.fail", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.moduleName = name;
|
||||||
this.configuration = config;
|
this.configuration = config;
|
||||||
|
|
||||||
|
// filter modules resolved from the system module finder
|
||||||
|
this.modules = config.modules().stream()
|
||||||
|
.map(ResolvedModule::name)
|
||||||
|
.filter(mn -> roots.contains(mn) && !system.find(mn).isPresent())
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
this.hashesBuilder = new ModuleHashesBuilder(config, modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is for jmod hash command.
|
* Returns a map of a module M to record hashes of the modules
|
||||||
|
* that depend upon M directly or indirectly.
|
||||||
*
|
*
|
||||||
* Identify the base modules in the module graph, i.e. no outgoing edge
|
* For jmod hash command, the returned map contains one entry
|
||||||
* to any of the modules to be hashed.
|
* for each module M that has no outgoing edges to any of the
|
||||||
|
* modules matching the specified --hash-modules pattern.
|
||||||
*
|
*
|
||||||
* For each base module M, compute the hashes of all modules that depend
|
* Each entry represents a leaf node in a connected subgraph containing
|
||||||
* upon M directly or indirectly. Then update M's module-info.class
|
* M and other candidate modules from the module graph where M's outgoing
|
||||||
* to record the hashes.
|
* edges to any module other than the ones matching the specified
|
||||||
|
* --hash-modules pattern are excluded.
|
||||||
*/
|
*/
|
||||||
boolean run() {
|
Map<String, ModuleHashes> computeHashes() {
|
||||||
if (configuration == null)
|
if (hashesBuilder == null)
|
||||||
return false;
|
return null;
|
||||||
|
|
||||||
// transposed graph containing the the packaged modules and
|
if (moduleName != null) {
|
||||||
// its transitive dependences matching --hash-modules
|
return hashesBuilder.computeHashes(Set.of(moduleName));
|
||||||
Map<String, Set<String>> graph = new HashMap<>();
|
|
||||||
for (String root : modules) {
|
|
||||||
Deque<String> deque = new ArrayDeque<>();
|
|
||||||
deque.add(root);
|
|
||||||
Set<String> visited = new HashSet<>();
|
|
||||||
while (!deque.isEmpty()) {
|
|
||||||
String mn = deque.pop();
|
|
||||||
if (!visited.contains(mn)) {
|
|
||||||
visited.add(mn);
|
|
||||||
|
|
||||||
if (modules.contains(mn))
|
|
||||||
graph.computeIfAbsent(mn, _k -> new HashSet<>());
|
|
||||||
|
|
||||||
ResolvedModule resolvedModule = configuration.findModule(mn).get();
|
|
||||||
for (ResolvedModule dm : resolvedModule.reads()) {
|
|
||||||
String name = dm.name();
|
|
||||||
if (!visited.contains(name)) {
|
|
||||||
deque.push(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
// reverse edge
|
|
||||||
if (modules.contains(name) && modules.contains(mn)) {
|
|
||||||
graph.computeIfAbsent(name, _k -> new HashSet<>()).add(mn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dryrun)
|
|
||||||
out.println("Dry run:");
|
|
||||||
|
|
||||||
// each node in a transposed graph is a matching packaged module
|
|
||||||
// in which the hash of the modules that depend upon it is recorded
|
|
||||||
graph.entrySet().stream()
|
|
||||||
.filter(e -> !e.getValue().isEmpty())
|
|
||||||
.forEach(e -> {
|
|
||||||
String mn = e.getKey();
|
|
||||||
Map<String, Path> modulesForHash = e.getValue().stream()
|
|
||||||
.collect(Collectors.toMap(Function.identity(),
|
|
||||||
moduleNameToPath::get));
|
|
||||||
ModuleHashes hashes = ModuleHashes.generate(modulesForHash, "SHA-256");
|
|
||||||
if (dryrun) {
|
|
||||||
out.format("%s%n", mn);
|
|
||||||
hashes.names().stream()
|
|
||||||
.sorted()
|
|
||||||
.forEach(name -> out.format(" hashes %s %s %s%n",
|
|
||||||
name, hashes.algorithm(), hashes.hashFor(name)));
|
|
||||||
} else {
|
} else {
|
||||||
try {
|
return hashesBuilder.computeHashes(modules);
|
||||||
updateModuleInfo(mn, hashes);
|
|
||||||
} catch (IOException ex) {
|
|
||||||
throw new UncheckedIOException(ex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compute hashes of the specified module.
|
|
||||||
*
|
|
||||||
* It records the hashing modules that depend upon the specified
|
|
||||||
* module directly or indirectly.
|
|
||||||
*/
|
|
||||||
ModuleHashes computeHashes(String name) {
|
|
||||||
if (configuration == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
// the transposed graph includes all modules in the resolved graph
|
|
||||||
Map<String, Set<String>> graph = transpose();
|
|
||||||
|
|
||||||
// find the modules that transitively depend upon the specified name
|
|
||||||
Deque<String> deque = new ArrayDeque<>();
|
|
||||||
deque.add(name);
|
|
||||||
Set<String> mods = visitNodes(graph, deque);
|
|
||||||
|
|
||||||
// filter modules matching the pattern specified --hash-modules
|
|
||||||
// as well as itself as the jmod file is being generated
|
|
||||||
Map<String, Path> modulesForHash = mods.stream()
|
|
||||||
.filter(mn -> !mn.equals(name) && modules.contains(mn))
|
|
||||||
.collect(Collectors.toMap(Function.identity(), moduleNameToPath::get));
|
|
||||||
|
|
||||||
if (modulesForHash.isEmpty())
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return ModuleHashes.generate(modulesForHash, "SHA-256");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns all nodes traversed from the given roots.
|
|
||||||
*/
|
|
||||||
private Set<String> visitNodes(Map<String, Set<String>> graph,
|
|
||||||
Deque<String> roots) {
|
|
||||||
Set<String> visited = new HashSet<>();
|
|
||||||
while (!roots.isEmpty()) {
|
|
||||||
String mn = roots.pop();
|
|
||||||
if (!visited.contains(mn)) {
|
|
||||||
visited.add(mn);
|
|
||||||
// the given roots may not be part of the graph
|
|
||||||
if (graph.containsKey(mn)) {
|
|
||||||
for (String dm : graph.get(mn)) {
|
|
||||||
if (!visited.contains(dm)) {
|
|
||||||
roots.push(dm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return visited;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a transposed graph from the resolved module graph.
|
|
||||||
*/
|
|
||||||
private Map<String, Set<String>> transpose() {
|
|
||||||
Map<String, Set<String>> transposedGraph = new HashMap<>();
|
|
||||||
Deque<String> deque = new ArrayDeque<>(modules);
|
|
||||||
|
|
||||||
Set<String> visited = new HashSet<>();
|
|
||||||
while (!deque.isEmpty()) {
|
|
||||||
String mn = deque.pop();
|
|
||||||
if (!visited.contains(mn)) {
|
|
||||||
visited.add(mn);
|
|
||||||
|
|
||||||
transposedGraph.computeIfAbsent(mn, _k -> new HashSet<>());
|
|
||||||
|
|
||||||
ResolvedModule resolvedModule = configuration.findModule(mn).get();
|
|
||||||
for (ResolvedModule dm : resolvedModule.reads()) {
|
|
||||||
String name = dm.name();
|
|
||||||
if (!visited.contains(name)) {
|
|
||||||
deque.push(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
// reverse edge
|
|
||||||
transposedGraph.computeIfAbsent(name, _k -> new HashSet<>())
|
|
||||||
.add(mn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return transposedGraph;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the given input stream of module-info.class and write
|
* Reads the given input stream of module-info.class and write
|
||||||
@ -993,11 +904,11 @@ public class JmodTask {
|
|||||||
extender.write(out);
|
extender.write(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateModuleInfo(String name, ModuleHashes moduleHashes)
|
void updateModuleInfo(String name, ModuleHashes moduleHashes)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Path target = moduleNameToPath.get(name);
|
Path target = moduleToPath(name);
|
||||||
Path tempTarget = target.resolveSibling(target.getFileName() + ".tmp");
|
Path tempTarget = Files.createTempFile(target.getFileName().toString(), ".tmp");
|
||||||
try {
|
try {
|
||||||
if (target.getFileName().toString().endsWith(".jmod")) {
|
if (target.getFileName().toString().endsWith(".jmod")) {
|
||||||
updateJmodFile(target, tempTarget, moduleHashes);
|
updateJmodFile(target, tempTarget, moduleHashes);
|
||||||
@ -1075,10 +986,10 @@ public class JmodTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Path moduleToPath(String name) {
|
private Path moduleToPath(String name) {
|
||||||
ModuleReference mref = moduleFinder.find(name).orElseThrow(
|
ResolvedModule rm = configuration.findModule(name).orElseThrow(
|
||||||
() -> new InternalError("Selected module " + name + " not on module path"));
|
() -> new InternalError("Selected module " + name + " not on module path"));
|
||||||
|
|
||||||
URI uri = mref.location().get();
|
URI uri = rm.reference().location().get();
|
||||||
Path path = Paths.get(uri);
|
Path path = Paths.get(uri);
|
||||||
String fn = path.getFileName().toString();
|
String fn = path.getFileName().toString();
|
||||||
if (!fn.endsWith(".jar") && !fn.endsWith(".jmod")) {
|
if (!fn.endsWith(".jar") && !fn.endsWith(".jmod")) {
|
||||||
@ -1088,11 +999,39 @@ public class JmodTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ClassPathConverter implements ValueConverter<Path> {
|
/**
|
||||||
static final ValueConverter<Path> INSTANCE = new ClassPathConverter();
|
* An abstract converter that given a string representing a list of paths,
|
||||||
|
* separated by the File.pathSeparator, returns a List of java.nio.Path's.
|
||||||
|
* Specific subclasses should do whatever validation is required on the
|
||||||
|
* individual path elements, if any.
|
||||||
|
*/
|
||||||
|
static abstract class AbstractPathConverter implements ValueConverter<List<Path>> {
|
||||||
|
@Override
|
||||||
|
public List<Path> convert(String value) {
|
||||||
|
List<Path> paths = new ArrayList<>();
|
||||||
|
String[] pathElements = value.split(File.pathSeparator);
|
||||||
|
for (String pathElement : pathElements) {
|
||||||
|
paths.add(toPath(pathElement));
|
||||||
|
}
|
||||||
|
return paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public Class<List<Path>> valueType() {
|
||||||
|
return (Class<List<Path>>)(Object)List.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public String valuePattern() { return "path"; }
|
||||||
|
|
||||||
|
abstract Path toPath(String path);
|
||||||
|
}
|
||||||
|
|
||||||
|
static class ClassPathConverter extends AbstractPathConverter {
|
||||||
|
static final ValueConverter<List<Path>> INSTANCE = new ClassPathConverter();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Path convert(String value) {
|
public Path toPath(String value) {
|
||||||
try {
|
try {
|
||||||
Path path = CWD.resolve(value);
|
Path path = CWD.resolve(value);
|
||||||
if (Files.notExists(path))
|
if (Files.notExists(path))
|
||||||
@ -1105,17 +1044,13 @@ public class JmodTask {
|
|||||||
throw new CommandException("err.path.not.valid", value);
|
throw new CommandException("err.path.not.valid", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public Class<Path> valueType() { return Path.class; }
|
|
||||||
|
|
||||||
@Override public String valuePattern() { return "path"; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DirPathConverter implements ValueConverter<Path> {
|
static class DirPathConverter extends AbstractPathConverter {
|
||||||
static final ValueConverter<Path> INSTANCE = new DirPathConverter();
|
static final ValueConverter<List<Path>> INSTANCE = new DirPathConverter();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Path convert(String value) {
|
public Path toPath(String value) {
|
||||||
try {
|
try {
|
||||||
Path path = CWD.resolve(value);
|
Path path = CWD.resolve(value);
|
||||||
if (Files.notExists(path))
|
if (Files.notExists(path))
|
||||||
@ -1127,10 +1062,6 @@ public class JmodTask {
|
|||||||
throw new CommandException("err.path.not.valid", value);
|
throw new CommandException("err.path.not.valid", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public Class<Path> valueType() { return Path.class; }
|
|
||||||
|
|
||||||
@Override public String valuePattern() { return "path"; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ExtractDirPathConverter implements ValueConverter<Path> {
|
static class ExtractDirPathConverter implements ValueConverter<Path> {
|
||||||
@ -1142,12 +1073,6 @@ public class JmodTask {
|
|||||||
if (Files.exists(path)) {
|
if (Files.exists(path)) {
|
||||||
if (!Files.isDirectory(path))
|
if (!Files.isDirectory(path))
|
||||||
throw new CommandException("err.cannot.create.dir", path);
|
throw new CommandException("err.cannot.create.dir", path);
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
Files.createDirectories(path);
|
|
||||||
} catch (IOException ioe) {
|
|
||||||
throw new CommandException("err.cannot.create.dir", path);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
} catch (InvalidPathException x) {
|
} catch (InvalidPathException x) {
|
||||||
@ -1316,22 +1241,19 @@ public class JmodTask {
|
|||||||
options = new Options();
|
options = new Options();
|
||||||
parser.formatHelpWith(new JmodHelpFormatter(options));
|
parser.formatHelpWith(new JmodHelpFormatter(options));
|
||||||
|
|
||||||
OptionSpec<Path> classPath
|
OptionSpec<List<Path>> classPath
|
||||||
= parser.accepts("class-path", getMessage("main.opt.class-path"))
|
= parser.accepts("class-path", getMessage("main.opt.class-path"))
|
||||||
.withRequiredArg()
|
.withRequiredArg()
|
||||||
.withValuesSeparatedBy(File.pathSeparatorChar)
|
|
||||||
.withValuesConvertedBy(ClassPathConverter.INSTANCE);
|
.withValuesConvertedBy(ClassPathConverter.INSTANCE);
|
||||||
|
|
||||||
OptionSpec<Path> cmds
|
OptionSpec<List<Path>> cmds
|
||||||
= parser.accepts("cmds", getMessage("main.opt.cmds"))
|
= parser.accepts("cmds", getMessage("main.opt.cmds"))
|
||||||
.withRequiredArg()
|
.withRequiredArg()
|
||||||
.withValuesSeparatedBy(File.pathSeparatorChar)
|
|
||||||
.withValuesConvertedBy(DirPathConverter.INSTANCE);
|
.withValuesConvertedBy(DirPathConverter.INSTANCE);
|
||||||
|
|
||||||
OptionSpec<Path> config
|
OptionSpec<List<Path>> config
|
||||||
= parser.accepts("config", getMessage("main.opt.config"))
|
= parser.accepts("config", getMessage("main.opt.config"))
|
||||||
.withRequiredArg()
|
.withRequiredArg()
|
||||||
.withValuesSeparatedBy(File.pathSeparatorChar)
|
|
||||||
.withValuesConvertedBy(DirPathConverter.INSTANCE);
|
.withValuesConvertedBy(DirPathConverter.INSTANCE);
|
||||||
|
|
||||||
OptionSpec<Path> dir
|
OptionSpec<Path> dir
|
||||||
@ -1359,22 +1281,19 @@ public class JmodTask {
|
|||||||
OptionSpec<Void> helpExtra
|
OptionSpec<Void> helpExtra
|
||||||
= parser.accepts("help-extra", getMessage("main.opt.help-extra"));
|
= parser.accepts("help-extra", getMessage("main.opt.help-extra"));
|
||||||
|
|
||||||
OptionSpec<Path> headerFiles
|
OptionSpec<List<Path>> headerFiles
|
||||||
= parser.accepts("header-files", getMessage("main.opt.header-files"))
|
= parser.accepts("header-files", getMessage("main.opt.header-files"))
|
||||||
.withRequiredArg()
|
.withRequiredArg()
|
||||||
.withValuesSeparatedBy(File.pathSeparatorChar)
|
|
||||||
.withValuesConvertedBy(DirPathConverter.INSTANCE);
|
.withValuesConvertedBy(DirPathConverter.INSTANCE);
|
||||||
|
|
||||||
OptionSpec<Path> libs
|
OptionSpec<List<Path>> libs
|
||||||
= parser.accepts("libs", getMessage("main.opt.libs"))
|
= parser.accepts("libs", getMessage("main.opt.libs"))
|
||||||
.withRequiredArg()
|
.withRequiredArg()
|
||||||
.withValuesSeparatedBy(File.pathSeparatorChar)
|
|
||||||
.withValuesConvertedBy(DirPathConverter.INSTANCE);
|
.withValuesConvertedBy(DirPathConverter.INSTANCE);
|
||||||
|
|
||||||
OptionSpec<Path> legalNotices
|
OptionSpec<List<Path>> legalNotices
|
||||||
= parser.accepts("legal-notices", getMessage("main.opt.legal-notices"))
|
= parser.accepts("legal-notices", getMessage("main.opt.legal-notices"))
|
||||||
.withRequiredArg()
|
.withRequiredArg()
|
||||||
.withValuesSeparatedBy(File.pathSeparatorChar)
|
|
||||||
.withValuesConvertedBy(DirPathConverter.INSTANCE);
|
.withValuesConvertedBy(DirPathConverter.INSTANCE);
|
||||||
|
|
||||||
|
|
||||||
@ -1383,17 +1302,15 @@ public class JmodTask {
|
|||||||
.withRequiredArg()
|
.withRequiredArg()
|
||||||
.describedAs(getMessage("main.opt.main-class.arg"));
|
.describedAs(getMessage("main.opt.main-class.arg"));
|
||||||
|
|
||||||
OptionSpec<Path> manPages
|
OptionSpec<List<Path>> manPages
|
||||||
= parser.accepts("man-pages", getMessage("main.opt.man-pages"))
|
= parser.accepts("man-pages", getMessage("main.opt.man-pages"))
|
||||||
.withRequiredArg()
|
.withRequiredArg()
|
||||||
.withValuesSeparatedBy(File.pathSeparatorChar)
|
|
||||||
.withValuesConvertedBy(DirPathConverter.INSTANCE);
|
.withValuesConvertedBy(DirPathConverter.INSTANCE);
|
||||||
|
|
||||||
OptionSpec<Path> modulePath
|
OptionSpec<List<Path>> modulePath
|
||||||
= parser.acceptsAll(Set.of("p", "module-path"),
|
= parser.acceptsAll(Set.of("p", "module-path"),
|
||||||
getMessage("main.opt.module-path"))
|
getMessage("main.opt.module-path"))
|
||||||
.withRequiredArg()
|
.withRequiredArg()
|
||||||
.withValuesSeparatedBy(File.pathSeparatorChar)
|
|
||||||
.withValuesConvertedBy(DirPathConverter.INSTANCE);
|
.withValuesConvertedBy(DirPathConverter.INSTANCE);
|
||||||
|
|
||||||
OptionSpec<Version> moduleVersion
|
OptionSpec<Version> moduleVersion
|
||||||
@ -1452,48 +1369,48 @@ public class JmodTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (opts.has(classPath))
|
if (opts.has(classPath))
|
||||||
options.classpath = opts.valuesOf(classPath);
|
options.classpath = getLastElement(opts.valuesOf(classPath));
|
||||||
if (opts.has(cmds))
|
if (opts.has(cmds))
|
||||||
options.cmds = opts.valuesOf(cmds);
|
options.cmds = getLastElement(opts.valuesOf(cmds));
|
||||||
if (opts.has(config))
|
if (opts.has(config))
|
||||||
options.configs = opts.valuesOf(config);
|
options.configs = getLastElement(opts.valuesOf(config));
|
||||||
if (opts.has(dir))
|
if (opts.has(dir))
|
||||||
options.extractDir = opts.valueOf(dir);
|
options.extractDir = getLastElement(opts.valuesOf(dir));
|
||||||
if (opts.has(dryrun))
|
if (opts.has(dryrun))
|
||||||
options.dryrun = true;
|
options.dryrun = true;
|
||||||
if (opts.has(excludes))
|
if (opts.has(excludes))
|
||||||
options.excludes = opts.valuesOf(excludes);
|
options.excludes = opts.valuesOf(excludes); // excludes is repeatable
|
||||||
if (opts.has(libs))
|
if (opts.has(libs))
|
||||||
options.libs = opts.valuesOf(libs);
|
options.libs = getLastElement(opts.valuesOf(libs));
|
||||||
if (opts.has(headerFiles))
|
if (opts.has(headerFiles))
|
||||||
options.headerFiles = opts.valuesOf(headerFiles);
|
options.headerFiles = getLastElement(opts.valuesOf(headerFiles));
|
||||||
if (opts.has(manPages))
|
if (opts.has(manPages))
|
||||||
options.manPages = opts.valuesOf(manPages);
|
options.manPages = getLastElement(opts.valuesOf(manPages));
|
||||||
if (opts.has(legalNotices))
|
if (opts.has(legalNotices))
|
||||||
options.legalNotices = opts.valuesOf(legalNotices);
|
options.legalNotices = getLastElement(opts.valuesOf(legalNotices));
|
||||||
if (opts.has(modulePath)) {
|
if (opts.has(modulePath)) {
|
||||||
Path[] dirs = opts.valuesOf(modulePath).toArray(new Path[0]);
|
Path[] dirs = getLastElement(opts.valuesOf(modulePath)).toArray(new Path[0]);
|
||||||
options.moduleFinder = new ModulePath(Runtime.version(), true, dirs);
|
options.moduleFinder = new ModulePath(Runtime.version(), true, dirs);
|
||||||
}
|
}
|
||||||
if (opts.has(moduleVersion))
|
if (opts.has(moduleVersion))
|
||||||
options.moduleVersion = opts.valueOf(moduleVersion);
|
options.moduleVersion = getLastElement(opts.valuesOf(moduleVersion));
|
||||||
if (opts.has(mainClass))
|
if (opts.has(mainClass))
|
||||||
options.mainClass = opts.valueOf(mainClass);
|
options.mainClass = getLastElement(opts.valuesOf(mainClass));
|
||||||
if (opts.has(osName))
|
if (opts.has(osName))
|
||||||
options.osName = opts.valueOf(osName);
|
options.osName = getLastElement(opts.valuesOf(osName));
|
||||||
if (opts.has(osArch))
|
if (opts.has(osArch))
|
||||||
options.osArch = opts.valueOf(osArch);
|
options.osArch = getLastElement(opts.valuesOf(osArch));
|
||||||
if (opts.has(osVersion))
|
if (opts.has(osVersion))
|
||||||
options.osVersion = opts.valueOf(osVersion);
|
options.osVersion = getLastElement(opts.valuesOf(osVersion));
|
||||||
if (opts.has(warnIfResolved))
|
if (opts.has(warnIfResolved))
|
||||||
options.moduleResolution = opts.valueOf(warnIfResolved);
|
options.moduleResolution = getLastElement(opts.valuesOf(warnIfResolved));
|
||||||
if (opts.has(doNotResolveByDefault)) {
|
if (opts.has(doNotResolveByDefault)) {
|
||||||
if (options.moduleResolution == null)
|
if (options.moduleResolution == null)
|
||||||
options.moduleResolution = ModuleResolution.empty();
|
options.moduleResolution = ModuleResolution.empty();
|
||||||
options.moduleResolution = options.moduleResolution.withDoNotResolveByDefault();
|
options.moduleResolution = options.moduleResolution.withDoNotResolveByDefault();
|
||||||
}
|
}
|
||||||
if (opts.has(hashModules)) {
|
if (opts.has(hashModules)) {
|
||||||
options.modulesToHash = opts.valueOf(hashModules);
|
options.modulesToHash = getLastElement(opts.valuesOf(hashModules));
|
||||||
// if storing hashes then the module path is required
|
// if storing hashes then the module path is required
|
||||||
if (options.moduleFinder == null)
|
if (options.moduleFinder == null)
|
||||||
throw new CommandException("err.modulepath.must.be.specified")
|
throw new CommandException("err.modulepath.must.be.specified")
|
||||||
@ -1531,6 +1448,13 @@ public class JmodTask {
|
|||||||
throw new CommandException("err.classpath.must.be.specified").showUsage(true);
|
throw new CommandException("err.classpath.must.be.specified").showUsage(true);
|
||||||
if (options.mainClass != null && !isValidJavaIdentifier(options.mainClass))
|
if (options.mainClass != null && !isValidJavaIdentifier(options.mainClass))
|
||||||
throw new CommandException("err.invalid.main-class", options.mainClass);
|
throw new CommandException("err.invalid.main-class", options.mainClass);
|
||||||
|
if (options.mode.equals(Mode.EXTRACT) && options.extractDir != null) {
|
||||||
|
try {
|
||||||
|
Files.createDirectories(options.extractDir);
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
throw new CommandException("err.cannot.create.dir", options.extractDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (OptionException e) {
|
} catch (OptionException e) {
|
||||||
throw new CommandException(e.getMessage());
|
throw new CommandException(e.getMessage());
|
||||||
}
|
}
|
||||||
@ -1558,6 +1482,12 @@ public class JmodTask {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static <E> E getLastElement(List<E> list) {
|
||||||
|
if (list.size() == 0)
|
||||||
|
throw new InternalError("Unexpected 0 list size");
|
||||||
|
return list.get(list.size() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
private void reportError(String message) {
|
private void reportError(String message) {
|
||||||
out.println(getMessage("error.prefix") + " " + message);
|
out.println(getMessage("error.prefix") + " " + message);
|
||||||
}
|
}
|
||||||
|
@ -108,9 +108,9 @@ err.internal.error=internal error: {0} {1} {2}
|
|||||||
err.invalid.dryrun.option=--dry-run can only be used with hash mode
|
err.invalid.dryrun.option=--dry-run can only be used with hash mode
|
||||||
err.module.descriptor.not.found=Module descriptor not found
|
err.module.descriptor.not.found=Module descriptor not found
|
||||||
err.missing.export.or.open.packages=Packages that are exported or open in {0} are not present: {1}
|
err.missing.export.or.open.packages=Packages that are exported or open in {0} are not present: {1}
|
||||||
|
err.module.resolution.fail=Resolution failed: {0}
|
||||||
warn.invalid.arg=Invalid classname or pathname not exist: {0}
|
warn.invalid.arg=Invalid classname or pathname not exist: {0}
|
||||||
warn.no.module.hashes=No hashes recorded: no module specified for hashing depends on {0}
|
warn.no.module.hashes=No hashes recorded: no module specified for hashing depends on {0}
|
||||||
warn.module.resolution.fail=No hashes recorded: {0}
|
|
||||||
warn.ignore.entry=ignoring entry {0}, in section {1}
|
warn.ignore.entry=ignoring entry {0}, in section {1}
|
||||||
warn.ignore.duplicate.entry=ignoring duplicate entry {0}, in section {1}
|
warn.ignore.duplicate.entry=ignoring duplicate entry {0}, in section {1}
|
||||||
|
|
||||||
|
@ -418,7 +418,6 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpChannelImpl_receive0
|
|||||||
(JNIEnv *env, jclass klass, jint fd, jobject resultContainerObj,
|
(JNIEnv *env, jclass klass, jint fd, jobject resultContainerObj,
|
||||||
jlong address, jint length, jboolean peek) {
|
jlong address, jint length, jboolean peek) {
|
||||||
SOCKETADDRESS sa;
|
SOCKETADDRESS sa;
|
||||||
int sa_len = sizeof(SOCKETADDRESS);
|
|
||||||
ssize_t rv = 0;
|
ssize_t rv = 0;
|
||||||
jlong *addr = jlong_to_ptr(address);
|
jlong *addr = jlong_to_ptr(address);
|
||||||
struct iovec iov[1];
|
struct iovec iov[1];
|
||||||
@ -429,7 +428,7 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpChannelImpl_receive0
|
|||||||
/* Set up the msghdr structure for receiving */
|
/* Set up the msghdr structure for receiving */
|
||||||
memset(msg, 0, sizeof (*msg));
|
memset(msg, 0, sizeof (*msg));
|
||||||
msg->msg_name = &sa;
|
msg->msg_name = &sa;
|
||||||
msg->msg_namelen = sa_len;
|
msg->msg_namelen = sizeof(sa);
|
||||||
iov->iov_base = addr;
|
iov->iov_base = addr;
|
||||||
iov->iov_len = length;
|
iov->iov_len = length;
|
||||||
msg->msg_iov = iov;
|
msg->msg_iov = iov;
|
||||||
@ -538,7 +537,7 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpChannelImpl_send0
|
|||||||
jobject targetAddress, jint targetPort, jint assocId, jint streamNumber,
|
jobject targetAddress, jint targetPort, jint assocId, jint streamNumber,
|
||||||
jboolean unordered, jint ppid) {
|
jboolean unordered, jint ppid) {
|
||||||
SOCKETADDRESS sa;
|
SOCKETADDRESS sa;
|
||||||
int sa_len = sizeof(SOCKETADDRESS);
|
int sa_len = 0;
|
||||||
ssize_t rv = 0;
|
ssize_t rv = 0;
|
||||||
jlong *addr = jlong_to_ptr(address);
|
jlong *addr = jlong_to_ptr(address);
|
||||||
struct iovec iov[1];
|
struct iovec iov[1];
|
||||||
@ -555,13 +554,12 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpChannelImpl_send0
|
|||||||
* Association already existing, assocId != -1, targetAddress = preferred addr
|
* Association already existing, assocId != -1, targetAddress = preferred addr
|
||||||
*/
|
*/
|
||||||
if (targetAddress != NULL /*&& assocId <= 0*/) {
|
if (targetAddress != NULL /*&& assocId <= 0*/) {
|
||||||
if (NET_InetAddressToSockaddr(env, targetAddress, targetPort, &sa.sa,
|
if (NET_InetAddressToSockaddr(env, targetAddress, targetPort, &sa,
|
||||||
&sa_len, JNI_TRUE) != 0) {
|
&sa_len, JNI_TRUE) != 0) {
|
||||||
return IOS_THROWN;
|
return IOS_THROWN;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
memset(&sa, '\x0', sa_len);
|
memset(&sa, '\x0', sizeof(sa));
|
||||||
sa_len = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up the msghdr structure for sending */
|
/* Set up the msghdr structure for sending */
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user