# HG changeset patch # User sla # Date 1363696002 -3600 # Node ID ae73e4f50e08e81167ab420880427fc45b0e2f84 # Parent 07dfacf3d73e9905b3ca28a9eeb19211f2b98804 8003703: Update RMI connection dialog box Reviewed-by: skoivu, ahgross, mchung, jbachorik diff -r 07dfacf3d73e -r ae73e4f50e08 jdk/src/share/classes/sun/tools/jconsole/Messages.java --- a/jdk/src/share/classes/sun/tools/jconsole/Messages.java Mon Mar 18 11:55:16 2013 +0100 +++ b/jdk/src/share/classes/sun/tools/jconsole/Messages.java Tue Mar 19 13:26:42 2013 +0100 @@ -156,6 +156,7 @@ public static String IMPACT; public static String INFO; public static String INFO_CAPITALIZED; + public static String INSECURE; public static String INVALID_PLUGIN_PATH; public static String INVALID_URL; public static String IS; @@ -303,6 +304,8 @@ public static String WRITABLE; public static String CONNECTION_FAILED1; public static String CONNECTION_FAILED2; + public static String CONNECTION_FAILED_SSL1; + public static String CONNECTION_FAILED_SSL2; public static String CONNECTION_LOST1; public static String CONNECTING_TO1; public static String CONNECTING_TO2; diff -r 07dfacf3d73e -r ae73e4f50e08 jdk/src/share/classes/sun/tools/jconsole/ProxyClient.java --- a/jdk/src/share/classes/sun/tools/jconsole/ProxyClient.java Mon Mar 18 11:55:16 2013 +0100 +++ b/jdk/src/share/classes/sun/tools/jconsole/ProxyClient.java Tue Mar 19 13:26:42 2013 +0100 @@ -307,10 +307,10 @@ } } - void connect() { + void connect(boolean requireSSL) { setConnectionState(ConnectionState.CONNECTING); try { - tryConnect(); + tryConnect(requireSSL); setConnectionState(ConnectionState.CONNECTED); } catch (Exception e) { if (JConsole.isDebug()) { @@ -320,7 +320,7 @@ } } - private void tryConnect() throws IOException { + private void tryConnect(boolean requireRemoteSSL) throws IOException { if (jmxUrl == null && "localhost".equals(hostName) && port == 0) { // Monitor self this.jmxc = null; @@ -340,6 +340,10 @@ this.jmxUrl = new JMXServiceURL(lvm.connectorAddress()); } } + Map env = new HashMap(); + if (requireRemoteSSL) { + env.put("jmx.remote.x.check.stub", "true"); + } // Need to pass in credentials ? if (userName == null && password == null) { if (isVmConnector()) { @@ -348,12 +352,11 @@ checkSslConfig(); } this.jmxc = new RMIConnector(stub, null); - jmxc.connect(); + jmxc.connect(env); } else { - this.jmxc = JMXConnectorFactory.connect(jmxUrl); + this.jmxc = JMXConnectorFactory.connect(jmxUrl, env); } } else { - Map env = new HashMap(); env.put(JMXConnector.CREDENTIALS, new String[] {userName, password}); if (isVmConnector()) { diff -r 07dfacf3d73e -r ae73e4f50e08 jdk/src/share/classes/sun/tools/jconsole/VMPanel.java --- a/jdk/src/share/classes/sun/tools/jconsole/VMPanel.java Mon Mar 18 11:55:16 2013 +0100 +++ b/jdk/src/share/classes/sun/tools/jconsole/VMPanel.java Tue Mar 19 13:26:42 2013 +0100 @@ -55,6 +55,7 @@ private VMInternalFrame vmIF = null; private static ArrayList tabInfos = new ArrayList(); private boolean wasConnected = false; + private boolean shouldUseSSL = true; // The everConnected flag keeps track of whether the window can be // closed if the user clicks Cancel after a failed connection attempt. @@ -286,7 +287,7 @@ new Thread("VMPanel.connect") { public void run() { - proxyClient.connect(); + proxyClient.connect(shouldUseSSL); } }.start(); } @@ -460,8 +461,12 @@ msgTitle = Messages.CONNECTION_LOST1; msgExplanation = Resources.format(Messages.CONNECTING_TO2, getConnectionName()); buttonStr = Messages.RECONNECT; + } else if (shouldUseSSL) { + msgTitle = Messages.CONNECTION_FAILED_SSL1; + msgExplanation = Resources.format(Messages.CONNECTION_FAILED_SSL2, getConnectionName()); + buttonStr = Messages.INSECURE; } else { - msgTitle =Messages.CONNECTION_FAILED1; + msgTitle = Messages.CONNECTION_FAILED1; msgExplanation = Resources.format(Messages.CONNECTION_FAILED2, getConnectionName()); buttonStr = Messages.CONNECT; } @@ -483,6 +488,9 @@ if (value == Messages.RECONNECT || value == Messages.CONNECT) { connect(); + } else if (value == Messages.INSECURE) { + shouldUseSSL = false; + connect(); } else if (!everConnected) { try { getFrame().setClosed(true); diff -r 07dfacf3d73e -r ae73e4f50e08 jdk/src/share/classes/sun/tools/jconsole/resources/messages.properties --- a/jdk/src/share/classes/sun/tools/jconsole/resources/messages.properties Mon Mar 18 11:55:16 2013 +0100 +++ b/jdk/src/share/classes/sun/tools/jconsole/resources/messages.properties Tue Mar 19 13:26:42 2013 +0100 @@ -114,6 +114,7 @@ IMPACT=Impact INFO=Info INFO_CAPITALIZED=INFO +INSECURE=Insecure connection INVALID_PLUGIN_PATH=Warning: Invalid plugin path: {0} INVALID_URL=Invalid URL: {0} IS=Is @@ -261,6 +262,8 @@ WRITABLE=Writable CONNECTION_FAILED1=Connection Failed: Retry? CONNECTION_FAILED2=The connection to {0} did not succeed.
Would you like to try again? +CONNECTION_FAILED_SSL1=Secure connection failed. Retry insecurely? +CONNECTION_FAILED_SSL2=The connection to {0} could not be made using SSL.
Would you like to try without SSL?
(Username and password will be sent in plain text.) CONNECTION_LOST1=Connection Lost: Reconnect? CONNECTING_TO1=Connecting to {0} CONNECTING_TO2=You are currently being connected to {0}.
This will take a few moments.