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/05/24 10:13:03 UTC

[camel] 23/27: CAMEL-13569: JndiContext - Remove old bean binding

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 9f90947b8c0be446f918ab196bb3e95767569472
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri May 24 10:30:23 2019 +0200

    CAMEL-13569: JndiContext - Remove old bean binding
---
 .../src/test/resources/jndi-example.properties     |  4 ----
 .../apache/camel/support/IntrospectionSupport.java |  2 +-
 .../org/apache/camel/support/jndi/JndiContext.java | 23 +---------------------
 3 files changed, 2 insertions(+), 27 deletions(-)

diff --git a/core/camel-core/src/test/resources/jndi-example.properties b/core/camel-core/src/test/resources/jndi-example.properties
index d2e1869..3807dfc 100644
--- a/core/camel-core/src/test/resources/jndi-example.properties
+++ b/core/camel-core/src/test/resources/jndi-example.properties
@@ -21,8 +21,4 @@ java.naming.factory.initial = org.apache.camel.support.jndi.CamelInitialContextF
 # the following properties will be copied into the context
 foo = bar
 
-example.class = org.apache.camel.support.jndi.ExampleBean
-example.name = James
-example.price = 2.34
-
 # END SNIPPET: jndi
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 17d8d79..c238b85 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
@@ -602,7 +602,7 @@ public final class IntrospectionSupport {
                         return true;
                     } else {
                         // We need to convert it
-                        Object convertedValue = typeConverter.convertTo(parameterType, ref);
+                        Object convertedValue = typeConverter != null ? typeConverter.convertTo(parameterType, ref) : ref;
                         // we may want to set options on classes that has package view visibility, so override the accessible
                         setter.setAccessible(true);
                         setter.invoke(target, convertedValue);
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/jndi/JndiContext.java b/core/camel-support/src/main/java/org/apache/camel/support/jndi/JndiContext.java
index 694080d..caca560 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/jndi/JndiContext.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/jndi/JndiContext.java
@@ -96,28 +96,7 @@ public class JndiContext implements Context, Serializable {
      * properties set on the injected bean
      */
     public static Map<String, Object> createBindingsMapFromEnvironment(Hashtable<String, Object> env) throws Exception {
-        Map<String, Object> answer = new HashMap<>(env);
-
-        for (Map.Entry<String, Object> entry : env.entrySet()) {
-            String key = entry.getKey();
-            Object value = entry.getValue();
-
-            if (key != null && value instanceof String) {
-                String valueText = (String)value;
-                if (key.endsWith(".class")) {
-                    Class<?> type = org.apache.camel.util.ObjectHelper.loadClass(valueText);
-                    if (type != null) {
-                        String newEntry = key.substring(0, key.length() - ".class".length());
-                        Object bean = createBean(type, answer, newEntry + ".");
-                        if (bean != null) {
-                            answer.put(newEntry, bean);
-                        }
-                    }
-                }
-            }
-        }
-
-        return answer;
+        return new HashMap<>();
     }
 
     public void freeze() {