manual checkstyle changes

This commit is contained in:
Clebert Suconic 2015-08-10 09:30:55 -04:00
parent bac96047f5
commit 5ac2c2444b
35 changed files with 86 additions and 118 deletions
artemis-commons/src/main/java/org/apache/activemq/artemis/utils
artemis-core-client/src/main/java/org/apache/activemq/artemis
artemis-dto/src/main/java/org/apache/activemq/artemis/dto
artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl
artemis-journal/src/main/java/org/apache/activemq/artemis
artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven
artemis-protocols
artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt
artemis-proton-plug/src
main/java/org/proton/plug/util
test/java/org/proton/plug/test/minimalclient
artemis-server/src/main/java/org/apache/activemq/artemis
core
persistence/impl/journal
postoffice/impl
spi/core/security
examples/jms/topic-selector-example1/src/main/java/org/apache/activemq/artemis/jms/example
tests
activemq5-unit-tests/src/test/java/org/apache/activemq/bugs
extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman
integration-tests/src/test/java/org/apache/activemq/artemis/tests
jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/util
stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/stomp

View File

@ -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 ) );

View File

@ -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;

View File

@ -103,9 +103,7 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement
final List<Interceptor> incomingInterceptors,
final List<Interceptor> 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<Interceptor> outgoingInterceptors,
final boolean client,
final Executor executor,
final SimpleString nodeID)
{
final SimpleString nodeID) {
super(transportConnection, executor);
this.packetDecoder = packetDecoder;

View File

@ -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) {

View File

@ -113,7 +113,7 @@ public class JSONArray {
return;
}
x.back();
for (; ; ) {
for (;;) {
if (x.nextClean() == ',') {
x.back();
myArrayList.add(null);

View File

@ -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:

View File

@ -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) {

View File

@ -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;

View File

@ -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");
}

View File

@ -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);

View File

@ -340,9 +340,7 @@ public class JournalTransaction {
}
private AtomicInteger internalgetCounter(final JournalFile file) {
if (lastFile != file)
{
if (lastFile != file) {
lastFile = file;
counter.set(0);
}

View File

@ -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);

View File

@ -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;

View File

@ -58,7 +58,6 @@ public class MQTTProtocolHandler extends ChannelInboundHandlerAdapter {
private ChannelHandlerContext ctx;
private final MQTTLogger log = MQTTLogger.LOGGER;
;
private boolean stopped = false;

View File

@ -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

View File

@ -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;

View File

@ -42,9 +42,9 @@ public class SimpleAMQPConnector implements Connector {
bootstrap.group(new NioEventLoopGroup(10));
bootstrap.handler(new ChannelInitializer<Channel>() {
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;
}

View File

@ -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)

View File

@ -140,9 +140,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
final boolean enableWildCardRouting,
final int idCacheSize,
final boolean persistIDCache,
final HierarchicalRepository<AddressSettings> addressSettingsRepository)
{
final HierarchicalRepository<AddressSettings> addressSettingsRepository) {
this.storageManager = storageManager;
queueFactory = bindableFactory;

View File

@ -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);

View File

@ -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;

View File

@ -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.");

View File

@ -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);

View File

@ -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.";

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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.");

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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

View File

@ -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.");

View File

@ -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;

View File

@ -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);

View File

@ -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);
}

View File

@ -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.");