This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new f0d3bf13e53 CAMEL-19342: Fix inlining rest-dsl routes.
f0d3bf13e53 is described below
commit f0d3bf13e5306c649a5e71f1a38ecfb421a1c4cc
Author: Claus Ibsen <[email protected]>
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 028f802c2af..48a84fb41c7 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
@@ -222,14 +222,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());
+ }
}
}
}