ARTEMIS-4174 fix style & rat

This commit is contained in:
Justin Bertram 2023-09-01 11:23:48 -05:00
parent 791fb7fd7b
commit 691771c766
No known key found for this signature in database
GPG Key ID: F41830B875BB8633
2 changed files with 60 additions and 48 deletions

View File

@ -36,6 +36,7 @@ public class RmiRegistryFactory {
private Registry registry; private Registry registry;
private String host; private String host;
private HostLimitedServerSocketFactory socketFactory; private HostLimitedServerSocketFactory socketFactory;
/** /**
* @return the port * @return the port
*/ */
@ -91,9 +92,7 @@ public class RmiRegistryFactory {
public void init() throws RemoteException, UnknownHostException { public void init() throws RemoteException, UnknownHostException {
socketFactory = new HostLimitedServerSocketFactory(); socketFactory = new HostLimitedServerSocketFactory();
registry = LocateRegistry.createRegistry(port, registry = LocateRegistry.createRegistry(port, new PassThroughToDefaultSocketFactory(), socketFactory);
new PassThroughToDefaultSocketFactory(),
socketFactory);
} }
public void destroy() throws RemoteException { public void destroy() throws RemoteException {

View File

@ -1,3 +1,19 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.artemis.core.server.management; package org.apache.activemq.artemis.core.server.management;
import org.apache.activemq.artemis.core.config.JMXConnectorConfiguration; import org.apache.activemq.artemis.core.config.JMXConnectorConfiguration;
@ -17,8 +33,7 @@ public class JMXRMIRegistryPortTest {
registryFactory.setPort(1099); registryFactory.setPort(1099);
registryFactory.init(); registryFactory.init();
try (ServerSocket testSocket = registryFactory.createTestSocket()) { try (ServerSocket testSocket = registryFactory.createTestSocket()) {
Assert.assertEquals(InetAddress.getByName("localhost"), Assert.assertEquals(InetAddress.getByName("localhost"), testSocket.getInetAddress());
testSocket.getInetAddress());
} }
registryFactory.destroy(); registryFactory.destroy();
} }
@ -30,8 +45,7 @@ public class JMXRMIRegistryPortTest {
registryFactory.setPort(1099); registryFactory.setPort(1099);
registryFactory.init(); registryFactory.init();
try (ServerSocket testSocket = registryFactory.createTestSocket()) { try (ServerSocket testSocket = registryFactory.createTestSocket()) {
Assert.assertEquals(InetAddress.getByAddress(new byte[] { 0, 0, 0, 0 }), Assert.assertEquals(InetAddress.getByAddress(new byte[]{0, 0, 0, 0}), testSocket.getInetAddress());
testSocket.getInetAddress());
} }
registryFactory.destroy(); registryFactory.destroy();
} }
@ -44,8 +58,7 @@ public class JMXRMIRegistryPortTest {
registryFactory.setPort(configuration.getConnectorPort()); registryFactory.setPort(configuration.getConnectorPort());
registryFactory.init(); registryFactory.init();
try (ServerSocket testSocket = registryFactory.createTestSocket()) { try (ServerSocket testSocket = registryFactory.createTestSocket()) {
Assert.assertEquals(InetAddress.getByName("localhost"), Assert.assertEquals(InetAddress.getByName("localhost"), testSocket.getInetAddress());
testSocket.getInetAddress());
} }
registryFactory.destroy(); registryFactory.destroy();
} }