diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ObjectNameBuilder.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ObjectNameBuilder.java index 6f4050883b..fd3d718444 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ObjectNameBuilder.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ObjectNameBuilder.java @@ -115,7 +115,7 @@ public final class ObjectNameBuilder { * @see DivertControl */ public ObjectName getDivertObjectName(final String name) throws Exception { - return createObjectName(ObjectNameBuilder.CORE_MODULE, "Divert", name.toString()); + return createObjectName(ObjectNameBuilder.CORE_MODULE, "Divert", name); } /** diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSTopicControlImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSTopicControlImpl.java index e226e7a8da..cfafe94045 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSTopicControlImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSTopicControlImpl.java @@ -267,7 +267,7 @@ public class JMSTopicControlImpl extends StandardMBean implements TopicControl { String subName = null; if (queue.isDurable()) { - Pair pair = ActiveMQDestination.decomposeQueueNameForDurableSubscription(queue.getName().toString()); + Pair pair = ActiveMQDestination.decomposeQueueNameForDurableSubscription(queue.getName()); clientID = pair.getA(); subName = pair.getB(); } @@ -296,7 +296,7 @@ public class JMSTopicControlImpl extends StandardMBean implements TopicControl { String subName = null; if (queue.isDurable() && !queue.getName().startsWith(ResourceNames.JMS_TOPIC)) { - Pair pair = ActiveMQDestination.decomposeQueueNameForDurableSubscription(queue.getName().toString()); + Pair pair = ActiveMQDestination.decomposeQueueNameForDurableSubscription(queue.getName()); clientID = pair.getA(); subName = pair.getB(); } diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTPublishManager.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTPublishManager.java index b0df5a2c19..19bbff89ff 100644 --- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTPublishManager.java +++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTPublishManager.java @@ -214,7 +214,7 @@ public class MQTTPublishManager { } private void sendServerMessage(int messageId, ServerMessageImpl message, int deliveryCount, int qos) { - String address = MQTTUtil.convertCoreAddressFilterToMQTT(message.getAddress().toString()).toString(); + String address = MQTTUtil.convertCoreAddressFilterToMQTT(message.getAddress().toString()); ByteBuf payload = message.getBodyBufferDuplicate().byteBuf(); diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTUtil.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTUtil.java index f2a69719e3..aa2262a07e 100644 --- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTUtil.java +++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTUtil.java @@ -71,10 +71,10 @@ public class MQTTUtil { } public static String convertCoreAddressFilterToMQTT(String filter) { - if (filter.startsWith(MQTT_RETAIN_ADDRESS_PREFIX.toString())) { + if (filter.startsWith(MQTT_RETAIN_ADDRESS_PREFIX)) { filter = filter.substring(MQTT_RETAIN_ADDRESS_PREFIX.length(), filter.length()); } - else if (filter.startsWith(MQTT_ADDRESS_PREFIX.toString())) { + else if (filter.startsWith(MQTT_ADDRESS_PREFIX)) { filter = filter.substring(MQTT_ADDRESS_PREFIX.length(), filter.length()); } return swapMQTTAndCoreWildCards(filter); diff --git a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/context/server/ProtonServerReceiverContext.java b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/context/server/ProtonServerReceiverContext.java index c0c1ea3ee1..04069198bd 100644 --- a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/context/server/ProtonServerReceiverContext.java +++ b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/context/server/ProtonServerReceiverContext.java @@ -66,7 +66,7 @@ public class ProtonServerReceiverContext extends AbstractProtonReceiverContext { catch (Exception e) { throw new ActiveMQAMQPInternalErrorException(e.getMessage(), e); } - target.setAddress(queue.toString()); + target.setAddress(queue); } else { //if not dynamic then we use the targets address as the address to forward the messages to, however there has to diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompDecoder.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompDecoder.java index c1a30933b2..427509f024 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompDecoder.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompDecoder.java @@ -314,7 +314,7 @@ public class StompDecoder { headers.put(headerName, headerValue); if (headerName.equals(Stomp.Headers.CONTENT_LENGTH)) { - contentLength = Integer.parseInt(headerValue.toString()); + contentLength = Integer.parseInt(headerValue); } whiteSpaceOnly = true; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java index 8748c2200a..bcd0256b51 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java @@ -463,7 +463,7 @@ public class QueueControlImpl extends AbstractControl implements QueueControl { @Override public String getFirstMessageAsJSON() throws Exception { - return toJSON(getFirstMessage()).toString(); + return toJSON(getFirstMessage()); } @Override diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java index d7eda4213c..96f661aef7 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java @@ -1127,7 +1127,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { int sessionCount = 0; for (Entry sessionEntry : sessions.entrySet()) { - if (sessionEntry.getValue().getUsername().toString().equals(username)) { + if (sessionEntry.getValue().getUsername().equals(username)) { sessionCount++; } }