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 2019/06/28 06:48:47 UTC

[camel] branch master updated (a2a252a -> d717709)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from a2a252a  Fixed CS
     new 8d02bf6  CAMEL-13686: camel-main - Refine logging output
     new 2eb00b5  CAMEL-13681: Property binding support should have support for ignore case in property keys
     new 6f7c532  CAMEL-13686: camel-main - Output summary of auto-configuration
     new b34731b  Fixed java9+ deprecation warning
     new d717709  Fixed test

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/impl/engine/AbstractCamelContext.java    |   4 +-
 .../camel/impl/engine/DefaultFactoryFinder.java    |   5 +-
 .../runtimecatalog/impl/AbstractCamelCatalog.java  |   2 +-
 .../org/apache/camel/core/osgi/impl/Activator.java |   2 +-
 .../camel/builder/FlexibleAggregationStrategy.java |   2 +-
 .../org/apache/camel/builder/xml/XPathTest.java    |   2 +-
 .../camel/support/PropertyBindingSupportTest.java  |   2 +-
 .../apache/camel/converter/jaxp/XmlConverter.java  |   2 +-
 .../support/builder/xml/XMLConverterHelper.java    |   2 +-
 .../processor/validation/ValidatingProcessor.java  |   2 +-
 .../java/org/apache/camel/main/MainSupport.java    | 103 +++++++++++++--------
 .../apache/camel/support/IntrospectionSupport.java |   4 +-
 .../org/apache/camel/support/LRUCacheFactory.java  |   2 +-
 .../org/apache/camel/support/ObjectHelper.java     |  10 +-
 14 files changed, 84 insertions(+), 60 deletions(-)


[camel] 01/05: CAMEL-13686: camel-main - Refine logging output

Posted by da...@apache.org.
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 8d02bf6661c74a9718542550c1588c06f74f1d89
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jun 28 07:29:33 2019 +0200

    CAMEL-13686: camel-main - Refine logging output
---
 .../java/org/apache/camel/main/MainSupport.java    | 96 +++++++++++++---------
 1 file changed, 57 insertions(+), 39 deletions(-)

