http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java ---------------------------------------------------------------------- diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java index f1605cb..a6ddf68 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java @@ -111,8 +111,7 @@ public final class StompConnection implements RemotingConnection { StompFrame frame = null; try { frame = frameHandler.decode(buffer); - } - catch (ActiveMQStompException e) { + } catch (ActiveMQStompException e) { switch (e.getCode()) { case ActiveMQStompException.INVALID_EOL_V10: if (version != null) @@ -258,8 +257,7 @@ public final class StompConnection implements RemotingConnection { if (queueCreator != null) { queueCreator.create(SimpleString.toSimpleString(queue)); } - } - catch (Exception e) { + } catch (Exception e) { throw new ActiveMQStompException(e.getMessage(), e).setHandler(frameHandler); } } @@ -400,8 +398,7 @@ public final class StompConnection implements RemotingConnection { for (final FailureListener listener : listenersClone) { try { listener.connectionFailed(me, false); - } - catch (final Throwable t) { + } catch (final Throwable t) { // Failure of one listener to execute shouldn't prevent others // from // executing @@ -416,8 +413,7 @@ public final class StompConnection implements RemotingConnection { for (final CloseListener listener : listenersClone) { try { listener.connectionClosed(); - } - catch (final Throwable t) { + } catch (final Throwable t) { // Failure of one listener to execute shouldn't prevent others // from // executing @@ -435,8 +431,7 @@ public final class StompConnection implements RemotingConnection { if (acceptVersion == null) { this.version = StompVersions.V1_0; - } - else { + } else { StringTokenizer tokenizer = new StringTokenizer(acceptVersion, ","); Set<String> requestVersions = new HashSet<>(tokenizer.countTokens()); while (tokenizer.hasMoreTokens()) { @@ -445,14 +440,11 @@ public final class StompConnection implements RemotingConnection { if (requestVersions.contains(StompVersions.V1_2.toString())) { this.version = StompVersions.V1_2; - } - else if (requestVersions.contains(StompVersions.V1_1.toString())) { + } else if (requestVersions.contains(StompVersions.V1_1.toString())) { this.version = StompVersions.V1_1; - } - else if (requestVersions.contains(StompVersions.V1_0.toString())) { + } else if (requestVersions.contains(StompVersions.V1_0.toString())) { this.version = StompVersions.V1_0; - } - else { + } else { //not a supported version! ActiveMQStompException error = BUNDLE.versionNotSupported(acceptVersion).setHandler(frameHandler); error.addHeader(Stomp.Headers.Error.VERSION, manager.getSupportedVersionsAsErrorVersion()); @@ -508,8 +500,7 @@ public final class StompConnection implements RemotingConnection { } reply = frameHandler.handleFrame(request); - } - catch (ActiveMQStompException e) { + } catch (ActiveMQStompException e) { reply = e.getFrame(); } @@ -544,12 +535,10 @@ public final class StompConnection implements RemotingConnection { try { if (txID == null) { session = manager.getSession(this); - } - else { + } else { session = manager.getTransactedSession(this, txID); } - } - catch (Exception e) { + } catch (Exception e) { throw BUNDLE.errorGetSession(e).setHandler(frameHandler); } @@ -574,12 +563,10 @@ public final class StompConnection implements RemotingConnection { try { if (minLargeMessageSize == -1 || (message.getBodyBuffer().writerIndex() < minLargeMessageSize)) { stompSession.sendInternal(message, false); - } - else { + } else { stompSession.sendInternalLarge(message, false); } - } - catch (Exception e) { + } catch (Exception e) { throw BUNDLE.errorSendMessage(message, e).setHandler(frameHandler); } } @@ -597,11 +584,9 @@ public final class StompConnection implements RemotingConnection { protected void beginTransaction(String txID) throws ActiveMQStompException { try { manager.beginTransaction(this, txID); - } - catch (ActiveMQStompException e) { + } catch (ActiveMQStompException e) { throw e; - } - catch (Exception e) { + } catch (Exception e) { throw BUNDLE.errorBeginTx(txID, e).setHandler(frameHandler); } } @@ -609,8 +594,7 @@ public final class StompConnection implements RemotingConnection { public void commitTransaction(String txID) throws ActiveMQStompException { try { manager.commitTransaction(this, txID); - } - catch (Exception e) { + } catch (Exception e) { throw BUNDLE.errorCommitTx(txID, e).setHandler(frameHandler); } } @@ -618,11 +602,9 @@ public final class StompConnection implements RemotingConnection { public void abortTransaction(String txID) throws ActiveMQStompException { try { manager.abortTransaction(this, txID); - } - catch (ActiveMQStompException e) { + } catch (ActiveMQStompException e) { throw e; - } - catch (Exception e) { + } catch (Exception e) { throw BUNDLE.errorAbortTx(txID, e).setHandler(frameHandler); } } @@ -638,8 +620,7 @@ public final class StompConnection implements RemotingConnection { String noLocalFilter = CONNECTION_ID_PROP + " <> '" + getID().toString() + "'"; if (selector == null) { selector = noLocalFilter; - } - else { + } else { selector += " AND " + noLocalFilter; } } @@ -651,8 +632,7 @@ public final class StompConnection implements RemotingConnection { String subscriptionID = null; if (id != null) { subscriptionID = id; - } - else { + } else { if (destination == null) { throw BUNDLE.noDestination().setHandler(frameHandler); } @@ -661,11 +641,9 @@ public final class StompConnection implements RemotingConnection { try { manager.createSubscription(this, subscriptionID, durableSubscriptionName, destination, selector, ack, noLocal); - } - catch (ActiveMQStompException e) { + } catch (ActiveMQStompException e) { throw e; - } - catch (Exception e) { + } catch (Exception e) { throw BUNDLE.errorCreatSubscription(subscriptionID, e).setHandler(frameHandler); } } @@ -673,11 +651,9 @@ public final class StompConnection implements RemotingConnection { public void unsubscribe(String subscriptionID, String durableSubscriptionName) throws ActiveMQStompException { try { manager.unsubscribe(this, subscriptionID, durableSubscriptionName); - } - catch (ActiveMQStompException e) { + } catch (ActiveMQStompException e) { throw e; - } - catch (Exception e) { + } catch (Exception e) { throw BUNDLE.errorUnsubscrib(subscriptionID, e).setHandler(frameHandler); } } @@ -685,11 +661,9 @@ public final class StompConnection implements RemotingConnection { public void acknowledge(String messageID, String subscriptionID) throws ActiveMQStompException { try { manager.acknowledge(this, messageID, subscriptionID); - } - catch (ActiveMQStompException e) { + } catch (ActiveMQStompException e) { throw e; - } - catch (Exception e) { + } catch (Exception e) { throw BUNDLE.errorAck(messageID, e).setHandler(frameHandler); } }
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompDecoder.java ---------------------------------------------------------------------- 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 427509f..cd2a929 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 @@ -221,16 +221,14 @@ public class StompDecoder { if (contentLength != -1) { if (pos + contentLength + 1 > data) { // Need more bytes - } - else { + } else { content = new byte[contentLength]; System.arraycopy(workingBuffer, pos, content, 0, contentLength); pos += contentLength + 1; } - } - else { + } else { // Need to scan for terminating NUL if (bodyStart == -1) { @@ -269,8 +267,7 @@ public class StompDecoder { init(); return ret; - } - else { + } else { return null; } } @@ -371,13 +368,11 @@ public class StompDecoder { while (offset < data) { if (workingBuffer[offset] == NEW_LINE) { nextChar = false; - } - else if (workingBuffer[offset] == CR) { + } else if (workingBuffer[offset] == CR) { if (nextChar) throw BUNDLE.invalidTwoCRs().setHandler(handler); nextChar = true; - } - else { + } else { break; } offset++; @@ -404,8 +399,7 @@ public class StompDecoder { // ABORT command = COMMAND_ABORT; - } - else { + } else { if (!tryIncrement(offset + COMMAND_ACK_LENGTH + 1)) { return false; } @@ -433,18 +427,14 @@ public class StompDecoder { // COMMIT command = COMMAND_COMMIT; - } - /**** added by meddy, 27 april 2011, handle header parser for reply to websocket protocol ****/ - else if (workingBuffer[offset + 7] == E) { + } else if (workingBuffer[offset + 7] == E) { if (!tryIncrement(offset + COMMAND_CONNECTED_LENGTH + 1)) { return false; } // CONNECTED command = COMMAND_CONNECTED; - } - /**** end ****/ - else { + } else { if (!tryIncrement(offset + COMMAND_CONNECT_LENGTH + 1)) { return false; } @@ -504,16 +494,14 @@ public class StompDecoder { // SEND command = COMMAND_SEND; - } - else if (workingBuffer[offset + 1] == T) { + } else if (workingBuffer[offset + 1] == T) { if (!tryIncrement(offset + COMMAND_STOMP_LENGTH + 1)) { return false; } // STOMP command = COMMAND_STOMP; - } - else { + } else { if (!tryIncrement(offset + COMMAND_SUBSCRIBE_LENGTH + 1)) { return false; } @@ -594,8 +582,7 @@ public class StompDecoder { public boolean tryIncrement(final int length) { if (pos + length >= data) { return false; - } - else { + } else { pos += length; return true; @@ -612,8 +599,7 @@ public class StompDecoder { //Unreadable characters str.append(bytes[i]); - } - else { + } else { str.append(b); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java ---------------------------------------------------------------------- diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java index 5dd74f5..50c3108 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java @@ -93,7 +93,7 @@ public class StompFrame { if (buffer == null) { if (isPing()) { buffer = ActiveMQBuffers.fixedBuffer(1); - buffer.writeByte((byte)10); + buffer.writeByte((byte) 10); size = buffer.writerIndex(); return buffer; } @@ -124,8 +124,7 @@ public class StompFrame { buffer.writeBytes(END_OF_FRAME); size = buffer.writerIndex(); - } - else { + } else { buffer.readerIndex(0); } return buffer; @@ -183,27 +182,17 @@ public class StompFrame { if (c == (byte) 10) { buffer[iBuffer] = (byte) 92; buffer[++iBuffer] = (byte) 110; - } - - // \r - else if (c == (byte) 13) { + } else if (c == (byte) 13) { // \r buffer[iBuffer] = (byte) 92; buffer[++iBuffer] = (byte) 114; - } + } else if (c == (byte) 92) { // \ - // \ - else if (c == (byte) 92) { buffer[iBuffer] = (byte) 92; buffer[++iBuffer] = (byte) 92; - } - - // : - else if (c == (byte) 58) { + } else if (c == (byte) 58) { // : buffer[iBuffer] = (byte) 92; buffer[++iBuffer] = (byte) 99; - } - - else { + } else { buffer[iBuffer] = c; } iBuffer++; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java ---------------------------------------------------------------------- diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java index 235cddd..46f8e4c 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java @@ -56,7 +56,7 @@ import static org.apache.activemq.artemis.core.protocol.stomp.ActiveMQStompProto /** * StompProtocolManager */ -public class StompProtocolManager extends AbstractProtocolManager<StompFrame,StompFrameInterceptor,StompConnection> { +public class StompProtocolManager extends AbstractProtocolManager<StompFrame, StompFrameInterceptor, StompConnection> { private static final List<String> websocketRegistryNames = Arrays.asList("v10.stomp", "v11.stomp", "v12.stomp"); @@ -136,8 +136,7 @@ public class StompProtocolManager extends AbstractProtocolManager<StompFrame,Sto if (ttl != -1) { return new ConnectionEntry(conn, null, System.currentTimeMillis(), ttl); - } - else { + } else { // Default to 1 minute - which is same as core protocol return new ConnectionEntry(conn, null, System.currentTimeMillis(), 1 * 60 * 1000); } @@ -157,8 +156,7 @@ public class StompProtocolManager extends AbstractProtocolManager<StompFrame,Sto StompFrame request; try { request = conn.decode(buffer); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorDecodingPacket(e); return; } @@ -170,8 +168,7 @@ public class StompProtocolManager extends AbstractProtocolManager<StompFrame,Sto try { invokeInterceptors(this.incomingInterceptors, request, conn); conn.handleFrame(request); - } - finally { + } finally { server.getStorageManager().clearContext(); } } while (conn.hasBytes()); @@ -214,8 +211,7 @@ public class StompProtocolManager extends AbstractProtocolManager<StompFrame,Sto try { connection.physicalSend(frame); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQStompProtocolLogger.LOGGER.errorSendingFrame(e, frame); return false; } @@ -268,8 +264,7 @@ public class StompProtocolManager extends AbstractProtocolManager<StompFrame,Sto session.getSession().stop(); session.getSession().rollback(true); session.getSession().close(false); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorCleaningStompConn(e); } } @@ -283,8 +278,7 @@ public class StompProtocolManager extends AbstractProtocolManager<StompFrame,Sto try { serverSession.rollback(true); serverSession.close(false); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorCleaningStompConn(e); } iterator.remove(); @@ -341,11 +335,9 @@ public class StompProtocolManager extends AbstractProtocolManager<StompFrame,Sto if (sm != null && server.getConfiguration().isSecurityEnabled()) { if (sm instanceof ActiveMQSecurityManager3) { validated = ((ActiveMQSecurityManager3) sm).validateUser(login, passcode, certificates) != null; - } - else if (sm instanceof ActiveMQSecurityManager2) { + } else if (sm instanceof ActiveMQSecurityManager2) { validated = ((ActiveMQSecurityManager2) sm).validateUser(login, passcode, certificates); - } - else { + } else { validated = sm.validateUser(login, passcode); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java ---------------------------------------------------------------------- diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java index 2596b15..f86dd92 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java @@ -124,7 +124,10 @@ public class StompSession implements SessionCallback { } @Override - public int sendMessage(MessageReference ref, ServerMessage serverMessage, final ServerConsumer consumer, int deliveryCount) { + public int sendMessage(MessageReference ref, + ServerMessage serverMessage, + final ServerConsumer consumer, + int deliveryCount) { LargeServerMessageImpl largeMessage = null; ServerMessage newServerMessage = serverMessage; try { @@ -183,22 +186,19 @@ public class StompSession implements SessionCallback { } }); } - } - else { + } else { messagesToAck.put(newServerMessage.getMessageID(), new Pair<>(consumer.getID(), length)); // Must send AFTER adding to messagesToAck - or could get acked from client BEFORE it's been added! manager.send(connection, frame); } return length; - } - catch (Exception e) { + } catch (Exception e) { if (ActiveMQStompProtocolLogger.LOGGER.isDebugEnabled()) { ActiveMQStompProtocolLogger.LOGGER.debug(e); } return 0; - } - finally { + } finally { if (largeMessage != null) { largeMessage.releaseResources(); largeMessage = null; @@ -216,7 +216,11 @@ public class StompSession implements SessionCallback { } @Override - public int sendLargeMessage(MessageReference ref, ServerMessage msg, ServerConsumer consumer, long bodySize, int deliveryCount) { + public int sendLargeMessage(MessageReference ref, + ServerMessage msg, + ServerConsumer consumer, + long bodySize, + int deliveryCount) { return 0; } @@ -260,8 +264,7 @@ public class StompSession implements SessionCallback { if (sub.getAck().equals(Stomp.Headers.Subscribe.AckModeValues.CLIENT_INDIVIDUAL)) { session.individualAcknowledge(consumerID, id); - } - else { + } else { session.acknowledge(consumerID, id); } @@ -293,14 +296,12 @@ public class StompSession implements SessionCallback { if (manager.getServer().locateQueue(queueName) == null) { session.createQueue(SimpleString.toSimpleString(destination), queueName, SimpleString.toSimpleString(selector), false, true); } - } - else { + } else { queueName = UUIDGenerator.getInstance().generateSimpleStringUUID(); session.createQueue(SimpleString.toSimpleString(destination), queueName, SimpleString.toSimpleString(selector), true, false); } session.createConsumer(consumerID, queueName, null, false, false, receiveCredits); - } - else { + } else { session.createConsumer(consumerID, queueName, SimpleString.toSimpleString(selector), false, false, receiveCredits); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompUtils.java ---------------------------------------------------------------------- diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompUtils.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompUtils.java index e45b220..affab84 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompUtils.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompUtils.java @@ -43,8 +43,7 @@ public class StompUtils { String priority = headers.remove(Stomp.Headers.Send.PRIORITY); if (priority != null) { msg.setPriority(Byte.parseByte(priority)); - } - else { + } else { msg.setPriority(Byte.parseByte(DEFAULT_MESSAGE_PRIORITY)); } String persistent = headers.remove(Stomp.Headers.Send.PERSISTENT); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java ---------------------------------------------------------------------- diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java index 25d32be..003865c 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java @@ -42,7 +42,10 @@ public abstract class VersionedStompFrameHandler { protected final ScheduledExecutorService scheduledExecutorService; protected final ExecutorFactory executorFactory; - public static VersionedStompFrameHandler getHandler(StompConnection connection, StompVersions version, ScheduledExecutorService scheduledExecutorService, ExecutorFactory executorFactory) { + public static VersionedStompFrameHandler getHandler(StompConnection connection, + StompVersions version, + ScheduledExecutorService scheduledExecutorService, + ExecutorFactory executorFactory) { if (version == StompVersions.V1_0) { return new StompFrameHandlerV10(connection, scheduledExecutorService, executorFactory); } @@ -55,7 +58,9 @@ public abstract class VersionedStompFrameHandler { return null; } - protected VersionedStompFrameHandler(StompConnection connection, ScheduledExecutorService scheduledExecutorService, ExecutorFactory executorFactory) { + protected VersionedStompFrameHandler(StompConnection connection, + ScheduledExecutorService scheduledExecutorService, + ExecutorFactory executorFactory) { this.connection = connection; this.scheduledExecutorService = scheduledExecutorService; this.executorFactory = executorFactory; @@ -78,45 +83,33 @@ public abstract class VersionedStompFrameHandler { if (Stomp.Commands.SEND.equals(request.getCommand())) { response = onSend(request); - } - else if (Stomp.Commands.ACK.equals(request.getCommand())) { + } else if (Stomp.Commands.ACK.equals(request.getCommand())) { response = onAck(request); - } - else if (Stomp.Commands.NACK.equals(request.getCommand())) { + } else if (Stomp.Commands.NACK.equals(request.getCommand())) { response = onNack(request); - } - else if (Stomp.Commands.BEGIN.equals(request.getCommand())) { + } else if (Stomp.Commands.BEGIN.equals(request.getCommand())) { response = onBegin(request); - } - else if (Stomp.Commands.COMMIT.equals(request.getCommand())) { + } else if (Stomp.Commands.COMMIT.equals(request.getCommand())) { response = onCommit(request); - } - else if (Stomp.Commands.ABORT.equals(request.getCommand())) { + } else if (Stomp.Commands.ABORT.equals(request.getCommand())) { response = onAbort(request); - } - else if (Stomp.Commands.SUBSCRIBE.equals(request.getCommand())) { + } else if (Stomp.Commands.SUBSCRIBE.equals(request.getCommand())) { response = onSubscribe(request); - } - else if (Stomp.Commands.UNSUBSCRIBE.equals(request.getCommand())) { + } else if (Stomp.Commands.UNSUBSCRIBE.equals(request.getCommand())) { response = onUnsubscribe(request); - } - else if (Stomp.Commands.CONNECT.equals(request.getCommand())) { + } else if (Stomp.Commands.CONNECT.equals(request.getCommand())) { response = onConnect(request); - } - else if (Stomp.Commands.STOMP.equals(request.getCommand())) { + } else if (Stomp.Commands.STOMP.equals(request.getCommand())) { response = onStomp(request); - } - else if (Stomp.Commands.DISCONNECT.equals(request.getCommand())) { + } else if (Stomp.Commands.DISCONNECT.equals(request.getCommand())) { response = onDisconnect(request); - } - else { + } else { response = onUnknown(request.getCommand()); } if (response == null) { response = postprocess(request); - } - else { + } else { if (request.hasHeader(Stomp.Headers.RECEIPT_REQUESTED)) { response.addHeader(Stomp.Headers.Response.RECEIPT_ID, request.getHeader(Stomp.Headers.RECEIPT_REQUESTED)); } @@ -164,8 +157,7 @@ public abstract class VersionedStompFrameHandler { try { connection.commitTransaction(txID); - } - catch (ActiveMQStompException e) { + } catch (ActiveMQStompException e) { response = e.getFrame(); } return response; @@ -188,19 +180,16 @@ public abstract class VersionedStompFrameHandler { if (frame.hasHeader(Stomp.Headers.CONTENT_LENGTH)) { message.setType(Message.BYTES_TYPE); message.getBodyBuffer().writeBytes(frame.getBodyAsBytes()); - } - else { + } else { message.setType(Message.TEXT_TYPE); String text = frame.getBody(); message.getBodyBuffer().writeNullableSimpleString(SimpleString.toSimpleString(text)); } connection.sendServerMessage(message, txID); - } - catch (ActiveMQStompException e) { + } catch (ActiveMQStompException e) { response = e.getFrame(); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQStompException error = BUNDLE.errorHandleSend(e).setHandler(this); response = error.getFrame(); } @@ -218,12 +207,10 @@ public abstract class VersionedStompFrameHandler { if (txID == null) { ActiveMQStompException error = BUNDLE.beginTxNoID().setHandler(this); response = error.getFrame(); - } - else { + } else { try { connection.beginTransaction(txID); - } - catch (ActiveMQStompException e) { + } catch (ActiveMQStompException e) { response = e.getFrame(); } } @@ -242,8 +229,7 @@ public abstract class VersionedStompFrameHandler { try { connection.abortTransaction(txID); - } - catch (ActiveMQStompException e) { + } catch (ActiveMQStompException e) { response = e.getFrame(); } @@ -269,8 +255,7 @@ public abstract class VersionedStompFrameHandler { try { connection.subscribe(destination, selector, ack, id, durableSubscriptionName, noLocal); - } - catch (ActiveMQStompException e) { + } catch (ActiveMQStompException e) { response = e.getFrame(); } @@ -284,8 +269,7 @@ public abstract class VersionedStompFrameHandler { if (request.getCommand().equals(Stomp.Commands.DISCONNECT)) { response.setNeedsDisconnect(true); } - } - else { + } else { //request null, disconnect if so. if (request.getCommand().equals(Stomp.Commands.DISCONNECT)) { this.connection.disconnect(false); @@ -316,13 +300,11 @@ public abstract class VersionedStompFrameHandler { if (serverMessage.containsProperty(Stomp.Headers.CONTENT_LENGTH) || serverMessage.getType() == Message.BYTES_TYPE) { frame.addHeader(Headers.CONTENT_LENGTH, String.valueOf(data.length)); buffer.readBytes(data); - } - else { + } else { SimpleString text = buffer.readNullableSimpleString(); if (text != null) { data = text.toString().getBytes(StandardCharsets.UTF_8); - } - else { + } else { data = new byte[0]; } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v10/StompFrameHandlerV10.java ---------------------------------------------------------------------- diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v10/StompFrameHandlerV10.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v10/StompFrameHandlerV10.java index 0e32881..4a0cfa1 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v10/StompFrameHandlerV10.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v10/StompFrameHandlerV10.java @@ -20,8 +20,8 @@ import javax.security.cert.X509Certificate; import java.util.Map; import java.util.concurrent.ScheduledExecutorService; -import org.apache.activemq.artemis.core.protocol.stomp.FrameEventListener; import org.apache.activemq.artemis.core.protocol.stomp.ActiveMQStompException; +import org.apache.activemq.artemis.core.protocol.stomp.FrameEventListener; import org.apache.activemq.artemis.core.protocol.stomp.Stomp; import org.apache.activemq.artemis.core.protocol.stomp.StompConnection; import org.apache.activemq.artemis.core.protocol.stomp.StompDecoder; @@ -37,7 +37,9 @@ import static org.apache.activemq.artemis.core.protocol.stomp.ActiveMQStompProto public class StompFrameHandlerV10 extends VersionedStompFrameHandler implements FrameEventListener { - public StompFrameHandlerV10(StompConnection connection, ScheduledExecutorService scheduledExecutorService, ExecutorFactory factory) { + public StompFrameHandlerV10(StompConnection connection, + ScheduledExecutorService scheduledExecutorService, + ExecutorFactory factory) { super(connection, scheduledExecutorService, factory); decoder = new StompDecoder(this); decoder.init(); @@ -73,8 +75,7 @@ public class StompFrameHandlerV10 extends VersionedStompFrameHandler implements if (requestID != null) { response.addHeader(Stomp.Headers.Connected.RESPONSE_ID, requestID); } - } - else { + } else { //not valid response = new StompFrameV10(Stomp.Responses.ERROR); String responseText = "Security Error occurred: User name [" + login + "] or password is invalid"; @@ -102,8 +103,7 @@ public class StompFrameHandlerV10 extends VersionedStompFrameHandler implements String subscriptionID = null; if (id != null) { subscriptionID = id; - } - else { + } else { if (destination == null) { ActiveMQStompException error = BUNDLE.needIDorDestination().setHandler(this); response = error.getFrame(); @@ -114,8 +114,7 @@ public class StompFrameHandlerV10 extends VersionedStompFrameHandler implements try { connection.unsubscribe(subscriptionID, durableSubscriptionName); - } - catch (ActiveMQStompException e) { + } catch (ActiveMQStompException e) { return e.getFrame(); } return response; @@ -134,8 +133,7 @@ public class StompFrameHandlerV10 extends VersionedStompFrameHandler implements try { connection.acknowledge(messageID, null); - } - catch (ActiveMQStompException e) { + } catch (ActiveMQStompException e) { response = e.getFrame(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameHandlerV11.java ---------------------------------------------------------------------- diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameHandlerV11.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameHandlerV11.java index 35de63c..c4a9a61 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameHandlerV11.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameHandlerV11.java @@ -48,7 +48,9 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements private HeartBeater heartBeater; - public StompFrameHandlerV11(StompConnection connection, ScheduledExecutorService scheduledExecutorService, ExecutorFactory executorFactory) { + public StompFrameHandlerV11(StompConnection connection, + ScheduledExecutorService scheduledExecutorService, + ExecutorFactory executorFactory) { super(connection, scheduledExecutorService, executorFactory); connection.addStompEventListener(this); decoder = new StompDecoderV11(this); @@ -98,13 +100,11 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements handleHeartBeat(heartBeat); if (heartBeater == null) { response.addHeader(Stomp.Headers.Connected.HEART_BEAT, "0,0"); - } - else { + } else { response.addHeader(Stomp.Headers.Connected.HEART_BEAT, heartBeater.serverPingPeriod + "," + heartBeater.clientPingResponse); } } - } - else { + } else { // not valid response = createStompFrame(Stomp.Responses.ERROR); response.setNeedsDisconnect(true); @@ -113,8 +113,7 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements response.setBody(responseText); response.addHeader(Stomp.Headers.Error.MESSAGE, responseText); } - } - catch (ActiveMQStompException e) { + } catch (ActiveMQStompException e) { response = e.getFrame(); } @@ -156,16 +155,14 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements String subscriptionID = null; if (id != null) { subscriptionID = id; - } - else if (durableSubscriptionName == null) { + } else if (durableSubscriptionName == null) { response = BUNDLE.needSubscriptionID().setHandler(this).getFrame(); return response; } try { connection.unsubscribe(subscriptionID, durableSubscriptionName); - } - catch (ActiveMQStompException e) { + } catch (ActiveMQStompException e) { response = e.getFrame(); } return response; @@ -190,8 +187,7 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements try { connection.acknowledge(messageID, subscriptionID); - } - catch (ActiveMQStompException e) { + } catch (ActiveMQStompException e) { response = e.getFrame(); } @@ -222,8 +218,7 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements if (reply.needsDisconnect()) { connection.disconnect(false); - } - else { + } else { //update ping if (heartBeater != null) { heartBeater.pinged(); @@ -259,14 +254,17 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements AtomicLong lastPingTimestamp = new AtomicLong(0); ConnectionEntry connectionEntry; - private HeartBeater(ScheduledExecutorService scheduledExecutorService, Executor executor, final long clientPing, final long clientAcceptPing) { + private HeartBeater(ScheduledExecutorService scheduledExecutorService, + Executor executor, + final long clientPing, + final long clientAcceptPing) { super(scheduledExecutorService, executor, clientAcceptPing > MIN_SERVER_PING ? clientAcceptPing : MIN_SERVER_PING, TimeUnit.MILLISECONDS, false); if (clientAcceptPing != 0) { serverPingPeriod = super.getPeriod(); } - connectionEntry = ((RemotingServiceImpl)connection.getManager().getServer().getRemotingService()).getConnectionEntry(connection.getID()); + connectionEntry = ((RemotingServiceImpl) connection.getManager().getServer().getRemotingService()).getConnectionEntry(connection.getID()); if (connectionEntry != null) { String heartBeatToTtlModifierStr = (String) connection.getAcceptorUsed().getConfiguration().get(TransportConstants.HEART_BEAT_TO_CONNECTION_TTL_MODIFIER); @@ -292,8 +290,7 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements if (connectionTtl < ttlMin) { connectionTtl = ttlMin; clientPingResponse = (long) (ttlMin / heartBeatToTtlModifier); - } - else if (connectionTtl > ttlMax) { + } else if (connectionTtl > ttlMax) { connectionTtl = ttlMax; clientPingResponse = (long) (ttlMax / heartBeatToTtlModifier); } @@ -375,13 +372,11 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements if (workingBuffer[offset] == NEW_LINE) { //client ping nextChar = false; - } - else if (workingBuffer[offset] == CR) { + } else if (workingBuffer[offset] == CR) { if (nextChar) throw BUNDLE.invalidTwoCRs().setHandler(handler); nextChar = true; - } - else { + } else { break; } offset++; @@ -417,8 +412,7 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements // ABORT command = COMMAND_ABORT; - } - else { + } else { if (!tryIncrement(offset + COMMAND_ACK_LENGTH + eolLen)) { return false; } @@ -446,18 +440,14 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements // COMMIT command = COMMAND_COMMIT; - } - /**** added by meddy, 27 april 2011, handle header parser for reply to websocket protocol ****/ - else if (workingBuffer[offset + 7] == E) { + } else if (workingBuffer[offset + 7] == E) { if (!tryIncrement(offset + COMMAND_CONNECTED_LENGTH + eolLen)) { return false; } // CONNECTED command = COMMAND_CONNECTED; - } - /**** end ****/ - else { + } else { if (!tryIncrement(offset + COMMAND_CONNECT_LENGTH + eolLen)) { return false; } @@ -517,16 +507,14 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements // SEND command = COMMAND_SEND; - } - else if (workingBuffer[offset + 1] == U) { + } else if (workingBuffer[offset + 1] == U) { if (!tryIncrement(offset + COMMAND_SUBSCRIBE_LENGTH + eolLen)) { return false; } // SUBSCRIBE command = COMMAND_SUBSCRIBE; - } - else { + } else { if (!tryIncrement(offset + StompDecoder.COMMAND_STOMP_LENGTH + eolLen)) { return false; } @@ -584,8 +572,7 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements //this is a backslash holder.append(b); isEscaping = false; - } - else { + } else { //begin escaping isEscaping = true; } @@ -610,8 +597,7 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements if (isEscaping) { holder.append(StompDecoder.NEW_LINE); isEscaping = false; - } - else { + } else { holder.append(b); } break; @@ -620,8 +606,7 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements if (isEscaping) { holder.append(StompDecoder.HEADER_SEPARATOR); isEscaping = false; - } - else { + } else { holder.append(b); } break; @@ -678,8 +663,7 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements if (contentLength != -1) { if (pos + contentLength + 1 > data) { // Need more bytes - } - else { + } else { content = new byte[contentLength]; System.arraycopy(workingBuffer, pos, content, 0, contentLength); @@ -697,8 +681,7 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements } } } - } - else { + } else { // Need to scan for terminating NUL if (bodyStart == -1) { @@ -735,8 +718,7 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements init(); return ret; - } - else { + } else { return null; } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java ---------------------------------------------------------------------- diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java index 31c7132..e6dd5b7 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java @@ -51,8 +51,7 @@ public class StompFrameV11 extends StompFrame { if (!headers.containsKey(key)) { headers.put(key, val); allHeaders.add(new Header(key, val)); - } - else if (!key.equals(Stomp.Headers.CONTENT_LENGTH)) { + } else if (!key.equals(Stomp.Headers.CONTENT_LENGTH)) { allHeaders.add(new Header(key, val)); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameHandlerV12.java ---------------------------------------------------------------------- diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameHandlerV12.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameHandlerV12.java index 19149bf..2149721 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameHandlerV12.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameHandlerV12.java @@ -34,7 +34,9 @@ import static org.apache.activemq.artemis.core.protocol.stomp.ActiveMQStompProto public class StompFrameHandlerV12 extends StompFrameHandlerV11 { - public StompFrameHandlerV12(StompConnection connection, ScheduledExecutorService scheduledExecutorService, ExecutorFactory factory) { + public StompFrameHandlerV12(StompConnection connection, + ScheduledExecutorService scheduledExecutorService, + ExecutorFactory factory) { super(connection, scheduledExecutorService, factory); decoder = new StompDecoderV12(this); decoder.init(); @@ -80,8 +82,7 @@ public class StompFrameHandlerV12 extends StompFrameHandlerV11 { try { connection.acknowledge(messageID, null); - } - catch (ActiveMQStompException e) { + } catch (ActiveMQStompException e) { response = e.getFrame(); } @@ -110,11 +111,9 @@ public class StompFrameHandlerV12 extends StompFrameHandlerV11 { //either \n or \r\n if (workingBuffer[pos - 2] == NEW_LINE) { pos--; - } - else if (workingBuffer[pos - 2] != CR) { + } else if (workingBuffer[pos - 2] != CR) { throwInvalid(); - } - else if (workingBuffer[pos - 1] != NEW_LINE) { + } else if (workingBuffer[pos - 1] != NEW_LINE) { throwInvalid(); } } @@ -140,8 +139,7 @@ public class StompFrameHandlerV12 extends StompFrameHandlerV11 { //this is a backslash holder.append(b); isEscaping = false; - } - else { + } else { //begin escaping isEscaping = true; } @@ -166,8 +164,7 @@ public class StompFrameHandlerV12 extends StompFrameHandlerV11 { if (isEscaping) { holder.append(NEW_LINE); isEscaping = false; - } - else { + } else { holder.append(b); } break; @@ -176,8 +173,7 @@ public class StompFrameHandlerV12 extends StompFrameHandlerV11 { if (isEscaping) { holder.append(CR); isEscaping = false; - } - else { + } else { holder.append(b); } break; @@ -193,8 +189,7 @@ public class StompFrameHandlerV12 extends StompFrameHandlerV11 { if (isEscaping) { holder.append(StompDecoder.HEADER_SEPARATOR); isEscaping = false; - } - else { + } else { holder.append(b); } break; @@ -253,8 +248,7 @@ public class StompFrameHandlerV12 extends StompFrameHandlerV11 { if (contentLength != -1) { if (pos + contentLength + 1 > data) { // Need more bytes - } - else { + } else { content = new byte[contentLength]; System.arraycopy(workingBuffer, pos, content, 0, contentLength); @@ -272,8 +266,7 @@ public class StompFrameHandlerV12 extends StompFrameHandlerV11 { } } } - } - else { + } else { // Need to scan for terminating NUL if (bodyStart == -1) { @@ -310,8 +303,7 @@ public class StompFrameHandlerV12 extends StompFrameHandlerV11 { init(); return ret; - } - else { + } else { return null; } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-protocols/pom.xml ---------------------------------------------------------------------- diff --git a/artemis-protocols/pom.xml b/artemis-protocols/pom.xml index 29289ac..f853d18 100644 --- a/artemis-protocols/pom.xml +++ b/artemis-protocols/pom.xml @@ -15,7 +15,8 @@ See the License for the specific language governing permissions and limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <artifactId>artemis-pom</artifactId> <groupId>org.apache.activemq</groupId> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRABundle.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRABundle.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRABundle.java index 622c2ec..f2e9722 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRABundle.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRABundle.java @@ -16,14 +16,14 @@ */ package org.apache.activemq.artemis.ra; +import javax.jms.JMSRuntimeException; +import javax.resource.NotSupportedException; + import org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException; +import org.jboss.logging.Messages; import org.jboss.logging.annotations.Cause; import org.jboss.logging.annotations.Message; import org.jboss.logging.annotations.MessageBundle; -import org.jboss.logging.Messages; - -import javax.jms.JMSRuntimeException; -import javax.resource.NotSupportedException; /** * Logger Code 15 http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRABytesMessage.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRABytesMessage.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRABytesMessage.java index 667d4a5..6e38088 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRABytesMessage.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRABytesMessage.java @@ -16,10 +16,9 @@ */ package org.apache.activemq.artemis.ra; -import java.util.Arrays; - import javax.jms.BytesMessage; import javax.jms.JMSException; +import java.util.Arrays; /** * A wrapper for a message http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionFactoryImpl.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionFactoryImpl.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionFactoryImpl.java index 2a1b706..faf111e 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionFactoryImpl.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionFactoryImpl.java @@ -83,8 +83,7 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact if (ActiveMQRAConnectionFactoryImpl.trace) { ActiveMQRALogger.LOGGER.trace("Created new ConnectionManager=" + this.cm); } - } - else { + } else { this.cm = cm; } @@ -120,8 +119,7 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact if (reference == null) { try { reference = new Reference(this.getClass().getCanonicalName(), new SerializableObjectRefAddr("ActiveMQ-CF", this), ConnectionFactoryObjectFactory.class.getCanonicalName(), null); - } - catch (NamingException e) { + } catch (NamingException e) { ActiveMQRALogger.LOGGER.errorCreatingReference(e); } } @@ -432,13 +430,11 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact conn.setPassword(password); try { validateUser(conn); - } - catch (JMSSecurityException e) { + } catch (JMSSecurityException e) { JMSSecurityRuntimeException e2 = new JMSSecurityRuntimeException(e.getMessage()); e2.initCause(e); throw e2; - } - catch (JMSException e) { + } catch (JMSException e) { JMSRuntimeException e2 = new JMSRuntimeException(e.getMessage()); e2.initCause(e); throw e2; @@ -463,13 +459,11 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact conn.setPassword(password); try { validateUser(conn); - } - catch (JMSSecurityException e) { + } catch (JMSSecurityException e) { JMSSecurityRuntimeException e2 = new JMSSecurityRuntimeException(e.getMessage()); e2.initCause(e); throw e2; - } - catch (JMSException e) { + } catch (JMSException e) { JMSRuntimeException e2 = new JMSRuntimeException(e.getMessage()); e2.initCause(e); throw e2; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionManager.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionManager.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionManager.java index bb0d0f3..f895b59 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionManager.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionManager.java @@ -79,8 +79,7 @@ public class ActiveMQRAConnectionManager implements ConnectionManager { for (ManagedConnection conn : connections) { try { conn.destroy(); - } - catch (Throwable e) { + } catch (Throwable e) { } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionMetaData.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionMetaData.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionMetaData.java index 32b4d0d..88da41c 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionMetaData.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionMetaData.java @@ -16,11 +16,10 @@ */ package org.apache.activemq.artemis.ra; +import javax.jms.ConnectionMetaData; import java.util.Enumeration; import java.util.Vector; -import javax.jms.ConnectionMetaData; - /** * This class implements javax.jms.ConnectionMetaData */ http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionRequestInfo.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionRequestInfo.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionRequestInfo.java index 97350ff..29a4c2d 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionRequestInfo.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionRequestInfo.java @@ -261,8 +261,7 @@ public class ActiveMQRAConnectionRequestInfo implements ConnectionRequestInfo { type == you.getType() && transacted == you.isTransacted() && acknowledgeMode == you.getAcknowledgeMode(); - } - else { + } else { return false; } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRACredential.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRACredential.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRACredential.java index 8a38e45..ee04949 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRACredential.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRACredential.java @@ -16,16 +16,15 @@ */ package org.apache.activemq.artemis.ra; -import java.io.Serializable; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.Set; - import javax.resource.spi.ConnectionRequestInfo; import javax.resource.spi.ManagedConnectionFactory; import javax.resource.spi.SecurityException; import javax.resource.spi.security.PasswordCredential; import javax.security.auth.Subject; +import java.io.Serializable; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.Set; /** * Credential information @@ -130,8 +129,7 @@ public class ActiveMQRACredential implements Serializable { if (subject == null && info != null) { jc.setUserName(((ActiveMQRAConnectionRequestInfo) info).getUserName()); jc.setPassword(((ActiveMQRAConnectionRequestInfo) info).getPassword()); - } - else if (subject != null) { + } else if (subject != null) { PasswordCredential pwdc = GetCredentialAction.getCredential(subject, mcf); if (pwdc == null) { @@ -140,8 +138,7 @@ public class ActiveMQRACredential implements Serializable { jc.setUserName(pwdc.getUserName()); jc.setPassword(new String(pwdc.getPassword())); - } - else { + } else { throw new SecurityException("No Subject or ConnectionRequestInfo set, could not get credentials"); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAJMSContext.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAJMSContext.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAJMSContext.java index 5d14ba4..fce9c11 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAJMSContext.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAJMSContext.java @@ -16,13 +16,13 @@ */ package org.apache.activemq.artemis.ra; +import javax.jms.ExceptionListener; +import javax.jms.JMSContext; + import org.apache.activemq.artemis.jms.client.ActiveMQConnectionForContext; import org.apache.activemq.artemis.jms.client.ActiveMQJMSContext; import org.apache.activemq.artemis.jms.client.ThreadAwareContext; -import javax.jms.ExceptionListener; -import javax.jms.JMSContext; - public class ActiveMQRAJMSContext extends ActiveMQJMSContext { public ActiveMQRAJMSContext(ActiveMQConnectionForContext connection, http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRALocalTransaction.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRALocalTransaction.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRALocalTransaction.java index 7857255..342a27f 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRALocalTransaction.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRALocalTransaction.java @@ -78,11 +78,9 @@ public class ActiveMQRALocalTransaction implements LocalTransaction { if (mc.getSession().getTransacted()) { mc.getSession().commit(); } - } - catch (JMSException e) { + } catch (JMSException e) { throw new ResourceException("Could not commit LocalTransaction", e); - } - finally { + } finally { //mc.setInManagedTx(false); mc.unlock(); } @@ -104,11 +102,9 @@ public class ActiveMQRALocalTransaction implements LocalTransaction { if (mc.getSession().getTransacted()) { mc.getSession().rollback(); } - } - catch (JMSException ex) { + } catch (JMSException ex) { throw new ResourceException("Could not rollback LocalTransaction", ex); - } - finally { + } finally { //mc.setInManagedTx(false); mc.unlock(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMCFProperties.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMCFProperties.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMCFProperties.java index dc363e7..945d434 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMCFProperties.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMCFProperties.java @@ -16,10 +16,9 @@ */ package org.apache.activemq.artemis.ra; -import java.io.Serializable; - import javax.jms.Queue; import javax.jms.Topic; +import java.io.Serializable; /** * The MCF default properties - these are set in the tx-connection-factory at the jms-ds.xml @@ -121,11 +120,9 @@ public class ActiveMQRAMCFProperties extends ConnectionFactoryProperties impleme if (defaultType.equals(ActiveMQRAMCFProperties.QUEUE_TYPE)) { type = ActiveMQRAConnectionFactory.QUEUE_CONNECTION; - } - else if (defaultType.equals(ActiveMQRAMCFProperties.TOPIC_TYPE)) { + } else if (defaultType.equals(ActiveMQRAMCFProperties.TOPIC_TYPE)) { type = ActiveMQRAConnectionFactory.TOPIC_CONNECTION; - } - else { + } else { type = ActiveMQRAConnectionFactory.CONNECTION; } } @@ -142,11 +139,9 @@ public class ActiveMQRAMCFProperties extends ConnectionFactoryProperties impleme if (type == ActiveMQRAConnectionFactory.CONNECTION) { return "BOTH"; - } - else if (type == ActiveMQRAConnectionFactory.QUEUE_CONNECTION) { + } else if (type == ActiveMQRAConnectionFactory.QUEUE_CONNECTION) { return ActiveMQRAMCFProperties.TOPIC_TYPE; - } - else { + } else { return ActiveMQRAMCFProperties.QUEUE_TYPE; } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnection.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnection.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnection.java index 97c6032..efd8ccc 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnection.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnection.java @@ -161,21 +161,17 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc try { setup(); - } - catch (ResourceException e) { + } catch (ResourceException e) { try { destroy(); - } - catch (Throwable ignored) { + } catch (Throwable ignored) { } throw e; - } - catch (Throwable t) { + } catch (Throwable t) { try { destroy(); - } - catch (Throwable ignored) { + } catch (Throwable ignored) { } throw new ResourceException("Error during setup", t); } @@ -232,8 +228,7 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc if (connection != null) { connection.stop(); } - } - catch (Throwable t) { + } catch (Throwable t) { ActiveMQRALogger.LOGGER.trace("Ignored error stopping connection", t); } @@ -263,8 +258,7 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc try { connection.setExceptionListener(null); - } - catch (JMSException e) { + } catch (JMSException e) { ActiveMQRALogger.LOGGER.debug("Error unsetting the exception listener " + this, e); } if (connection != null) { @@ -296,8 +290,7 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc if (xaSession != null) { xaSession.close(); } - } - catch (JMSException e) { + } catch (JMSException e) { ActiveMQRALogger.LOGGER.debug("Error closing session " + this, e); } @@ -305,8 +298,7 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc if (connectionFactory != null) { ra.closeConnectionFactory(mcf.getProperties()); } - } - catch (Throwable e) { + } catch (Throwable e) { throw new ResourceException("Could not properly close the session and connection", e); } } @@ -356,8 +348,7 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc ActiveMQRASession h = (ActiveMQRASession) obj; h.setManagedConnection(this); handles.add(h); - } - else { + } else { throw new IllegalStateException("ManagedConnection in an illegal state"); } } @@ -376,8 +367,7 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc throw new javax.jms.IllegalStateException("Transaction " + tx + " not active"); } } - } - catch (SystemException e) { + } catch (SystemException e) { JMSException jmsE = new javax.jms.IllegalStateException("Unexpected exception on the Transaction ManagerTransaction"); jmsE.initCause(e); throw jmsE; @@ -415,8 +405,7 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc if (lock.tryLock(tryLock.intValue(), TimeUnit.SECONDS) == false) { throw new ResourceAllocationException("Unable to obtain lock in " + tryLock + " seconds: " + this); } - } - catch (InterruptedException e) { + } catch (InterruptedException e) { throw new ResourceAllocationException("Interrupted attempting lock: " + this); } } @@ -588,8 +577,7 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc try { connection.setExceptionListener(null); - } - catch (JMSException e) { + } catch (JMSException e) { ActiveMQRALogger.LOGGER.debug("Unable to unset exception listener", e); } @@ -610,8 +598,7 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc } return xaSession.getSession(); - } - else { + } else { if (ActiveMQRAManagedConnection.trace) { ActiveMQRALogger.LOGGER.trace("getSession() -> non XA session " + nonXAsession); } @@ -764,8 +751,7 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc if (cri.getType() == ActiveMQRAConnectionFactory.TOPIC_CONNECTION) { if (userName != null && password != null) { connection = (ActiveMQXAConnection) connectionFactory.createXATopicConnection(userName, password); - } - else { + } else { connection = (ActiveMQXAConnection) connectionFactory.createXATopicConnection(); } @@ -774,12 +760,10 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc xaSession = connection.createXATopicSession(); nonXAsession = connection.createNonXATopicSession(transacted, acknowledgeMode); - } - else if (cri.getType() == ActiveMQRAConnectionFactory.QUEUE_CONNECTION) { + } else if (cri.getType() == ActiveMQRAConnectionFactory.QUEUE_CONNECTION) { if (userName != null && password != null) { connection = (ActiveMQXAConnection) connectionFactory.createXAQueueConnection(userName, password); - } - else { + } else { connection = (ActiveMQXAConnection) connectionFactory.createXAQueueConnection(); } @@ -788,12 +772,10 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc xaSession = connection.createXAQueueSession(); nonXAsession = connection.createNonXAQueueSession(transacted, acknowledgeMode); - } - else { + } else { if (userName != null && password != null) { connection = (ActiveMQXAConnection) connectionFactory.createXAConnection(userName, password); - } - else { + } else { connection = (ActiveMQXAConnection) connectionFactory.createXAConnection(); } @@ -803,8 +785,7 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc nonXAsession = connection.createNonXASession(transacted, acknowledgeMode); } - } - catch (JMSException je) { + } catch (JMSException je) { throw new ResourceException(je.getMessage(), je); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java index c46efca..a3541a6 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java @@ -310,8 +310,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti ActiveMQRAManagedConnectionFactory other = (ActiveMQRAManagedConnectionFactory) obj; return mcfProperties.equals(other.getProperties()) && ra.equals(other.getResourceAdapter()); - } - else { + } else { return false; } } @@ -671,8 +670,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti if (info == null) { // Create a default one return new ActiveMQRAConnectionRequestInfo(ra.getProperties(), mcfProperties.getType()); - } - else { + } else { // Fill the one with any defaults info.setDefaults(ra.getProperties()); return info; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMapMessage.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMapMessage.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMapMessage.java index 0b2cb61..70e5005 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMapMessage.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMapMessage.java @@ -16,11 +16,10 @@ */ package org.apache.activemq.artemis.ra; -import java.util.Arrays; -import java.util.Enumeration; - import javax.jms.JMSException; import javax.jms.MapMessage; +import java.util.Arrays; +import java.util.Enumeration; /** * A wrapper for a message http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessage.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessage.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessage.java index d060009..9b49466 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessage.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessage.java @@ -810,8 +810,7 @@ public class ActiveMQRAMessage implements Message { if (object != null && object instanceof ActiveMQRAMessage) { return message.equals(((ActiveMQRAMessage) object).message); - } - else { + } else { return message.equals(object); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessageConsumer.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessageConsumer.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessageConsumer.java index 73ec6c2..0e156aa 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessageConsumer.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessageConsumer.java @@ -77,8 +77,7 @@ public class ActiveMQRAMessageConsumer implements MessageConsumer { } try { closeConsumer(); - } - finally { + } finally { session.removeConsumer(this); } } @@ -126,12 +125,10 @@ public class ActiveMQRAMessageConsumer implements MessageConsumer { session.checkStrict(); if (listener == null) { consumer.setMessageListener(null); - } - else { + } else { consumer.setMessageListener(wrapMessageListener(listener)); } - } - finally { + } finally { session.unlock(); } } @@ -175,12 +172,10 @@ public class ActiveMQRAMessageConsumer implements MessageConsumer { if (message == null) { return null; - } - else { + } else { return wrapMessage(message); } - } - finally { + } finally { session.unlock(); } } @@ -209,12 +204,10 @@ public class ActiveMQRAMessageConsumer implements MessageConsumer { if (message == null) { return null; - } - else { + } else { return wrapMessage(message); } - } - finally { + } finally { session.unlock(); } } @@ -242,12 +235,10 @@ public class ActiveMQRAMessageConsumer implements MessageConsumer { if (message == null) { return null; - } - else { + } else { return wrapMessage(message); } - } - finally { + } finally { session.unlock(); } } @@ -278,17 +269,13 @@ public class ActiveMQRAMessageConsumer implements MessageConsumer { if (message instanceof BytesMessage) { return new ActiveMQRABytesMessage((BytesMessage) message, session); - } - else if (message instanceof MapMessage) { + } else if (message instanceof MapMessage) { return new ActiveMQRAMapMessage((MapMessage) message, session); - } - else if (message instanceof ObjectMessage) { + } else if (message instanceof ObjectMessage) { return new ActiveMQRAObjectMessage((ObjectMessage) message, session); - } - else if (message instanceof StreamMessage) { + } else if (message instanceof StreamMessage) { return new ActiveMQRAStreamMessage((StreamMessage) message, session); - } - else if (message instanceof TextMessage) { + } else if (message instanceof TextMessage) { return new ActiveMQRATextMessage((TextMessage) message, session); } return new ActiveMQRAMessage(message, session); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessageProducer.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessageProducer.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessageProducer.java index 41337f6..74c11cc 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessageProducer.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessageProducer.java @@ -73,8 +73,7 @@ public class ActiveMQRAMessageProducer implements MessageProducer { } try { closeProducer(); - } - finally { + } finally { session.removeProducer(this); } } @@ -118,8 +117,7 @@ public class ActiveMQRAMessageProducer implements MessageProducer { if (ActiveMQRAMessageProducer.trace) { ActiveMQRALogger.LOGGER.trace("sent " + this + " result=" + message); } - } - finally { + } finally { session.unlock(); } } @@ -146,8 +144,7 @@ public class ActiveMQRAMessageProducer implements MessageProducer { if (ActiveMQRAMessageProducer.trace) { ActiveMQRALogger.LOGGER.trace("sent " + this + " result=" + message); } - } - finally { + } finally { session.unlock(); } } @@ -187,8 +184,7 @@ public class ActiveMQRAMessageProducer implements MessageProducer { if (ActiveMQRAMessageProducer.trace) { ActiveMQRALogger.LOGGER.trace("sent " + this + " result=" + message); } - } - finally { + } finally { session.unlock(); } } @@ -214,8 +210,7 @@ public class ActiveMQRAMessageProducer implements MessageProducer { if (ActiveMQRAMessageProducer.trace) { ActiveMQRALogger.LOGGER.trace("sent " + this + " result=" + message); } - } - finally { + } finally { session.unlock(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAObjectMessage.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAObjectMessage.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAObjectMessage.java index c343917..a01575c 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAObjectMessage.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAObjectMessage.java @@ -16,10 +16,9 @@ */ package org.apache.activemq.artemis.ra; -import java.io.Serializable; - import javax.jms.JMSException; import javax.jms.ObjectMessage; +import java.io.Serializable; /** * A wrapper for a message http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAProperties.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAProperties.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAProperties.java index a1046b9..95a58d3 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAProperties.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAProperties.java @@ -253,8 +253,7 @@ public class ActiveMQRAProperties extends ConnectionFactoryProperties implements if (password != null) { password = codecInstance.decode(password); } - } - catch (Exception e) { + } catch (Exception e) { throw ActiveMQRABundle.BUNDLE.errorDecodingPassword(e); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAQueueSender.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAQueueSender.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAQueueSender.java index 90fb8ea..47a7acb 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAQueueSender.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAQueueSender.java @@ -98,8 +98,7 @@ public class ActiveMQRAQueueSender extends ActiveMQRAMessageProducer implements if (ActiveMQRAQueueSender.trace) { ActiveMQRALogger.LOGGER.trace("sent " + this + " result=" + message); } - } - finally { + } finally { session.unlock(); } } @@ -125,8 +124,7 @@ public class ActiveMQRAQueueSender extends ActiveMQRAMessageProducer implements if (ActiveMQRAQueueSender.trace) { ActiveMQRALogger.LOGGER.trace("sent " + this + " result=" + message); } - } - finally { + } finally { session.unlock(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAService.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAService.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAService.java index 1f4cc29..8efe50e 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAService.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAService.java @@ -16,11 +16,10 @@ */ package org.apache.activemq.artemis.ra; -import java.util.Set; - import javax.management.MBeanServer; import javax.management.ObjectInstance; import javax.management.ObjectName; +import java.util.Set; /** * An ActiveMQRAService ensures that ActiveMQ Artemis Resource Adapter will be stopped *before* the ActiveMQ Artemis server. @@ -57,8 +56,7 @@ public class ActiveMQRAService { mBeanServer.invoke(mbean.getObjectName(), "stop", new Object[0], new String[0]); } } - } - catch (Exception e) { + } catch (Exception e) { ActiveMQRALogger.LOGGER.errorStoppingRA(e); } }
