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 2019/05/12 06:54:56 UTC
[camel] branch master updated (bff915d -> faeeb51)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.
from bff915d Upgrade Proton-J to version 0.33.0
new 9292390 Fixed potential NPE
new faeeb51 CAMEL-13500: Camel Main can now configure component options with nested values like you can do with Spring Boot etc.
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../camel/impl/engine/AbstractCamelContext.java | 7 +++---
.../java/org/apache/camel/main/MainSupport.java | 26 ++++++++++++++++++++--
2 files changed, 28 insertions(+), 5 deletions(-)
[camel] 01/02: Fixed potential NPE
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 9292390315bc33fa2e2d8b9e87552d2c3b0ca1bf
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun May 12 08:37:21 2019 +0200
Fixed potential NPE
---
.../java/org/apache/camel/impl/engine/AbstractCamelContext.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
index 49e4eaf..de81632 100644
--- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
+++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
@@ -2486,9 +2486,10 @@ public abstract class AbstractCamelContext extends ServiceSupport implements Cam
// stop route inputs in the same order as they was started so we stop
// the very first inputs first
try {
- // force shutting down routes as they may otherwise cause shutdown
- // to hang
- shutdownStrategy.shutdownForced(this, getRouteStartupOrder());
+ // force shutting down routes as they may otherwise cause shutdown to hang
+ if (shutdownStrategy != null) {
+ shutdownStrategy.shutdownForced(this, getRouteStartupOrder());
+ }
} catch (Throwable e) {
log.warn("Error occurred while shutting down routes. This exception will be ignored.", e);
}
[camel] 02/02: CAMEL-13500: Camel Main can now configure component
options with nested values like you can do with Spring Boot etc.
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit faeeb51fab3a29b8fcdc2698feaa27afd1009481
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun May 12 08:54:30 2019 +0200
CAMEL-13500: Camel Main can now configure component options with nested values like you can do with Spring Boot etc.
---
.../java/org/apache/camel/main/MainSupport.java | 26 ++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/core/camel-core/src/main/java/org/apache/camel/main/MainSupport.java b/core/camel-core/src/main/java/org/apache/camel/main/MainSupport.java
index 9f5ced9..c7f8b0c 100644
--- a/core/camel-core/src/main/java/org/apache/camel/main/MainSupport.java
+++ b/core/camel-core/src/main/java/org/apache/camel/main/MainSupport.java
@@ -34,6 +34,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.camel.CamelContext;
import org.apache.camel.Component;
+import org.apache.camel.Exchange;
+import org.apache.camel.Expression;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.FileWatcherReloadStrategy;
@@ -45,6 +47,7 @@ import org.apache.camel.spi.EventNotifier;
import org.apache.camel.spi.Language;
import org.apache.camel.spi.PropertiesComponent;
import org.apache.camel.spi.ReloadStrategy;
+import org.apache.camel.support.DefaultExchange;
import org.apache.camel.support.EndpointHelper;
import org.apache.camel.support.IntrospectionSupport;
import org.apache.camel.support.LifecycleStrategySupport;
@@ -960,15 +963,34 @@ public abstract class MainSupport extends ServiceSupport {
Map.Entry<String, Object> entry = (Map.Entry) it.next();
String name = entry.getKey();
Object value = entry.getValue();
+
+ // if the name has dot's then its an OGNL expressions (so lets use simple language to walk down this ognl path)
+ boolean ognl = name.contains(".");
+ if (ognl) {
+ Language method = context.resolveLanguage("simple");
+ String path = name.substring(0, name.lastIndexOf('.'));
+ Expression exp = method.createExpression("${body." + path + "}");
+ Exchange dummy = new DefaultExchange(context);
+ dummy.getMessage().setBody(target);
+ Object newTarget = exp.evaluate(dummy, Object.class);
+ if (newTarget != null) {
+ target = newTarget;
+ name = name.substring(name.lastIndexOf('.') + 1);
+ }
+ }
+
+
String stringValue = value != null ? value.toString() : null;
boolean hit = false;
+
+ LOG.debug("Setting property {} on {} with value {}", name, target, stringValue);
if (EndpointHelper.isReferenceParameter(stringValue)) {
- hit = IntrospectionSupport.setProperty(context, context.getTypeConverter(), target, name, (Object) null, stringValue, true);
+ hit = IntrospectionSupport.setProperty(context, context.getTypeConverter(), target, name, null, stringValue, true);
} else if (value != null) {
try {
hit = IntrospectionSupport.setProperty(context, context.getTypeConverter(), target, name, value);
} catch (IllegalArgumentException var12) {
- hit = IntrospectionSupport.setProperty(context, context.getTypeConverter(), target, name, (Object) null, stringValue, true);
+ hit = IntrospectionSupport.setProperty(context, context.getTypeConverter(), target, name, null, stringValue, true);
}
}