8014420: Default JDP address does not match the one assigned by IANA
Summary: JDP protocol defaults changed to IANA assigned values
Reviewed-by: dholmes, jbachorik, hirt
Contributed-by: fweimer@redhat.com
--- a/jdk/src/share/classes/sun/management/Agent.java Tue May 28 15:57:45 2013 +0200
+++ b/jdk/src/share/classes/sun/management/Agent.java Tue May 28 18:46:39 2013 +0400
@@ -77,7 +77,7 @@
private static final String SNMP_ADAPTOR_BOOTSTRAP_CLASS_NAME =
"sun.management.snmp.AdaptorBootstrap";
- private static final String JDP_DEFAULT_ADDRESS = "239.255.255.225";
+ private static final String JDP_DEFAULT_ADDRESS = "224.0.23.178";
private static final int JDP_DEFAULT_PORT = 7095;
// The only active agent allowed
--- a/jdk/src/share/classes/sun/management/jdp/package-info.java Tue May 28 15:57:45 2013 +0200
+++ b/jdk/src/share/classes/sun/management/jdp/package-info.java Tue May 28 18:46:39 2013 +0400
@@ -60,7 +60,7 @@
*
* - `INSTANCE_NAME` -- The user-provided name of the running instance
*
- * The protocol sends packets to 239.255.255.225:7095 by default.
+ * The protocol sends packets to 224.0.23.178:7095 by default.
*
* The protocol uses system properties to control it's behaviour:
* - `com.sun.management.jdp.port` -- override default port
--- a/jdk/test/sun/management/jdp/JdpTest.sh Tue May 28 15:57:45 2013 +0200
+++ b/jdk/test/sun/management/jdp/JdpTest.sh Tue May 28 18:46:39 2013 +0400
@@ -2,17 +2,17 @@
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
-#
+#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
-#
+#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
@@ -22,8 +22,8 @@
# questions.
# @test
-# @bug 7169888
-# @compile -XDignore.symbol.file JdpUnitTest.java JdpClient.java JdpDoSomething.java
+# @bug 7169888
+# @compile -XDignore.symbol.file JdpUnitTest.java JdpClient.java JdpDoSomething.java
# @run shell JdpTest.sh --jtreg --no-compile
# @summary No word Failed expected in the test output
@@ -44,17 +44,20 @@
_logname=".classes/output.txt"
_last_pid=""
+_ip="224.0.23.178"
+_port="7095"
+_jmxport="4545"
_do_compile(){
# If the test run without JTReg, we have to compile it by our self
# Under JTReg see @compile statement above
- # sun.* packages is not included to symbol file lib/ct.sym so we have
+ # sun.* packages is not included to symbol file lib/ct.sym so we have
# to ignore it
if [ ! -d ${_testclasses} ]
then
mkdir -p ${_testclasses}
- fi
+ fi
rm -f ${_testclasses}/*.class
@@ -64,11 +67,11 @@
JdpDoSomething.java \
JdpClient.java
-
+
if [ ! -f ${_testclasses}/JdpDoSomething.class -o ! -f ${_testclasses}/JdpClient.class -o ! -f ${_testclasses}/JdpUnitTest.class ]
then
echo "ERROR: Can't compile"
- exit -1
+ exit 255
fi
}
@@ -84,10 +87,10 @@
npid=`_get_pid`
if [ "${npid}" = "" ]
then
- echo "ERROR: Test app not started"
+ echo "ERROR: Test app not started. Please check machine resources before filing a bug."
if [ "${_jtreg}" = "yes" ]
then
- exit -1
+ exit 255
fi
fi
}
@@ -100,53 +103,53 @@
rm ${_lockFileName}
# wait until VM is actually shuts down
- while true
+ while true
do
npid=`_get_pid`
- if [ "${npid}" = "" ]
+ if [ "${npid}" = "" ]
then
break
fi
sleep 1
- done
+ done
}
-
+
_testme(){
${TESTJAVA}/bin/java \
-cp ${_testclasses} \
$* \
- -Dcom.sun.management.jdp.port=7095 \
- -Dcom.sun.management.jdp.address=239.255.255.225 \
- JdpClient
+ -Dcom.sun.management.jdp.port=${_port} \
+ -Dcom.sun.management.jdp.address=${_ip} \
+ JdpClient
-}
+}
_jcmd(){
${TESTJAVA}/bin/jcmd JdpDoSomething $* > /dev/null 2>/dev/null
-}
+}
_echo(){
echo "$*"
echo "$*" >> ${_logname}
}
-
+
# ============= TESTS ======================================
-
+
test_01(){
-
- _echo "**** Test one ****"
+
+ _echo "**** Test one ****"
_app_start JdpUnitTest \
- -Dcom.sun.management.jdp.port=7095 \
- -Dcom.sun.management.jdp.address=239.255.255.225 \
+ -Dcom.sun.management.jdp.port=${_port} \
+ -Dcom.sun.management.jdp.address=${_ip} \
-Dcom.sun.management.jdp.pause=5
res=`_testme`
- case "${res}" in
- OK*)
+ case "${res}" in
+ OK*)
_echo "Passed"
;;
*)
@@ -155,24 +158,24 @@
esac
_app_stop
-}
+}
test_02(){
-
- _echo "**** Test two ****"
+
+ _echo "**** Test two ****"
_app_start JdpDoSomething \
- -Dcom.sun.management.jdp.port=7095 \
- -Dcom.sun.management.jdp.address=239.255.255.225 \
+ -Dcom.sun.management.jdp.port=${_port} \
+ -Dcom.sun.management.jdp.address=${_ip} \
-Dcom.sun.management.jdp.pause=5 \
- -Dcom.sun.management.jmxremote.port=4545 \
+ -Dcom.sun.management.jmxremote.port=${_jmxport} \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false
res=`_testme`
- case "${res}" in
- OK*)
+ case "${res}" in
+ OK*)
_echo "Passed"
;;
*)
@@ -181,26 +184,26 @@
esac
_app_stop
-}
+}
test_03(){
-
+
_echo "**** Test three ****"
_app_start JdpDoSomething
-
+
_jcmd ManagementAgent.start\
- jdp.port=7095 \
- jdp.address=239.255.255.225 \
+ jdp.port=${_port} \
+ jdp.address=${_ip} \
jdp.pause=5 \
- jmxremote.port=4545 \
+ jmxremote.port=${_jmxport} \
jmxremote.authenticate=false \
jmxremote.ssl=false
res=`_testme`
- case "${res}" in
- OK*)
+ case "${res}" in
+ OK*)
_echo "Passed"
;;
*)
@@ -209,7 +212,7 @@
esac
_app_stop
-}
+}
test_04(){
@@ -217,7 +220,7 @@
_app_start JdpDoSomething \
-Dcom.sun.management.jmxremote.autodiscovery=true \
- -Dcom.sun.management.jmxremote.port=4545 \
+ -Dcom.sun.management.jmxremote.port=${_jmxport} \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false
@@ -243,7 +246,7 @@
_jcmd ManagementAgent.start\
jmxremote.autodiscovery=true \
- jmxremote.port=4545 \
+ jmxremote.port=${_jmxport} \
jmxremote.authenticate=false \
jmxremote.ssl=false
@@ -279,20 +282,20 @@
#------------------------------------------------------------------------------
-# reading parameters
+# reading parameters
-for parm in "$@"
+for parm in "$@"
do
case $parm in
--verbose) _verbose=yes ;;
--jtreg) _jtreg=yes ;;
--no-compile) _compile=no ;;
--testsuite=*) _testsuite=`_echo $parm | sed "s,^--.*=\(.*\),\1,"` ;;
- *)
- echo "Undefined parameter $parm. Try --help for help"
- exit
+ *)
+ echo "Undefined parameter $parm. Try --help for help"
+ exit
;;
- esac
+ esac
done
if [ "${_compile}" = "yes" ]
@@ -325,11 +328,11 @@
cat ${_testsrc}/policy.tpl | \
sed -e "s,@_TESTCLASSES@,${_testclasses},g" -e "s,@TESTJAVA@,${TESTJAVA},g" \
> ${_policyname}
-
+
fi
-
+
# Local mode tests
for i in `echo ${_testsuite} | sed -e "s/,/ /g"`
do
- test_${i}
+ test_${i}
done