8173608: Separate JDK management agent from java.management module
Reviewed-by: dfuchs, dholmes, erikj
--- a/jdk/make/copy/Copy-java.management.gmk Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-#
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. 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.
-#
-
-include CopyCommon.gmk
-
-################################################################################
-
-MGMT_CONF_DIR := $(CONF_DST_DIR)/management
-MGMT_CONF_SRC := $(JDK_TOPDIR)/src/java.management/share/conf
-MGMT_SRC_FILES := $(wildcard $(MGMT_CONF_SRC)/*)
-MGMT_TARGET_FILES := $(subst $(MGMT_CONF_SRC),$(MGMT_CONF_DIR),$(MGMT_SRC_FILES))
-
-$(MGMT_CONF_DIR)/management.properties: $(MGMT_CONF_SRC)/management.properties
- $(call install-file)
- $(CHMOD) 644 $@
-
-# this file has different permissions...don't know why...
-$(MGMT_CONF_DIR)/jmxremote.access: $(MGMT_CONF_SRC)/jmxremote.access
- $(call install-file)
- $(CHMOD) 644 $@
-
-$(MGMT_CONF_DIR)/%: $(MGMT_CONF_SRC)/%
- $(call install-file)
- $(CHMOD) 444 $@
-
-TARGETS := $(MGMT_TARGET_FILES)
-
-################################################################################
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/copy/Copy-jdk.management.agent.gmk Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,50 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. 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.
+#
+
+include CopyCommon.gmk
+
+################################################################################
+
+MGMT_CONF_DIR := $(CONF_DST_DIR)/management
+MGMT_CONF_SRC := $(JDK_TOPDIR)/src/jdk.management.agent/share/conf
+MGMT_SRC_FILES := $(wildcard $(MGMT_CONF_SRC)/*)
+MGMT_TARGET_FILES := $(subst $(MGMT_CONF_SRC),$(MGMT_CONF_DIR),$(MGMT_SRC_FILES))
+
+$(MGMT_CONF_DIR)/management.properties: $(MGMT_CONF_SRC)/management.properties
+ $(call install-file)
+ $(CHMOD) 644 $@
+
+# this file has different permissions...don't know why...
+$(MGMT_CONF_DIR)/jmxremote.access: $(MGMT_CONF_SRC)/jmxremote.access
+ $(call install-file)
+ $(CHMOD) 644 $@
+
+$(MGMT_CONF_DIR)/%: $(MGMT_CONF_SRC)/%
+ $(call install-file)
+ $(CHMOD) 444 $@
+
+TARGETS := $(MGMT_TARGET_FILES)
+
+################################################################################
--- a/jdk/make/gensrc/Gensrc-java.management.gmk Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-#
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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.
-#
-
-include GensrcCommon.gmk
-
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, jdk, gensrc/Gensrc-java.management.gmk))
-
-################################################################################
-
-include GensrcProperties.gmk
-
-$(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
- SRC_DIRS := $(JDK_TOPDIR)/src/java.management/share/classes/sun/management/resources, \
- CLASS := ListResourceBundle, \
-))
-
-TARGETS += $(COMPILE_PROPERTIES)
-
-################################################################################
-
-all: $(TARGETS)
-
-.PHONY: all
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/gensrc/Gensrc-jdk.management.agent.gmk Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,43 @@
+#
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# 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.
+#
+
+include GensrcCommon.gmk
+
+################################################################################
+
+include GensrcProperties.gmk
+
+$(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
+ SRC_DIRS := $(JDK_TOPDIR)/src/jdk.management.agent/share/classes/jdk/internal/agent/resources, \
+ CLASS := ListResourceBundle, \
+))
+
+TARGETS += $(COMPILE_PROPERTIES)
+
+################################################################################
+
+all: $(TARGETS)
+
+.PHONY: all
--- a/jdk/make/lib/Lib-java.management.gmk Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/make/lib/Lib-java.management.gmk Tue Jan 31 20:06:32 2017 -0800
@@ -30,8 +30,7 @@
################################################################################
-LIBMANAGEMENT_SRC += $(JDK_TOPDIR)/src/java.management/share/native/libmanagement \
- $(JDK_TOPDIR)/src/java.management/$(OPENJDK_TARGET_OS_TYPE)/native/libmanagement
+LIBMANAGEMENT_SRC += $(JDK_TOPDIR)/src/java.management/share/native/libmanagement
LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/include \
$(addprefix -I,$(LIBMANAGEMENT_SRC)) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.management \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/lib/Lib-jdk.management.agent.gmk Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,59 @@
+#
+# 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.
+#
+
+include LibCommon.gmk
+
+################################################################################
+
+LIBMANAGEMENT_RMI_SRC += $(JDK_TOPDIR)/src/jdk.management.agent/$(OPENJDK_TARGET_OS_TYPE)/native/libmanagement_rmi
+LIBMANAGEMENT_RMI_CFLAGS := $(addprefix -I,$(LIBMANAGEMENT_RMI_SRC)) \
+ -I$(SUPPORT_OUTPUTDIR)/headers/jdk.management.agent \
+ $(LIBJAVA_HEADER_FLAGS) \
+ #
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBMANAGEMENT_RMI, \
+ LIBRARY := management_rmi, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(LIBMANAGEMENT_RMI_SRC), \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) $(LIBMANAGEMENT_RMI_CFLAGS), \
+ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libmanagement_rmi/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LIBS := $(JDKLIB_LIBS), \
+ LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib, \
+ VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=management_rmi.dll" \
+ -D "JDK_INTERNAL_NAME=management_rmi" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmanagement_rmi, \
+))
+
+$(BUILD_LIBMANAGEMENT_RMI): $(call FindLib, java.base, java)
+
+TARGETS += $(BUILD_LIBMANAGEMENT_RMI)
+
+################################################################################
--- a/jdk/make/mapfiles/libmanagement/mapfile-vers Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/make/mapfiles/libmanagement/mapfile-vers Tue Jan 31 20:06:32 2017 -0800
@@ -28,7 +28,6 @@
SUNWprivate_1.1 {
global:
Java_sun_management_ClassLoadingImpl_setVerboseClass;
- Java_sun_management_FileSystemImpl_isAccessUserOnly0;
Java_sun_management_GarbageCollectorImpl_getCollectionCount;
Java_sun_management_GarbageCollectorImpl_getCollectionTime;
Java_sun_management_HotspotThread_getInternalThreadCount;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/mapfiles/libmanagement_rmi/mapfile-vers Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,34 @@
+#
+# 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.
+#
+
+# Define library interface.
+
+SUNWprivate_1.1 {
+ global:
+ Java_jdk_internal_agent_FileSystemImpl_isAccessUserOnly0;
+ JNI_OnLoad;
+ local:
+ *;
+};
--- a/jdk/src/java.base/share/classes/module-info.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/src/java.base/share/classes/module-info.java Tue Jan 31 20:06:32 2017 -0800
@@ -177,6 +177,7 @@
exports jdk.internal.perf to
java.desktop,
java.management,
+ jdk.management.agent,
jdk.jvmstat;
exports jdk.internal.ref to
java.desktop,
@@ -197,6 +198,7 @@
jdk.jlink;
exports jdk.internal.vm to
java.management,
+ jdk.management.agent,
jdk.jvmstat;
exports sun.net to
jdk.incubator.httpclient;
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/security/FileLoginModule.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/remote/security/FileLoginModule.java Tue Jan 31 20:06:32 2017 -0800
@@ -47,7 +47,6 @@
import com.sun.jmx.remote.util.ClassLogger;
import com.sun.jmx.remote.util.EnvHelp;
-import sun.management.jmxremote.ConnectorBootstrap;
/**
* This {@link LoginModule} performs file-based authentication.
@@ -110,12 +109,14 @@
*/
public class FileLoginModule implements LoginModule {
+ private static final String PASSWORD_FILE_NAME = "jmxremote.password";
+
// Location of the default password file
private static final String DEFAULT_PASSWORD_FILE_NAME =
AccessController.doPrivileged(new GetPropertyAction("java.home")) +
File.separatorChar + "conf" +
File.separatorChar + "management" + File.separatorChar +
- ConnectorBootstrap.DefaultValues.PASSWORD_FILE_NAME;
+ PASSWORD_FILE_NAME;
// Key to retrieve the stored username
private static final String USERNAME_KEY =
@@ -200,8 +201,7 @@
passwordFileDisplayName = passwordFile;
} catch (SecurityException e) {
hasJavaHomePermission = false;
- passwordFileDisplayName =
- ConnectorBootstrap.DefaultValues.PASSWORD_FILE_NAME;
+ passwordFileDisplayName = PASSWORD_FILE_NAME;
}
}
}
--- a/jdk/src/java.management/share/classes/module-info.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/src/java.management/share/classes/module-info.java Tue Jan 31 20:06:32 2017 -0800
@@ -43,13 +43,19 @@
exports javax.management.remote;
exports javax.management.remote.rmi;
exports javax.management.timer;
- exports sun.management to jdk.jconsole, jdk.management;
+ exports com.sun.jmx.remote.internal to jdk.management.agent;
+ exports com.sun.jmx.remote.security to jdk.management.agent;
+ exports sun.management to
+ jdk.jconsole,
+ jdk.management,
+ jdk.management.agent;
+ exports sun.management.counter to jdk.management.agent;
+ exports sun.management.counter.perf to jdk.management.agent;
exports sun.management.spi to jdk.management;
uses javax.management.remote.JMXConnectorProvider;
uses javax.management.remote.JMXConnectorServerProvider;
uses sun.management.spi.PlatformMBeanProvider;
- uses sun.management.spi.AgentProvider;
provides javax.security.auth.spi.LoginModule
with com.sun.jmx.remote.security.FileLoginModule;
--- a/jdk/src/java.management/share/classes/sun/management/Agent.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,739 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.management;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.management.ManagementFactory;
-import java.lang.reflect.Method;
-import java.net.InetAddress;
-import java.net.MalformedURLException;
-import java.net.UnknownHostException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.text.MessageFormat;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.Properties;
-import java.util.ResourceBundle;
-import java.util.ServiceLoader;
-import java.util.function.Function;
-import java.util.function.Predicate;
-
-import javax.management.remote.JMXConnectorServer;
-import javax.management.remote.JMXServiceURL;
-
-import static sun.management.AgentConfigurationError.*;
-import sun.management.jmxremote.ConnectorBootstrap;
-import sun.management.jdp.JdpController;
-import sun.management.jdp.JdpException;
-import jdk.internal.vm.VMSupport;
-import sun.management.spi.AgentProvider;
-
-/**
- * This Agent is started by the VM when -Dcom.sun.management.snmp or
- * -Dcom.sun.management.jmxremote is set. This class will be loaded by the
- * system class loader. Also jmx framework could be started by jcmd
- */
-public class Agent {
- /**
- * Agent status collector strategy class
- */
- private static abstract class StatusCollector {
- protected static final Map<String, String> DEFAULT_PROPS = new HashMap<>();
-
- static {
- DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.PORT,
- ConnectorBootstrap.DefaultValues.PORT);
- DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.USE_LOCAL_ONLY,
- ConnectorBootstrap.DefaultValues.USE_LOCAL_ONLY);
- DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.USE_AUTHENTICATION,
- ConnectorBootstrap.DefaultValues.USE_AUTHENTICATION);
- DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.USE_SSL,
- ConnectorBootstrap.DefaultValues.USE_SSL);
- DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.USE_REGISTRY_SSL,
- ConnectorBootstrap.DefaultValues.USE_REGISTRY_SSL);
- DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.SSL_NEED_CLIENT_AUTH,
- ConnectorBootstrap.DefaultValues.SSL_NEED_CLIENT_AUTH);
- DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.CONFIG_FILE_NAME,
- ConnectorBootstrap.DefaultValues.CONFIG_FILE_NAME);
- DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.PASSWORD_FILE_NAME,
- ConnectorBootstrap.DefaultValues.PASSWORD_FILE_NAME);
- DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.ACCESS_FILE_NAME,
- ConnectorBootstrap.DefaultValues.ACCESS_FILE_NAME);
-
- }
-
- final protected StringBuilder sb = new StringBuilder();
- final public String collect() {
- Properties agentProps = VMSupport.getAgentProperties();
- String localConnAddr = (String)agentProps.get(LOCAL_CONNECTOR_ADDRESS_PROP);
- if (localConnAddr != null || jmxServer != null) {
- addAgentStatus(true);
- appendConnections(localConnAddr);
- } else {
- addAgentStatus(false);
- }
- return sb.toString();
- }
-
- private void appendConnections(String localConnAddr) {
- appendConnectionsHeader();
- if (localConnAddr != null) {
- try {
- JMXServiceURL u = new JMXServiceURL(localConnAddr);
- addConnection(false, u);
- } catch (MalformedURLException e) {
- // will never happen
- }
-
- }
- if (jmxServer != null) {
- addConnection(true, jmxServer.getAddress());
- }
- appendConnectionsFooter();
- }
-
- private void addConnection(boolean remote, JMXServiceURL u) {
- appendConnectionHeader(remote);
- addConnectionDetails(u);
- addConfigProperties();
- appendConnectionFooter(remote);
- }
-
- private void addConfigProperties() {
- appendConfigPropsHeader();
-
- Properties remoteProps = configProps != null ?
- configProps : getManagementProperties();
- Map<Object, Object> props = new HashMap<>(DEFAULT_PROPS);
-
- if (remoteProps == null) {
- // local connector only
- String loc_only = System.getProperty(
- ConnectorBootstrap.PropertyNames.USE_LOCAL_ONLY
- );
-
- if (loc_only != null &&
- !ConnectorBootstrap.DefaultValues.USE_LOCAL_ONLY.equals(loc_only)) {
- props.put(
- ConnectorBootstrap.PropertyNames.USE_LOCAL_ONLY,
- loc_only
- );
- }
- } else {
- props.putAll(remoteProps);
- }
-
- props.entrySet().stream()
- .filter(preprocess(Map.Entry::getKey, StatusCollector::isManagementProp))
- .forEach(this::addConfigProp);
-
- appendConfigPropsFooter();
- }
-
- private static boolean isManagementProp(Object pName) {
- return pName != null && pName.toString().startsWith("com.sun.management.");
- }
-
- private static <T, V> Predicate<T> preprocess(Function<T, V> f, Predicate<V> p) {
- return (T t) -> p.test(f.apply(t));
- }
-
- abstract protected void addAgentStatus(boolean enabled);
- abstract protected void appendConnectionsHeader();
- abstract protected void appendConnectionsFooter();
- abstract protected void addConnectionDetails(JMXServiceURL u);
- abstract protected void appendConnectionHeader(boolean remote);
- abstract protected void appendConnectionFooter(boolean remote);
- abstract protected void appendConfigPropsHeader();
- abstract protected void appendConfigPropsFooter();
- abstract protected void addConfigProp(Map.Entry<?, ?> prop);
- }
-
- /**
- * Free-text status collector strategy implementation
- */
- final private static class TextStatusCollector extends StatusCollector {
-
- @Override
- protected void addAgentStatus(boolean enabled) {
- sb.append("Agent: ").append(enabled ? "enabled" : "disabled").append('\n');
- }
-
- @Override
- protected void appendConnectionsHeader() {
- sb.append('\n');
- }
-
- @Override
- protected void addConnectionDetails(JMXServiceURL u) {
- sb.append("Protocol : ").append(u.getProtocol()).append('\n')
- .append("Host : ").append(u.getHost()).append('\n')
- .append("URL : ").append(u).append('\n');
- }
-
- @Override
- protected void appendConnectionHeader(boolean remote) {
- sb.append("Connection Type: ").append(remote ? "remote" : "local").append('\n');
- }
-
- @Override
- protected void appendConfigPropsHeader() {
- sb.append("Properties :\n");
- }
-
- @Override
- protected void addConfigProp(Map.Entry<?, ?> prop) {
- sb.append(" ").append(prop.getKey()).append(" = ")
- .append(prop.getValue());
- Object defVal = DEFAULT_PROPS.get(prop.getKey());
- if (defVal != null && defVal.equals(prop.getValue())) {
- sb.append(" [default]");
- }
- sb.append("\n");
- }
-
- @Override
- protected void appendConnectionsFooter() {}
-
- @Override
- protected void appendConnectionFooter(boolean remote) {
- sb.append('\n');
- }
-
- @Override
- protected void appendConfigPropsFooter() {}
- }
-
- // management properties
-
- private static Properties mgmtProps;
- private static ResourceBundle messageRB;
- private static final String CONFIG_FILE =
- "com.sun.management.config.file";
- private static final String SNMP_PORT =
- "com.sun.management.snmp.port";
- private static final String JMXREMOTE =
- "com.sun.management.jmxremote";
- private static final String JMXREMOTE_PORT =
- "com.sun.management.jmxremote.port";
- private static final String RMI_PORT =
- "com.sun.management.jmxremote.rmi.port";
- private static final String ENABLE_THREAD_CONTENTION_MONITORING =
- "com.sun.management.enableThreadContentionMonitoring";
- private static final String LOCAL_CONNECTOR_ADDRESS_PROP =
- "com.sun.management.jmxremote.localConnectorAddress";
- private static final String SNMP_AGENT_NAME =
- "SnmpAgent";
-
- private static final String JDP_DEFAULT_ADDRESS = "224.0.23.178";
- private static final int JDP_DEFAULT_PORT = 7095;
-
- // The only active agent allowed
- private static JMXConnectorServer jmxServer = null;
- // The properties used to configure the server
- private static Properties configProps = null;
-
- // Parse string com.sun.management.prop=xxx,com.sun.management.prop=yyyy
- // and return property set if args is null or empty
- // return empty property set
- private static Properties parseString(String args) {
- Properties argProps = new Properties();
- if (args != null && !args.trim().equals("")) {
- for (String option : args.split(",")) {
- String s[] = option.split("=", 2);
- String name = s[0].trim();
- String value = (s.length > 1) ? s[1].trim() : "";
-
- if (!name.startsWith("com.sun.management.")) {
- error(INVALID_OPTION, name);
- }
-
- argProps.setProperty(name, value);
- }
- }
-
- return argProps;
- }
-
- // invoked by -javaagent or -Dcom.sun.management.agent.class
- public static void premain(String args) throws Exception {
- agentmain(args);
- }
-
- // invoked by attach mechanism
- public static void agentmain(String args) throws Exception {
- if (args == null || args.length() == 0) {
- args = JMXREMOTE; // default to local management
- }
-
- Properties arg_props = parseString(args);
-
- // Read properties from the config file
- Properties config_props = new Properties();
- String fname = arg_props.getProperty(CONFIG_FILE);
- readConfiguration(fname, config_props);
-
- // Arguments override config file
- config_props.putAll(arg_props);
- startAgent(config_props);
- }
-
- // jcmd ManagementAgent.start_local entry point
- // Also called due to command-line via startAgent()
- private static synchronized void startLocalManagementAgent() {
- Properties agentProps = VMSupport.getAgentProperties();
-
- // start local connector if not started
- if (agentProps.get(LOCAL_CONNECTOR_ADDRESS_PROP) == null) {
- JMXConnectorServer cs = ConnectorBootstrap.startLocalConnectorServer();
- String address = cs.getAddress().toString();
- // Add the local connector address to the agent properties
- agentProps.put(LOCAL_CONNECTOR_ADDRESS_PROP, address);
-
- try {
- // export the address to the instrumentation buffer
- ConnectorAddressLink.export(address);
- } catch (Exception x) {
- // Connector server started but unable to export address
- // to instrumentation buffer - non-fatal error.
- warning(EXPORT_ADDRESS_FAILED, x.getMessage());
- }
- }
- }
-
- // jcmd ManagementAgent.start entry point
- // This method starts the remote JMX agent and starts neither
- // the local JMX agent nor the SNMP agent
- // @see #startLocalManagementAgent and also @see #startAgent.
- private static synchronized void startRemoteManagementAgent(String args) throws Exception {
- if (jmxServer != null) {
- throw new RuntimeException(getText(INVALID_STATE, "Agent already started"));
- }
-
- try {
- Properties argProps = parseString(args);
- configProps = new Properties();
-
- // Load the management properties from the config file
- // if config file is not specified readConfiguration implicitly
- // reads <java.home>/conf/management/management.properties
-
- String fname = System.getProperty(CONFIG_FILE);
- readConfiguration(fname, configProps);
-
- // management properties can be overridden by system properties
- // which take precedence
- Properties sysProps = System.getProperties();
- synchronized (sysProps) {
- configProps.putAll(sysProps);
- }
-
- // if user specifies config file into command line for either
- // jcmd utilities or attach command it overrides properties set in
- // command line at the time of VM start
- String fnameUser = argProps.getProperty(CONFIG_FILE);
- if (fnameUser != null) {
- readConfiguration(fnameUser, configProps);
- }
-
- // arguments specified in command line of jcmd utilities
- // override both system properties and one set by config file
- // specified in jcmd command line
- configProps.putAll(argProps);
-
- // jcmd doesn't allow to change ThreadContentionMonitoring, but user
- // can specify this property inside config file, so enable optional
- // monitoring functionality if this property is set
- final String enableThreadContentionMonitoring =
- configProps.getProperty(ENABLE_THREAD_CONTENTION_MONITORING);
-
- if (enableThreadContentionMonitoring != null) {
- ManagementFactory.getThreadMXBean().
- setThreadContentionMonitoringEnabled(true);
- }
-
- String jmxremotePort = configProps.getProperty(JMXREMOTE_PORT);
- if (jmxremotePort != null) {
- jmxServer = ConnectorBootstrap.
- startRemoteConnectorServer(jmxremotePort, configProps);
-
- startDiscoveryService(configProps);
- } else {
- throw new AgentConfigurationError(INVALID_JMXREMOTE_PORT, "No port specified");
- }
- } catch (JdpException e) {
- error(e);
- } catch (AgentConfigurationError err) {
- error(err.getError(), err.getParams());
- }
- }
-
- private static synchronized void stopRemoteManagementAgent() throws Exception {
-
- JdpController.stopDiscoveryService();
-
- if (jmxServer != null) {
- ConnectorBootstrap.unexportRegistry();
- ConnectorAddressLink.unexportRemote();
-
- // Attempt to stop already stopped agent
- // Don't cause any errors.
- jmxServer.stop();
- jmxServer = null;
- configProps = null;
- }
- }
-
- private static synchronized String getManagementAgentStatus() throws Exception {
- return new TextStatusCollector().collect();
- }
-
- private static void startAgent(Properties props) throws Exception {
- String snmpPort = props.getProperty(SNMP_PORT);
- String jmxremote = props.getProperty(JMXREMOTE);
- String jmxremotePort = props.getProperty(JMXREMOTE_PORT);
-
- // Enable optional monitoring functionality if requested
- final String enableThreadContentionMonitoring =
- props.getProperty(ENABLE_THREAD_CONTENTION_MONITORING);
- if (enableThreadContentionMonitoring != null) {
- ManagementFactory.getThreadMXBean().
- setThreadContentionMonitoringEnabled(true);
- }
-
- try {
- if (snmpPort != null) {
- loadSnmpAgent(props);
- }
-
- /*
- * If the jmxremote.port property is set then we start the
- * RMIConnectorServer for remote M&M.
- *
- * If the jmxremote or jmxremote.port properties are set then
- * we start a RMIConnectorServer for local M&M. The address
- * of this "local" server is exported as a counter to the jstat
- * instrumentation buffer.
- */
- if (jmxremote != null || jmxremotePort != null) {
- if (jmxremotePort != null) {
- jmxServer = ConnectorBootstrap.
- startRemoteConnectorServer(jmxremotePort, props);
- startDiscoveryService(props);
- }
- startLocalManagementAgent();
- }
-
- } catch (AgentConfigurationError e) {
- error(e.getError(), e.getParams());
- } catch (Exception e) {
- error(e);
- }
- }
-
- private static void startDiscoveryService(Properties props)
- throws IOException, JdpException {
- // Start discovery service if requested
- String discoveryPort = props.getProperty("com.sun.management.jdp.port");
- String discoveryAddress = props.getProperty("com.sun.management.jdp.address");
- String discoveryShouldStart = props.getProperty("com.sun.management.jmxremote.autodiscovery");
-
- // Decide whether we should start autodicovery service.
- // To start autodiscovery following conditions should be met:
- // autodiscovery==true OR (autodicovery==null AND jdp.port != NULL)
-
- boolean shouldStart = false;
- if (discoveryShouldStart == null){
- shouldStart = (discoveryPort != null);
- }
- else{
- try{
- shouldStart = Boolean.parseBoolean(discoveryShouldStart);
- } catch (NumberFormatException e) {
- throw new AgentConfigurationError(AGENT_EXCEPTION, "Couldn't parse autodiscovery argument");
- }
- }
-
- if (shouldStart) {
- // port and address are required arguments and have no default values
- InetAddress address;
- try {
- address = (discoveryAddress == null) ?
- InetAddress.getByName(JDP_DEFAULT_ADDRESS) : InetAddress.getByName(discoveryAddress);
- } catch (UnknownHostException e) {
- throw new AgentConfigurationError(AGENT_EXCEPTION, e, "Unable to broadcast to requested address");
- }
-
- int port = JDP_DEFAULT_PORT;
- if (discoveryPort != null) {
- try {
- port = Integer.parseInt(discoveryPort);
- } catch (NumberFormatException e) {
- throw new AgentConfigurationError(AGENT_EXCEPTION, "Couldn't parse JDP port argument");
- }
- }
-
- // Rebuilding service URL to broadcast it
- String jmxremotePort = props.getProperty(JMXREMOTE_PORT);
- String rmiPort = props.getProperty(RMI_PORT);
-
- JMXServiceURL url = jmxServer.getAddress();
- String hostname = url.getHost();
-
- String jmxUrlStr = (rmiPort != null)
- ? String.format(
- "service:jmx:rmi://%s:%s/jndi/rmi://%s:%s/jmxrmi",
- hostname, rmiPort, hostname, jmxremotePort)
- : String.format(
- "service:jmx:rmi:///jndi/rmi://%s:%s/jmxrmi", hostname, jmxremotePort);
-
- String instanceName = props.getProperty("com.sun.management.jdp.name");
-
- JdpController.startDiscoveryService(address, port, instanceName, jmxUrlStr);
- }
- }
-
- public static Properties loadManagementProperties() {
- Properties props = new Properties();
-
- // Load the management properties from the config file
-
- String fname = System.getProperty(CONFIG_FILE);
- readConfiguration(fname, props);
-
- // management properties can be overridden by system properties
- // which take precedence
- Properties sysProps = System.getProperties();
- synchronized (sysProps) {
- props.putAll(sysProps);
- }
-
- return props;
- }
-
- public static synchronized Properties getManagementProperties() {
- if (mgmtProps == null) {
- String configFile = System.getProperty(CONFIG_FILE);
- String snmpPort = System.getProperty(SNMP_PORT);
- String jmxremote = System.getProperty(JMXREMOTE);
- String jmxremotePort = System.getProperty(JMXREMOTE_PORT);
-
- if (configFile == null && snmpPort == null
- && jmxremote == null && jmxremotePort == null) {
- // return if out-of-the-management option is not specified
- return null;
- }
- mgmtProps = loadManagementProperties();
- }
- return mgmtProps;
- }
-
- private static void loadSnmpAgent(Properties props) {
- /*
- * Load the jdk.snmp service
- */
- AgentProvider provider = AccessController.doPrivileged(
- (PrivilegedAction<AgentProvider>) () -> {
- for(AgentProvider aProvider : ServiceLoader.loadInstalled(AgentProvider.class)) {
- if(aProvider.getName().equals(SNMP_AGENT_NAME))
- return aProvider;
- }
- return null;
- }, null
- );
-
- if (provider != null) {
- provider.startAgent(props);
- } else { // snmp runtime doesn't exist - initialization fails
- throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT);
- }
- }
-
- // read config file and initialize the properties
- private static void readConfiguration(String fname, Properties p) {
- if (fname == null) {
- String home = System.getProperty("java.home");
- if (home == null) {
- throw new Error("Can't find java.home ??");
- }
- StringBuilder defaultFileName = new StringBuilder(home);
- defaultFileName.append(File.separator).append("conf");
- defaultFileName.append(File.separator).append("management");
- defaultFileName.append(File.separator).append("management.properties");
- // Set file name
- fname = defaultFileName.toString();
- }
- final File configFile = new File(fname);
- if (!configFile.exists()) {
- error(CONFIG_FILE_NOT_FOUND, fname);
- }
-
- InputStream in = null;
- try {
- in = new FileInputStream(configFile);
- BufferedInputStream bin = new BufferedInputStream(in);
- p.load(bin);
- } catch (FileNotFoundException e) {
- error(CONFIG_FILE_OPEN_FAILED, e.getMessage());
- } catch (IOException e) {
- error(CONFIG_FILE_OPEN_FAILED, e.getMessage());
- } catch (SecurityException e) {
- error(CONFIG_FILE_ACCESS_DENIED, fname);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- error(CONFIG_FILE_CLOSE_FAILED, fname);
- }
- }
- }
- }
-
- public static void startAgent() throws Exception {
- String prop = System.getProperty("com.sun.management.agent.class");
-
- // -Dcom.sun.management.agent.class not set so read management
- // properties and start agent
- if (prop == null) {
- // initialize management properties
- Properties props = getManagementProperties();
- if (props != null) {
- startAgent(props);
- }
- return;
- }
-
- // -Dcom.sun.management.agent.class=<agent classname>:<agent args>
- String[] values = prop.split(":");
- if (values.length < 1 || values.length > 2) {
- error(AGENT_CLASS_INVALID, "\"" + prop + "\"");
- }
- String cname = values[0];
- String args = (values.length == 2 ? values[1] : null);
-
- if (cname == null || cname.length() == 0) {
- error(AGENT_CLASS_INVALID, "\"" + prop + "\"");
- }
-
- if (cname != null) {
- try {
- // Instantiate the named class.
- // invoke the premain(String args) method
- Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(cname);
- Method premain = clz.getMethod("premain",
- new Class<?>[]{String.class});
- premain.invoke(null, /* static */
- new Object[]{args});
- } catch (ClassNotFoundException ex) {
- error(AGENT_CLASS_NOT_FOUND, "\"" + cname + "\"");
- } catch (NoSuchMethodException ex) {
- error(AGENT_CLASS_PREMAIN_NOT_FOUND, "\"" + cname + "\"");
- } catch (SecurityException ex) {
- error(AGENT_CLASS_ACCESS_DENIED);
- } catch (Exception ex) {
- String msg = (ex.getCause() == null
- ? ex.getMessage()
- : ex.getCause().getMessage());
- error(AGENT_CLASS_FAILED, msg);
- }
- }
- }
-
- public static void error(String key) {
- String keyText = getText(key);
- System.err.print(getText("agent.err.error") + ": " + keyText);
- throw new RuntimeException(keyText);
- }
-
- public static void error(String key, String[] params) {
- if (params == null || params.length == 0) {
- error(key);
- } else {
- StringBuilder message = new StringBuilder(params[0]);
- for (int i = 1; i < params.length; i++) {
- message.append(' ').append(params[i]);
- }
- error(key, message.toString());
- }
- }
-
- public static void error(String key, String message) {
- String keyText = getText(key);
- System.err.print(getText("agent.err.error") + ": " + keyText);
- System.err.println(": " + message);
- throw new RuntimeException(keyText + ": " + message);
- }
-
- public static void error(Exception e) {
- e.printStackTrace();
- System.err.println(getText(AGENT_EXCEPTION) + ": " + e.toString());
- throw new RuntimeException(e);
- }
-
- public static void warning(String key, String message) {
- System.err.print(getText("agent.err.warning") + ": " + getText(key));
- System.err.println(": " + message);
- }
-
- private static void initResource() {
- try {
- messageRB =
- ResourceBundle.getBundle("sun.management.resources.agent");
- } catch (MissingResourceException e) {
- throw new Error("Fatal: Resource for management agent is missing");
- }
- }
-
- public static String getText(String key) {
- if (messageRB == null) {
- initResource();
- }
- try {
- return messageRB.getString(key);
- } catch (MissingResourceException e) {
- return "Missing management agent resource bundle: key = \"" + key + "\"";
- }
- }
-
- public static String getText(String key, String... args) {
- if (messageRB == null) {
- initResource();
- }
- String format = messageRB.getString(key);
- if (format == null) {
- format = "missing resource key: key = \"" + key + "\", "
- + "arguments = \"{0}\", \"{1}\", \"{2}\"";
- }
- return MessageFormat.format(format, (Object[]) args);
- }
-}
--- a/jdk/src/java.management/share/classes/sun/management/AgentConfigurationError.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.management;
-
-/**
- * Configuration Error thrown by a management agent.
- */
-public class AgentConfigurationError extends Error {
- public static final String AGENT_EXCEPTION =
- "agent.err.exception";
- public static final String CONFIG_FILE_NOT_FOUND =
- "agent.err.configfile.notfound";
- public static final String CONFIG_FILE_OPEN_FAILED =
- "agent.err.configfile.failed";
- public static final String CONFIG_FILE_CLOSE_FAILED =
- "agent.err.configfile.closed.failed";
- public static final String CONFIG_FILE_ACCESS_DENIED =
- "agent.err.configfile.access.denied";
- public static final String EXPORT_ADDRESS_FAILED =
- "agent.err.exportaddress.failed";
- public static final String AGENT_CLASS_NOT_FOUND =
- "agent.err.agentclass.notfound";
- public static final String AGENT_CLASS_FAILED =
- "agent.err.agentclass.failed";
- public static final String AGENT_CLASS_PREMAIN_NOT_FOUND =
- "agent.err.premain.notfound";
- public static final String AGENT_CLASS_ACCESS_DENIED =
- "agent.err.agentclass.access.denied";
- public static final String AGENT_CLASS_INVALID =
- "agent.err.invalid.agentclass";
- public static final String INVALID_JMXREMOTE_PORT =
- "agent.err.invalid.jmxremote.port";
- public static final String INVALID_JMXREMOTE_RMI_PORT =
- "agent.err.invalid.jmxremote.rmi.port";
- public static final String PASSWORD_FILE_NOT_SET =
- "agent.err.password.file.notset";
- public static final String PASSWORD_FILE_NOT_READABLE =
- "agent.err.password.file.not.readable";
- public static final String PASSWORD_FILE_READ_FAILED =
- "agent.err.password.file.read.failed";
- public static final String PASSWORD_FILE_NOT_FOUND =
- "agent.err.password.file.notfound";
- public static final String ACCESS_FILE_NOT_SET =
- "agent.err.access.file.notset";
- public static final String ACCESS_FILE_NOT_READABLE =
- "agent.err.access.file.not.readable";
- public static final String ACCESS_FILE_READ_FAILED =
- "agent.err.access.file.read.failed";
- public static final String ACCESS_FILE_NOT_FOUND =
- "agent.err.access.file.notfound";
- public static final String PASSWORD_FILE_ACCESS_NOT_RESTRICTED =
- "agent.err.password.file.access.notrestricted";
- public static final String FILE_ACCESS_NOT_RESTRICTED =
- "agent.err.file.access.not.restricted";
- public static final String FILE_NOT_FOUND =
- "agent.err.file.not.found";
- public static final String FILE_NOT_READABLE =
- "agent.err.file.not.readable";
- public static final String FILE_NOT_SET =
- "agent.err.file.not.set";
- public static final String FILE_READ_FAILED =
- "agent.err.file.read.failed";
- public static final String CONNECTOR_SERVER_IO_ERROR =
- "agent.err.connector.server.io.error";
- public static final String INVALID_OPTION =
- "agent.err.invalid.option";
- public static final String INVALID_STATE =
- "agent.err.invalid.state";
-
- private final String error;
- private final String[] params;
-
- public AgentConfigurationError(String error) {
- super();
- this.error = error;
- this.params = null;
- }
-
- public AgentConfigurationError(String error, Throwable cause) {
- super(cause);
- this.error = error;
- this.params = null;
- }
-
- public AgentConfigurationError(String error, String... params) {
- super();
- this.error = error;
- this.params = params.clone();
- }
-
- public AgentConfigurationError(String error, Throwable cause, String... params) {
- super(cause);
- this.error = error;
- this.params = params.clone();
- }
-
- public String getError() {
- return error;
- }
-
- public String[] getParams() {
- return params.clone();
- }
-
- private static final long serialVersionUID = 1211605593516195475L;
-}
--- a/jdk/src/java.management/share/classes/sun/management/ConnectorAddressLink.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,218 +0,0 @@
-/*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.management;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import jdk.internal.perf.Perf;
-import sun.management.counter.Units;
-import sun.management.counter.Counter;
-import sun.management.counter.perf.PerfInstrumentation;
-
-/**
- * A utility class to support the exporting and importing of the address
- * of a connector server using the instrumentation buffer.
- *
- * @since 1.5
- */
-public class ConnectorAddressLink {
- /**
- * A simple wrapper for the perf-counter backing {@linkplain ByteBuffer}
- */
- private static final class PerfHandle {
- private ByteBuffer bb;
-
- private PerfHandle(ByteBuffer bb) {
- this.bb = bb.order(ByteOrder.nativeOrder());
- }
-
- private void putLong(long l) {
- this.bb = bb.clear();
- this.bb.asLongBuffer().put(l);
- }
- }
-
- private static final String CONNECTOR_ADDRESS_COUNTER =
- "sun.management.JMXConnectorServer.address";
- private static final String REMOTE_CONNECTOR_STATE_COUNTER =
- "sun.management.JMXConnectorServer.remote.enabled";
-
- /*
- * The format of the jvmstat counters representing the properties of
- * a given out-of-the-box JMX remote connector will be as follows:
- *
- * sun.management.JMXConnectorServer.<counter>.<key>=<value>
- *
- * where:
- *
- * counter = index computed by this class which uniquely identifies
- * an out-of-the-box JMX remote connector running in this
- * Java virtual machine.
- * key/value = a given key/value pair in the map supplied to the
- * exportRemote() method.
- *
- * For example,
- *
- * sun.management.JMXConnectorServer.0.remoteAddress=service:jmx:rmi:///jndi/rmi://myhost:5000/jmxrmi
- * sun.management.JMXConnectorServer.0.authenticate=false
- * sun.management.JMXConnectorServer.0.ssl=false
- * sun.management.JMXConnectorServer.0.sslRegistry=false
- * sun.management.JMXConnectorServer.0.sslNeedClientAuth=false
- */
- private static final String REMOTE_CONNECTOR_COUNTER_PREFIX =
- "sun.management.JMXConnectorServer.";
-
- /*
- * JMX remote connector counter (it will be incremented every
- * time a new out-of-the-box JMX remote connector is created).
- */
- private static final AtomicInteger counter = new AtomicInteger();
-
- private static PerfHandle remotePerfHandle = null;
-
- /**
- * Exports the specified connector address to the instrumentation buffer
- * so that it can be read by this or other Java virtual machines running
- * on the same system.
- *
- * @param address The connector address.
- */
- public static void export(String address) {
- if (address == null || address.length() == 0) {
- throw new IllegalArgumentException("address not specified");
- }
- Perf perf = Perf.getPerf();
- perf.createString(
- CONNECTOR_ADDRESS_COUNTER, 1, Units.STRING.intValue(), address);
- }
-
- public static void unexportRemote() {
- unexport(remotePerfHandle);
- }
-
- private static void unexport(PerfHandle ph) {
- if (ph != null) {
- ph.putLong(-1L);
- }
- }
-
- /**
- * Imports the connector address from the instrument buffer
- * of the specified Java virtual machine.
- *
- * @param vmid an identifier that uniquely identifies a local Java virtual
- * machine, or <code>0</code> to indicate the current Java virtual machine.
- *
- * @return the value of the connector address, or <code>null</code> if the
- * target VM has not exported a connector address.
- *
- * @throws IOException An I/O error occurred while trying to acquire the
- * instrumentation buffer.
- */
- public static String importFrom(int vmid) throws IOException {
- Perf perf = Perf.getPerf();
- ByteBuffer bb;
- try {
- bb = perf.attach(vmid, "r");
- } catch (IllegalArgumentException iae) {
- throw new IOException(iae.getMessage());
- }
- List<Counter> counters =
- new PerfInstrumentation(bb).findByPattern(CONNECTOR_ADDRESS_COUNTER);
- Iterator<Counter> i = counters.iterator();
- if (i.hasNext()) {
- Counter c = i.next();
- return (String) c.getValue();
- } else {
- return null;
- }
- }
-
- /**
- * Exports the specified remote connector address and associated
- * configuration properties to the instrumentation buffer so that
- * it can be read by this or other Java virtual machines running
- * on the same system.
- *
- * @param properties The remote connector address properties.
- */
- public static void exportRemote(Map<String, String> properties) {
- final int index = counter.getAndIncrement();
- Perf perf = Perf.getPerf();
- for (Map.Entry<String, String> entry : properties.entrySet()) {
- perf.createString(REMOTE_CONNECTOR_COUNTER_PREFIX + index + "." +
- entry.getKey(), 1, Units.STRING.intValue(), entry.getValue());
- }
- if (remotePerfHandle != null) {
- remotePerfHandle.putLong(index);
- } else {
- remotePerfHandle = new PerfHandle(
- perf.createLong(REMOTE_CONNECTOR_STATE_COUNTER, 1, Units.NONE.intValue(), (long)index)
- );
- }
- }
-
- /**
- * Imports the remote connector address and associated
- * configuration properties from the instrument buffer
- * of the specified Java virtual machine.
- *
- * @param vmid an identifier that uniquely identifies a local Java virtual
- * machine, or <code>0</code> to indicate the current Java virtual machine.
- *
- * @return a map containing the remote connector's properties, or an empty
- * map if the target VM has not exported the remote connector's properties.
- *
- * @throws IOException An I/O error occurred while trying to acquire the
- * instrumentation buffer.
- */
- public static Map<String, String> importRemoteFrom(int vmid) throws IOException {
- Perf perf = Perf.getPerf();
- ByteBuffer bb;
- try {
- bb = perf.attach(vmid, "r");
- } catch (IllegalArgumentException iae) {
- throw new IOException(iae.getMessage());
- }
- List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
- Map<String, String> properties = new HashMap<>();
- for (Counter c : counters) {
- String name = c.getName();
- if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
- !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
- properties.put(name, c.getValue().toString());
- }
- }
- return properties;
- }
-}
--- a/jdk/src/java.management/share/classes/sun/management/FileSystem.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.management;
-
-import java.io.File;
-import java.io.IOException;
-
-/*
- * Utility class to support file system operations
- *
- * @since 1.5
- */
-public abstract class FileSystem {
-
- private static final Object lock = new Object();
- private static FileSystem fs;
-
- protected FileSystem() { }
-
- /**
- * Opens the file system
- */
- public static FileSystem open() {
- synchronized (lock) {
- if (fs == null) {
- fs = new FileSystemImpl();
- }
- return fs;
- }
- }
-
- /**
- * Tells whether or not the specified file is located on a
- * file system that supports file security or not.
- *
- * @throws IOException if an I/O error occurs.
- */
- public abstract boolean supportsFileSecurity(File f) throws IOException;
-
- /**
- * Tell whether or not the specified file is accessible
- * by anything other than the file owner.
- *
- * @throws IOException if an I/O error occurs.
- *
- * @throws UnsupportedOperationException
- * If file is located on a file system that doesn't support
- * file security.
- */
- public abstract boolean isAccessUserOnly(File f) throws IOException;
-}
--- a/jdk/src/java.management/share/classes/sun/management/jdp/JdpBroadcaster.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.management.jdp;
-
-import java.io.IOException;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.NetworkInterface;
-import java.net.ProtocolFamily;
-import java.net.StandardProtocolFamily;
-import java.net.StandardSocketOptions;
-import java.nio.ByteBuffer;
-import java.nio.channels.DatagramChannel;
-import java.nio.channels.UnsupportedAddressTypeException;
-import java.util.Enumeration;
-
-/**
- * JdpBroadcaster is responsible for sending pre-built JDP packet across a Net
- *
- * <p> Multicast group address, port number and ttl have to be chosen on upper
- * level and passed to broadcaster constructor. Also it's possible to specify
- * source address to broadcast from. </p>
- *
- * <p>JdpBradcaster doesn't perform any validation on a supplied {@code port} and {@code ttl} because
- * the allowed values depend on an operating system setup</p>
- *
- */
-public final class JdpBroadcaster {
-
- private final InetAddress addr;
- private final int port;
- private final DatagramChannel channel;
-
- /**
- * Create a new broadcaster
- *
- * @param address - multicast group address
- * @param srcAddress - address of interface we should use to broadcast.
- * @param port - udp port to use
- * @param ttl - packet ttl
- * @throws IOException
- */
- public JdpBroadcaster(InetAddress address, InetAddress srcAddress, int port, int ttl)
- throws IOException, JdpException {
- this.addr = address;
- this.port = port;
-
- ProtocolFamily family = (address instanceof Inet6Address)
- ? StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
-
- channel = DatagramChannel.open(family);
- channel.setOption(StandardSocketOptions.SO_REUSEADDR, true);
- channel.setOption(StandardSocketOptions.IP_MULTICAST_TTL, ttl);
-
- // with srcAddress equal to null, this constructor do exactly the same as
- // if srcAddress is not passed
- if (srcAddress != null) {
- // User requests particular interface to bind to
- NetworkInterface interf = NetworkInterface.getByInetAddress(srcAddress);
-
- if (interf == null) {
- throw new JdpException("Unable to get network interface for " + srcAddress.toString());
- }
-
- if (!interf.isUp()) {
- throw new JdpException(interf.getName() + " is not up.");
- }
-
- if (!interf.supportsMulticast()) {
- throw new JdpException(interf.getName() + " does not support multicast.");
- }
-
- try {
- channel.bind(new InetSocketAddress(srcAddress, 0));
- } catch (UnsupportedAddressTypeException ex) {
- throw new JdpException("Unable to bind to source address");
- }
- channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, interf);
- }
- }
-
- /**
- * Create a new broadcaster
- *
- * @param address - multicast group address
- * @param port - udp port to use
- * @param ttl - packet ttl
- * @throws IOException
- */
- public JdpBroadcaster(InetAddress address, int port, int ttl)
- throws IOException, JdpException {
- this(address, null, port, ttl);
- }
-
- /**
- * Broadcast pre-built packet
- *
- * @param packet - instance of JdpPacket
- * @throws IOException
- */
- public void sendPacket(JdpPacket packet)
- throws IOException {
- byte[] data = packet.getPacketData();
- // Unlike allocate/put wrap don't need a flip afterward
- ByteBuffer b = ByteBuffer.wrap(data);
- channel.send(b, new InetSocketAddress(addr, port));
- }
-
- /**
- * Shutdown broadcaster and close underlying socket channel
- *
- * @throws IOException
- */
- public void shutdown() throws IOException {
- channel.close();
- }
-}
--- a/jdk/src/java.management/share/classes/sun/management/jdp/JdpController.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,236 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.management.jdp;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.UUID;
-
-import java.lang.management.ManagementFactory;
-import java.lang.management.RuntimeMXBean;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import sun.management.VMManagement;
-
-/**
- * JdpController is responsible to create and manage a broadcast loop.
- *
- * <p> Other part of code has no access to broadcast loop and have to use
- * provided static methods
- * {@link #startDiscoveryService(InetAddress,int,String,String) startDiscoveryService}
- * and {@link #stopDiscoveryService() stopDiscoveryService}
- * <p>{@link #startDiscoveryService(InetAddress,int,String,String) startDiscoveryService} could be called multiple
- * times as it stops the running service if it is necessary.
- * Call to {@link #stopDiscoveryService() stopDiscoveryService}
- * ignored if service isn't run.
- *
- *
- * <p> System properties below could be used to control broadcast loop behavior.
- * Property below have to be set explicitly in command line. It's not possible to
- * set it in management.config file. Careless changes of these properties could
- * lead to security or network issues.
- * <ul>
- * <li>com.sun.management.jdp.ttl - set ttl for broadcast packet</li>
- * <li>com.sun.management.jdp.pause - set broadcast interval in seconds</li>
- * <li>com.sun.management.jdp.source_addr - an address of interface to use for broadcast</li>
- * </ul>
- *
- * <p>null parameters values are filtered out on {@link JdpPacketWriter} level and
- * corresponding keys are not placed to packet.
- */
-public final class JdpController {
-
- private static class JDPControllerRunner implements Runnable {
-
- private final JdpJmxPacket packet;
- private final JdpBroadcaster bcast;
- private final int pause;
- private volatile boolean shutdown = false;
-
- private JDPControllerRunner(JdpBroadcaster bcast, JdpJmxPacket packet, int pause) {
- this.bcast = bcast;
- this.packet = packet;
- this.pause = pause;
- }
-
- @Override
- public void run() {
- try {
- while (!shutdown) {
- bcast.sendPacket(packet);
- try {
- Thread.sleep(this.pause);
- } catch (InterruptedException e) {
- // pass
- }
- }
-
- } catch (IOException e) {
- // pass;
- }
-
- // It's not possible to re-use controller,
- // nevertheless reset shutdown variable
- try {
- stop();
- bcast.shutdown();
- } catch (IOException ex) {
- // pass - ignore IOException during shutdown
- }
- }
-
- public void stop() {
- shutdown = true;
- }
- }
- private static JDPControllerRunner controller = null;
-
- private JdpController(){
- // Don't allow to instantiate this class.
- }
-
- // Utility to handle optional system properties
- // Parse an integer from string or return default if provided string is null
- private static int getInteger(String val, int dflt, String msg) throws JdpException {
- try {
- return (val == null) ? dflt : Integer.parseInt(val);
- } catch (NumberFormatException ex) {
- throw new JdpException(msg);
- }
- }
-
- // Parse an inet address from string or return default if provided string is null
- private static InetAddress getInetAddress(String val, InetAddress dflt, String msg) throws JdpException {
- try {
- return (val == null) ? dflt : InetAddress.getByName(val);
- } catch (UnknownHostException ex) {
- throw new JdpException(msg);
- }
- }
-
- // Get the process id of the current running Java process
- private static Integer getProcessId() {
- try {
- // Get the current process id using a reflection hack
- RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
- Field jvm = runtime.getClass().getDeclaredField("jvm");
- jvm.setAccessible(true);
-
- VMManagement mgmt = (sun.management.VMManagement) jvm.get(runtime);
- Method pid_method = mgmt.getClass().getDeclaredMethod("getProcessId");
- pid_method.setAccessible(true);
- Integer pid = (Integer) pid_method.invoke(mgmt);
- return pid;
- } catch(Exception ex) {
- return null;
- }
- }
-
-
- /**
- * Starts discovery service
- *
- * @param address - multicast group address
- * @param port - udp port to use
- * @param instanceName - name of running JVM instance
- * @param url - JMX service url
- * @throws IOException
- */
- public static synchronized void startDiscoveryService(InetAddress address, int port, String instanceName, String url)
- throws IOException, JdpException {
-
- // Limit packet to local subnet by default
- int ttl = getInteger(
- System.getProperty("com.sun.management.jdp.ttl"), 1,
- "Invalid jdp packet ttl");
-
- // Broadcast once a 5 seconds by default
- int pause = getInteger(
- System.getProperty("com.sun.management.jdp.pause"), 5,
- "Invalid jdp pause");
-
- // Converting seconds to milliseconds
- pause = pause * 1000;
-
- // Allow OS to choose broadcast source
- InetAddress sourceAddress = getInetAddress(
- System.getProperty("com.sun.management.jdp.source_addr"), null,
- "Invalid source address provided");
-
- // Generate session id
- UUID id = UUID.randomUUID();
-
- JdpJmxPacket packet = new JdpJmxPacket(id, url);
-
- // Don't broadcast whole command line for security reason.
- // Strip everything after first space
- String javaCommand = System.getProperty("sun.java.command");
- if (javaCommand != null) {
- String[] arr = javaCommand.split(" ", 2);
- packet.setMainClass(arr[0]);
- }
-
- // Put optional explicit java instance name to packet, if user doesn't specify
- // it the key is skipped. PacketWriter is responsible to skip keys having null value.
- packet.setInstanceName(instanceName);
-
- // Set rmi server hostname if it explicitly specified by user with
- // java.rmi.server.hostname
- String rmiHostname = System.getProperty("java.rmi.server.hostname");
- packet.setRmiHostname(rmiHostname);
-
- // Set broadcast interval
- packet.setBroadcastInterval(Integer.toString(pause));
-
- // Set process id
- Integer pid = getProcessId();
- if (pid != null) {
- packet.setProcessId(pid.toString());
- }
-
- JdpBroadcaster bcast = new JdpBroadcaster(address, sourceAddress, port, ttl);
-
- // Stop discovery service if it's already running
- stopDiscoveryService();
-
- controller = new JDPControllerRunner(bcast, packet, pause);
-
- Thread t = new Thread(null, controller, "JDP broadcaster", 0, false);
- t.setDaemon(true);
- t.start();
- }
-
- /**
- * Stop running discovery service,
- * it's safe to attempt to stop not started service
- */
- public static synchronized void stopDiscoveryService() {
- if ( controller != null ){
- controller.stop();
- controller = null;
- }
- }
-}
--- a/jdk/src/java.management/share/classes/sun/management/jdp/JdpException.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.management.jdp;
-
-/**
- * An Exception thrown if a JDP implementation encounters a problem.
- */
-public final class JdpException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Construct a new JDP exception with a meaningful message
- *
- * @param msg - message
- */
- public JdpException(String msg) {
- super(msg);
- }
-}
--- a/jdk/src/java.management/share/classes/sun/management/jdp/JdpGenericPacket.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.management.jdp;
-
-/**
- * JdpGenericPacket responsible to provide fields
- * common for all Jdp packets
- */
-public abstract class JdpGenericPacket implements JdpPacket {
-
- /**
- * JDP protocol magic. Magic allows a reader to quickly select
- * JDP packets from a bunch of broadcast packets addressed to the same port
- * and broadcast group. Any packet intended to be parsed by JDP client
- * has to start from this magic.
- */
- private static final int MAGIC = 0xC0FFEE42;
-
- /**
- * Current version of protocol. Any implementation of this protocol has to
- * conform with the packet structure and the flow described in JEP-168
- */
- private static final short PROTOCOL_VERSION = 1;
-
- /**
- * Default do-nothing constructor
- */
- protected JdpGenericPacket(){
- // do nothing
- }
-
-
- /**
- * Validate protocol header magic field
- *
- * @param magic - value to validate
- * @throws JdpException
- */
- public static void checkMagic(int magic)
- throws JdpException {
- if (magic != MAGIC) {
- throw new JdpException("Invalid JDP magic header: " + magic);
- }
- }
-
- /**
- * Validate protocol header version field
- *
- * @param version - value to validate
- * @throws JdpException
- */
- public static void checkVersion(short version)
- throws JdpException {
-
- if (version > PROTOCOL_VERSION) {
- throw new JdpException("Unsupported protocol version: " + version);
- }
- }
-
- /**
- *
- * @return protocol magic
- */
- public static int getMagic() {
- return MAGIC;
- }
-
- /**
- *
- * @return current protocol version
- */
- public static short getVersion() {
- return PROTOCOL_VERSION;
- }
-}
--- a/jdk/src/java.management/share/classes/sun/management/jdp/JdpJmxPacket.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,245 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.management.jdp;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.UUID;
-
-/**
- * A packet to broadcasts JMX URL
- *
- * Fields:
- *
- * <ul>
- * <li>UUID - broadcast session ID, changed every time when we start/stop
- * discovery service</li>
- * <li>JMX_URL - URL to connect to JMX service</li>
- * <li>MAIN_CLASS - optional name of main class, filled from sun.java.command stripped for
- * security reason to first space</li>
- * <li>INSTANCE_NAME - optional custom name of particular instance as provided by customer</li>
- * </ul>
- */
-public final class JdpJmxPacket
- extends JdpGenericPacket
- implements JdpPacket {
-
- /**
- * Session ID
- */
- public final static String UUID_KEY = "DISCOVERABLE_SESSION_UUID";
- /**
- * Name of main class
- */
- public final static String MAIN_CLASS_KEY = "MAIN_CLASS";
- /**
- * JMX service URL
- */
- public final static String JMX_SERVICE_URL_KEY = "JMX_SERVICE_URL";
- /**
- * Name of Java instance
- */
- public final static String INSTANCE_NAME_KEY = "INSTANCE_NAME";
- /**
- * PID of java process, optional presented if it could be obtained
- */
- public final static String PROCESS_ID_KEY = "PROCESS_ID";
- /**
- * Hostname of rmi server, optional presented if user overrides rmi server
- * hostname by java.rmi.server.hostname property
- */
- public final static String RMI_HOSTNAME_KEY = "RMI_HOSTNAME";
- /**
- * Configured broadcast interval, optional
- */
- public final static String BROADCAST_INTERVAL_KEY = "BROADCAST_INTERVAL";
-
- private UUID id;
- private String mainClass;
- private String jmxServiceUrl;
- private String instanceName;
- private String processId;
- private String rmiHostname;
- private String broadcastInterval;
-
- /**
- * Create new instance from user provided data. Set mandatory fields
- *
- * @param id - java instance id
- * @param jmxServiceUrl - JMX service url
- */
- public JdpJmxPacket(UUID id, String jmxServiceUrl) {
- this.id = id;
- this.jmxServiceUrl = jmxServiceUrl;
- }
-
- /**
- * Create new instance from network data Parse packet and set fields.
- *
- * @param data - raw packet data as it came from a Net
- * @throws JdpException
- */
- public JdpJmxPacket(byte[] data)
- throws JdpException {
- JdpPacketReader reader;
-
- reader = new JdpPacketReader(data);
- Map<String, String> p = reader.getDiscoveryDataAsMap();
-
- String sId = p.get(UUID_KEY);
- this.id = (sId == null) ? null : UUID.fromString(sId);
- this.jmxServiceUrl = p.get(JMX_SERVICE_URL_KEY);
- this.mainClass = p.get(MAIN_CLASS_KEY);
- this.instanceName = p.get(INSTANCE_NAME_KEY);
- this.processId = p.get(PROCESS_ID_KEY);
- this.rmiHostname = p.get(RMI_HOSTNAME_KEY);
- this.broadcastInterval = p.get(BROADCAST_INTERVAL_KEY);
- }
-
- /**
- * Set main class field
- *
- * @param mainClass - main class of running app
- */
- public void setMainClass(String mainClass) {
- this.mainClass = mainClass;
- }
-
- /**
- * Set instance name field
- *
- * @param instanceName - name of instance as provided by customer
- */
- public void setInstanceName(String instanceName) {
- this.instanceName = instanceName;
- }
-
- /**
- * @return id of discovery session
- */
- public UUID getId() {
- return id;
- }
-
- /**
- *
- * @return main class field
- */
- public String getMainClass() {
- return mainClass;
- }
-
- /**
- *
- * @return JMX service URL
- */
- public String getJmxServiceUrl() {
- return jmxServiceUrl;
- }
-
- /**
- *
- * @return instance name
- */
- public String getInstanceName() {
- return instanceName;
- }
-
- public String getProcessId() {
- return processId;
- }
-
- public void setProcessId(String processId) {
- this.processId = processId;
- }
-
- public String getRmiHostname() {
- return rmiHostname;
- }
-
- public void setRmiHostname(String rmiHostname) {
- this.rmiHostname = rmiHostname;
- }
-
- public String getBroadcastInterval() {
- return broadcastInterval;
- }
-
- public void setBroadcastInterval(String broadcastInterval) {
- this.broadcastInterval = broadcastInterval;
- }
-
- /**
- *
- * @return assembled packet ready to be sent across a Net
- * @throws IOException
- */
- @Override
- public byte[] getPacketData() throws IOException {
- // Assemble packet from fields to byte array
- JdpPacketWriter writer;
- writer = new JdpPacketWriter();
- writer.addEntry(UUID_KEY, (id == null) ? null : id.toString());
- writer.addEntry(MAIN_CLASS_KEY, mainClass);
- writer.addEntry(JMX_SERVICE_URL_KEY, jmxServiceUrl);
- writer.addEntry(INSTANCE_NAME_KEY, instanceName);
- writer.addEntry(PROCESS_ID_KEY, processId);
- writer.addEntry(RMI_HOSTNAME_KEY, rmiHostname);
- writer.addEntry(BROADCAST_INTERVAL_KEY, broadcastInterval);
-
- return writer.getPacketBytes();
- }
-
- /**
- *
- * @return packet hash code
- */
- @Override
- public int hashCode() {
- int hash = 1;
- hash = hash * 31 + id.hashCode();
- hash = hash * 31 + jmxServiceUrl.hashCode();
- return hash;
- }
-
- /**
- * Compare two packets
- *
- * @param o - packet to compare
- * @return either packet equals or not
- */
- @Override
- public boolean equals(Object o) {
-
- if (o == null || ! (o instanceof JdpJmxPacket) ){
- return false;
- }
-
- JdpJmxPacket p = (JdpJmxPacket) o;
- return Objects.equals(id, p.getId()) && Objects.equals(jmxServiceUrl, p.getJmxServiceUrl());
- }
-}
--- a/jdk/src/java.management/share/classes/sun/management/jdp/JdpPacket.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.management.jdp;
-
-import java.io.IOException;
-
-/**
- * Packet to broadcast
- *
- * <p>Each packet have to contain MAGIC and PROTOCOL_VERSION in order to be
- * recognized as a valid JDP packet.</p>
- *
- * <p>Default implementation build packet as a set of UTF-8 encoded Key/Value pairs
- * are stored as an ordered list of values, and are sent to the server
- * in that order.</p>
- *
- * <p>
- * Packet structure:
- *
- * 4 bytes JDP magic (0xC0FFE42)
- * 2 bytes JDP protocol version (01)
- *
- * 2 bytes size of key
- * x bytes key (UTF-8 encoded)
- * 2 bytes size of value
- * x bytes value (UTF-8 encoded)
- *
- * repeat as many times as necessary ...
- * </p>
- */
-public interface JdpPacket {
-
- /**
- * This method responsible to assemble packet and return a byte array
- * ready to be sent across a Net.
- *
- * @return assembled packet as an array of bytes
- * @throws IOException
- */
- public byte[] getPacketData() throws IOException;
-
-}
--- a/jdk/src/java.management/share/classes/sun/management/jdp/JdpPacketReader.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.management.jdp;
-
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * JdpPacketReader responsible for reading a packet <p>This class gets a byte
- * array as it came from a Net, validates it and breaks a part </p>
- */
-public final class JdpPacketReader {
-
- private final DataInputStream pkt;
- private Map<String, String> pmap = null;
-
- /**
- * Create packet reader, extract and check magic and version
- *
- * @param packet - packet received from a Net
- * @throws JdpException
- */
- public JdpPacketReader(byte[] packet)
- throws JdpException {
- ByteArrayInputStream bais = new ByteArrayInputStream(packet);
- pkt = new DataInputStream(bais);
-
- try {
- int magic = pkt.readInt();
- JdpGenericPacket.checkMagic(magic);
- } catch (IOException e) {
- throw new JdpException("Invalid JDP packet received, bad magic");
- }
-
- try {
- short version = pkt.readShort();
- JdpGenericPacket.checkVersion(version);
- } catch (IOException e) {
- throw new JdpException("Invalid JDP packet received, bad protocol version");
- }
- }
-
- /**
- * Get next entry from packet
- *
- * @return the entry
- * @throws EOFException
- * @throws JdpException
- */
- public String getEntry()
- throws EOFException, JdpException {
-
- try {
- short len = pkt.readShort();
- // Artificial setting the "len" field to Short.MAX_VALUE may cause a reader to allocate
- // to much memory. Prevent this possible DOS attack.
- if (len < 1 && len > pkt.available()) {
- throw new JdpException("Broken JDP packet. Invalid entry length field.");
- }
-
- byte[] b = new byte[len];
- if (pkt.read(b) != len) {
- throw new JdpException("Broken JDP packet. Unable to read entry.");
- }
- return new String(b, "UTF-8");
-
- } catch (EOFException e) {
- throw e;
- } catch (UnsupportedEncodingException ex) {
- throw new JdpException("Broken JDP packet. Unable to decode entry.");
- } catch (IOException e) {
- throw new JdpException("Broken JDP packet. Unable to read entry.");
- }
-
-
- }
-
- /**
- * return packet content as a key/value map
- *
- * @return map containing packet entries pair of entries treated as
- * key,value
- * @throws IOException
- * @throws JdpException
- */
- public Map<String, String> getDiscoveryDataAsMap()
- throws JdpException {
- // return cached map if possible
- if (pmap != null) {
- return pmap;
- }
-
- String key = null, value = null;
-
- final Map<String, String> tmpMap = new HashMap<>();
- try {
- while (true) {
- key = getEntry();
- value = getEntry();
- tmpMap.put(key, value);
- }
- } catch (EOFException e) {
- // EOF reached on reading value, report broken packet
- // otherwise ignore it.
- if (value == null) {
- throw new JdpException("Broken JDP packet. Key without value." + key);
- }
- }
-
- pmap = Collections.unmodifiableMap(tmpMap);
- return pmap;
- }
-}
--- a/jdk/src/java.management/share/classes/sun/management/jdp/JdpPacketWriter.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.management.jdp;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-/**
- * JdpPacketWriter responsible for writing a packet
- * <p>This class assembles a set of key/value pairs to valid JDP packet,
- * ready to be sent across a Net</p>
- */
-public final class JdpPacketWriter {
-
- private final ByteArrayOutputStream baos;
- private final DataOutputStream pkt;
-
- /**
- * Create a JDP packet, add mandatory magic and version headers
- *
- * @throws IOException
- */
- public JdpPacketWriter()
- throws IOException {
- baos = new ByteArrayOutputStream();
- pkt = new DataOutputStream(baos);
-
- pkt.writeInt(JdpGenericPacket.getMagic());
- pkt.writeShort(JdpGenericPacket.getVersion());
- }
-
- /**
- * Put string entry to packet
- *
- * @param entry - string to put (utf-8 encoded)
- * @throws IOException
- */
- public void addEntry(String entry)
- throws IOException {
- /* DataOutputStream.writeUTF() do essentially
- * the same as:
- * pkt.writeShort(entry.getBytes("UTF-8").length);
- * pkt.write(entry.getBytes("UTF-8"));
- */
- pkt.writeUTF(entry);
- }
-
- /**
- * Put key/value pair to packet
- *
- * @param key - key to put (utf-8 encoded)
- * @param val - value to put (utf-8 encoded)
- * @throws IOException
- */
- public void addEntry(String key, String val)
- throws IOException {
- /* Silently skip key if value is null.
- * We don't need to distinguish between key missing
- * and key has no value cases
- */
- if (val != null) {
- addEntry(key);
- addEntry(val);
- }
- }
-
- /**
- * Return assembled packet as a byte array
- *
- * @return packet bytes
- */
- public byte[] getPacketBytes() {
- return baos.toByteArray();
- }
-}
--- a/jdk/src/java.management/share/classes/sun/management/jdp/package-info.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2013, 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.
- */
-/**
- * Summary
- * -------
- *
- * Define a lightweight network protocol for discovering running and
- * manageable Java processes within a network subnet.
- *
- *
- * Description
- * -----------
- *
- * The protocol is lightweight multicast based, and works like a beacon,
- * broadcasting the JMXService URL needed to connect to the external JMX
- * agent if an application is started with appropriate parameters.
- *
- * The payload is structured like this:
- *
- * 4 bytes JDP magic (0xC0FFEE42)
- * 2 bytes JDP protocol version (1)
- * 2 bytes size of the next entry
- * x bytes next entry (UTF-8 encoded)
- * 2 bytes size of next entry
- * ... Rinse and repeat...
- *
- * The payload will be parsed as even entries being keys, odd entries being
- * values.
- *
- * The standard JDP packet contains four entries:
- *
- * - `DISCOVERABLE_SESSION_UUID` -- Unique id of the instance; this id changes every time
- * the discovery protocol starts and stops
- *
- * - `MAIN_CLASS` -- The value of the `sun.java.command` property
- *
- * - `JMX_SERVICE_URL` -- The URL to connect to the JMX agent
- *
- * - `INSTANCE_NAME` -- The user-provided name of the running instance
- *
- * 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
- *
- * - `com.sun.management.jdp.address` -- override default address
- *
- * - `com.sun.management.jmxremote.autodiscovery` -- whether we should start autodiscovery or
- * not. Autodiscovery starts if and only if following conditions are met: (autodiscovery is
- * true OR (autodiscovery is not set AND jdp.port is set))
- *
- * - `com.sun.management.jdp.ttl` -- set ttl for broadcast packet, default is 1
- * - `com.sun.management.jdp.pause` -- set broadcast interval in seconds default is 5
- * - `com.sun.management.jdp.source_addr` -- an address of interface to use for broadcast
- */
-
-package sun.management.jdp;
--- a/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1016 +0,0 @@
-/*
- * Copyright (c) 2003, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.management.jmxremote;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.lang.management.ManagementFactory;
-import java.net.InetAddress;
-import java.net.MalformedURLException;
-import java.net.Socket;
-import java.net.ServerSocket;
-import java.net.UnknownHostException;
-import java.rmi.NoSuchObjectException;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.registry.Registry;
-import java.rmi.server.RMIClientSocketFactory;
-import java.rmi.server.RMIServerSocketFactory;
-import java.rmi.server.RMISocketFactory;
-import java.rmi.server.RemoteObject;
-import java.rmi.server.UnicastRemoteObject;
-import java.security.KeyStore;
-import java.security.Principal;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import javax.management.MBeanServer;
-import javax.management.remote.JMXAuthenticator;
-import javax.management.remote.JMXConnectorServer;
-import javax.management.remote.JMXConnectorServerFactory;
-import javax.management.remote.JMXServiceURL;
-import javax.management.remote.rmi.RMIConnectorServer;
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSocket;
-import javax.net.ssl.SSLSocketFactory;
-import javax.net.ssl.TrustManagerFactory;
-import javax.rmi.ssl.SslRMIClientSocketFactory;
-import javax.rmi.ssl.SslRMIServerSocketFactory;
-import javax.security.auth.Subject;
-
-import com.sun.jmx.remote.internal.RMIExporter;
-import com.sun.jmx.remote.security.JMXPluggableAuthenticator;
-import com.sun.jmx.remote.util.ClassLogger;
-
-import sun.management.Agent;
-import sun.management.AgentConfigurationError;
-import static sun.management.AgentConfigurationError.*;
-import sun.management.ConnectorAddressLink;
-import sun.management.FileSystem;
-import sun.rmi.server.UnicastRef;
-import sun.rmi.server.UnicastServerRef;
-import sun.rmi.server.UnicastServerRef2;
-
-/**
- * This class initializes and starts the RMIConnectorServer for JSR 163
- * JMX Monitoring.
- **/
-public final class ConnectorBootstrap {
-
- /**
- * Default values for JMX configuration properties.
- **/
- public static interface DefaultValues {
-
- public static final String PORT = "0";
- public static final String CONFIG_FILE_NAME = "management.properties";
- public static final String USE_SSL = "true";
- public static final String USE_LOCAL_ONLY = "true";
- public static final String USE_REGISTRY_SSL = "false";
- public static final String USE_AUTHENTICATION = "true";
- public static final String PASSWORD_FILE_NAME = "jmxremote.password";
- public static final String ACCESS_FILE_NAME = "jmxremote.access";
- public static final String SSL_NEED_CLIENT_AUTH = "false";
- }
-
- /**
- * Names of JMX configuration properties.
- **/
- public static interface PropertyNames {
-
- public static final String PORT =
- "com.sun.management.jmxremote.port";
- public static final String HOST =
- "com.sun.management.jmxremote.host";
- public static final String RMI_PORT =
- "com.sun.management.jmxremote.rmi.port";
- public static final String CONFIG_FILE_NAME =
- "com.sun.management.config.file";
- public static final String USE_LOCAL_ONLY =
- "com.sun.management.jmxremote.local.only";
- public static final String USE_SSL =
- "com.sun.management.jmxremote.ssl";
- public static final String USE_REGISTRY_SSL =
- "com.sun.management.jmxremote.registry.ssl";
- public static final String USE_AUTHENTICATION =
- "com.sun.management.jmxremote.authenticate";
- public static final String PASSWORD_FILE_NAME =
- "com.sun.management.jmxremote.password.file";
- public static final String ACCESS_FILE_NAME =
- "com.sun.management.jmxremote.access.file";
- public static final String LOGIN_CONFIG_NAME =
- "com.sun.management.jmxremote.login.config";
- public static final String SSL_ENABLED_CIPHER_SUITES =
- "com.sun.management.jmxremote.ssl.enabled.cipher.suites";
- public static final String SSL_ENABLED_PROTOCOLS =
- "com.sun.management.jmxremote.ssl.enabled.protocols";
- public static final String SSL_NEED_CLIENT_AUTH =
- "com.sun.management.jmxremote.ssl.need.client.auth";
- public static final String SSL_CONFIG_FILE_NAME =
- "com.sun.management.jmxremote.ssl.config.file";
- }
-
- /**
- * JMXConnectorServer associated data.
- */
- private static class JMXConnectorServerData {
-
- public JMXConnectorServerData(
- JMXConnectorServer jmxConnectorServer,
- JMXServiceURL jmxRemoteURL) {
- this.jmxConnectorServer = jmxConnectorServer;
- this.jmxRemoteURL = jmxRemoteURL;
- }
- JMXConnectorServer jmxConnectorServer;
- JMXServiceURL jmxRemoteURL;
- }
-
- /**
- * <p>Prevents our RMI server objects from keeping the JVM alive.</p>
- *
- * <p>We use a private interface in Sun's JMX Remote API implementation
- * that allows us to specify how to export RMI objects. We do so using
- * UnicastServerRef, a class in Sun's RMI implementation. This is all
- * non-portable, of course, so this is only valid because we are inside
- * Sun's JRE.</p>
- *
- * <p>Objects are exported using {@link
- * UnicastServerRef#exportObject(Remote, Object, boolean)}. The
- * boolean parameter is called <code>permanent</code> and means
- * both that the object is not eligible for Distributed Garbage
- * Collection, and that its continued existence will not prevent
- * the JVM from exiting. It is the latter semantics we want (we
- * already have the former because of the way the JMX Remote API
- * works). Hence the somewhat misleading name of this class.</p>
- */
- private static class PermanentExporter implements RMIExporter {
-
- public Remote exportObject(Remote obj,
- int port,
- RMIClientSocketFactory csf,
- RMIServerSocketFactory ssf)
- throws RemoteException {
-
- synchronized (this) {
- if (firstExported == null) {
- firstExported = obj;
- }
- }
-
- final UnicastServerRef ref;
- if (csf == null && ssf == null) {
- ref = new UnicastServerRef(port);
- } else {
- ref = new UnicastServerRef2(port, csf, ssf);
- }
- return ref.exportObject(obj, null, true);
- }
-
- // Nothing special to be done for this case
- public boolean unexportObject(Remote obj, boolean force)
- throws NoSuchObjectException {
- return UnicastRemoteObject.unexportObject(obj, force);
- }
- Remote firstExported;
- }
-
- /**
- * This JMXAuthenticator wraps the JMXPluggableAuthenticator and verifies
- * that at least one of the principal names contained in the authenticated
- * Subject is present in the access file.
- */
- private static class AccessFileCheckerAuthenticator
- implements JMXAuthenticator {
-
- public AccessFileCheckerAuthenticator(Map<String, Object> env) throws IOException {
- environment = env;
- accessFile = (String) env.get("jmx.remote.x.access.file");
- properties = propertiesFromFile(accessFile);
- }
-
- public Subject authenticate(Object credentials) {
- final JMXAuthenticator authenticator =
- new JMXPluggableAuthenticator(environment);
- final Subject subject = authenticator.authenticate(credentials);
- checkAccessFileEntries(subject);
- return subject;
- }
-
- private void checkAccessFileEntries(Subject subject) {
- if (subject == null) {
- throw new SecurityException(
- "Access denied! No matching entries found in " +
- "the access file [" + accessFile + "] as the " +
- "authenticated Subject is null");
- }
- final Set<Principal> principals = subject.getPrincipals();
- for (Principal p1: principals) {
- if (properties.containsKey(p1.getName())) {
- return;
- }
- }
-
- final Set<String> principalsStr = new HashSet<>();
- for (Principal p2: principals) {
- principalsStr.add(p2.getName());
- }
- throw new SecurityException(
- "Access denied! No entries found in the access file [" +
- accessFile + "] for any of the authenticated identities " +
- principalsStr);
- }
-
- private static Properties propertiesFromFile(String fname)
- throws IOException {
- Properties p = new Properties();
- if (fname == null) {
- return p;
- }
- try (FileInputStream fin = new FileInputStream(fname)) {
- p.load(fin);
- }
- return p;
- }
- private final Map<String, Object> environment;
- private final Properties properties;
- private final String accessFile;
- }
-
- // The variable below is here to support stop functionality
- // It would be overriten if you call startRemoteCommectionServer second
- // time. It's OK for now as logic in Agent.java forbids mutiple agents
- private static Registry registry = null;
-
- public static void unexportRegistry() {
- // Remove the entry from registry
- try {
- if (registry != null) {
- UnicastRemoteObject.unexportObject(registry, true);
- registry = null;
- }
- } catch(NoSuchObjectException ex) {
- // This exception can appears only if we attempt
- // to unexportRegistry second time. So it's safe
- // to ignore it without additional messages.
- }
- }
-
- /**
- * Initializes and starts the JMX Connector Server.
- * If the com.sun.management.jmxremote.port property is not defined,
- * simply return. Otherwise, attempts to load the config file, and
- * then calls {@link #startRemoteConnectorServer
- * (java.lang.String, java.util.Properties)}.
- *
- * This method is used by some jtreg tests.
- **/
- public static synchronized JMXConnectorServer initialize() {
-
- // Load a new management properties
- final Properties props = Agent.loadManagementProperties();
- if (props == null) {
- return null;
- }
-
- final String portStr = props.getProperty(PropertyNames.PORT);
- return startRemoteConnectorServer(portStr, props);
- }
-
- /**
- * This method is used by some jtreg tests.
- *
- * @see #startRemoteConnectorServer
- * (String portStr, Properties props)
- */
- public static synchronized JMXConnectorServer initialize(String portStr, Properties props) {
- return startRemoteConnectorServer(portStr, props);
- }
-
- /**
- * Initializes and starts a JMX Connector Server for remote
- * monitoring and management.
- **/
- public static synchronized JMXConnectorServer startRemoteConnectorServer(String portStr, Properties props) {
-
- // Get port number
- final int port;
- try {
- port = Integer.parseInt(portStr);
- } catch (NumberFormatException x) {
- throw new AgentConfigurationError(INVALID_JMXREMOTE_PORT, x, portStr);
- }
- if (port < 0) {
- throw new AgentConfigurationError(INVALID_JMXREMOTE_PORT, portStr);
- }
-
- // User can specify a port to be used to export rmi object,
- // in order to simplify firewall rules
- // if port is not specified random one will be allocated.
- int rmiPort = 0;
- String rmiPortStr = props.getProperty(PropertyNames.RMI_PORT);
- try {
- if (rmiPortStr != null) {
- rmiPort = Integer.parseInt(rmiPortStr);
- }
- } catch (NumberFormatException x) {
- throw new AgentConfigurationError(INVALID_JMXREMOTE_RMI_PORT, x, rmiPortStr);
- }
- if (rmiPort < 0) {
- throw new AgentConfigurationError(INVALID_JMXREMOTE_RMI_PORT, rmiPortStr);
- }
-
- // Do we use authentication?
- final String useAuthenticationStr =
- props.getProperty(PropertyNames.USE_AUTHENTICATION,
- DefaultValues.USE_AUTHENTICATION);
- final boolean useAuthentication =
- Boolean.valueOf(useAuthenticationStr).booleanValue();
-
- // Do we use SSL?
- final String useSslStr =
- props.getProperty(PropertyNames.USE_SSL,
- DefaultValues.USE_SSL);
- final boolean useSsl =
- Boolean.valueOf(useSslStr).booleanValue();
-
- // Do we use RMI Registry SSL?
- final String useRegistrySslStr =
- props.getProperty(PropertyNames.USE_REGISTRY_SSL,
- DefaultValues.USE_REGISTRY_SSL);
- final boolean useRegistrySsl =
- Boolean.valueOf(useRegistrySslStr).booleanValue();
-
- final String enabledCipherSuites =
- props.getProperty(PropertyNames.SSL_ENABLED_CIPHER_SUITES);
- String enabledCipherSuitesList[] = null;
- if (enabledCipherSuites != null) {
- StringTokenizer st = new StringTokenizer(enabledCipherSuites, ",");
- int tokens = st.countTokens();
- enabledCipherSuitesList = new String[tokens];
- for (int i = 0; i < tokens; i++) {
- enabledCipherSuitesList[i] = st.nextToken();
- }
- }
-
- final String enabledProtocols =
- props.getProperty(PropertyNames.SSL_ENABLED_PROTOCOLS);
- String enabledProtocolsList[] = null;
- if (enabledProtocols != null) {
- StringTokenizer st = new StringTokenizer(enabledProtocols, ",");
- int tokens = st.countTokens();
- enabledProtocolsList = new String[tokens];
- for (int i = 0; i < tokens; i++) {
- enabledProtocolsList[i] = st.nextToken();
- }
- }
-
- final String sslNeedClientAuthStr =
- props.getProperty(PropertyNames.SSL_NEED_CLIENT_AUTH,
- DefaultValues.SSL_NEED_CLIENT_AUTH);
- final boolean sslNeedClientAuth =
- Boolean.valueOf(sslNeedClientAuthStr).booleanValue();
-
- // Read SSL config file name
- final String sslConfigFileName =
- props.getProperty(PropertyNames.SSL_CONFIG_FILE_NAME);
-
- String loginConfigName = null;
- String passwordFileName = null;
- String accessFileName = null;
-
- // Initialize settings when authentication is active
- if (useAuthentication) {
-
- // Get non-default login configuration
- loginConfigName =
- props.getProperty(PropertyNames.LOGIN_CONFIG_NAME);
-
- if (loginConfigName == null) {
- // Get password file
- passwordFileName =
- props.getProperty(PropertyNames.PASSWORD_FILE_NAME,
- getDefaultFileName(DefaultValues.PASSWORD_FILE_NAME));
- checkPasswordFile(passwordFileName);
- }
-
- // Get access file
- accessFileName = props.getProperty(PropertyNames.ACCESS_FILE_NAME,
- getDefaultFileName(DefaultValues.ACCESS_FILE_NAME));
- checkAccessFile(accessFileName);
- }
-
- final String bindAddress =
- props.getProperty(PropertyNames.HOST);
-
- if (log.debugOn()) {
- log.debug("startRemoteConnectorServer",
- Agent.getText("jmxremote.ConnectorBootstrap.starting") +
- "\n\t" + PropertyNames.PORT + "=" + port +
- (bindAddress == null ? "" : "\n\t" + PropertyNames.HOST + "=" + bindAddress) +
- "\n\t" + PropertyNames.RMI_PORT + "=" + rmiPort +
- "\n\t" + PropertyNames.USE_SSL + "=" + useSsl +
- "\n\t" + PropertyNames.USE_REGISTRY_SSL + "=" + useRegistrySsl +
- "\n\t" + PropertyNames.SSL_CONFIG_FILE_NAME + "=" + sslConfigFileName +
- "\n\t" + PropertyNames.SSL_ENABLED_CIPHER_SUITES + "=" +
- enabledCipherSuites +
- "\n\t" + PropertyNames.SSL_ENABLED_PROTOCOLS + "=" +
- enabledProtocols +
- "\n\t" + PropertyNames.SSL_NEED_CLIENT_AUTH + "=" +
- sslNeedClientAuth +
- "\n\t" + PropertyNames.USE_AUTHENTICATION + "=" +
- useAuthentication +
- (useAuthentication ? (loginConfigName == null ? ("\n\t" + PropertyNames.PASSWORD_FILE_NAME + "=" +
- passwordFileName) : ("\n\t" + PropertyNames.LOGIN_CONFIG_NAME + "=" +
- loginConfigName)) : "\n\t" +
- Agent.getText("jmxremote.ConnectorBootstrap.noAuthentication")) +
- (useAuthentication ? ("\n\t" + PropertyNames.ACCESS_FILE_NAME + "=" +
- accessFileName) : "") +
- "");
- }
-
- final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
- JMXConnectorServer cs = null;
- JMXServiceURL url = null;
- try {
- final JMXConnectorServerData data = exportMBeanServer(
- mbs, port, rmiPort, useSsl, useRegistrySsl,
- sslConfigFileName, enabledCipherSuitesList,
- enabledProtocolsList, sslNeedClientAuth,
- useAuthentication, loginConfigName,
- passwordFileName, accessFileName, bindAddress);
- cs = data.jmxConnectorServer;
- url = data.jmxRemoteURL;
- log.config("startRemoteConnectorServer",
- Agent.getText("jmxremote.ConnectorBootstrap.ready",
- url.toString()));
- } catch (Exception e) {
- throw new AgentConfigurationError(AGENT_EXCEPTION, e, e.toString());
- }
- try {
- // Export remote connector address and associated configuration
- // properties to the instrumentation buffer.
- Map<String, String> properties = new HashMap<>();
- properties.put("remoteAddress", url.toString());
- properties.put("authenticate", useAuthenticationStr);
- properties.put("ssl", useSslStr);
- properties.put("sslRegistry", useRegistrySslStr);
- properties.put("sslNeedClientAuth", sslNeedClientAuthStr);
- ConnectorAddressLink.exportRemote(properties);
- } catch (Exception e) {
- // Remote connector server started but unable to export remote
- // connector address and associated configuration properties to
- // the instrumentation buffer - non-fatal error.
- log.debug("startRemoteConnectorServer", e);
- }
- return cs;
- }
-
- /*
- * Creates and starts a RMI Connector Server for "local" monitoring
- * and management.
- */
- public static JMXConnectorServer startLocalConnectorServer() {
- // Ensure cryptographically strong random number generater used
- // to choose the object number - see java.rmi.server.ObjID
- System.setProperty("java.rmi.server.randomIDs", "true");
-
- // This RMI server should not keep the VM alive
- Map<String, Object> env = new HashMap<>();
- env.put(RMIExporter.EXPORTER_ATTRIBUTE, new PermanentExporter());
- env.put(RMIConnectorServer.CREDENTIAL_TYPES, new String[]{
- String[].class.getName(), String.class.getName()
- });
-
- // The local connector server need only be available via the
- // loopback connection.
- String localhost = "localhost";
- InetAddress lh = null;
- try {
- lh = InetAddress.getByName(localhost);
- localhost = lh.getHostAddress();
- } catch (UnknownHostException x) {
- }
-
- // localhost unknown or (somehow) didn't resolve to
- // a loopback address.
- if (lh == null || !lh.isLoopbackAddress()) {
- localhost = "127.0.0.1";
- }
-
- MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
- try {
- JMXServiceURL url = new JMXServiceURL("rmi", localhost, 0);
- // Do we accept connections from local interfaces only?
- Properties props = Agent.getManagementProperties();
- if (props == null) {
- props = new Properties();
- }
- String useLocalOnlyStr = props.getProperty(
- PropertyNames.USE_LOCAL_ONLY, DefaultValues.USE_LOCAL_ONLY);
- boolean useLocalOnly = Boolean.valueOf(useLocalOnlyStr).booleanValue();
- if (useLocalOnly) {
- env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE,
- new LocalRMIServerSocketFactory());
- }
- JMXConnectorServer server =
- JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);
- server.start();
- return server;
- } catch (Exception e) {
- throw new AgentConfigurationError(AGENT_EXCEPTION, e, e.toString());
- }
- }
-
- private static void checkPasswordFile(String passwordFileName) {
- if (passwordFileName == null || passwordFileName.length() == 0) {
- throw new AgentConfigurationError(PASSWORD_FILE_NOT_SET);
- }
- File file = new File(passwordFileName);
- if (!file.exists()) {
- throw new AgentConfigurationError(PASSWORD_FILE_NOT_FOUND, passwordFileName);
- }
-
- if (!file.canRead()) {
- throw new AgentConfigurationError(PASSWORD_FILE_NOT_READABLE, passwordFileName);
- }
-
- FileSystem fs = FileSystem.open();
- try {
- if (fs.supportsFileSecurity(file)) {
- if (!fs.isAccessUserOnly(file)) {
- final String msg = Agent.getText("jmxremote.ConnectorBootstrap.password.readonly",
- passwordFileName);
- log.config("startRemoteConnectorServer", msg);
- throw new AgentConfigurationError(PASSWORD_FILE_ACCESS_NOT_RESTRICTED,
- passwordFileName);
- }
- }
- } catch (IOException e) {
- throw new AgentConfigurationError(PASSWORD_FILE_READ_FAILED,
- e, passwordFileName);
- }
- }
-
- private static void checkAccessFile(String accessFileName) {
- if (accessFileName == null || accessFileName.length() == 0) {
- throw new AgentConfigurationError(ACCESS_FILE_NOT_SET);
- }
- File file = new File(accessFileName);
- if (!file.exists()) {
- throw new AgentConfigurationError(ACCESS_FILE_NOT_FOUND, accessFileName);
- }
-
- if (!file.canRead()) {
- throw new AgentConfigurationError(ACCESS_FILE_NOT_READABLE, accessFileName);
- }
- }
-
- private static void checkRestrictedFile(String restrictedFileName) {
- if (restrictedFileName == null || restrictedFileName.length() == 0) {
- throw new AgentConfigurationError(FILE_NOT_SET);
- }
- File file = new File(restrictedFileName);
- if (!file.exists()) {
- throw new AgentConfigurationError(FILE_NOT_FOUND, restrictedFileName);
- }
- if (!file.canRead()) {
- throw new AgentConfigurationError(FILE_NOT_READABLE, restrictedFileName);
- }
- FileSystem fs = FileSystem.open();
- try {
- if (fs.supportsFileSecurity(file)) {
- if (!fs.isAccessUserOnly(file)) {
- final String msg = Agent.getText(
- "jmxremote.ConnectorBootstrap.file.readonly",
- restrictedFileName);
- log.config("startRemoteConnectorServer", msg);
- throw new AgentConfigurationError(
- FILE_ACCESS_NOT_RESTRICTED, restrictedFileName);
- }
- }
- } catch (IOException e) {
- throw new AgentConfigurationError(
- FILE_READ_FAILED, e, restrictedFileName);
- }
- }
-
- /**
- * Compute the full path name for a default file.
- * @param basename basename (with extension) of the default file.
- * @return ${JRE}/conf/management/${basename}
- **/
- private static String getDefaultFileName(String basename) {
- final String fileSeparator = File.separator;
- return System.getProperty("java.home") + fileSeparator + "conf" +
- fileSeparator + "management" + fileSeparator +
- basename;
- }
-
- private static SslRMIServerSocketFactory createSslRMIServerSocketFactory(
- String sslConfigFileName,
- String[] enabledCipherSuites,
- String[] enabledProtocols,
- boolean sslNeedClientAuth,
- String bindAddress) {
- if (sslConfigFileName == null) {
- return new HostAwareSslSocketFactory(
- enabledCipherSuites,
- enabledProtocols,
- sslNeedClientAuth, bindAddress);
- } else {
- checkRestrictedFile(sslConfigFileName);
- try {
- // Load the SSL keystore properties from the config file
- Properties p = new Properties();
- try (InputStream in = new FileInputStream(sslConfigFileName)) {
- BufferedInputStream bin = new BufferedInputStream(in);
- p.load(bin);
- }
- String keyStore =
- p.getProperty("javax.net.ssl.keyStore");
- String keyStorePassword =
- p.getProperty("javax.net.ssl.keyStorePassword", "");
- String trustStore =
- p.getProperty("javax.net.ssl.trustStore");
- String trustStorePassword =
- p.getProperty("javax.net.ssl.trustStorePassword", "");
-
- char[] keyStorePasswd = null;
- if (keyStorePassword.length() != 0) {
- keyStorePasswd = keyStorePassword.toCharArray();
- }
-
- char[] trustStorePasswd = null;
- if (trustStorePassword.length() != 0) {
- trustStorePasswd = trustStorePassword.toCharArray();
- }
-
- KeyStore ks = null;
- if (keyStore != null) {
- ks = KeyStore.getInstance(KeyStore.getDefaultType());
- try (FileInputStream ksfis = new FileInputStream(keyStore)) {
- ks.load(ksfis, keyStorePasswd);
- }
- }
- KeyManagerFactory kmf = KeyManagerFactory.getInstance(
- KeyManagerFactory.getDefaultAlgorithm());
- kmf.init(ks, keyStorePasswd);
-
- KeyStore ts = null;
- if (trustStore != null) {
- ts = KeyStore.getInstance(KeyStore.getDefaultType());
- try (FileInputStream tsfis = new FileInputStream(trustStore)) {
- ts.load(tsfis, trustStorePasswd);
- }
- }
- TrustManagerFactory tmf = TrustManagerFactory.getInstance(
- TrustManagerFactory.getDefaultAlgorithm());
- tmf.init(ts);
-
- SSLContext ctx = SSLContext.getInstance("SSL");
- ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
-
- return new HostAwareSslSocketFactory(
- ctx,
- enabledCipherSuites,
- enabledProtocols,
- sslNeedClientAuth, bindAddress);
- } catch (Exception e) {
- throw new AgentConfigurationError(AGENT_EXCEPTION, e, e.toString());
- }
- }
- }
-
- private static JMXConnectorServerData exportMBeanServer(
- MBeanServer mbs,
- int port,
- int rmiPort,
- boolean useSsl,
- boolean useRegistrySsl,
- String sslConfigFileName,
- String[] enabledCipherSuites,
- String[] enabledProtocols,
- boolean sslNeedClientAuth,
- boolean useAuthentication,
- String loginConfigName,
- String passwordFileName,
- String accessFileName,
- String bindAddress)
- throws IOException, MalformedURLException {
-
- /* Make sure we use non-guessable RMI object IDs. Otherwise
- * attackers could hijack open connections by guessing their
- * IDs. */
- System.setProperty("java.rmi.server.randomIDs", "true");
-
- JMXServiceURL url = new JMXServiceURL("rmi", bindAddress, rmiPort);
-
- Map<String, Object> env = new HashMap<>();
-
- PermanentExporter exporter = new PermanentExporter();
-
- env.put(RMIExporter.EXPORTER_ATTRIBUTE, exporter);
- env.put(RMIConnectorServer.CREDENTIAL_TYPES, new String[]{
- String[].class.getName(), String.class.getName()
- });
-
- boolean useSocketFactory = bindAddress != null && !useSsl;
-
- if (useAuthentication) {
- if (loginConfigName != null) {
- env.put("jmx.remote.x.login.config", loginConfigName);
- }
- if (passwordFileName != null) {
- env.put("jmx.remote.x.password.file", passwordFileName);
- }
-
- env.put("jmx.remote.x.access.file", accessFileName);
-
- if (env.get("jmx.remote.x.password.file") != null ||
- env.get("jmx.remote.x.login.config") != null) {
- env.put(JMXConnectorServer.AUTHENTICATOR,
- new AccessFileCheckerAuthenticator(env));
- }
- }
-
- RMIClientSocketFactory csf = null;
- RMIServerSocketFactory ssf = null;
-
- if (useSsl || useRegistrySsl) {
- csf = new SslRMIClientSocketFactory();
- ssf = createSslRMIServerSocketFactory(
- sslConfigFileName, enabledCipherSuites,
- enabledProtocols, sslNeedClientAuth, bindAddress);
- }
-
- if (useSsl) {
- env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE,
- csf);
- env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE,
- ssf);
- }
-
- if (useSocketFactory) {
- ssf = new HostAwareSocketFactory(bindAddress);
- env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE,
- ssf);
- }
-
- JMXConnectorServer connServer = null;
- try {
- connServer =
- JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);
- connServer.start();
- } catch (IOException e) {
- if (connServer == null || connServer.getAddress() == null) {
- throw new AgentConfigurationError(CONNECTOR_SERVER_IO_ERROR,
- e, url.toString());
- } else {
- throw new AgentConfigurationError(CONNECTOR_SERVER_IO_ERROR,
- e, connServer.getAddress().toString());
- }
- }
-
- if (useRegistrySsl) {
- registry =
- new SingleEntryRegistry(port, csf, ssf,
- "jmxrmi", exporter.firstExported);
- } else if (useSocketFactory) {
- registry =
- new SingleEntryRegistry(port, csf, ssf,
- "jmxrmi", exporter.firstExported);
- } else {
- registry =
- new SingleEntryRegistry(port,
- "jmxrmi", exporter.firstExported);
- }
-
-
- int registryPort =
- ((UnicastRef) ((RemoteObject) registry).getRef()).getLiveRef().getPort();
- String jmxUrlStr = String.format("service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi",
- url.getHost(), registryPort);
- JMXServiceURL remoteURL = new JMXServiceURL(jmxUrlStr);
-
- /* Our exporter remembers the first object it was asked to
- export, which will be an RMIServerImpl appropriate for
- publication in our special registry. We could
- alternatively have constructed the RMIServerImpl explicitly
- and then constructed an RMIConnectorServer passing it as a
- parameter, but that's quite a bit more verbose and pulls in
- lots of knowledge of the RMI connector. */
-
- return new JMXConnectorServerData(connServer, remoteURL);
- }
-
- /**
- * This class cannot be instantiated.
- **/
- private ConnectorBootstrap() {
- }
-
- private static final ClassLogger log =
- new ClassLogger(ConnectorBootstrap.class.getPackage().getName(),
- "ConnectorBootstrap");
-
- private static class HostAwareSocketFactory implements RMIServerSocketFactory {
-
- private final String bindAddress;
-
- private HostAwareSocketFactory(String bindAddress) {
- this.bindAddress = bindAddress;
- }
-
- @Override
- public ServerSocket createServerSocket(int port) throws IOException {
- if (bindAddress == null) {
- return new ServerSocket(port);
- } else {
- try {
- InetAddress addr = InetAddress.getByName(bindAddress);
- return new ServerSocket(port, 0, addr);
- } catch (UnknownHostException e) {
- return new ServerSocket(port);
- }
- }
- }
- }
-
- private static class HostAwareSslSocketFactory extends SslRMIServerSocketFactory {
-
- private final String bindAddress;
- private final String[] enabledCipherSuites;
- private final String[] enabledProtocols;
- private final boolean needClientAuth;
- private final SSLContext context;
-
- private HostAwareSslSocketFactory(String[] enabledCipherSuites,
- String[] enabledProtocols,
- boolean sslNeedClientAuth,
- String bindAddress) throws IllegalArgumentException {
- this(null, enabledCipherSuites, enabledProtocols, sslNeedClientAuth, bindAddress);
- }
-
- private HostAwareSslSocketFactory(SSLContext ctx,
- String[] enabledCipherSuites,
- String[] enabledProtocols,
- boolean sslNeedClientAuth,
- String bindAddress) throws IllegalArgumentException {
- this.context = ctx;
- this.bindAddress = bindAddress;
- this.enabledProtocols = enabledProtocols;
- this.enabledCipherSuites = enabledCipherSuites;
- this.needClientAuth = sslNeedClientAuth;
- checkValues(ctx, enabledCipherSuites, enabledProtocols);
- }
-
- @Override
- public ServerSocket createServerSocket(int port) throws IOException {
- if (bindAddress != null) {
- try {
- InetAddress addr = InetAddress.getByName(bindAddress);
- return new SslServerSocket(port, 0, addr, context,
- enabledCipherSuites, enabledProtocols, needClientAuth);
- } catch (UnknownHostException e) {
- return new SslServerSocket(port, context,
- enabledCipherSuites, enabledProtocols, needClientAuth);
- }
- } else {
- return new SslServerSocket(port, context,
- enabledCipherSuites, enabledProtocols, needClientAuth);
- }
- }
-
- private static void checkValues(SSLContext context,
- String[] enabledCipherSuites,
- String[] enabledProtocols) throws IllegalArgumentException {
- // Force the initialization of the default at construction time,
- // rather than delaying it to the first time createServerSocket()
- // is called.
- //
- final SSLSocketFactory sslSocketFactory =
- context == null ?
- (SSLSocketFactory)SSLSocketFactory.getDefault() : context.getSocketFactory();
- SSLSocket sslSocket = null;
- if (enabledCipherSuites != null || enabledProtocols != null) {
- try {
- sslSocket = (SSLSocket) sslSocketFactory.createSocket();
- } catch (Exception e) {
- final String msg = "Unable to check if the cipher suites " +
- "and protocols to enable are supported";
- throw (IllegalArgumentException)
- new IllegalArgumentException(msg).initCause(e);
- }
- }
-
- // Check if all the cipher suites and protocol versions to enable
- // are supported by the underlying SSL/TLS implementation and if
- // true create lists from arrays.
- //
- if (enabledCipherSuites != null) {
- sslSocket.setEnabledCipherSuites(enabledCipherSuites);
- }
- if (enabledProtocols != null) {
- sslSocket.setEnabledProtocols(enabledProtocols);
- }
- }
- }
-
- private static class SslServerSocket extends ServerSocket {
-
- private static SSLSocketFactory defaultSSLSocketFactory;
- private final String[] enabledCipherSuites;
- private final String[] enabledProtocols;
- private final boolean needClientAuth;
- private final SSLContext context;
-
- private SslServerSocket(int port,
- SSLContext ctx,
- String[] enabledCipherSuites,
- String[] enabledProtocols,
- boolean needClientAuth) throws IOException {
- super(port);
- this.enabledProtocols = enabledProtocols;
- this.enabledCipherSuites = enabledCipherSuites;
- this.needClientAuth = needClientAuth;
- this.context = ctx;
- }
-
- private SslServerSocket(int port,
- int backlog,
- InetAddress bindAddr,
- SSLContext ctx,
- String[] enabledCipherSuites,
- String[] enabledProtocols,
- boolean needClientAuth) throws IOException {
- super(port, backlog, bindAddr);
- this.enabledProtocols = enabledProtocols;
- this.enabledCipherSuites = enabledCipherSuites;
- this.needClientAuth = needClientAuth;
- this.context = ctx;
- }
-
- @Override
- public Socket accept() throws IOException {
- final SSLSocketFactory sslSocketFactory =
- context == null ?
- getDefaultSSLSocketFactory() : context.getSocketFactory();
- Socket socket = super.accept();
- SSLSocket sslSocket = (SSLSocket) sslSocketFactory.createSocket(
- socket, socket.getInetAddress().getHostName(),
- socket.getPort(), true);
- sslSocket.setUseClientMode(false);
- if (enabledCipherSuites != null) {
- sslSocket.setEnabledCipherSuites(enabledCipherSuites);
- }
- if (enabledProtocols != null) {
- sslSocket.setEnabledProtocols(enabledProtocols);
- }
- sslSocket.setNeedClientAuth(needClientAuth);
- return sslSocket;
- }
-
- private static synchronized SSLSocketFactory getDefaultSSLSocketFactory() {
- if (defaultSSLSocketFactory == null) {
- defaultSSLSocketFactory = (SSLSocketFactory)SSLSocketFactory.getDefault();
- return defaultSSLSocketFactory;
- } else {
- return defaultSSLSocketFactory;
- }
- }
-
- }
-}
--- a/jdk/src/java.management/share/classes/sun/management/jmxremote/LocalRMIServerSocketFactory.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.management.jmxremote;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.SocketException;
-import java.rmi.server.RMIServerSocketFactory;
-import java.util.Enumeration;
-
-/**
- * This RMI server socket factory creates server sockets that
- * will only accept connection requests from clients running
- * on the host where the RMI remote objects have been exported.
- */
-public final class LocalRMIServerSocketFactory implements RMIServerSocketFactory {
- /**
- * Creates a server socket that only accepts connection requests from
- * clients running on the host where the RMI remote objects have been
- * exported.
- */
- public ServerSocket createServerSocket(int port) throws IOException {
- return new ServerSocket(port) {
- @Override
- public Socket accept() throws IOException {
- final Socket socket = super.accept();
- final InetAddress remoteAddr = socket.getInetAddress();
- final String msg = "The server sockets created using the " +
- "LocalRMIServerSocketFactory only accept connections " +
- "from clients running on the host where the RMI " +
- "remote objects have been exported.";
-
- if (remoteAddr == null) {
- // Though unlikeky, the socket could be already
- // closed... Send a more detailed message in
- // this case. Also avoid throwing NullPointerExceptiion
- //
- String details = "";
- if (socket.isClosed()) {
- details = " Socket is closed.";
- } else if (!socket.isConnected()) {
- details = " Socket is not connected";
- }
- try {
- socket.close();
- } catch (Exception ok) {
- // ok - this is just cleanup before throwing detailed
- // exception.
- }
- throw new IOException(msg +
- " Couldn't determine client address." +
- details);
- } else if (remoteAddr.isLoopbackAddress()) {
- // local address: accept the connection.
- return socket;
- }
- // Retrieve all the network interfaces on this host.
- Enumeration<NetworkInterface> nis;
- try {
- nis = NetworkInterface.getNetworkInterfaces();
- } catch (SocketException e) {
- try {
- socket.close();
- } catch (IOException ioe) {
- // Ignore...
- }
- throw new IOException(msg, e);
- }
- // Walk through the network interfaces to see
- // if any of them matches the client's address.
- // If true, then the client's address is local.
- while (nis.hasMoreElements()) {
- NetworkInterface ni = nis.nextElement();
- Enumeration<InetAddress> addrs = ni.getInetAddresses();
- while (addrs.hasMoreElements()) {
- InetAddress localAddr = addrs.nextElement();
- if (localAddr.equals(remoteAddr)) {
- return socket;
- }
- }
- }
- // The client's address is remote so refuse the connection.
- try {
- socket.close();
- } catch (IOException ioe) {
- // Ignore...
- }
- throw new IOException(msg);
- }
- };
- }
-
- /**
- * Two LocalRMIServerSocketFactory objects
- * are equal if they are of the same type.
- */
- @Override
- public boolean equals(Object obj) {
- return (obj instanceof LocalRMIServerSocketFactory);
- }
-
- /**
- * Returns a hash code value for this LocalRMIServerSocketFactory.
- */
- @Override
- public int hashCode() {
- return getClass().hashCode();
- }
-}
--- a/jdk/src/java.management/share/classes/sun/management/jmxremote/SingleEntryRegistry.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-/*
- * @author Sun Microsystems, Inc.
- * @build @BUILD_TAG_PLACEHOLDER@
- *
- * @COPYRIGHT_MINI_LEGAL_NOTICE_PLACEHOLDER@
- */
-
-package sun.management.jmxremote;
-
-import java.rmi.AccessException;
-import java.rmi.NotBoundException;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.server.RMIClientSocketFactory;
-import java.rmi.server.RMIServerSocketFactory;
-
-import sun.rmi.registry.RegistryImpl;
-
-/** A Registry that consists of a single entry that never changes. */
-public class SingleEntryRegistry extends RegistryImpl {
- SingleEntryRegistry(int port, String name, Remote object)
- throws RemoteException {
- super(port);
- this.name = name;
- this.object = object;
- }
-
- SingleEntryRegistry(int port,
- RMIClientSocketFactory csf,
- RMIServerSocketFactory ssf,
- String name,
- Remote object)
- throws RemoteException {
- super(port, csf, ssf);
- this.name = name;
- this.object = object;
- }
-
- public String[] list() {
- return new String[] {name};
- }
-
- public Remote lookup(String name) throws NotBoundException {
- if (name.equals(this.name))
- return object;
- throw new NotBoundException("Not bound: \"" + name + "\" (only " +
- "bound name is \"" + this.name + "\")");
- }
-
- public void bind(String name, Remote obj) throws AccessException {
- throw new AccessException("Cannot modify this registry");
- }
-
- public void rebind(String name, Remote obj) throws AccessException {
- throw new AccessException("Cannot modify this registry");
- }
-
- public void unbind(String name) throws AccessException {
- throw new AccessException("Cannot modify this registry");
- }
-
- private final String name;
- private final Remote object;
-
- private static final long serialVersionUID = -4897238949499730950L;
-}
--- a/jdk/src/java.management/share/classes/sun/management/jmxremote/package.html Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-
- Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation. 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.
-
--->
-
-</head>
-<body bgcolor="white">
-
-Provides classes that make it possible to create a JMX RMI Connector Server
-at bootstrap for the JSR 163 instrumentation.
-
-@since 1.5
-</body>
-</html>
--- a/jdk/src/java.management/share/classes/sun/management/resources/agent.properties Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#
-# Copyright (c) 2004, 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. 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.
-#
-
-agent.err.error = Error
-agent.err.exception = Exception thrown by the agent
-agent.err.warning = Warning
-
-agent.err.configfile.notfound = Config file not found
-agent.err.configfile.failed = Failed in reading the config file
-agent.err.configfile.closed.failed = Failed in closing the config file
-agent.err.configfile.access.denied = Access to the config file is denied
-
-agent.err.exportaddress.failed = Export of JMX connector address to instrumentation buffer failed
-
-agent.err.agentclass.notfound = Management agent class not found
-agent.err.agentclass.failed = Management agent class failed
-agent.err.premain.notfound = premain(String) does not exist in agent class
-agent.err.agentclass.access.denied = Access to premain(String) is denied
-agent.err.invalid.agentclass = Invalid com.sun.management.agent.class property value
-agent.err.invalid.state = Invalid agent state: {0}
-agent.err.invalid.jmxremote.port = Invalid com.sun.management.jmxremote.port number
-agent.err.invalid.jmxremote.rmi.port = Invalid com.sun.management.jmxremote.rmi.port number
-
-agent.err.file.not.set = File not specified
-agent.err.file.not.readable = File not readable
-agent.err.file.read.failed = Failed in reading the file
-agent.err.file.not.found = File not found
-agent.err.file.access.not.restricted = File read access must be restricted
-
-agent.err.password.file.notset = Password file is not specified but com.sun.management.jmxremote.authenticate=true
-agent.err.password.file.not.readable = Password file not readable
-agent.err.password.file.read.failed = Failed in reading the password file
-agent.err.password.file.notfound = Password file not found
-agent.err.password.file.access.notrestricted = Password file read access must be restricted
-
-agent.err.access.file.notset = Access file is not specified but com.sun.management.jmxremote.authenticate=true
-agent.err.access.file.not.readable = Access file not readable
-agent.err.access.file.read.failed = Failed in reading the access file
-agent.err.access.file.notfound = Access file not found
-
-agent.err.connector.server.io.error = JMX connector server communication error
-
-agent.err.invalid.option = Invalid option specified
-
-jmxremote.ConnectorBootstrap.starting = Starting JMX Connector Server:
-jmxremote.ConnectorBootstrap.noAuthentication = No Authentication
-jmxremote.ConnectorBootstrap.ready = JMX Connector ready at: {0}
-jmxremote.ConnectorBootstrap.password.readonly = Password file read access must be restricted: {0}
-jmxremote.ConnectorBootstrap.file.readonly = File read access must be restricted: {0}
--- a/jdk/src/java.management/share/classes/sun/management/resources/agent_de.properties Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#
-# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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.
-#
-
-agent.err.error = Fehler
-agent.err.exception = Ausnahme von Agent ausgel\u00F6st
-agent.err.warning = Warnung
-
-agent.err.configfile.notfound = Konfigurationsdatei wurde nicht gefunden
-agent.err.configfile.failed = Konfigurationsdatei konnte nicht gelesen werden
-agent.err.configfile.closed.failed = Konfigurationsdatei konnte nicht geschlossen werden
-agent.err.configfile.access.denied = Zugriff auf Konfigurationsdatei wurde abgelehnt
-
-agent.err.exportaddress.failed = Export der JMX-Connector-Adresse in Instrumentierungspuffer nicht erfolgreich
-
-agent.err.agentclass.notfound = Management Agent-Klasse nicht gefunden
-agent.err.agentclass.failed = Management Agent-Klasse nicht erfolgreich
-agent.err.premain.notfound = premain(String) ist in Agent-Klasse nicht vorhanden
-agent.err.agentclass.access.denied = Zugriff auf premain(String) wurde abgelehnt
-agent.err.invalid.agentclass = Ung\u00FCltiger Eigenschaftswert f\u00FCr com.sun.management.agent.class
-agent.err.invalid.state = Ung\u00FCltiger Agent-Zustand: {0}
-agent.err.invalid.jmxremote.port = Ung\u00FCltige Nummer f\u00FCr com.sun.management.jmxremote.port
-agent.err.invalid.jmxremote.rmi.port = Ung\u00FCltige Nummer f\u00FCr com.sun.management.jmxremote.rmi.port
-
-agent.err.file.not.set = Datei nicht angegeben
-agent.err.file.not.readable = Datei nicht lesbar
-agent.err.file.read.failed = Datei konnte nicht gelesen werden
-agent.err.file.not.found = Datei wurde nicht gefunden
-agent.err.file.access.not.restricted = Lesezugriff auf Datei muss eingeschr\u00E4nkt werden
-
-agent.err.password.file.notset = Es wurde keine Kennwortdatei angegeben, obwohl com.sun.management.jmxremote.authenticate auf "true" gesetzt ist
-agent.err.password.file.not.readable = Kennwortdatei nicht lesbar
-agent.err.password.file.read.failed = Kennwortdatei konnte nicht gelesen werden
-agent.err.password.file.notfound = Kennwortdatei nicht gefunden
-agent.err.password.file.access.notrestricted = Lesezugriff auf Kennwortdatei muss eingeschr\u00E4nkt werden
-
-agent.err.access.file.notset = Es wurde keine Zugriffsdatei angegeben, obwohl com.sun.management.jmxremote.authenticate auf "true" gesetzt ist
-agent.err.access.file.not.readable = Zugriffsdatei kann nicht gelesen werden
-agent.err.access.file.read.failed = Zugriffsdatei konnte nicht gelesen werden
-agent.err.access.file.notfound = Zugriffsdatei nicht gefunden
-
-agent.err.connector.server.io.error = Fehler bei JMX-Connector-Serverkommunikation
-
-agent.err.invalid.option = Ung\u00FCltige Option angegeben
-
-jmxremote.ConnectorBootstrap.starting = JMX-Connector-Server starten:
-jmxremote.ConnectorBootstrap.noAuthentication = Keine Authentifizierung
-jmxremote.ConnectorBootstrap.ready = JMX-Connector bereit unter: {0}
-jmxremote.ConnectorBootstrap.password.readonly = Lesezugriff auf Kennwortdatei muss eingeschr\u00E4nkt werden: {0}
-jmxremote.ConnectorBootstrap.file.readonly = Lesezugriff auf Datei muss eingeschr\u00E4nkt werden: {0}
--- a/jdk/src/java.management/share/classes/sun/management/resources/agent_es.properties Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#
-# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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.
-#
-
-agent.err.error = Error
-agent.err.exception = Excepci\u00F3n devuelta por el agente
-agent.err.warning = Advertencia
-
-agent.err.configfile.notfound = No se ha encontrado el archivo de configuraci\u00F3n
-agent.err.configfile.failed = Fallo al leer el archivo de configuraci\u00F3n
-agent.err.configfile.closed.failed = Fallo al cerrar el archivo de configuraci\u00F3n
-agent.err.configfile.access.denied = Acceso denegado al archivo de configuraci\u00F3n
-
-agent.err.exportaddress.failed = Fallo al exportar la direcci\u00F3n del conector JMX al buffer de instrumentaci\u00F3n
-
-agent.err.agentclass.notfound = Clase de agente de gesti\u00F3n no encontrada
-agent.err.agentclass.failed = Fallo de clase de agente de gesti\u00F3n
-agent.err.premain.notfound = premain(String) no existe en la clase del agente
-agent.err.agentclass.access.denied = Acceso denegado a premain(String)
-agent.err.invalid.agentclass = Valor de propiedad com.sun.management.agent.class no v\u00E1lido
-agent.err.invalid.state = Estado de agente no v\u00E1lido: {0}
-agent.err.invalid.jmxremote.port = N\u00FAmero com.sun.management.jmxremote.port no v\u00E1lido
-agent.err.invalid.jmxremote.rmi.port = N\u00FAmero com.sun.management.jmxremote.rmi.port no v\u00E1lido
-
-agent.err.file.not.set = Archivo no especificado
-agent.err.file.not.readable = Archivo ilegible
-agent.err.file.read.failed = Fallo al leer el archivo
-agent.err.file.not.found = Archivo no encontrado
-agent.err.file.access.not.restricted = El acceso de lectura al archivo debe ser restringido
-
-agent.err.password.file.notset = El archivo de contrase\u00F1as no se ha especificado, pero com.sun.management.jmxremote.authenticate=true
-agent.err.password.file.not.readable = No se puede leer el archivo de contrase\u00F1as
-agent.err.password.file.read.failed = Fallo al leer el archivo de contrase\u00F1as
-agent.err.password.file.notfound = Archivo de contrase\u00F1as no encontrado
-agent.err.password.file.access.notrestricted = Se debe restringir el acceso de lectura al archivo de contrase\u00F1as
-
-agent.err.access.file.notset = El archivo de acceso no se ha especificado, pero com.sun.management.jmxremote.authenticate=true
-agent.err.access.file.not.readable = No se puede leer el archivo de acceso
-agent.err.access.file.read.failed = Fallo al leer el archivo de acceso
-agent.err.access.file.notfound = Archivo de acceso no encontrado
-
-agent.err.connector.server.io.error = Error de comunicaci\u00F3n con el servidor de conector JMX
-
-agent.err.invalid.option = Opci\u00F3n especificada no v\u00E1lida
-
-jmxremote.ConnectorBootstrap.starting = Iniciando servidor de conector JMX:
-jmxremote.ConnectorBootstrap.noAuthentication = Sin autenticaci\u00F3n
-jmxremote.ConnectorBootstrap.ready = Conector JMX listo en: {0}
-jmxremote.ConnectorBootstrap.password.readonly = Se debe restringir el acceso de lectura al archivo de contrase\u00F1as: {0}
-jmxremote.ConnectorBootstrap.file.readonly = El acceso de lectura al archivo debe ser restringido: {0}
--- a/jdk/src/java.management/share/classes/sun/management/resources/agent_fr.properties Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#
-# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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.
-#
-
-agent.err.error = Erreur
-agent.err.exception = Exception envoy\u00E9e par l'agent
-agent.err.warning = Avertissement
-
-agent.err.configfile.notfound = Fichier de configuration introuvable
-agent.err.configfile.failed = Impossible de lire le fichier de configuration
-agent.err.configfile.closed.failed = Impossible de fermer le fichier de configuration
-agent.err.configfile.access.denied = Acc\u00E8s refus\u00E9 au fichier de configuration
-
-agent.err.exportaddress.failed = Impossible d'exporter l'adresse du connecteur JMX dans le tampon d'instrumentation
-
-agent.err.agentclass.notfound = Classe d'agents de gestion introuvable
-agent.err.agentclass.failed = Echec de la classe d'agents de gestion
-agent.err.premain.notfound = premain(String) n'existe pas dans la classe d'agents
-agent.err.agentclass.access.denied = Acc\u00E8s \u00E0 premain(String) refus\u00E9
-agent.err.invalid.agentclass = Valeur de propri\u00E9t\u00E9 com.sun.management.agent.class incorrecte
-agent.err.invalid.state = Etat de l''agent non valide : {0}
-agent.err.invalid.jmxremote.port = Num\u00E9ro com.sun.management.jmxremote.port incorrect
-agent.err.invalid.jmxremote.rmi.port = Num\u00E9ro com.sun.management.jmxremote.rmi.port non valide
-
-agent.err.file.not.set = Fichier non sp\u00E9cifi\u00E9
-agent.err.file.not.readable = Fichier illisible
-agent.err.file.read.failed = Impossible de lire le fichier
-agent.err.file.not.found = Fichier introuvable
-agent.err.file.access.not.restricted = L'acc\u00E8s en lecture au fichier doit \u00EAtre limit\u00E9
-
-agent.err.password.file.notset = Le fichier de mots de passe n'est pas sp\u00E9cifi\u00E9 mais com.sun.management.jmxremote.authenticate=true
-agent.err.password.file.not.readable = Fichier de mots de passe illisible
-agent.err.password.file.read.failed = Impossible de lire le fichier de mots de passe
-agent.err.password.file.notfound = Fichier de mots de passe introuvable
-agent.err.password.file.access.notrestricted = L'acc\u00E8s en lecture au fichier de mots de passe doit \u00EAtre limit\u00E9
-
-agent.err.access.file.notset = Le fichier d'acc\u00E8s n'est pas sp\u00E9cifi\u00E9 mais com.sun.management.jmxremote.authenticate=true
-agent.err.access.file.not.readable = Fichier d'acc\u00E8s illisible
-agent.err.access.file.read.failed = Impossible de lire le fichier d'acc\u00E8s
-agent.err.access.file.notfound = Fichier d'acc\u00E8s introuvable
-
-agent.err.connector.server.io.error = Erreur de communication avec le serveur du connecteur JMX
-
-agent.err.invalid.option = Option sp\u00E9cifi\u00E9e non valide
-
-jmxremote.ConnectorBootstrap.starting = D\u00E9marrage du serveur du connecteur JMX :
-jmxremote.ConnectorBootstrap.noAuthentication = Pas d'authentification
-jmxremote.ConnectorBootstrap.ready = Connecteur JMX pr\u00EAt \u00E0 : {0}
-jmxremote.ConnectorBootstrap.password.readonly = L''acc\u00E8s en lecture au fichier de mots de passe doit \u00EAtre limit\u00E9 : {0}
-jmxremote.ConnectorBootstrap.file.readonly = L''acc\u00E8s en lecture au fichier doit \u00EAtre limit\u00E9 : {0}
--- a/jdk/src/java.management/share/classes/sun/management/resources/agent_it.properties Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#
-# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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.
-#
-
-agent.err.error = Errore
-agent.err.exception = Eccezione dell'agente
-agent.err.warning = Avvertenza
-
-agent.err.configfile.notfound = File di configurazione non trovato
-agent.err.configfile.failed = Errore di lettura file di configurazione
-agent.err.configfile.closed.failed = Errore di chiusura file di configurazione
-agent.err.configfile.access.denied = Accesso negato al file di configurazione
-
-agent.err.exportaddress.failed = Errore di esportazione dell'indirizzo connettore JMX nel buffer strumenti
-
-agent.err.agentclass.notfound = Classe agente gestione non trovata
-agent.err.agentclass.failed = Errore classe agente gestione
-agent.err.premain.notfound = premain(String) non esiste nella classe agente
-agent.err.agentclass.access.denied = Accesso negato a premain(String)
-agent.err.invalid.agentclass = Valore propriet\u00E0 com.sun.management.agent.class non valido
-agent.err.invalid.state = Stato agente non valido: {0}
-agent.err.invalid.jmxremote.port = Numero com.sun.management.jmxremote.port non valido
-agent.err.invalid.jmxremote.rmi.port = Numero com.sun.management.jmxremote.rmi.port non valido
-
-agent.err.file.not.set = File non specificato
-agent.err.file.not.readable = File non leggibile
-agent.err.file.read.failed = Errore di lettura file
-agent.err.file.not.found = File non trovato
-agent.err.file.access.not.restricted = Limitare l'accesso in lettura al file
-
-agent.err.password.file.notset = Il password file non \u00E8 specificato ma com.sun.management.jmxremote.authenticate=true
-agent.err.password.file.not.readable = Password file non leggibile
-agent.err.password.file.read.failed = Errore di lettura password file
-agent.err.password.file.notfound = Password file non trovato
-agent.err.password.file.access.notrestricted = Limitare l'accesso in lettura al password file
-
-agent.err.access.file.notset = Il file di accesso non \u00E8 specificato ma com.sun.management.jmxremote.authenticate=true
-agent.err.access.file.not.readable = File di accesso non leggibile
-agent.err.access.file.read.failed = Errore di lettura file di accesso
-agent.err.access.file.notfound = File di accesso non trovato
-
-agent.err.connector.server.io.error = Errore di comunicazione server del connettore JMX
-
-agent.err.invalid.option = Specificata opzione non valida
-
-jmxremote.ConnectorBootstrap.starting = Avvio del server connettore JMX:
-jmxremote.ConnectorBootstrap.noAuthentication = Nessuna autenticazione
-jmxremote.ConnectorBootstrap.ready = Connettore JMX pronto in: {0}
-jmxremote.ConnectorBootstrap.password.readonly = Limitare l''accesso in lettura al password file: {0}
-jmxremote.ConnectorBootstrap.file.readonly = Limitare l''accesso in lettura al file: {0}
--- a/jdk/src/java.management/share/classes/sun/management/resources/agent_ja.properties Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#
-# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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.
-#
-
-agent.err.error = \u30A8\u30E9\u30FC
-agent.err.exception = \u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u304C\u4F8B\u5916\u3092\u30B9\u30ED\u30FC\u3057\u307E\u3057\u305F
-agent.err.warning = \u8B66\u544A
-
-agent.err.configfile.notfound = \u69CB\u6210\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
-agent.err.configfile.failed = \u69CB\u6210\u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u306B\u5931\u6557\u3057\u307E\u3057\u305F
-agent.err.configfile.closed.failed = \u69CB\u6210\u30D5\u30A1\u30A4\u30EB\u3092\u9589\u3058\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
-agent.err.configfile.access.denied = \u69CB\u6210\u30D5\u30A1\u30A4\u30EB\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u304C\u62D2\u5426\u3055\u308C\u307E\u3057\u305F
-
-agent.err.exportaddress.failed = JMX\u30B3\u30CD\u30AF\u30BF\u30FB\u30A2\u30C9\u30EC\u30B9\u306E\u8A08\u6E2C\u30D0\u30C3\u30D5\u30A1\u3078\u306E\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8\u304C\u5931\u6557\u3057\u307E\u3057\u305F
-
-agent.err.agentclass.notfound = \u7BA1\u7406\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30AF\u30E9\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
-agent.err.agentclass.failed = \u7BA1\u7406\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30AF\u30E9\u30B9\u304C\u5931\u6557\u3057\u307E\u3057\u305F
-agent.err.premain.notfound = premain(String)\u304C\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30AF\u30E9\u30B9\u306B\u5B58\u5728\u3057\u307E\u305B\u3093
-agent.err.agentclass.access.denied = premain(String)\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u304C\u62D2\u5426\u3055\u308C\u307E\u3057\u305F
-agent.err.invalid.agentclass = com.sun.management.agent.class\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u5024\u304C\u7121\u52B9\u3067\u3059
-agent.err.invalid.state = \u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u306E\u72B6\u614B\u304C\u7121\u52B9\u3067\u3059: {0}
-agent.err.invalid.jmxremote.port = com.sun.management.jmxremote.port\u306E\u756A\u53F7\u304C\u7121\u52B9\u3067\u3059
-agent.err.invalid.jmxremote.rmi.port = com.sun.management.jmxremote.rmi.port\u306E\u756A\u53F7\u304C\u7121\u52B9\u3067\u3059
-
-agent.err.file.not.set = \u30D5\u30A1\u30A4\u30EB\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
-agent.err.file.not.readable = \u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u307F\u53D6\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093
-agent.err.file.read.failed = \u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u306B\u5931\u6557\u3057\u307E\u3057\u305F
-agent.err.file.not.found = \u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F
-agent.err.file.access.not.restricted = \u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u30A2\u30AF\u30BB\u30B9\u306F\u5236\u9650\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
-
-agent.err.password.file.notset = \u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u304C\u3001com.sun.management.jmxremote.authenticate=true\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059
-agent.err.password.file.not.readable = \u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u307F\u53D6\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093
-agent.err.password.file.read.failed = \u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u306B\u5931\u6557\u3057\u307E\u3057\u305F
-agent.err.password.file.notfound = \u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
-agent.err.password.file.access.notrestricted = \u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u30A2\u30AF\u30BB\u30B9\u306F\u5236\u9650\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
-
-agent.err.access.file.notset = \u30A2\u30AF\u30BB\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u304C\u3001com.sun.management.jmxremote.authenticate=true\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059
-agent.err.access.file.not.readable = \u30A2\u30AF\u30BB\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u307F\u53D6\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093
-agent.err.access.file.read.failed = \u30A2\u30AF\u30BB\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u306B\u5931\u6557\u3057\u307E\u3057\u305F
-agent.err.access.file.notfound = \u30A2\u30AF\u30BB\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
-
-agent.err.connector.server.io.error = JMX\u30B3\u30CD\u30AF\u30BF\u30FB\u30B5\u30FC\u30D0\u30FC\u306E\u901A\u4FE1\u30A8\u30E9\u30FC
-
-agent.err.invalid.option = \u7121\u52B9\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u304C\u6307\u5B9A\u3055\u308C\u307E\u3057\u305F
-
-jmxremote.ConnectorBootstrap.starting = JMX\u30B3\u30CD\u30AF\u30BF\u30FB\u30B5\u30FC\u30D0\u30FC\u3092\u8D77\u52D5\u3057\u3066\u3044\u307E\u3059:
-jmxremote.ConnectorBootstrap.noAuthentication = \u8A8D\u8A3C\u306A\u3057
-jmxremote.ConnectorBootstrap.ready = JMX\u30B3\u30CD\u30AF\u30BF\u306E\u6E96\u5099\u304C\u3067\u304D\u307E\u3057\u305F: {0}
-jmxremote.ConnectorBootstrap.password.readonly = \u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u30A2\u30AF\u30BB\u30B9\u306F\u5236\u9650\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {0}
-jmxremote.ConnectorBootstrap.file.readonly = \u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u30A2\u30AF\u30BB\u30B9\u306F\u5236\u9650\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {0}
--- a/jdk/src/java.management/share/classes/sun/management/resources/agent_ko.properties Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#
-# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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.
-#
-
-agent.err.error = \uC624\uB958
-agent.err.exception = \uC5D0\uC774\uC804\uD2B8\uC5D0 \uC608\uC678\uC0AC\uD56D\uC774 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.
-agent.err.warning = \uACBD\uACE0
-
-agent.err.configfile.notfound = \uAD6C\uC131 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-agent.err.configfile.failed = \uAD6C\uC131 \uD30C\uC77C \uC77D\uAE30\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
-agent.err.configfile.closed.failed = \uAD6C\uC131 \uD30C\uC77C \uB2EB\uAE30\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
-agent.err.configfile.access.denied = \uAD6C\uC131 \uD30C\uC77C\uC5D0 \uB300\uD55C \uC561\uC138\uC2A4\uAC00 \uAC70\uBD80\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
-
-agent.err.exportaddress.failed = \uAE30\uAE30 \uBC84\uD37C\uB85C JMX \uCEE4\uB125\uD130 \uC8FC\uC18C \uC775\uC2A4\uD3EC\uD2B8\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
-
-agent.err.agentclass.notfound = \uAD00\uB9AC \uC5D0\uC774\uC804\uD2B8 \uD074\uB798\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-agent.err.agentclass.failed = \uAD00\uB9AC \uC5D0\uC774\uC804\uD2B8 \uD074\uB798\uC2A4\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
-agent.err.premain.notfound = \uC5D0\uC774\uC804\uD2B8 \uD074\uB798\uC2A4\uC5D0 premain(\uBB38\uC790\uC5F4)\uC774 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
-agent.err.agentclass.access.denied = premain(\uBB38\uC790\uC5F4)\uC5D0 \uB300\uD55C \uC561\uC138\uC2A4\uAC00 \uAC70\uBD80\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
-agent.err.invalid.agentclass = com.sun.management.agent.class \uC18D\uC131 \uAC12\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
-agent.err.invalid.state = \uBD80\uC801\uD569\uD55C \uC5D0\uC774\uC804\uD2B8 \uC0C1\uD0DC: {0}
-agent.err.invalid.jmxremote.port = com.sun.management.jmxremote.port \uBC88\uD638\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
-agent.err.invalid.jmxremote.rmi.port = \uBD80\uC801\uD569\uD55C com.sun.management.jmxremote.rmi.port \uBC88\uD638
-
-agent.err.file.not.set = \uD30C\uC77C\uC774 \uC9C0\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.
-agent.err.file.not.readable = \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-agent.err.file.read.failed = \uD30C\uC77C \uC77D\uAE30\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
-agent.err.file.not.found = \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-agent.err.file.access.not.restricted = \uD30C\uC77C \uC77D\uAE30 \uC561\uC138\uC2A4\uB294 \uC81C\uD55C\uB418\uC5B4\uC57C \uD569\uB2C8\uB2E4.
-
-agent.err.password.file.notset = \uBE44\uBC00\uBC88\uD638 \uD30C\uC77C\uC774 \uC9C0\uC815\uB418\uC9C0 \uC54A\uC558\uC9C0\uB9CC com.sun.management.jmxremote.authenticate=true\uC785\uB2C8\uB2E4.
-agent.err.password.file.not.readable = \uBE44\uBC00\uBC88\uD638 \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-agent.err.password.file.read.failed = \uBE44\uBC00\uBC88\uD638 \uD30C\uC77C \uC77D\uAE30\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
-agent.err.password.file.notfound = \uBE44\uBC00\uBC88\uD638 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-agent.err.password.file.access.notrestricted = \uBE44\uBC00\uBC88\uD638 \uD30C\uC77C \uC77D\uAE30 \uC561\uC138\uC2A4\uB294 \uC81C\uD55C\uB418\uC5B4\uC57C \uD569\uB2C8\uB2E4.
-
-agent.err.access.file.notset = \uC561\uC138\uC2A4 \uD30C\uC77C\uC774 \uC9C0\uC815\uB418\uC9C0 \uC54A\uC558\uC9C0\uB9CC com.sun.management.jmxremote.authenticate=true\uC785\uB2C8\uB2E4.
-agent.err.access.file.not.readable = \uC561\uC138\uC2A4 \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-agent.err.access.file.read.failed = \uC561\uC138\uC2A4 \uD30C\uC77C \uC77D\uAE30\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
-agent.err.access.file.notfound = \uC561\uC138\uC2A4 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-
-agent.err.connector.server.io.error = JMX \uCEE4\uB125\uD130 \uC11C\uBC84 \uD1B5\uC2E0 \uC624\uB958
-
-agent.err.invalid.option = \uBD80\uC801\uD569\uD55C \uC635\uC158\uC774 \uC9C0\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
-
-jmxremote.ConnectorBootstrap.starting = JMX \uCEE4\uB125\uD130 \uC11C\uBC84\uB97C \uC2DC\uC791\uD558\uB294 \uC911:
-jmxremote.ConnectorBootstrap.noAuthentication = \uC778\uC99D \uC5C6\uC74C
-jmxremote.ConnectorBootstrap.ready = {0}\uC5D0\uC11C JMX \uCEE4\uB125\uD130\uAC00 \uC900\uBE44\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
-jmxremote.ConnectorBootstrap.password.readonly = \uBE44\uBC00\uBC88\uD638 \uD30C\uC77C \uC77D\uAE30 \uC561\uC138\uC2A4\uB294 \uC81C\uD55C\uB418\uC5B4\uC57C \uD568: {0}
-jmxremote.ConnectorBootstrap.file.readonly = \uD30C\uC77C \uC77D\uAE30 \uC561\uC138\uC2A4\uB294 \uC81C\uD55C\uB418\uC5B4\uC57C \uD568: {0}
--- a/jdk/src/java.management/share/classes/sun/management/resources/agent_pt_BR.properties Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#
-# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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.
-#
-
-agent.err.error = Erro
-agent.err.exception = Exce\u00E7\u00E3o gerada pelo agente
-agent.err.warning = Advert\u00EAncia
-
-agent.err.configfile.notfound = Arquivo de configura\u00E7\u00E3o n\u00E3o encontrado
-agent.err.configfile.failed = Falha ao ler o arquivo de configura\u00E7\u00E3o
-agent.err.configfile.closed.failed = Falha ao fechar o arquivo de configura\u00E7\u00E3o
-agent.err.configfile.access.denied = Acesso negado ao arquivo de configura\u00E7\u00E3o
-
-agent.err.exportaddress.failed = Falha na exporta\u00E7\u00E3o do endere\u00E7o do conector JMX para o buffer de instrumenta\u00E7\u00E3o
-
-agent.err.agentclass.notfound = Classe do agente de gerenciamento n\u00E3o encontrada
-agent.err.agentclass.failed = Falha na classe do agente de gerenciamento
-agent.err.premain.notfound = premain(String) n\u00E3o existe na classe do agente
-agent.err.agentclass.access.denied = Acesso negado a premain(String)
-agent.err.invalid.agentclass = Valor inv\u00E1lido da propriedade com.sun.management.agent.class
-agent.err.invalid.state = Estado inv\u00E1lido do agente: {0}
-agent.err.invalid.jmxremote.port = N\u00FAmero inv\u00E1lido de com.sun.management.jmxremote.port
-agent.err.invalid.jmxremote.rmi.port = N\u00FAmero inv\u00E1lido do com.sun.management.jmxremote.rmi.port
-
-agent.err.file.not.set = Arquivo n\u00E3o especificado
-agent.err.file.not.readable = Arquivo ileg\u00EDvel
-agent.err.file.read.failed = Falha ao ler o arquivo
-agent.err.file.not.found = Arquivo n\u00E3o encontrado
-agent.err.file.access.not.restricted = O acesso de leitura do arquivo deve ser limitado
-
-agent.err.password.file.notset = O arquivo de senha n\u00E3o est\u00E1 especificado, mas com.sun.management.jmxremote.authenticate=true
-agent.err.password.file.not.readable = Arquivo de senha ileg\u00EDvel
-agent.err.password.file.read.failed = Falha ao ler o arquivo de senha
-agent.err.password.file.notfound = Arquivo de senha n\u00E3o encontrado
-agent.err.password.file.access.notrestricted = O acesso de leitura do arquivo de senha deve ser limitado
-
-agent.err.access.file.notset = O arquivo de acesso n\u00E3o est\u00E1 especificado, mas com.sun.management.jmxremote.authenticate=true
-agent.err.access.file.not.readable = Arquivo de acesso ileg\u00EDvel
-agent.err.access.file.read.failed = Falha ao ler o arquivo de acesso
-agent.err.access.file.notfound = Arquivo de acesso n\u00E3o encontrado
-
-agent.err.connector.server.io.error = Erro de comunica\u00E7\u00E3o do servidor do conector JMX
-
-agent.err.invalid.option = Op\u00E7\u00E3o especificada inv\u00E1lida
-
-jmxremote.ConnectorBootstrap.starting = Iniciando o Servidor do Conector JMX:
-jmxremote.ConnectorBootstrap.noAuthentication = Sem autentica\u00E7\u00E3o
-jmxremote.ConnectorBootstrap.ready = Conector JMX pronto em: {0}
-jmxremote.ConnectorBootstrap.password.readonly = O acesso de leitura do arquivo de senha deve ser limitado: {0}
-jmxremote.ConnectorBootstrap.file.readonly = O acesso de leitura do arquivo deve ser limitado: {0}
--- a/jdk/src/java.management/share/classes/sun/management/resources/agent_sv.properties Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#
-# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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.
-#
-
-agent.err.error = Fel
-agent.err.exception = Agenten orsakade ett undantag
-agent.err.warning = Varning
-
-agent.err.configfile.notfound = Konfigurationsfilen hittades inte
-agent.err.configfile.failed = Kunde inte l\u00E4sa konfigurationsfilen
-agent.err.configfile.closed.failed = Kunde inte st\u00E4nga konfigurationsfilen
-agent.err.configfile.access.denied = \u00C5tkomst till konfigurationsfilen nekad
-
-agent.err.exportaddress.failed = Kunde inte exportera JMX-anslutningsadressen till instrumentbufferten
-
-agent.err.agentclass.notfound = Administrationsagentklassen hittades inte
-agent.err.agentclass.failed = Administrationsagentklassen utf\u00F6rdes inte
-agent.err.premain.notfound = premain(String) finns inte i agentklassen
-agent.err.agentclass.access.denied = \u00C5tkomst till premain(String) nekad
-agent.err.invalid.agentclass = Ogiltigt egenskapsv\u00E4rde f\u00F6r com.sun.management.agent.class
-agent.err.invalid.state = Ogiltig agentstatus: {0}
-agent.err.invalid.jmxremote.port = Ogiltigt com.sun.management.jmxremote.port-nummer
-agent.err.invalid.jmxremote.rmi.port = Ogiltigt com.sun.management.jmxremote.rmi.port-nummer
-
-agent.err.file.not.set = Filen \u00E4r inte angiven
-agent.err.file.not.readable = Filen \u00E4r inte l\u00E4sbar
-agent.err.file.read.failed = Kunde inte l\u00E4sa filen
-agent.err.file.not.found = Filen hittades inte
-agent.err.file.access.not.restricted = Fill\u00E4snings\u00E5tkomst m\u00E5ste begr\u00E4nsas
-
-agent.err.password.file.notset = L\u00F6senordsfilen har inte angetts men com.sun.management.jmxremote.authenticate=true
-agent.err.password.file.not.readable = L\u00F6senordsfilen \u00E4r inte l\u00E4sbar
-agent.err.password.file.read.failed = Kunde inte l\u00E4sa l\u00F6senordsfilen
-agent.err.password.file.notfound = Hittar inte l\u00F6senordsfilen
-agent.err.password.file.access.notrestricted = L\u00E4sbeh\u00F6righeten f\u00F6r filen m\u00E5ste begr\u00E4nsas
-
-agent.err.access.file.notset = \u00C5tkomstfilen har inte angetts men com.sun.management.jmxremote.authenticate=true
-agent.err.access.file.not.readable = Access-filen \u00E4r inte l\u00E4sbar
-agent.err.access.file.read.failed = Kunde inte l\u00E4sa \u00E5tkomstfilen
-agent.err.access.file.notfound = Access-filen hittades inte
-
-agent.err.connector.server.io.error = Serverkommunikationsfel f\u00F6r JMX-anslutning
-
-agent.err.invalid.option = Det angivna alternativet \u00E4r ogiltigt
-
-jmxremote.ConnectorBootstrap.starting = Startar server f\u00F6r JMX-anslutning:
-jmxremote.ConnectorBootstrap.noAuthentication = Ingen autentisering
-jmxremote.ConnectorBootstrap.ready = JMX-anslutning redo p\u00E5: {0}
-jmxremote.ConnectorBootstrap.password.readonly = L\u00E4sbeh\u00F6righeten f\u00F6r l\u00F6senordsfilen m\u00E5ste begr\u00E4nsas: {0}
-jmxremote.ConnectorBootstrap.file.readonly = Fill\u00E4snings\u00E5tkomst m\u00E5ste begr\u00E4nsas {0}
--- a/jdk/src/java.management/share/classes/sun/management/resources/agent_zh_CN.properties Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#
-# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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.
-#
-
-agent.err.error = \u9519\u8BEF
-agent.err.exception = \u4EE3\u7406\u629B\u51FA\u5F02\u5E38\u9519\u8BEF
-agent.err.warning = \u8B66\u544A
-
-agent.err.configfile.notfound = \u627E\u4E0D\u5230\u914D\u7F6E\u6587\u4EF6
-agent.err.configfile.failed = \u672A\u80FD\u8BFB\u53D6\u914D\u7F6E\u6587\u4EF6
-agent.err.configfile.closed.failed = \u672A\u80FD\u5173\u95ED\u914D\u7F6E\u6587\u4EF6
-agent.err.configfile.access.denied = \u62D2\u7EDD\u8BBF\u95EE\u914D\u7F6E\u6587\u4EF6
-
-agent.err.exportaddress.failed = \u672A\u80FD\u5C06 JMX \u8FDE\u63A5\u5668\u5730\u5740\u5BFC\u51FA\u5230\u68C0\u6D4B\u7F13\u51B2\u533A
-
-agent.err.agentclass.notfound = \u627E\u4E0D\u5230\u7BA1\u7406\u4EE3\u7406\u7C7B
-agent.err.agentclass.failed = \u7BA1\u7406\u4EE3\u7406\u7C7B\u5931\u8D25
-agent.err.premain.notfound = \u4EE3\u7406\u7C7B\u4E2D\u4E0D\u5B58\u5728 premain(String)
-agent.err.agentclass.access.denied = \u62D2\u7EDD\u8BBF\u95EE premain(String)
-agent.err.invalid.agentclass = com.sun.management.agent.class \u5C5E\u6027\u503C\u65E0\u6548
-agent.err.invalid.state = \u65E0\u6548\u7684\u4EE3\u7406\u72B6\u6001: {0}
-agent.err.invalid.jmxremote.port = com.sun.management.jmxremote.port \u7F16\u53F7\u65E0\u6548
-agent.err.invalid.jmxremote.rmi.port = com.sun.management.jmxremote.rmi.port \u7F16\u53F7\u65E0\u6548
-
-agent.err.file.not.set = \u672A\u6307\u5B9A\u6587\u4EF6
-agent.err.file.not.readable = \u6587\u4EF6\u4E0D\u53EF\u8BFB\u53D6
-agent.err.file.read.failed = \u672A\u80FD\u8BFB\u53D6\u6587\u4EF6
-agent.err.file.not.found = \u627E\u4E0D\u5230\u6587\u4EF6
-agent.err.file.access.not.restricted = \u5FC5\u987B\u9650\u5236\u6587\u4EF6\u8BFB\u53D6\u8BBF\u95EE\u6743\u9650
-
-agent.err.password.file.notset = \u672A\u6307\u5B9A\u53E3\u4EE4\u6587\u4EF6, \u4F46 com.sun.management.jmxremote.authenticate=true
-agent.err.password.file.not.readable = \u53E3\u4EE4\u6587\u4EF6\u4E0D\u53EF\u8BFB\u53D6
-agent.err.password.file.read.failed = \u8BFB\u53D6\u53E3\u4EE4\u6587\u4EF6\u5931\u8D25
-agent.err.password.file.notfound = \u627E\u4E0D\u5230\u53E3\u4EE4\u6587\u4EF6
-agent.err.password.file.access.notrestricted = \u5FC5\u987B\u9650\u5236\u53E3\u4EE4\u6587\u4EF6\u8BFB\u53D6\u8BBF\u95EE\u6743\u9650
-
-agent.err.access.file.notset = \u672A\u6307\u5B9A\u8BBF\u95EE\u6587\u4EF6, \u4F46 com.sun.management.jmxremote.authenticate=true
-agent.err.access.file.not.readable = \u8BBF\u95EE\u6587\u4EF6\u4E0D\u53EF\u8BFB\u53D6
-agent.err.access.file.read.failed = \u8BFB\u53D6\u8BBF\u95EE\u6587\u4EF6\u5931\u8D25
-agent.err.access.file.notfound = \u627E\u4E0D\u5230\u8BBF\u95EE\u6587\u4EF6
-
-agent.err.connector.server.io.error = JMX \u8FDE\u63A5\u5668\u670D\u52A1\u5668\u901A\u4FE1\u9519\u8BEF
-
-agent.err.invalid.option = \u6307\u5B9A\u7684\u9009\u9879\u65E0\u6548
-
-jmxremote.ConnectorBootstrap.starting = \u6B63\u5728\u542F\u52A8 JMX \u8FDE\u63A5\u5668\u670D\u52A1\u5668:
-jmxremote.ConnectorBootstrap.noAuthentication = \u65E0\u9A8C\u8BC1
-jmxremote.ConnectorBootstrap.ready = \u4F4D\u4E8E{0}\u7684 JMX \u8FDE\u63A5\u5668\u5DF2\u5C31\u7EEA
-jmxremote.ConnectorBootstrap.password.readonly = \u5FC5\u987B\u9650\u5236\u53E3\u4EE4\u6587\u4EF6\u8BFB\u53D6\u8BBF\u95EE\u6743\u9650: {0}
-jmxremote.ConnectorBootstrap.file.readonly = \u5FC5\u987B\u9650\u5236\u6587\u4EF6\u8BFB\u53D6\u8BBF\u95EE\u6743\u9650: {0}
--- a/jdk/src/java.management/share/classes/sun/management/resources/agent_zh_TW.properties Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#
-# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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.
-#
-
-agent.err.error = \u932F\u8AA4
-agent.err.exception = \u4EE3\u7406\u7A0B\u5F0F\u767C\u751F\u7570\u5E38
-agent.err.warning = \u8B66\u544A
-
-agent.err.configfile.notfound = \u627E\u4E0D\u5230\u8A2D\u5B9A\u6A94\u6848
-agent.err.configfile.failed = \u7121\u6CD5\u8B80\u53D6\u8A2D\u5B9A\u6A94\u6848
-agent.err.configfile.closed.failed = \u7121\u6CD5\u95DC\u9589\u8A2D\u5B9A\u6A94\u6848
-agent.err.configfile.access.denied = \u5B58\u53D6\u8A2D\u5B9A\u6A94\u6848\u906D\u5230\u62D2\u7D55
-
-agent.err.exportaddress.failed = \u5C07 JMX \u9023\u63A5\u5668\u4F4D\u5740\u532F\u51FA\u81F3\u8A2D\u5099\u7DE9\u885D\u5340\u5931\u6557
-
-agent.err.agentclass.notfound = \u627E\u4E0D\u5230\u7BA1\u7406\u4EE3\u7406\u7A0B\u5F0F\u985E\u5225
-agent.err.agentclass.failed = \u7BA1\u7406\u4EE3\u7406\u7A0B\u5F0F\u985E\u5225\u5931\u6557
-agent.err.premain.notfound = \u4EE3\u7406\u7A0B\u5F0F\u985E\u5225\u4E2D\u4E0D\u5B58\u5728 premain(String)
-agent.err.agentclass.access.denied = \u5B58\u53D6 premain(String) \u906D\u5230\u62D2\u7D55
-agent.err.invalid.agentclass = com.sun.management.agent.class \u5C6C\u6027\u503C\u7121\u6548
-agent.err.invalid.state = \u7121\u6548\u7684\u4EE3\u7406\u7A0B\u5F0F\u72C0\u614B: {0}
-agent.err.invalid.jmxremote.port = com.sun.management.jmxremote.port \u865F\u78BC\u7121\u6548
-agent.err.invalid.jmxremote.rmi.port = com.sun.management.jmxremote.rmi.port \u865F\u78BC\u7121\u6548
-
-agent.err.file.not.set = \u672A\u6307\u5B9A\u6A94\u6848
-agent.err.file.not.readable = \u6A94\u6848\u7121\u6CD5\u8B80\u53D6
-agent.err.file.read.failed = \u7121\u6CD5\u8B80\u53D6\u6A94\u6848
-agent.err.file.not.found = \u627E\u4E0D\u5230\u6A94\u6848
-agent.err.file.access.not.restricted = \u5FC5\u9808\u9650\u5236\u6A94\u6848\u8B80\u53D6\u5B58\u53D6\u6B0A
-
-agent.err.password.file.notset = \u672A\u6307\u5B9A\u5BC6\u78BC\u6A94\u6848\uFF0C\u4F46 com.sun.management.jmxremote.authenticate=true
-agent.err.password.file.not.readable = \u5BC6\u78BC\u6A94\u6848\u7121\u6CD5\u8B80\u53D6
-agent.err.password.file.read.failed = \u7121\u6CD5\u8B80\u53D6\u5BC6\u78BC\u6A94\u6848
-agent.err.password.file.notfound = \u627E\u4E0D\u5230\u5BC6\u78BC\u6A94\u6848
-agent.err.password.file.access.notrestricted = \u5FC5\u9808\u9650\u5236\u5BC6\u78BC\u6A94\u6848\u8B80\u53D6\u5B58\u53D6
-
-agent.err.access.file.notset = \u672A\u6307\u5B9A\u5B58\u53D6\u6A94\u6848\uFF0C\u4F46 com.sun.management.jmxremote.authenticate=true
-agent.err.access.file.not.readable = \u5B58\u53D6\u6A94\u6848\u7121\u6CD5\u8B80\u53D6
-agent.err.access.file.read.failed = \u7121\u6CD5\u8B80\u53D6\u5B58\u53D6\u6A94\u6848
-agent.err.access.file.notfound = \u627E\u4E0D\u5230\u5B58\u53D6\u6A94\u6848
-
-agent.err.connector.server.io.error = JMX \u9023\u63A5\u5668\u4F3A\u670D\u5668\u901A\u8A0A\u932F\u8AA4
-
-agent.err.invalid.option = \u6307\u5B9A\u7684\u9078\u9805\u7121\u6548
-
-jmxremote.ConnectorBootstrap.starting = \u6B63\u5728\u555F\u52D5 JMX \u9023\u63A5\u5668\u4F3A\u670D\u5668:
-jmxremote.ConnectorBootstrap.noAuthentication = \u7121\u8A8D\u8B49
-jmxremote.ConnectorBootstrap.ready = JMX \u9023\u63A5\u5668\u5C31\u7DD2\uFF0C\u4F4D\u65BC: {0}
-jmxremote.ConnectorBootstrap.password.readonly = \u5FC5\u9808\u9650\u5236\u5BC6\u78BC\u6A94\u6848\u8B80\u53D6\u5B58\u53D6: {0}
-jmxremote.ConnectorBootstrap.file.readonly = \u5FC5\u9808\u9650\u5236\u6A94\u6848\u8B80\u53D6\u5B58\u53D6\u6B0A: {0}
--- a/jdk/src/java.management/share/classes/sun/management/spi/AgentProvider.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.management.spi;
-
-import java.util.Properties;
-
-/**
- * Service interface for management agent
- */
-public abstract class AgentProvider {
-
- /**
- * Instantiates a new AgentProvider.
- *
- * @throws SecurityException if the subclass (and calling code) does not
- * have
- * {@code RuntimePermission("sun.management.spi.AgentProvider.subclass")}
- */
- protected AgentProvider() {
- this(checkSubclassPermission());
- }
-
- private AgentProvider(Void unused) {
- }
-
- private static Void checkSubclassPermission() {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null) {
- sm.checkPermission(new RuntimePermission(AgentProvider.class.getName() + ".subclass"));
- }
- return null;
- }
-
- /**
- * Gets the name of the agent provider.
- *
- * @return name of agent provider
- */
- public abstract String getName();
-
- /**
- * Initializes and starts the agent.
- *
- * @throws IllegalStateException if this agent has already been started.
- */
- public abstract void startAgent();
-
- /**
- * Initializes and starts the agent at given port and with given properties
- *
- * @param props environment variables for agent
- *
- * @throws IllegalStateException if this agent has already been started.
- */
- public abstract void startAgent(Properties props);
-
- /**
- * Checks if agent is started and not terminated.
- *
- * @return true if agent is running, false otherwise.
- */
- public abstract boolean isActive();
-
- /**
- * Stops this agent.
- *
- * @throws IllegalStateException if this agent is not started.
- */
- public abstract void stopAgent();
-}
--- a/jdk/src/java.management/share/conf/jmxremote.access Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-######################################################################
-# Default Access Control File for Remote JMX(TM) Monitoring
-######################################################################
-#
-# Access control file for Remote JMX API access to monitoring.
-# This file defines the allowed access for different roles. The
-# password file (jmxremote.password by default) defines the roles and their
-# passwords. To be functional, a role must have an entry in
-# both the password and the access files.
-#
-# The default location of this file is $JRE/conf/management/jmxremote.access
-# You can specify an alternate location by specifying a property in
-# the management config file $JRE/conf/management/management.properties
-# (See that file for details)
-#
-# The file format for password and access files is syntactically the same
-# as the Properties file format. The syntax is described in the Javadoc
-# for java.util.Properties.load.
-# A typical access file has multiple lines, where each line is blank,
-# a comment (like this one), or an access control entry.
-#
-# An access control entry consists of a role name, and an
-# associated access level. The role name is any string that does not
-# itself contain spaces or tabs. It corresponds to an entry in the
-# password file (jmxremote.password). The access level is one of the
-# following:
-# "readonly" grants access to read attributes of MBeans.
-# For monitoring, this means that a remote client in this
-# role can read measurements but cannot perform any action
-# that changes the environment of the running program.
-# "readwrite" grants access to read and write attributes of MBeans,
-# to invoke operations on them, and optionally
-# to create or remove them. This access should be granted
-# only to trusted clients, since they can potentially
-# interfere with the smooth operation of a running program.
-#
-# The "readwrite" access level can optionally be followed by the "create" and/or
-# "unregister" keywords. The "unregister" keyword grants access to unregister
-# (delete) MBeans. The "create" keyword grants access to create MBeans of a
-# particular class or of any class matching a particular pattern. Access
-# should only be granted to create MBeans of known and trusted classes.
-#
-# For example, the following entry would grant readwrite access
-# to "controlRole", as well as access to create MBeans of the class
-# javax.management.monitor.CounterMonitor and to unregister any MBean:
-# controlRole readwrite \
-# create javax.management.monitor.CounterMonitorMBean \
-# unregister
-# or equivalently:
-# controlRole readwrite unregister create javax.management.monitor.CounterMBean
-#
-# The following entry would grant readwrite access as well as access to create
-# MBeans of any class in the packages javax.management.monitor and
-# javax.management.timer:
-# controlRole readwrite \
-# create javax.management.monitor.*,javax.management.timer.* \
-# unregister
-#
-# The \ character is defined in the Properties file syntax to allow continuation
-# lines as shown here. A * in a class pattern matches a sequence of characters
-# other than dot (.), so javax.management.monitor.* matches
-# javax.management.monitor.CounterMonitor but not
-# javax.management.monitor.foo.Bar.
-#
-# A given role should have at most one entry in this file. If a role
-# has no entry, it has no access.
-# If multiple entries are found for the same role name, then the last
-# access entry is used.
-#
-#
-# Default access control entries:
-# o The "monitorRole" role has readonly access.
-# o The "controlRole" role has readwrite access and can create the standard
-# Timer and Monitor MBeans defined by the JMX API.
-
-monitorRole readonly
-controlRole readwrite \
- create javax.management.monitor.*,javax.management.timer.* \
- unregister
--- a/jdk/src/java.management/share/conf/jmxremote.password.template Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-# ----------------------------------------------------------------------
-# Template for jmxremote.password
-#
-# o Copy this template to jmxremote.password
-# o Set the user/password entries in jmxremote.password
-# o Change the permission of jmxremote.password to read-only
-# by the owner.
-#
-# See below for the location of jmxremote.password file.
-# ----------------------------------------------------------------------
-
-##############################################################
-# Password File for Remote JMX Monitoring
-##############################################################
-#
-# Password file for Remote JMX API access to monitoring. This
-# file defines the different roles and their passwords. The access
-# control file (jmxremote.access by default) defines the allowed
-# access for each role. To be functional, a role must have an entry
-# in both the password and the access files.
-#
-# Default location of this file is $JRE/conf/management/jmxremote.password
-# You can specify an alternate location by specifying a property in
-# the management config file $JRE/conf/management/management.properties
-# or by specifying a system property (See that file for details).
-
-
-##############################################################
-# File permissions of the jmxremote.password file
-##############################################################
-# Since there are cleartext passwords stored in this file,
-# this file must be readable by ONLY the owner,
-# otherwise the program will exit with an error.
-#
-# The file format for password and access files is syntactically the same
-# as the Properties file format. The syntax is described in the Javadoc
-# for java.util.Properties.load.
-# Typical password file has multiple lines, where each line is blank,
-# a comment (like this one), or a password entry.
-#
-#
-# A password entry consists of a role name and an associated
-# password. The role name is any string that does not itself contain
-# spaces or tabs. The password is again any string that does not
-# contain spaces or tabs. Note that passwords appear in the clear in
-# this file, so it is a good idea not to use valuable passwords.
-#
-# A given role should have at most one entry in this file. If a role
-# has no entry, it has no access.
-# If multiple entries are found for the same role name, then the last one
-# is used.
-#
-# In a typical installation, this file can be read by anybody on the
-# local machine, and possibly by people on other machines.
-# For # security, you should either restrict the access to this file,
-# or specify another, less accessible file in the management config file
-# as described above.
-#
-# Following are two commented-out entries. The "measureRole" role has
-# password "QED". The "controlRole" role has password "R&D".
-#
-# monitorRole QED
-# controlRole R&D
-
--- a/jdk/src/java.management/share/conf/management.properties Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,331 +0,0 @@
-#####################################################################
-# Default Configuration File for Java Platform Management
-#####################################################################
-#
-# The Management Configuration file (in java.util.Properties format)
-# will be read if one of the following system properties is set:
-# -Dcom.sun.management.jmxremote.port=<port-number>
-# or -Dcom.sun.management.snmp.port=<port-number>
-# or -Dcom.sun.management.config.file=<this-file>
-#
-# The default Management Configuration file is:
-#
-# $JRE/conf/management/management.properties
-#
-# Another location for the Management Configuration File can be specified
-# by the following property on the Java command line:
-#
-# -Dcom.sun.management.config.file=<this-file>
-#
-# If -Dcom.sun.management.config.file=<this-file> is set, the port
-# number for the management agent can be specified in the config file
-# using the following lines:
-#
-# ################ Management Agent Port #########################
-#
-# For setting the JMX RMI agent port use the following line
-# com.sun.management.jmxremote.port=<port-number>
-#
-# For setting the SNMP agent port use the following line
-# com.sun.management.snmp.port=<port-number>
-
-#####################################################################
-# Optional Instrumentation
-#####################################################################
-#
-# By default only the basic instrumentation with low overhead is on.
-# The following properties allow to selectively turn on optional
-# instrumentation which are off by default and may have some
-# additional overhead.
-#
-# com.sun.management.enableThreadContentionMonitoring
-#
-# This option enables thread contention monitoring if the
-# Java virtual machine supports such instrumentation.
-# Refer to the specification for the java.lang.management.ThreadMBean
-# interface - see isThreadContentionMonitoringSupported() method.
-#
-
-# To enable thread contention monitoring, uncomment the following line
-# com.sun.management.enableThreadContentionMonitoring
-
-#####################################################################
-# SNMP Management Properties
-#####################################################################
-#
-# If the system property -Dcom.sun.management.snmp.port=<port-number>
-# is set then
-# - The SNMP agent (with the Java virtual machine MIB) is started
-# that listens on the specified port for incoming SNMP requests.
-# - the following properties for read for SNMP management.
-#
-# The configuration can be specified only at startup time.
-# Later changes to the above system property (e.g. via setProperty method), this
-# config file, or the ACL file has no effect to the running SNMP agent.
-#
-
-#
-# ##################### SNMP Trap Port #########################
-#
-# com.sun.management.snmp.trap=<trap-destination-port-number>
-# Specifies the remote port number at which managers are expected
-# to listen for trap. For each host defined in the ACL file,
-# the SNMP agent will send traps at <host>:<trap-destination-port-number>
-# Default for this property is 162.
-#
-
-# To set port for sending traps to a different port use the following line
-# com.sun.management.snmp.trap=<trap-destination-port-number>
-
-#
-# ################ SNMP listen interface #########################
-#
-# com.sun.management.snmp.interface=<InetAddress>
-# Specifies the local interface on which the SNMP agent will bind.
-# This is useful when running on machines which have several
-# interfaces defined. It makes it possible to listen to a specific
-# subnet accessible through that interface.
-# Default for this property is "localhost".
-#
-# The format of the value for that property is any string accepted
-# by java.net.InetAddress.getByName(String).
-#
-
-# For restricting the port on which SNMP agent listens use the following line
-# com.sun.management.snmp.interface=<InetAddress>
-
-#
-# #################### SNMP ACL file #########################
-#
-# com.sun.management.snmp.acl=true|false
-# Default for this property is true. (Case for true/false ignored)
-# If this property is specified as false then the ACL file
-# is not checked: all manager hosts are allowed all access.
-#
-
-# For SNMP without checking ACL file uncomment the following line
-# com.sun.management.snmp.acl=false
-
-#
-# com.sun.management.snmp.acl.file=filepath
-# Specifies location for ACL file
-# This is optional - default location is
-# $JRE/conf/management/snmp.acl
-#
-# If the property "com.sun.management.snmp.acl" is set to false,
-# then this property and the ACL file are ignored.
-# Otherwise the ACL file must exist and be in the valid format.
-# If the ACL file is empty or non existent then no access is allowed.
-#
-# The SNMP agent will read the ACL file at startup time.
-# Modification to the ACL file has no effect to any running SNMP
-# agents which read that ACL file at startup.
-#
-
-# For a non-default acl file location use the following line
-# com.sun.management.snmp.acl.file=filepath
-
-#####################################################################
-# RMI Management Properties
-#####################################################################
-#
-# If system property -Dcom.sun.management.jmxremote.port=<port-number>
-# is set then
-# - A MBean server is started
-# - JRE Platform MBeans are registered in the MBean server
-# - RMI connector is published in a private readonly registry at
-# specified port using a well known name, "jmxrmi"
-# - the following properties are read for JMX remote management.
-#
-# The configuration can be specified only at startup time.
-# Later changes to above system property (e.g. via setProperty method),
-# this config file, the password file, or the access file have no effect to the
-# running MBean server, the connector, or the registry.
-#
-
-#
-# ########## RMI connector settings for local management ##########
-#
-# com.sun.management.jmxremote.local.only=true|false
-# Default for this property is true. (Case for true/false ignored)
-# If this property is specified as true then the local JMX RMI connector
-# server will only accept connection requests from clients running on
-# the host where the out-of-the-box JMX management agent is running.
-# In order to ensure backwards compatibility this property could be
-# set to false. However, deploying the local management agent in this
-# way is discouraged because the local JMX RMI connector server will
-# accept connection requests from any client either local or remote.
-# For remote management the remote JMX RMI connector server should
-# be used instead with authentication and SSL/TLS encryption enabled.
-#
-
-# For allowing the local management agent accept local
-# and remote connection requests use the following line
-# com.sun.management.jmxremote.local.only=false
-
-#
-# ###################### RMI SSL #############################
-#
-# com.sun.management.jmxremote.ssl=true|false
-# Default for this property is true. (Case for true/false ignored)
-# If this property is specified as false then SSL is not used.
-#
-
-# For RMI monitoring without SSL use the following line
-# com.sun.management.jmxremote.ssl=false
-
-# com.sun.management.jmxremote.ssl.config.file=filepath
-# Specifies the location of the SSL configuration file. A properties
-# file can be used to supply the keystore and truststore location and
-# password settings thus avoiding to pass them as cleartext in the
-# command-line.
-#
-# The current implementation of the out-of-the-box management agent will
-# look up and use the properties specified below to configure the SSL
-# keystore and truststore, if present:
-# javax.net.ssl.keyStore=<keystore-location>
-# javax.net.ssl.keyStorePassword=<keystore-password>
-# javax.net.ssl.trustStore=<truststore-location>
-# javax.net.ssl.trustStorePassword=<truststore-password>
-# Any other properties in the file will be ignored. This will allow us
-# to extend the property set in the future if required by the default
-# SSL implementation.
-#
-# If the property "com.sun.management.jmxremote.ssl" is set to false,
-# then this property is ignored.
-#
-
-# For supplying the keystore settings in a file use the following line
-# com.sun.management.jmxremote.ssl.config.file=filepath
-
-# com.sun.management.jmxremote.ssl.enabled.cipher.suites=<cipher-suites>
-# The value of this property is a string that is a comma-separated list
-# of SSL/TLS cipher suites to enable. This property can be specified in
-# conjunction with the previous property "com.sun.management.jmxremote.ssl"
-# in order to control which particular SSL/TLS cipher suites are enabled
-# for use by accepted connections. If this property is not specified then
-# the SSL/TLS RMI Server Socket Factory uses the SSL/TLS cipher suites that
-# are enabled by default.
-#
-
-# com.sun.management.jmxremote.ssl.enabled.protocols=<protocol-versions>
-# The value of this property is a string that is a comma-separated list
-# of SSL/TLS protocol versions to enable. This property can be specified in
-# conjunction with the previous property "com.sun.management.jmxremote.ssl"
-# in order to control which particular SSL/TLS protocol versions are
-# enabled for use by accepted connections. If this property is not
-# specified then the SSL/TLS RMI Server Socket Factory uses the SSL/TLS
-# protocol versions that are enabled by default.
-#
-
-# com.sun.management.jmxremote.ssl.need.client.auth=true|false
-# Default for this property is false. (Case for true/false ignored)
-# If this property is specified as true in conjunction with the previous
-# property "com.sun.management.jmxremote.ssl" then the SSL/TLS RMI Server
-# Socket Factory will require client authentication.
-#
-
-# For RMI monitoring with SSL client authentication use the following line
-# com.sun.management.jmxremote.ssl.need.client.auth=true
-
-# com.sun.management.jmxremote.registry.ssl=true|false
-# Default for this property is false. (Case for true/false ignored)
-# If this property is specified as true then the RMI registry used
-# to bind the RMIServer remote object is protected with SSL/TLS
-# RMI Socket Factories that can be configured with the properties:
-# com.sun.management.jmxremote.ssl.config.file
-# com.sun.management.jmxremote.ssl.enabled.cipher.suites
-# com.sun.management.jmxremote.ssl.enabled.protocols
-# com.sun.management.jmxremote.ssl.need.client.auth
-# If the two properties below are true at the same time, i.e.
-# com.sun.management.jmxremote.ssl=true
-# com.sun.management.jmxremote.registry.ssl=true
-# then the RMIServer remote object and the RMI registry are
-# both exported with the same SSL/TLS RMI Socket Factories.
-#
-
-# For using an SSL/TLS protected RMI registry use the following line
-# com.sun.management.jmxremote.registry.ssl=true
-
-#
-# ################ RMI User authentication ################
-#
-# com.sun.management.jmxremote.authenticate=true|false
-# Default for this property is true. (Case for true/false ignored)
-# If this property is specified as false then no authentication is
-# performed and all users are allowed all access.
-#
-
-# For RMI monitoring without any checking use the following line
-# com.sun.management.jmxremote.authenticate=false
-
-#
-# ################ RMI Login configuration ###################
-#
-# com.sun.management.jmxremote.login.config=<config-name>
-# Specifies the name of a JAAS login configuration entry to use when
-# authenticating users of RMI monitoring.
-#
-# Setting this property is optional - the default login configuration
-# specifies a file-based authentication that uses the password file.
-#
-# When using this property to override the default login configuration
-# then the named configuration entry must be in a file that gets loaded
-# by JAAS. In addition, the login module(s) specified in the configuration
-# should use the name and/or password callbacks to acquire the user's
-# credentials. See the NameCallback and PasswordCallback classes in the
-# javax.security.auth.callback package for more details.
-#
-# If the property "com.sun.management.jmxremote.authenticate" is set to
-# false, then this property and the password & access files are ignored.
-#
-
-# For a non-default login configuration use the following line
-# com.sun.management.jmxremote.login.config=<config-name>
-
-#
-# ################ RMI Password file location ##################
-#
-# com.sun.management.jmxremote.password.file=filepath
-# Specifies location for password file
-# This is optional - default location is
-# $JRE/conf/management/jmxremote.password
-#
-# If the property "com.sun.management.jmxremote.authenticate" is set to
-# false, then this property and the password & access files are ignored.
-# Otherwise the password file must exist and be in the valid format.
-# If the password file is empty or non-existent then no access is allowed.
-#
-
-# For a non-default password file location use the following line
-# com.sun.management.jmxremote.password.file=filepath
-
-#
-# ################ RMI Access file location #####################
-#
-# com.sun.management.jmxremote.access.file=filepath
-# Specifies location for access file
-# This is optional - default location is
-# $JRE/conf/management/jmxremote.access
-#
-# If the property "com.sun.management.jmxremote.authenticate" is set to
-# false, then this property and the password & access files are ignored.
-# Otherwise, the access file must exist and be in the valid format.
-# If the access file is empty or non-existent then no access is allowed.
-#
-
-# For a non-default password file location use the following line
-# com.sun.management.jmxremote.access.file=filepath
-#
-
-# ################ Management agent listen interface #########################
-#
-# com.sun.management.jmxremote.host=<host-or-interface-name>
-# Specifies the local interface on which the JMX RMI agent will bind.
-# This is useful when running on machines which have several
-# interfaces defined. It makes it possible to listen to a specific
-# subnet accessible through that interface.
-#
-# The format of the value for that property is any string accepted
-# by java.net.InetAddress.getByName(String).
-#
--- a/jdk/src/java.management/share/conf/snmp.acl.template Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-# ----------------------------------------------------------------------
-# Template for SNMP Access Control List File
-#
-# o Copy this template to snmp.acl
-# o Set access control for SNMP support
-# o Change the permission of snmp.acl to be read-only
-# by the owner.
-#
-# See below for the location of snmp.acl file.
-# ----------------------------------------------------------------------
-
-############################################################
-# SNMP Access Control List File
-############################################################
-#
-# Default location of this file is $JRE/conf/management/snmp.acl.
-# You can specify an alternate location by specifying a property in
-# the management config file $JRE/conf/management/management.properties
-# or by specifying a system property (See that file for details).
-#
-
-
-##############################################################
-# File permissions of the snmp.acl file
-##############################################################
-#
-# Since there are cleartext community strings stored in this file,
-# this ACL file must be readable by ONLY the owner,
-# otherwise the program will exit with an error.
-#
-##############################################################
-# Format of the acl group
-##############################################################
-#
-# communities: a list of SNMP community strings to which the
-# access control applies separated by commas.
-#
-# access: either "read-only" or "read-write".
-#
-# managers: a list of hosts to be granted the access rights.
-# Each can be expressed as any one of the following:
-# - hostname: hubble
-# - ip v4 and v6 addresses: 123.456.789.12 , fe80::a00:20ff:fe9b:ea82
-# - ip v4 and v6 netmask prefix notation: 123.456.789.0/24,
-# fe80::a00:20ff:fe9b:ea82/64
-# see RFC 2373 (http://www.ietf.org/rfc/rfc2373.txt)
-#
-# An example of two community groups for multiple hosts:
-# acl = {
-# {
-# communities = public, private
-# access = read-only
-# managers = hubble, snowbell, nanak
-# }
-# {
-# communities = jerry
-# access = read-write
-# managers = hubble, telescope
-# }
-# }
-#
-##############################################################
-# Format of the trap group
-##############################################################
-#
-# trap-community: a single SNMP community string that will be included
-# in the traps sent to the hosts.
-#
-# hosts: a list of hosts to which the SNMP agent will send traps.
-#
-# An example of two trap community definitions for multiple hosts:
-# trap = {
-# {
-# trap-community = public
-# hosts = hubble, snowbell
-# }
-# {
-# trap-community = private
-# hosts = telescope
-# }
-# }
-#
-############################################################
-#
-# Update the community strings (public and private) below
-# before copying this template file
-#
-# Common SNMP ACL Example
-# ------------------------
-#
-# o Only localhost can connect, and access rights
-# are limited to read-only
-# o Traps are sent to localhost only
-#
-#
-# acl = {
-# {
-# communities = public, private
-# access = read-only
-# managers = localhost
-# }
-# }
-#
-#
-# trap = {
-# {
-# trap-community = public
-# hosts = localhost
-# }
-# }
--- a/jdk/src/java.management/unix/classes/sun/management/FileSystemImpl.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2004, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.management;
-
-import java.io.File;
-import java.io.IOException;
-
-/*
- * Solaris/Linux implementation of sun.management.FileSystem
- */
-public class FileSystemImpl extends FileSystem {
-
- public boolean supportsFileSecurity(File f) throws IOException {
- return true;
- }
-
- public boolean isAccessUserOnly(File f) throws IOException {
- return isAccessUserOnly0(f.getPath());
- }
-
- // Native methods
-
- static native boolean isAccessUserOnly0(String path) throws IOException;
-
- // Initialization
-
- static {
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction<Void>() {
- public Void run() {
- System.loadLibrary("management");
- return null;
- }
- });
- }
-}
--- a/jdk/src/java.management/unix/native/libmanagement/FileSystemImpl.c Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2004, 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. 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.
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "jni.h"
-#include "jni_util.h"
-#include "sun_management_FileSystemImpl.h"
-
-#ifdef _ALLBSD_SOURCE
-#define stat64 stat
-#endif
-
-/*
- * Class: sun_management_FileSystemImpl
- * Method: isAccessUserOnly0
- * Signature: (Ljava/lang/String;)Z
- */
-JNIEXPORT jboolean JNICALL Java_sun_management_FileSystemImpl_isAccessUserOnly0
- (JNIEnv *env, jclass ignored, jstring str)
-{
- jboolean res = JNI_FALSE;
- jboolean isCopy;
- const char *path = JNU_GetStringPlatformChars(env, str, &isCopy);
- if (path != NULL) {
- struct stat64 sb;
- if (stat64(path, &sb) == 0) {
- res = ((sb.st_mode & (S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)) == 0) ? JNI_TRUE : JNI_FALSE;
- } else {
- JNU_ThrowIOExceptionWithLastError(env, "stat64 failed");
- }
- if (isCopy) {
- JNU_ReleaseStringPlatformChars(env, str, path);
- }
- }
- return res;
-}
--- a/jdk/src/java.management/windows/classes/sun/management/FileSystemImpl.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2004, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.management;
-
-import java.io.File;
-import java.io.IOException;
-
-/*
- * Windows implementation of sun.management.FileSystem
- */
-public class FileSystemImpl extends FileSystem {
-
- public boolean supportsFileSecurity(File f) throws IOException {
- return isSecuritySupported0(f.getAbsolutePath());
- }
-
- public boolean isAccessUserOnly(File f) throws IOException {
- String path = f.getAbsolutePath();
- if (!isSecuritySupported0(path)) {
- throw new UnsupportedOperationException("File system does not support file security");
- }
- return isAccessUserOnly0(path);
- }
-
- // Native methods
-
- static native void init0();
-
- static native boolean isSecuritySupported0(String path) throws IOException;
-
- static native boolean isAccessUserOnly0(String path) throws IOException;
-
- // Initialization
-
- static {
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction<Void>() {
- public Void run() {
- System.loadLibrary("management");
- return null;
- }
- });
- init0();
- }
-}
--- a/jdk/src/java.management/windows/native/libmanagement/FileSystemImpl.c Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,314 +0,0 @@
-/*
- * Copyright (c) 2004, 2011, 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.
- */
-
-#include <windows.h>
-#include <malloc.h>
-#include <string.h>
-
-#include "jni.h"
-#include "jni_util.h"
-#include "sun_management_FileSystemImpl.h"
-
-/*
- * Access mask to represent any file access
- */
-#define ANY_ACCESS (FILE_GENERIC_READ | FILE_GENERIC_WRITE | FILE_GENERIC_EXECUTE)
-
-/*
- * Returns JNI_TRUE if the specified file is on a file system that supports
- * persistent ACLs (On NTFS file systems returns true, on FAT32 file systems
- * returns false).
- */
-static jboolean isSecuritySupported(JNIEnv* env, const char* path) {
- char* root;
- char* p;
- BOOL res;
- DWORD dwMaxComponentLength;
- DWORD dwFlags;
- char fsName[128];
- DWORD fsNameLength;
-
- /*
- * Get root directory. Assume that files are absolute paths. For UNCs
- * the slash after the share name is required.
- */
- root = strdup(path);
- if (*root == '\\') {
- /*
- * \\server\share\file ==> \\server\share\
- */
- int slashskip = 3;
- p = root;
- while ((*p == '\\') && (slashskip > 0)) {
- char* p2;
- p++;
- p2 = strchr(p, '\\');
- if ((p2 == NULL) || (*p2 != '\\')) {
- free(root);
- JNU_ThrowIOException(env, "Malformed UNC");
- return JNI_FALSE;
- }
- p = p2;
- slashskip--;
- }
- if (slashskip != 0) {
- free(root);
- JNU_ThrowIOException(env, "Malformed UNC");
- return JNI_FALSE;
- }
- p++;
- *p = '\0';
-
- } else {
- p = strchr(root, '\\');
- if (p == NULL) {
- free(root);
- JNU_ThrowIOException(env, "Absolute filename not specified");
- return JNI_FALSE;
- }
- p++;
- *p = '\0';
- }
-
-
- /*
- * Get the volume information - this gives us the file system file and
- * also tells us if the file system supports persistent ACLs.
- */
- fsNameLength = sizeof(fsName)-1;
- res = GetVolumeInformation(root,
- NULL, // address of name of the volume, can be NULL
- 0, // length of volume name
- NULL, // address of volume serial number, can be NULL
- &dwMaxComponentLength,
- &dwFlags,
- fsName,
- fsNameLength);
- if (res == 0) {
- free(root);
- JNU_ThrowIOExceptionWithLastError(env, "GetVolumeInformation failed");
- return JNI_FALSE;
- }
-
- free(root);
- return (dwFlags & FS_PERSISTENT_ACLS) ? JNI_TRUE : JNI_FALSE;
-}
-
-
-/*
- * Returns the security descriptor for a file.
- */
-static SECURITY_DESCRIPTOR* getFileSecurityDescriptor(JNIEnv* env, const char* path) {
- SECURITY_DESCRIPTOR* sd;
- DWORD len = 0;
- SECURITY_INFORMATION info =
- OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION;
-
- GetFileSecurityA(path, info , 0, 0, &len);
- if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
- JNU_ThrowIOExceptionWithLastError(env, "GetFileSecurity failed");
- return NULL;
- }
- sd = (SECURITY_DESCRIPTOR *)malloc(len);
- if (sd == NULL) {
- JNU_ThrowOutOfMemoryError(env, 0);
- } else {
- if (!(*GetFileSecurityA)(path, info, sd, len, &len)) {
- JNU_ThrowIOExceptionWithLastError(env, "GetFileSecurity failed");
- free(sd);
- return NULL;
- }
- }
- return sd;
-}
-
-/*
- * Returns pointer to the SID identifying the owner of the specified
- * file.
- */
-static SID* getFileOwner(JNIEnv* env, SECURITY_DESCRIPTOR* sd) {
- SID* owner;
- BOOL defaulted;
-
- if (!GetSecurityDescriptorOwner(sd, &owner, &defaulted)) {
- JNU_ThrowIOExceptionWithLastError(env, "GetSecurityDescriptorOwner failed");
- return NULL;
- }
- return owner;
-}
-
-/*
- * Returns pointer discretionary access-control list (ACL) from the security
- * descriptor of the specified file.
- */
-static ACL* getFileDACL(JNIEnv* env, SECURITY_DESCRIPTOR* sd) {
- ACL *acl;
- int defaulted, present;
-
- if (!GetSecurityDescriptorDacl(sd, &present, &acl, &defaulted)) {
- JNU_ThrowIOExceptionWithLastError(env, "GetSecurityDescriptorDacl failed");
- return NULL;
- }
- if (!present) {
- JNU_ThrowInternalError(env, "Security descriptor does not contain a DACL");
- return NULL;
- }
- return acl;
-}
-
-/*
- * Returns JNI_TRUE if the specified owner is the only SID will access
- * to the file.
- */
-static jboolean isAccessUserOnly(JNIEnv* env, SID* owner, ACL* acl) {
- ACL_SIZE_INFORMATION acl_size_info;
- DWORD i;
-
- /*
- * If there's no DACL then there's no access to the file
- */
- if (acl == NULL) {
- return JNI_TRUE;
- }
-
- /*
- * Get the ACE count
- */
- if (!GetAclInformation(acl, (void *) &acl_size_info, sizeof(acl_size_info),
- AclSizeInformation)) {
- JNU_ThrowIOExceptionWithLastError(env, "GetAclInformation failed");
- return JNI_FALSE;
- }
-
- /*
- * Iterate over the ACEs. For each "allow" type check that the SID
- * matches the owner, and check that the access is read only.
- */
- for (i = 0; i < acl_size_info.AceCount; i++) {
- void* ace;
- ACCESS_ALLOWED_ACE *access;
- SID* sid;
-
- if (!GetAce(acl, i, &ace)) {
- JNU_ThrowIOExceptionWithLastError(env, "GetAce failed");
- return -1;
- }
- if (((ACCESS_ALLOWED_ACE *)ace)->Header.AceType != ACCESS_ALLOWED_ACE_TYPE) {
- continue;
- }
- access = (ACCESS_ALLOWED_ACE *)ace;
- sid = (SID *) &access->SidStart;
- if (!EqualSid(owner, sid)) {
- /*
- * If the ACE allows any access then the file is not secure.
- */
- if (access->Mask & ANY_ACCESS) {
- return JNI_FALSE;
- }
- }
- }
- return JNI_TRUE;
-}
-
-
-/*
- * Class: sun_management_FileSystemImpl
- * Method: init0
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_sun_management_FileSystemImpl_init0
- (JNIEnv *env, jclass ignored)
-{
- /* nothing to do */
-}
-
-/*
- * Class: sun_management_FileSystemImpl
- * Method: isSecuritySupported0
- * Signature: (Ljava/lang/String;)Z
- */
-JNIEXPORT jboolean JNICALL Java_sun_management_FileSystemImpl_isSecuritySupported0
- (JNIEnv *env, jclass ignored, jstring str)
-{
- jboolean res;
- jboolean isCopy;
- const char* path;
-
- path = JNU_GetStringPlatformChars(env, str, &isCopy);
- if (path != NULL) {
- res = isSecuritySupported(env, path);
- if (isCopy) {
- JNU_ReleaseStringPlatformChars(env, str, path);
- }
- return res;
- } else {
- /* exception thrown - doesn't matter what we return */
- return JNI_TRUE;
- }
-}
-
-
-/*
- * Class: sun_management_FileSystemImpl
- * Method: isAccessUserOnly0
- * Signature: (Ljava/lang/String;)Z
- */
-JNIEXPORT jboolean JNICALL Java_sun_management_FileSystemImpl_isAccessUserOnly0
- (JNIEnv *env, jclass ignored, jstring str)
-{
- jboolean res = JNI_FALSE;
- jboolean isCopy;
- const char* path;
-
- path = JNU_GetStringPlatformChars(env, str, &isCopy);
- if (path != NULL) {
- /*
- * From the security descriptor get the file owner and
- * DACL. Then check if anybody but the owner has access
- * to the file.
- */
- SECURITY_DESCRIPTOR* sd = getFileSecurityDescriptor(env, path);
- if (sd != NULL) {
- SID *owner = getFileOwner(env, sd);
- if (owner != NULL) {
- ACL* acl = getFileDACL(env, sd);
- if (acl != NULL) {
- res = isAccessUserOnly(env, owner, acl);
- } else {
- /*
- * If acl is NULL it means that an exception was thrown
- * or there is "all acess" to the file.
- */
- res = JNI_FALSE;
- }
- }
- free(sd);
- }
- if (isCopy) {
- JNU_ReleaseStringPlatformChars(env, str, path);
- }
- }
- return res;
-}
--- a/jdk/src/java.rmi/share/classes/module-info.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/src/java.rmi/share/classes/module-info.java Tue Jan 31 20:06:32 2017 -0800
@@ -39,12 +39,14 @@
// accessible to the security manager at initialization time
exports com.sun.rmi.rmid to java.base;
exports sun.rmi.registry to
- java.management;
+ jdk.management.agent;
exports sun.rmi.server to
java.management,
+ jdk.management.agent,
jdk.jconsole;
exports sun.rmi.transport to
java.management,
+ jdk.management.agent,
jdk.jconsole;
uses java.rmi.server.RMIClassLoaderSpi;
}
--- a/jdk/src/jdk.jconsole/share/classes/module-info.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/src/jdk.jconsole/share/classes/module-info.java Tue Jan 31 20:06:32 2017 -0800
@@ -31,6 +31,7 @@
requires jdk.attach;
requires jdk.jvmstat;
requires jdk.management;
+ requires jdk.management.agent;
exports com.sun.tools.jconsole;
uses com.sun.tools.jconsole.JConsolePlugin;
}
--- a/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/LocalVirtualMachine.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/LocalVirtualMachine.java Tue Jan 31 20:06:32 2017 -0800
@@ -29,13 +29,11 @@
import java.io.IOException;
import java.io.File;
-// Sun specific
import com.sun.tools.attach.VirtualMachine;
import com.sun.tools.attach.VirtualMachineDescriptor;
import com.sun.tools.attach.AttachNotSupportedException;
-// Sun private
-import sun.management.ConnectorAddressLink;
+import jdk.internal.agent.ConnectorAddressLink;
import sun.jvmstat.monitor.HostIdentifier;
import sun.jvmstat.monitor.MonitoredHost;
import sun.jvmstat.monitor.MonitoredVm;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,739 @@
+/*
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.agent;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.management.ManagementFactory;
+import java.lang.reflect.Method;
+import java.net.InetAddress;
+import java.net.MalformedURLException;
+import java.net.UnknownHostException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.Properties;
+import java.util.ResourceBundle;
+import java.util.ServiceLoader;
+import java.util.function.Function;
+import java.util.function.Predicate;
+
+import javax.management.remote.JMXConnectorServer;
+import javax.management.remote.JMXServiceURL;
+
+import static jdk.internal.agent.AgentConfigurationError.*;
+import jdk.internal.agent.spi.AgentProvider;
+import jdk.internal.vm.VMSupport;
+import sun.management.jdp.JdpController;
+import sun.management.jdp.JdpException;
+import sun.management.jmxremote.ConnectorBootstrap;
+
+/**
+ * This Agent is started by the VM when -Dcom.sun.management.snmp or
+ * -Dcom.sun.management.jmxremote is set. This class will be loaded by the
+ * system class loader. Also jmx framework could be started by jcmd
+ */
+public class Agent {
+ /**
+ * Agent status collector strategy class
+ */
+ private static abstract class StatusCollector {
+ protected static final Map<String, String> DEFAULT_PROPS = new HashMap<>();
+
+ static {
+ DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.PORT,
+ ConnectorBootstrap.DefaultValues.PORT);
+ DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.USE_LOCAL_ONLY,
+ ConnectorBootstrap.DefaultValues.USE_LOCAL_ONLY);
+ DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.USE_AUTHENTICATION,
+ ConnectorBootstrap.DefaultValues.USE_AUTHENTICATION);
+ DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.USE_SSL,
+ ConnectorBootstrap.DefaultValues.USE_SSL);
+ DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.USE_REGISTRY_SSL,
+ ConnectorBootstrap.DefaultValues.USE_REGISTRY_SSL);
+ DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.SSL_NEED_CLIENT_AUTH,
+ ConnectorBootstrap.DefaultValues.SSL_NEED_CLIENT_AUTH);
+ DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.CONFIG_FILE_NAME,
+ ConnectorBootstrap.DefaultValues.CONFIG_FILE_NAME);
+ DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.PASSWORD_FILE_NAME,
+ ConnectorBootstrap.DefaultValues.PASSWORD_FILE_NAME);
+ DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.ACCESS_FILE_NAME,
+ ConnectorBootstrap.DefaultValues.ACCESS_FILE_NAME);
+
+ }
+
+ final protected StringBuilder sb = new StringBuilder();
+ final public String collect() {
+ Properties agentProps = VMSupport.getAgentProperties();
+ String localConnAddr = (String)agentProps.get(LOCAL_CONNECTOR_ADDRESS_PROP);
+ if (localConnAddr != null || jmxServer != null) {
+ addAgentStatus(true);
+ appendConnections(localConnAddr);
+ } else {
+ addAgentStatus(false);
+ }
+ return sb.toString();
+ }
+
+ private void appendConnections(String localConnAddr) {
+ appendConnectionsHeader();
+ if (localConnAddr != null) {
+ try {
+ JMXServiceURL u = new JMXServiceURL(localConnAddr);
+ addConnection(false, u);
+ } catch (MalformedURLException e) {
+ // will never happen
+ }
+
+ }
+ if (jmxServer != null) {
+ addConnection(true, jmxServer.getAddress());
+ }
+ appendConnectionsFooter();
+ }
+
+ private void addConnection(boolean remote, JMXServiceURL u) {
+ appendConnectionHeader(remote);
+ addConnectionDetails(u);
+ addConfigProperties();
+ appendConnectionFooter(remote);
+ }
+
+ private void addConfigProperties() {
+ appendConfigPropsHeader();
+
+ Properties remoteProps = configProps != null ?
+ configProps : getManagementProperties();
+ Map<Object, Object> props = new HashMap<>(DEFAULT_PROPS);
+
+ if (remoteProps == null) {
+ // local connector only
+ String loc_only = System.getProperty(
+ ConnectorBootstrap.PropertyNames.USE_LOCAL_ONLY
+ );
+
+ if (loc_only != null &&
+ !ConnectorBootstrap.DefaultValues.USE_LOCAL_ONLY.equals(loc_only)) {
+ props.put(
+ ConnectorBootstrap.PropertyNames.USE_LOCAL_ONLY,
+ loc_only
+ );
+ }
+ } else {
+ props.putAll(remoteProps);
+ }
+
+ props.entrySet().stream()
+ .filter(preprocess(Map.Entry::getKey, StatusCollector::isManagementProp))
+ .forEach(this::addConfigProp);
+
+ appendConfigPropsFooter();
+ }
+
+ private static boolean isManagementProp(Object pName) {
+ return pName != null && pName.toString().startsWith("com.sun.management.");
+ }
+
+ private static <T, V> Predicate<T> preprocess(Function<T, V> f, Predicate<V> p) {
+ return (T t) -> p.test(f.apply(t));
+ }
+
+ abstract protected void addAgentStatus(boolean enabled);
+ abstract protected void appendConnectionsHeader();
+ abstract protected void appendConnectionsFooter();
+ abstract protected void addConnectionDetails(JMXServiceURL u);
+ abstract protected void appendConnectionHeader(boolean remote);
+ abstract protected void appendConnectionFooter(boolean remote);
+ abstract protected void appendConfigPropsHeader();
+ abstract protected void appendConfigPropsFooter();
+ abstract protected void addConfigProp(Map.Entry<?, ?> prop);
+ }
+
+ /**
+ * Free-text status collector strategy implementation
+ */
+ final private static class TextStatusCollector extends StatusCollector {
+
+ @Override
+ protected void addAgentStatus(boolean enabled) {
+ sb.append("Agent: ").append(enabled ? "enabled" : "disabled").append('\n');
+ }
+
+ @Override
+ protected void appendConnectionsHeader() {
+ sb.append('\n');
+ }
+
+ @Override
+ protected void addConnectionDetails(JMXServiceURL u) {
+ sb.append("Protocol : ").append(u.getProtocol()).append('\n')
+ .append("Host : ").append(u.getHost()).append('\n')
+ .append("URL : ").append(u).append('\n');
+ }
+
+ @Override
+ protected void appendConnectionHeader(boolean remote) {
+ sb.append("Connection Type: ").append(remote ? "remote" : "local").append('\n');
+ }
+
+ @Override
+ protected void appendConfigPropsHeader() {
+ sb.append("Properties :\n");
+ }
+
+ @Override
+ protected void addConfigProp(Map.Entry<?, ?> prop) {
+ sb.append(" ").append(prop.getKey()).append(" = ")
+ .append(prop.getValue());
+ Object defVal = DEFAULT_PROPS.get(prop.getKey());
+ if (defVal != null && defVal.equals(prop.getValue())) {
+ sb.append(" [default]");
+ }
+ sb.append("\n");
+ }
+
+ @Override
+ protected void appendConnectionsFooter() {}
+
+ @Override
+ protected void appendConnectionFooter(boolean remote) {
+ sb.append('\n');
+ }
+
+ @Override
+ protected void appendConfigPropsFooter() {}
+ }
+
+ // management properties
+
+ private static Properties mgmtProps;
+ private static ResourceBundle messageRB;
+ private static final String CONFIG_FILE =
+ "com.sun.management.config.file";
+ private static final String SNMP_PORT =
+ "com.sun.management.snmp.port";
+ private static final String JMXREMOTE =
+ "com.sun.management.jmxremote";
+ private static final String JMXREMOTE_PORT =
+ "com.sun.management.jmxremote.port";
+ private static final String RMI_PORT =
+ "com.sun.management.jmxremote.rmi.port";
+ private static final String ENABLE_THREAD_CONTENTION_MONITORING =
+ "com.sun.management.enableThreadContentionMonitoring";
+ private static final String LOCAL_CONNECTOR_ADDRESS_PROP =
+ "com.sun.management.jmxremote.localConnectorAddress";
+ private static final String SNMP_AGENT_NAME =
+ "SnmpAgent";
+
+ private static final String JDP_DEFAULT_ADDRESS = "224.0.23.178";
+ private static final int JDP_DEFAULT_PORT = 7095;
+
+ // The only active agent allowed
+ private static JMXConnectorServer jmxServer = null;
+ // The properties used to configure the server
+ private static Properties configProps = null;
+
+ // Parse string com.sun.management.prop=xxx,com.sun.management.prop=yyyy
+ // and return property set if args is null or empty
+ // return empty property set
+ private static Properties parseString(String args) {
+ Properties argProps = new Properties();
+ if (args != null && !args.trim().equals("")) {
+ for (String option : args.split(",")) {
+ String s[] = option.split("=", 2);
+ String name = s[0].trim();
+ String value = (s.length > 1) ? s[1].trim() : "";
+
+ if (!name.startsWith("com.sun.management.")) {
+ error(INVALID_OPTION, name);
+ }
+
+ argProps.setProperty(name, value);
+ }
+ }
+
+ return argProps;
+ }
+
+ // invoked by -javaagent or -Dcom.sun.management.agent.class
+ public static void premain(String args) throws Exception {
+ agentmain(args);
+ }
+
+ // invoked by attach mechanism
+ public static void agentmain(String args) throws Exception {
+ if (args == null || args.length() == 0) {
+ args = JMXREMOTE; // default to local management
+ }
+
+ Properties arg_props = parseString(args);
+
+ // Read properties from the config file
+ Properties config_props = new Properties();
+ String fname = arg_props.getProperty(CONFIG_FILE);
+ readConfiguration(fname, config_props);
+
+ // Arguments override config file
+ config_props.putAll(arg_props);
+ startAgent(config_props);
+ }
+
+ // jcmd ManagementAgent.start_local entry point
+ // Also called due to command-line via startAgent()
+ private static synchronized void startLocalManagementAgent() {
+ Properties agentProps = VMSupport.getAgentProperties();
+
+ // start local connector if not started
+ if (agentProps.get(LOCAL_CONNECTOR_ADDRESS_PROP) == null) {
+ JMXConnectorServer cs = ConnectorBootstrap.startLocalConnectorServer();
+ String address = cs.getAddress().toString();
+ // Add the local connector address to the agent properties
+ agentProps.put(LOCAL_CONNECTOR_ADDRESS_PROP, address);
+
+ try {
+ // export the address to the instrumentation buffer
+ ConnectorAddressLink.export(address);
+ } catch (Exception x) {
+ // Connector server started but unable to export address
+ // to instrumentation buffer - non-fatal error.
+ warning(EXPORT_ADDRESS_FAILED, x.getMessage());
+ }
+ }
+ }
+
+ // jcmd ManagementAgent.start entry point
+ // This method starts the remote JMX agent and starts neither
+ // the local JMX agent nor the SNMP agent
+ // @see #startLocalManagementAgent and also @see #startAgent.
+ private static synchronized void startRemoteManagementAgent(String args) throws Exception {
+ if (jmxServer != null) {
+ throw new RuntimeException(getText(INVALID_STATE, "Agent already started"));
+ }
+
+ try {
+ Properties argProps = parseString(args);
+ configProps = new Properties();
+
+ // Load the management properties from the config file
+ // if config file is not specified readConfiguration implicitly
+ // reads <java.home>/conf/management/management.properties
+
+ String fname = System.getProperty(CONFIG_FILE);
+ readConfiguration(fname, configProps);
+
+ // management properties can be overridden by system properties
+ // which take precedence
+ Properties sysProps = System.getProperties();
+ synchronized (sysProps) {
+ configProps.putAll(sysProps);
+ }
+
+ // if user specifies config file into command line for either
+ // jcmd utilities or attach command it overrides properties set in
+ // command line at the time of VM start
+ String fnameUser = argProps.getProperty(CONFIG_FILE);
+ if (fnameUser != null) {
+ readConfiguration(fnameUser, configProps);
+ }
+
+ // arguments specified in command line of jcmd utilities
+ // override both system properties and one set by config file
+ // specified in jcmd command line
+ configProps.putAll(argProps);
+
+ // jcmd doesn't allow to change ThreadContentionMonitoring, but user
+ // can specify this property inside config file, so enable optional
+ // monitoring functionality if this property is set
+ final String enableThreadContentionMonitoring =
+ configProps.getProperty(ENABLE_THREAD_CONTENTION_MONITORING);
+
+ if (enableThreadContentionMonitoring != null) {
+ ManagementFactory.getThreadMXBean().
+ setThreadContentionMonitoringEnabled(true);
+ }
+
+ String jmxremotePort = configProps.getProperty(JMXREMOTE_PORT);
+ if (jmxremotePort != null) {
+ jmxServer = ConnectorBootstrap.
+ startRemoteConnectorServer(jmxremotePort, configProps);
+
+ startDiscoveryService(configProps);
+ } else {
+ throw new AgentConfigurationError(INVALID_JMXREMOTE_PORT, "No port specified");
+ }
+ } catch (JdpException e) {
+ error(e);
+ } catch (AgentConfigurationError err) {
+ error(err.getError(), err.getParams());
+ }
+ }
+
+ private static synchronized void stopRemoteManagementAgent() throws Exception {
+
+ JdpController.stopDiscoveryService();
+
+ if (jmxServer != null) {
+ ConnectorBootstrap.unexportRegistry();
+ ConnectorAddressLink.unexportRemote();
+
+ // Attempt to stop already stopped agent
+ // Don't cause any errors.
+ jmxServer.stop();
+ jmxServer = null;
+ configProps = null;
+ }
+ }
+
+ private static synchronized String getManagementAgentStatus() throws Exception {
+ return new TextStatusCollector().collect();
+ }
+
+ private static void startAgent(Properties props) throws Exception {
+ String snmpPort = props.getProperty(SNMP_PORT);
+ String jmxremote = props.getProperty(JMXREMOTE);
+ String jmxremotePort = props.getProperty(JMXREMOTE_PORT);
+
+ // Enable optional monitoring functionality if requested
+ final String enableThreadContentionMonitoring =
+ props.getProperty(ENABLE_THREAD_CONTENTION_MONITORING);
+ if (enableThreadContentionMonitoring != null) {
+ ManagementFactory.getThreadMXBean().
+ setThreadContentionMonitoringEnabled(true);
+ }
+
+ try {
+ if (snmpPort != null) {
+ loadSnmpAgent(props);
+ }
+
+ /*
+ * If the jmxremote.port property is set then we start the
+ * RMIConnectorServer for remote M&M.
+ *
+ * If the jmxremote or jmxremote.port properties are set then
+ * we start a RMIConnectorServer for local M&M. The address
+ * of this "local" server is exported as a counter to the jstat
+ * instrumentation buffer.
+ */
+ if (jmxremote != null || jmxremotePort != null) {
+ if (jmxremotePort != null) {
+ jmxServer = ConnectorBootstrap.
+ startRemoteConnectorServer(jmxremotePort, props);
+ startDiscoveryService(props);
+ }
+ startLocalManagementAgent();
+ }
+
+ } catch (AgentConfigurationError e) {
+ error(e.getError(), e.getParams());
+ } catch (Exception e) {
+ error(e);
+ }
+ }
+
+ private static void startDiscoveryService(Properties props)
+ throws IOException, JdpException {
+ // Start discovery service if requested
+ String discoveryPort = props.getProperty("com.sun.management.jdp.port");
+ String discoveryAddress = props.getProperty("com.sun.management.jdp.address");
+ String discoveryShouldStart = props.getProperty("com.sun.management.jmxremote.autodiscovery");
+
+ // Decide whether we should start autodicovery service.
+ // To start autodiscovery following conditions should be met:
+ // autodiscovery==true OR (autodicovery==null AND jdp.port != NULL)
+
+ boolean shouldStart = false;
+ if (discoveryShouldStart == null){
+ shouldStart = (discoveryPort != null);
+ }
+ else{
+ try{
+ shouldStart = Boolean.parseBoolean(discoveryShouldStart);
+ } catch (NumberFormatException e) {
+ throw new AgentConfigurationError(AGENT_EXCEPTION, "Couldn't parse autodiscovery argument");
+ }
+ }
+
+ if (shouldStart) {
+ // port and address are required arguments and have no default values
+ InetAddress address;
+ try {
+ address = (discoveryAddress == null) ?
+ InetAddress.getByName(JDP_DEFAULT_ADDRESS) : InetAddress.getByName(discoveryAddress);
+ } catch (UnknownHostException e) {
+ throw new AgentConfigurationError(AGENT_EXCEPTION, e, "Unable to broadcast to requested address");
+ }
+
+ int port = JDP_DEFAULT_PORT;
+ if (discoveryPort != null) {
+ try {
+ port = Integer.parseInt(discoveryPort);
+ } catch (NumberFormatException e) {
+ throw new AgentConfigurationError(AGENT_EXCEPTION, "Couldn't parse JDP port argument");
+ }
+ }
+
+ // Rebuilding service URL to broadcast it
+ String jmxremotePort = props.getProperty(JMXREMOTE_PORT);
+ String rmiPort = props.getProperty(RMI_PORT);
+
+ JMXServiceURL url = jmxServer.getAddress();
+ String hostname = url.getHost();
+
+ String jmxUrlStr = (rmiPort != null)
+ ? String.format(
+ "service:jmx:rmi://%s:%s/jndi/rmi://%s:%s/jmxrmi",
+ hostname, rmiPort, hostname, jmxremotePort)
+ : String.format(
+ "service:jmx:rmi:///jndi/rmi://%s:%s/jmxrmi", hostname, jmxremotePort);
+
+ String instanceName = props.getProperty("com.sun.management.jdp.name");
+
+ JdpController.startDiscoveryService(address, port, instanceName, jmxUrlStr);
+ }
+ }
+
+ public static Properties loadManagementProperties() {
+ Properties props = new Properties();
+
+ // Load the management properties from the config file
+
+ String fname = System.getProperty(CONFIG_FILE);
+ readConfiguration(fname, props);
+
+ // management properties can be overridden by system properties
+ // which take precedence
+ Properties sysProps = System.getProperties();
+ synchronized (sysProps) {
+ props.putAll(sysProps);
+ }
+
+ return props;
+ }
+
+ public static synchronized Properties getManagementProperties() {
+ if (mgmtProps == null) {
+ String configFile = System.getProperty(CONFIG_FILE);
+ String snmpPort = System.getProperty(SNMP_PORT);
+ String jmxremote = System.getProperty(JMXREMOTE);
+ String jmxremotePort = System.getProperty(JMXREMOTE_PORT);
+
+ if (configFile == null && snmpPort == null
+ && jmxremote == null && jmxremotePort == null) {
+ // return if out-of-the-management option is not specified
+ return null;
+ }
+ mgmtProps = loadManagementProperties();
+ }
+ return mgmtProps;
+ }
+
+ private static void loadSnmpAgent(Properties props) {
+ /*
+ * Load the jdk.snmp service
+ */
+ AgentProvider provider = AccessController.doPrivileged(
+ (PrivilegedAction<AgentProvider>) () -> {
+ for (AgentProvider aProvider : ServiceLoader.loadInstalled(AgentProvider.class)) {
+ if (aProvider.getName().equals(SNMP_AGENT_NAME))
+ return aProvider;
+ }
+ return null;
+ }, null
+ );
+
+ if (provider != null) {
+ provider.startAgent(props);
+ } else { // snmp runtime doesn't exist - initialization fails
+ throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT);
+ }
+ }
+
+ // read config file and initialize the properties
+ private static void readConfiguration(String fname, Properties p) {
+ if (fname == null) {
+ String home = System.getProperty("java.home");
+ if (home == null) {
+ throw new Error("Can't find java.home ??");
+ }
+ StringBuilder defaultFileName = new StringBuilder(home);
+ defaultFileName.append(File.separator).append("conf");
+ defaultFileName.append(File.separator).append("management");
+ defaultFileName.append(File.separator).append("management.properties");
+ // Set file name
+ fname = defaultFileName.toString();
+ }
+ final File configFile = new File(fname);
+ if (!configFile.exists()) {
+ error(CONFIG_FILE_NOT_FOUND, fname);
+ }
+
+ InputStream in = null;
+ try {
+ in = new FileInputStream(configFile);
+ BufferedInputStream bin = new BufferedInputStream(in);
+ p.load(bin);
+ } catch (FileNotFoundException e) {
+ error(CONFIG_FILE_OPEN_FAILED, e.getMessage());
+ } catch (IOException e) {
+ error(CONFIG_FILE_OPEN_FAILED, e.getMessage());
+ } catch (SecurityException e) {
+ error(CONFIG_FILE_ACCESS_DENIED, fname);
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ error(CONFIG_FILE_CLOSE_FAILED, fname);
+ }
+ }
+ }
+ }
+
+ public static void startAgent() throws Exception {
+ String prop = System.getProperty("com.sun.management.agent.class");
+
+ // -Dcom.sun.management.agent.class not set so read management
+ // properties and start agent
+ if (prop == null) {
+ // initialize management properties
+ Properties props = getManagementProperties();
+ if (props != null) {
+ startAgent(props);
+ }
+ return;
+ }
+
+ // -Dcom.sun.management.agent.class=<agent classname>:<agent args>
+ String[] values = prop.split(":");
+ if (values.length < 1 || values.length > 2) {
+ error(AGENT_CLASS_INVALID, "\"" + prop + "\"");
+ }
+ String cname = values[0];
+ String args = (values.length == 2 ? values[1] : null);
+
+ if (cname == null || cname.length() == 0) {
+ error(AGENT_CLASS_INVALID, "\"" + prop + "\"");
+ }
+
+ if (cname != null) {
+ try {
+ // Instantiate the named class.
+ // invoke the premain(String args) method
+ Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(cname);
+ Method premain = clz.getMethod("premain",
+ new Class<?>[]{String.class});
+ premain.invoke(null, /* static */
+ new Object[]{args});
+ } catch (ClassNotFoundException ex) {
+ error(AGENT_CLASS_NOT_FOUND, "\"" + cname + "\"");
+ } catch (NoSuchMethodException ex) {
+ error(AGENT_CLASS_PREMAIN_NOT_FOUND, "\"" + cname + "\"");
+ } catch (SecurityException ex) {
+ error(AGENT_CLASS_ACCESS_DENIED);
+ } catch (Exception ex) {
+ String msg = (ex.getCause() == null
+ ? ex.getMessage()
+ : ex.getCause().getMessage());
+ error(AGENT_CLASS_FAILED, msg);
+ }
+ }
+ }
+
+ public static void error(String key) {
+ String keyText = getText(key);
+ System.err.print(getText("agent.err.error") + ": " + keyText);
+ throw new RuntimeException(keyText);
+ }
+
+ public static void error(String key, String[] params) {
+ if (params == null || params.length == 0) {
+ error(key);
+ } else {
+ StringBuilder message = new StringBuilder(params[0]);
+ for (int i = 1; i < params.length; i++) {
+ message.append(' ').append(params[i]);
+ }
+ error(key, message.toString());
+ }
+ }
+
+ public static void error(String key, String message) {
+ String keyText = getText(key);
+ System.err.print(getText("agent.err.error") + ": " + keyText);
+ System.err.println(": " + message);
+ throw new RuntimeException(keyText + ": " + message);
+ }
+
+ public static void error(Exception e) {
+ e.printStackTrace();
+ System.err.println(getText(AGENT_EXCEPTION) + ": " + e.toString());
+ throw new RuntimeException(e);
+ }
+
+ public static void warning(String key, String message) {
+ System.err.print(getText("agent.err.warning") + ": " + getText(key));
+ System.err.println(": " + message);
+ }
+
+ private static void initResource() {
+ try {
+ messageRB =
+ ResourceBundle.getBundle("jdk.internal.agent.resources.agent");
+ } catch (MissingResourceException e) {
+ throw new Error("Fatal: Resource for management agent is missing");
+ }
+ }
+
+ public static String getText(String key) {
+ if (messageRB == null) {
+ initResource();
+ }
+ try {
+ return messageRB.getString(key);
+ } catch (MissingResourceException e) {
+ return "Missing management agent resource bundle: key = \"" + key + "\"";
+ }
+ }
+
+ public static String getText(String key, String... args) {
+ if (messageRB == null) {
+ initResource();
+ }
+ String format = messageRB.getString(key);
+ if (format == null) {
+ format = "missing resource key: key = \"" + key + "\", "
+ + "arguments = \"{0}\", \"{1}\", \"{2}\"";
+ }
+ return MessageFormat.format(format, (Object[]) args);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/AgentConfigurationError.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2004, 2013, 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.agent;
+
+/**
+ * Configuration Error thrown by a management agent.
+ */
+public class AgentConfigurationError extends Error {
+ public static final String AGENT_EXCEPTION =
+ "agent.err.exception";
+ public static final String CONFIG_FILE_NOT_FOUND =
+ "agent.err.configfile.notfound";
+ public static final String CONFIG_FILE_OPEN_FAILED =
+ "agent.err.configfile.failed";
+ public static final String CONFIG_FILE_CLOSE_FAILED =
+ "agent.err.configfile.closed.failed";
+ public static final String CONFIG_FILE_ACCESS_DENIED =
+ "agent.err.configfile.access.denied";
+ public static final String EXPORT_ADDRESS_FAILED =
+ "agent.err.exportaddress.failed";
+ public static final String AGENT_CLASS_NOT_FOUND =
+ "agent.err.agentclass.notfound";
+ public static final String AGENT_CLASS_FAILED =
+ "agent.err.agentclass.failed";
+ public static final String AGENT_CLASS_PREMAIN_NOT_FOUND =
+ "agent.err.premain.notfound";
+ public static final String AGENT_CLASS_ACCESS_DENIED =
+ "agent.err.agentclass.access.denied";
+ public static final String AGENT_CLASS_INVALID =
+ "agent.err.invalid.agentclass";
+ public static final String INVALID_JMXREMOTE_PORT =
+ "agent.err.invalid.jmxremote.port";
+ public static final String INVALID_JMXREMOTE_RMI_PORT =
+ "agent.err.invalid.jmxremote.rmi.port";
+ public static final String PASSWORD_FILE_NOT_SET =
+ "agent.err.password.file.notset";
+ public static final String PASSWORD_FILE_NOT_READABLE =
+ "agent.err.password.file.not.readable";
+ public static final String PASSWORD_FILE_READ_FAILED =
+ "agent.err.password.file.read.failed";
+ public static final String PASSWORD_FILE_NOT_FOUND =
+ "agent.err.password.file.notfound";
+ public static final String ACCESS_FILE_NOT_SET =
+ "agent.err.access.file.notset";
+ public static final String ACCESS_FILE_NOT_READABLE =
+ "agent.err.access.file.not.readable";
+ public static final String ACCESS_FILE_READ_FAILED =
+ "agent.err.access.file.read.failed";
+ public static final String ACCESS_FILE_NOT_FOUND =
+ "agent.err.access.file.notfound";
+ public static final String PASSWORD_FILE_ACCESS_NOT_RESTRICTED =
+ "agent.err.password.file.access.notrestricted";
+ public static final String FILE_ACCESS_NOT_RESTRICTED =
+ "agent.err.file.access.not.restricted";
+ public static final String FILE_NOT_FOUND =
+ "agent.err.file.not.found";
+ public static final String FILE_NOT_READABLE =
+ "agent.err.file.not.readable";
+ public static final String FILE_NOT_SET =
+ "agent.err.file.not.set";
+ public static final String FILE_READ_FAILED =
+ "agent.err.file.read.failed";
+ public static final String CONNECTOR_SERVER_IO_ERROR =
+ "agent.err.connector.server.io.error";
+ public static final String INVALID_OPTION =
+ "agent.err.invalid.option";
+ public static final String INVALID_STATE =
+ "agent.err.invalid.state";
+
+ private final String error;
+ private final String[] params;
+
+ public AgentConfigurationError(String error) {
+ super();
+ this.error = error;
+ this.params = null;
+ }
+
+ public AgentConfigurationError(String error, Throwable cause) {
+ super(cause);
+ this.error = error;
+ this.params = null;
+ }
+
+ public AgentConfigurationError(String error, String... params) {
+ super();
+ this.error = error;
+ this.params = params.clone();
+ }
+
+ public AgentConfigurationError(String error, Throwable cause, String... params) {
+ super(cause);
+ this.error = error;
+ this.params = params.clone();
+ }
+
+ public String getError() {
+ return error;
+ }
+
+ public String[] getParams() {
+ return params.clone();
+ }
+
+ private static final long serialVersionUID = 1211605593516195475L;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/ConnectorAddressLink.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,218 @@
+/*
+ * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.agent;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import jdk.internal.perf.Perf;
+import sun.management.counter.Units;
+import sun.management.counter.Counter;
+import sun.management.counter.perf.PerfInstrumentation;
+
+/**
+ * A utility class to support the exporting and importing of the address
+ * of a connector server using the instrumentation buffer.
+ *
+ * @since 1.5
+ */
+public class ConnectorAddressLink {
+ /**
+ * A simple wrapper for the perf-counter backing {@linkplain ByteBuffer}
+ */
+ private static final class PerfHandle {
+ private ByteBuffer bb;
+
+ private PerfHandle(ByteBuffer bb) {
+ this.bb = bb.order(ByteOrder.nativeOrder());
+ }
+
+ private void putLong(long l) {
+ this.bb = bb.clear();
+ this.bb.asLongBuffer().put(l);
+ }
+ }
+
+ private static final String CONNECTOR_ADDRESS_COUNTER =
+ "sun.management.JMXConnectorServer.address";
+ private static final String REMOTE_CONNECTOR_STATE_COUNTER =
+ "sun.management.JMXConnectorServer.remote.enabled";
+
+ /*
+ * The format of the jvmstat counters representing the properties of
+ * a given out-of-the-box JMX remote connector will be as follows:
+ *
+ * sun.management.JMXConnectorServer.<counter>.<key>=<value>
+ *
+ * where:
+ *
+ * counter = index computed by this class which uniquely identifies
+ * an out-of-the-box JMX remote connector running in this
+ * Java virtual machine.
+ * key/value = a given key/value pair in the map supplied to the
+ * exportRemote() method.
+ *
+ * For example,
+ *
+ * sun.management.JMXConnectorServer.0.remoteAddress=service:jmx:rmi:///jndi/rmi://myhost:5000/jmxrmi
+ * sun.management.JMXConnectorServer.0.authenticate=false
+ * sun.management.JMXConnectorServer.0.ssl=false
+ * sun.management.JMXConnectorServer.0.sslRegistry=false
+ * sun.management.JMXConnectorServer.0.sslNeedClientAuth=false
+ */
+ private static final String REMOTE_CONNECTOR_COUNTER_PREFIX =
+ "sun.management.JMXConnectorServer.";
+
+ /*
+ * JMX remote connector counter (it will be incremented every
+ * time a new out-of-the-box JMX remote connector is created).
+ */
+ private static final AtomicInteger counter = new AtomicInteger();
+
+ private static PerfHandle remotePerfHandle = null;
+
+ /**
+ * Exports the specified connector address to the instrumentation buffer
+ * so that it can be read by this or other Java virtual machines running
+ * on the same system.
+ *
+ * @param address The connector address.
+ */
+ public static void export(String address) {
+ if (address == null || address.length() == 0) {
+ throw new IllegalArgumentException("address not specified");
+ }
+ Perf perf = Perf.getPerf();
+ perf.createString(
+ CONNECTOR_ADDRESS_COUNTER, 1, Units.STRING.intValue(), address);
+ }
+
+ public static void unexportRemote() {
+ unexport(remotePerfHandle);
+ }
+
+ private static void unexport(PerfHandle ph) {
+ if (ph != null) {
+ ph.putLong(-1L);
+ }
+ }
+
+ /**
+ * Imports the connector address from the instrument buffer
+ * of the specified Java virtual machine.
+ *
+ * @param vmid an identifier that uniquely identifies a local Java virtual
+ * machine, or <code>0</code> to indicate the current Java virtual machine.
+ *
+ * @return the value of the connector address, or <code>null</code> if the
+ * target VM has not exported a connector address.
+ *
+ * @throws IOException An I/O error occurred while trying to acquire the
+ * instrumentation buffer.
+ */
+ public static String importFrom(int vmid) throws IOException {
+ Perf perf = Perf.getPerf();
+ ByteBuffer bb;
+ try {
+ bb = perf.attach(vmid, "r");
+ } catch (IllegalArgumentException iae) {
+ throw new IOException(iae.getMessage());
+ }
+ List<Counter> counters =
+ new PerfInstrumentation(bb).findByPattern(CONNECTOR_ADDRESS_COUNTER);
+ Iterator<Counter> i = counters.iterator();
+ if (i.hasNext()) {
+ Counter c = i.next();
+ return (String) c.getValue();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Exports the specified remote connector address and associated
+ * configuration properties to the instrumentation buffer so that
+ * it can be read by this or other Java virtual machines running
+ * on the same system.
+ *
+ * @param properties The remote connector address properties.
+ */
+ public static void exportRemote(Map<String, String> properties) {
+ final int index = counter.getAndIncrement();
+ Perf perf = Perf.getPerf();
+ for (Map.Entry<String, String> entry : properties.entrySet()) {
+ perf.createString(REMOTE_CONNECTOR_COUNTER_PREFIX + index + "." +
+ entry.getKey(), 1, Units.STRING.intValue(), entry.getValue());
+ }
+ if (remotePerfHandle != null) {
+ remotePerfHandle.putLong(index);
+ } else {
+ remotePerfHandle = new PerfHandle(
+ perf.createLong(REMOTE_CONNECTOR_STATE_COUNTER, 1, Units.NONE.intValue(), (long)index)
+ );
+ }
+ }
+
+ /**
+ * Imports the remote connector address and associated
+ * configuration properties from the instrument buffer
+ * of the specified Java virtual machine.
+ *
+ * @param vmid an identifier that uniquely identifies a local Java virtual
+ * machine, or <code>0</code> to indicate the current Java virtual machine.
+ *
+ * @return a map containing the remote connector's properties, or an empty
+ * map if the target VM has not exported the remote connector's properties.
+ *
+ * @throws IOException An I/O error occurred while trying to acquire the
+ * instrumentation buffer.
+ */
+ public static Map<String, String> importRemoteFrom(int vmid) throws IOException {
+ Perf perf = Perf.getPerf();
+ ByteBuffer bb;
+ try {
+ bb = perf.attach(vmid, "r");
+ } catch (IllegalArgumentException iae) {
+ throw new IOException(iae.getMessage());
+ }
+ List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
+ Map<String, String> properties = new HashMap<>();
+ for (Counter c : counters) {
+ String name = c.getName();
+ if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
+ !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
+ properties.put(name, c.getValue().toString());
+ }
+ }
+ return properties;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/FileSystem.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2004, 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.agent;
+
+import java.io.File;
+import java.io.IOException;
+
+/*
+ * Utility class to support file system operations
+ *
+ * @since 1.5
+ */
+public abstract class FileSystem {
+
+ private static final Object lock = new Object();
+ private static FileSystem fs;
+
+ protected FileSystem() { }
+
+ /**
+ * Opens the file system
+ */
+ public static FileSystem open() {
+ synchronized (lock) {
+ if (fs == null) {
+ fs = new FileSystemImpl();
+ }
+ return fs;
+ }
+ }
+
+ /**
+ * Tells whether or not the specified file is located on a
+ * file system that supports file security or not.
+ *
+ * @throws IOException if an I/O error occurs.
+ */
+ public abstract boolean supportsFileSecurity(File f) throws IOException;
+
+ /**
+ * Tell whether or not the specified file is accessible
+ * by anything other than the file owner.
+ *
+ * @throws IOException if an I/O error occurs.
+ *
+ * @throws UnsupportedOperationException
+ * If file is located on a file system that doesn't support
+ * file security.
+ */
+ public abstract boolean isAccessUserOnly(File f) throws IOException;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent.properties Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,71 @@
+#
+# Copyright (c) 2004, 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. 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.
+#
+
+agent.err.error = Error
+agent.err.exception = Exception thrown by the agent
+agent.err.warning = Warning
+
+agent.err.configfile.notfound = Config file not found
+agent.err.configfile.failed = Failed in reading the config file
+agent.err.configfile.closed.failed = Failed in closing the config file
+agent.err.configfile.access.denied = Access to the config file is denied
+
+agent.err.exportaddress.failed = Export of JMX connector address to instrumentation buffer failed
+
+agent.err.agentclass.notfound = Management agent class not found
+agent.err.agentclass.failed = Management agent class failed
+agent.err.premain.notfound = premain(String) does not exist in agent class
+agent.err.agentclass.access.denied = Access to premain(String) is denied
+agent.err.invalid.agentclass = Invalid com.sun.management.agent.class property value
+agent.err.invalid.state = Invalid agent state: {0}
+agent.err.invalid.jmxremote.port = Invalid com.sun.management.jmxremote.port number
+agent.err.invalid.jmxremote.rmi.port = Invalid com.sun.management.jmxremote.rmi.port number
+
+agent.err.file.not.set = File not specified
+agent.err.file.not.readable = File not readable
+agent.err.file.read.failed = Failed in reading the file
+agent.err.file.not.found = File not found
+agent.err.file.access.not.restricted = File read access must be restricted
+
+agent.err.password.file.notset = Password file is not specified but com.sun.management.jmxremote.authenticate=true
+agent.err.password.file.not.readable = Password file not readable
+agent.err.password.file.read.failed = Failed in reading the password file
+agent.err.password.file.notfound = Password file not found
+agent.err.password.file.access.notrestricted = Password file read access must be restricted
+
+agent.err.access.file.notset = Access file is not specified but com.sun.management.jmxremote.authenticate=true
+agent.err.access.file.not.readable = Access file not readable
+agent.err.access.file.read.failed = Failed in reading the access file
+agent.err.access.file.notfound = Access file not found
+
+agent.err.connector.server.io.error = JMX connector server communication error
+
+agent.err.invalid.option = Invalid option specified
+
+jmxremote.ConnectorBootstrap.starting = Starting JMX Connector Server:
+jmxremote.ConnectorBootstrap.noAuthentication = No Authentication
+jmxremote.ConnectorBootstrap.ready = JMX Connector ready at: {0}
+jmxremote.ConnectorBootstrap.password.readonly = Password file read access must be restricted: {0}
+jmxremote.ConnectorBootstrap.file.readonly = File read access must be restricted: {0}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_de.properties Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,71 @@
+#
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# 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.
+#
+
+agent.err.error = Fehler
+agent.err.exception = Ausnahme von Agent ausgel\u00F6st
+agent.err.warning = Warnung
+
+agent.err.configfile.notfound = Konfigurationsdatei wurde nicht gefunden
+agent.err.configfile.failed = Konfigurationsdatei konnte nicht gelesen werden
+agent.err.configfile.closed.failed = Konfigurationsdatei konnte nicht geschlossen werden
+agent.err.configfile.access.denied = Zugriff auf Konfigurationsdatei wurde abgelehnt
+
+agent.err.exportaddress.failed = Export der JMX-Connector-Adresse in Instrumentierungspuffer nicht erfolgreich
+
+agent.err.agentclass.notfound = Management Agent-Klasse nicht gefunden
+agent.err.agentclass.failed = Management Agent-Klasse nicht erfolgreich
+agent.err.premain.notfound = premain(String) ist in Agent-Klasse nicht vorhanden
+agent.err.agentclass.access.denied = Zugriff auf premain(String) wurde abgelehnt
+agent.err.invalid.agentclass = Ung\u00FCltiger Eigenschaftswert f\u00FCr com.sun.management.agent.class
+agent.err.invalid.state = Ung\u00FCltiger Agent-Zustand: {0}
+agent.err.invalid.jmxremote.port = Ung\u00FCltige Nummer f\u00FCr com.sun.management.jmxremote.port
+agent.err.invalid.jmxremote.rmi.port = Ung\u00FCltige Nummer f\u00FCr com.sun.management.jmxremote.rmi.port
+
+agent.err.file.not.set = Datei nicht angegeben
+agent.err.file.not.readable = Datei nicht lesbar
+agent.err.file.read.failed = Datei konnte nicht gelesen werden
+agent.err.file.not.found = Datei wurde nicht gefunden
+agent.err.file.access.not.restricted = Lesezugriff auf Datei muss eingeschr\u00E4nkt werden
+
+agent.err.password.file.notset = Es wurde keine Kennwortdatei angegeben, obwohl com.sun.management.jmxremote.authenticate auf "true" gesetzt ist
+agent.err.password.file.not.readable = Kennwortdatei nicht lesbar
+agent.err.password.file.read.failed = Kennwortdatei konnte nicht gelesen werden
+agent.err.password.file.notfound = Kennwortdatei nicht gefunden
+agent.err.password.file.access.notrestricted = Lesezugriff auf Kennwortdatei muss eingeschr\u00E4nkt werden
+
+agent.err.access.file.notset = Es wurde keine Zugriffsdatei angegeben, obwohl com.sun.management.jmxremote.authenticate auf "true" gesetzt ist
+agent.err.access.file.not.readable = Zugriffsdatei kann nicht gelesen werden
+agent.err.access.file.read.failed = Zugriffsdatei konnte nicht gelesen werden
+agent.err.access.file.notfound = Zugriffsdatei nicht gefunden
+
+agent.err.connector.server.io.error = Fehler bei JMX-Connector-Serverkommunikation
+
+agent.err.invalid.option = Ung\u00FCltige Option angegeben
+
+jmxremote.ConnectorBootstrap.starting = JMX-Connector-Server starten:
+jmxremote.ConnectorBootstrap.noAuthentication = Keine Authentifizierung
+jmxremote.ConnectorBootstrap.ready = JMX-Connector bereit unter: {0}
+jmxremote.ConnectorBootstrap.password.readonly = Lesezugriff auf Kennwortdatei muss eingeschr\u00E4nkt werden: {0}
+jmxremote.ConnectorBootstrap.file.readonly = Lesezugriff auf Datei muss eingeschr\u00E4nkt werden: {0}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_es.properties Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,71 @@
+#
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# 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.
+#
+
+agent.err.error = Error
+agent.err.exception = Excepci\u00F3n devuelta por el agente
+agent.err.warning = Advertencia
+
+agent.err.configfile.notfound = No se ha encontrado el archivo de configuraci\u00F3n
+agent.err.configfile.failed = Fallo al leer el archivo de configuraci\u00F3n
+agent.err.configfile.closed.failed = Fallo al cerrar el archivo de configuraci\u00F3n
+agent.err.configfile.access.denied = Acceso denegado al archivo de configuraci\u00F3n
+
+agent.err.exportaddress.failed = Fallo al exportar la direcci\u00F3n del conector JMX al buffer de instrumentaci\u00F3n
+
+agent.err.agentclass.notfound = Clase de agente de gesti\u00F3n no encontrada
+agent.err.agentclass.failed = Fallo de clase de agente de gesti\u00F3n
+agent.err.premain.notfound = premain(String) no existe en la clase del agente
+agent.err.agentclass.access.denied = Acceso denegado a premain(String)
+agent.err.invalid.agentclass = Valor de propiedad com.sun.management.agent.class no v\u00E1lido
+agent.err.invalid.state = Estado de agente no v\u00E1lido: {0}
+agent.err.invalid.jmxremote.port = N\u00FAmero com.sun.management.jmxremote.port no v\u00E1lido
+agent.err.invalid.jmxremote.rmi.port = N\u00FAmero com.sun.management.jmxremote.rmi.port no v\u00E1lido
+
+agent.err.file.not.set = Archivo no especificado
+agent.err.file.not.readable = Archivo ilegible
+agent.err.file.read.failed = Fallo al leer el archivo
+agent.err.file.not.found = Archivo no encontrado
+agent.err.file.access.not.restricted = El acceso de lectura al archivo debe ser restringido
+
+agent.err.password.file.notset = El archivo de contrase\u00F1as no se ha especificado, pero com.sun.management.jmxremote.authenticate=true
+agent.err.password.file.not.readable = No se puede leer el archivo de contrase\u00F1as
+agent.err.password.file.read.failed = Fallo al leer el archivo de contrase\u00F1as
+agent.err.password.file.notfound = Archivo de contrase\u00F1as no encontrado
+agent.err.password.file.access.notrestricted = Se debe restringir el acceso de lectura al archivo de contrase\u00F1as
+
+agent.err.access.file.notset = El archivo de acceso no se ha especificado, pero com.sun.management.jmxremote.authenticate=true
+agent.err.access.file.not.readable = No se puede leer el archivo de acceso
+agent.err.access.file.read.failed = Fallo al leer el archivo de acceso
+agent.err.access.file.notfound = Archivo de acceso no encontrado
+
+agent.err.connector.server.io.error = Error de comunicaci\u00F3n con el servidor de conector JMX
+
+agent.err.invalid.option = Opci\u00F3n especificada no v\u00E1lida
+
+jmxremote.ConnectorBootstrap.starting = Iniciando servidor de conector JMX:
+jmxremote.ConnectorBootstrap.noAuthentication = Sin autenticaci\u00F3n
+jmxremote.ConnectorBootstrap.ready = Conector JMX listo en: {0}
+jmxremote.ConnectorBootstrap.password.readonly = Se debe restringir el acceso de lectura al archivo de contrase\u00F1as: {0}
+jmxremote.ConnectorBootstrap.file.readonly = El acceso de lectura al archivo debe ser restringido: {0}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_fr.properties Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,71 @@
+#
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# 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.
+#
+
+agent.err.error = Erreur
+agent.err.exception = Exception envoy\u00E9e par l'agent
+agent.err.warning = Avertissement
+
+agent.err.configfile.notfound = Fichier de configuration introuvable
+agent.err.configfile.failed = Impossible de lire le fichier de configuration
+agent.err.configfile.closed.failed = Impossible de fermer le fichier de configuration
+agent.err.configfile.access.denied = Acc\u00E8s refus\u00E9 au fichier de configuration
+
+agent.err.exportaddress.failed = Impossible d'exporter l'adresse du connecteur JMX dans le tampon d'instrumentation
+
+agent.err.agentclass.notfound = Classe d'agents de gestion introuvable
+agent.err.agentclass.failed = Echec de la classe d'agents de gestion
+agent.err.premain.notfound = premain(String) n'existe pas dans la classe d'agents
+agent.err.agentclass.access.denied = Acc\u00E8s \u00E0 premain(String) refus\u00E9
+agent.err.invalid.agentclass = Valeur de propri\u00E9t\u00E9 com.sun.management.agent.class incorrecte
+agent.err.invalid.state = Etat de l''agent non valide : {0}
+agent.err.invalid.jmxremote.port = Num\u00E9ro com.sun.management.jmxremote.port incorrect
+agent.err.invalid.jmxremote.rmi.port = Num\u00E9ro com.sun.management.jmxremote.rmi.port non valide
+
+agent.err.file.not.set = Fichier non sp\u00E9cifi\u00E9
+agent.err.file.not.readable = Fichier illisible
+agent.err.file.read.failed = Impossible de lire le fichier
+agent.err.file.not.found = Fichier introuvable
+agent.err.file.access.not.restricted = L'acc\u00E8s en lecture au fichier doit \u00EAtre limit\u00E9
+
+agent.err.password.file.notset = Le fichier de mots de passe n'est pas sp\u00E9cifi\u00E9 mais com.sun.management.jmxremote.authenticate=true
+agent.err.password.file.not.readable = Fichier de mots de passe illisible
+agent.err.password.file.read.failed = Impossible de lire le fichier de mots de passe
+agent.err.password.file.notfound = Fichier de mots de passe introuvable
+agent.err.password.file.access.notrestricted = L'acc\u00E8s en lecture au fichier de mots de passe doit \u00EAtre limit\u00E9
+
+agent.err.access.file.notset = Le fichier d'acc\u00E8s n'est pas sp\u00E9cifi\u00E9 mais com.sun.management.jmxremote.authenticate=true
+agent.err.access.file.not.readable = Fichier d'acc\u00E8s illisible
+agent.err.access.file.read.failed = Impossible de lire le fichier d'acc\u00E8s
+agent.err.access.file.notfound = Fichier d'acc\u00E8s introuvable
+
+agent.err.connector.server.io.error = Erreur de communication avec le serveur du connecteur JMX
+
+agent.err.invalid.option = Option sp\u00E9cifi\u00E9e non valide
+
+jmxremote.ConnectorBootstrap.starting = D\u00E9marrage du serveur du connecteur JMX :
+jmxremote.ConnectorBootstrap.noAuthentication = Pas d'authentification
+jmxremote.ConnectorBootstrap.ready = Connecteur JMX pr\u00EAt \u00E0 : {0}
+jmxremote.ConnectorBootstrap.password.readonly = L''acc\u00E8s en lecture au fichier de mots de passe doit \u00EAtre limit\u00E9 : {0}
+jmxremote.ConnectorBootstrap.file.readonly = L''acc\u00E8s en lecture au fichier doit \u00EAtre limit\u00E9 : {0}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_it.properties Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,71 @@
+#
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# 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.
+#
+
+agent.err.error = Errore
+agent.err.exception = Eccezione dell'agente
+agent.err.warning = Avvertenza
+
+agent.err.configfile.notfound = File di configurazione non trovato
+agent.err.configfile.failed = Errore di lettura file di configurazione
+agent.err.configfile.closed.failed = Errore di chiusura file di configurazione
+agent.err.configfile.access.denied = Accesso negato al file di configurazione
+
+agent.err.exportaddress.failed = Errore di esportazione dell'indirizzo connettore JMX nel buffer strumenti
+
+agent.err.agentclass.notfound = Classe agente gestione non trovata
+agent.err.agentclass.failed = Errore classe agente gestione
+agent.err.premain.notfound = premain(String) non esiste nella classe agente
+agent.err.agentclass.access.denied = Accesso negato a premain(String)
+agent.err.invalid.agentclass = Valore propriet\u00E0 com.sun.management.agent.class non valido
+agent.err.invalid.state = Stato agente non valido: {0}
+agent.err.invalid.jmxremote.port = Numero com.sun.management.jmxremote.port non valido
+agent.err.invalid.jmxremote.rmi.port = Numero com.sun.management.jmxremote.rmi.port non valido
+
+agent.err.file.not.set = File non specificato
+agent.err.file.not.readable = File non leggibile
+agent.err.file.read.failed = Errore di lettura file
+agent.err.file.not.found = File non trovato
+agent.err.file.access.not.restricted = Limitare l'accesso in lettura al file
+
+agent.err.password.file.notset = Il password file non \u00E8 specificato ma com.sun.management.jmxremote.authenticate=true
+agent.err.password.file.not.readable = Password file non leggibile
+agent.err.password.file.read.failed = Errore di lettura password file
+agent.err.password.file.notfound = Password file non trovato
+agent.err.password.file.access.notrestricted = Limitare l'accesso in lettura al password file
+
+agent.err.access.file.notset = Il file di accesso non \u00E8 specificato ma com.sun.management.jmxremote.authenticate=true
+agent.err.access.file.not.readable = File di accesso non leggibile
+agent.err.access.file.read.failed = Errore di lettura file di accesso
+agent.err.access.file.notfound = File di accesso non trovato
+
+agent.err.connector.server.io.error = Errore di comunicazione server del connettore JMX
+
+agent.err.invalid.option = Specificata opzione non valida
+
+jmxremote.ConnectorBootstrap.starting = Avvio del server connettore JMX:
+jmxremote.ConnectorBootstrap.noAuthentication = Nessuna autenticazione
+jmxremote.ConnectorBootstrap.ready = Connettore JMX pronto in: {0}
+jmxremote.ConnectorBootstrap.password.readonly = Limitare l''accesso in lettura al password file: {0}
+jmxremote.ConnectorBootstrap.file.readonly = Limitare l''accesso in lettura al file: {0}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_ja.properties Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,71 @@
+#
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# 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.
+#
+
+agent.err.error = \u30A8\u30E9\u30FC
+agent.err.exception = \u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u304C\u4F8B\u5916\u3092\u30B9\u30ED\u30FC\u3057\u307E\u3057\u305F
+agent.err.warning = \u8B66\u544A
+
+agent.err.configfile.notfound = \u69CB\u6210\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
+agent.err.configfile.failed = \u69CB\u6210\u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u306B\u5931\u6557\u3057\u307E\u3057\u305F
+agent.err.configfile.closed.failed = \u69CB\u6210\u30D5\u30A1\u30A4\u30EB\u3092\u9589\u3058\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
+agent.err.configfile.access.denied = \u69CB\u6210\u30D5\u30A1\u30A4\u30EB\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u304C\u62D2\u5426\u3055\u308C\u307E\u3057\u305F
+
+agent.err.exportaddress.failed = JMX\u30B3\u30CD\u30AF\u30BF\u30FB\u30A2\u30C9\u30EC\u30B9\u306E\u8A08\u6E2C\u30D0\u30C3\u30D5\u30A1\u3078\u306E\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8\u304C\u5931\u6557\u3057\u307E\u3057\u305F
+
+agent.err.agentclass.notfound = \u7BA1\u7406\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30AF\u30E9\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
+agent.err.agentclass.failed = \u7BA1\u7406\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30AF\u30E9\u30B9\u304C\u5931\u6557\u3057\u307E\u3057\u305F
+agent.err.premain.notfound = premain(String)\u304C\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30AF\u30E9\u30B9\u306B\u5B58\u5728\u3057\u307E\u305B\u3093
+agent.err.agentclass.access.denied = premain(String)\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u304C\u62D2\u5426\u3055\u308C\u307E\u3057\u305F
+agent.err.invalid.agentclass = com.sun.management.agent.class\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u5024\u304C\u7121\u52B9\u3067\u3059
+agent.err.invalid.state = \u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u306E\u72B6\u614B\u304C\u7121\u52B9\u3067\u3059: {0}
+agent.err.invalid.jmxremote.port = com.sun.management.jmxremote.port\u306E\u756A\u53F7\u304C\u7121\u52B9\u3067\u3059
+agent.err.invalid.jmxremote.rmi.port = com.sun.management.jmxremote.rmi.port\u306E\u756A\u53F7\u304C\u7121\u52B9\u3067\u3059
+
+agent.err.file.not.set = \u30D5\u30A1\u30A4\u30EB\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
+agent.err.file.not.readable = \u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u307F\u53D6\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093
+agent.err.file.read.failed = \u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u306B\u5931\u6557\u3057\u307E\u3057\u305F
+agent.err.file.not.found = \u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F
+agent.err.file.access.not.restricted = \u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u30A2\u30AF\u30BB\u30B9\u306F\u5236\u9650\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
+
+agent.err.password.file.notset = \u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u304C\u3001com.sun.management.jmxremote.authenticate=true\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059
+agent.err.password.file.not.readable = \u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u307F\u53D6\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093
+agent.err.password.file.read.failed = \u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u306B\u5931\u6557\u3057\u307E\u3057\u305F
+agent.err.password.file.notfound = \u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
+agent.err.password.file.access.notrestricted = \u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u30A2\u30AF\u30BB\u30B9\u306F\u5236\u9650\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
+
+agent.err.access.file.notset = \u30A2\u30AF\u30BB\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u304C\u3001com.sun.management.jmxremote.authenticate=true\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059
+agent.err.access.file.not.readable = \u30A2\u30AF\u30BB\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u307F\u53D6\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093
+agent.err.access.file.read.failed = \u30A2\u30AF\u30BB\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u306B\u5931\u6557\u3057\u307E\u3057\u305F
+agent.err.access.file.notfound = \u30A2\u30AF\u30BB\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
+
+agent.err.connector.server.io.error = JMX\u30B3\u30CD\u30AF\u30BF\u30FB\u30B5\u30FC\u30D0\u30FC\u306E\u901A\u4FE1\u30A8\u30E9\u30FC
+
+agent.err.invalid.option = \u7121\u52B9\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u304C\u6307\u5B9A\u3055\u308C\u307E\u3057\u305F
+
+jmxremote.ConnectorBootstrap.starting = JMX\u30B3\u30CD\u30AF\u30BF\u30FB\u30B5\u30FC\u30D0\u30FC\u3092\u8D77\u52D5\u3057\u3066\u3044\u307E\u3059:
+jmxremote.ConnectorBootstrap.noAuthentication = \u8A8D\u8A3C\u306A\u3057
+jmxremote.ConnectorBootstrap.ready = JMX\u30B3\u30CD\u30AF\u30BF\u306E\u6E96\u5099\u304C\u3067\u304D\u307E\u3057\u305F: {0}
+jmxremote.ConnectorBootstrap.password.readonly = \u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u30A2\u30AF\u30BB\u30B9\u306F\u5236\u9650\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {0}
+jmxremote.ConnectorBootstrap.file.readonly = \u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u30A2\u30AF\u30BB\u30B9\u306F\u5236\u9650\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {0}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_ko.properties Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,71 @@
+#
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# 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.
+#
+
+agent.err.error = \uC624\uB958
+agent.err.exception = \uC5D0\uC774\uC804\uD2B8\uC5D0 \uC608\uC678\uC0AC\uD56D\uC774 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.
+agent.err.warning = \uACBD\uACE0
+
+agent.err.configfile.notfound = \uAD6C\uC131 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+agent.err.configfile.failed = \uAD6C\uC131 \uD30C\uC77C \uC77D\uAE30\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
+agent.err.configfile.closed.failed = \uAD6C\uC131 \uD30C\uC77C \uB2EB\uAE30\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
+agent.err.configfile.access.denied = \uAD6C\uC131 \uD30C\uC77C\uC5D0 \uB300\uD55C \uC561\uC138\uC2A4\uAC00 \uAC70\uBD80\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+
+agent.err.exportaddress.failed = \uAE30\uAE30 \uBC84\uD37C\uB85C JMX \uCEE4\uB125\uD130 \uC8FC\uC18C \uC775\uC2A4\uD3EC\uD2B8\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
+
+agent.err.agentclass.notfound = \uAD00\uB9AC \uC5D0\uC774\uC804\uD2B8 \uD074\uB798\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+agent.err.agentclass.failed = \uAD00\uB9AC \uC5D0\uC774\uC804\uD2B8 \uD074\uB798\uC2A4\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
+agent.err.premain.notfound = \uC5D0\uC774\uC804\uD2B8 \uD074\uB798\uC2A4\uC5D0 premain(\uBB38\uC790\uC5F4)\uC774 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
+agent.err.agentclass.access.denied = premain(\uBB38\uC790\uC5F4)\uC5D0 \uB300\uD55C \uC561\uC138\uC2A4\uAC00 \uAC70\uBD80\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+agent.err.invalid.agentclass = com.sun.management.agent.class \uC18D\uC131 \uAC12\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
+agent.err.invalid.state = \uBD80\uC801\uD569\uD55C \uC5D0\uC774\uC804\uD2B8 \uC0C1\uD0DC: {0}
+agent.err.invalid.jmxremote.port = com.sun.management.jmxremote.port \uBC88\uD638\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
+agent.err.invalid.jmxremote.rmi.port = \uBD80\uC801\uD569\uD55C com.sun.management.jmxremote.rmi.port \uBC88\uD638
+
+agent.err.file.not.set = \uD30C\uC77C\uC774 \uC9C0\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.
+agent.err.file.not.readable = \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+agent.err.file.read.failed = \uD30C\uC77C \uC77D\uAE30\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
+agent.err.file.not.found = \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+agent.err.file.access.not.restricted = \uD30C\uC77C \uC77D\uAE30 \uC561\uC138\uC2A4\uB294 \uC81C\uD55C\uB418\uC5B4\uC57C \uD569\uB2C8\uB2E4.
+
+agent.err.password.file.notset = \uBE44\uBC00\uBC88\uD638 \uD30C\uC77C\uC774 \uC9C0\uC815\uB418\uC9C0 \uC54A\uC558\uC9C0\uB9CC com.sun.management.jmxremote.authenticate=true\uC785\uB2C8\uB2E4.
+agent.err.password.file.not.readable = \uBE44\uBC00\uBC88\uD638 \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+agent.err.password.file.read.failed = \uBE44\uBC00\uBC88\uD638 \uD30C\uC77C \uC77D\uAE30\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
+agent.err.password.file.notfound = \uBE44\uBC00\uBC88\uD638 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+agent.err.password.file.access.notrestricted = \uBE44\uBC00\uBC88\uD638 \uD30C\uC77C \uC77D\uAE30 \uC561\uC138\uC2A4\uB294 \uC81C\uD55C\uB418\uC5B4\uC57C \uD569\uB2C8\uB2E4.
+
+agent.err.access.file.notset = \uC561\uC138\uC2A4 \uD30C\uC77C\uC774 \uC9C0\uC815\uB418\uC9C0 \uC54A\uC558\uC9C0\uB9CC com.sun.management.jmxremote.authenticate=true\uC785\uB2C8\uB2E4.
+agent.err.access.file.not.readable = \uC561\uC138\uC2A4 \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+agent.err.access.file.read.failed = \uC561\uC138\uC2A4 \uD30C\uC77C \uC77D\uAE30\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
+agent.err.access.file.notfound = \uC561\uC138\uC2A4 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+
+agent.err.connector.server.io.error = JMX \uCEE4\uB125\uD130 \uC11C\uBC84 \uD1B5\uC2E0 \uC624\uB958
+
+agent.err.invalid.option = \uBD80\uC801\uD569\uD55C \uC635\uC158\uC774 \uC9C0\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+
+jmxremote.ConnectorBootstrap.starting = JMX \uCEE4\uB125\uD130 \uC11C\uBC84\uB97C \uC2DC\uC791\uD558\uB294 \uC911:
+jmxremote.ConnectorBootstrap.noAuthentication = \uC778\uC99D \uC5C6\uC74C
+jmxremote.ConnectorBootstrap.ready = {0}\uC5D0\uC11C JMX \uCEE4\uB125\uD130\uAC00 \uC900\uBE44\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+jmxremote.ConnectorBootstrap.password.readonly = \uBE44\uBC00\uBC88\uD638 \uD30C\uC77C \uC77D\uAE30 \uC561\uC138\uC2A4\uB294 \uC81C\uD55C\uB418\uC5B4\uC57C \uD568: {0}
+jmxremote.ConnectorBootstrap.file.readonly = \uD30C\uC77C \uC77D\uAE30 \uC561\uC138\uC2A4\uB294 \uC81C\uD55C\uB418\uC5B4\uC57C \uD568: {0}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_pt_BR.properties Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,71 @@
+#
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# 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.
+#
+
+agent.err.error = Erro
+agent.err.exception = Exce\u00E7\u00E3o gerada pelo agente
+agent.err.warning = Advert\u00EAncia
+
+agent.err.configfile.notfound = Arquivo de configura\u00E7\u00E3o n\u00E3o encontrado
+agent.err.configfile.failed = Falha ao ler o arquivo de configura\u00E7\u00E3o
+agent.err.configfile.closed.failed = Falha ao fechar o arquivo de configura\u00E7\u00E3o
+agent.err.configfile.access.denied = Acesso negado ao arquivo de configura\u00E7\u00E3o
+
+agent.err.exportaddress.failed = Falha na exporta\u00E7\u00E3o do endere\u00E7o do conector JMX para o buffer de instrumenta\u00E7\u00E3o
+
+agent.err.agentclass.notfound = Classe do agente de gerenciamento n\u00E3o encontrada
+agent.err.agentclass.failed = Falha na classe do agente de gerenciamento
+agent.err.premain.notfound = premain(String) n\u00E3o existe na classe do agente
+agent.err.agentclass.access.denied = Acesso negado a premain(String)
+agent.err.invalid.agentclass = Valor inv\u00E1lido da propriedade com.sun.management.agent.class
+agent.err.invalid.state = Estado inv\u00E1lido do agente: {0}
+agent.err.invalid.jmxremote.port = N\u00FAmero inv\u00E1lido de com.sun.management.jmxremote.port
+agent.err.invalid.jmxremote.rmi.port = N\u00FAmero inv\u00E1lido do com.sun.management.jmxremote.rmi.port
+
+agent.err.file.not.set = Arquivo n\u00E3o especificado
+agent.err.file.not.readable = Arquivo ileg\u00EDvel
+agent.err.file.read.failed = Falha ao ler o arquivo
+agent.err.file.not.found = Arquivo n\u00E3o encontrado
+agent.err.file.access.not.restricted = O acesso de leitura do arquivo deve ser limitado
+
+agent.err.password.file.notset = O arquivo de senha n\u00E3o est\u00E1 especificado, mas com.sun.management.jmxremote.authenticate=true
+agent.err.password.file.not.readable = Arquivo de senha ileg\u00EDvel
+agent.err.password.file.read.failed = Falha ao ler o arquivo de senha
+agent.err.password.file.notfound = Arquivo de senha n\u00E3o encontrado
+agent.err.password.file.access.notrestricted = O acesso de leitura do arquivo de senha deve ser limitado
+
+agent.err.access.file.notset = O arquivo de acesso n\u00E3o est\u00E1 especificado, mas com.sun.management.jmxremote.authenticate=true
+agent.err.access.file.not.readable = Arquivo de acesso ileg\u00EDvel
+agent.err.access.file.read.failed = Falha ao ler o arquivo de acesso
+agent.err.access.file.notfound = Arquivo de acesso n\u00E3o encontrado
+
+agent.err.connector.server.io.error = Erro de comunica\u00E7\u00E3o do servidor do conector JMX
+
+agent.err.invalid.option = Op\u00E7\u00E3o especificada inv\u00E1lida
+
+jmxremote.ConnectorBootstrap.starting = Iniciando o Servidor do Conector JMX:
+jmxremote.ConnectorBootstrap.noAuthentication = Sem autentica\u00E7\u00E3o
+jmxremote.ConnectorBootstrap.ready = Conector JMX pronto em: {0}
+jmxremote.ConnectorBootstrap.password.readonly = O acesso de leitura do arquivo de senha deve ser limitado: {0}
+jmxremote.ConnectorBootstrap.file.readonly = O acesso de leitura do arquivo deve ser limitado: {0}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_sv.properties Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,71 @@
+#
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# 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.
+#
+
+agent.err.error = Fel
+agent.err.exception = Agenten orsakade ett undantag
+agent.err.warning = Varning
+
+agent.err.configfile.notfound = Konfigurationsfilen hittades inte
+agent.err.configfile.failed = Kunde inte l\u00E4sa konfigurationsfilen
+agent.err.configfile.closed.failed = Kunde inte st\u00E4nga konfigurationsfilen
+agent.err.configfile.access.denied = \u00C5tkomst till konfigurationsfilen nekad
+
+agent.err.exportaddress.failed = Kunde inte exportera JMX-anslutningsadressen till instrumentbufferten
+
+agent.err.agentclass.notfound = Administrationsagentklassen hittades inte
+agent.err.agentclass.failed = Administrationsagentklassen utf\u00F6rdes inte
+agent.err.premain.notfound = premain(String) finns inte i agentklassen
+agent.err.agentclass.access.denied = \u00C5tkomst till premain(String) nekad
+agent.err.invalid.agentclass = Ogiltigt egenskapsv\u00E4rde f\u00F6r com.sun.management.agent.class
+agent.err.invalid.state = Ogiltig agentstatus: {0}
+agent.err.invalid.jmxremote.port = Ogiltigt com.sun.management.jmxremote.port-nummer
+agent.err.invalid.jmxremote.rmi.port = Ogiltigt com.sun.management.jmxremote.rmi.port-nummer
+
+agent.err.file.not.set = Filen \u00E4r inte angiven
+agent.err.file.not.readable = Filen \u00E4r inte l\u00E4sbar
+agent.err.file.read.failed = Kunde inte l\u00E4sa filen
+agent.err.file.not.found = Filen hittades inte
+agent.err.file.access.not.restricted = Fill\u00E4snings\u00E5tkomst m\u00E5ste begr\u00E4nsas
+
+agent.err.password.file.notset = L\u00F6senordsfilen har inte angetts men com.sun.management.jmxremote.authenticate=true
+agent.err.password.file.not.readable = L\u00F6senordsfilen \u00E4r inte l\u00E4sbar
+agent.err.password.file.read.failed = Kunde inte l\u00E4sa l\u00F6senordsfilen
+agent.err.password.file.notfound = Hittar inte l\u00F6senordsfilen
+agent.err.password.file.access.notrestricted = L\u00E4sbeh\u00F6righeten f\u00F6r filen m\u00E5ste begr\u00E4nsas
+
+agent.err.access.file.notset = \u00C5tkomstfilen har inte angetts men com.sun.management.jmxremote.authenticate=true
+agent.err.access.file.not.readable = Access-filen \u00E4r inte l\u00E4sbar
+agent.err.access.file.read.failed = Kunde inte l\u00E4sa \u00E5tkomstfilen
+agent.err.access.file.notfound = Access-filen hittades inte
+
+agent.err.connector.server.io.error = Serverkommunikationsfel f\u00F6r JMX-anslutning
+
+agent.err.invalid.option = Det angivna alternativet \u00E4r ogiltigt
+
+jmxremote.ConnectorBootstrap.starting = Startar server f\u00F6r JMX-anslutning:
+jmxremote.ConnectorBootstrap.noAuthentication = Ingen autentisering
+jmxremote.ConnectorBootstrap.ready = JMX-anslutning redo p\u00E5: {0}
+jmxremote.ConnectorBootstrap.password.readonly = L\u00E4sbeh\u00F6righeten f\u00F6r l\u00F6senordsfilen m\u00E5ste begr\u00E4nsas: {0}
+jmxremote.ConnectorBootstrap.file.readonly = Fill\u00E4snings\u00E5tkomst m\u00E5ste begr\u00E4nsas {0}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_zh_CN.properties Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,71 @@
+#
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# 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.
+#
+
+agent.err.error = \u9519\u8BEF
+agent.err.exception = \u4EE3\u7406\u629B\u51FA\u5F02\u5E38\u9519\u8BEF
+agent.err.warning = \u8B66\u544A
+
+agent.err.configfile.notfound = \u627E\u4E0D\u5230\u914D\u7F6E\u6587\u4EF6
+agent.err.configfile.failed = \u672A\u80FD\u8BFB\u53D6\u914D\u7F6E\u6587\u4EF6
+agent.err.configfile.closed.failed = \u672A\u80FD\u5173\u95ED\u914D\u7F6E\u6587\u4EF6
+agent.err.configfile.access.denied = \u62D2\u7EDD\u8BBF\u95EE\u914D\u7F6E\u6587\u4EF6
+
+agent.err.exportaddress.failed = \u672A\u80FD\u5C06 JMX \u8FDE\u63A5\u5668\u5730\u5740\u5BFC\u51FA\u5230\u68C0\u6D4B\u7F13\u51B2\u533A
+
+agent.err.agentclass.notfound = \u627E\u4E0D\u5230\u7BA1\u7406\u4EE3\u7406\u7C7B
+agent.err.agentclass.failed = \u7BA1\u7406\u4EE3\u7406\u7C7B\u5931\u8D25
+agent.err.premain.notfound = \u4EE3\u7406\u7C7B\u4E2D\u4E0D\u5B58\u5728 premain(String)
+agent.err.agentclass.access.denied = \u62D2\u7EDD\u8BBF\u95EE premain(String)
+agent.err.invalid.agentclass = com.sun.management.agent.class \u5C5E\u6027\u503C\u65E0\u6548
+agent.err.invalid.state = \u65E0\u6548\u7684\u4EE3\u7406\u72B6\u6001: {0}
+agent.err.invalid.jmxremote.port = com.sun.management.jmxremote.port \u7F16\u53F7\u65E0\u6548
+agent.err.invalid.jmxremote.rmi.port = com.sun.management.jmxremote.rmi.port \u7F16\u53F7\u65E0\u6548
+
+agent.err.file.not.set = \u672A\u6307\u5B9A\u6587\u4EF6
+agent.err.file.not.readable = \u6587\u4EF6\u4E0D\u53EF\u8BFB\u53D6
+agent.err.file.read.failed = \u672A\u80FD\u8BFB\u53D6\u6587\u4EF6
+agent.err.file.not.found = \u627E\u4E0D\u5230\u6587\u4EF6
+agent.err.file.access.not.restricted = \u5FC5\u987B\u9650\u5236\u6587\u4EF6\u8BFB\u53D6\u8BBF\u95EE\u6743\u9650
+
+agent.err.password.file.notset = \u672A\u6307\u5B9A\u53E3\u4EE4\u6587\u4EF6, \u4F46 com.sun.management.jmxremote.authenticate=true
+agent.err.password.file.not.readable = \u53E3\u4EE4\u6587\u4EF6\u4E0D\u53EF\u8BFB\u53D6
+agent.err.password.file.read.failed = \u8BFB\u53D6\u53E3\u4EE4\u6587\u4EF6\u5931\u8D25
+agent.err.password.file.notfound = \u627E\u4E0D\u5230\u53E3\u4EE4\u6587\u4EF6
+agent.err.password.file.access.notrestricted = \u5FC5\u987B\u9650\u5236\u53E3\u4EE4\u6587\u4EF6\u8BFB\u53D6\u8BBF\u95EE\u6743\u9650
+
+agent.err.access.file.notset = \u672A\u6307\u5B9A\u8BBF\u95EE\u6587\u4EF6, \u4F46 com.sun.management.jmxremote.authenticate=true
+agent.err.access.file.not.readable = \u8BBF\u95EE\u6587\u4EF6\u4E0D\u53EF\u8BFB\u53D6
+agent.err.access.file.read.failed = \u8BFB\u53D6\u8BBF\u95EE\u6587\u4EF6\u5931\u8D25
+agent.err.access.file.notfound = \u627E\u4E0D\u5230\u8BBF\u95EE\u6587\u4EF6
+
+agent.err.connector.server.io.error = JMX \u8FDE\u63A5\u5668\u670D\u52A1\u5668\u901A\u4FE1\u9519\u8BEF
+
+agent.err.invalid.option = \u6307\u5B9A\u7684\u9009\u9879\u65E0\u6548
+
+jmxremote.ConnectorBootstrap.starting = \u6B63\u5728\u542F\u52A8 JMX \u8FDE\u63A5\u5668\u670D\u52A1\u5668:
+jmxremote.ConnectorBootstrap.noAuthentication = \u65E0\u9A8C\u8BC1
+jmxremote.ConnectorBootstrap.ready = \u4F4D\u4E8E{0}\u7684 JMX \u8FDE\u63A5\u5668\u5DF2\u5C31\u7EEA
+jmxremote.ConnectorBootstrap.password.readonly = \u5FC5\u987B\u9650\u5236\u53E3\u4EE4\u6587\u4EF6\u8BFB\u53D6\u8BBF\u95EE\u6743\u9650: {0}
+jmxremote.ConnectorBootstrap.file.readonly = \u5FC5\u987B\u9650\u5236\u6587\u4EF6\u8BFB\u53D6\u8BBF\u95EE\u6743\u9650: {0}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_zh_TW.properties Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,71 @@
+#
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# 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.
+#
+
+agent.err.error = \u932F\u8AA4
+agent.err.exception = \u4EE3\u7406\u7A0B\u5F0F\u767C\u751F\u7570\u5E38
+agent.err.warning = \u8B66\u544A
+
+agent.err.configfile.notfound = \u627E\u4E0D\u5230\u8A2D\u5B9A\u6A94\u6848
+agent.err.configfile.failed = \u7121\u6CD5\u8B80\u53D6\u8A2D\u5B9A\u6A94\u6848
+agent.err.configfile.closed.failed = \u7121\u6CD5\u95DC\u9589\u8A2D\u5B9A\u6A94\u6848
+agent.err.configfile.access.denied = \u5B58\u53D6\u8A2D\u5B9A\u6A94\u6848\u906D\u5230\u62D2\u7D55
+
+agent.err.exportaddress.failed = \u5C07 JMX \u9023\u63A5\u5668\u4F4D\u5740\u532F\u51FA\u81F3\u8A2D\u5099\u7DE9\u885D\u5340\u5931\u6557
+
+agent.err.agentclass.notfound = \u627E\u4E0D\u5230\u7BA1\u7406\u4EE3\u7406\u7A0B\u5F0F\u985E\u5225
+agent.err.agentclass.failed = \u7BA1\u7406\u4EE3\u7406\u7A0B\u5F0F\u985E\u5225\u5931\u6557
+agent.err.premain.notfound = \u4EE3\u7406\u7A0B\u5F0F\u985E\u5225\u4E2D\u4E0D\u5B58\u5728 premain(String)
+agent.err.agentclass.access.denied = \u5B58\u53D6 premain(String) \u906D\u5230\u62D2\u7D55
+agent.err.invalid.agentclass = com.sun.management.agent.class \u5C6C\u6027\u503C\u7121\u6548
+agent.err.invalid.state = \u7121\u6548\u7684\u4EE3\u7406\u7A0B\u5F0F\u72C0\u614B: {0}
+agent.err.invalid.jmxremote.port = com.sun.management.jmxremote.port \u865F\u78BC\u7121\u6548
+agent.err.invalid.jmxremote.rmi.port = com.sun.management.jmxremote.rmi.port \u865F\u78BC\u7121\u6548
+
+agent.err.file.not.set = \u672A\u6307\u5B9A\u6A94\u6848
+agent.err.file.not.readable = \u6A94\u6848\u7121\u6CD5\u8B80\u53D6
+agent.err.file.read.failed = \u7121\u6CD5\u8B80\u53D6\u6A94\u6848
+agent.err.file.not.found = \u627E\u4E0D\u5230\u6A94\u6848
+agent.err.file.access.not.restricted = \u5FC5\u9808\u9650\u5236\u6A94\u6848\u8B80\u53D6\u5B58\u53D6\u6B0A
+
+agent.err.password.file.notset = \u672A\u6307\u5B9A\u5BC6\u78BC\u6A94\u6848\uFF0C\u4F46 com.sun.management.jmxremote.authenticate=true
+agent.err.password.file.not.readable = \u5BC6\u78BC\u6A94\u6848\u7121\u6CD5\u8B80\u53D6
+agent.err.password.file.read.failed = \u7121\u6CD5\u8B80\u53D6\u5BC6\u78BC\u6A94\u6848
+agent.err.password.file.notfound = \u627E\u4E0D\u5230\u5BC6\u78BC\u6A94\u6848
+agent.err.password.file.access.notrestricted = \u5FC5\u9808\u9650\u5236\u5BC6\u78BC\u6A94\u6848\u8B80\u53D6\u5B58\u53D6
+
+agent.err.access.file.notset = \u672A\u6307\u5B9A\u5B58\u53D6\u6A94\u6848\uFF0C\u4F46 com.sun.management.jmxremote.authenticate=true
+agent.err.access.file.not.readable = \u5B58\u53D6\u6A94\u6848\u7121\u6CD5\u8B80\u53D6
+agent.err.access.file.read.failed = \u7121\u6CD5\u8B80\u53D6\u5B58\u53D6\u6A94\u6848
+agent.err.access.file.notfound = \u627E\u4E0D\u5230\u5B58\u53D6\u6A94\u6848
+
+agent.err.connector.server.io.error = JMX \u9023\u63A5\u5668\u4F3A\u670D\u5668\u901A\u8A0A\u932F\u8AA4
+
+agent.err.invalid.option = \u6307\u5B9A\u7684\u9078\u9805\u7121\u6548
+
+jmxremote.ConnectorBootstrap.starting = \u6B63\u5728\u555F\u52D5 JMX \u9023\u63A5\u5668\u4F3A\u670D\u5668:
+jmxremote.ConnectorBootstrap.noAuthentication = \u7121\u8A8D\u8B49
+jmxremote.ConnectorBootstrap.ready = JMX \u9023\u63A5\u5668\u5C31\u7DD2\uFF0C\u4F4D\u65BC: {0}
+jmxremote.ConnectorBootstrap.password.readonly = \u5FC5\u9808\u9650\u5236\u5BC6\u78BC\u6A94\u6848\u8B80\u53D6\u5B58\u53D6: {0}
+jmxremote.ConnectorBootstrap.file.readonly = \u5FC5\u9808\u9650\u5236\u6A94\u6848\u8B80\u53D6\u5B58\u53D6\u6B0A: {0}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/spi/AgentProvider.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. 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.agent.spi;
+
+import java.util.Properties;
+
+/**
+ * Service interface for management agent
+ */
+public abstract class AgentProvider {
+
+ /**
+ * Instantiates a new AgentProvider.
+ *
+ * @throws SecurityException if the subclass (and calling code) does not
+ * have
+ * {@code RuntimePermission("sun.management.spi.AgentProvider.subclass")}
+ */
+ protected AgentProvider() {
+ this(checkSubclassPermission());
+ }
+
+ private AgentProvider(Void unused) {
+ }
+
+ private static Void checkSubclassPermission() {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(new RuntimePermission(AgentProvider.class.getName() + ".subclass"));
+ }
+ return null;
+ }
+
+ /**
+ * Gets the name of the agent provider.
+ *
+ * @return name of agent provider
+ */
+ public abstract String getName();
+
+ /**
+ * Initializes and starts the agent.
+ *
+ * @throws IllegalStateException if this agent has already been started.
+ */
+ public abstract void startAgent();
+
+ /**
+ * Initializes and starts the agent at given port and with given properties
+ *
+ * @param props environment variables for agent
+ *
+ * @throws IllegalStateException if this agent has already been started.
+ */
+ public abstract void startAgent(Properties props);
+
+ /**
+ * Checks if agent is started and not terminated.
+ *
+ * @return true if agent is running, false otherwise.
+ */
+ public abstract boolean isActive();
+
+ /**
+ * Stops this agent.
+ *
+ * @throws IllegalStateException if this agent is not started.
+ */
+ public abstract void stopAgent();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/module-info.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+module jdk.management.agent {
+ requires java.management;
+
+ exports jdk.internal.agent to jdk.jconsole;
+
+ uses jdk.internal.agent.spi.AgentProvider;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/sun/management/jdp/JdpBroadcaster.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.management.jdp;
+
+import java.io.IOException;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.NetworkInterface;
+import java.net.ProtocolFamily;
+import java.net.StandardProtocolFamily;
+import java.net.StandardSocketOptions;
+import java.nio.ByteBuffer;
+import java.nio.channels.DatagramChannel;
+import java.nio.channels.UnsupportedAddressTypeException;
+import java.util.Enumeration;
+
+/**
+ * JdpBroadcaster is responsible for sending pre-built JDP packet across a Net
+ *
+ * <p> Multicast group address, port number and ttl have to be chosen on upper
+ * level and passed to broadcaster constructor. Also it's possible to specify
+ * source address to broadcast from. </p>
+ *
+ * <p>JdpBradcaster doesn't perform any validation on a supplied {@code port} and {@code ttl} because
+ * the allowed values depend on an operating system setup</p>
+ *
+ */
+public final class JdpBroadcaster {
+
+ private final InetAddress addr;
+ private final int port;
+ private final DatagramChannel channel;
+
+ /**
+ * Create a new broadcaster
+ *
+ * @param address - multicast group address
+ * @param srcAddress - address of interface we should use to broadcast.
+ * @param port - udp port to use
+ * @param ttl - packet ttl
+ * @throws IOException
+ */
+ public JdpBroadcaster(InetAddress address, InetAddress srcAddress, int port, int ttl)
+ throws IOException, JdpException {
+ this.addr = address;
+ this.port = port;
+
+ ProtocolFamily family = (address instanceof Inet6Address)
+ ? StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
+
+ channel = DatagramChannel.open(family);
+ channel.setOption(StandardSocketOptions.SO_REUSEADDR, true);
+ channel.setOption(StandardSocketOptions.IP_MULTICAST_TTL, ttl);
+
+ // with srcAddress equal to null, this constructor do exactly the same as
+ // if srcAddress is not passed
+ if (srcAddress != null) {
+ // User requests particular interface to bind to
+ NetworkInterface interf = NetworkInterface.getByInetAddress(srcAddress);
+
+ if (interf == null) {
+ throw new JdpException("Unable to get network interface for " + srcAddress.toString());
+ }
+
+ if (!interf.isUp()) {
+ throw new JdpException(interf.getName() + " is not up.");
+ }
+
+ if (!interf.supportsMulticast()) {
+ throw new JdpException(interf.getName() + " does not support multicast.");
+ }
+
+ try {
+ channel.bind(new InetSocketAddress(srcAddress, 0));
+ } catch (UnsupportedAddressTypeException ex) {
+ throw new JdpException("Unable to bind to source address");
+ }
+ channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, interf);
+ }
+ }
+
+ /**
+ * Create a new broadcaster
+ *
+ * @param address - multicast group address
+ * @param port - udp port to use
+ * @param ttl - packet ttl
+ * @throws IOException
+ */
+ public JdpBroadcaster(InetAddress address, int port, int ttl)
+ throws IOException, JdpException {
+ this(address, null, port, ttl);
+ }
+
+ /**
+ * Broadcast pre-built packet
+ *
+ * @param packet - instance of JdpPacket
+ * @throws IOException
+ */
+ public void sendPacket(JdpPacket packet)
+ throws IOException {
+ byte[] data = packet.getPacketData();
+ // Unlike allocate/put wrap don't need a flip afterward
+ ByteBuffer b = ByteBuffer.wrap(data);
+ channel.send(b, new InetSocketAddress(addr, port));
+ }
+
+ /**
+ * Shutdown broadcaster and close underlying socket channel
+ *
+ * @throws IOException
+ */
+ public void shutdown() throws IOException {
+ channel.close();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/sun/management/jdp/JdpController.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.management.jdp;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.UUID;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import sun.management.VMManagement;
+
+/**
+ * JdpController is responsible to create and manage a broadcast loop.
+ *
+ * <p> Other part of code has no access to broadcast loop and have to use
+ * provided static methods
+ * {@link #startDiscoveryService(InetAddress,int,String,String) startDiscoveryService}
+ * and {@link #stopDiscoveryService() stopDiscoveryService}
+ * <p>{@link #startDiscoveryService(InetAddress,int,String,String) startDiscoveryService} could be called multiple
+ * times as it stops the running service if it is necessary.
+ * Call to {@link #stopDiscoveryService() stopDiscoveryService}
+ * ignored if service isn't run.
+ *
+ *
+ * <p> System properties below could be used to control broadcast loop behavior.
+ * Property below have to be set explicitly in command line. It's not possible to
+ * set it in management.config file. Careless changes of these properties could
+ * lead to security or network issues.
+ * <ul>
+ * <li>com.sun.management.jdp.ttl - set ttl for broadcast packet</li>
+ * <li>com.sun.management.jdp.pause - set broadcast interval in seconds</li>
+ * <li>com.sun.management.jdp.source_addr - an address of interface to use for broadcast</li>
+ * </ul>
+ *
+ * <p>null parameters values are filtered out on {@link JdpPacketWriter} level and
+ * corresponding keys are not placed to packet.
+ */
+public final class JdpController {
+
+ private static class JDPControllerRunner implements Runnable {
+
+ private final JdpJmxPacket packet;
+ private final JdpBroadcaster bcast;
+ private final int pause;
+ private volatile boolean shutdown = false;
+
+ private JDPControllerRunner(JdpBroadcaster bcast, JdpJmxPacket packet, int pause) {
+ this.bcast = bcast;
+ this.packet = packet;
+ this.pause = pause;
+ }
+
+ @Override
+ public void run() {
+ try {
+ while (!shutdown) {
+ bcast.sendPacket(packet);
+ try {
+ Thread.sleep(this.pause);
+ } catch (InterruptedException e) {
+ // pass
+ }
+ }
+
+ } catch (IOException e) {
+ // pass;
+ }
+
+ // It's not possible to re-use controller,
+ // nevertheless reset shutdown variable
+ try {
+ stop();
+ bcast.shutdown();
+ } catch (IOException ex) {
+ // pass - ignore IOException during shutdown
+ }
+ }
+
+ public void stop() {
+ shutdown = true;
+ }
+ }
+ private static JDPControllerRunner controller = null;
+
+ private JdpController(){
+ // Don't allow to instantiate this class.
+ }
+
+ // Utility to handle optional system properties
+ // Parse an integer from string or return default if provided string is null
+ private static int getInteger(String val, int dflt, String msg) throws JdpException {
+ try {
+ return (val == null) ? dflt : Integer.parseInt(val);
+ } catch (NumberFormatException ex) {
+ throw new JdpException(msg);
+ }
+ }
+
+ // Parse an inet address from string or return default if provided string is null
+ private static InetAddress getInetAddress(String val, InetAddress dflt, String msg) throws JdpException {
+ try {
+ return (val == null) ? dflt : InetAddress.getByName(val);
+ } catch (UnknownHostException ex) {
+ throw new JdpException(msg);
+ }
+ }
+
+ // Get the process id of the current running Java process
+ private static Integer getProcessId() {
+ try {
+ // Get the current process id using a reflection hack
+ RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
+ Field jvm = runtime.getClass().getDeclaredField("jvm");
+ jvm.setAccessible(true);
+
+ VMManagement mgmt = (sun.management.VMManagement) jvm.get(runtime);
+ Method pid_method = mgmt.getClass().getDeclaredMethod("getProcessId");
+ pid_method.setAccessible(true);
+ Integer pid = (Integer) pid_method.invoke(mgmt);
+ return pid;
+ } catch(Exception ex) {
+ return null;
+ }
+ }
+
+
+ /**
+ * Starts discovery service
+ *
+ * @param address - multicast group address
+ * @param port - udp port to use
+ * @param instanceName - name of running JVM instance
+ * @param url - JMX service url
+ * @throws IOException
+ */
+ public static synchronized void startDiscoveryService(InetAddress address, int port, String instanceName, String url)
+ throws IOException, JdpException {
+
+ // Limit packet to local subnet by default
+ int ttl = getInteger(
+ System.getProperty("com.sun.management.jdp.ttl"), 1,
+ "Invalid jdp packet ttl");
+
+ // Broadcast once a 5 seconds by default
+ int pause = getInteger(
+ System.getProperty("com.sun.management.jdp.pause"), 5,
+ "Invalid jdp pause");
+
+ // Converting seconds to milliseconds
+ pause = pause * 1000;
+
+ // Allow OS to choose broadcast source
+ InetAddress sourceAddress = getInetAddress(
+ System.getProperty("com.sun.management.jdp.source_addr"), null,
+ "Invalid source address provided");
+
+ // Generate session id
+ UUID id = UUID.randomUUID();
+
+ JdpJmxPacket packet = new JdpJmxPacket(id, url);
+
+ // Don't broadcast whole command line for security reason.
+ // Strip everything after first space
+ String javaCommand = System.getProperty("sun.java.command");
+ if (javaCommand != null) {
+ String[] arr = javaCommand.split(" ", 2);
+ packet.setMainClass(arr[0]);
+ }
+
+ // Put optional explicit java instance name to packet, if user doesn't specify
+ // it the key is skipped. PacketWriter is responsible to skip keys having null value.
+ packet.setInstanceName(instanceName);
+
+ // Set rmi server hostname if it explicitly specified by user with
+ // java.rmi.server.hostname
+ String rmiHostname = System.getProperty("java.rmi.server.hostname");
+ packet.setRmiHostname(rmiHostname);
+
+ // Set broadcast interval
+ packet.setBroadcastInterval(Integer.toString(pause));
+
+ // Set process id
+ Integer pid = getProcessId();
+ if (pid != null) {
+ packet.setProcessId(pid.toString());
+ }
+
+ JdpBroadcaster bcast = new JdpBroadcaster(address, sourceAddress, port, ttl);
+
+ // Stop discovery service if it's already running
+ stopDiscoveryService();
+
+ controller = new JDPControllerRunner(bcast, packet, pause);
+
+ Thread t = new Thread(null, controller, "JDP broadcaster", 0, false);
+ t.setDaemon(true);
+ t.start();
+ }
+
+ /**
+ * Stop running discovery service,
+ * it's safe to attempt to stop not started service
+ */
+ public static synchronized void stopDiscoveryService() {
+ if ( controller != null ){
+ controller.stop();
+ controller = null;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/sun/management/jdp/JdpException.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.management.jdp;
+
+/**
+ * An Exception thrown if a JDP implementation encounters a problem.
+ */
+public final class JdpException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construct a new JDP exception with a meaningful message
+ *
+ * @param msg - message
+ */
+ public JdpException(String msg) {
+ super(msg);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/sun/management/jdp/JdpGenericPacket.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.management.jdp;
+
+/**
+ * JdpGenericPacket responsible to provide fields
+ * common for all Jdp packets
+ */
+public abstract class JdpGenericPacket implements JdpPacket {
+
+ /**
+ * JDP protocol magic. Magic allows a reader to quickly select
+ * JDP packets from a bunch of broadcast packets addressed to the same port
+ * and broadcast group. Any packet intended to be parsed by JDP client
+ * has to start from this magic.
+ */
+ private static final int MAGIC = 0xC0FFEE42;
+
+ /**
+ * Current version of protocol. Any implementation of this protocol has to
+ * conform with the packet structure and the flow described in JEP-168
+ */
+ private static final short PROTOCOL_VERSION = 1;
+
+ /**
+ * Default do-nothing constructor
+ */
+ protected JdpGenericPacket(){
+ // do nothing
+ }
+
+
+ /**
+ * Validate protocol header magic field
+ *
+ * @param magic - value to validate
+ * @throws JdpException
+ */
+ public static void checkMagic(int magic)
+ throws JdpException {
+ if (magic != MAGIC) {
+ throw new JdpException("Invalid JDP magic header: " + magic);
+ }
+ }
+
+ /**
+ * Validate protocol header version field
+ *
+ * @param version - value to validate
+ * @throws JdpException
+ */
+ public static void checkVersion(short version)
+ throws JdpException {
+
+ if (version > PROTOCOL_VERSION) {
+ throw new JdpException("Unsupported protocol version: " + version);
+ }
+ }
+
+ /**
+ *
+ * @return protocol magic
+ */
+ public static int getMagic() {
+ return MAGIC;
+ }
+
+ /**
+ *
+ * @return current protocol version
+ */
+ public static short getVersion() {
+ return PROTOCOL_VERSION;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/sun/management/jdp/JdpJmxPacket.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,245 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.management.jdp;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.UUID;
+
+/**
+ * A packet to broadcasts JMX URL
+ *
+ * Fields:
+ *
+ * <ul>
+ * <li>UUID - broadcast session ID, changed every time when we start/stop
+ * discovery service</li>
+ * <li>JMX_URL - URL to connect to JMX service</li>
+ * <li>MAIN_CLASS - optional name of main class, filled from sun.java.command stripped for
+ * security reason to first space</li>
+ * <li>INSTANCE_NAME - optional custom name of particular instance as provided by customer</li>
+ * </ul>
+ */
+public final class JdpJmxPacket
+ extends JdpGenericPacket
+ implements JdpPacket {
+
+ /**
+ * Session ID
+ */
+ public final static String UUID_KEY = "DISCOVERABLE_SESSION_UUID";
+ /**
+ * Name of main class
+ */
+ public final static String MAIN_CLASS_KEY = "MAIN_CLASS";
+ /**
+ * JMX service URL
+ */
+ public final static String JMX_SERVICE_URL_KEY = "JMX_SERVICE_URL";
+ /**
+ * Name of Java instance
+ */
+ public final static String INSTANCE_NAME_KEY = "INSTANCE_NAME";
+ /**
+ * PID of java process, optional presented if it could be obtained
+ */
+ public final static String PROCESS_ID_KEY = "PROCESS_ID";
+ /**
+ * Hostname of rmi server, optional presented if user overrides rmi server
+ * hostname by java.rmi.server.hostname property
+ */
+ public final static String RMI_HOSTNAME_KEY = "RMI_HOSTNAME";
+ /**
+ * Configured broadcast interval, optional
+ */
+ public final static String BROADCAST_INTERVAL_KEY = "BROADCAST_INTERVAL";
+
+ private UUID id;
+ private String mainClass;
+ private String jmxServiceUrl;
+ private String instanceName;
+ private String processId;
+ private String rmiHostname;
+ private String broadcastInterval;
+
+ /**
+ * Create new instance from user provided data. Set mandatory fields
+ *
+ * @param id - java instance id
+ * @param jmxServiceUrl - JMX service url
+ */
+ public JdpJmxPacket(UUID id, String jmxServiceUrl) {
+ this.id = id;
+ this.jmxServiceUrl = jmxServiceUrl;
+ }
+
+ /**
+ * Create new instance from network data Parse packet and set fields.
+ *
+ * @param data - raw packet data as it came from a Net
+ * @throws JdpException
+ */
+ public JdpJmxPacket(byte[] data)
+ throws JdpException {
+ JdpPacketReader reader;
+
+ reader = new JdpPacketReader(data);
+ Map<String, String> p = reader.getDiscoveryDataAsMap();
+
+ String sId = p.get(UUID_KEY);
+ this.id = (sId == null) ? null : UUID.fromString(sId);
+ this.jmxServiceUrl = p.get(JMX_SERVICE_URL_KEY);
+ this.mainClass = p.get(MAIN_CLASS_KEY);
+ this.instanceName = p.get(INSTANCE_NAME_KEY);
+ this.processId = p.get(PROCESS_ID_KEY);
+ this.rmiHostname = p.get(RMI_HOSTNAME_KEY);
+ this.broadcastInterval = p.get(BROADCAST_INTERVAL_KEY);
+ }
+
+ /**
+ * Set main class field
+ *
+ * @param mainClass - main class of running app
+ */
+ public void setMainClass(String mainClass) {
+ this.mainClass = mainClass;
+ }
+
+ /**
+ * Set instance name field
+ *
+ * @param instanceName - name of instance as provided by customer
+ */
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ /**
+ * @return id of discovery session
+ */
+ public UUID getId() {
+ return id;
+ }
+
+ /**
+ *
+ * @return main class field
+ */
+ public String getMainClass() {
+ return mainClass;
+ }
+
+ /**
+ *
+ * @return JMX service URL
+ */
+ public String getJmxServiceUrl() {
+ return jmxServiceUrl;
+ }
+
+ /**
+ *
+ * @return instance name
+ */
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public String getProcessId() {
+ return processId;
+ }
+
+ public void setProcessId(String processId) {
+ this.processId = processId;
+ }
+
+ public String getRmiHostname() {
+ return rmiHostname;
+ }
+
+ public void setRmiHostname(String rmiHostname) {
+ this.rmiHostname = rmiHostname;
+ }
+
+ public String getBroadcastInterval() {
+ return broadcastInterval;
+ }
+
+ public void setBroadcastInterval(String broadcastInterval) {
+ this.broadcastInterval = broadcastInterval;
+ }
+
+ /**
+ *
+ * @return assembled packet ready to be sent across a Net
+ * @throws IOException
+ */
+ @Override
+ public byte[] getPacketData() throws IOException {
+ // Assemble packet from fields to byte array
+ JdpPacketWriter writer;
+ writer = new JdpPacketWriter();
+ writer.addEntry(UUID_KEY, (id == null) ? null : id.toString());
+ writer.addEntry(MAIN_CLASS_KEY, mainClass);
+ writer.addEntry(JMX_SERVICE_URL_KEY, jmxServiceUrl);
+ writer.addEntry(INSTANCE_NAME_KEY, instanceName);
+ writer.addEntry(PROCESS_ID_KEY, processId);
+ writer.addEntry(RMI_HOSTNAME_KEY, rmiHostname);
+ writer.addEntry(BROADCAST_INTERVAL_KEY, broadcastInterval);
+
+ return writer.getPacketBytes();
+ }
+
+ /**
+ *
+ * @return packet hash code
+ */
+ @Override
+ public int hashCode() {
+ int hash = 1;
+ hash = hash * 31 + id.hashCode();
+ hash = hash * 31 + jmxServiceUrl.hashCode();
+ return hash;
+ }
+
+ /**
+ * Compare two packets
+ *
+ * @param o - packet to compare
+ * @return either packet equals or not
+ */
+ @Override
+ public boolean equals(Object o) {
+
+ if (o == null || ! (o instanceof JdpJmxPacket) ){
+ return false;
+ }
+
+ JdpJmxPacket p = (JdpJmxPacket) o;
+ return Objects.equals(id, p.getId()) && Objects.equals(jmxServiceUrl, p.getJmxServiceUrl());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/sun/management/jdp/JdpPacket.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.management.jdp;
+
+import java.io.IOException;
+
+/**
+ * Packet to broadcast
+ *
+ * <p>Each packet have to contain MAGIC and PROTOCOL_VERSION in order to be
+ * recognized as a valid JDP packet.</p>
+ *
+ * <p>Default implementation build packet as a set of UTF-8 encoded Key/Value pairs
+ * are stored as an ordered list of values, and are sent to the server
+ * in that order.</p>
+ *
+ * <p>
+ * Packet structure:
+ *
+ * 4 bytes JDP magic (0xC0FFE42)
+ * 2 bytes JDP protocol version (01)
+ *
+ * 2 bytes size of key
+ * x bytes key (UTF-8 encoded)
+ * 2 bytes size of value
+ * x bytes value (UTF-8 encoded)
+ *
+ * repeat as many times as necessary ...
+ * </p>
+ */
+public interface JdpPacket {
+
+ /**
+ * This method responsible to assemble packet and return a byte array
+ * ready to be sent across a Net.
+ *
+ * @return assembled packet as an array of bytes
+ * @throws IOException
+ */
+ public byte[] getPacketData() throws IOException;
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/sun/management/jdp/JdpPacketReader.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.management.jdp;
+
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * JdpPacketReader responsible for reading a packet <p>This class gets a byte
+ * array as it came from a Net, validates it and breaks a part </p>
+ */
+public final class JdpPacketReader {
+
+ private final DataInputStream pkt;
+ private Map<String, String> pmap = null;
+
+ /**
+ * Create packet reader, extract and check magic and version
+ *
+ * @param packet - packet received from a Net
+ * @throws JdpException
+ */
+ public JdpPacketReader(byte[] packet)
+ throws JdpException {
+ ByteArrayInputStream bais = new ByteArrayInputStream(packet);
+ pkt = new DataInputStream(bais);
+
+ try {
+ int magic = pkt.readInt();
+ JdpGenericPacket.checkMagic(magic);
+ } catch (IOException e) {
+ throw new JdpException("Invalid JDP packet received, bad magic");
+ }
+
+ try {
+ short version = pkt.readShort();
+ JdpGenericPacket.checkVersion(version);
+ } catch (IOException e) {
+ throw new JdpException("Invalid JDP packet received, bad protocol version");
+ }
+ }
+
+ /**
+ * Get next entry from packet
+ *
+ * @return the entry
+ * @throws EOFException
+ * @throws JdpException
+ */
+ public String getEntry()
+ throws EOFException, JdpException {
+
+ try {
+ short len = pkt.readShort();
+ // Artificial setting the "len" field to Short.MAX_VALUE may cause a reader to allocate
+ // to much memory. Prevent this possible DOS attack.
+ if (len < 1 && len > pkt.available()) {
+ throw new JdpException("Broken JDP packet. Invalid entry length field.");
+ }
+
+ byte[] b = new byte[len];
+ if (pkt.read(b) != len) {
+ throw new JdpException("Broken JDP packet. Unable to read entry.");
+ }
+ return new String(b, "UTF-8");
+
+ } catch (EOFException e) {
+ throw e;
+ } catch (UnsupportedEncodingException ex) {
+ throw new JdpException("Broken JDP packet. Unable to decode entry.");
+ } catch (IOException e) {
+ throw new JdpException("Broken JDP packet. Unable to read entry.");
+ }
+
+
+ }
+
+ /**
+ * return packet content as a key/value map
+ *
+ * @return map containing packet entries pair of entries treated as
+ * key,value
+ * @throws IOException
+ * @throws JdpException
+ */
+ public Map<String, String> getDiscoveryDataAsMap()
+ throws JdpException {
+ // return cached map if possible
+ if (pmap != null) {
+ return pmap;
+ }
+
+ String key = null, value = null;
+
+ final Map<String, String> tmpMap = new HashMap<>();
+ try {
+ while (true) {
+ key = getEntry();
+ value = getEntry();
+ tmpMap.put(key, value);
+ }
+ } catch (EOFException e) {
+ // EOF reached on reading value, report broken packet
+ // otherwise ignore it.
+ if (value == null) {
+ throw new JdpException("Broken JDP packet. Key without value." + key);
+ }
+ }
+
+ pmap = Collections.unmodifiableMap(tmpMap);
+ return pmap;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/sun/management/jdp/JdpPacketWriter.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.management.jdp;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+/**
+ * JdpPacketWriter responsible for writing a packet
+ * <p>This class assembles a set of key/value pairs to valid JDP packet,
+ * ready to be sent across a Net</p>
+ */
+public final class JdpPacketWriter {
+
+ private final ByteArrayOutputStream baos;
+ private final DataOutputStream pkt;
+
+ /**
+ * Create a JDP packet, add mandatory magic and version headers
+ *
+ * @throws IOException
+ */
+ public JdpPacketWriter()
+ throws IOException {
+ baos = new ByteArrayOutputStream();
+ pkt = new DataOutputStream(baos);
+
+ pkt.writeInt(JdpGenericPacket.getMagic());
+ pkt.writeShort(JdpGenericPacket.getVersion());
+ }
+
+ /**
+ * Put string entry to packet
+ *
+ * @param entry - string to put (utf-8 encoded)
+ * @throws IOException
+ */
+ public void addEntry(String entry)
+ throws IOException {
+ /* DataOutputStream.writeUTF() do essentially
+ * the same as:
+ * pkt.writeShort(entry.getBytes("UTF-8").length);
+ * pkt.write(entry.getBytes("UTF-8"));
+ */
+ pkt.writeUTF(entry);
+ }
+
+ /**
+ * Put key/value pair to packet
+ *
+ * @param key - key to put (utf-8 encoded)
+ * @param val - value to put (utf-8 encoded)
+ * @throws IOException
+ */
+ public void addEntry(String key, String val)
+ throws IOException {
+ /* Silently skip key if value is null.
+ * We don't need to distinguish between key missing
+ * and key has no value cases
+ */
+ if (val != null) {
+ addEntry(key);
+ addEntry(val);
+ }
+ }
+
+ /**
+ * Return assembled packet as a byte array
+ *
+ * @return packet bytes
+ */
+ public byte[] getPacketBytes() {
+ return baos.toByteArray();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/sun/management/jdp/package-info.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+/**
+ * Summary
+ * -------
+ *
+ * Define a lightweight network protocol for discovering running and
+ * manageable Java processes within a network subnet.
+ *
+ *
+ * Description
+ * -----------
+ *
+ * The protocol is lightweight multicast based, and works like a beacon,
+ * broadcasting the JMXService URL needed to connect to the external JMX
+ * agent if an application is started with appropriate parameters.
+ *
+ * The payload is structured like this:
+ *
+ * 4 bytes JDP magic (0xC0FFEE42)
+ * 2 bytes JDP protocol version (1)
+ * 2 bytes size of the next entry
+ * x bytes next entry (UTF-8 encoded)
+ * 2 bytes size of next entry
+ * ... Rinse and repeat...
+ *
+ * The payload will be parsed as even entries being keys, odd entries being
+ * values.
+ *
+ * The standard JDP packet contains four entries:
+ *
+ * - `DISCOVERABLE_SESSION_UUID` -- Unique id of the instance; this id changes every time
+ * the discovery protocol starts and stops
+ *
+ * - `MAIN_CLASS` -- The value of the `sun.java.command` property
+ *
+ * - `JMX_SERVICE_URL` -- The URL to connect to the JMX agent
+ *
+ * - `INSTANCE_NAME` -- The user-provided name of the running instance
+ *
+ * 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
+ *
+ * - `com.sun.management.jdp.address` -- override default address
+ *
+ * - `com.sun.management.jmxremote.autodiscovery` -- whether we should start autodiscovery or
+ * not. Autodiscovery starts if and only if following conditions are met: (autodiscovery is
+ * true OR (autodiscovery is not set AND jdp.port is set))
+ *
+ * - `com.sun.management.jdp.ttl` -- set ttl for broadcast packet, default is 1
+ * - `com.sun.management.jdp.pause` -- set broadcast interval in seconds default is 5
+ * - `com.sun.management.jdp.source_addr` -- an address of interface to use for broadcast
+ */
+
+package sun.management.jdp;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/sun/management/jmxremote/ConnectorBootstrap.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,1027 @@
+/*
+ * Copyright (c) 2003, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.management.jmxremote;
+
+import java.lang.System.Logger;
+import java.lang.System.Logger.Level;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.lang.management.ManagementFactory;
+import java.net.InetAddress;
+import java.net.MalformedURLException;
+import java.net.Socket;
+import java.net.ServerSocket;
+import java.net.UnknownHostException;
+import java.rmi.NoSuchObjectException;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.registry.Registry;
+import java.rmi.server.RMIClientSocketFactory;
+import java.rmi.server.RMIServerSocketFactory;
+import java.rmi.server.RMISocketFactory;
+import java.rmi.server.RemoteObject;
+import java.rmi.server.UnicastRemoteObject;
+import java.security.KeyStore;
+import java.security.Principal;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import javax.management.MBeanServer;
+import javax.management.remote.JMXAuthenticator;
+import javax.management.remote.JMXConnectorServer;
+import javax.management.remote.JMXConnectorServerFactory;
+import javax.management.remote.JMXServiceURL;
+import javax.management.remote.rmi.RMIConnectorServer;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocket;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManagerFactory;
+import javax.rmi.ssl.SslRMIClientSocketFactory;
+import javax.rmi.ssl.SslRMIServerSocketFactory;
+import javax.security.auth.Subject;
+
+import com.sun.jmx.remote.internal.RMIExporter;
+import com.sun.jmx.remote.security.JMXPluggableAuthenticator;
+
+import jdk.internal.agent.Agent;
+import jdk.internal.agent.AgentConfigurationError;
+import static jdk.internal.agent.AgentConfigurationError.*;
+import jdk.internal.agent.ConnectorAddressLink;
+import jdk.internal.agent.FileSystem;
+import sun.rmi.server.UnicastRef;
+import sun.rmi.server.UnicastServerRef;
+import sun.rmi.server.UnicastServerRef2;
+
+/**
+ * This class initializes and starts the RMIConnectorServer for JSR 163
+ * JMX Monitoring.
+ **/
+public final class ConnectorBootstrap {
+
+ /**
+ * Default values for JMX configuration properties.
+ **/
+ public static interface DefaultValues {
+
+ public static final String PORT = "0";
+ public static final String CONFIG_FILE_NAME = "management.properties";
+ public static final String USE_SSL = "true";
+ public static final String USE_LOCAL_ONLY = "true";
+ public static final String USE_REGISTRY_SSL = "false";
+ public static final String USE_AUTHENTICATION = "true";
+ public static final String PASSWORD_FILE_NAME = "jmxremote.password";
+ public static final String ACCESS_FILE_NAME = "jmxremote.access";
+ public static final String SSL_NEED_CLIENT_AUTH = "false";
+ }
+
+ /**
+ * Names of JMX configuration properties.
+ **/
+ public static interface PropertyNames {
+
+ public static final String PORT =
+ "com.sun.management.jmxremote.port";
+ public static final String HOST =
+ "com.sun.management.jmxremote.host";
+ public static final String RMI_PORT =
+ "com.sun.management.jmxremote.rmi.port";
+ public static final String CONFIG_FILE_NAME =
+ "com.sun.management.config.file";
+ public static final String USE_LOCAL_ONLY =
+ "com.sun.management.jmxremote.local.only";
+ public static final String USE_SSL =
+ "com.sun.management.jmxremote.ssl";
+ public static final String USE_REGISTRY_SSL =
+ "com.sun.management.jmxremote.registry.ssl";
+ public static final String USE_AUTHENTICATION =
+ "com.sun.management.jmxremote.authenticate";
+ public static final String PASSWORD_FILE_NAME =
+ "com.sun.management.jmxremote.password.file";
+ public static final String ACCESS_FILE_NAME =
+ "com.sun.management.jmxremote.access.file";
+ public static final String LOGIN_CONFIG_NAME =
+ "com.sun.management.jmxremote.login.config";
+ public static final String SSL_ENABLED_CIPHER_SUITES =
+ "com.sun.management.jmxremote.ssl.enabled.cipher.suites";
+ public static final String SSL_ENABLED_PROTOCOLS =
+ "com.sun.management.jmxremote.ssl.enabled.protocols";
+ public static final String SSL_NEED_CLIENT_AUTH =
+ "com.sun.management.jmxremote.ssl.need.client.auth";
+ public static final String SSL_CONFIG_FILE_NAME =
+ "com.sun.management.jmxremote.ssl.config.file";
+ }
+
+ /**
+ * JMXConnectorServer associated data.
+ */
+ private static class JMXConnectorServerData {
+
+ public JMXConnectorServerData(
+ JMXConnectorServer jmxConnectorServer,
+ JMXServiceURL jmxRemoteURL) {
+ this.jmxConnectorServer = jmxConnectorServer;
+ this.jmxRemoteURL = jmxRemoteURL;
+ }
+ JMXConnectorServer jmxConnectorServer;
+ JMXServiceURL jmxRemoteURL;
+ }
+
+ /**
+ * <p>Prevents our RMI server objects from keeping the JVM alive.</p>
+ *
+ * <p>We use a private interface in Sun's JMX Remote API implementation
+ * that allows us to specify how to export RMI objects. We do so using
+ * UnicastServerRef, a class in Sun's RMI implementation. This is all
+ * non-portable, of course, so this is only valid because we are inside
+ * Sun's JRE.</p>
+ *
+ * <p>Objects are exported using {@link
+ * UnicastServerRef#exportObject(Remote, Object, boolean)}. The
+ * boolean parameter is called <code>permanent</code> and means
+ * both that the object is not eligible for Distributed Garbage
+ * Collection, and that its continued existence will not prevent
+ * the JVM from exiting. It is the latter semantics we want (we
+ * already have the former because of the way the JMX Remote API
+ * works). Hence the somewhat misleading name of this class.</p>
+ */
+ private static class PermanentExporter implements RMIExporter {
+
+ public Remote exportObject(Remote obj,
+ int port,
+ RMIClientSocketFactory csf,
+ RMIServerSocketFactory ssf)
+ throws RemoteException {
+
+ synchronized (this) {
+ if (firstExported == null) {
+ firstExported = obj;
+ }
+ }
+
+ final UnicastServerRef ref;
+ if (csf == null && ssf == null) {
+ ref = new UnicastServerRef(port);
+ } else {
+ ref = new UnicastServerRef2(port, csf, ssf);
+ }
+ return ref.exportObject(obj, null, true);
+ }
+
+ // Nothing special to be done for this case
+ public boolean unexportObject(Remote obj, boolean force)
+ throws NoSuchObjectException {
+ return UnicastRemoteObject.unexportObject(obj, force);
+ }
+ Remote firstExported;
+ }
+
+ /**
+ * This JMXAuthenticator wraps the JMXPluggableAuthenticator and verifies
+ * that at least one of the principal names contained in the authenticated
+ * Subject is present in the access file.
+ */
+ private static class AccessFileCheckerAuthenticator
+ implements JMXAuthenticator {
+
+ public AccessFileCheckerAuthenticator(Map<String, Object> env) throws IOException {
+ environment = env;
+ accessFile = (String) env.get("jmx.remote.x.access.file");
+ properties = propertiesFromFile(accessFile);
+ }
+
+ public Subject authenticate(Object credentials) {
+ final JMXAuthenticator authenticator =
+ new JMXPluggableAuthenticator(environment);
+ final Subject subject = authenticator.authenticate(credentials);
+ checkAccessFileEntries(subject);
+ return subject;
+ }
+
+ private void checkAccessFileEntries(Subject subject) {
+ if (subject == null) {
+ throw new SecurityException(
+ "Access denied! No matching entries found in " +
+ "the access file [" + accessFile + "] as the " +
+ "authenticated Subject is null");
+ }
+ final Set<Principal> principals = subject.getPrincipals();
+ for (Principal p1: principals) {
+ if (properties.containsKey(p1.getName())) {
+ return;
+ }
+ }
+
+ final Set<String> principalsStr = new HashSet<>();
+ for (Principal p2: principals) {
+ principalsStr.add(p2.getName());
+ }
+ throw new SecurityException(
+ "Access denied! No entries found in the access file [" +
+ accessFile + "] for any of the authenticated identities " +
+ principalsStr);
+ }
+
+ private static Properties propertiesFromFile(String fname)
+ throws IOException {
+ Properties p = new Properties();
+ if (fname == null) {
+ return p;
+ }
+ try (FileInputStream fin = new FileInputStream(fname)) {
+ p.load(fin);
+ }
+ return p;
+ }
+ private final Map<String, Object> environment;
+ private final Properties properties;
+ private final String accessFile;
+ }
+
+ // The variable below is here to support stop functionality
+ // It would be overriten if you call startRemoteCommectionServer second
+ // time. It's OK for now as logic in Agent.java forbids mutiple agents
+ private static Registry registry = null;
+
+ public static void unexportRegistry() {
+ // Remove the entry from registry
+ try {
+ if (registry != null) {
+ UnicastRemoteObject.unexportObject(registry, true);
+ registry = null;
+ }
+ } catch(NoSuchObjectException ex) {
+ // This exception can appears only if we attempt
+ // to unexportRegistry second time. So it's safe
+ // to ignore it without additional messages.
+ }
+ }
+
+ /**
+ * Initializes and starts the JMX Connector Server.
+ * If the com.sun.management.jmxremote.port property is not defined,
+ * simply return. Otherwise, attempts to load the config file, and
+ * then calls {@link #startRemoteConnectorServer
+ * (java.lang.String, java.util.Properties)}.
+ *
+ * This method is used by some jtreg tests.
+ **/
+ public static synchronized JMXConnectorServer initialize() {
+
+ // Load a new management properties
+ final Properties props = Agent.loadManagementProperties();
+ if (props == null) {
+ return null;
+ }
+
+ final String portStr = props.getProperty(PropertyNames.PORT);
+ return startRemoteConnectorServer(portStr, props);
+ }
+
+ /**
+ * This method is used by some jtreg tests.
+ *
+ * @see #startRemoteConnectorServer
+ * (String portStr, Properties props)
+ */
+ public static synchronized JMXConnectorServer initialize(String portStr, Properties props) {
+ return startRemoteConnectorServer(portStr, props);
+ }
+
+ /**
+ * Initializes and starts a JMX Connector Server for remote
+ * monitoring and management.
+ **/
+ public static synchronized JMXConnectorServer startRemoteConnectorServer(String portStr, Properties props) {
+
+ // Get port number
+ final int port;
+ try {
+ port = Integer.parseInt(portStr);
+ } catch (NumberFormatException x) {
+ throw new AgentConfigurationError(INVALID_JMXREMOTE_PORT, x, portStr);
+ }
+ if (port < 0) {
+ throw new AgentConfigurationError(INVALID_JMXREMOTE_PORT, portStr);
+ }
+
+ // User can specify a port to be used to export rmi object,
+ // in order to simplify firewall rules
+ // if port is not specified random one will be allocated.
+ int rmiPort = 0;
+ String rmiPortStr = props.getProperty(PropertyNames.RMI_PORT);
+ try {
+ if (rmiPortStr != null) {
+ rmiPort = Integer.parseInt(rmiPortStr);
+ }
+ } catch (NumberFormatException x) {
+ throw new AgentConfigurationError(INVALID_JMXREMOTE_RMI_PORT, x, rmiPortStr);
+ }
+ if (rmiPort < 0) {
+ throw new AgentConfigurationError(INVALID_JMXREMOTE_RMI_PORT, rmiPortStr);
+ }
+
+ // Do we use authentication?
+ final String useAuthenticationStr =
+ props.getProperty(PropertyNames.USE_AUTHENTICATION,
+ DefaultValues.USE_AUTHENTICATION);
+ final boolean useAuthentication =
+ Boolean.valueOf(useAuthenticationStr).booleanValue();
+
+ // Do we use SSL?
+ final String useSslStr =
+ props.getProperty(PropertyNames.USE_SSL,
+ DefaultValues.USE_SSL);
+ final boolean useSsl =
+ Boolean.valueOf(useSslStr).booleanValue();
+
+ // Do we use RMI Registry SSL?
+ final String useRegistrySslStr =
+ props.getProperty(PropertyNames.USE_REGISTRY_SSL,
+ DefaultValues.USE_REGISTRY_SSL);
+ final boolean useRegistrySsl =
+ Boolean.valueOf(useRegistrySslStr).booleanValue();
+
+ final String enabledCipherSuites =
+ props.getProperty(PropertyNames.SSL_ENABLED_CIPHER_SUITES);
+ String enabledCipherSuitesList[] = null;
+ if (enabledCipherSuites != null) {
+ StringTokenizer st = new StringTokenizer(enabledCipherSuites, ",");
+ int tokens = st.countTokens();
+ enabledCipherSuitesList = new String[tokens];
+ for (int i = 0; i < tokens; i++) {
+ enabledCipherSuitesList[i] = st.nextToken();
+ }
+ }
+
+ final String enabledProtocols =
+ props.getProperty(PropertyNames.SSL_ENABLED_PROTOCOLS);
+ String enabledProtocolsList[] = null;
+ if (enabledProtocols != null) {
+ StringTokenizer st = new StringTokenizer(enabledProtocols, ",");
+ int tokens = st.countTokens();
+ enabledProtocolsList = new String[tokens];
+ for (int i = 0; i < tokens; i++) {
+ enabledProtocolsList[i] = st.nextToken();
+ }
+ }
+
+ final String sslNeedClientAuthStr =
+ props.getProperty(PropertyNames.SSL_NEED_CLIENT_AUTH,
+ DefaultValues.SSL_NEED_CLIENT_AUTH);
+ final boolean sslNeedClientAuth =
+ Boolean.valueOf(sslNeedClientAuthStr).booleanValue();
+
+ // Read SSL config file name
+ final String sslConfigFileName =
+ props.getProperty(PropertyNames.SSL_CONFIG_FILE_NAME);
+
+ String loginConfigName = null;
+ String passwordFileName = null;
+ String accessFileName = null;
+
+ // Initialize settings when authentication is active
+ if (useAuthentication) {
+
+ // Get non-default login configuration
+ loginConfigName =
+ props.getProperty(PropertyNames.LOGIN_CONFIG_NAME);
+
+ if (loginConfigName == null) {
+ // Get password file
+ passwordFileName =
+ props.getProperty(PropertyNames.PASSWORD_FILE_NAME,
+ getDefaultFileName(DefaultValues.PASSWORD_FILE_NAME));
+ checkPasswordFile(passwordFileName);
+ }
+
+ // Get access file
+ accessFileName = props.getProperty(PropertyNames.ACCESS_FILE_NAME,
+ getDefaultFileName(DefaultValues.ACCESS_FILE_NAME));
+ checkAccessFile(accessFileName);
+ }
+
+ final String bindAddress =
+ props.getProperty(PropertyNames.HOST);
+
+ if (logger.isLoggable(Level.DEBUG)) {
+ logger.log(Level.DEBUG, "startRemoteConnectorServer",
+ Agent.getText("jmxremote.ConnectorBootstrap.starting") +
+ "\n\t" + PropertyNames.PORT + "=" + port +
+ (bindAddress == null ? "" : "\n\t" + PropertyNames.HOST + "=" + bindAddress) +
+ "\n\t" + PropertyNames.RMI_PORT + "=" + rmiPort +
+ "\n\t" + PropertyNames.USE_SSL + "=" + useSsl +
+ "\n\t" + PropertyNames.USE_REGISTRY_SSL + "=" + useRegistrySsl +
+ "\n\t" + PropertyNames.SSL_CONFIG_FILE_NAME + "=" + sslConfigFileName +
+ "\n\t" + PropertyNames.SSL_ENABLED_CIPHER_SUITES + "=" +
+ enabledCipherSuites +
+ "\n\t" + PropertyNames.SSL_ENABLED_PROTOCOLS + "=" +
+ enabledProtocols +
+ "\n\t" + PropertyNames.SSL_NEED_CLIENT_AUTH + "=" +
+ sslNeedClientAuth +
+ "\n\t" + PropertyNames.USE_AUTHENTICATION + "=" +
+ useAuthentication +
+ (useAuthentication ? (loginConfigName == null ? ("\n\t" + PropertyNames.PASSWORD_FILE_NAME + "=" +
+ passwordFileName) : ("\n\t" + PropertyNames.LOGIN_CONFIG_NAME + "=" +
+ loginConfigName)) : "\n\t" +
+ Agent.getText("jmxremote.ConnectorBootstrap.noAuthentication")) +
+ (useAuthentication ? ("\n\t" + PropertyNames.ACCESS_FILE_NAME + "=" +
+ accessFileName) : "") +
+ "");
+ }
+
+ final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+ JMXConnectorServer cs = null;
+ JMXServiceURL url = null;
+ try {
+ final JMXConnectorServerData data = exportMBeanServer(
+ mbs, port, rmiPort, useSsl, useRegistrySsl,
+ sslConfigFileName, enabledCipherSuitesList,
+ enabledProtocolsList, sslNeedClientAuth,
+ useAuthentication, loginConfigName,
+ passwordFileName, accessFileName, bindAddress);
+ cs = data.jmxConnectorServer;
+ url = data.jmxRemoteURL;
+ config("startRemoteConnectorServer",
+ Agent.getText("jmxremote.ConnectorBootstrap.ready",
+ url.toString()));
+ } catch (Exception e) {
+ throw new AgentConfigurationError(AGENT_EXCEPTION, e, e.toString());
+ }
+ try {
+ // Export remote connector address and associated configuration
+ // properties to the instrumentation buffer.
+ Map<String, String> properties = new HashMap<>();
+ properties.put("remoteAddress", url.toString());
+ properties.put("authenticate", useAuthenticationStr);
+ properties.put("ssl", useSslStr);
+ properties.put("sslRegistry", useRegistrySslStr);
+ properties.put("sslNeedClientAuth", sslNeedClientAuthStr);
+ ConnectorAddressLink.exportRemote(properties);
+ } catch (Exception e) {
+ // Remote connector server started but unable to export remote
+ // connector address and associated configuration properties to
+ // the instrumentation buffer - non-fatal error.
+ config("startRemoteConnectorServer", e);
+ }
+ return cs;
+ }
+
+ /*
+ * Creates and starts a RMI Connector Server for "local" monitoring
+ * and management.
+ */
+ public static JMXConnectorServer startLocalConnectorServer() {
+ // Ensure cryptographically strong random number generater used
+ // to choose the object number - see java.rmi.server.ObjID
+ System.setProperty("java.rmi.server.randomIDs", "true");
+
+ // This RMI server should not keep the VM alive
+ Map<String, Object> env = new HashMap<>();
+ env.put(RMIExporter.EXPORTER_ATTRIBUTE, new PermanentExporter());
+ env.put(RMIConnectorServer.CREDENTIAL_TYPES, new String[]{
+ String[].class.getName(), String.class.getName()
+ });
+
+ // The local connector server need only be available via the
+ // loopback connection.
+ String localhost = "localhost";
+ InetAddress lh = null;
+ try {
+ lh = InetAddress.getByName(localhost);
+ localhost = lh.getHostAddress();
+ } catch (UnknownHostException x) {
+ }
+
+ // localhost unknown or (somehow) didn't resolve to
+ // a loopback address.
+ if (lh == null || !lh.isLoopbackAddress()) {
+ localhost = "127.0.0.1";
+ }
+
+ MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+ try {
+ JMXServiceURL url = new JMXServiceURL("rmi", localhost, 0);
+ // Do we accept connections from local interfaces only?
+ Properties props = Agent.getManagementProperties();
+ if (props == null) {
+ props = new Properties();
+ }
+ String useLocalOnlyStr = props.getProperty(
+ PropertyNames.USE_LOCAL_ONLY, DefaultValues.USE_LOCAL_ONLY);
+ boolean useLocalOnly = Boolean.valueOf(useLocalOnlyStr).booleanValue();
+ if (useLocalOnly) {
+ env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE,
+ new LocalRMIServerSocketFactory());
+ }
+ JMXConnectorServer server =
+ JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);
+ server.start();
+ return server;
+ } catch (Exception e) {
+ throw new AgentConfigurationError(AGENT_EXCEPTION, e, e.toString());
+ }
+ }
+
+ private static void checkPasswordFile(String passwordFileName) {
+ if (passwordFileName == null || passwordFileName.length() == 0) {
+ throw new AgentConfigurationError(PASSWORD_FILE_NOT_SET);
+ }
+ File file = new File(passwordFileName);
+ if (!file.exists()) {
+ throw new AgentConfigurationError(PASSWORD_FILE_NOT_FOUND, passwordFileName);
+ }
+
+ if (!file.canRead()) {
+ throw new AgentConfigurationError(PASSWORD_FILE_NOT_READABLE, passwordFileName);
+ }
+
+ FileSystem fs = FileSystem.open();
+ try {
+ if (fs.supportsFileSecurity(file)) {
+ if (!fs.isAccessUserOnly(file)) {
+ final String msg = Agent.getText("jmxremote.ConnectorBootstrap.password.readonly",
+ passwordFileName);
+ config("startRemoteConnectorServer", msg);
+ throw new AgentConfigurationError(PASSWORD_FILE_ACCESS_NOT_RESTRICTED,
+ passwordFileName);
+ }
+ }
+ } catch (IOException e) {
+ throw new AgentConfigurationError(PASSWORD_FILE_READ_FAILED,
+ e, passwordFileName);
+ }
+ }
+
+ private static void checkAccessFile(String accessFileName) {
+ if (accessFileName == null || accessFileName.length() == 0) {
+ throw new AgentConfigurationError(ACCESS_FILE_NOT_SET);
+ }
+ File file = new File(accessFileName);
+ if (!file.exists()) {
+ throw new AgentConfigurationError(ACCESS_FILE_NOT_FOUND, accessFileName);
+ }
+
+ if (!file.canRead()) {
+ throw new AgentConfigurationError(ACCESS_FILE_NOT_READABLE, accessFileName);
+ }
+ }
+
+ private static void checkRestrictedFile(String restrictedFileName) {
+ if (restrictedFileName == null || restrictedFileName.length() == 0) {
+ throw new AgentConfigurationError(FILE_NOT_SET);
+ }
+ File file = new File(restrictedFileName);
+ if (!file.exists()) {
+ throw new AgentConfigurationError(FILE_NOT_FOUND, restrictedFileName);
+ }
+ if (!file.canRead()) {
+ throw new AgentConfigurationError(FILE_NOT_READABLE, restrictedFileName);
+ }
+ FileSystem fs = FileSystem.open();
+ try {
+ if (fs.supportsFileSecurity(file)) {
+ if (!fs.isAccessUserOnly(file)) {
+ final String msg = Agent.getText(
+ "jmxremote.ConnectorBootstrap.file.readonly",
+ restrictedFileName);
+ config("startRemoteConnectorServer", msg);
+ throw new AgentConfigurationError(
+ FILE_ACCESS_NOT_RESTRICTED, restrictedFileName);
+ }
+ }
+ } catch (IOException e) {
+ throw new AgentConfigurationError(
+ FILE_READ_FAILED, e, restrictedFileName);
+ }
+ }
+
+ /**
+ * Compute the full path name for a default file.
+ * @param basename basename (with extension) of the default file.
+ * @return ${JRE}/conf/management/${basename}
+ **/
+ private static String getDefaultFileName(String basename) {
+ final String fileSeparator = File.separator;
+ return System.getProperty("java.home") + fileSeparator + "conf" +
+ fileSeparator + "management" + fileSeparator +
+ basename;
+ }
+
+ private static SslRMIServerSocketFactory createSslRMIServerSocketFactory(
+ String sslConfigFileName,
+ String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean sslNeedClientAuth,
+ String bindAddress) {
+ if (sslConfigFileName == null) {
+ return new HostAwareSslSocketFactory(
+ enabledCipherSuites,
+ enabledProtocols,
+ sslNeedClientAuth, bindAddress);
+ } else {
+ checkRestrictedFile(sslConfigFileName);
+ try {
+ // Load the SSL keystore properties from the config file
+ Properties p = new Properties();
+ try (InputStream in = new FileInputStream(sslConfigFileName)) {
+ BufferedInputStream bin = new BufferedInputStream(in);
+ p.load(bin);
+ }
+ String keyStore =
+ p.getProperty("javax.net.ssl.keyStore");
+ String keyStorePassword =
+ p.getProperty("javax.net.ssl.keyStorePassword", "");
+ String trustStore =
+ p.getProperty("javax.net.ssl.trustStore");
+ String trustStorePassword =
+ p.getProperty("javax.net.ssl.trustStorePassword", "");
+
+ char[] keyStorePasswd = null;
+ if (keyStorePassword.length() != 0) {
+ keyStorePasswd = keyStorePassword.toCharArray();
+ }
+
+ char[] trustStorePasswd = null;
+ if (trustStorePassword.length() != 0) {
+ trustStorePasswd = trustStorePassword.toCharArray();
+ }
+
+ KeyStore ks = null;
+ if (keyStore != null) {
+ ks = KeyStore.getInstance(KeyStore.getDefaultType());
+ try (FileInputStream ksfis = new FileInputStream(keyStore)) {
+ ks.load(ksfis, keyStorePasswd);
+ }
+ }
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance(
+ KeyManagerFactory.getDefaultAlgorithm());
+ kmf.init(ks, keyStorePasswd);
+
+ KeyStore ts = null;
+ if (trustStore != null) {
+ ts = KeyStore.getInstance(KeyStore.getDefaultType());
+ try (FileInputStream tsfis = new FileInputStream(trustStore)) {
+ ts.load(tsfis, trustStorePasswd);
+ }
+ }
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance(
+ TrustManagerFactory.getDefaultAlgorithm());
+ tmf.init(ts);
+
+ SSLContext ctx = SSLContext.getInstance("SSL");
+ ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+
+ return new HostAwareSslSocketFactory(
+ ctx,
+ enabledCipherSuites,
+ enabledProtocols,
+ sslNeedClientAuth, bindAddress);
+ } catch (Exception e) {
+ throw new AgentConfigurationError(AGENT_EXCEPTION, e, e.toString());
+ }
+ }
+ }
+
+ private static JMXConnectorServerData exportMBeanServer(
+ MBeanServer mbs,
+ int port,
+ int rmiPort,
+ boolean useSsl,
+ boolean useRegistrySsl,
+ String sslConfigFileName,
+ String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean sslNeedClientAuth,
+ boolean useAuthentication,
+ String loginConfigName,
+ String passwordFileName,
+ String accessFileName,
+ String bindAddress)
+ throws IOException, MalformedURLException {
+
+ /* Make sure we use non-guessable RMI object IDs. Otherwise
+ * attackers could hijack open connections by guessing their
+ * IDs. */
+ System.setProperty("java.rmi.server.randomIDs", "true");
+
+ JMXServiceURL url = new JMXServiceURL("rmi", bindAddress, rmiPort);
+
+ Map<String, Object> env = new HashMap<>();
+
+ PermanentExporter exporter = new PermanentExporter();
+
+ env.put(RMIExporter.EXPORTER_ATTRIBUTE, exporter);
+ env.put(RMIConnectorServer.CREDENTIAL_TYPES, new String[]{
+ String[].class.getName(), String.class.getName()
+ });
+
+ boolean useSocketFactory = bindAddress != null && !useSsl;
+
+ if (useAuthentication) {
+ if (loginConfigName != null) {
+ env.put("jmx.remote.x.login.config", loginConfigName);
+ }
+ if (passwordFileName != null) {
+ env.put("jmx.remote.x.password.file", passwordFileName);
+ }
+
+ env.put("jmx.remote.x.access.file", accessFileName);
+
+ if (env.get("jmx.remote.x.password.file") != null ||
+ env.get("jmx.remote.x.login.config") != null) {
+ env.put(JMXConnectorServer.AUTHENTICATOR,
+ new AccessFileCheckerAuthenticator(env));
+ }
+ }
+
+ RMIClientSocketFactory csf = null;
+ RMIServerSocketFactory ssf = null;
+
+ if (useSsl || useRegistrySsl) {
+ csf = new SslRMIClientSocketFactory();
+ ssf = createSslRMIServerSocketFactory(
+ sslConfigFileName, enabledCipherSuites,
+ enabledProtocols, sslNeedClientAuth, bindAddress);
+ }
+
+ if (useSsl) {
+ env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE,
+ csf);
+ env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE,
+ ssf);
+ }
+
+ if (useSocketFactory) {
+ ssf = new HostAwareSocketFactory(bindAddress);
+ env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE,
+ ssf);
+ }
+
+ JMXConnectorServer connServer = null;
+ try {
+ connServer =
+ JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);
+ connServer.start();
+ } catch (IOException e) {
+ if (connServer == null || connServer.getAddress() == null) {
+ throw new AgentConfigurationError(CONNECTOR_SERVER_IO_ERROR,
+ e, url.toString());
+ } else {
+ throw new AgentConfigurationError(CONNECTOR_SERVER_IO_ERROR,
+ e, connServer.getAddress().toString());
+ }
+ }
+
+ if (useRegistrySsl) {
+ registry =
+ new SingleEntryRegistry(port, csf, ssf,
+ "jmxrmi", exporter.firstExported);
+ } else if (useSocketFactory) {
+ registry =
+ new SingleEntryRegistry(port, csf, ssf,
+ "jmxrmi", exporter.firstExported);
+ } else {
+ registry =
+ new SingleEntryRegistry(port,
+ "jmxrmi", exporter.firstExported);
+ }
+
+
+ int registryPort =
+ ((UnicastRef) ((RemoteObject) registry).getRef()).getLiveRef().getPort();
+ String jmxUrlStr = String.format("service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi",
+ url.getHost(), registryPort);
+ JMXServiceURL remoteURL = new JMXServiceURL(jmxUrlStr);
+
+ /* Our exporter remembers the first object it was asked to
+ export, which will be an RMIServerImpl appropriate for
+ publication in our special registry. We could
+ alternatively have constructed the RMIServerImpl explicitly
+ and then constructed an RMIConnectorServer passing it as a
+ parameter, but that's quite a bit more verbose and pulls in
+ lots of knowledge of the RMI connector. */
+
+ return new JMXConnectorServerData(connServer, remoteURL);
+ }
+
+ /**
+ * This class cannot be instantiated.
+ **/
+ private ConnectorBootstrap() {
+ }
+
+ private static final Logger logger =
+ System.getLogger(ConnectorBootstrap.class.getPackageName());
+ private static void config(String func, String msg) {
+ logger.log(Level.DEBUG, msg);
+ }
+
+ private static void config(String func, Throwable t) {
+ logger.log(Level.DEBUG, "ConnectorBootstrap::" + func, t);
+ }
+
+ private static void config(String func, String msg, Throwable t) {
+ logger.log(Level.DEBUG, msg, t);
+ }
+
+ private static class HostAwareSocketFactory implements RMIServerSocketFactory {
+
+ private final String bindAddress;
+
+ private HostAwareSocketFactory(String bindAddress) {
+ this.bindAddress = bindAddress;
+ }
+
+ @Override
+ public ServerSocket createServerSocket(int port) throws IOException {
+ if (bindAddress == null) {
+ return new ServerSocket(port);
+ } else {
+ try {
+ InetAddress addr = InetAddress.getByName(bindAddress);
+ return new ServerSocket(port, 0, addr);
+ } catch (UnknownHostException e) {
+ return new ServerSocket(port);
+ }
+ }
+ }
+ }
+
+ private static class HostAwareSslSocketFactory extends SslRMIServerSocketFactory {
+
+ private final String bindAddress;
+ private final String[] enabledCipherSuites;
+ private final String[] enabledProtocols;
+ private final boolean needClientAuth;
+ private final SSLContext context;
+
+ private HostAwareSslSocketFactory(String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean sslNeedClientAuth,
+ String bindAddress) throws IllegalArgumentException {
+ this(null, enabledCipherSuites, enabledProtocols, sslNeedClientAuth, bindAddress);
+ }
+
+ private HostAwareSslSocketFactory(SSLContext ctx,
+ String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean sslNeedClientAuth,
+ String bindAddress) throws IllegalArgumentException {
+ this.context = ctx;
+ this.bindAddress = bindAddress;
+ this.enabledProtocols = enabledProtocols;
+ this.enabledCipherSuites = enabledCipherSuites;
+ this.needClientAuth = sslNeedClientAuth;
+ checkValues(ctx, enabledCipherSuites, enabledProtocols);
+ }
+
+ @Override
+ public ServerSocket createServerSocket(int port) throws IOException {
+ if (bindAddress != null) {
+ try {
+ InetAddress addr = InetAddress.getByName(bindAddress);
+ return new SslServerSocket(port, 0, addr, context,
+ enabledCipherSuites, enabledProtocols, needClientAuth);
+ } catch (UnknownHostException e) {
+ return new SslServerSocket(port, context,
+ enabledCipherSuites, enabledProtocols, needClientAuth);
+ }
+ } else {
+ return new SslServerSocket(port, context,
+ enabledCipherSuites, enabledProtocols, needClientAuth);
+ }
+ }
+
+ private static void checkValues(SSLContext context,
+ String[] enabledCipherSuites,
+ String[] enabledProtocols) throws IllegalArgumentException {
+ // Force the initialization of the default at construction time,
+ // rather than delaying it to the first time createServerSocket()
+ // is called.
+ //
+ final SSLSocketFactory sslSocketFactory =
+ context == null ?
+ (SSLSocketFactory)SSLSocketFactory.getDefault() : context.getSocketFactory();
+ SSLSocket sslSocket = null;
+ if (enabledCipherSuites != null || enabledProtocols != null) {
+ try {
+ sslSocket = (SSLSocket) sslSocketFactory.createSocket();
+ } catch (Exception e) {
+ final String msg = "Unable to check if the cipher suites " +
+ "and protocols to enable are supported";
+ throw (IllegalArgumentException)
+ new IllegalArgumentException(msg).initCause(e);
+ }
+ }
+
+ // Check if all the cipher suites and protocol versions to enable
+ // are supported by the underlying SSL/TLS implementation and if
+ // true create lists from arrays.
+ //
+ if (enabledCipherSuites != null) {
+ sslSocket.setEnabledCipherSuites(enabledCipherSuites);
+ }
+ if (enabledProtocols != null) {
+ sslSocket.setEnabledProtocols(enabledProtocols);
+ }
+ }
+ }
+
+ private static class SslServerSocket extends ServerSocket {
+
+ private static SSLSocketFactory defaultSSLSocketFactory;
+ private final String[] enabledCipherSuites;
+ private final String[] enabledProtocols;
+ private final boolean needClientAuth;
+ private final SSLContext context;
+
+ private SslServerSocket(int port,
+ SSLContext ctx,
+ String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean needClientAuth) throws IOException {
+ super(port);
+ this.enabledProtocols = enabledProtocols;
+ this.enabledCipherSuites = enabledCipherSuites;
+ this.needClientAuth = needClientAuth;
+ this.context = ctx;
+ }
+
+ private SslServerSocket(int port,
+ int backlog,
+ InetAddress bindAddr,
+ SSLContext ctx,
+ String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean needClientAuth) throws IOException {
+ super(port, backlog, bindAddr);
+ this.enabledProtocols = enabledProtocols;
+ this.enabledCipherSuites = enabledCipherSuites;
+ this.needClientAuth = needClientAuth;
+ this.context = ctx;
+ }
+
+ @Override
+ public Socket accept() throws IOException {
+ final SSLSocketFactory sslSocketFactory =
+ context == null ?
+ getDefaultSSLSocketFactory() : context.getSocketFactory();
+ Socket socket = super.accept();
+ SSLSocket sslSocket = (SSLSocket) sslSocketFactory.createSocket(
+ socket, socket.getInetAddress().getHostName(),
+ socket.getPort(), true);
+ sslSocket.setUseClientMode(false);
+ if (enabledCipherSuites != null) {
+ sslSocket.setEnabledCipherSuites(enabledCipherSuites);
+ }
+ if (enabledProtocols != null) {
+ sslSocket.setEnabledProtocols(enabledProtocols);
+ }
+ sslSocket.setNeedClientAuth(needClientAuth);
+ return sslSocket;
+ }
+
+ private static synchronized SSLSocketFactory getDefaultSSLSocketFactory() {
+ if (defaultSSLSocketFactory == null) {
+ defaultSSLSocketFactory = (SSLSocketFactory)SSLSocketFactory.getDefault();
+ return defaultSSLSocketFactory;
+ } else {
+ return defaultSSLSocketFactory;
+ }
+ }
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/sun/management/jmxremote/LocalRMIServerSocketFactory.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.management.jmxremote;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketException;
+import java.rmi.server.RMIServerSocketFactory;
+import java.util.Enumeration;
+
+/**
+ * This RMI server socket factory creates server sockets that
+ * will only accept connection requests from clients running
+ * on the host where the RMI remote objects have been exported.
+ */
+public final class LocalRMIServerSocketFactory implements RMIServerSocketFactory {
+ /**
+ * Creates a server socket that only accepts connection requests from
+ * clients running on the host where the RMI remote objects have been
+ * exported.
+ */
+ public ServerSocket createServerSocket(int port) throws IOException {
+ return new ServerSocket(port) {
+ @Override
+ public Socket accept() throws IOException {
+ final Socket socket = super.accept();
+ final InetAddress remoteAddr = socket.getInetAddress();
+ final String msg = "The server sockets created using the " +
+ "LocalRMIServerSocketFactory only accept connections " +
+ "from clients running on the host where the RMI " +
+ "remote objects have been exported.";
+
+ if (remoteAddr == null) {
+ // Though unlikeky, the socket could be already
+ // closed... Send a more detailed message in
+ // this case. Also avoid throwing NullPointerExceptiion
+ //
+ String details = "";
+ if (socket.isClosed()) {
+ details = " Socket is closed.";
+ } else if (!socket.isConnected()) {
+ details = " Socket is not connected";
+ }
+ try {
+ socket.close();
+ } catch (Exception ok) {
+ // ok - this is just cleanup before throwing detailed
+ // exception.
+ }
+ throw new IOException(msg +
+ " Couldn't determine client address." +
+ details);
+ } else if (remoteAddr.isLoopbackAddress()) {
+ // local address: accept the connection.
+ return socket;
+ }
+ // Retrieve all the network interfaces on this host.
+ Enumeration<NetworkInterface> nis;
+ try {
+ nis = NetworkInterface.getNetworkInterfaces();
+ } catch (SocketException e) {
+ try {
+ socket.close();
+ } catch (IOException ioe) {
+ // Ignore...
+ }
+ throw new IOException(msg, e);
+ }
+ // Walk through the network interfaces to see
+ // if any of them matches the client's address.
+ // If true, then the client's address is local.
+ while (nis.hasMoreElements()) {
+ NetworkInterface ni = nis.nextElement();
+ Enumeration<InetAddress> addrs = ni.getInetAddresses();
+ while (addrs.hasMoreElements()) {
+ InetAddress localAddr = addrs.nextElement();
+ if (localAddr.equals(remoteAddr)) {
+ return socket;
+ }
+ }
+ }
+ // The client's address is remote so refuse the connection.
+ try {
+ socket.close();
+ } catch (IOException ioe) {
+ // Ignore...
+ }
+ throw new IOException(msg);
+ }
+ };
+ }
+
+ /**
+ * Two LocalRMIServerSocketFactory objects
+ * are equal if they are of the same type.
+ */
+ @Override
+ public boolean equals(Object obj) {
+ return (obj instanceof LocalRMIServerSocketFactory);
+ }
+
+ /**
+ * Returns a hash code value for this LocalRMIServerSocketFactory.
+ */
+ @Override
+ public int hashCode() {
+ return getClass().hashCode();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/sun/management/jmxremote/SingleEntryRegistry.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2003, 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.
+ */
+
+/*
+ * @author Sun Microsystems, Inc.
+ * @build @BUILD_TAG_PLACEHOLDER@
+ *
+ * @COPYRIGHT_MINI_LEGAL_NOTICE_PLACEHOLDER@
+ */
+
+package sun.management.jmxremote;
+
+import java.rmi.AccessException;
+import java.rmi.NotBoundException;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.server.RMIClientSocketFactory;
+import java.rmi.server.RMIServerSocketFactory;
+
+import sun.rmi.registry.RegistryImpl;
+
+/** A Registry that consists of a single entry that never changes. */
+public class SingleEntryRegistry extends RegistryImpl {
+ SingleEntryRegistry(int port, String name, Remote object)
+ throws RemoteException {
+ super(port);
+ this.name = name;
+ this.object = object;
+ }
+
+ SingleEntryRegistry(int port,
+ RMIClientSocketFactory csf,
+ RMIServerSocketFactory ssf,
+ String name,
+ Remote object)
+ throws RemoteException {
+ super(port, csf, ssf);
+ this.name = name;
+ this.object = object;
+ }
+
+ public String[] list() {
+ return new String[] {name};
+ }
+
+ public Remote lookup(String name) throws NotBoundException {
+ if (name.equals(this.name))
+ return object;
+ throw new NotBoundException("Not bound: \"" + name + "\" (only " +
+ "bound name is \"" + this.name + "\")");
+ }
+
+ public void bind(String name, Remote obj) throws AccessException {
+ throw new AccessException("Cannot modify this registry");
+ }
+
+ public void rebind(String name, Remote obj) throws AccessException {
+ throw new AccessException("Cannot modify this registry");
+ }
+
+ public void unbind(String name) throws AccessException {
+ throw new AccessException("Cannot modify this registry");
+ }
+
+ private final String name;
+ private final Remote object;
+
+ private static final long serialVersionUID = -4897238949499730950L;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/classes/sun/management/jmxremote/package.html Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+ Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation. 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.
+
+-->
+
+</head>
+<body bgcolor="white">
+
+Provides classes that make it possible to create a JMX RMI Connector Server
+at bootstrap for the JSR 163 instrumentation.
+
+@since 1.5
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/conf/jmxremote.access Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,79 @@
+######################################################################
+# Default Access Control File for Remote JMX(TM) Monitoring
+######################################################################
+#
+# Access control file for Remote JMX API access to monitoring.
+# This file defines the allowed access for different roles. The
+# password file (jmxremote.password by default) defines the roles and their
+# passwords. To be functional, a role must have an entry in
+# both the password and the access files.
+#
+# The default location of this file is $JRE/conf/management/jmxremote.access
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/conf/management/management.properties
+# (See that file for details)
+#
+# The file format for password and access files is syntactically the same
+# as the Properties file format. The syntax is described in the Javadoc
+# for java.util.Properties.load.
+# A typical access file has multiple lines, where each line is blank,
+# a comment (like this one), or an access control entry.
+#
+# An access control entry consists of a role name, and an
+# associated access level. The role name is any string that does not
+# itself contain spaces or tabs. It corresponds to an entry in the
+# password file (jmxremote.password). The access level is one of the
+# following:
+# "readonly" grants access to read attributes of MBeans.
+# For monitoring, this means that a remote client in this
+# role can read measurements but cannot perform any action
+# that changes the environment of the running program.
+# "readwrite" grants access to read and write attributes of MBeans,
+# to invoke operations on them, and optionally
+# to create or remove them. This access should be granted
+# only to trusted clients, since they can potentially
+# interfere with the smooth operation of a running program.
+#
+# The "readwrite" access level can optionally be followed by the "create" and/or
+# "unregister" keywords. The "unregister" keyword grants access to unregister
+# (delete) MBeans. The "create" keyword grants access to create MBeans of a
+# particular class or of any class matching a particular pattern. Access
+# should only be granted to create MBeans of known and trusted classes.
+#
+# For example, the following entry would grant readwrite access
+# to "controlRole", as well as access to create MBeans of the class
+# javax.management.monitor.CounterMonitor and to unregister any MBean:
+# controlRole readwrite \
+# create javax.management.monitor.CounterMonitorMBean \
+# unregister
+# or equivalently:
+# controlRole readwrite unregister create javax.management.monitor.CounterMBean
+#
+# The following entry would grant readwrite access as well as access to create
+# MBeans of any class in the packages javax.management.monitor and
+# javax.management.timer:
+# controlRole readwrite \
+# create javax.management.monitor.*,javax.management.timer.* \
+# unregister
+#
+# The \ character is defined in the Properties file syntax to allow continuation
+# lines as shown here. A * in a class pattern matches a sequence of characters
+# other than dot (.), so javax.management.monitor.* matches
+# javax.management.monitor.CounterMonitor but not
+# javax.management.monitor.foo.Bar.
+#
+# A given role should have at most one entry in this file. If a role
+# has no entry, it has no access.
+# If multiple entries are found for the same role name, then the last
+# access entry is used.
+#
+#
+# Default access control entries:
+# o The "monitorRole" role has readonly access.
+# o The "controlRole" role has readwrite access and can create the standard
+# Timer and Monitor MBeans defined by the JMX API.
+
+monitorRole readonly
+controlRole readwrite \
+ create javax.management.monitor.*,javax.management.timer.* \
+ unregister
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/conf/jmxremote.password.template Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,64 @@
+# ----------------------------------------------------------------------
+# Template for jmxremote.password
+#
+# o Copy this template to jmxremote.password
+# o Set the user/password entries in jmxremote.password
+# o Change the permission of jmxremote.password to read-only
+# by the owner.
+#
+# See below for the location of jmxremote.password file.
+# ----------------------------------------------------------------------
+
+##############################################################
+# Password File for Remote JMX Monitoring
+##############################################################
+#
+# Password file for Remote JMX API access to monitoring. This
+# file defines the different roles and their passwords. The access
+# control file (jmxremote.access by default) defines the allowed
+# access for each role. To be functional, a role must have an entry
+# in both the password and the access files.
+#
+# Default location of this file is $JRE/conf/management/jmxremote.password
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/conf/management/management.properties
+# or by specifying a system property (See that file for details).
+
+
+##############################################################
+# File permissions of the jmxremote.password file
+##############################################################
+# Since there are cleartext passwords stored in this file,
+# this file must be readable by ONLY the owner,
+# otherwise the program will exit with an error.
+#
+# The file format for password and access files is syntactically the same
+# as the Properties file format. The syntax is described in the Javadoc
+# for java.util.Properties.load.
+# Typical password file has multiple lines, where each line is blank,
+# a comment (like this one), or a password entry.
+#
+#
+# A password entry consists of a role name and an associated
+# password. The role name is any string that does not itself contain
+# spaces or tabs. The password is again any string that does not
+# contain spaces or tabs. Note that passwords appear in the clear in
+# this file, so it is a good idea not to use valuable passwords.
+#
+# A given role should have at most one entry in this file. If a role
+# has no entry, it has no access.
+# If multiple entries are found for the same role name, then the last one
+# is used.
+#
+# In a typical installation, this file can be read by anybody on the
+# local machine, and possibly by people on other machines.
+# For # security, you should either restrict the access to this file,
+# or specify another, less accessible file in the management config file
+# as described above.
+#
+# Following are two commented-out entries. The "measureRole" role has
+# password "QED". The "controlRole" role has password "R&D".
+#
+# monitorRole QED
+# controlRole R&D
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/share/conf/management.properties Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,331 @@
+#####################################################################
+# Default Configuration File for Java Platform Management
+#####################################################################
+#
+# The Management Configuration file (in java.util.Properties format)
+# will be read if one of the following system properties is set:
+# -Dcom.sun.management.jmxremote.port=<port-number>
+# or -Dcom.sun.management.snmp.port=<port-number>
+# or -Dcom.sun.management.config.file=<this-file>
+#
+# The default Management Configuration file is:
+#
+# $JRE/conf/management/management.properties
+#
+# Another location for the Management Configuration File can be specified
+# by the following property on the Java command line:
+#
+# -Dcom.sun.management.config.file=<this-file>
+#
+# If -Dcom.sun.management.config.file=<this-file> is set, the port
+# number for the management agent can be specified in the config file
+# using the following lines:
+#
+# ################ Management Agent Port #########################
+#
+# For setting the JMX RMI agent port use the following line
+# com.sun.management.jmxremote.port=<port-number>
+#
+# For setting the SNMP agent port use the following line
+# com.sun.management.snmp.port=<port-number>
+
+#####################################################################
+# Optional Instrumentation
+#####################################################################
+#
+# By default only the basic instrumentation with low overhead is on.
+# The following properties allow to selectively turn on optional
+# instrumentation which are off by default and may have some
+# additional overhead.
+#
+# com.sun.management.enableThreadContentionMonitoring
+#
+# This option enables thread contention monitoring if the
+# Java virtual machine supports such instrumentation.
+# Refer to the specification for the java.lang.management.ThreadMBean
+# interface - see isThreadContentionMonitoringSupported() method.
+#
+
+# To enable thread contention monitoring, uncomment the following line
+# com.sun.management.enableThreadContentionMonitoring
+
+#####################################################################
+# SNMP Management Properties
+#####################################################################
+#
+# If the system property -Dcom.sun.management.snmp.port=<port-number>
+# is set then
+# - The SNMP agent (with the Java virtual machine MIB) is started
+# that listens on the specified port for incoming SNMP requests.
+# - the following properties for read for SNMP management.
+#
+# The configuration can be specified only at startup time.
+# Later changes to the above system property (e.g. via setProperty method), this
+# config file, or the ACL file has no effect to the running SNMP agent.
+#
+
+#
+# ##################### SNMP Trap Port #########################
+#
+# com.sun.management.snmp.trap=<trap-destination-port-number>
+# Specifies the remote port number at which managers are expected
+# to listen for trap. For each host defined in the ACL file,
+# the SNMP agent will send traps at <host>:<trap-destination-port-number>
+# Default for this property is 162.
+#
+
+# To set port for sending traps to a different port use the following line
+# com.sun.management.snmp.trap=<trap-destination-port-number>
+
+#
+# ################ SNMP listen interface #########################
+#
+# com.sun.management.snmp.interface=<InetAddress>
+# Specifies the local interface on which the SNMP agent will bind.
+# This is useful when running on machines which have several
+# interfaces defined. It makes it possible to listen to a specific
+# subnet accessible through that interface.
+# Default for this property is "localhost".
+#
+# The format of the value for that property is any string accepted
+# by java.net.InetAddress.getByName(String).
+#
+
+# For restricting the port on which SNMP agent listens use the following line
+# com.sun.management.snmp.interface=<InetAddress>
+
+#
+# #################### SNMP ACL file #########################
+#
+# com.sun.management.snmp.acl=true|false
+# Default for this property is true. (Case for true/false ignored)
+# If this property is specified as false then the ACL file
+# is not checked: all manager hosts are allowed all access.
+#
+
+# For SNMP without checking ACL file uncomment the following line
+# com.sun.management.snmp.acl=false
+
+#
+# com.sun.management.snmp.acl.file=filepath
+# Specifies location for ACL file
+# This is optional - default location is
+# $JRE/conf/management/snmp.acl
+#
+# If the property "com.sun.management.snmp.acl" is set to false,
+# then this property and the ACL file are ignored.
+# Otherwise the ACL file must exist and be in the valid format.
+# If the ACL file is empty or non existent then no access is allowed.
+#
+# The SNMP agent will read the ACL file at startup time.
+# Modification to the ACL file has no effect to any running SNMP
+# agents which read that ACL file at startup.
+#
+
+# For a non-default acl file location use the following line
+# com.sun.management.snmp.acl.file=filepath
+
+#####################################################################
+# RMI Management Properties
+#####################################################################
+#
+# If system property -Dcom.sun.management.jmxremote.port=<port-number>
+# is set then
+# - A MBean server is started
+# - JRE Platform MBeans are registered in the MBean server
+# - RMI connector is published in a private readonly registry at
+# specified port using a well known name, "jmxrmi"
+# - the following properties are read for JMX remote management.
+#
+# The configuration can be specified only at startup time.
+# Later changes to above system property (e.g. via setProperty method),
+# this config file, the password file, or the access file have no effect to the
+# running MBean server, the connector, or the registry.
+#
+
+#
+# ########## RMI connector settings for local management ##########
+#
+# com.sun.management.jmxremote.local.only=true|false
+# Default for this property is true. (Case for true/false ignored)
+# If this property is specified as true then the local JMX RMI connector
+# server will only accept connection requests from clients running on
+# the host where the out-of-the-box JMX management agent is running.
+# In order to ensure backwards compatibility this property could be
+# set to false. However, deploying the local management agent in this
+# way is discouraged because the local JMX RMI connector server will
+# accept connection requests from any client either local or remote.
+# For remote management the remote JMX RMI connector server should
+# be used instead with authentication and SSL/TLS encryption enabled.
+#
+
+# For allowing the local management agent accept local
+# and remote connection requests use the following line
+# com.sun.management.jmxremote.local.only=false
+
+#
+# ###################### RMI SSL #############################
+#
+# com.sun.management.jmxremote.ssl=true|false
+# Default for this property is true. (Case for true/false ignored)
+# If this property is specified as false then SSL is not used.
+#
+
+# For RMI monitoring without SSL use the following line
+# com.sun.management.jmxremote.ssl=false
+
+# com.sun.management.jmxremote.ssl.config.file=filepath
+# Specifies the location of the SSL configuration file. A properties
+# file can be used to supply the keystore and truststore location and
+# password settings thus avoiding to pass them as cleartext in the
+# command-line.
+#
+# The current implementation of the out-of-the-box management agent will
+# look up and use the properties specified below to configure the SSL
+# keystore and truststore, if present:
+# javax.net.ssl.keyStore=<keystore-location>
+# javax.net.ssl.keyStorePassword=<keystore-password>
+# javax.net.ssl.trustStore=<truststore-location>
+# javax.net.ssl.trustStorePassword=<truststore-password>
+# Any other properties in the file will be ignored. This will allow us
+# to extend the property set in the future if required by the default
+# SSL implementation.
+#
+# If the property "com.sun.management.jmxremote.ssl" is set to false,
+# then this property is ignored.
+#
+
+# For supplying the keystore settings in a file use the following line
+# com.sun.management.jmxremote.ssl.config.file=filepath
+
+# com.sun.management.jmxremote.ssl.enabled.cipher.suites=<cipher-suites>
+# The value of this property is a string that is a comma-separated list
+# of SSL/TLS cipher suites to enable. This property can be specified in
+# conjunction with the previous property "com.sun.management.jmxremote.ssl"
+# in order to control which particular SSL/TLS cipher suites are enabled
+# for use by accepted connections. If this property is not specified then
+# the SSL/TLS RMI Server Socket Factory uses the SSL/TLS cipher suites that
+# are enabled by default.
+#
+
+# com.sun.management.jmxremote.ssl.enabled.protocols=<protocol-versions>
+# The value of this property is a string that is a comma-separated list
+# of SSL/TLS protocol versions to enable. This property can be specified in
+# conjunction with the previous property "com.sun.management.jmxremote.ssl"
+# in order to control which particular SSL/TLS protocol versions are
+# enabled for use by accepted connections. If this property is not
+# specified then the SSL/TLS RMI Server Socket Factory uses the SSL/TLS
+# protocol versions that are enabled by default.
+#
+
+# com.sun.management.jmxremote.ssl.need.client.auth=true|false
+# Default for this property is false. (Case for true/false ignored)
+# If this property is specified as true in conjunction with the previous
+# property "com.sun.management.jmxremote.ssl" then the SSL/TLS RMI Server
+# Socket Factory will require client authentication.
+#
+
+# For RMI monitoring with SSL client authentication use the following line
+# com.sun.management.jmxremote.ssl.need.client.auth=true
+
+# com.sun.management.jmxremote.registry.ssl=true|false
+# Default for this property is false. (Case for true/false ignored)
+# If this property is specified as true then the RMI registry used
+# to bind the RMIServer remote object is protected with SSL/TLS
+# RMI Socket Factories that can be configured with the properties:
+# com.sun.management.jmxremote.ssl.config.file
+# com.sun.management.jmxremote.ssl.enabled.cipher.suites
+# com.sun.management.jmxremote.ssl.enabled.protocols
+# com.sun.management.jmxremote.ssl.need.client.auth
+# If the two properties below are true at the same time, i.e.
+# com.sun.management.jmxremote.ssl=true
+# com.sun.management.jmxremote.registry.ssl=true
+# then the RMIServer remote object and the RMI registry are
+# both exported with the same SSL/TLS RMI Socket Factories.
+#
+
+# For using an SSL/TLS protected RMI registry use the following line
+# com.sun.management.jmxremote.registry.ssl=true
+
+#
+# ################ RMI User authentication ################
+#
+# com.sun.management.jmxremote.authenticate=true|false
+# Default for this property is true. (Case for true/false ignored)
+# If this property is specified as false then no authentication is
+# performed and all users are allowed all access.
+#
+
+# For RMI monitoring without any checking use the following line
+# com.sun.management.jmxremote.authenticate=false
+
+#
+# ################ RMI Login configuration ###################
+#
+# com.sun.management.jmxremote.login.config=<config-name>
+# Specifies the name of a JAAS login configuration entry to use when
+# authenticating users of RMI monitoring.
+#
+# Setting this property is optional - the default login configuration
+# specifies a file-based authentication that uses the password file.
+#
+# When using this property to override the default login configuration
+# then the named configuration entry must be in a file that gets loaded
+# by JAAS. In addition, the login module(s) specified in the configuration
+# should use the name and/or password callbacks to acquire the user's
+# credentials. See the NameCallback and PasswordCallback classes in the
+# javax.security.auth.callback package for more details.
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
+# false, then this property and the password & access files are ignored.
+#
+
+# For a non-default login configuration use the following line
+# com.sun.management.jmxremote.login.config=<config-name>
+
+#
+# ################ RMI Password file location ##################
+#
+# com.sun.management.jmxremote.password.file=filepath
+# Specifies location for password file
+# This is optional - default location is
+# $JRE/conf/management/jmxremote.password
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
+# false, then this property and the password & access files are ignored.
+# Otherwise the password file must exist and be in the valid format.
+# If the password file is empty or non-existent then no access is allowed.
+#
+
+# For a non-default password file location use the following line
+# com.sun.management.jmxremote.password.file=filepath
+
+#
+# ################ RMI Access file location #####################
+#
+# com.sun.management.jmxremote.access.file=filepath
+# Specifies location for access file
+# This is optional - default location is
+# $JRE/conf/management/jmxremote.access
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
+# false, then this property and the password & access files are ignored.
+# Otherwise, the access file must exist and be in the valid format.
+# If the access file is empty or non-existent then no access is allowed.
+#
+
+# For a non-default password file location use the following line
+# com.sun.management.jmxremote.access.file=filepath
+#
+
+# ################ Management agent listen interface #########################
+#
+# com.sun.management.jmxremote.host=<host-or-interface-name>
+# Specifies the local interface on which the JMX RMI agent will bind.
+# This is useful when running on machines which have several
+# interfaces defined. It makes it possible to listen to a specific
+# subnet accessible through that interface.
+#
+# The format of the value for that property is any string accepted
+# by java.net.InetAddress.getByName(String).
+#
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/unix/classes/jdk/internal/agent/FileSystemImpl.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2004, 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. 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.agent;
+
+import java.io.File;
+import java.io.IOException;
+
+/*
+ * Solaris/Linux implementation of jdk.internal.agent.FileSystem
+ */
+public class FileSystemImpl extends FileSystem {
+
+ public boolean supportsFileSecurity(File f) throws IOException {
+ return true;
+ }
+
+ public boolean isAccessUserOnly(File f) throws IOException {
+ return isAccessUserOnly0(f.getPath());
+ }
+
+ // Native methods
+
+ static native boolean isAccessUserOnly0(String path) throws IOException;
+
+ // Initialization
+
+ static {
+ java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction<Void>() {
+ public Void run() {
+ System.loadLibrary("management_rmi");
+ return null;
+ }
+ });
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/unix/native/libmanagement_rmi/FileSystemImpl.c Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2004, 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. 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.
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "jni.h"
+#include "jni_util.h"
+#include "jdk_internal_agent_FileSystemImpl.h"
+
+#ifdef _ALLBSD_SOURCE
+#define stat64 stat
+#endif
+
+/*
+ * JNI_OnLoad
+ */
+JNIEXPORT jint JNICALL DEF_JNI_OnLoad(JavaVM *vm, void *reserved)
+{
+ JNIEnv* env;
+
+ if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_2) != JNI_OK) {
+ return JNI_EVERSION; /* JNI version not supported */
+ }
+
+ return JNI_VERSION_9;
+}
+
+/*
+ * Class: jdk_internal_agent_FileSystemImpl
+ * Method: isAccessUserOnly0
+ * Signature: (Ljava/lang/String;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_jdk_internal_agent_FileSystemImpl_isAccessUserOnly0
+ (JNIEnv *env, jclass ignored, jstring str)
+{
+ jboolean res = JNI_FALSE;
+ jboolean isCopy;
+ const char *path = JNU_GetStringPlatformChars(env, str, &isCopy);
+ if (path != NULL) {
+ struct stat64 sb;
+ if (stat64(path, &sb) == 0) {
+ res = ((sb.st_mode & (S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)) == 0) ? JNI_TRUE : JNI_FALSE;
+ } else {
+ JNU_ThrowIOExceptionWithLastError(env, "stat64 failed");
+ }
+ if (isCopy) {
+ JNU_ReleaseStringPlatformChars(env, str, path);
+ }
+ }
+ return res;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/windows/classes/jdk/internal/agent/FileSystemImpl.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2004, 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. 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.agent;
+
+import java.io.File;
+import java.io.IOException;
+
+/*
+ * Windows implementation of sun.management.FileSystem
+ */
+public class FileSystemImpl extends FileSystem {
+
+ public boolean supportsFileSecurity(File f) throws IOException {
+ return isSecuritySupported0(f.getAbsolutePath());
+ }
+
+ public boolean isAccessUserOnly(File f) throws IOException {
+ String path = f.getAbsolutePath();
+ if (!isSecuritySupported0(path)) {
+ throw new UnsupportedOperationException("File system does not support file security");
+ }
+ return isAccessUserOnly0(path);
+ }
+
+ // Native methods
+
+ static native void init0();
+
+ static native boolean isSecuritySupported0(String path) throws IOException;
+
+ static native boolean isAccessUserOnly0(String path) throws IOException;
+
+ // Initialization
+
+ static {
+ java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction<Void>() {
+ public Void run() {
+ System.loadLibrary("management_rmi");
+ return null;
+ }
+ });
+ init0();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.management.agent/windows/native/libmanagement_rmi/FileSystemImpl.c Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,326 @@
+/*
+ * Copyright (c) 2004, 2011, 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.
+ */
+
+#include <windows.h>
+#include <malloc.h>
+#include <string.h>
+
+#include "jni.h"
+#include "jni_util.h"
+#include "jdk_internal_agent_FileSystemImpl.h"
+
+JNIEXPORT jint JNICALL DEF_JNI_OnLoad(JavaVM *vm, void *reserved)
+{
+ JNIEnv* env;
+
+ if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_2) != JNI_OK) {
+ return JNI_EVERSION; /* JNI version not supported */
+ }
+
+ return JNI_VERSION_9;
+}
+
+
+/*
+ * Access mask to represent any file access
+ */
+#define ANY_ACCESS (FILE_GENERIC_READ | FILE_GENERIC_WRITE | FILE_GENERIC_EXECUTE)
+
+/*
+ * Returns JNI_TRUE if the specified file is on a file system that supports
+ * persistent ACLs (On NTFS file systems returns true, on FAT32 file systems
+ * returns false).
+ */
+static jboolean isSecuritySupported(JNIEnv* env, const char* path) {
+ char* root;
+ char* p;
+ BOOL res;
+ DWORD dwMaxComponentLength;
+ DWORD dwFlags;
+ char fsName[128];
+ DWORD fsNameLength;
+
+ /*
+ * Get root directory. Assume that files are absolute paths. For UNCs
+ * the slash after the share name is required.
+ */
+ root = strdup(path);
+ if (*root == '\\') {
+ /*
+ * \\server\share\file ==> \\server\share\
+ */
+ int slashskip = 3;
+ p = root;
+ while ((*p == '\\') && (slashskip > 0)) {
+ char* p2;
+ p++;
+ p2 = strchr(p, '\\');
+ if ((p2 == NULL) || (*p2 != '\\')) {
+ free(root);
+ JNU_ThrowIOException(env, "Malformed UNC");
+ return JNI_FALSE;
+ }
+ p = p2;
+ slashskip--;
+ }
+ if (slashskip != 0) {
+ free(root);
+ JNU_ThrowIOException(env, "Malformed UNC");
+ return JNI_FALSE;
+ }
+ p++;
+ *p = '\0';
+
+ } else {
+ p = strchr(root, '\\');
+ if (p == NULL) {
+ free(root);
+ JNU_ThrowIOException(env, "Absolute filename not specified");
+ return JNI_FALSE;
+ }
+ p++;
+ *p = '\0';
+ }
+
+
+ /*
+ * Get the volume information - this gives us the file system file and
+ * also tells us if the file system supports persistent ACLs.
+ */
+ fsNameLength = sizeof(fsName)-1;
+ res = GetVolumeInformation(root,
+ NULL, // address of name of the volume, can be NULL
+ 0, // length of volume name
+ NULL, // address of volume serial number, can be NULL
+ &dwMaxComponentLength,
+ &dwFlags,
+ fsName,
+ fsNameLength);
+ if (res == 0) {
+ free(root);
+ JNU_ThrowIOExceptionWithLastError(env, "GetVolumeInformation failed");
+ return JNI_FALSE;
+ }
+
+ free(root);
+ return (dwFlags & FS_PERSISTENT_ACLS) ? JNI_TRUE : JNI_FALSE;
+}
+
+
+/*
+ * Returns the security descriptor for a file.
+ */
+static SECURITY_DESCRIPTOR* getFileSecurityDescriptor(JNIEnv* env, const char* path) {
+ SECURITY_DESCRIPTOR* sd;
+ DWORD len = 0;
+ SECURITY_INFORMATION info =
+ OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION;
+
+ GetFileSecurityA(path, info , 0, 0, &len);
+ if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
+ JNU_ThrowIOExceptionWithLastError(env, "GetFileSecurity failed");
+ return NULL;
+ }
+ sd = (SECURITY_DESCRIPTOR *)malloc(len);
+ if (sd == NULL) {
+ JNU_ThrowOutOfMemoryError(env, 0);
+ } else {
+ if (!(*GetFileSecurityA)(path, info, sd, len, &len)) {
+ JNU_ThrowIOExceptionWithLastError(env, "GetFileSecurity failed");
+ free(sd);
+ return NULL;
+ }
+ }
+ return sd;
+}
+
+/*
+ * Returns pointer to the SID identifying the owner of the specified
+ * file.
+ */
+static SID* getFileOwner(JNIEnv* env, SECURITY_DESCRIPTOR* sd) {
+ SID* owner;
+ BOOL defaulted;
+
+ if (!GetSecurityDescriptorOwner(sd, &owner, &defaulted)) {
+ JNU_ThrowIOExceptionWithLastError(env, "GetSecurityDescriptorOwner failed");
+ return NULL;
+ }
+ return owner;
+}
+
+/*
+ * Returns pointer discretionary access-control list (ACL) from the security
+ * descriptor of the specified file.
+ */
+static ACL* getFileDACL(JNIEnv* env, SECURITY_DESCRIPTOR* sd) {
+ ACL *acl;
+ int defaulted, present;
+
+ if (!GetSecurityDescriptorDacl(sd, &present, &acl, &defaulted)) {
+ JNU_ThrowIOExceptionWithLastError(env, "GetSecurityDescriptorDacl failed");
+ return NULL;
+ }
+ if (!present) {
+ JNU_ThrowInternalError(env, "Security descriptor does not contain a DACL");
+ return NULL;
+ }
+ return acl;
+}
+
+/*
+ * Returns JNI_TRUE if the specified owner is the only SID will access
+ * to the file.
+ */
+static jboolean isAccessUserOnly(JNIEnv* env, SID* owner, ACL* acl) {
+ ACL_SIZE_INFORMATION acl_size_info;
+ DWORD i;
+
+ /*
+ * If there's no DACL then there's no access to the file
+ */
+ if (acl == NULL) {
+ return JNI_TRUE;
+ }
+
+ /*
+ * Get the ACE count
+ */
+ if (!GetAclInformation(acl, (void *) &acl_size_info, sizeof(acl_size_info),
+ AclSizeInformation)) {
+ JNU_ThrowIOExceptionWithLastError(env, "GetAclInformation failed");
+ return JNI_FALSE;
+ }
+
+ /*
+ * Iterate over the ACEs. For each "allow" type check that the SID
+ * matches the owner, and check that the access is read only.
+ */
+ for (i = 0; i < acl_size_info.AceCount; i++) {
+ void* ace;
+ ACCESS_ALLOWED_ACE *access;
+ SID* sid;
+
+ if (!GetAce(acl, i, &ace)) {
+ JNU_ThrowIOExceptionWithLastError(env, "GetAce failed");
+ return -1;
+ }
+ if (((ACCESS_ALLOWED_ACE *)ace)->Header.AceType != ACCESS_ALLOWED_ACE_TYPE) {
+ continue;
+ }
+ access = (ACCESS_ALLOWED_ACE *)ace;
+ sid = (SID *) &access->SidStart;
+ if (!EqualSid(owner, sid)) {
+ /*
+ * If the ACE allows any access then the file is not secure.
+ */
+ if (access->Mask & ANY_ACCESS) {
+ return JNI_FALSE;
+ }
+ }
+ }
+ return JNI_TRUE;
+}
+
+
+/*
+ * Class: jdk_internal_agent_FileSystemImpl
+ * Method: init0
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_jdk_internal_agent_FileSystemImpl_init0
+ (JNIEnv *env, jclass ignored)
+{
+ /* nothing to do */
+}
+
+/*
+ * Class: jdk_internal_agent_FileSystemImpl
+ * Method: isSecuritySupported0
+ * Signature: (Ljava/lang/String;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_jdk_internal_agent_FileSystemImpl_isSecuritySupported0
+ (JNIEnv *env, jclass ignored, jstring str)
+{
+ jboolean res;
+ jboolean isCopy;
+ const char* path;
+
+ path = JNU_GetStringPlatformChars(env, str, &isCopy);
+ if (path != NULL) {
+ res = isSecuritySupported(env, path);
+ if (isCopy) {
+ JNU_ReleaseStringPlatformChars(env, str, path);
+ }
+ return res;
+ } else {
+ /* exception thrown - doesn't matter what we return */
+ return JNI_TRUE;
+ }
+}
+
+
+/*
+ * Class: jdk_internal_agent_FileSystemImpl
+ * Method: isAccessUserOnly0
+ * Signature: (Ljava/lang/String;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_jdk_internal_agent_FileSystemImpl_isAccessUserOnly0
+ (JNIEnv *env, jclass ignored, jstring str)
+{
+ jboolean res = JNI_FALSE;
+ jboolean isCopy;
+ const char* path;
+
+ path = JNU_GetStringPlatformChars(env, str, &isCopy);
+ if (path != NULL) {
+ /*
+ * From the security descriptor get the file owner and
+ * DACL. Then check if anybody but the owner has access
+ * to the file.
+ */
+ SECURITY_DESCRIPTOR* sd = getFileSecurityDescriptor(env, path);
+ if (sd != NULL) {
+ SID *owner = getFileOwner(env, sd);
+ if (owner != NULL) {
+ ACL* acl = getFileDACL(env, sd);
+ if (acl != NULL) {
+ res = isAccessUserOnly(env, owner, acl);
+ } else {
+ /*
+ * If acl is NULL it means that an exception was thrown
+ * or there is "all acess" to the file.
+ */
+ res = JNI_FALSE;
+ }
+ }
+ free(sd);
+ }
+ if (isCopy) {
+ JNU_ReleaseStringPlatformChars(env, str, path);
+ }
+ }
+ return res;
+}
--- a/jdk/test/com/sun/tools/attach/StartManagementAgent.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/com/sun/tools/attach/StartManagementAgent.java Tue Jan 31 20:06:32 2017 -0800
@@ -41,7 +41,7 @@
* @summary Test for VirtualMachine.startManagementAgent and VirtualMachine.startLocalManagementAgent
* @modules jdk.jartool/sun.tools.jar
* @library /lib/testlibrary
- * @modules java.management
+ * @modules jdk.management.agent
* jdk.attach
* jdk.jartool/sun.tools.jar
* @run build Application SimpleProvider jdk.testlibrary.*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/internal/agent/AgentCMETest.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Portions Copyright (c) 2012 IBM Corporation
+ */
+
+/**
+ * @test
+ * @bug 7164191
+ * @summary properties.putAll API may fail with ConcurrentModifcationException on multi-thread scenario
+ * @modules jdk.management.agent/jdk.internal.agent
+ * @author Deven You
+ */
+
+import java.util.Properties;
+import jdk.internal.agent.Agent;
+
+public class AgentCMETest {
+ static Class<?> agentClass;
+
+ /**
+ * In jdk.internal.agent.Agent.loadManagementProperties(), call
+ * properties.putAll API may fail with ConcurrentModifcationException if the
+ * system properties are modified simultaneously by another thread
+ *
+ * @param args
+ * @throws Exception
+ */
+ public static void main(String[] args) throws Exception {
+ System.out.println("Start...");
+
+ final Properties properties = System.getProperties();
+ Thread t1 = new Thread(new Runnable() {
+ public void run() {
+ for (int i = 0; i < 100; i++) {
+ properties.put(String.valueOf(i), "");
+ try {
+ Thread.sleep(1);
+ } catch (InterruptedException e) {
+ // do nothing
+ }
+ }
+ }
+ });
+ t1.start();
+
+ for (int i = 0; i < 10000; i++) {
+ Agent.loadManagementProperties();
+ }
+
+ System.out.println("Finished...");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/internal/agent/AgentCheckTest.java Tue Jan 31 20:06:32 2017 -0800
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 5013605
+ * @summary Localize log messages from the management agents
+ * @modules jdk.management.agent/jdk.internal.agent
+ *
+ * @author Tim Bell
+ */
+import jdk.internal.agent.Agent;
+
+public class AgentCheckTest {
+
+ public static void main(String[] args){
+ String [][] testStrings = {
+ {"agent.err.error", "", ""},
+ {"jmxremote.ConnectorBootstrap.starting", "", ""},
+ {"jmxremote.ConnectorBootstrap.noAuthentication", "", ""},
+ {"jmxremote.ConnectorBootstrap.ready", "Phony JMXServiceURL", ""},
+ {"jmxremote.ConnectorBootstrap.password.readonly", "Phony passwordFileName", ""},
+ };
+
+ boolean pass = true;
+ System.out.println("Start...");
+ for (int ii = 0; ii < testStrings.length; ii++) {
+ String key = testStrings[ii][0];
+ String p1 = testStrings[ii][1];
+ String p2 = testStrings[ii][2];
+ String ss = Agent.getText(key, p1, p2);
+ if (ss.startsWith("missing resource key")) {
+ pass = false;
+ System.out.println(" lookup failed for key = " + key);
+ }
+ }
+ if (!pass) {
+ throw new Error ("Resource lookup(s) failed; Test failed");
+ }
+ System.out.println("...Finished.");
+ }
+}
--- a/jdk/test/sun/management/AgentCMETest.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Portions Copyright (c) 2012 IBM Corporation
- */
-
-/**
- * @test
- * @bug 7164191
- * @summary properties.putAll API may fail with ConcurrentModifcationException on multi-thread scenario
- * @modules java.management/sun.management
- * @author Deven You
- */
-
-import java.util.Properties;
-import sun.management.Agent;
-
-public class AgentCMETest {
- static Class<?> agentClass;
-
- /**
- * In sun.management.Agent.loadManagementProperties(), call
- * properties.putAll API may fail with ConcurrentModifcationException if the
- * system properties are modified simultaneously by another thread
- *
- * @param args
- * @throws Exception
- */
- public static void main(String[] args) throws Exception {
- System.out.println("Start...");
-
- final Properties properties = System.getProperties();
- Thread t1 = new Thread(new Runnable() {
- public void run() {
- for (int i = 0; i < 100; i++) {
- properties.put(String.valueOf(i), "");
- try {
- Thread.sleep(1);
- } catch (InterruptedException e) {
- // do nothing
- }
- }
- }
- });
- t1.start();
-
- for (int i = 0; i < 10000; i++) {
- Agent.loadManagementProperties();
- }
-
- System.out.println("Finished...");
- }
-}
--- a/jdk/test/sun/management/AgentCheckTest.java Wed Jul 05 22:46:23 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * @test
- * @bug 5013605
- * @summary Localize log messages from the management agents
- * @modules java.management/sun.management
- *
- * @author Tim Bell
- */
-import sun.management.Agent;
-
-public class AgentCheckTest {
-
- public static void main(String[] args){
- String [][] testStrings = {
- {"agent.err.error", "", ""},
- {"jmxremote.ConnectorBootstrap.starting", "", ""},
- {"jmxremote.ConnectorBootstrap.noAuthentication", "", ""},
- {"jmxremote.ConnectorBootstrap.ready", "Phony JMXServiceURL", ""},
- {"jmxremote.ConnectorBootstrap.password.readonly", "Phony passwordFileName", ""},
- };
-
- boolean pass = true;
- System.out.println("Start...");
- for (int ii = 0; ii < testStrings.length; ii++) {
- String key = testStrings[ii][0];
- String p1 = testStrings[ii][1];
- String p2 = testStrings[ii][2];
- String ss = Agent.getText(key, p1, p2);
- if (ss.startsWith("missing resource key")) {
- pass = false;
- System.out.println(" lookup failed for key = " + key);
- }
- }
- if (!pass) {
- throw new Error ("Resource lookup(s) failed; Test failed");
- }
- System.out.println("...Finished.");
- }
-}
--- a/jdk/test/sun/management/jdp/JdpDefaultsTest.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jdp/JdpDefaultsTest.java Tue Jan 31 20:06:32 2017 -0800
@@ -31,7 +31,7 @@
* @test JdpDefaultsTest
* @summary Assert that we can read JDP packets from a multicast socket connection, on default IP and port.
* @library /lib/testlibrary
- * @modules java.management/sun.management.jdp
+ * @modules jdk.management.agent/sun.management.jdp
* @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher
* @run main JdpDefaultsTest
*/
--- a/jdk/test/sun/management/jdp/JdpOffTest.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jdp/JdpOffTest.java Tue Jan 31 20:06:32 2017 -0800
@@ -32,7 +32,7 @@
* @test JdpOffTest.java
* @summary Assert that no JDP packets are sent to the default address and port.
* @library /lib/testlibrary
- * @modules java.management/sun.management.jdp
+ * @modules jdk.management.agent/sun.management.jdp
* @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOffTestCase DynamicLauncher
* @run main JdpOffTest
*/
--- a/jdk/test/sun/management/jdp/JdpSpecificAddressTest.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jdp/JdpSpecificAddressTest.java Tue Jan 31 20:06:32 2017 -0800
@@ -31,7 +31,7 @@
* @test JdpSpecificAddressTest
* @summary Assert that we can read JDP packets from a multicast socket connection, on specific IP and port.
* @library /lib/testlibrary
- * @modules java.management/sun.management.jdp
+ * @modules jdk.management.agent/sun.management.jdp
* @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher
* @run main JdpSpecificAddressTest
*/
--- a/jdk/test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java Tue Jan 31 20:06:32 2017 -0800
@@ -28,7 +28,7 @@
*
* @author Daniel Fuchs
*
- * @modules java.management/sun.management.jmxremote
+ * @modules jdk.management.agent/sun.management.jmxremote
* @run compile -XDignore.symbol.file=true -g LocalRMIServerSocketFactoryTest.java
* @run main LocalRMIServerSocketFactoryTest
*/
--- a/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java Tue Jan 31 20:06:32 2017 -0800
@@ -41,8 +41,7 @@
* @test
* @bug 6434402 8004926
* @library /lib/testlibrary
- * @modules java.management/sun.management
- * java.management
+ * @modules jdk.management.agent/jdk.internal.agent
* @build jdk.testlibrary.*
* @build TestManager TestApplication CustomLauncherTest
* @run main/othervm CustomLauncherTest
@@ -147,7 +146,7 @@
ProcessBuilder client = ProcessTools.createJavaProcessBuilder(
"-cp",
TEST_CLASSPATH,
- "--add-exports", "java.management/sun.management=ALL-UNNAMED",
+ "--add-exports", "jdk.management.agent/jdk.internal.agent=ALL-UNNAMED",
"TestManager",
String.valueOf(serverPrc.getPid()),
port.get(),
--- a/jdk/test/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java Tue Jan 31 20:06:32 2017 -0800
@@ -48,8 +48,8 @@
* @summary Test JMX agent host address binding. Same ports but different
* interfaces to bind to (using plain sockets and SSL sockets).
*
- * @modules java.management/sun.management
- * java.management/sun.management.jmxremote
+ * @modules jdk.management.agent/jdk.internal.agent
+ * jdk.management.agent/sun.management.jmxremote
* @library /lib/testlibrary
* @build jdk.testlibrary.* JMXAgentInterfaceBinding
* @run main/timeout=5 JMXInterfaceBindingTest
--- a/jdk/test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java Tue Jan 31 20:06:32 2017 -0800
@@ -27,7 +27,7 @@
* @summary Tests that the jvmstat counters published by the out-of-the-box
* management agent for the JMX connection details are correct.
* @author Luis-Miguel Alventosa
- * @modules java.management/sun.management
+ * @modules jdk.management.agent/jdk.internal.agent
* @run clean JvmstatCountersTest
* @run build JvmstatCountersTest
* @run main/othervm/timeout=600 -XX:+UsePerfData JvmstatCountersTest 1
@@ -42,7 +42,7 @@
import javax.management.*;
import javax.management.remote.*;
import com.sun.tools.attach.*;
-import sun.management.ConnectorAddressLink;
+import jdk.internal.agent.ConnectorAddressLink;
public class JvmstatCountersTest {
--- a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java Tue Jan 31 20:06:32 2017 -0800
@@ -38,7 +38,7 @@
* without connection or username/password details.
* TestManager will attempt a connection to the address obtained from
* both agent properties and jvmstat buffer.
- * @modules java.management/sun.management
+ * @modules jdk.management.agent/jdk.internal.agent
* @build jdk.testlibrary.* TestManager TestApplication
* @run main/othervm/timeout=300 LocalManagementTest
*/
@@ -131,7 +131,7 @@
ProcessBuilder client = ProcessTools.createJavaProcessBuilder(
"-cp",
TEST_CLASSPATH,
- "--add-exports", "java.management/sun.management=ALL-UNNAMED",
+ "--add-exports", "jdk.management.agent/jdk.internal.agent=ALL-UNNAMED",
"TestManager",
String.valueOf(serverPrc.getPid()),
port.get(),
--- a/jdk/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.java Tue Jan 31 20:06:32 2017 -0800
@@ -28,7 +28,7 @@
* @library /lib/testlibrary
* @bug 6557093
* @summary Check SSL config file permission for out-of-the-box management
- * @modules java.management
+ * @modules jdk.management.agent
* @build jdk.testlibrary.* AbstractFilePermissionTest Dummy
* @run main/timeout=300 PasswordFilePermissionTest
*
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java Tue Jan 31 20:06:32 2017 -0800
@@ -40,7 +40,7 @@
import javax.management.remote.*;
import javax.management.*;
-import sun.management.AgentConfigurationError;
+import jdk.internal.agent.AgentConfigurationError;
import java.security.Security;
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh Tue Jan 31 20:06:32 2017 -0800
@@ -28,9 +28,8 @@
#
# @key intermittent
# @library /lib/testlibrary
-# @modules java.management/sun.management
-# java.management/sun.management.jmxremote
-# java.management
+# @modules jdk.management.agent/jdk.internal.agent
+# jdk.management.agent/sun.management.jmxremote
# @build jdk.testlibrary.* TestLogger Utils RmiBootstrapTest
# @run shell/timeout=300 RmiBootstrapTest.sh
@@ -51,8 +50,8 @@
DEBUGOPTIONS=""
export DEBUGOPTIONS
-EXTRAOPTIONS="--add-exports java.management/sun.management=ALL-UNNAMED \
- --add-exports java.management/sun.management.jmxremote=ALL-UNNAMED"
+EXTRAOPTIONS="--add-exports jdk.management.agent/jdk.internal.agent=ALL-UNNAMED \
+ --add-exports jdk.management.agent/sun.management.jmxremote=ALL-UNNAMED"
export EXTRAOPTIONS
# Call the common generic test
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java Tue Jan 31 20:06:32 2017 -0800
@@ -42,7 +42,7 @@
* @library /lib/testlibrary
* @bug 6228231
* @summary Test that RMI registry uses SSL.
- * @modules java.management
+ * @modules jdk.management.agent
* @build jdk.testlibrary.* RmiRegistrySslTestApp
* @run main/timeout=300 RmiRegistrySslTest
* @author Luis-Miguel Alventosa, Taras Ledkov
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh Tue Jan 31 20:06:32 2017 -0800
@@ -27,8 +27,8 @@
# @summary Test RMI Bootstrap with SSL
#
# @library /lib/testlibrary
-# @modules java.management/sun.management
-# java.management/sun.management.jmxremote
+# @modules jdk.management.agent/jdk.internal.agent
+# jdk.management.agent/sun.management.jmxremote
# @build jdk.testlibrary.* TestLogger Utils RmiBootstrapTest
# @run shell/timeout=300 RmiSslBootstrapTest.sh
@@ -49,8 +49,8 @@
DEBUGOPTIONS=""
export DEBUGOPTIONS
-EXTRAOPTIONS="--add-exports java.management/sun.management=ALL-UNNAMED \
- --add-exports java.management/sun.management.jmxremote=ALL-UNNAMED"
+EXTRAOPTIONS="--add-exports jdk.management.agent/jdk.internal.agent=ALL-UNNAMED \
+ --add-exports jdk.management.agent/sun.management.jmxremote=ALL-UNNAMED"
export EXTRAOPTIONS
# Call the common generic test
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.java Tue Jan 31 20:06:32 2017 -0800
@@ -43,7 +43,7 @@
import javax.management.remote.*;
import javax.management.*;
-import sun.management.AgentConfigurationError;
+import jdk.internal.agent.AgentConfigurationError;
/**
* <p>This class implements unit test for RMI Bootstrap.
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.sh Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.sh Tue Jan 31 20:06:32 2017 -0800
@@ -26,8 +26,8 @@
# @summary Test RMI Bootstrap with SSL and no keystore.
#
# @bug 4932854
-# @modules java.management/sun.management
-# java.management/sun.management.jmxremote
+# @modules jdk.management.agent/jdk.internal.agent
+# jdk.management.agent/sun.management.jmxremote
# @build TestLogger RmiSslNoKeyStoreTest
# @run shell/timeout=300 RmiSslNoKeyStoreTest.sh
@@ -48,8 +48,8 @@
DEBUGOPTIONS=""
export DEBUGOPTIONS
-EXTRAOPTIONS="--add-exports java.management/sun.management=ALL-UNNAMED \
- --add-exports java.management/sun.management.jmxremote=ALL-UNNAMED"
+EXTRAOPTIONS="--add-exports jdk.management.agent/jdk.internal.agent=ALL-UNNAMED \
+ --add-exports jdk.management.agent/sun.management.jmxremote=ALL-UNNAMED"
export EXTRAOPTIONS
# Call the common generic test
--- a/jdk/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.java Tue Jan 31 20:06:32 2017 -0800
@@ -27,7 +27,7 @@
* @test
* @library /lib/testlibrary
* @bug 6557093
- * @modules java.management
+ * @modules jdk.management.agent
* @build jdk.testlibrary.* Dummy AbstractFilePermissionTest
* @summary Check SSL config file permission for out-of-the-box management
* @run main/timeout=300 SSLConfigFilePermissionTest
--- a/jdk/test/sun/management/jmxremote/bootstrap/TestManager.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/bootstrap/TestManager.java Tue Jan 31 20:06:32 2017 -0800
@@ -46,7 +46,7 @@
import com.sun.tools.attach.VirtualMachine;
// Sun implementation specific
-import sun.management.ConnectorAddressLink;
+import jdk.internal.agent.ConnectorAddressLink;
public class TestManager {
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java Tue Jan 31 20:06:32 2017 -0800
@@ -46,14 +46,15 @@
import jdk.testlibrary.ProcessTools;
import jdk.testlibrary.Utils;
-import sun.management.Agent;
-import sun.management.AgentConfigurationError;
+import jdk.internal.agent.Agent;
+import jdk.internal.agent.AgentConfigurationError;
+import jdk.internal.agent.ConnectorAddressLink;
/**
* @test
* @bug 7110104
* @library /lib/testlibrary
- * @modules java.management/sun.management
+ * @modules jdk.management.agent/jdk.internal.agent
* @build jdk.testlibrary.* JMXStartStopTest PortAllocator TestApp ManagementAgentJcmd
* @run main/othervm/timeout=600 -XX:+UsePerfData JMXStartStopTest
* @summary Makes sure that enabling/disabling the management agent through JCMD
@@ -103,7 +104,7 @@
String jmxUrlStr = null;
try {
- jmxUrlStr = sun.management.ConnectorAddressLink.importFrom((int)pid);
+ jmxUrlStr = ConnectorAddressLink.importFrom((int)pid);
dbg_print("Local Service URL: " +jmxUrlStr);
if ( jmxUrlStr == null ) {
throw new Exception("No Service URL. Local agent not started?");
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java Tue Jan 31 20:06:32 2017 -0800
@@ -42,7 +42,7 @@
* in the related performance counters.
* @key intermittent
* @library /lib/testlibrary
- * @modules java.management/sun.management
+ * @modules jdk.management.agent/jdk.internal.agent
* @build jdk.testlibrary.* PortAllocator TestApp ManagementAgentJcmd
* @run testng/othervm -XX:+UsePerfData JMXStatusPerfCountersTest
*/
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStatusTest.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStatusTest.java Tue Jan 31 20:06:32 2017 -0800
@@ -38,7 +38,7 @@
* Management agent may be disabled, started (only local connections) and started.
* The test asserts that the expected text is being printed.
* @library /lib/testlibrary
- * @modules java.management/sun.management
+ * @modules jdk.management.agent/jdk.internal.agent
* @build jdk.testlibrary.* PortAllocator TestApp ManagementAgentJcmd
* JMXStatusTest JMXStatus1Test JMXStatus2Test
* @run testng/othervm -XX:+UsePerfData JMXStatus1Test
--- a/jdk/test/sun/management/jmxremote/startstop/ManagementAgentJcmd.java Wed Jul 05 22:46:23 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/startstop/ManagementAgentJcmd.java Tue Jan 31 20:06:32 2017 -0800
@@ -30,8 +30,8 @@
import java.util.function.Consumer;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
-import sun.management.Agent;
-import sun.management.AgentConfigurationError;
+import jdk.internal.agent.Agent;
+import jdk.internal.agent.AgentConfigurationError;
import jdk.testlibrary.JDKToolLauncher;
import jdk.testlibrary.ProcessTools;