http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java index a80d550..a69061e 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java @@ -32,8 +32,8 @@ import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.utils.TypedProperties; -import static org.apache.activemq.artemis.reader.MapMessageUtil.writeBodyMap; import static org.apache.activemq.artemis.reader.MapMessageUtil.readBodyMap; +import static org.apache.activemq.artemis.reader.MapMessageUtil.writeBodyMap; /** * ActiveMQ Artemis implementation of a JMS MapMessage. @@ -187,8 +187,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess checkName(name); try { TypedProperties.setObjectProperty(new SimpleString(name), value, map); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } invalid = true; @@ -198,8 +197,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess public boolean getBoolean(final String name) throws JMSException { try { return map.getBooleanProperty(new SimpleString(name)); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } } @@ -208,8 +206,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess public byte getByte(final String name) throws JMSException { try { return map.getByteProperty(new SimpleString(name)); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } } @@ -218,8 +215,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess public short getShort(final String name) throws JMSException { try { return map.getShortProperty(new SimpleString(name)); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } } @@ -228,8 +224,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess public char getChar(final String name) throws JMSException { try { return map.getCharProperty(new SimpleString(name)); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } } @@ -238,8 +233,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess public int getInt(final String name) throws JMSException { try { return map.getIntProperty(new SimpleString(name)); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } } @@ -248,8 +242,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess public long getLong(final String name) throws JMSException { try { return map.getLongProperty(new SimpleString(name)); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } } @@ -258,8 +251,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess public float getFloat(final String name) throws JMSException { try { return map.getFloatProperty(new SimpleString(name)); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } } @@ -268,8 +260,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess public double getDouble(final String name) throws JMSException { try { return map.getDoubleProperty(new SimpleString(name)); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } } @@ -280,12 +271,10 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess SimpleString str = map.getSimpleStringProperty(new SimpleString(name)); if (str == null) { return null; - } - else { + } else { return str.toString(); } - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } } @@ -294,8 +283,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess public byte[] getBytes(final String name) throws JMSException { try { return map.getBytesProperty(new SimpleString(name)); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } }
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java index 78acdb7..12b1296 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java @@ -77,16 +77,13 @@ public class ActiveMQMessage implements javax.jms.Message { entry.getKey().equals("timestamp") || entry.getKey().equals("priority")) { // Ignore - } - else if (entry.getKey().equals("userID")) { + } else if (entry.getKey().equals("userID")) { jmsMessage.put("JMSMessageID", entry.getValue().toString()); - } - else { + } else { Object value = entry.getValue(); if (value instanceof SimpleString) { jmsMessage.put(entry.getKey(), value.toString()); - } - else { + } else { jmsMessage.put(entry.getKey(), value); } } @@ -95,8 +92,6 @@ public class ActiveMQMessage implements javax.jms.Message { return jmsMessage; } - - public static CompositeData coreCompositeTypeToJMSCompositeType(CompositeDataSupport data) throws Exception { CompositeData jmsdata = new CompositeDataSupport(data.getCompositeType(), new HashMap<String, Object>()); return jmsdata; @@ -124,7 +119,9 @@ public class ActiveMQMessage implements javax.jms.Message { return createMessage(message, session, null); } - public static ActiveMQMessage createMessage(final ClientMessage message, final ClientSession session, final ConnectionFactoryOptions options) { + public static ActiveMQMessage createMessage(final ClientMessage message, + final ClientSession session, + final ConnectionFactoryOptions options) { int type = message.getType(); ActiveMQMessage msg; @@ -248,16 +245,14 @@ public class ActiveMQMessage implements javax.jms.Message { try { byte[] corrIDBytes = foreign.getJMSCorrelationIDAsBytes(); setJMSCorrelationIDAsBytes(corrIDBytes); - } - catch (JMSException e) { + } catch (JMSException e) { // specified as String String corrIDString = foreign.getJMSCorrelationID(); if (corrIDString != null) { setJMSCorrelationID(corrIDString); } } - } - else { + } else { // Some providers, like WSMQ do automatic conversions between native byte[] correlation id // and String correlation id. This makes it impossible for ActiveMQ Artemis to guarantee to return the correct // type as set by the user @@ -329,8 +324,7 @@ public class ActiveMQMessage implements javax.jms.Message { public void setJMSCorrelationIDAsBytes(final byte[] correlationID) throws JMSException { try { MessageUtil.setJMSCorrelationIDAsBytes(message, correlationID); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { JMSException ex = new JMSException(e.getMessage()); ex.initCause(e); throw ex; @@ -371,8 +365,7 @@ public class ActiveMQMessage implements javax.jms.Message { if (dest == null) { MessageUtil.setJMSReplyTo(message, null); replyTo = null; - } - else { + } else { if (dest instanceof ActiveMQDestination == false) { throw new InvalidDestinationException("Foreign destination " + dest); } @@ -410,11 +403,9 @@ public class ActiveMQMessage implements javax.jms.Message { public void setJMSDeliveryMode(final int deliveryMode) throws JMSException { if (deliveryMode == DeliveryMode.PERSISTENT) { message.setDurable(true); - } - else if (deliveryMode == DeliveryMode.NON_PERSISTENT) { + } else if (deliveryMode == DeliveryMode.NON_PERSISTENT) { message.setDurable(false); - } - else { + } else { throw ActiveMQJMSClientBundle.BUNDLE.illegalDeliveryMode(deliveryMode); } } @@ -428,12 +419,10 @@ public class ActiveMQMessage implements javax.jms.Message { public void setJMSRedelivered(final boolean redelivered) throws JMSException { if (!redelivered) { message.setDeliveryCount(1); - } - else { + } else { if (message.getDeliveryCount() > 1) { // do nothing - } - else { + } else { message.setDeliveryCount(2); } } @@ -500,8 +489,7 @@ public class ActiveMQMessage implements javax.jms.Message { public boolean getBooleanProperty(final String name) throws JMSException { try { return message.getBooleanProperty(new SimpleString(name)); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } } @@ -510,8 +498,7 @@ public class ActiveMQMessage implements javax.jms.Message { public byte getByteProperty(final String name) throws JMSException { try { return message.getByteProperty(new SimpleString(name)); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } } @@ -520,8 +507,7 @@ public class ActiveMQMessage implements javax.jms.Message { public short getShortProperty(final String name) throws JMSException { try { return message.getShortProperty(new SimpleString(name)); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } } @@ -534,8 +520,7 @@ public class ActiveMQMessage implements javax.jms.Message { try { return message.getIntProperty(new SimpleString(name)); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } } @@ -548,8 +533,7 @@ public class ActiveMQMessage implements javax.jms.Message { try { return message.getLongProperty(new SimpleString(name)); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } } @@ -558,8 +542,7 @@ public class ActiveMQMessage implements javax.jms.Message { public float getFloatProperty(final String name) throws JMSException { try { return message.getFloatProperty(new SimpleString(name)); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } } @@ -568,8 +551,7 @@ public class ActiveMQMessage implements javax.jms.Message { public double getDoubleProperty(final String name) throws JMSException { try { return message.getDoubleProperty(new SimpleString(name)); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } } @@ -583,15 +565,12 @@ public class ActiveMQMessage implements javax.jms.Message { try { if (MessageUtil.JMSXGROUPID.equals(name)) { return message.getStringProperty(org.apache.activemq.artemis.api.core.Message.HDR_GROUP_ID); - } - else if (MessageUtil.JMSXUSERID.equals(name)) { + } else if (MessageUtil.JMSXUSERID.equals(name)) { return message.getStringProperty(org.apache.activemq.artemis.api.core.Message.HDR_VALIDATED_USER); - } - else { + } else { return message.getStringProperty(new SimpleString(name)); } - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } } @@ -663,11 +642,9 @@ public class ActiveMQMessage implements javax.jms.Message { if (handleCoreProperty(name, value, MessageUtil.JMSXGROUPID, org.apache.activemq.artemis.api.core.Message.HDR_GROUP_ID)) { return; - } - else if (handleCoreProperty(name, value, MessageUtil.JMSXUSERID, org.apache.activemq.artemis.api.core.Message.HDR_VALIDATED_USER)) { + } else if (handleCoreProperty(name, value, MessageUtil.JMSXUSERID, org.apache.activemq.artemis.api.core.Message.HDR_VALIDATED_USER)) { return; - } - else { + } else { message.putStringProperty(new SimpleString(name), SimpleString.toSimpleString(value)); } } @@ -686,8 +663,7 @@ public class ActiveMQMessage implements javax.jms.Message { setOutputStream((OutputStream) value); return; - } - else if (ActiveMQJMSConstants.JMS_ACTIVEMQ_SAVE_STREAM.equals(name)) { + } else if (ActiveMQJMSConstants.JMS_ACTIVEMQ_SAVE_STREAM.equals(name)) { saveToOutputStream((OutputStream) value); return; @@ -703,8 +679,7 @@ public class ActiveMQMessage implements javax.jms.Message { try { message.putObjectProperty(new SimpleString(name), value); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } } @@ -718,8 +693,7 @@ public class ActiveMQMessage implements javax.jms.Message { } session.commit(); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -730,15 +704,13 @@ public class ActiveMQMessage implements javax.jms.Message { Long value; try { value = message.getLongProperty(org.apache.activemq.artemis.api.core.Message.HDR_SCHEDULED_DELIVERY_TIME); - } - catch (Exception e) { + } catch (Exception e) { return 0; } if (value == null) { return 0; - } - else { + } else { return value.longValue(); } } @@ -763,8 +735,7 @@ public class ActiveMQMessage implements javax.jms.Message { try { ObjectInputStream ois = new ObjectInputStream(is); return (T) ois.readObject(); - } - catch (Exception e) { + } catch (Exception e) { throw new MessageFormatException(e.getMessage()); } } @@ -842,8 +813,7 @@ public class ActiveMQMessage implements javax.jms.Message { try { message.setOutputStream(output); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -856,8 +826,7 @@ public class ActiveMQMessage implements javax.jms.Message { try { message.saveToOutputStream(output); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -866,8 +835,7 @@ public class ActiveMQMessage implements javax.jms.Message { checkStream(); try { return message.waitOutputStreamCompletion(timeWait); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -913,8 +881,7 @@ public class ActiveMQMessage implements javax.jms.Message { " or " + ActiveMQJMSConstants.JMS_ACTIVEMQ_SAVE_STREAM + "?"); - } - else { + } else { throw ActiveMQJMSClientBundle.BUNDLE.messageNotWritable(); } } @@ -966,7 +933,10 @@ public class ActiveMQMessage implements javax.jms.Message { } } - private boolean handleCoreProperty(final String name, final Object value, String jmsPropertyName, SimpleString corePropertyName) { + private boolean handleCoreProperty(final String name, + final Object value, + String jmsPropertyName, + SimpleString corePropertyName) { boolean result = false; if (jmsPropertyName.equals(name)) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageConsumer.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageConsumer.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageConsumer.java index 5fbf448..8bc1fd8 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageConsumer.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageConsumer.java @@ -117,8 +117,7 @@ public final class ActiveMQMessageConsumer implements QueueReceiver, TopicSubscr try { consumer.setMessageHandler(coreListener); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -149,8 +148,7 @@ public final class ActiveMQMessageConsumer implements QueueReceiver, TopicSubscr } session.removeConsumer(this); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -209,8 +207,7 @@ public final class ActiveMQMessageConsumer implements QueueReceiver, TopicSubscr if (noWait) { coreMessage = consumer.receiveImmediate(); - } - else { + } else { coreMessage = consumer.receive(timeout); } @@ -219,15 +216,14 @@ public final class ActiveMQMessageConsumer implements QueueReceiver, TopicSubscr if (coreMessage != null) { ClientSession coreSession = session.getCoreSession(); boolean needSession = ackMode == Session.CLIENT_ACKNOWLEDGE || - ackMode == ActiveMQJMSConstants.INDIVIDUAL_ACKNOWLEDGE || - coreMessage.getType() == ActiveMQObjectMessage.TYPE; + ackMode == ActiveMQJMSConstants.INDIVIDUAL_ACKNOWLEDGE || + coreMessage.getType() == ActiveMQObjectMessage.TYPE; jmsMsg = ActiveMQMessage.createMessage(coreMessage, needSession ? coreSession : null, options); try { jmsMsg.doBeforeReceive(); - } - catch (IndexOutOfBoundsException ioob) { - ((ClientSessionInternal)session.getCoreSession()).markRollbackOnly(); + } catch (IndexOutOfBoundsException ioob) { + ((ClientSessionInternal) session.getCoreSession()).markRollbackOnly(); // In case this exception happen you will need to know where it happened. // it has been a bug here in the past, and this was used to debug it. // nothing better than keep it for future investigations in case it happened again @@ -241,20 +237,17 @@ public final class ActiveMQMessageConsumer implements QueueReceiver, TopicSubscr // https://issues.jboss.org/browse/JBPAPP-6110 if (session.getAcknowledgeMode() == ActiveMQJMSConstants.INDIVIDUAL_ACKNOWLEDGE) { jmsMsg.setIndividualAcknowledge(); - } - else { + } else { coreMessage.acknowledge(); } } return jmsMsg; - } - catch (ActiveMQException e) { - ((ClientSessionInternal)session.getCoreSession()).markRollbackOnly(); + } catch (ActiveMQException e) { + ((ClientSessionInternal) session.getCoreSession()).markRollbackOnly(); throw JMSExceptionHelper.convertFromActiveMQException(e); - } - catch (ActiveMQInterruptedException e) { - ((ClientSessionInternal)session.getCoreSession()).markRollbackOnly(); + } catch (ActiveMQInterruptedException e) { + ((ClientSessionInternal) session.getCoreSession()).markRollbackOnly(); throw JMSExceptionHelper.convertFromActiveMQException(e); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java index 8a47e8c..270cc9f 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java @@ -178,8 +178,7 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To connection.getThreadAwareContext().assertNotCompletionListenerThread(); try { clientProducer.close(); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -373,15 +372,13 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To if (timeToLive == 0) { jmsMessage.setJMSExpiration(0); - } - else { + } else { jmsMessage.setJMSExpiration(System.currentTimeMillis() + timeToLive); } if (!disableMessageTimestamp) { jmsMessage.setJMSTimestamp(System.currentTimeMillis()); - } - else { + } else { jmsMessage.setJMSTimestamp(0); } @@ -393,8 +390,7 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To } destination = defaultDestination; - } - else { + } else { if (defaultDestination != null) { if (!destination.equals(defaultDestination)) { throw new UnsupportedOperationException("Where a default destination is specified " + "for the sender and a destination is " + "specified in the arguments to the send, " + "these destinations must be equal"); @@ -411,12 +407,10 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To // as that's a more efficient path for such operation if (!query.isExists() && ((address.toString().startsWith(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX) && !query.isAutoCreateJmsQueues()) || (address.toString().startsWith(ActiveMQDestination.JMS_TOPIC_ADDRESS_PREFIX) && !query.isAutoCreateJmsTopics()))) { throw new InvalidDestinationException("Destination " + address + " does not exist"); - } - else { + } else { connection.addKnownDestination(address); } - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -433,20 +427,15 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To if (jmsMessage instanceof BytesMessage) { activeMQJmsMessage = new ActiveMQBytesMessage((BytesMessage) jmsMessage, clientSession); - } - else if (jmsMessage instanceof MapMessage) { + } else if (jmsMessage instanceof MapMessage) { activeMQJmsMessage = new ActiveMQMapMessage((MapMessage) jmsMessage, clientSession); - } - else if (jmsMessage instanceof ObjectMessage) { + } else if (jmsMessage instanceof ObjectMessage) { activeMQJmsMessage = new ActiveMQObjectMessage((ObjectMessage) jmsMessage, clientSession, options); - } - else if (jmsMessage instanceof StreamMessage) { + } else if (jmsMessage instanceof StreamMessage) { activeMQJmsMessage = new ActiveMQStreamMessage((StreamMessage) jmsMessage, clientSession); - } - else if (jmsMessage instanceof TextMessage) { + } else if (jmsMessage instanceof TextMessage) { activeMQJmsMessage = new ActiveMQTextMessage((TextMessage) jmsMessage, clientSession); - } - else { + } else { activeMQJmsMessage = new ActiveMQMessage(jmsMessage, clientSession); } @@ -454,8 +443,7 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To jmsMessage.setJMSDestination(destination); foreign = true; - } - else { + } else { activeMQJmsMessage = (ActiveMQMessage) jmsMessage; } @@ -477,8 +465,7 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To try { activeMQJmsMessage.doBeforeSend(); - } - catch (Exception e) { + } catch (Exception e) { JMSException je = new JMSException(e.getMessage()); je.initCause(e); @@ -500,20 +487,16 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To */ if (completionListener != null) { clientProducer.send(address, coreMessage, new CompletionListenerWrapper(completionListener, jmsMessage, this)); - } - else { + } else { clientProducer.send(address, coreMessage); } - } - catch (ActiveMQInterruptedException e) { + } catch (ActiveMQInterruptedException e) { JMSException jmsException = new JMSException(e.getMessage()); jmsException.initCause(e); throw jmsException; - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); - } - catch (java.lang.IllegalStateException e) { + } catch (java.lang.IllegalStateException e) { JMSException je = new IllegalStateException(e.getMessage()); je.setStackTrace(e.getStackTrace()); je.initCause(e); @@ -550,16 +533,14 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To if (jmsMessage instanceof StreamMessage) { try { ((StreamMessage) jmsMessage).reset(); - } - catch (JMSException e) { + } catch (JMSException e) { // HORNETQ-1209 XXX ignore? } } if (jmsMessage instanceof BytesMessage) { try { ((BytesMessage) jmsMessage).reset(); - } - catch (JMSException e) { + } catch (JMSException e) { // HORNETQ-1209 XXX ignore? } } @@ -567,8 +548,7 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To try { producer.connection.getThreadAwareContext().setCurrentThread(true); completionListener.onCompletion(jmsMessage); - } - finally { + } finally { producer.connection.getThreadAwareContext().clearCurrentThread(true); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQObjectMessage.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQObjectMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQObjectMessage.java index a149dbd..173f29d 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQObjectMessage.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQObjectMessage.java @@ -58,7 +58,9 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess this.options = options; } - protected ActiveMQObjectMessage(final ClientMessage message, final ClientSession session, ConnectionFactoryOptions options) { + protected ActiveMQObjectMessage(final ClientMessage message, + final ClientSession session, + ConnectionFactoryOptions options) { super(message, session); this.options = options; } @@ -66,7 +68,9 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess /** * A copy constructor for foreign JMS ObjectMessages. */ - public ActiveMQObjectMessage(final ObjectMessage foreign, final ClientSession session, ConnectionFactoryOptions options) throws JMSException { + public ActiveMQObjectMessage(final ObjectMessage foreign, + final ClientSession session, + ConnectionFactoryOptions options) throws JMSException { super(foreign, ActiveMQObjectMessage.TYPE, session); setObject(foreign.getObject()); @@ -98,8 +102,7 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess int len = message.getBodyBuffer().readInt(); data = new byte[len]; message.getBodyBuffer().readBytes(data); - } - catch (Exception e) { + } catch (Exception e) { data = null; } @@ -122,8 +125,7 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess oos.flush(); data = baos.toByteArray(); - } - catch (Exception e) { + } catch (Exception e) { JMSException je = new JMSException("Failed to serialize object"); je.setLinkedException(e); je.initCause(e); @@ -150,8 +152,7 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess } Serializable object = (Serializable) ois.readObject(); return object; - } - catch (Exception e) { + } catch (Exception e) { JMSException je = new JMSException(e.getMessage()); je.setStackTrace(e.getStackTrace()); throw je; @@ -169,8 +170,7 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess protected <T> T getBodyInternal(Class<T> c) throws MessageFormatException { try { return (T) getObject(); - } - catch (JMSException e) { + } catch (JMSException e) { throw new MessageFormatException("Deserialization error on ActiveMQObjectMessage"); } } @@ -181,8 +181,7 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess return true; try { return Serializable.class == c || Object.class == c || c.isInstance(getObject()); - } - catch (JMSException e) { + } catch (JMSException e) { return false; } } @@ -190,8 +189,7 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess private String getDeserializationBlackList() { if (options == null) { return null; - } - else { + } else { return options.getDeserializationBlackList(); } } @@ -199,8 +197,7 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess private String getDeserializationWhiteList() { if (options == null) { return null; - } - else { + } else { return options.getDeserializationWhiteList(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueueBrowser.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueueBrowser.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueueBrowser.java index adb2219..bb58f3d 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueueBrowser.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueueBrowser.java @@ -16,12 +16,11 @@ */ package org.apache.activemq.artemis.jms.client; -import java.util.Enumeration; -import java.util.NoSuchElementException; - import javax.jms.JMSException; import javax.jms.Queue; import javax.jms.QueueBrowser; +import java.util.Enumeration; +import java.util.NoSuchElementException; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.SimpleString; @@ -71,8 +70,7 @@ public final class ActiveMQQueueBrowser implements QueueBrowser { if (consumer != null) { try { consumer.close(); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -86,8 +84,7 @@ public final class ActiveMQQueueBrowser implements QueueBrowser { consumer = session.createConsumer(queue.getSimpleAddress(), filterString, true); return new BrowserEnumeration(); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } @@ -127,8 +124,7 @@ public final class ActiveMQQueueBrowser implements QueueBrowser { if (current == null) { try { current = consumer.receiveImmediate(); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { return false; } } @@ -144,15 +140,13 @@ public final class ActiveMQQueueBrowser implements QueueBrowser { msg = ActiveMQMessage.createMessage(next, session, options); try { msg.doBeforeReceive(); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQJMSClientLogger.LOGGER.errorCreatingMessage(msg.getCoreMessage().toString(), e); return null; } return msg; - } - else { + } else { throw new NoSuchElementException(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java index 3ba2945..47d1512 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java @@ -16,11 +16,6 @@ */ package org.apache.activemq.artemis.jms.client; -import java.io.Serializable; -import java.util.HashSet; -import java.util.Set; -import java.util.UUID; - import javax.jms.BytesMessage; import javax.jms.Destination; import javax.jms.IllegalStateException; @@ -48,17 +43,21 @@ import javax.jms.TopicSession; import javax.jms.TopicSubscriber; import javax.jms.TransactionInProgressException; import javax.transaction.xa.XAResource; +import java.io.Serializable; +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException; -import org.apache.activemq.artemis.selector.filter.FilterException; -import org.apache.activemq.artemis.selector.impl.SelectorParser; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientProducer; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSession.AddressQuery; import org.apache.activemq.artemis.api.core.client.ClientSession.QueueQuery; +import org.apache.activemq.artemis.selector.filter.FilterException; +import org.apache.activemq.artemis.selector.impl.SelectorParser; import org.apache.activemq.artemis.utils.SelectorTranslator; /** @@ -217,8 +216,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { } try { session.commit(); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -234,8 +232,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { try { session.rollback(); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -253,8 +250,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { session.close(); connection.removeSession(this); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -268,8 +264,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { try { session.rollback(true); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } @@ -314,8 +309,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { ClientProducer producer = session.createProducer(jbd == null ? null : jbd.getSimpleAddress()); return new ActiveMQMessageProducer(connection, producer, jbd, session, options); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -369,12 +363,10 @@ public class ActiveMQSession implements QueueSession, TopicSession { if (queue == null) { throw new JMSException("There is no queue with name " + queueName); - } - else { + } else { return queue; } - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -395,12 +387,10 @@ public class ActiveMQSession implements QueueSession, TopicSession { if (topic == null) { throw new JMSException("There is no topic with name " + topicName); - } - else { + } else { return topic; } - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -470,8 +460,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { ActiveMQTopic localTopic; if (topic instanceof ActiveMQTopic) { localTopic = (ActiveMQTopic) topic; - } - else { + } else { localTopic = new ActiveMQTopic(topic.getTopicName()); } return internalCreateSharedConsumer(localTopic, name, messageSelector, ConsumerDurability.NON_DURABLE); @@ -494,8 +483,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { ActiveMQTopic localTopic; if (topic instanceof ActiveMQTopic) { localTopic = (ActiveMQTopic) topic; - } - else { + } else { localTopic = new ActiveMQTopic(topic.getTopicName()); } return createConsumer(localTopic, name, messageSelector, noLocal, ConsumerDurability.DURABLE); @@ -520,8 +508,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { if (topic instanceof ActiveMQTopic) { localTopic = (ActiveMQTopic) topic; - } - else { + } else { localTopic = new ActiveMQTopic(topic.getTopicName()); } return internalCreateSharedConsumer(localTopic, name, messageSelector, ConsumerDurability.DURABLE); @@ -587,14 +574,12 @@ public class ActiveMQSession implements QueueSession, TopicSession { if (durability == ConsumerDurability.DURABLE) { try { session.createSharedQueue(dest.getSimpleAddress(), queueName, coreFilterString, true); - } - catch (ActiveMQQueueExistsException ignored) { + } catch (ActiveMQQueueExistsException ignored) { // We ignore this because querying and then creating the queue wouldn't be idempotent // we could also add a parameter to ignore existence what would require a bigger work around to avoid // compatibility. } - } - else { + } else { session.createSharedQueue(dest.getSimpleAddress(), queueName, coreFilterString, false); } @@ -605,8 +590,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { consumers.add(jbc); return jbc; - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -626,15 +610,13 @@ public class ActiveMQSession implements QueueSession, TopicSession { if (connection.getClientID() != null) { filter = ActiveMQConnection.CONNECTION_ID_PROPERTY_NAME.toString() + "<>'" + connection.getClientID() + "'"; - } - else { + } else { filter = ActiveMQConnection.CONNECTION_ID_PROPERTY_NAME.toString() + "<>'" + connection.getUID() + "'"; } if (selectorString != null) { selectorString += " AND " + filter; - } - else { + } else { selectorString = filter; } } @@ -659,8 +641,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { if (!response.isExists() || !response.getQueueNames().contains(dest.getSimpleAddress())) { if (response.isAutoCreateJmsQueues()) { session.createQueue(dest.getSimpleAddress(), dest.getSimpleAddress(), true); - } - else { + } else { throw new InvalidDestinationException("Destination " + dest.getName() + " does not exist"); } } @@ -668,8 +649,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { connection.addKnownDestination(dest.getSimpleAddress()); consumer = session.createConsumer(dest.getSimpleAddress(), coreFilterString, false); - } - else { + } else { AddressQuery response = session.addressQuery(dest.getSimpleAddress()); if (!response.isExists() && !response.isAutoCreateJmsTopics()) { @@ -692,8 +672,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { consumer = session.createConsumer(queueName, null, false); autoDeleteQueueName = queueName; - } - else { + } else { // Durable sub if (durability != ConsumerDurability.DURABLE) throw new RuntimeException("Subscription name must be null for non-durable topic consumer"); @@ -711,8 +690,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { if (!subResponse.isExists()) { session.createQueue(dest.getSimpleAddress(), queueName, coreFilterString, true); - } - else { + } else { // Already exists if (subResponse.getConsumerCount() > 0) { throw new IllegalStateException("Cannot create a subscriber on the durable subscription since it already has subscriber(s)"); @@ -757,8 +735,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { consumers.add(jbc); return jbc; - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -793,8 +770,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { if (filterString != null) { SelectorParser.parse(filterString.trim()); } - } - catch (FilterException e) { + } catch (FilterException e) { throw JMSExceptionHelper.convertFromActiveMQException(ActiveMQJMSClientBundle.BUNDLE.invalidFilter(e, new SimpleString(filterString))); } @@ -809,13 +785,11 @@ public class ActiveMQSession implements QueueSession, TopicSession { if (!response.isExists()) { if (response.isAutoCreateJmsQueues()) { session.createQueue(jbq.getSimpleAddress(), jbq.getSimpleAddress(), true); - } - else { + } else { throw new InvalidDestinationException("Destination " + jbq.getName() + " does not exist"); } } - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } @@ -840,8 +814,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { connection.addTemporaryQueue(simpleAddress); return queue; - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -868,8 +841,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { connection.addTemporaryQueue(simpleAddress); return topic; - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -897,8 +869,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { } session.deleteQueue(queueName); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -1007,8 +978,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { session.deleteQueue(address); connection.removeTemporaryQueue(address); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -1035,8 +1005,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { session.deleteQueue(address); connection.removeTemporaryQueue(address); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -1044,8 +1013,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { public void start() throws JMSException { try { session.start(); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -1053,8 +1021,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { public void stop() throws JMSException { try { session.stop(); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } } @@ -1069,8 +1036,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { if (!session.isClosed()) { try { session.deleteQueue(queueName); - } - catch (ActiveMQException ignore) { + } catch (ActiveMQException ignore) { // Exception on deleting queue shouldn't prevent close from completing } } @@ -1091,8 +1057,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { if (isTemporary) { queue = ActiveMQDestination.createTemporaryQueue(queueName); - } - else { + } else { queue = ActiveMQDestination.createQueue(queueName); } @@ -1100,8 +1065,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { if (!response.isExists() && !response.isAutoCreateJmsQueues()) { return null; - } - else { + } else { return queue; } } @@ -1112,8 +1076,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { if (isTemporary) { topic = ActiveMQDestination.createTemporaryTopic(topicName); - } - else { + } else { topic = ActiveMQDestination.createTopic(topicName); } @@ -1121,8 +1084,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { if (!query.isExists() && !query.isAutoCreateJmsTopics()) { return null; - } - else { + } else { return topic; } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQStreamMessage.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQStreamMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQStreamMessage.java index 1c7772c..2762a9c 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQStreamMessage.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQStreamMessage.java @@ -66,8 +66,7 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre Object obj = foreign.readObject(); writeObject(obj); } - } - catch (MessageEOFException e) { + } catch (MessageEOFException e) { // Ignore } } @@ -91,11 +90,9 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre checkRead(); try { return streamReadBoolean(message.getBodyBuffer()); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { throw new MessageFormatException(e.getMessage()); - } - catch (IndexOutOfBoundsException e) { + } catch (IndexOutOfBoundsException e) { throw new MessageEOFException(""); } } @@ -106,11 +103,9 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre try { return streamReadByte(message.getBodyBuffer()); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { throw new MessageFormatException(e.getMessage()); - } - catch (IndexOutOfBoundsException e) { + } catch (IndexOutOfBoundsException e) { throw new MessageEOFException(""); } } @@ -120,11 +115,9 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre checkRead(); try { return streamReadShort(message.getBodyBuffer()); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { throw new MessageFormatException(e.getMessage()); - } - catch (IndexOutOfBoundsException e) { + } catch (IndexOutOfBoundsException e) { throw new MessageEOFException(""); } } @@ -134,11 +127,9 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre checkRead(); try { return streamReadChar(message.getBodyBuffer()); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { throw new MessageFormatException(e.getMessage()); - } - catch (IndexOutOfBoundsException e) { + } catch (IndexOutOfBoundsException e) { throw new MessageEOFException(""); } } @@ -148,11 +139,9 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre checkRead(); try { return streamReadInteger(message.getBodyBuffer()); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { throw new MessageFormatException(e.getMessage()); - } - catch (IndexOutOfBoundsException e) { + } catch (IndexOutOfBoundsException e) { throw new MessageEOFException(""); } } @@ -162,11 +151,9 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre checkRead(); try { return streamReadLong(message.getBodyBuffer()); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { throw new MessageFormatException(e.getMessage()); - } - catch (IndexOutOfBoundsException e) { + } catch (IndexOutOfBoundsException e) { throw new MessageEOFException(""); } } @@ -176,11 +163,9 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre checkRead(); try { return streamReadFloat(message.getBodyBuffer()); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { throw new MessageFormatException(e.getMessage()); - } - catch (IndexOutOfBoundsException e) { + } catch (IndexOutOfBoundsException e) { throw new MessageEOFException(""); } } @@ -190,11 +175,9 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre checkRead(); try { return streamReadDouble(message.getBodyBuffer()); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { throw new MessageFormatException(e.getMessage()); - } - catch (IndexOutOfBoundsException e) { + } catch (IndexOutOfBoundsException e) { throw new MessageEOFException(""); } } @@ -204,11 +187,9 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre checkRead(); try { return streamReadString(message.getBodyBuffer()); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { throw new MessageFormatException(e.getMessage()); - } - catch (IndexOutOfBoundsException e) { + } catch (IndexOutOfBoundsException e) { throw new MessageEOFException(""); } } @@ -226,11 +207,9 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre len = pairRead.getA(); return pairRead.getB(); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { throw new MessageFormatException(e.getMessage()); - } - catch (IndexOutOfBoundsException e) { + } catch (IndexOutOfBoundsException e) { throw new MessageEOFException(""); } } @@ -240,11 +219,9 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre checkRead(); try { return streamReadObject(message.getBodyBuffer()); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { throw new MessageFormatException(e.getMessage()); - } - catch (IndexOutOfBoundsException e) { + } catch (IndexOutOfBoundsException e) { throw new MessageEOFException(""); } } @@ -332,38 +309,27 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre public void writeObject(final Object value) throws JMSException { if (value instanceof String) { writeString((String) value); - } - else if (value instanceof Boolean) { + } else if (value instanceof Boolean) { writeBoolean((Boolean) value); - } - else if (value instanceof Byte) { + } else if (value instanceof Byte) { writeByte((Byte) value); - } - else if (value instanceof Short) { + } else if (value instanceof Short) { writeShort((Short) value); - } - else if (value instanceof Integer) { + } else if (value instanceof Integer) { writeInt((Integer) value); - } - else if (value instanceof Long) { + } else if (value instanceof Long) { writeLong((Long) value); - } - else if (value instanceof Float) { + } else if (value instanceof Float) { writeFloat((Float) value); - } - else if (value instanceof Double) { + } else if (value instanceof Double) { writeDouble((Double) value); - } - else if (value instanceof byte[]) { + } else if (value instanceof byte[]) { writeBytes((byte[]) value); - } - else if (value instanceof Character) { + } else if (value instanceof Character) { writeChar((Character) value); - } - else if (value == null) { + } else if (value == null) { writeString(null); - } - else { + } else { throw new MessageFormatException("Invalid object type: " + value.getClass()); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTextMessage.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTextMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTextMessage.java index bb28604..1406b4c 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTextMessage.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTextMessage.java @@ -80,8 +80,7 @@ public class ActiveMQTextMessage extends ActiveMQMessage implements TextMessage if (text != null) { this.text = new SimpleString(text); - } - else { + } else { this.text = null; } @@ -92,8 +91,7 @@ public class ActiveMQTextMessage extends ActiveMQMessage implements TextMessage public String getText() { if (text != null) { return text.toString(); - } - else { + } else { return null; } } @@ -126,4 +124,4 @@ public class ActiveMQTextMessage extends ActiveMQMessage implements TextMessage return true; return c.isAssignableFrom(java.lang.String.class); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ConnectionFactoryOptions.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ConnectionFactoryOptions.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ConnectionFactoryOptions.java index 2f27b15..bf95c0f 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ConnectionFactoryOptions.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ConnectionFactoryOptions.java @@ -17,9 +17,10 @@ package org.apache.activemq.artemis.jms.client; - -/** Common interface to be used to share common parameters between the RA and client JMS. - * Initially developed to carry on Serialization packages white list but it could eventually be expanded. */ +/** + * Common interface to be used to share common parameters between the RA and client JMS. + * Initially developed to carry on Serialization packages white list but it could eventually be expanded. + */ public interface ConnectionFactoryOptions { String getDeserializationBlackList(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/JMSMessageListenerWrapper.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/JMSMessageListenerWrapper.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/JMSMessageListenerWrapper.java index 91ea34f..92ae226 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/JMSMessageListenerWrapper.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/JMSMessageListenerWrapper.java @@ -76,8 +76,7 @@ public class JMSMessageListenerWrapper implements MessageHandler { try { msg.doBeforeReceive(); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQJMSClientLogger.LOGGER.errorPreparingMessageForReceipt(msg.getCoreMessage().toString(), e); return; @@ -86,9 +85,8 @@ public class JMSMessageListenerWrapper implements MessageHandler { if (transactedOrClientAck) { try { message.acknowledge(); - } - catch (ActiveMQException e) { - ((ClientSessionInternal)session.getCoreSession()).markRollbackOnly(); + } catch (ActiveMQException e) { + ((ClientSessionInternal) session.getCoreSession()).markRollbackOnly(); ActiveMQJMSClientLogger.LOGGER.errorProcessingMessage(e); } } @@ -96,8 +94,7 @@ public class JMSMessageListenerWrapper implements MessageHandler { try { connection.getThreadAwareContext().setCurrentThread(false); listener.onMessage(msg); - } - catch (RuntimeException e) { + } catch (RuntimeException e) { // See JMS 1.1 spec, section 4.5.2 ActiveMQJMSClientLogger.LOGGER.onMessageError(e); @@ -111,13 +108,11 @@ public class JMSMessageListenerWrapper implements MessageHandler { session.getCoreSession().rollback(true); session.setRecoverCalled(true); - } - catch (Exception e2) { + } catch (Exception e2) { ActiveMQJMSClientLogger.LOGGER.errorRecoveringSession(e2); } } - } - finally { + } finally { connection.getThreadAwareContext().clearCurrentThread(false); } if (!session.isRecoverCalled() && !individualACK) { @@ -126,9 +121,8 @@ public class JMSMessageListenerWrapper implements MessageHandler { if (!consumer.isClosed() && !transactedOrClientAck) { message.acknowledge(); } - } - catch (ActiveMQException e) { - ((ClientSessionInternal)session.getCoreSession()).markRollbackOnly(); + } catch (ActiveMQException e) { + ((ClientSessionInternal) session.getCoreSession()).markRollbackOnly(); ActiveMQJMSClientLogger.LOGGER.errorProcessingMessage(e); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ThreadAwareContext.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ThreadAwareContext.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ThreadAwareContext.java index 7bdf35c..c74264f 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ThreadAwareContext.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ThreadAwareContext.java @@ -16,11 +16,11 @@ */ package org.apache.activemq.artemis.jms.client; -import org.apache.activemq.artemis.utils.ConcurrentHashSet; - import javax.jms.IllegalStateException; import java.util.Set; +import org.apache.activemq.artemis.utils.ConcurrentHashSet; + /** * Restricts what can be called on context passed in wrapped CompletionListener. */ @@ -53,8 +53,7 @@ public class ThreadAwareContext { public void setCurrentThread(boolean isCompletionListener) { if (isCompletionListener) { completionListenerThread = Thread.currentThread(); - } - else { + } else { messageListenerThreads.add(Thread.currentThread().getId()); } } @@ -68,8 +67,7 @@ public class ThreadAwareContext { public void clearCurrentThread(boolean isCompletionListener) { if (isCompletionListener) { completionListenerThread = null; - } - else { + } else { messageListenerThreads.remove(Thread.currentThread().getId()); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/referenceable/ConnectionFactoryObjectFactory.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/referenceable/ConnectionFactoryObjectFactory.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/referenceable/ConnectionFactoryObjectFactory.java index 3443bf1..ad125f0 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/referenceable/ConnectionFactoryObjectFactory.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/referenceable/ConnectionFactoryObjectFactory.java @@ -16,12 +16,11 @@ */ package org.apache.activemq.artemis.jms.referenceable; -import java.util.Hashtable; - import javax.naming.Context; import javax.naming.Name; import javax.naming.Reference; import javax.naming.spi.ObjectFactory; +import java.util.Hashtable; /** * A ConnectionFactoryObjectFactory. http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/referenceable/DestinationObjectFactory.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/referenceable/DestinationObjectFactory.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/referenceable/DestinationObjectFactory.java index a2c8333..896e815 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/referenceable/DestinationObjectFactory.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/referenceable/DestinationObjectFactory.java @@ -16,12 +16,11 @@ */ package org.apache.activemq.artemis.jms.referenceable; -import java.util.Hashtable; - import javax.naming.Context; import javax.naming.Name; import javax.naming.Reference; import javax.naming.spi.ObjectFactory; +import java.util.Hashtable; /** * A DestinationObjectFactory. http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/referenceable/SerializableObjectRefAddr.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/referenceable/SerializableObjectRefAddr.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/referenceable/SerializableObjectRefAddr.java index a6e227f..09c971d 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/referenceable/SerializableObjectRefAddr.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/referenceable/SerializableObjectRefAddr.java @@ -16,15 +16,14 @@ */ package org.apache.activemq.artemis.jms.referenceable; +import javax.naming.NamingException; +import javax.naming.RefAddr; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; -import javax.naming.NamingException; -import javax.naming.RefAddr; - /** * A SerializableObjectRefAddr. * @@ -52,8 +51,7 @@ public class SerializableObjectRefAddr extends RefAddr { oos.flush(); bytes = bos.toByteArray(); - } - catch (IOException e) { + } catch (IOException e) { throw new NamingException("Failed to serialize object:" + content + ", " + e.getMessage()); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ActiveMQInitialContextFactory.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ActiveMQInitialContextFactory.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ActiveMQInitialContextFactory.java index 8b5a431..26641e9 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ActiveMQInitialContextFactory.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ActiveMQInitialContextFactory.java @@ -57,8 +57,7 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory { try { ConnectionFactory factory = createConnectionFactory((String) environment.get(key), jndiName); data.put(jndiName, factory); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); throw new NamingException("Invalid broker URL"); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/LazyCreateContext.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/LazyCreateContext.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/LazyCreateContext.java index ff2c62c..52269d3 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/LazyCreateContext.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/LazyCreateContext.java @@ -25,8 +25,7 @@ public abstract class LazyCreateContext extends ReadOnlyContext { public Object lookup(String name) throws NamingException { try { return super.lookup(name); - } - catch (NameNotFoundException e) { + } catch (NameNotFoundException e) { Object answer = createEntry(name); if (answer == null) { throw e; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ReadOnlyContext.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ReadOnlyContext.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ReadOnlyContext.java index f3873ef..6ffeabd 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ReadOnlyContext.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ReadOnlyContext.java @@ -16,12 +16,6 @@ */ package org.apache.activemq.artemis.jndi; -import java.io.Serializable; -import java.util.Collections; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Map; import javax.naming.Binding; import javax.naming.CompositeName; import javax.naming.Context; @@ -36,6 +30,12 @@ import javax.naming.NotContextException; import javax.naming.OperationNotSupportedException; import javax.naming.Reference; import javax.naming.spi.NamingManager; +import java.io.Serializable; +import java.util.Collections; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; import org.apache.activemq.artemis.core.client.ActiveMQClientLogger; @@ -82,8 +82,7 @@ public class ReadOnlyContext implements Context, Serializable { public ReadOnlyContext(Hashtable env) { if (env == null) { this.environment = new Hashtable<>(); - } - else { + } else { this.environment = new Hashtable<>(env); } this.bindings = Collections.EMPTY_MAP; @@ -93,8 +92,7 @@ public class ReadOnlyContext implements Context, Serializable { public ReadOnlyContext(Hashtable environment, Map<String, Object> bindings) { if (environment == null) { this.environment = new Hashtable<>(); - } - else { + } else { this.environment = new Hashtable<>(environment); } this.bindings = new HashMap<>(); @@ -103,8 +101,7 @@ public class ReadOnlyContext implements Context, Serializable { for (Map.Entry<String, Object> binding : bindings.entrySet()) { try { internalBind(binding.getKey(), binding.getValue()); - } - catch (Throwable e) { + } catch (Throwable e) { ActiveMQClientLogger.LOGGER.error("Failed to bind " + binding.getKey() + "=" + binding.getValue(), e); } } @@ -163,8 +160,7 @@ public class ReadOnlyContext implements Context, Serializable { } bindings.put(name, value); newBindings.put(name, value); - } - else { + } else { String segment = name.substring(0, pos); assert segment != null; assert !segment.equals(""); @@ -174,8 +170,7 @@ public class ReadOnlyContext implements Context, Serializable { treeBindings.put(segment, o); bindings.put(segment, o); newBindings.put(segment, o); - } - else if (!(o instanceof ReadOnlyContext)) { + } else if (!(o instanceof ReadOnlyContext)) { throw new NamingException("Something already bound where a subcontext should go"); } ReadOnlyContext readOnlyContext = (ReadOnlyContext) o; @@ -228,22 +223,19 @@ public class ReadOnlyContext implements Context, Serializable { throw new NamingException("scheme " + scheme + " not recognized"); } return ctx.lookup(name); - } - else { + } else { // Split out the first name of the path // and look for it in the bindings map. CompositeName path = new CompositeName(name); if (path.size() == 0) { return this; - } - else { + } else { String first = path.get(0); Object obj = bindings.get(first); if (obj == null) { throw new NameNotFoundException(name); - } - else if (obj instanceof Context && path.size() > 1) { + } else if (obj instanceof Context && path.size() > 1) { Context subContext = (Context) obj; obj = subContext.lookup(path.getSuffix(1)); } @@ -258,11 +250,9 @@ public class ReadOnlyContext implements Context, Serializable { if (result instanceof Reference) { try { result = NamingManager.getObjectInstance(result, null, null, this.environment); - } - catch (NamingException e) { + } catch (NamingException e) { throw e; - } - catch (Exception e) { + } catch (Exception e) { throw (NamingException) new NamingException("could not look up : " + name).initCause(e); } } @@ -305,11 +295,9 @@ public class ReadOnlyContext implements Context, Serializable { Object o = lookup(name); if (o == this) { return new ListEnumeration(); - } - else if (o instanceof Context) { + } else if (o instanceof Context) { return ((Context) o).list(""); - } - else { + } else { throw new NotContextException(); } } @@ -319,11 +307,9 @@ public class ReadOnlyContext implements Context, Serializable { Object o = lookup(name); if (o == this) { return new ListBindingEnumeration(); - } - else if (o instanceof Context) { + } else if (o instanceof Context) { return ((Context) o).listBindings(""); - } - else { + } else { throw new NotContextException(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/InVMSchema.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/InVMSchema.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/InVMSchema.java index 18b0111..73e826a 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/InVMSchema.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/InVMSchema.java @@ -16,16 +16,16 @@ */ package org.apache.activemq.artemis.uri; +import java.net.URI; +import java.util.Map; + import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; -import org.apache.activemq.artemis.uri.schema.serverLocator.InVMServerLocatorSchema; import org.apache.activemq.artemis.uri.schema.connector.InVMTransportConfigurationSchema; +import org.apache.activemq.artemis.uri.schema.serverLocator.InVMServerLocatorSchema; import org.apache.activemq.artemis.utils.uri.BeanSupport; import org.apache.activemq.artemis.utils.uri.SchemaConstants; -import java.net.URI; -import java.util.Map; - public class InVMSchema extends AbstractCFSchema { @Override http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/JGroupsSchema.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/JGroupsSchema.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/JGroupsSchema.java index 1bc78c3..2d82018 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/JGroupsSchema.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/JGroupsSchema.java @@ -49,8 +49,7 @@ public class JGroupsSchema extends AbstractCFSchema { ActiveMQConnectionFactory factory; if (options.isHa()) { factory = ActiveMQJMSClient.createConnectionFactoryWithHA(dcConfig, options.getFactoryTypeEnum()); - } - else { + } else { factory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(dcConfig, options.getFactoryTypeEnum()); } return BeanSupport.setData(uri, factory, query); @@ -63,11 +62,9 @@ public class JGroupsSchema extends AbstractCFSchema { String auth; if (endpoint instanceof JGroupsFileBroadcastEndpointFactory) { auth = ((JGroupsFileBroadcastEndpointFactory) endpoint).getChannelName(); - } - else if (endpoint instanceof JGroupsPropertiesBroadcastEndpointFactory) { + } else if (endpoint instanceof JGroupsPropertiesBroadcastEndpointFactory) { auth = ((JGroupsPropertiesBroadcastEndpointFactory) endpoint).getChannelName(); - } - else { + } else { throw new NotSerializableException(endpoint + "not serializable"); } String query = BeanSupport.getData(null, bean, dgc, endpoint); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/JMSConnectionOptions.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/JMSConnectionOptions.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/JMSConnectionOptions.java index 92fb3b7..86ca984 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/JMSConnectionOptions.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/JMSConnectionOptions.java @@ -48,12 +48,10 @@ public class JMSConnectionOptions extends ConnectionOptions { try { if (type == null) { return JMSFactoryType.CF; - } - else { + } else { return Enum.valueOf(JMSFactoryType.class, type); } - } - catch (Exception e) { + } catch (Exception e) { return null; } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/TCPSchema.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/TCPSchema.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/TCPSchema.java index a350263..8ea3cfc 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/TCPSchema.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/TCPSchema.java @@ -16,20 +16,20 @@ */ package org.apache.activemq.artemis.uri; +import java.net.URI; +import java.util.List; +import java.util.Map; + import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory; import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; -import org.apache.activemq.artemis.uri.schema.serverLocator.TCPServerLocatorSchema; import org.apache.activemq.artemis.uri.schema.connector.TCPTransportConfigurationSchema; +import org.apache.activemq.artemis.uri.schema.serverLocator.TCPServerLocatorSchema; import org.apache.activemq.artemis.utils.uri.BeanSupport; import org.apache.activemq.artemis.utils.uri.SchemaConstants; -import java.net.URI; -import java.util.List; -import java.util.Map; - public class TCPSchema extends AbstractCFSchema { @Override @@ -53,8 +53,7 @@ public class TCPSchema extends AbstractCFSchema { if (options.isHa()) { factory = ActiveMQJMSClient.createConnectionFactoryWithHA(options.getFactoryTypeEnum(), tcs); - } - else { + } else { factory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(options.getFactoryTypeEnum(), tcs); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/UDPSchema.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/UDPSchema.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/UDPSchema.java index 4a1e87b..45f7ebf 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/UDPSchema.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/uri/UDPSchema.java @@ -46,8 +46,7 @@ public class UDPSchema extends AbstractCFSchema { ActiveMQConnectionFactory factory; if (options.isHa()) { factory = ActiveMQJMSClient.createConnectionFactoryWithHA(dgc, options.getFactoryTypeEnum()); - } - else { + } else { factory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(dgc, options.getFactoryTypeEnum()); } return BeanSupport.setData(uri, factory, query);