diff --git a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
index cb2f182..72a6873 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
@@ -486,7 +486,7 @@ public abstract class MainSupport extends ServiceSupport {
     }
 
     /**
-     * Whether auto configuration of components/dataformats/languages is enabled or not.
+     * Whether auto-configuration of components/dataformats/languages is enabled or not.
      * When enabled the configuration parameters are loaded from the properties component
      * and configured as defaults (similar to spring-boot auto-configuration). You can prefix
      * the parameters in the properties file with:
@@ -498,7 +498,7 @@ public abstract class MainSupport extends ServiceSupport {
      * - camel.language.name.option2=value2
      * Where name is the name of the component, dataformat or language such as seda,direct,jaxb.
      * <p/>
-     * The auto configuration also works for any options on components
+     * The auto-configuration also works for any options on components
      * that is a complex type (not standard Java type) and there has been an explicit single
      * bean instance registered to the Camel registry via the {@link org.apache.camel.spi.Registry#bind(String, Object)} method
      * or by using the {@link org.apache.camel.BindToRegistry} annotation style.
@@ -733,15 +733,17 @@ public abstract class MainSupport extends ServiceSupport {
             camelContext.getManagementStrategy().addEventNotifier(notifier);
         }
 
-        // need to eager allow to auto configure properties component
+        final Map<String, String> autoConfiguredProperties = new LinkedHashMap<>();
+
+        // need to eager allow to auto-configure properties component
         if (mainConfigurationProperties.isAutoConfigurationEnabled()) {
-            autoConfigurationFailFast(camelContext);
-            autoConfigurationPropertiesComponent(camelContext);
-            autoConfigurationMainConfiguration(camelContext, mainConfigurationProperties);
+            autoConfigurationFailFast(camelContext, autoConfiguredProperties);
+            autoConfigurationPropertiesComponent(camelContext, autoConfiguredProperties);
+            autoConfigurationMainConfiguration(camelContext, mainConfigurationProperties, autoConfiguredProperties);
         }
 
         // configure from main configuration properties
-        doConfigureCamelContextFromMainConfiguration(camelContext, mainConfigurationProperties);
+        doConfigureCamelContextFromMainConfiguration(camelContext, mainConfigurationProperties, autoConfiguredProperties);
 
         // try to load configuration classes
         loadConfigurations(camelContext);
@@ -749,10 +751,16 @@ public abstract class MainSupport extends ServiceSupport {
         // conventional configuration via properties to allow configuring options on
         // component, dataformat, and languages (like spring-boot auto-configuration)
         if (mainConfigurationProperties.isAutowireComponentProperties() || mainConfigurationProperties.isAutowireComponentPropertiesDeep()) {
-            autoConfigurationFromRegistry(camelContext, mainConfigurationProperties.isAutowireComponentPropertiesDeep());
+            autowireConfigurationFromRegistry(camelContext, mainConfigurationProperties.isAutowireComponentPropertiesDeep());
         }
         if (mainConfigurationProperties.isAutoConfigurationEnabled()) {
-            autoConfigurationFromProperties(camelContext);
+            autoConfigurationFromProperties(camelContext, autoConfiguredProperties);
+        }
+
+        // log summary of configurations
+        if (!autoConfiguredProperties.isEmpty()) {
+            LOG.info("Auto-configuration summary:");
+            autoConfiguredProperties.forEach((k, v) -> LOG.info("\t{}={}", k, v));
         }
 
         // try to load the route builders
@@ -768,7 +776,7 @@ public abstract class MainSupport extends ServiceSupport {
         }
     }
 
-    protected void autoConfigurationFailFast(CamelContext camelContext) throws Exception {
+    protected void autoConfigurationFailFast(CamelContext camelContext, Map<String, String> autoConfiguredProperties) throws Exception {
         // load properties
         Properties prop = camelContext.getPropertiesComponent().loadProperties();
         LOG.debug("Properties from Camel properties component:");
@@ -782,6 +790,7 @@ public abstract class MainSupport extends ServiceSupport {
             envEnabled = prop.remove("camel.main.auto-configuration-environment-variables-enabled");
             if (envEnabled != null) {
                 PropertyBindingSupport.bindMandatoryProperty(camelContext, mainConfigurationProperties, "autoConfigurationEnvironmentVariablesEnabled", envEnabled, true);
+                autoConfiguredProperties.put("camel.main.auto-configuration-environment-variables-enabled", envEnabled.toString());
             }
         }
 
@@ -809,6 +818,7 @@ public abstract class MainSupport extends ServiceSupport {
             }
             if (failFast != null) {
                 PropertyBindingSupport.bindMandatoryProperty(camelContext, mainConfigurationProperties, "autoConfigurationFailFast", failFast, true);
+                autoConfiguredProperties.put("camel.main.auto-configuration-fail-fast", failFast.toString());
             }
         }
     }
@@ -816,7 +826,8 @@ public abstract class MainSupport extends ServiceSupport {
     /**
      * Configures CamelContext from the {@link MainConfigurationProperties} properties.
      */
