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

lburgazzoli 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 3a46a2f  CAMEL-15003: PropertyBindingSupport fails for anonymous 
classes
3a46a2f is described below

commit 3a46a2f4e1bd9c156e231db4a080459e0cafef0a
Author: lburgazzoli <[email protected]>
AuthorDate: Mon May 4 10:01:40 2020 +0200

    CAMEL-15003: PropertyBindingSupport fails for anonymous classes
---
 .../camel/support/PropertyBindingSupportConfigurerTest.java  | 12 +++++++++++-
 .../org/apache/camel/support/PropertyBindingSupport.java     |  7 +++++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git 
a/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportConfigurerTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportConfigurerTest.java
index 431c6ce..dc1b01f 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportConfigurerTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportConfigurerTest.java
@@ -151,6 +151,16 @@ public class PropertyBindingSupportConfigurerTest extends 
ContextTestSupport {
         }
     }
 
+    @Test
+    public void testConfigurerShouldNotFailForAnonymousClasses() throws 
Exception {
+        
PropertyBindingSupport.autowireSingletonPropertiesFromRegistry(context, new 
Bar() {
+            @Override
+            public int getAge() {
+                return super.getAge();
+            }
+        });
+    }
+
     public static class Bar {
         private int age;
         private boolean rider;
@@ -199,7 +209,7 @@ public class PropertyBindingSupportConfigurerTest extends 
ContextTestSupport {
         }
     }
 
-    private class MyConfigurer implements GeneratedPropertyConfigurer {
+    private static class MyConfigurer implements GeneratedPropertyConfigurer {
 
         private int counter;
 
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 42dc7da..df84e27 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
@@ -364,8 +364,11 @@ public final class PropertyBindingSupport {
                 // special for camel context itself as we have an extended 
configurer
                 name = "ExtendedCamelContext";
             }
-            // see if there is a configurer for it
-            configurer = 
camelContext.adapt(ExtendedCamelContext.class).getConfigurerResolver().resolvePropertyConfigurer(name,
 camelContext);
+
+            if (isNotEmpty(name)) {
+                // see if there is a configurer for it
+                configurer = 
camelContext.adapt(ExtendedCamelContext.class).getConfigurerResolver().resolvePropertyConfigurer(name,
 camelContext);
+            }
         }
 
         // use configurer to get all the current options and its values

Reply via email to