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 2023/05/13 07:20:12 UTC
[camel] branch camel-3.x updated: CAMEL-19342: Fix inlining rest-dsl routes.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.x by this push:
new a6af149c04e CAMEL-19342: Fix inlining rest-dsl routes.
a6af149c04e is described below
commit a6af149c04e9b0544453bac34ee7844ca5814c46
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat May 13 09:19:33 2023 +0200
CAMEL-19342: Fix inlining rest-dsl routes.
---
.../main/java/org/apache/camel/impl/DefaultModel.java | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java
index 2cac4a0903e..fe510627ee8 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java
@@ -221,14 +221,17 @@ public class DefaultModel implements Model {
if (from != null) {
String uri = from.getEndpointUri();
if (uri != null && uri.startsWith("rest:")) {
- ToDefinition to = (ToDefinition) r.getOutputs().get(0);
- String toUri = to.getEndpointUri();
- RouteDefinition toBeInlined = directs.get(toUri);
- if (toBeInlined != null) {
- toBeRemoved.add(toBeInlined);
- // inline by replacing the outputs
- r.getOutputs().clear();
- r.getOutputs().addAll(toBeInlined.getOutputs());
+ ProcessorDefinition<?> def = r.getOutputs().get(0);
+ if (def instanceof ToDefinition) {
+ ToDefinition to = (ToDefinition) def;
+ String toUri = to.getEndpointUri();
+ RouteDefinition toBeInlined = directs.get(toUri);
+ if (toBeInlined != null) {
+ toBeRemoved.add(toBeInlined);
+ // inline by replacing the outputs
+ r.getOutputs().clear();
+ r.getOutputs().addAll(toBeInlined.getOutputs());
+ }
}
}
}