Skip to content

Commit 72930ab

Browse files
authored
Apply various IntelliJ autofixes. This is absolutely safe. (#731)
1 parent d83685f commit 72930ab

File tree

66 files changed

+193
-216
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+193
-216
lines changed

broker/src/test/java/util/Broker.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
public class Broker implements AutoCloseable, ExtensionContext.Store.CloseableResource {
4747
// Use same MBeanServer instance that broker is using (don't create new)
4848
private final MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
49-
public Path tempDir;
50-
public EmbeddedActiveMQ embeddedBroker = new EmbeddedActiveMQ();
51-
public Configuration configuration = new ConfigurationImpl();
49+
public final Path tempDir;
50+
public final EmbeddedActiveMQ embeddedBroker = new EmbeddedActiveMQ();
51+
public final Configuration configuration = new ConfigurationImpl();
5252

5353
public Broker() {
5454
this(null);
@@ -178,9 +178,9 @@ private int findRandomAvailablePortOnAllLocalInterfaces() throws IOException {
178178
}
179179
}
180180

181-
protected Object createProxy(final ObjectName objectName,
182-
final Class mbeanInterface,
183-
final MBeanServer mbeanServer) {
181+
protected <T> Object createProxy(final ObjectName objectName,
182+
final Class<T> mbeanInterface,
183+
final MBeanServer mbeanServer) {
184184
return MBeanServerInvocationHandler.newProxyInstance(mbeanServer, objectName, mbeanInterface, false);
185185
}
186186

cli-activemq-jmx/src/main/java/com/redhat/amqx/formatters/PythonFormatter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class PythonFormatter implements Formatter {
1414
*/
1515
public String convertJSON(String json) {
1616
// TODO for serialization from JSON to java object use jackson json library
17-
json = json.replaceAll("\"", "\'");
17+
json = json.replaceAll("\"", "'");
1818
json = json.replaceAll(":", ": ");
1919
json = json.replaceAll(",'", ", '");
2020
json = json.replaceAll("'?[Nn]one'?", "None");

cli-activemq-jmx/src/main/java/com/redhat/amqx/main/BrokerType.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ public enum BrokerType {
88
ARTEMIS("service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi", "amq", "artemis"),
99
ACTIVEMQ("service:jmx:rmi:///jndi/rmi://localhost:1099/karaf-root", "amq", "activemq");
1010

11-
private String defaultJMXURL;
12-
private String defaultBrokerName;
13-
private String defaultUpstreamName;
11+
private final String defaultJMXURL;
12+
private final String defaultBrokerName;
13+
private final String defaultUpstreamName;
1414

1515
BrokerType(String defaultJMXURL, String defaultBrokerName, String upstreamName) {
1616
this.defaultJMXURL = defaultJMXURL;

cli-activemq-jmx/src/main/java/com/redhat/amqx/main/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class Main {
1919
private static void help(int code) {
2020
System.out.println("Usage: amqx <object> --host <brokerIp>:<port> --action <action> [--name <destinationName>]\n");
2121

22-
System.out.printf("Objects: {%s, %s, %s, %s}\n", DESTINATION, JMS_TOPIC, ADDRESS, BROKER, DIVERT);
22+
System.out.printf("Objects: {%s, %s, %s, %s, %s}\n", DESTINATION, JMS_TOPIC, ADDRESS, BROKER, DIVERT);
2323
System.out.printf("Actions: Destination {%s, %s, %s, %s}\n", QueueAction.ADD_ACTION,
2424
QueueAction.REMOVE_ACTION, QueueAction.LIST_ACTION, QueueAction.PROPERTIES_ACTION);
2525
// TODO finish broker actions

cli-activemq-jmx/src/main/java/com/redhat/amqx/main/NodeType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public enum NodeType {
99
QUEUE("Queue"),
1010
DIVERT("Divert");
1111

12-
private String nodeTypeString;
12+
private final String nodeTypeString;
1313

1414
NodeType(final String nodeTypeString) {
1515
this.nodeTypeString = nodeTypeString;

cli-activemq-jmx/src/main/java/com/redhat/amqx/main/actions/AddressAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected void processCommand(String[] args) {
6464
setCredentials(cmdLine);
6565
setLogLevel(cmdLine.getOptionValue("log-level", DEFAULT_LOGGING_LEVEL));
6666

67-
if (routingType.toLowerCase().equals("multicast")) {
67+
if (routingType.equalsIgnoreCase("multicast")) {
6868
routingType = RoutingType.MULTICAST.toString();
6969
} else {
7070
routingType = RoutingType.ANYCAST.toString();

cli-activemq-jmx/src/main/java/com/redhat/amqx/main/actions/DivertAction.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@
33
import com.redhat.amqx.main.BrokerType;
44
import com.redhat.amqx.management.ManagerFactory;
55
import com.redhat.amqx.management.artemis.DivertArtemisManager;
6-
import com.redhat.amqx.management.exception.DestinationException;
7-
import org.apache.activemq.artemis.api.core.RoutingType;
86
import org.apache.activemq.artemis.core.server.ComponentConfigurationRoutingType;
97
import org.apache.commons.cli.CommandLine;
108
import org.apache.commons.cli.CommandLineParser;
119
import org.apache.commons.cli.DefaultParser;
1210
import org.apache.commons.cli.ParseException;
1311

14-
import javax.print.attribute.standard.Destination;
1512
import java.io.IOException;
1613

1714
/**

cli-activemq-jmx/src/main/java/com/redhat/amqx/management/AbstractConnectionManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
*/
2020
public abstract class AbstractConnectionManager {
2121
private static final Logger logger = LoggerFactory.getLogger(AbstractConnectionManager.class);
22-
private Resolver<?, ?, ?, ?, ?> resolver;
23-
private String brokerName;
22+
private final Resolver<?, ?, ?, ?, ?> resolver;
23+
private final String brokerName;
2424
private JMXServiceURL jmxServiceURL;
2525
protected MBeanServerConnection mBeanServerConnection;
2626

@@ -34,7 +34,7 @@ public AbstractConnectionManager(String url, final Credentials credentials, Stri
3434
// else { use default url};
3535
jmxServiceURL = new JMXServiceURL(url);
3636

37-
if (brokerName == null || brokerName.equals("")) {
37+
if (brokerName == null || brokerName.isEmpty()) {
3838
this.brokerName = brokerType.getDefaultBrokerName();
3939
} else {
4040
this.brokerName = brokerName;

cli-activemq-jmx/src/main/java/com/redhat/amqx/management/Credentials.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* Implements basic credentials used for authentication
55
*/
66
public class Credentials {
7-
private String username;
8-
private String password;
7+
private final String username;
8+
private final String password;
99

1010
public Credentials(String username, String password) {
1111
this.username = username;

cli-activemq-jmx/src/main/java/com/redhat/amqx/management/ManagerFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public BrokerManager createBrokerManager(String jmxURL, Credentials credentials,
4949
}
5050

5151
private String checkBrokerName(String brokerName, BrokerType brokerType) {
52-
if (brokerName == null || brokerName.equals("")) {
52+
if (brokerName == null || brokerName.isEmpty()) {
5353
brokerName = brokerType.getDefaultBrokerName();
5454
}
5555
return brokerName;
@@ -62,7 +62,7 @@ private String checkBrokerName(String brokerName, BrokerType brokerType) {
6262
* @return brokerType to be used from parameters
6363
*/
6464
private BrokerType resolveBrokerType(String brokerTypeName) {
65-
if (brokerTypeName == null || brokerTypeName.equals("")) {
65+
if (brokerTypeName == null || brokerTypeName.isEmpty()) {
6666
return BrokerType.ARTEMIS;
6767
} else {
6868
brokerTypeName = brokerTypeName.toUpperCase().trim();

0 commit comments

Comments
 (0)