You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2023/05/28 13:55:49 UTC
[camel] 01/04: (chores) camel-support: reduce code duplications
This is an automated email from the ASF dual-hosted git repository.
orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 9826d232343fbedb2946bc1996c5516dfa573c34
Author: Otavio R. Piske <an...@gmail.com>
AuthorDate: Sun May 28 13:40:13 2023 +0200
(chores) camel-support: reduce code duplications
Signed-off-by: Otavio R. Piske <an...@gmail.com>
---
.../org/apache/camel/support/PropertyBindingSupport.java | 6 ++----
.../camel/support/processor/DefaultExchangeFormatter.java | 12 ++++--------
2 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java b/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
index 92145fad72a..f50807c1920 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
@@ -1730,14 +1730,12 @@ public final class PropertyBindingSupport {
* The properties to use for binding
*/
public Builder withProperties(Map<String, Object> properties) {
- if (this.properties == null) {
- this.properties = properties;
- } else {
+ if (this.properties != null) {
// there may be existing options so add those if missing
// we need to mutate existing as we are may be removing bound properties
this.properties.forEach(properties::putIfAbsent);
- this.properties = properties;
}
+ this.properties = properties;
return this;
}
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/processor/DefaultExchangeFormatter.java b/core/camel-support/src/main/java/org/apache/camel/support/processor/DefaultExchangeFormatter.java
index aa16d0691fe..40956846045 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/processor/DefaultExchangeFormatter.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/processor/DefaultExchangeFormatter.java
@@ -226,20 +226,16 @@ public class DefaultExchangeFormatter implements ExchangeFormatter {
sb = answer;
}
- if (multiline) {
- sb.insert(0, "Exchange[");
- sb.append("]");
- return sb.toString();
- } else {
+ if (!multiline) {
// get rid of the leading comma space if needed
if (sb.length() > 1 && sb.charAt(0) == ',' && sb.charAt(1) == ' ') {
sb.replace(0, 2, "");
}
- sb.insert(0, "Exchange[");
- sb.append("]");
- return sb.toString();
}
+ sb.insert(0, "Exchange[");
+ sb.append("]");
+ return sb.toString();
}
/**