Author: davsclaus
Date: Thu Jul 10 21:33:02 2008
New Revision: 675832

URL: http://svn.apache.org/viewvc?rev=675832&view=rev
Log:
CAMEL-693: Should skip OSGi virutal bundles. Partly applied patch with thanks 
to Freeman.

Modified:
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ResolverUtil.java

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ResolverUtil.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ResolverUtil.java?rev=675832&r1=675831&r2=675832&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ResolverUtil.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ResolverUtil.java
 Thu Jul 10 21:33:02 2008
@@ -280,11 +280,12 @@
 
     protected void find(Test test, String packageName, ClassLoader loader) {
         if (LOG.isTraceEnabled()) {
-            LOG.trace("Searching for: " + test + " in package: " + packageName 
+ " using classloader: " 
+            LOG.trace("Searching for: " + test + " in package: " + packageName 
+ " using classloader: "
                     + loader.getClass().getName());
         }
         if (loader.getClass().getName().endsWith(
                 "org.apache.felix.framework.searchpolicy.ContentClassLoader")) 
{
+            LOG.trace("This is not an URL classloader, skipping");
             //this classloader is in OSGI env which is not URLClassloader, we 
should resort to the
             //BundleDelegatingClassLoader in OSGI, so just return
             return;
@@ -324,12 +325,21 @@
 
                 String urlPath = url.getFile();
                 urlPath = URLDecoder.decode(urlPath, "UTF-8");
+                if (LOG.isTraceEnabled()) {
+                    LOG.trace("Decoded urlPath: " + urlPath);
+                }
 
                 // If it's a file in a directory, trim the stupid file: spec
                 if (urlPath.startsWith("file:")) {
                     urlPath = urlPath.substring(5);
                 }
 
+                // osgi bundles should be skipped
+                if (urlPath.startsWith("bundle:")) {
+                    LOG.trace("It's a virtual osgi bundle, skipping");
+                    continue;
+                }
+
                 // Else it's in a JAR, grab the path to the jar
                 if (urlPath.indexOf('!') > 0) {
                     urlPath = urlPath.substring(0, urlPath.indexOf('!'));


Reply via email to