camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [5/5] camel git commit: CAMEL-7949: Fixed CS
Date Sat, 29 Nov 2014 09:45:07 GMT
CAMEL-7949: Fixed CS


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6e845a53
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6e845a53
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6e845a53

Branch: refs/heads/master
Commit: 6e845a53704472fa5cd324f02d19ce06c00a3c52
Parents: 1dc631e
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sat Nov 29 10:41:33 2014 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sat Nov 29 10:41:33 2014 +0100

----------------------------------------------------------------------
 .../camel/component/sjms/SjmsConstants.java     |   2 +-
 .../sjms/SjmsExchangeMessageHelper.java         |   0
 .../sjms/consumer/InOutMessageHandler.java      |   2 +-
 .../camel/component/sjms/jms/JmsConstants.java  |  37 ++++---
 .../sjms/jms/JmsMessageHeaderType.java          |   0
 .../component/sjms/jms/JmsMessageHelper.java    | 106 +++++++++----------
 .../component/sjms/producer/InOnlyProducer.java |   2 +-
 .../component/sjms/producer/InOutProducer.java  |   4 +-
 .../JMSMessageHelperTypeConversionTest.java     |   2 +-
 9 files changed, 82 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6e845a53/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConstants.java
b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConstants.java
index b39e51e..f963cf3 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConstants.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConstants.java
@@ -18,6 +18,6 @@ package org.apache.camel.component.sjms;
 
 public interface SjmsConstants {
 
-    public static final String JMS_MESSAGE_TYPE = "JmsMessageType";
+    String JMS_MESSAGE_TYPE = "JmsMessageType";
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/6e845a53/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsExchangeMessageHelper.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsExchangeMessageHelper.java
b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsExchangeMessageHelper.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/camel/blob/6e845a53/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/InOutMessageHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/InOutMessageHandler.java
b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/InOutMessageHandler.java
index 25a0f1d..85b20a7 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/InOutMessageHandler.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/InOutMessageHandler.java
@@ -119,7 +119,7 @@ public class InOutMessageHandler extends AbstractMessageHandler {
 
     @Override
     public void close() {
-        for (final Map.Entry<String,MessageProducer> entry : producerCache.entrySet())
{
+        for (final Map.Entry<String, MessageProducer> entry : producerCache.entrySet())
{
             try {
                 entry.getValue().close();
             } catch (JMSException e) {

http://git-wip-us.apache.org/repos/asf/camel/blob/6e845a53/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsConstants.java
b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsConstants.java
index 725cc20..08e0339 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsConstants.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsConstants.java
@@ -24,54 +24,63 @@ public interface JmsConstants {
     /**
      * Set by the publishing Client
      */
-    public static final String JMS_CORRELATION_ID = "JMSCorrelationID";
+    String JMS_CORRELATION_ID = "JMSCorrelationID";
+
     /**
      * Set on the send or publish event
      */
-    public static final String JMS_DELIVERY_MODE = "JMSDeliveryMode";
+    String JMS_DELIVERY_MODE = "JMSDeliveryMode";
+
     /**
      * Set on the send or publish event
      */
-    public static final String JMS_DESTINATION = "JMSDestination";
+    String JMS_DESTINATION = "JMSDestination";
+
     /**
      * Set on the send or publish event
      */
-    public static final String JMS_EXPIRATION = "JMSExpiration";
+    String JMS_EXPIRATION = "JMSExpiration";
+
     /**
      * Set on the send or publish event
      */
-    public static final String JMS_MESSAGE_ID = "JMSMessageID";
+    String JMS_MESSAGE_ID = "JMSMessageID";
+
     /**
      * Set on the send or publish event
      */
-    public static final String JMS_PRIORITY = "JMSPriority";
+    String JMS_PRIORITY = "JMSPriority";
+
     /**
      * A redelivery flag set by the JMS provider
      */
-    public static final String JMS_REDELIVERED = "JMSRedelivered";
+    String JMS_REDELIVERED = "JMSRedelivered";
+
     /**
      * The JMS Reply To {@link javax.jms.Destination} set by the publishing Client
      */
-    public static final String JMS_REPLY_TO = "JMSReplyTo";
+    String JMS_REPLY_TO = "JMSReplyTo";
+
     /**
      * Set on the send or publish event
      */
-    public static final String JMS_TIMESTAMP = "JMSTimestamp";
+    String JMS_TIMESTAMP = "JMSTimestamp";
+
     /**
      * Set by the publishing Client
      */
-    public static final String JMS_TYPE = "JMSType";
+    String JMS_TYPE = "JMSType";
 
     /**
      * Custom headers
      */
-    public static final String JMSX_GROUP_ID = "JMSXGroupID";
-
+    String JMSX_GROUP_ID = "JMSXGroupID";
 
     /**
      * String representation of JMS delivery modes.
      */
-    public static final String JMS_DELIVERY_MODE_PERSISTENT = "PERSISTENT";
-    public static final String JMS_DELIVERY_MODE_NON_PERSISTENT = "NON_PERSISTENT";
+    String JMS_DELIVERY_MODE_PERSISTENT = "PERSISTENT";
+
+    String JMS_DELIVERY_MODE_NON_PERSISTENT = "NON_PERSISTENT";
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/6e845a53/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHeaderType.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHeaderType.java
b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHeaderType.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/camel/blob/6e845a53/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHelper.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHelper.java
b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHelper.java
index 5ca09b4..062d143 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHelper.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHelper.java
@@ -79,54 +79,54 @@ public final class JmsMessageHelper implements JmsConstants {
                     bodyMessage = (DefaultMessage) exchange.getIn();
                 }
                 switch (JmsMessageHelper.discoverJmsMessageType(message)) {
-                    case Bytes:
-                        BytesMessage bytesMessage = (BytesMessage) message;
-                        if (bytesMessage.getBodyLength() > Integer.MAX_VALUE) {
-                            LOGGER.warn("Length of BytesMessage is too long: {}", bytesMessage.getBodyLength());
-                            return null;
-                        }
-                        byte[] result = new byte[(int) bytesMessage.getBodyLength()];
-                        bytesMessage.readBytes(result);
-                        bodyMessage.setHeader(SjmsConstants.JMS_MESSAGE_TYPE, JmsMessageType.Bytes);
-                        bodyMessage.setBody(result);
-                        break;
-                    case Map:
-                        Map<String, Object> body = new HashMap<>();
-                        MapMessage mapMessage = (MapMessage) message;
-                        Enumeration<String> names = mapMessage.getMapNames();
-                        while (names.hasMoreElements()) {
-                            String key = names.nextElement();
-                            Object value = mapMessage.getObject(key);
-                            body.put(key, value);
-                        }
-                        bodyMessage.setHeader(SjmsConstants.JMS_MESSAGE_TYPE, JmsMessageType.Map);
-                        bodyMessage.setBody(body);
-                        break;
-                    case Object:
-                        ObjectMessage objMsg = (ObjectMessage) message;
-                        bodyMessage.setHeader(SjmsConstants.JMS_MESSAGE_TYPE, JmsMessageType.Object);
-                        bodyMessage.setBody(objMsg.getObject());
-                        break;
-                    case Text:
-                        TextMessage textMsg = (TextMessage) message;
-                        bodyMessage.setHeader(SjmsConstants.JMS_MESSAGE_TYPE, JmsMessageType.Text);
-                        bodyMessage.setBody(textMsg.getText());
-                        break;
-                    case Stream:
-                        StreamMessage streamMessage = (StreamMessage) message;
-                        List list = new ArrayList<>();
-                        Object obj;
-                        while ((obj = streamMessage.readObject()) != null) {
-                            list.add(obj);
-                        }
-                        bodyMessage.setHeader(SjmsConstants.JMS_MESSAGE_TYPE, JmsMessageType.Stream);
-                        bodyMessage.setBody(list);
-                        break;
-                    case Message:
-                    default:
-                        // Do nothing. Only set the headers for an empty message
-                        bodyMessage.setBody(message);
-                        break;
+                case Bytes:
+                    BytesMessage bytesMessage = (BytesMessage) message;
+                    if (bytesMessage.getBodyLength() > Integer.MAX_VALUE) {
+                        LOGGER.warn("Length of BytesMessage is too long: {}", bytesMessage.getBodyLength());
+                        return null;
+                    }
+                    byte[] result = new byte[(int) bytesMessage.getBodyLength()];
+                    bytesMessage.readBytes(result);
+                    bodyMessage.setHeader(SjmsConstants.JMS_MESSAGE_TYPE, JmsMessageType.Bytes);
+                    bodyMessage.setBody(result);
+                    break;
+                case Map:
+                    Map<String, Object> body = new HashMap<String, Object>();
+                    MapMessage mapMessage = (MapMessage) message;
+                    Enumeration<String> names = mapMessage.getMapNames();
+                    while (names.hasMoreElements()) {
+                        String key = names.nextElement();
+                        Object value = mapMessage.getObject(key);
+                        body.put(key, value);
+                    }
+                    bodyMessage.setHeader(SjmsConstants.JMS_MESSAGE_TYPE, JmsMessageType.Map);
+                    bodyMessage.setBody(body);
+                    break;
+                case Object:
+                    ObjectMessage objMsg = (ObjectMessage) message;
+                    bodyMessage.setHeader(SjmsConstants.JMS_MESSAGE_TYPE, JmsMessageType.Object);
+                    bodyMessage.setBody(objMsg.getObject());
+                    break;
+                case Text:
+                    TextMessage textMsg = (TextMessage) message;
+                    bodyMessage.setHeader(SjmsConstants.JMS_MESSAGE_TYPE, JmsMessageType.Text);
+                    bodyMessage.setBody(textMsg.getText());
+                    break;
+                case Stream:
+                    StreamMessage streamMessage = (StreamMessage) message;
+                    List<Object> list = new ArrayList<Object>();
+                    Object obj;
+                    while ((obj = streamMessage.readObject()) != null) {
+                        list.add(obj);
+                    }
+                    bodyMessage.setHeader(SjmsConstants.JMS_MESSAGE_TYPE, JmsMessageType.Stream);
+                    bodyMessage.setBody(list);
+                    break;
+                case Message:
+                default:
+                    // Do nothing. Only set the headers for an empty message
+                    bodyMessage.setBody(message);
+                    break;
                 }
             }
         } catch (Exception e) {
@@ -142,10 +142,10 @@ public final class JmsMessageHelper implements JmsConstants {
 
         if (exchange.getOut().getBody() != null) {
             body = exchange.getOut().getBody();
-            bodyHeaders = new HashMap<>(exchange.getOut().getHeaders());
+            bodyHeaders = new HashMap<String, Object>(exchange.getOut().getHeaders());
         } else {
             body = exchange.getIn().getBody();
-            bodyHeaders = new HashMap<>(exchange.getIn().getHeaders());
+            bodyHeaders = new HashMap<String, Object>(exchange.getIn().getHeaders());
         }
 
         answer = createMessage(session, body, bodyHeaders, endpoint);
@@ -220,8 +220,8 @@ public final class JmsMessageHelper implements JmsConstants {
      * @return {@link Message}
      */
     private static Message setJmsMessageHeaders(final Message jmsMessage, Map<String,
Object> messageHeaders, KeyFormatStrategy keyFormatStrategy) throws IllegalHeaderException
{
-        Map<String, Object> headers = new HashMap<>(messageHeaders);
-        for (final Map.Entry<String,Object> entry : headers.entrySet()) {
+        Map<String, Object> headers = new HashMap<String, Object>(messageHeaders);
+        for (final Map.Entry<String, Object> entry : headers.entrySet()) {
             String headerName = entry.getKey();
             Object headerValue = entry.getValue();
 
@@ -313,7 +313,7 @@ public final class JmsMessageHelper implements JmsConstants {
 
     @SuppressWarnings("unchecked")
     public static Exchange setJmsMessageHeaders(final Message jmsMessage, final Exchange
exchange, boolean out, KeyFormatStrategy keyFormatStrategy) throws JMSException {
-        Map<String, Object> headers = new HashMap<>();
+        Map<String, Object> headers = new HashMap<String, Object>();
         if (jmsMessage != null) {
             // lets populate the standard JMS message headers
             try {

http://git-wip-us.apache.org/repos/asf/camel/blob/6e845a53/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java
b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java
index a1fbd7a..253edbd 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java
@@ -85,7 +85,7 @@ public class InOnlyProducer extends SjmsProducer {
     @Override
     public void sendMessage(final Exchange exchange, final AsyncCallback callback, final
MessageProducerResources producer) throws Exception {
         try {
-            Collection<Message> messages = new ArrayList<>(1);
+            Collection<Message> messages = new ArrayList<Message>(1);
             if (exchange.getIn().getBody() != null) {
                 if (exchange.getIn().getBody() instanceof List) {
                     Iterable<?> payload = (Iterable<?>) exchange.getIn().getBody();

http://git-wip-us.apache.org/repos/asf/camel/blob/6e845a53/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOutProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOutProducer.java
b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOutProducer.java
index 55f7019..4b7bf0b 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOutProducer.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOutProducer.java
@@ -52,7 +52,7 @@ import org.apache.commons.pool.impl.GenericObjectPool;
  */
 public class InOutProducer extends SjmsProducer {
 
-    private static final Map<String, Exchanger<Object>> EXCHANGERS = new ConcurrentHashMap<>();
+    private static final Map<String, Exchanger<Object>> EXCHANGERS = new ConcurrentHashMap<String,
Exchanger<Object>>();
 
     /**
      * A pool of {@link MessageConsumerResources} objects that are the reply
@@ -198,7 +198,7 @@ public class InOutProducer extends SjmsProducer {
             correlationId = exchange.getIn().getHeader(JmsConstants.JMS_CORRELATION_ID, String.class);
         }
         Object responseObject = null;
-        Exchanger<Object> messageExchanger = new Exchanger<>();
+        Exchanger<Object> messageExchanger = new Exchanger<Object>();
         JmsMessageHelper.setCorrelationId(request, correlationId);
         EXCHANGERS.put(correlationId, messageExchanger);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/6e845a53/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/typeconversion/JMSMessageHelperTypeConversionTest.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/typeconversion/JMSMessageHelperTypeConversionTest.java
b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/typeconversion/JMSMessageHelperTypeConversionTest.java
index 6a228b0..d389886 100644
--- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/typeconversion/JMSMessageHelperTypeConversionTest.java
+++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/typeconversion/JMSMessageHelperTypeConversionTest.java
@@ -58,7 +58,7 @@ public class JMSMessageHelperTypeConversionTest extends JmsTestSupport {
     public void testJMSMessageHelperMap() throws Exception {
         getMockEndpoint(MOCK_RESULT_URI).expectedMessageCount(1);
 
-        Map<Object,Object> map = new HashMap<>();
+        Map<Object, Object> map = new HashMap<Object, Object>();
         map.put("Hello", "Camel");
         map.put("Int", Integer.MAX_VALUE);
         map.put("Boolean", Boolean.TRUE);


Mime
View raw message