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 3438ac36cafdbea86c77a12f0ea14e148dd7873e Author: Claus Ibsen <[email protected]> AuthorDate: Mon Sep 21 12:02:31 2020 +0200 CAMEL-15559: Fixed camel-catalog validate configuration properties with spaces around = sign. --- .../java/org/apache/camel/catalog/CamelCatalogTest.java | 14 ++++++++++++++ .../apache/camel/catalog/impl/AbstractCamelCatalog.java | 10 ++++++++++ 2 files changed, 24 insertions(+) diff --git a/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java b/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java index ad57b41..8e5694b 100644 --- a/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java +++ b/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java @@ -1476,6 +1476,20 @@ public class CamelCatalogTest { ConfigurationPropertiesValidationResult result = catalog.validateConfigurationProperty(text); assertTrue(result.isSuccess()); + // spaces around + text = "camel.main.allow-use-original-message = true"; + result = catalog.validateConfigurationProperty(text); + assertTrue(result.isSuccess()); + text = "camel.main.allow-use-original-message= true"; + result = catalog.validateConfigurationProperty(text); + assertTrue(result.isSuccess()); + text = "camel.main.allow-use-original-message =true"; + result = catalog.validateConfigurationProperty(text); + assertTrue(result.isSuccess()); + text = "camel.main.allow-use-original-message = true"; + result = catalog.validateConfigurationProperty(text); + assertTrue(result.isSuccess()); + text = "camel.main.allow-use-original-message=abc"; result = catalog.validateConfigurationProperty(text); assertFalse(result.isSuccess()); diff --git a/core/camel-core-catalog/src/main/java/org/apache/camel/catalog/impl/AbstractCamelCatalog.java b/core/camel-core-catalog/src/main/java/org/apache/camel/catalog/impl/AbstractCamelCatalog.java index 407ea4f..b34ca0e 100644 --- a/core/camel-core-catalog/src/main/java/org/apache/camel/catalog/impl/AbstractCamelCatalog.java +++ b/core/camel-core-catalog/src/main/java/org/apache/camel/catalog/impl/AbstractCamelCatalog.java @@ -960,6 +960,16 @@ public abstract class AbstractCamelCatalog { String longKey = CatalogHelper.before(line, "="); String key = longKey; String value = CatalogHelper.after(line, "="); + // trim values + if (longKey != null) { + longKey = longKey.trim(); + } + if (key != null) { + key = key.trim(); + } + if (value != null) { + value = value.trim(); + } ConfigurationPropertiesValidationResult result = new ConfigurationPropertiesValidationResult(); boolean accept = acceptConfigurationPropertyKey(key);
