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 2015/05/19 22:24:32 UTC

[1/4] camel git commit: Bean component should use try .. catch to ensure the callback is invoked. Polished

Repository: camel
Updated Branches:
  refs/heads/master 7d36d5260 -> 45a3c047b


Bean component should use try .. catch to ensure the callback is invoked. Polished


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

Branch: refs/heads/master
Commit: 6f5bee10d09467d36a005044592fa4a853849532
Parents: 7d36d52
Author: Claus Ibsen <da...@apache.org>
Authored: Tue May 19 20:34:10 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue May 19 20:34:10 2015 +0200

----------------------------------------------------------------------
 .../apache/camel/component/bean/BeanProcessor.java    | 14 ++++++++++----
 .../apache/camel/component/bean/PojoProxyHelper.java  |  1 +
 2 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6f5bee10/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java b/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java
index bf8ddbe..a273162 100644
--- a/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java
@@ -94,7 +94,7 @@ public class BeanProcessor extends ServiceSupport implements AsyncProcessor {
             Processor processor = getProcessor();
             if (processor == null) {
                 // so if there is a custom type converter for the bean to processor
-                processor = exchange.getContext().getTypeConverter().convertTo(Processor.class, exchange, bean);
+                processor = exchange.getContext().getTypeConverter().tryConvertTo(Processor.class, exchange, bean);
             }
             if (processor != null) {
                 LOG.trace("Using a custom adapter as bean invocation: {}", processor);
@@ -131,9 +131,15 @@ public class BeanProcessor extends ServiceSupport implements AsyncProcessor {
                 LOG.debug("BeanHolder bean: {} and beanInvocation bean: {} is same instance: {}", new Object[]{bean.getClass(), clazz, sameBean});
             }
             if (sameBean) {
-                beanInvoke.invoke(bean, exchange);
-                // propagate headers
-                exchange.getOut().getHeaders().putAll(exchange.getIn().getHeaders());
+                try {
+                    beanInvoke.invoke(bean, exchange);
+                    if (exchange.hasOut()) {
+                        // propagate headers
+                        exchange.getOut().getHeaders().putAll(exchange.getIn().getHeaders());
+                    }
+                } catch (Throwable e) {
+                    exchange.setException(e);
+                }
                 callback.done(true);
                 return true;
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/6f5bee10/camel-core/src/main/java/org/apache/camel/component/bean/PojoProxyHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/PojoProxyHelper.java b/camel-core/src/main/java/org/apache/camel/component/bean/PojoProxyHelper.java
index 8a3d6aa..98964e6 100644
--- a/camel-core/src/main/java/org/apache/camel/component/bean/PojoProxyHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/component/bean/PojoProxyHelper.java
@@ -27,6 +27,7 @@ import org.apache.camel.util.ServiceHelper;
  * receives a reply. Unlike the ProxyHelper this works only with methods that have only one parameter.
  */
 public final class PojoProxyHelper {
+
     private PojoProxyHelper() {
     }
 


[4/4] camel git commit: Fixed rest-dsl after recent changes

Posted by da...@apache.org.
Fixed rest-dsl after recent changes


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

Branch: refs/heads/master
Commit: 45a3c047b5096b4039d206d5b25ac770ba5251de
Parents: 6aaec82
Author: Claus Ibsen <da...@apache.org>
Authored: Tue May 19 22:28:48 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue May 19 22:28:48 2015 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/camel/model/rest/VerbDefinition.java | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/45a3c047/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
index 45b950f..ee7a615 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
@@ -102,6 +102,13 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition>
         return params;
     }
 
+    /**
+     * To specify the REST operation parameters using Swagger.
+     */
+    public void setParams(List<RestOperationParamDefinition> params) {
+        this.params = params;
+    }
+
     public String getMethod() {
         return method;
     }


[3/4] camel git commit: CAMEL-8782: Configuring endpoints using reference lookup may fail with matching primitive types with their Object counterpart types

Posted by da...@apache.org.
CAMEL-8782: Configuring endpoints using reference lookup may fail with matching primitive types with their Object counterpart types


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

Branch: refs/heads/master
Commit: 6aaec82213c0a9eefe0675d57ad6f8d8dff0aa4d
Parents: 2bd2331
Author: Claus Ibsen <da...@apache.org>
Authored: Tue May 19 21:49:34 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue May 19 21:54:31 2015 +0200

----------------------------------------------------------------------
 .../org/apache/camel/util/IntrospectionSupport.java     | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6aaec822/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java b/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
index d04c310..13ceba9 100755
--- a/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
+++ b/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
@@ -43,6 +43,8 @@ import org.apache.camel.TypeConverter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.camel.util.ObjectHelper.isAssignableFrom;
+
 /**
  * Helper for introspections of beans.
  * <p/>
@@ -502,16 +504,20 @@ public final class IntrospectionSupport {
                 if (ref == null) {
                     // try the next method if nothing was found
                     continue;
-                } else if (!parameterType.isAssignableFrom(ref.getClass())) {
+                } else {
                     // setter method has not the correct type
-                    continue;
+                    // (must use ObjectHelper.isAssignableFrom which takes primitive types into account)
+                    boolean assignable = isAssignableFrom(parameterType, ref.getClass());
+                    if (!assignable) {
+                        continue;
+                    }
                 }
             }
 
             try {
                 try {
                     // If the type is null or it matches the needed type, just use the value directly
-                    if (value == null || parameterType.isAssignableFrom(ref.getClass())) {
+                    if (value == null || isAssignableFrom(parameterType, ref.getClass())) {
                         // we may want to set options on classes that has package view visibility, so override the accessible
                         setter.setAccessible(true);
                         setter.invoke(target, ref);


[2/4] camel git commit: Polished

Posted by da...@apache.org.
Polished


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

Branch: refs/heads/master
Commit: 2bd23319fe527b9165a5e20f0d06d4d57a667d25
Parents: 6f5bee1
Author: Claus Ibsen <da...@apache.org>
Authored: Tue May 19 21:49:04 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue May 19 21:49:04 2015 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/camel/util/ObjectHelper.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2bd23319/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java b/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
index 7367d1e..4e9ad05 100644
--- a/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
@@ -1825,7 +1825,7 @@ public final class ObjectHelper {
     }
     
     /**
-     * Calling the Callable with the setting of TCCL with the camel context application classloader;
+     * Calling the Callable with the setting of TCCL with the camel context application classloader.
      * 
      * @param call the Callable instance
      * @param exchange the exchange 
@@ -1840,10 +1840,10 @@ public final class ObjectHelper {
     }
     
     /**
-     * Calling the Callable with the setting of TCCL with a given classloader;
-     * 
-     * @param call the Callable instance
-     * @param  the exchange 
+     * Calling the Callable with the setting of TCCL with a given classloader.
+     *
+     * @param call        the Callable instance
+     * @param classloader the class loader
      * @return the result of Callable return  
      */
     public static Object callWithTCCL(Callable<?> call, ClassLoader classloader) throws Exception {