coheigea commented on a change in pull request #641: Prevent RMI registry rebind
URL: https://github.com/apache/cxf/pull/641#discussion_r381336693
##########
File path:
rt/management/src/main/java/org/apache/cxf/management/jmx/MBServerConnectorFactory.java
##########
@@ -169,18 +176,85 @@ public void run() {
} else {
// Start the connector server in the same thread.
connectorServer.start();
+ remoteServerStub = rmiServer.toStub();
}
if (LOG.isLoggable(Level.INFO)) {
LOG.info("JMX connector server started: " + connectorServer);
}
}
+ static int getRegistryPort(final String url) {
+ int serverStart = url.indexOf("/jndi/rmi://");
+ final String serverPart = url.substring(serverStart + 12);
+ int portStart = serverPart.indexOf(':') + 1;
+
+ int portEnd;
+ int port = 0;
+ if (portStart > 0) {
+ portEnd = indexNotOfNumber(serverPart, portStart);
+ if (portEnd > portStart) {
+ final String portString = serverPart.substring(portStart,
portEnd);
+ port = Integer.parseInt(portString);
+ }
+ }
+ return port;
+ }
+
+ public static String getBindingName(final JMXServiceURL jmxServiceURL) {
Review comment:
Could we make this protected? And add a test for it?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services