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 2020/11/05 07:14:24 UTC

[camel] branch master updated: CAMEL-15181: report-maven-plugin fails to validate simple expression

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


The following commit(s) were added to refs/heads/master by this push:
     new 97e2586  CAMEL-15181: report-maven-plugin fails to validate simple expression
97e2586 is described below

commit 97e2586d16054f8b90346a9fe0b65f9ac7e00fec
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Nov 5 08:09:49 2020 +0100

    CAMEL-15181: report-maven-plugin fails to validate simple expression
---
 .../java/org/apache/camel/catalog/impl/AbstractCamelCatalog.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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 1a7571a..dba54f6 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
@@ -38,6 +38,7 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.catalog.ConfigurationPropertiesValidationResult;
 import org.apache.camel.catalog.EndpointValidationResult;
 import org.apache.camel.catalog.JSonSchemaResolver;
@@ -1263,16 +1264,21 @@ public abstract class AbstractCamelCatalog {
 
         LanguageValidationResult answer = new LanguageValidationResult(simple);
 
+        Object context = null;
         Object instance = null;
         Class<?> clazz = null;
         try {
+            // need a simple camel context for the simple language parser to be able to parse
+            clazz = classLoader.loadClass("org.apache.camel.impl.engine.SimpleCamelContext");
+            context = clazz.getDeclaredConstructor(boolean.class).newInstance(false);
             clazz = classLoader.loadClass("org.apache.camel.language.simple.SimpleLanguage");
             instance = clazz.getDeclaredConstructor().newInstance();
+            instance.getClass().getMethod("setCamelContext", CamelContext.class).invoke(instance, context);
         } catch (Exception e) {
             // ignore
         }
 
-        if (clazz != null && instance != null) {
+        if (clazz != null && context != null && instance != null) {
             Throwable cause = null;
             try {
                 if (predicate) {