camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] git commit: CAMEL-7121: OsgiClassLoader should compact path like the default classloader does. Upgraded to karaf 2.3.5 and latest aws.
Date Tue, 29 Apr 2014 08:46:14 GMT
Repository: camel
Updated Branches:
  refs/heads/master 0a60bfdf1 -> f8b27d919


CAMEL-7121: OsgiClassLoader should compact path like the default classloader does. Upgraded
to karaf 2.3.5 and latest aws.


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

Branch: refs/heads/master
Commit: cbcf4c0a4d6ac10f82aa2a8cac65b7136adb46ce
Parents: 0a60bfd
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Apr 29 10:32:48 2014 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Apr 29 10:46:06 2014 +0200

----------------------------------------------------------------------
 .../camel/core/osgi/OsgiClassResolver.java      | 28 +++++++++++++++++---
 parent/pom.xml                                  |  6 ++---
 .../camel/itest/karaf/AbstractFeatureTest.java  |  2 +-
 .../itest/osgi/OSGiIntegrationTestSupport.java  |  2 +-
 4 files changed, 29 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/cbcf4c0a/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 66c4008..297e1f5 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
@@ -65,7 +65,9 @@ public class OsgiClassResolver extends DefaultClassResolver {
     @Override
     public InputStream loadResourceAsStream(String uri) {
         ObjectHelper.notEmpty(uri, "uri");
-        URL url = loadResourceAsURL(uri);
+
+        String resolvedName = resolveUriPath(uri);
+        URL url = loadResourceAsURL(resolvedName);
         InputStream answer = null;
         if (url != null) {
             try {
@@ -80,14 +82,16 @@ public class OsgiClassResolver extends DefaultClassResolver {
     @Override
     public URL loadResourceAsURL(String uri) {
         ObjectHelper.notEmpty(uri, "uri");
-        return bundleContext.getBundle().getResource(uri);
+        String resolvedName = resolveUriPath(uri);
+        return bundleContext.getBundle().getResource(resolvedName);
     }
 
     @Override
     public Enumeration<URL> loadResourcesAsURL(String uri) {
         ObjectHelper.notEmpty(uri, "uri");
         try {
-            return bundleContext.getBundle().getResources(uri);
+            String resolvedName = resolveUriPath(uri);
+            return bundleContext.getBundle().getResources(resolvedName);
         } catch (IOException e) {
             throw new RuntimeException("Cannot load resource: " + uri, e);
         }
@@ -99,7 +103,9 @@ public class OsgiClassResolver extends DefaultClassResolver {
         Vector<URL> answer = new Vector<URL>();
 
         try {
-            Enumeration<URL> e = bundleContext.getBundle().getResources(uri);
+            String resolvedName = resolveUriPath(uri);
+
+            Enumeration<URL> e = bundleContext.getBundle().getResources(resolvedName);
             while (e != null && e.hasMoreElements()) {
                 answer.add(e.nextElement());
             }
@@ -137,5 +143,19 @@ public class OsgiClassResolver extends DefaultClassResolver {
         }
         return answer;
     }
+
+    /**
+     * Helper operation used to remove relative path notation from
+     * resources.  Most critical for resources on the Classpath
+     * as resource loaders will not resolve the relative paths correctly.
+     *
+     * @param name the name of the resource to load
+     * @return the modified or unmodified string if there were no changes
+     */
+    private static String resolveUriPath(String name) {
+        // compact the path and use / as separator as that's used for loading resources on
the classpath
+        return FileUtil.compactPath(name, '/');
+    }
+
     
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/cbcf4c0a/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index c2c31e9..ac4fc00 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -59,8 +59,8 @@
     <avalon-version>4.3.1</avalon-version>
     <avro-version>1.7.6</avro-version>
     <avro-bundle-version>1.7.6_1</avro-bundle-version>
-    <aws-java-sdk-bundle-version>1.7.1_1</aws-java-sdk-bundle-version>
-    <aws-java-sdk-version>1.7.1</aws-java-sdk-version>
+    <aws-java-sdk-bundle-version>1.7.5_1</aws-java-sdk-bundle-version>
+    <aws-java-sdk-version>1.7.5</aws-java-sdk-version>
     <axiom-version>1.2.14</axiom-version>
     <backport-util-concurrent-version>3.1</backport-util-concurrent-version>
     <bcel-bundle-version>5.2_4</bcel-bundle-version>
@@ -258,7 +258,7 @@
     <jython-version>2.5.3</jython-version>
     <kafka-version>0.8.1</kafka-version>
     <kafka-bundle-version>0.8.1_1</kafka-bundle-version>
-    <karaf-version>2.3.3</karaf-version>
+    <karaf-version>2.3.5</karaf-version>
     <kie-version>6.0.0.Final</kie-version>
     <krati-version>0.4.9</krati-version>
     <kxml2-bundle-version>2.3.0_2</kxml2-bundle-version>

http://git-wip-us.apache.org/repos/asf/camel/blob/cbcf4c0a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java
b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java
index f0de40a..adae8ee 100644
--- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java
+++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java
@@ -159,7 +159,7 @@ public abstract class AbstractFeatureTest {
             new Option[]{
                 karafDistributionConfiguration().frameworkUrl(
                     maven().groupId("org.apache.karaf").artifactId("apache-karaf").type("tar.gz").versionAsInProject())
-                    .karafVersion("2.3.3").name("Apache Karaf")
+                    .karafVersion("2.3.5").name("Apache Karaf")
                     .unpackDirectory(new File("target/paxexam/unpack/")),
                 
                 KarafDistributionOption.keepRuntimeFolder(),

http://git-wip-us.apache.org/repos/asf/camel/blob/cbcf4c0a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java
b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java
index 088f10c..3a80643 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java
@@ -132,7 +132,7 @@ public class OSGiIntegrationTestSupport extends CamelTestSupport {
             new Option[] {
                       karafDistributionConfiguration()
                           .frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf").type("tar.gz").versionAsInProject())
-                          .karafVersion("2.3.3")
+                          .karafVersion("2.3.5")
                           .name("Apache Karaf")
                           .useDeployFolder(false).unpackDirectory(new File("target/paxexam/unpack/")),
 


Mime
View raw message