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/03/30 07:13:10 UTC

[camel-karaf] branch master updated: Fixed NPE

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-karaf.git


The following commit(s) were added to refs/heads/master by this push:
     new 16d20f1  Fixed NPE
16d20f1 is described below

commit 16d20f16508e1e5ead946411ed31da7e3e10b359
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Mar 30 09:12:49 2020 +0200

    Fixed NPE
---
 .../org/apache/camel/core/osgi/OsgiTypeConverter.java    | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/core/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiTypeConverter.java b/core/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiTypeConverter.java
index 6354cf7..29b5796 100644
--- a/core/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiTypeConverter.java
+++ b/core/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiTypeConverter.java
@@ -79,14 +79,16 @@ public class OsgiTypeConverter extends ServiceSupport implements TypeConverter,
     public Object addingService(ServiceReference<TypeConverterLoader> serviceReference) {
         LOG.trace("AddingService: {}, Bundle: {}", serviceReference, serviceReference.getBundle());        
         TypeConverterLoader loader = bundleContext.getService(serviceReference);
-        try {
-            LOG.debug("loading type converter from bundle: {}", serviceReference.getBundle().getSymbolicName());
-            if (delegate != null) {
-                ServiceHelper.startService(this.delegate);
-                loader.load(delegate);
+        if (loader != null) {
+            try {
+                LOG.debug("loading type converter from bundle: {}", serviceReference.getBundle().getSymbolicName());
+                if (delegate != null) {
+                    ServiceHelper.startService(this.delegate);
+                    loader.load(delegate);
+                }
+            } catch (Throwable t) {
+                throw new RuntimeCamelException("Error loading type converters from service: " + serviceReference + " due: " + t.getMessage(), t);
             }
-        } catch (Throwable t) {
-            throw new RuntimeCamelException("Error loading type converters from service: " + serviceReference + " due: " + t.getMessage(), t);
         }
        
         return loader;