camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: CAMEL-8261: spring-dm may not be able to load resources from classpath from camel-core
Date Thu, 22 Jan 2015 10:28:12 GMT
CAMEL-8261: spring-dm may not be able to load resources from classpath from camel-core


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/81325f03
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/81325f03
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/81325f03

Branch: refs/heads/master
Commit: 81325f0326b7267160b315724225c720c278d4dd
Parents: d8be337
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu Jan 22 11:25:55 2015 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu Jan 22 11:25:55 2015 +0100

----------------------------------------------------------------------
 .../apache/camel/core/osgi/OsgiClassResolver.java    | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/81325f03/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiClassResolver.java
----------------------------------------------------------------------
diff --git a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiClassResolver.java
b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiClassResolver.java
index 2e07458..5094dd7 100644
--- a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiClassResolver.java
+++ b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiClassResolver.java
@@ -88,7 +88,12 @@ public class OsgiClassResolver extends DefaultClassResolver {
             } catch (IOException ex) {
                 throw new RuntimeException("Cannot load resource: " + uri, ex);
             }
-        } 
+        }
+
+        // fallback to default as spring-dm may have issues loading resources
+        if (answer == null) {
+            answer = super.loadResourceAsStream(uri);
+        }
         return answer;
     }
 
@@ -96,7 +101,13 @@ public class OsgiClassResolver extends DefaultClassResolver {
     public URL loadResourceAsURL(String uri) {
         ObjectHelper.notEmpty(uri, "uri");
         String resolvedName = resolveUriPath(uri);
-        return bundleContext.getBundle().getResource(resolvedName);
+        URL answer = bundleContext.getBundle().getResource(resolvedName);
+
+        // fallback to default as spring-dm may have issues loading resources
+        if (answer == null) {
+            answer = super.loadResourceAsURL(uri);
+        }
+        return answer;
     }
 
     @Override


Mime
View raw message