From 5ac2c2444b79d7a1e811dd2fd0973df332ad2268 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Mon, 10 Aug 2015 09:30:55 -0400 Subject: [PATCH] manual checkstyle changes --- .../apache/activemq/artemis/utils/Base64.java | 6 ++-- .../activemq/artemis/utils/ReusableLatch.java | 4 +-- .../core/impl/RemotingConnectionImpl.java | 8 ++--- .../artemis/utils/OrderedExecutorFactory.java | 2 +- .../artemis/utils/json/JSONArray.java | 2 +- .../artemis/utils/json/JSONObject.java | 2 +- .../artemis/utils/json/JSONTokener.java | 8 ++--- .../activemq/artemis/dto/package-info.java | 5 ++-- .../jms/bridge/impl/JMSBridgeImpl.java | 12 +++----- .../core/io/AbstractSequentialFile.java | 2 +- .../core/journal/impl/JournalTransaction.java | 4 +-- .../journal/ActiveMQJournalLogger.java | 4 +-- .../artemis/maven/ArtemisCreatePlugin.java | 4 +-- .../protocol/mqtt/MQTTProtocolHandler.java | 1 - .../proton/plug/util/CreditsSemaphore.java | 6 ++-- .../org/proton/plug/util/ReusableLatch.java | 4 +-- .../minimalclient/SimpleAMQPConnector.java | 20 ++++++------- .../journal/LargeServerMessageInSync.java | 2 +- .../core/postoffice/impl/PostOfficeImpl.java | 4 +-- .../security/ActiveMQSecurityManagerImpl.java | 3 +- .../jms/example/TopicSelectorExample1.java | 6 ++-- .../activemq/bugs/SlowConsumerTest.java | 2 +- .../extras/byteman/ClosingConnectionTest.java | 17 +++++------ .../HierarchicalObjectRepositoryTest.java | 6 ++-- .../extras/byteman/OrphanedConsumerTest.java | 6 ++-- .../client/ConsumerWindowSizeTest.java | 5 ++-- .../management/ManagementWithStompTest.java | 2 +- .../management/NotificationTest.java | 4 +-- .../management/SecurityNotificationTest.java | 10 +++---- .../openwire/amq/JMSConsumer6Test.java | 29 +++++++++---------- .../stomp/ConcurrentStompTest.java | 2 +- .../netty/ActiveMQFrameDecoder2Test.java | 2 +- .../artemis/tests/util/JMSTestBase.java | 4 +-- .../jms/tests/util/ProxyAssertSupport.java | 4 +-- .../tests/stress/stomp/StompStressTest.java | 2 +- 35 files changed, 86 insertions(+), 118 deletions(-) diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/Base64.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/Base64.java index 71dbcfb701..5284246cdb 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/Base64.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/Base64.java @@ -1567,8 +1567,7 @@ public class Base64 { // Encode? if (encode) { buffer[position++] = (byte) theByte; - if (position >= bufferLength) // Enough to encode. - { + if (position >= bufferLength) { // Enough to encode. out.write(Base64.encode3to4(b4, buffer, bufferLength, options)); lineLength += 4; @@ -1586,8 +1585,7 @@ public class Base64 { // Meaningful Base64 character? if (decodabet[theByte & 0x7f] > Base64.WHITE_SPACE_ENC) { buffer[position++] = (byte) theByte; - if (position >= bufferLength) // Enough to output. - { + if (position >= bufferLength) { // Enough to output. int len = Base64.decode4to3(buffer, 0, b4, 0, options); out.write(b4, 0, len); // out.write( Base64.decode4to3( buffer ) ); diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ReusableLatch.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ReusableLatch.java index 5fd0b55ae4..4f04f22930 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ReusableLatch.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ReusableLatch.java @@ -61,7 +61,7 @@ public class ReusableLatch { } public void add() { - for (; ; ) { + for (;;) { int actualState = getState(); int newState = actualState + 1; if (compareAndSetState(actualState, newState)) { @@ -72,7 +72,7 @@ public class ReusableLatch { @Override public boolean tryReleaseShared(final int numberOfReleases) { - for (; ; ) { + for (;;) { int actualState = getState(); if (actualState == 0) { return true; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/RemotingConnectionImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/RemotingConnectionImpl.java index 7bd68ad6aa..68687136b5 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/RemotingConnectionImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/RemotingConnectionImpl.java @@ -103,9 +103,7 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement final List incomingInterceptors, final List outgoingInterceptors, final Executor executor, - final SimpleString nodeID) - - { + final SimpleString nodeID) { this(packetDecoder, transportConnection, -1, -1, incomingInterceptors, outgoingInterceptors, false, executor, nodeID); } @@ -117,9 +115,7 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement final List outgoingInterceptors, final boolean client, final Executor executor, - final SimpleString nodeID) - - { + final SimpleString nodeID) { super(transportConnection, executor); this.packetDecoder = packetDecoder; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/OrderedExecutorFactory.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/OrderedExecutorFactory.java index 7e13fd6fd0..69cc54a146 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/OrderedExecutorFactory.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/OrderedExecutorFactory.java @@ -73,7 +73,7 @@ public final class OrderedExecutorFactory implements ExecutorFactory { this.parent = parent; runner = new Runnable() { public void run() { - for (; ; ) { + for (;;) { // Optimization, first try without any locks Runnable task = tasks.poll(); if (task == null) { diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONArray.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONArray.java index 7143273fef..0cbaf72ad4 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONArray.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONArray.java @@ -113,7 +113,7 @@ public class JSONArray { return; } x.back(); - for (; ; ) { + for (;;) { if (x.nextClean() == ',') { x.back(); myArrayList.add(null); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONObject.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONObject.java index 50d8447170..c23f7ee2bc 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONObject.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONObject.java @@ -181,7 +181,7 @@ public class JSONObject { if (x.nextClean() != '{') { throw x.syntaxError("A JSONObject text must begin with '{'"); } - for (; ; ) { + for (;;) { c = x.nextClean(); switch (c) { case 0: diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONTokener.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONTokener.java index 2dd5b5ed20..5f5153b964 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONTokener.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONTokener.java @@ -205,7 +205,7 @@ public class JSONTokener { * @throws JSONException */ public char nextClean() throws JSONException { - for (; ; ) { + for (;;) { char c = next(); if (c == 0 || c > ' ') { return c; @@ -228,7 +228,7 @@ public class JSONTokener { public String nextString(final char quote) throws JSONException { char c; StringBuffer sb = new StringBuffer(); - for (; ; ) { + for (;;) { c = next(); switch (c) { case 0: @@ -281,7 +281,7 @@ public class JSONTokener { */ public String nextTo(final char d) throws JSONException { StringBuffer sb = new StringBuffer(); - for (; ; ) { + for (;;) { char c = next(); if (c == d || c == 0 || c == '\n' || c == '\r') { if (c != 0) { @@ -303,7 +303,7 @@ public class JSONTokener { public String nextTo(final String delimiters) throws JSONException { char c; StringBuffer sb = new StringBuffer(); - for (; ; ) { + for (;;) { c = next(); if (delimiters.indexOf(c) >= 0 || c == 0 || c == '\n' || c == '\r') { if (c != 0) { diff --git a/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/package-info.java b/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/package-info.java index d9f22f5bfd..8f98eec4b9 100644 --- a/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/package-info.java +++ b/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/package-info.java @@ -18,5 +18,6 @@ * The JAXB POJOs for the XML configuration of ActiveMQ Artemis broker */ @javax.xml.bind.annotation.XmlSchema( - namespace = "http://activemq.org/schema", - elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package org.apache.activemq.artemis.dto; + namespace = "http://activemq.org/schema", + elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package org.apache.activemq.artemis.dto; 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 c0c7f9786e..ea6ea41892 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 @@ -1015,8 +1015,7 @@ public final class JMSBridgeImpl implements JMSBridge { sourceConn = createConnection(sourceUsername, sourcePassword, sourceCff, clientID, false, true); sourceSession = sourceConn.createSession(true, Session.SESSION_TRANSACTED); } - else // bridging across different servers - { + else { // bridging across different servers // QoS = ONCE_AND_ONLY_ONCE if (forwardMode == JMSBridgeImpl.FORWARD_MODE_XA) { // Create an XASession for consuming from the source @@ -1027,8 +1026,7 @@ public final class JMSBridgeImpl implements JMSBridge { sourceConn = createConnection(sourceUsername, sourcePassword, sourceCff, clientID, true, true); sourceSession = ((XAConnection) sourceConn).createXASession(); } - else // QoS = DUPLICATES_OK || AT_MOST_ONCE - { + else { // QoS = DUPLICATES_OK || AT_MOST_ONCE if (JMSBridgeImpl.trace) { ActiveMQJMSBridgeLogger.LOGGER.trace("Creating non XA source session"); } @@ -1068,8 +1066,7 @@ public final class JMSBridgeImpl implements JMSBridge { targetConn = sourceConn; targetSession = sourceSession; } - else // bridging across different servers - { + else { // bridging across different servers // QoS = ONCE_AND_ONLY_ONCE if (forwardMode == JMSBridgeImpl.FORWARD_MODE_XA) { if (JMSBridgeImpl.trace) { @@ -1082,8 +1079,7 @@ public final class JMSBridgeImpl implements JMSBridge { targetSession = ((XAConnection) targetConn).createXASession(); } - else // QoS = DUPLICATES_OK || AT_MOST_ONCE - { + else { // QoS = DUPLICATES_OK || AT_MOST_ONCE if (JMSBridgeImpl.trace) { ActiveMQJMSBridgeLogger.LOGGER.trace("Creating non XA dest session"); } diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/AbstractSequentialFile.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/AbstractSequentialFile.java index c294dbc459..dcb22ab37f 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/AbstractSequentialFile.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/AbstractSequentialFile.java @@ -109,7 +109,7 @@ public abstract class AbstractSequentialFile implements SequentialFile { ByteBuffer buffer = ByteBuffer.allocate(10 * 1024); - for (; ; ) { + for (;;) { buffer.rewind(); int size = this.read(buffer); newFileName.writeDirect(buffer, false); diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java index 930fb34fbf..8a29d600e7 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java @@ -340,9 +340,7 @@ public class JournalTransaction { } private AtomicInteger internalgetCounter(final JournalFile file) { - if (lastFile != file) - - { + if (lastFile != file) { lastFile = file; counter.set(0); } diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalLogger.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalLogger.java index 198185c1ae..67574d1dff 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalLogger.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalLogger.java @@ -72,8 +72,8 @@ public interface ActiveMQJournalLogger extends BasicLogger { @LogMessage(level = Logger.Level.INFO) @Message(id = 141007, value = "Current File on the journal is <= the sequence file.getFileID={0} on the dataFiles" + - "\nCurrentfile.getFileId={1} while the file.getFileID()={2}" + - "\nIs same = ({3})", + "\nCurrentfile.getFileId={1} while the file.getFileID()={2}" + + "\nIs same = ({3})", format = Message.Format.MESSAGE_FORMAT) void currentFile(Long fileID, Long id, Long fileFileID, Boolean b); diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java index d4d11201e6..e0db71474c 100644 --- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java +++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java @@ -46,9 +46,7 @@ import org.eclipse.aether.resolution.ArtifactResolutionException; import org.eclipse.aether.resolution.ArtifactResult; @Mojo(name = "create", defaultPhase = LifecyclePhase.VERIFY) -public class ArtemisCreatePlugin extends ArtemisAbstractPlugin - -{ +public class ArtemisCreatePlugin extends ArtemisAbstractPlugin { @Parameter String name; diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java index 1ef99df5c3..6db86df613 100644 --- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java +++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java @@ -58,7 +58,6 @@ public class MQTTProtocolHandler extends ChannelInboundHandlerAdapter { private ChannelHandlerContext ctx; private final MQTTLogger log = MQTTLogger.LOGGER; - ; private boolean stopped = false; diff --git a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/util/CreditsSemaphore.java b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/util/CreditsSemaphore.java index ae81ce4c6a..170e8755d8 100644 --- a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/util/CreditsSemaphore.java +++ b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/util/CreditsSemaphore.java @@ -33,7 +33,7 @@ public class CreditsSemaphore { @Override public int tryAcquireShared(final int numberOfAqcquires) { - for (; ; ) { + for (;;) { int actualSize = getState(); int newValue = actualSize - numberOfAqcquires; @@ -50,7 +50,7 @@ public class CreditsSemaphore { @Override public boolean tryReleaseShared(final int numberOfReleases) { - for (; ; ) { + for (;;) { int actualSize = getState(); int newValue = actualSize + numberOfReleases; @@ -62,7 +62,7 @@ public class CreditsSemaphore { } public void setCredits(final int credits) { - for (; ; ) { + for (;;) { int actualState = getState(); if (compareAndSetState(actualState, credits)) { // This is to wake up any pending threads that could be waiting on queued diff --git a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/util/ReusableLatch.java b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/util/ReusableLatch.java index 7703561be5..87e00e00fb 100644 --- a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/util/ReusableLatch.java +++ b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/util/ReusableLatch.java @@ -56,7 +56,7 @@ public class ReusableLatch { } public void add() { - for (; ; ) { + for (;;) { int actualState = getState(); int newState = actualState + 1; if (compareAndSetState(actualState, newState)) { @@ -67,7 +67,7 @@ public class ReusableLatch { @Override public boolean tryReleaseShared(final int numberOfReleases) { - for (; ; ) { + for (;;) { int actualState = getState(); if (actualState == 0) { return true; diff --git a/artemis-protocols/artemis-proton-plug/src/test/java/org/proton/plug/test/minimalclient/SimpleAMQPConnector.java b/artemis-protocols/artemis-proton-plug/src/test/java/org/proton/plug/test/minimalclient/SimpleAMQPConnector.java index 8fd7ecbf26..088e7a10a4 100644 --- a/artemis-protocols/artemis-proton-plug/src/test/java/org/proton/plug/test/minimalclient/SimpleAMQPConnector.java +++ b/artemis-protocols/artemis-proton-plug/src/test/java/org/proton/plug/test/minimalclient/SimpleAMQPConnector.java @@ -42,9 +42,9 @@ public class SimpleAMQPConnector implements Connector { bootstrap.group(new NioEventLoopGroup(10)); bootstrap.handler(new ChannelInitializer() { - public void initChannel(Channel channel) throws Exception { - } - }); + public void initChannel(Channel channel) throws Exception { + } + }); } public AMQPClientConnectionContext connect(String host, int port) throws Exception { @@ -59,14 +59,12 @@ public class SimpleAMQPConnector implements Connector { final AMQPClientConnectionContext connection = (AMQPClientConnectionContext) ProtonClientConnectionContextFactory.getFactory().createConnection(clientConnectionSPI); future.channel().pipeline().addLast(new ChannelDuplexHandler() { - - @Override - public void channelRead(final ChannelHandlerContext ctx, - final Object msg) throws Exception { - ByteBuf buffer = (ByteBuf) msg; - connection.inputBuffer(buffer); - } - }); + @Override + public void channelRead(final ChannelHandlerContext ctx, final Object msg) throws Exception { + ByteBuf buffer = (ByteBuf) msg; + connection.inputBuffer(buffer); + } + }); return connection; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageInSync.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageInSync.java index 7b274ab585..f264415052 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageInSync.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageInSync.java @@ -53,7 +53,7 @@ public final class LargeServerMessageInSync implements ReplicatedLargeMessage { if (appendFile != null) { appendFile.close(); appendFile.open(); - for (; ; ) { + for (;;) { buffer.rewind(); int bytesRead = appendFile.read(buffer); if (bytesRead > 0) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java index 5b7b95bf94..85ac2ef20e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java @@ -140,9 +140,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding final boolean enableWildCardRouting, final int idCacheSize, final boolean persistIDCache, - final HierarchicalRepository addressSettingsRepository) - - { + final HierarchicalRepository addressSettingsRepository) { this.storageManager = storageManager; queueFactory = bindableFactory; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQSecurityManagerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQSecurityManagerImpl.java index e4fa4d3d74..a9d4991ccc 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQSecurityManagerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQSecurityManagerImpl.java @@ -53,8 +53,7 @@ public class ActiveMQSecurityManagerImpl implements ActiveMQSecurityManager { else if (username == null && password == null) { return configuration.getDefaultUser() != null; } - else // the only possible case here is user == null, password != null - { + else { // the only possible case here is user == null, password != null logger.debug("Validating default user against a provided password. This happens when username=null, password!=null"); String defaultUsername = configuration.getDefaultUser(); User defaultUser = configuration.getUser(defaultUsername); diff --git a/examples/jms/topic-selector-example1/src/main/java/org/apache/activemq/artemis/jms/example/TopicSelectorExample1.java b/examples/jms/topic-selector-example1/src/main/java/org/apache/activemq/artemis/jms/example/TopicSelectorExample1.java index 09608dd21e..53aee126cd 100644 --- a/examples/jms/topic-selector-example1/src/main/java/org/apache/activemq/artemis/jms/example/TopicSelectorExample1.java +++ b/examples/jms/topic-selector-example1/src/main/java/org/apache/activemq/artemis/jms/example/TopicSelectorExample1.java @@ -89,7 +89,7 @@ public class TopicSelectorExample1 { System.out.println("*************************************************************"); System.out.println("MessageConsumer1 will only receive messages where someID=1:"); - for (; ; ) { + for (;;) { TextMessage messageReceivedA = (TextMessage) messageConsumer1.receive(1000); if (messageReceivedA == null) { break; @@ -103,7 +103,7 @@ public class TopicSelectorExample1 { // Step 13. Consume the messages from MessageConsumer2, filtering out someID=2 System.out.println("*************************************************************"); System.out.println("MessageConsumer2 will only receive messages where someID=2:"); - for (; ; ) { + for (;;) { TextMessage messageReceivedB = (TextMessage) messageConsumer2.receive(1000); if (messageReceivedB == null) { break; @@ -117,7 +117,7 @@ public class TopicSelectorExample1 { // Step 14. Consume the messages from MessageConsumer3, receiving the complete set of messages System.out.println("*************************************************************"); System.out.println("MessageConsumer3 will receive every message:"); - for (; ; ) { + for (;;) { TextMessage messageReceivedC = (TextMessage) messageConsumer3.receive(1000); if (messageReceivedC == null) { break; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/SlowConsumerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/SlowConsumerTest.java index d1ddf38d5a..c3c2bac2fa 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/SlowConsumerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/SlowConsumerTest.java @@ -140,7 +140,7 @@ public class SlowConsumerTest extends TestCase { stompSocket.setSoTimeout((int) timeOut); InputStream is = stompSocket.getInputStream(); int c = 0; - for (; ; ) { + for (;;) { c = is.read(); if (c < 0) { throw new IOException("socket closed."); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClosingConnectionTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClosingConnectionTest.java index 749ce19694..e5698f26aa 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClosingConnectionTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClosingConnectionTest.java @@ -107,15 +107,14 @@ public class ClosingConnectionTest extends ActiveMQTestBase { * Test for https://bugzilla.redhat.com/show_bug.cgi?id=1193085 * */ @Test - @BMRules( - rules = {@BMRule( - name = "rule to kill connection", - targetClass = "org.apache.activemq.artemis.core.io.nio.NIOSequentialFile", - targetMethod = "open(int, boolean)", - targetLocation = "AT INVOKE java.nio.channels.FileChannel.size()", - action = "org.apache.activemq.artemis.tests.extras.byteman.ClosingConnectionTest.killConnection();" - - )}) + @BMRules(rules = { + @BMRule( + name = "rule to kill connection", + targetClass = "org.apache.activemq.artemis.core.io.nio.NIOSequentialFile", + targetMethod = "open(int, boolean)", + targetLocation = "AT INVOKE java.nio.channels.FileChannel.size()", + action = "org.apache.activemq.artemis.tests.extras.byteman.ClosingConnectionTest.killConnection();") + }) public void testKillConnection() throws Exception { locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setBlockOnAcknowledge(true); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/HierarchicalObjectRepositoryTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/HierarchicalObjectRepositoryTest.java index 9855bddf2c..361cbc70d4 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/HierarchicalObjectRepositoryTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/HierarchicalObjectRepositoryTest.java @@ -33,9 +33,9 @@ import org.junit.runner.RunWith; @RunWith(BMUnitRunner.class) @BMRules(rules = {@BMRule(name = "modify map during iteration", - targetClass = "org.apache.activemq.artemis.core.settings.impl.HierarchicalObjectRepository", - targetMethod = "getPossibleMatches(String)", targetLocation = "AT INVOKE java.util.HashMap.put", - action = "org.apache.activemq.artemis.tests.extras.byteman.HierarchicalObjectRepositoryTest.bum()"),}) + targetClass = "org.apache.activemq.artemis.core.settings.impl.HierarchicalObjectRepository", + targetMethod = "getPossibleMatches(String)", targetLocation = "AT INVOKE java.util.HashMap.put", + action = "org.apache.activemq.artemis.tests.extras.byteman.HierarchicalObjectRepositoryTest.bum()"),}) public class HierarchicalObjectRepositoryTest { private static final String A = "a."; diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/OrphanedConsumerTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/OrphanedConsumerTest.java index 1a37ab3ecc..211aee5c15 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/OrphanedConsumerTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/OrphanedConsumerTest.java @@ -119,8 +119,7 @@ public class OrphanedConsumerTest extends ActiveMQTestBase { targetLocation = "ENTRY", condition = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.isConditionActive()", action = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.leavingCloseOnTestCountersWhileClosing()") - - }) + }) public void testOrphanedConsumers() throws Exception { internalTestOrphanedConsumers(false); } @@ -148,8 +147,7 @@ public class OrphanedConsumerTest extends ActiveMQTestBase { targetLocation = "ENTRY", condition = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.isConditionActive()", action = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.leavingCloseOnTestCountersWhileClosing()") - - }) + }) public void testOrphanedConsumersByManagement() throws Exception { internalTestOrphanedConsumers(true); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java index df212a12e0..4166d47ffd 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java @@ -1061,9 +1061,8 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { if (count++ == 1) { // it will hold here for a while - if (!latchDone.await(TIMEOUT, TimeUnit.SECONDS)) // a timed wait, so if the test fails, one less - // thread around - { + if (!latchDone.await(TIMEOUT, TimeUnit.SECONDS)) { + // a timed wait, so if the test fails, one less thread around new Exception("ClientConsuemrWindowSizeTest Handler couldn't receive signal in less than 5 seconds").printStackTrace(); failed = true; } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementWithStompTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementWithStompTest.java index 3e03afc677..1816d00ae8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementWithStompTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementWithStompTest.java @@ -195,7 +195,7 @@ public class ManagementWithStompTest extends ManagementTestBase { stompSocket.setSoTimeout((int) timeOut); InputStream is = stompSocket.getInputStream(); int c = 0; - for (; ; ) { + for (;;) { c = is.read(); if (c < 0) { throw new IOException("socket closed."); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/NotificationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/NotificationTest.java index 57ce05fed2..a5a66955d8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/NotificationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/NotificationTest.java @@ -252,9 +252,7 @@ public class NotificationTest extends ActiveMQTestBase { } m = consumer.receiveImmediate(); if (m != null) { - for (SimpleString key : m.getPropertyNames()) - - { + for (SimpleString key : m.getPropertyNames()) { System.out.println(key + "=" + m.getObjectProperty(key)); } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java index 27fcd7c511..015cbf4172 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java @@ -16,6 +16,9 @@ */ package org.apache.activemq.artemis.tests.integration.management; +import java.util.HashSet; +import java.util.Set; + import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.SimpleString; @@ -37,9 +40,6 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import java.util.HashSet; -import java.util.Set; - import static org.apache.activemq.artemis.api.core.management.CoreNotificationType.SECURITY_AUTHENTICATION_VIOLATION; import static org.apache.activemq.artemis.api.core.management.CoreNotificationType.SECURITY_PERMISSION_VIOLATION; @@ -183,9 +183,7 @@ public class SecurityNotificationTest extends ActiveMQTestBase { } m = consumer.receiveImmediate(); if (m != null) { - for (SimpleString key : m.getPropertyNames()) - - { + for (SimpleString key : m.getPropertyNames()) { System.out.println(key + "=" + m.getObjectProperty(key)); } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JMSConsumer6Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JMSConsumer6Test.java index 0e76e7f3c7..0c1b1b128d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JMSConsumer6Test.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JMSConsumer6Test.java @@ -16,23 +16,22 @@ */ package org.apache.activemq.artemis.tests.integration.openwire.amq; -import java.util.Arrays; -import java.util.Collection; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; - import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageListener; import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.TextMessage; +import java.util.Arrays; +import java.util.Collection; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.ActiveMQMessageConsumer; import org.apache.activemq.ActiveMQSession; -import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.artemis.tests.integration.openwire.BasicOpenWireTest; +import org.apache.activemq.command.ActiveMQDestination; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -65,14 +64,14 @@ public class JMSConsumer6Test extends BasicOpenWireTest { ActiveMQSession session = (ActiveMQSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE); ActiveMQDestination destination = createDestination(session, destinationType); MessageConsumer consumer = session.createConsumer(destination, new MessageListener() { - @Override - public void onMessage(Message m) { - counter.incrementAndGet(); - if (counter.get() == 4) { - done.countDown(); - } - } - }); + @Override + public void onMessage(Message m) { + counter.incrementAndGet(); + if (counter.get() == 4) { + done.countDown(); + } + } + }); assertNotNull(consumer); // Send the messages diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/ConcurrentStompTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/ConcurrentStompTest.java index fd16c12be6..2379caf1b1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/ConcurrentStompTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/ConcurrentStompTest.java @@ -115,7 +115,7 @@ public class ConcurrentStompTest extends StompTestBase { socket.setSoTimeout((int) timeOut); InputStream is = socket.getInputStream(); int c = 0; - for (; ; ) { + for (;;) { c = is.read(); if (c < 0) { throw new IOException("socket closed."); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/ActiveMQFrameDecoder2Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/ActiveMQFrameDecoder2Test.java index 6254ad4d59..a77018362c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/ActiveMQFrameDecoder2Test.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/ActiveMQFrameDecoder2Test.java @@ -59,7 +59,7 @@ public class ActiveMQFrameDecoder2Test extends ActiveMQTestBase { int cnt = 0; for (ByteBuf p : packets) { decoder.writeInbound(p); - for (; ; ) { + for (;;) { ByteBuf frame = (ByteBuf) decoder.readInbound(); if (frame == null) { break; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSTestBase.java index 9b14a03c07..d46861723f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSTestBase.java @@ -254,9 +254,7 @@ public class JMSTestBase extends ActiveMQTestBase { ServiceUtils.setTransactionManager(new DummyTransactionManager()); } - protected final void receiveMessages(JMSConsumer consumer, final int start, final int msgCount, final boolean ack) - - { + protected final void receiveMessages(JMSConsumer consumer, final int start, final int msgCount, final boolean ack) { try { for (int i = start; i < msgCount; i++) { Message message = consumer.receive(100); diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/util/ProxyAssertSupport.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/util/ProxyAssertSupport.java index 72782ed7a9..50b1d088b3 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/util/ProxyAssertSupport.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/util/ProxyAssertSupport.java @@ -66,9 +66,7 @@ public class ProxyAssertSupport { } } - public static void fail(final java.lang.String string) - - { + public static void fail(final java.lang.String string) { try { Assert.fail(string); } diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/stomp/StompStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/stomp/StompStressTest.java index 65196d535f..1a7b7648d9 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/stomp/StompStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/stomp/StompStressTest.java @@ -147,7 +147,7 @@ public class StompStressTest extends ActiveMQTestBase { stompSocket.setSoTimeout((int) timeOut); InputStream is = stompSocket.getInputStream(); int c = 0; - for (; ; ) { + for (;;) { c = is.read(); if (c < 0) { throw new IOException("socket closed.");