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 01c281396c6 CAMEL-21315: rest-dsl - Throw exception if user trying to 
set to(endpoint) multiple times.
01c281396c6 is described below

commit 01c281396c6e4fdd579d63264497658029290090
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Mon Oct 7 12:17:59 2024 +0200

    CAMEL-21315: rest-dsl - Throw exception if user trying to set to(endpoint) 
multiple times.
---
 .../src/main/java/org/apache/camel/model/rest/VerbDefinition.java     | 4 ++++
 1 file changed, 4 insertions(+)

diff --git 
a/core/camel-core-model/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
 
b/core/camel-core-model/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
index 5fdc39c1c57..d0e96f54488 100644
--- 
a/core/camel-core-model/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
+++ 
b/core/camel-core-model/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
@@ -382,6 +382,10 @@ public abstract class VerbDefinition extends 
OptionalIdentifiedDefinition<VerbDe
      * handles this REST call.
      */
     public void setTo(ToDefinition to) {
+        if (this.to != null) {
+            throw new IllegalArgumentException(
+                    "This verb has already set to endpoint. It is not possible 
to configure multiple 'to' with Rest DSL.");
+        }
         this.to = to;
     }
 

Reply via email to