camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1051019 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java components/camel-spring/src/test/java/org/apache/camel/spring/scan/DefaultPackageScanClassResolverTest.java
Date Mon, 20 Dec 2010 08:37:25 GMT
Author: davsclaus
Date: Mon Dec 20 08:37:25 2010
New Revision: 1051019

URL: http://svn.apache.org/viewvc?rev=1051019&view=rev
Log:
CAMEL-3442: Fixed test.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/DefaultPackageScanClassResolverTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java?rev=1051019&r1=1051018&r2=1051019&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java
Mon Dec 20 08:37:25 2010
@@ -59,13 +59,13 @@ public class DefaultPackageScanClassReso
             ClassLoader ccl = Thread.currentThread().getContextClassLoader();
             if (ccl != null) {
                 if (log.isTraceEnabled()) {
-                    log.trace("The thread context class loader: " + ccl + "  is used to load
the class");
+                    log.trace("Adding ContextClassLoader from current thread: " + ccl);
                 }
                 classLoaders.add(ccl);
             }
-        } catch (UnsupportedOperationException ex) {
-            // Ignore this exception as the PackageScanClassResolver
-            // don't want use any other classloader
+        } catch (Exception e) {
+            // Ignore this exception
+            log.warn("Cannot add ContextClassLoader from current thread due " + e.getMessage()
+ ". This exception will be ignored.");
         }
 
         classLoaders.add(DefaultPackageScanClassResolver.class.getClassLoader());

Modified: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/DefaultPackageScanClassResolverTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/DefaultPackageScanClassResolverTest.java?rev=1051019&r1=1051018&r2=1051019&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/DefaultPackageScanClassResolverTest.java
(original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/DefaultPackageScanClassResolverTest.java
Mon Dec 20 08:37:25 2010
@@ -139,6 +139,9 @@ public class DefaultPackageScanClassReso
 
             Thread.currentThread().setContextClassLoader(classLoader);
 
+            // recreate resolver since we mess with context class loader
+            resolver = new DefaultPackageScanClassResolver();
+
             filter.addIncludePattern("a.*.c.*");
             resolver.addFilter(filter);
             Set<Class<?>> scanned = resolver.findByFilter(filter, "a.b.c");
@@ -162,6 +165,9 @@ public class DefaultPackageScanClassReso
 
             Thread.currentThread().setContextClassLoader(classLoader);
 
+            // recreate resolver since we mess with context class loader
+            resolver = new DefaultPackageScanClassResolver();
+
             filter.addIncludePattern("a.*.c.*");
             resolver.addFilter(filter);
             Set<Class<?>> scanned = resolver.findByFilter(filter, "a.b.c");



Mime
View raw message