diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java index c8d7e1344a..5881e0d46f 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java @@ -1878,6 +1878,7 @@ public final class JMSBridgeImpl implements JMSBridge } @Override + @SuppressWarnings("WaitNotInLoop") // both lock.wait(..) either returns, throws or continue, thus avoiding spurious wakes public void run() { while (started) diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/JMSQueueConfiguration.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/JMSQueueConfiguration.java index f84b8d3a44..1c6e84b810 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/JMSQueueConfiguration.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/JMSQueueConfiguration.java @@ -32,5 +32,5 @@ public interface JMSQueueConfiguration String[] getBindings(); - JMSQueueConfiguration setBindings(String[] bindings); + JMSQueueConfiguration setBindings(String... bindings); } diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAStreamMessage.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAStreamMessage.java index 7e3d50482a..5c99b090b9 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAStreamMessage.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAStreamMessage.java @@ -266,7 +266,7 @@ public class ActiveMQRAStreamMessage extends ActiveMQRAMessage implements Stream { if (ActiveMQRAStreamMessage.trace) { - ActiveMQRALogger.LOGGER.trace("writeBytes(" + value + ", " + offset + ", " + length + ")"); + ActiveMQRALogger.LOGGER.trace("writeBytes(" + Arrays.toString(value) + ", " + offset + ", " + length + ")"); } ((StreamMessage)message).writeBytes(value, offset, length); @@ -281,7 +281,7 @@ public class ActiveMQRAStreamMessage extends ActiveMQRAMessage implements Stream { if (ActiveMQRAStreamMessage.trace) { - ActiveMQRALogger.LOGGER.trace("writeBytes(" + value + ")"); + ActiveMQRALogger.LOGGER.trace("writeBytes(" + Arrays.toString(value) + ")"); } ((StreamMessage)message).writeBytes(value); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java index 226cf76287..6e57af5332 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java @@ -2465,6 +2465,7 @@ public class QueueImpl implements Queue acknowledge(tx, ref); } + @SuppressWarnings({"ArrayToString", "ArrayToStringConcatentation"}) private void moveBetweenSnFQueues(final SimpleString queueSuffix, final Transaction tx, final MessageReference ref) throws Exception @@ -2481,7 +2482,8 @@ public class QueueImpl implements Queue if (propName.startsWith(MessageImpl.HDR_ROUTE_TO_IDS)) { oldRouteToIDs = (byte[]) copyMessage.removeProperty(propName); - ActiveMQServerLogger.LOGGER.debug("Removed property from message: " + propName + " = " + oldRouteToIDs + " (" + ByteBuffer.wrap(oldRouteToIDs).getLong() + ")"); + final String hashcodeToString = oldRouteToIDs.toString(); // don't use Arrays.toString(..) here + ActiveMQServerLogger.LOGGER.debug("Removed property from message: " + propName + " = " + hashcodeToString + " (" + ByteBuffer.wrap(oldRouteToIDs).getLong() + ")"); // there should only be one of these properties so potentially save some loop iterations break; diff --git a/pom.xml b/pom.xml index 61824fd69e..103ddba20e 100644 --- a/pom.xml +++ b/pom.xml @@ -700,6 +700,22 @@ org.apache.maven.plugins maven-compiler-plugin 3.1 + + + javac-with-errorprone + true + + + -Xep:DepAnn:WARN + + + + + org.codehaus.plexus + plexus-compiler-javac-errorprone + 2.5 + + org.apache.maven.plugins diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageTest.java index 02fd2081bc..65bdea841f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageTest.java @@ -235,8 +235,9 @@ public class LargeMessageTest extends LargeMessageTestBase msg1.getBodyBuffer().readByte(); Assert.fail("Exception was expected"); } - catch (Throwable ignored) + catch (final Exception ignored) { + // empty on purpose } session.close(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java index 16ce2bc45d..e3e63db9a2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java @@ -276,7 +276,7 @@ public abstract class ClusterTestBase extends ServiceTestBase { ActiveMQServer server = servers[bNode]; - log.debug("waiting for " + nodes + " on the topology for server = " + server); + log.debug("waiting for " + Arrays.toString(nodes) + " on the topology for server = " + server); long start = System.currentTimeMillis(); @@ -322,7 +322,7 @@ public abstract class ClusterTestBase extends ServiceTestBase while (System.currentTimeMillis() - start < WAIT_TIMEOUT); if (!exists) { - String msg = "Timed out waiting for cluster topology of " + nodes + + String msg = "Timed out waiting for cluster topology of " + Arrays.toString(nodes) + " (received " + topology.getMembers().size() + ") topology = " + diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryTest.java index 82037a1365..84a03f6464 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryTest.java @@ -391,7 +391,7 @@ public class DiscoveryTest extends DiscoveryBaseTest byte[] btreceived = client.receiveBroadcast(5, TimeUnit.SECONDS); - System.out.println("BTReceived = " + btreceived); + System.out.println("BTReceived = " + Arrays.toString(btreceived)); assertNotNull(btreceived); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementHelperTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementHelperTest.java index dbf526608d..d6c2da7a49 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementHelperTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementHelperTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.management; +import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -193,12 +194,12 @@ public class ManagementHelperTest extends Assert String key1 = RandomUtil.randomString(); String[] val1 = new String[]{"a", "b", "c"}; - ManagementHelperTest.log.info("val1 type is " + val1); + ManagementHelperTest.log.info("val1 type is " + Arrays.toString(val1)); String key2 = RandomUtil.randomString(); Integer[] val2 = new Integer[]{1, 2, 3, 4, 5}; - ManagementHelperTest.log.info("val2 type is " + val2); + ManagementHelperTest.log.info("val2 type is " + Arrays.toString(val2)); map.put(key1, val1); map.put(key2, val2); diff --git a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/ActiveMQAdmin.java b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/ActiveMQAdmin.java index c99cc558e1..68c633342a 100644 --- a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/ActiveMQAdmin.java +++ b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/ActiveMQAdmin.java @@ -252,7 +252,6 @@ public class ActiveMQAdmin implements Admin while ((line = br.readLine()) != null) { System.out.println("SERVER: " + line); - line.replace('|', '\n'); if ("OK".equals(line.trim())) { new Thread()