-    protected void doConfigureCamelContextFromMainConfiguration(CamelContext camelContext, MainConfigurationProperties config) throws Exception {
+    protected void doConfigureCamelContextFromMainConfiguration(CamelContext camelContext, MainConfigurationProperties config,
+                                                                Map<String, String> autoConfiguredProperties) throws Exception {
         if (config.getFileConfigurations() != null) {
             String[] locs = config.getFileConfigurations().split(",");
             for (String loc : locs) {
@@ -891,12 +902,12 @@ public abstract class MainSupport extends ServiceSupport {
             }
         }
         if (!contextProperties.isEmpty()) {
-            LOG.info("Auto configuring CamelContext from loaded properties: {}", contextProperties.size());
+            LOG.debug("Auto-configuring CamelContext from loaded properties: {}", contextProperties.size());
             setPropertiesOnTarget(camelContext, camelContext, contextProperties, null, "camel.context.",
-                    mainConfigurationProperties.isAutoConfigurationFailFast(), true);
+                    mainConfigurationProperties.isAutoConfigurationFailFast(), true, autoConfiguredProperties);
         }
         if (!hystrixProperties.isEmpty()) {
-            LOG.info("Auto configuring Hystrix EIP from loaded properties: {}", hystrixProperties.size());
+            LOG.debug("Auto-configuring Hystrix EIP from loaded properties: {}", hystrixProperties.size());
             ModelCamelContext model = camelContext.adapt(ModelCamelContext.class);
             HystrixConfigurationDefinition hystrix = model.getHystrixConfiguration(null);
             if (hystrix == null) {
@@ -904,10 +915,10 @@ public abstract class MainSupport extends ServiceSupport {
                 model.setHystrixConfiguration(hystrix);
             }
             setPropertiesOnTarget(camelContext, hystrix, hystrixProperties, null, "camel.hsytrix.",
-                    mainConfigurationProperties.isAutoConfigurationFailFast(), true);
+                    mainConfigurationProperties.isAutoConfigurationFailFast(), true, autoConfiguredProperties);
         }
         if (!restProperties.isEmpty()) {
-            LOG.info("Auto configuring Rest DSL from loaded properties: {}", restProperties.size());
+            LOG.debug("Auto-configuring Rest DSL from loaded properties: {}", restProperties.size());
             ModelCamelContext model = camelContext.adapt(ModelCamelContext.class);
             RestConfiguration rest = model.getRestConfiguration();
             if (rest == null) {
@@ -915,32 +926,32 @@ public abstract class MainSupport extends ServiceSupport {
                 model.setRestConfiguration(rest);
             }
             setPropertiesOnTarget(camelContext, rest, restProperties, null, "camel.rest.",
-                    mainConfigurationProperties.isAutoConfigurationFailFast(), true);
+                    mainConfigurationProperties.isAutoConfigurationFailFast(), true, autoConfiguredProperties);
         }
 
         // log which options was not set
         if (!contextProperties.isEmpty()) {
             contextProperties.forEach((k, v) -> {
-                LOG.warn("Property not auto configured: camel.context.{}={} on object: {}", k, v, camelContext);
+                LOG.warn("Property not auto-configured: camel.context.{}={} on bean: {}", k, v, camelContext);
             });
         }
         if (!hystrixProperties.isEmpty()) {
             ModelCamelContext model = camelContext.adapt(ModelCamelContext.class);
             HystrixConfigurationDefinition hystrix = model.getHystrixConfiguration(null);
             hystrixProperties.forEach((k, v) -> {
-                LOG.warn("Property not auto configured: camel.hystrix.{}={} on object: {}", k, v, hystrix);
+                LOG.warn("Property not auto-configured: camel.hystrix.{}={} on bean: {}", k, v, hystrix);
             });
         }
         if (!restProperties.isEmpty()) {
             ModelCamelContext model = camelContext.adapt(ModelCamelContext.class);
             RestConfiguration rest = model.getRestConfiguration();
             restProperties.forEach((k, v) -> {
-                LOG.warn("Property not auto configured: camel.rest.{}={} on object: {}", k, v, rest);
+                LOG.warn("Property not auto-configured: camel.rest.{}={} on bean: {}", k, v, rest);
             });
         }
     }
 
-    protected void autoConfigurationPropertiesComponent(CamelContext camelContext) throws Exception {
+    protected void autoConfigurationPropertiesComponent(CamelContext camelContext, Map<String, String> autoConfiguredProperties) throws Exception {
         // load properties
         Properties prop = camelContext.getPropertiesComponent().loadProperties();
 
@@ -965,19 +976,21 @@ public abstract class MainSupport extends ServiceSupport {
         }
 
         if (!properties.isEmpty()) {
-            LOG.info("Auto configuring properties component from loaded properties: {}", properties.size());
-            setPropertiesOnTarget(camelContext, camelContext.getPropertiesComponent(), properties, null, "camel.component.properties.", mainConfigurationProperties.isAutoConfigurationFailFast(), true);
+            LOG.debug("Auto-configuring properties component from loaded properties: {}", properties.size());
+            setPropertiesOnTarget(camelContext, camelContext.getPropertiesComponent(), properties, null,
+                    "camel.component.properties.", mainConfigurationProperties.isAutoConfigurationFailFast(),
+                    true, autoConfiguredProperties);
         }
 
         // log which options was not set
         if (!properties.isEmpty()) {
             properties.forEach((k, v) -> {
-                LOG.warn("Property not auto configured: camel.component.properties.{}={} on object: {}", k, v, camelContext.getPropertiesComponent());
+                LOG.warn("Property not auto-configured: camel.component.properties.{}={} on object: {}", k, v, camelContext.getPropertiesComponent());
             });
         }
     }
 
-    protected void autoConfigurationMainConfiguration(CamelContext camelContext, MainConfigurationProperties config) throws Exception {
+    protected void autoConfigurationMainConfiguration(CamelContext camelContext, MainConfigurationProperties config, Map<String, String> autoConfiguredProperties) throws Exception {
         // load properties
         Properties prop = camelContext.getPropertiesComponent().loadProperties();
 
@@ -1002,20 +1015,20 @@ public abstract class MainSupport extends ServiceSupport {
         }
 
         if (!properties.isEmpty()) {
-            LOG.info("Auto configuring main from loaded properties: {}", properties.size());
+            LOG.debug("Auto-configuring main from loaded properties: {}", properties.size());
             setPropertiesOnTarget(camelContext, config, properties, null, "camel.main.",
-                    mainConfigurationProperties.isAutoConfigurationFailFast(), true);
+                    mainConfigurationProperties.isAutoConfigurationFailFast(), true, autoConfiguredProperties);
         }
 
         // log which options was not set
         if (!properties.isEmpty()) {
             properties.forEach((k, v) -> {
-                LOG.warn("Property not auto configured: camel.main.{}={} on object: {}", k, v, config);
+                LOG.warn("Property not auto-configured: camel.main.{}={} on bean: {}", k, v, config);
             });
         }
     }
 
-    protected void autoConfigurationFromProperties(CamelContext camelContext) throws Exception {
+    protected void autoConfigurationFromProperties(CamelContext camelContext, Map<String, String> autoConfiguredProperties) throws Exception {
         // load optional META-INF/services/org/apache/camel/autowire.properties
         Properties prop = new OrderedProperties();
         try {
@@ -1023,7 +1036,7 @@ public abstract class MainSupport extends ServiceSupport {
             if (is != null) {
                 prop.load(is);
                 if (!prop.isEmpty()) {
-                    LOG.info("Loaded {} properties from classpath: META-INF/services/org/apache/camel/autowire.properties", prop.size());
+                    LOG.info("Autowired enabled from classpath: META-INF/services/org/apache/camel/autowire.properties with {} properties", prop.size());
                     if (LOG.isDebugEnabled()) {
                         LOG.debug("Properties from classpath: META-INF/services/org/apache/camel/autowire.properties:");
                         for (String key : prop.stringPropertyNames()) {
@@ -1117,14 +1130,14 @@ public abstract class MainSupport extends ServiceSupport {
 
         if (!properties.isEmpty()) {
             long total = properties.values().stream().mapToLong(Map::size).sum();
-            LOG.info("Auto configuring {} components/dataformat/languages from loaded properties: {}", properties.size(), total);
+            LOG.debug("Auto-configuring {} components/dataformat/languages from loaded properties: {}", properties.size(), total);
         }
 
         for (PropertyOptionKey pok : properties.keySet()) {
             Map<String, Object> values = properties.get(pok);
             String optionKey = pok.getKey().substring(pok.getOptionPrefix().length() + 1);
             setPropertiesOnTarget(camelContext, pok.getInstance(), values, optionKey, pok.getOptionPrefix(),
-                    mainConfigurationProperties.isAutoConfigurationFailFast(), true);
+                    mainConfigurationProperties.isAutoConfigurationFailFast(), true, autoConfiguredProperties);
         }
 
         // log which options was not set
@@ -1133,18 +1146,18 @@ public abstract class MainSupport extends ServiceSupport {
                 Map<String, Object> values = properties.get(pok);
                 values.forEach((k, v) -> {
                     String stringValue = v != null ? v.toString() : null;
-                    LOG.warn("Property ({}={}) not auto configured with name: {} on bean: {} with value: {}", pok.getKey(), stringValue, k, pok.getInstance(), stringValue);
+                    LOG.warn("Property ({}={}) not auto-configured with name: {} on bean: {} with value: {}", pok.getKey(), stringValue, k, pok.getInstance(), stringValue);
                 });
             }
         }
     }
 
-    protected void autoConfigurationFromRegistry(CamelContext camelContext, boolean deepNesting) throws Exception {
+    protected void autowireConfigurationFromRegistry(CamelContext camelContext, boolean deepNesting) throws Exception {
         camelContext.addLifecycleStrategy(new LifecycleStrategySupport() {
             @Override
             public void onComponentAdd(String name, Component component) {
                 PropertyBindingSupport.autowireSingletonPropertiesFromRegistry(camelContext, component, false, deepNesting, (obj, propertyName, type, value) -> {
-                    LOG.info("Auto configuring option: {} on component: {} as one instance of type: {} registered in the Camel Registry",
+                    LOG.info("Autowired property: {} on component: {} as exactly one instance of type: {} found in the registry",
                             propertyName, component.getClass().getSimpleName(), type.getName());
                 });
             }
@@ -1209,7 +1222,8 @@ public abstract class MainSupport extends ServiceSupport {
     }
 
     private static boolean setPropertiesOnTarget(CamelContext context, Object target, Map<String, Object> properties,
-                                                 String optionKey, String optionPrefix, boolean failIfNotSet, boolean ignoreCase) throws Exception {
+                                                 String optionKey, String optionPrefix, boolean failIfNotSet, boolean ignoreCase,
+                                                 Map<String, String> autoConfiguredProperties) throws Exception {
         ObjectHelper.notNull(context, "context");
         ObjectHelper.notNull(target, "target");
         ObjectHelper.notNull(properties, "properties");
@@ -1224,10 +1238,12 @@ public abstract class MainSupport extends ServiceSupport {
             String stringValue = value != null ? value.toString() : null;
             String key = name;
             if (optionPrefix != null && optionKey != null) {
-                key = optionPrefix + "." + optionKey;
+                key = optionPrefix + optionKey;
+            } else if (optionPrefix != null) {
+                key = optionPrefix + name;
             }
 
-            LOG.debug("Setting property ({}) with name: {} on bean: {} with value: {}", key, name, target, stringValue);
+            LOG.debug("Configuring property: {}={} on bean: {}", key, stringValue, target);
             try {
                 boolean hit;
                 if (failIfNotSet) {
@@ -1239,13 +1255,15 @@ public abstract class MainSupport extends ServiceSupport {
                 if (hit) {
                     it.remove();
                     rc = true;
+                    LOG.debug("Configured property: {}={} on bean: {}", key, stringValue, target);
+                    autoConfiguredProperties.put(key, stringValue);
                 }
             } catch (PropertyBindingException e) {
                 if (failIfNotSet) {
                     // enrich the error with more precise details with option prefix and key
                     throw new PropertyBindingException(e.getTarget(), e.getPropertyName(), e.getValue(), optionPrefix, optionKey, e.getCause());
                 } else {
-                    LOG.debug("Error setting property (" + key + ") with name: " + name + ") on bean: " + target
+                    LOG.debug("Error configuring property (" + key + ") with name: " + name + ") on bean: " + target
                             + " with value: " + stringValue + ". This exception is ignored as failIfNotSet=false.", e);
                 }
             }


[camel] 04/05: Fixed java9+ deprecation warning

Posted by da...@apache.org.
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 b34731b5ffc1a6e4ea65898683c7d6f5d28897b8
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jun 28 08:46:35 2019 +0200

    Fixed java9+ deprecation warning
---
 .../org/apache/camel/impl/engine/AbstractCamelContext.java     |  4 ++--
 .../org/apache/camel/impl/engine/DefaultFactoryFinder.java     |  5 ++---
 .../apache/camel/runtimecatalog/impl/AbstractCamelCatalog.java |  2 +-
 .../main/java/org/apache/camel/core/osgi/impl/Activator.java   |  2 +-
 .../org/apache/camel/builder/FlexibleAggregationStrategy.java  |  2 +-
 .../src/test/java/org/apache/camel/builder/xml/XPathTest.java  |  2 +-
 .../java/org/apache/camel/converter/jaxp/XmlConverter.java     |  2 +-
 .../apache/camel/support/builder/xml/XMLConverterHelper.java   |  2 +-
 .../support/processor/validation/ValidatingProcessor.java      |  2 +-
 .../main/java/org/apache/camel/support/LRUCacheFactory.java    |  2 +-
 .../src/main/java/org/apache/camel/support/ObjectHelper.java   | 10 ++++------
 11 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
index 7519bcd..6d5b5c7 100644
--- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
+++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
@@ -3350,8 +3350,8 @@ public abstract class AbstractCamelContext extends ServiceSupport implements Ext
                 try {
                     Class<?> type = getFactoryFinder(DefaultComponentResolver.RESOURCE_PATH).findClass("properties");
                     if (type != null) {
-                        log.info("No existing PropertiesComponent has been configured, creating a new default PropertiesComponent with name: properties");
-                        comp = type.newInstance();
+                        log.debug("No existing PropertiesComponent has been configured, creating a new default PropertiesComponent with name: properties");
+                        comp = type.getDeclaredConstructor().newInstance();
                         globalOptions.put(PropertiesComponent.DEFAULT_CREATED, "true");
                     }
                 } catch (Exception e) {
diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultFactoryFinder.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultFactoryFinder.java
index 68df342..d604cfa 100644
--- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultFactoryFinder.java
+++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultFactoryFinder.java
@@ -94,10 +94,9 @@ public class DefaultFactoryFinder implements FactoryFinder {
         return findClass(key, propertyPrefix);
     }
 
-    private Object newInstance(String key, String propertyPrefix) throws IllegalAccessException,
-        InstantiationException, IOException, ClassNotFoundException {
+    private Object newInstance(String key, String propertyPrefix) throws Exception {
         Class<?> clazz = findClass(key, propertyPrefix);
-        return clazz.newInstance();
+        return clazz.getDeclaredConstructor().newInstance();
     }
 
     private <T> T newInstance(String key, Injector injector, Class<T> expectedType) throws IOException,
diff --git a/core/camel-base/src/main/java/org/apache/camel/runtimecatalog/impl/AbstractCamelCatalog.java b/core/camel-base/src/main/java/org/apache/camel/runtimecatalog/impl/AbstractCamelCatalog.java
index b42967b..a327a88 100644
--- a/core/camel-base/src/main/java/org/apache/camel/runtimecatalog/impl/AbstractCamelCatalog.java
+++ b/core/camel-base/src/main/java/org/apache/camel/runtimecatalog/impl/AbstractCamelCatalog.java
@@ -1090,7 +1090,7 @@ public abstract class AbstractCamelCatalog {
         Class<?> clazz = null;
         try {
             clazz = classLoader.loadClass("org.apache.camel.language.simple.SimpleLanguage");
-            instance = clazz.newInstance();
+            instance = clazz.getDeclaredConstructor().newInstance();
         } catch (Exception e) {
             // ignore
         }
diff --git a/core/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/impl/Activator.java b/core/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/impl/Activator.java
index 25f809e..936e356 100644
--- a/core/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/impl/Activator.java
+++ b/core/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/impl/Activator.java
@@ -250,7 +250,7 @@ public class Activator implements BundleActivator, BundleTrackerCustomizer<Objec
                             Class<?> clazz = bundle.loadClass(pkg);
                             BundleTypeConverterLoader bundleTypeConverterLoader =
                                 new BundleTypeConverterLoader(bundle, url3 != null);
-                            bundleTypeConverterLoader.setTypeConverterLoader((TypeConverterLoader)clazz.newInstance());
+                            bundleTypeConverterLoader.setTypeConverterLoader((TypeConverterLoader)clazz.getDeclaredConstructor().newInstance());
                             resolvers.add(bundleTypeConverterLoader);
                             BundleTypeConverterLoader fallBackBundleTypeConverterLoader =
                                 new BundleTypeConverterLoader(bundle, url3 != null);
diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/FlexibleAggregationStrategy.java b/core/camel-core/src/main/java/org/apache/camel/builder/FlexibleAggregationStrategy.java
index 33973b4..be8ee06 100644
--- a/core/camel-core/src/main/java/org/apache/camel/builder/FlexibleAggregationStrategy.java
+++ b/core/camel-core/src/main/java/org/apache/camel/builder/FlexibleAggregationStrategy.java
@@ -265,7 +265,7 @@ public class FlexibleAggregationStrategy<E> implements AggregationStrategy {
         try {
             if (oldValue == null || oldExchange.getProperty(Exchange.AGGREGATED_COLLECTION_GUARD, Boolean.class) == null) {
                 try {
-                    collection = collectionType.newInstance();
+                    collection = collectionType.getDeclaredConstructor().newInstance();
                 } catch (Exception e) {
                     LOG.warn("Could not instantiate collection of type {}. Aborting aggregation.", collectionType);
                     throw CamelExecutionException.wrapCamelExecutionException(oldExchange, e);
diff --git a/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathTest.java b/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathTest.java
index b9c73d6..e8d5a18 100644
--- a/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/builder/xml/XPathTest.java
@@ -300,7 +300,7 @@ public class XPathTest extends ContextTestSupport {
 
         // we may not have Xalan on the classpath
         try {
-            instance = Class.forName("org.apache.xalan.extensions.XPathFunctionResolverImpl").newInstance();
+            instance = Class.forName("org.apache.xalan.extensions.XPathFunctionResolverImpl").getDeclaredConstructor().newInstance();
         } catch (Throwable e) {
             
             log.debug("Could not find Xalan on the classpath so ignoring this test case: " + e);
diff --git a/core/camel-jaxp/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java b/core/camel-jaxp/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
index ce70472..155e066 100644
--- a/core/camel-jaxp/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
+++ b/core/camel-jaxp/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
@@ -913,7 +913,7 @@ public class XmlConverter {
         try {
             Class<?> smClass = ObjectHelper.loadClass("org.apache.xerces.util.SecurityManager");
             if (smClass != null) {
-                Object sm = smClass.newInstance();
+                Object sm = smClass.getDeclaredConstructor().newInstance();
                 // Here we just use the default setting of the SeurityManager
                 factory.setAttribute("http://apache.org/xml/properties/security-manager", sm);
             }
diff --git a/core/camel-jaxp/src/main/java/org/apache/camel/support/builder/xml/XMLConverterHelper.java b/core/camel-jaxp/src/main/java/org/apache/camel/support/builder/xml/XMLConverterHelper.java
index a230f42..8489e41 100644
--- a/core/camel-jaxp/src/main/java/org/apache/camel/support/builder/xml/XMLConverterHelper.java
+++ b/core/camel-jaxp/src/main/java/org/apache/camel/support/builder/xml/XMLConverterHelper.java
@@ -136,7 +136,7 @@ public class XMLConverterHelper {
         try {
             Class<?> smClass = ObjectHelper.loadClass("org.apache.xerces.util.SecurityManager");
             if (smClass != null) {
-                Object sm = smClass.newInstance();
+                Object sm = smClass.getDeclaredConstructor().newInstance();
                 // Here we just use the default setting of the SeurityManager
                 factory.setAttribute("http://apache.org/xml/properties/security-manager", sm);
             }
diff --git a/core/camel-jaxp/src/main/java/org/apache/camel/support/processor/validation/ValidatingProcessor.java b/core/camel-jaxp/src/main/java/org/apache/camel/support/processor/validation/ValidatingProcessor.java
index 97d20fc..f235af2 100644
--- a/core/camel-jaxp/src/main/java/org/apache/camel/support/processor/validation/ValidatingProcessor.java
+++ b/core/camel-jaxp/src/main/java/org/apache/camel/support/processor/validation/ValidatingProcessor.java
@@ -155,7 +155,7 @@ public class ValidatingProcessor extends AsyncProcessorSupport {
                 // must be a local instance to avoid problems with concurrency
                 // (to be
                 // thread safe)
-                ValidatorErrorHandler handler = errorHandler.getClass().newInstance();
+                ValidatorErrorHandler handler = errorHandler.getClass().getDeclaredConstructor().newInstance();
                 validator.setErrorHandler(handler);
 
                 try {
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/LRUCacheFactory.java b/core/camel-support/src/main/java/org/apache/camel/support/LRUCacheFactory.java
index 92727a4..58d7d48 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/LRUCacheFactory.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/LRUCacheFactory.java
@@ -56,7 +56,7 @@ public abstract class LRUCacheFactory {
                 }
                 String clazzName = props.getProperty("class");
                 Class<?> clazz = classLoader.loadClass(clazzName);
-                Object factory = clazz.newInstance();
+                Object factory = clazz.getDeclaredConstructor().newInstance();
                 return (LRUCacheFactory) factory;
             }
         } catch (Throwable t) {
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/ObjectHelper.java b/core/camel-support/src/main/java/org/apache/camel/support/ObjectHelper.java
index db2061d..195b1c7 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/ObjectHelper.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/ObjectHelper.java
@@ -210,8 +210,8 @@ public final class ObjectHelper {
      */
     public static <T> T newInstance(Class<T> type) {
         try {
-            return type.newInstance();
-        } catch (InstantiationException | IllegalAccessException e) {
+            return type.getDeclaredConstructor().newInstance();
+        } catch (Exception e) {
             throw new RuntimeCamelException(e);
         }
     }
@@ -222,11 +222,9 @@ public final class ObjectHelper {
      */
     public static <T> T newInstance(Class<?> actualType, Class<T> expectedType) {
         try {
-            Object value = actualType.newInstance();
+            Object value = actualType.getDeclaredConstructor().newInstance();
             return org.apache.camel.util.ObjectHelper.cast(expectedType, value);
-        } catch (InstantiationException e) {
-            throw new RuntimeCamelException(e);
-        } catch (IllegalAccessException e) {
+        } catch (Exception e) {
             throw new RuntimeCamelException(e);
         }
     }


[camel] 02/05: CAMEL-13681: Property binding support should have support for ignore case in property keys

Posted by da...@apache.org.
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 2eb00b5168889b59c81392531412e9b7406b2f4e
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jun 28 07:43:45 2019 +0200

    CAMEL-13681: Property binding support should have support for ignore case in property keys
---
 .../src/main/java/org/apache/camel/support/IntrospectionSupport.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/core/camel-support/src/main/java/org/apache/camel/support/IntrospectionSupport.java b/core/camel-support/src/main/java/org/apache/camel/support/IntrospectionSupport.java
index 9883396..2b450d6 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/IntrospectionSupport.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/IntrospectionSupport.java
@@ -405,7 +405,9 @@ public final class IntrospectionSupport {
 
     public static Method getPropertyGetter(Class<?> type, String propertyName, boolean ignoreCase) throws NoSuchMethodException {
         if (ignoreCase) {
-            Method[] methods = type.getDeclaredMethods();
+            List<Method> methods = new ArrayList<>();
+            methods.addAll(Arrays.asList(type.getDeclaredMethods()));
+            methods.addAll(Arrays.asList(type.getMethods()));
             for (Method m : methods) {
                 if (isGetter(m)) {
                     if (m.getName().startsWith("is") && m.getName().substring(2).equalsIgnoreCase(propertyName)) {


[camel] 05/05: Fixed test

Posted by da...@apache.org.
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 d717709557fffa9bbb9d9e1f682f18f8623f16f9
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jun 28 08:48:23 2019 +0200

    Fixed test
---
 .../test/java/org/apache/camel/support/PropertyBindingSupportTest.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportTest.java b/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportTest.java
index 5c751df..968961f 100644
--- a/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportTest.java
@@ -318,7 +318,7 @@ public class PropertyBindingSupportTest extends ContextTestSupport {
             PropertyBindingSupport.bindProperty(context, foo, "bar.work", "#class:org.apache.camel.support.Company");
             fail("Should throw exception");
         } catch (PropertyBindingException e) {
-            assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
+            assertIsInstanceOf(IllegalStateException.class, e.getCause());
         }
     }
 


[camel] 03/05: CAMEL-13686: camel-main - Output summary of auto-configuration

Posted by da...@apache.org.
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 6f7c5322e416549bff99a9a6dd3e1956b79530a9
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jun 28 07:49:48 2019 +0200

    CAMEL-13686: camel-main - Output summary of auto-configuration
---
 .../src/main/java/org/apache/camel/main/MainSupport.java         | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
index 72a6873..2a547f4 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
@@ -760,7 +760,14 @@ public abstract class MainSupport extends ServiceSupport {
         // log summary of configurations
         if (!autoConfiguredProperties.isEmpty()) {
             LOG.info("Auto-configuration summary:");
-            autoConfiguredProperties.forEach((k, v) -> LOG.info("\t{}={}", k, v));
+            autoConfiguredProperties.forEach((k, v) -> {
+                boolean sensitive = k.toLowerCase(Locale.US).contains("password") || k.contains("secret") || k.contains("passphrase") || k.contains("token");
+                if (sensitive) {
+                    LOG.info("\t{}=xxxxxx", k);
+                } else {
+                    LOG.info("\t{}={}", k, v);
+                }
+            });
         }
 
         // try to load the route builders