You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2014/05/08 09:50:08 UTC

[1/2] git commit: Fixed potential NPE in seda producer.

Repository: camel
Updated Branches:
  refs/heads/camel-2.12.x 9195ef645 -> 32b6f773d
  refs/heads/camel-2.13.x 06b7d5c87 -> 6a75fdc11


Fixed potential NPE in seda producer.


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

Branch: refs/heads/camel-2.13.x
Commit: 6a75fdc11df1d74a5baa25237fe3cddb01c64747
Parents: 06b7d5c
Author: Claus Ibsen <da...@apache.org>
Authored: Thu May 8 09:48:02 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu May 8 09:49:42 2014 +0200

----------------------------------------------------------------------
 .../java/org/apache/camel/component/seda/SedaEndpoint.java  | 9 +++++----
 .../java/org/apache/camel/component/seda/SedaProducer.java  | 8 +++++++-
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6a75fdc1/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
index 6212447..397beab 100644
--- a/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
@@ -179,12 +179,13 @@ public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint,
         }
     }
 
+    /**
+     * Get's the {@link QueueReference} for the this endpoint.
+     * @return the reference, or <tt>null</tt> if no queue reference exists.
+     */
     public synchronized QueueReference getQueueReference() {
         String key = getComponent().getQueueKey(getEndpointUri());
-        QueueReference ref =  getComponent().getQueueReference(key);
-        if (ref == null) {
-            LOG.warn("There was no queue reference for the endpoint {0}", getEndpointUri());
-        }
+        QueueReference ref = getComponent().getQueueReference(key);
         return ref;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/6a75fdc1/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java b/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java
index 379443d..81a2e4c 100644
--- a/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java
+++ b/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java
@@ -210,8 +210,14 @@ public class SedaProducer extends DefaultAsyncProducer {
      * @param exchange the exchange to add to the queue
      */
     protected void addToQueue(Exchange exchange) throws SedaConsumerNotAvailableException {
+        BlockingQueue<Exchange> queue = null;
         QueueReference queueReference = endpoint.getQueueReference();
-        BlockingQueue<Exchange> queue = queueReference.getQueue();
+        if (queueReference != null) {
+            queue = queueReference.getQueue();
+        }
+        if (queue == null) {
+            throw new SedaConsumerNotAvailableException("No queue available on endpoint: " + endpoint, exchange);
+        }
 
         if (endpoint.isFailIfNoConsumers() && !queueReference.hasConsumers()) {
             throw new SedaConsumerNotAvailableException("No consumers available on endpoint: " + endpoint, exchange);


[2/2] git commit: Fixed potential NPE in seda producer.

Posted by da...@apache.org.
Fixed potential NPE in seda producer.


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

Branch: refs/heads/camel-2.12.x
Commit: 32b6f773dbb870ea29e79277cf32c05117a62ed1
Parents: 9195ef6
Author: Claus Ibsen <da...@apache.org>
Authored: Thu May 8 09:48:02 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu May 8 09:49:56 2014 +0200

----------------------------------------------------------------------
 .../java/org/apache/camel/component/seda/SedaEndpoint.java  | 9 +++++----
 .../java/org/apache/camel/component/seda/SedaProducer.java  | 8 +++++++-
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/32b6f773/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
index 7ee8d03..c8367dd 100644
--- a/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
@@ -179,12 +179,13 @@ public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint,
         }
     }
 
+    /**
+     * Get's the {@link QueueReference} for the this endpoint.
+     * @return the reference, or <tt>null</tt> if no queue reference exists.
+     */
     public synchronized QueueReference getQueueReference() {
         String key = getComponent().getQueueKey(getEndpointUri());
-        QueueReference ref =  getComponent().getQueueReference(key);
-        if (ref == null) {
-            LOG.warn("There was no queue reference for the endpoint {0}", getEndpointUri());
-        }
+        QueueReference ref = getComponent().getQueueReference(key);
         return ref;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/32b6f773/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java b/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java
index 379443d..81a2e4c 100644
--- a/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java
+++ b/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java
@@ -210,8 +210,14 @@ public class SedaProducer extends DefaultAsyncProducer {
      * @param exchange the exchange to add to the queue
      */
     protected void addToQueue(Exchange exchange) throws SedaConsumerNotAvailableException {
+        BlockingQueue<Exchange> queue = null;
         QueueReference queueReference = endpoint.getQueueReference();
-        BlockingQueue<Exchange> queue = queueReference.getQueue();
+        if (queueReference != null) {
+            queue = queueReference.getQueue();
+        }
+        if (queue == null) {
+            throw new SedaConsumerNotAvailableException("No queue available on endpoint: " + endpoint, exchange);
+        }
 
         if (endpoint.isFailIfNoConsumers() && !queueReference.hasConsumers()) {
             throw new SedaConsumerNotAvailableException("No consumers available on endpoint: " + endpoint, exchange);