servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject [4/9] servicemix-bundles git commit: [SM-2558]use TCCL as fallback classloader for the SwaggerContext
Date Mon, 25 May 2015 06:29:49 GMT
[SM-2558]use TCCL as fallback classloader for the SwaggerContext


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

Branch: refs/heads/master
Commit: ed7d9262eaf2329b4aef5c7f879ea3f323914e9f
Parents: 9d9da50
Author: Freeman Fang <freeman.fang@gmail.com>
Authored: Mon May 25 14:26:29 2015 +0800
Committer: Freeman Fang <freeman.fang@gmail.com>
Committed: Mon May 25 14:26:29 2015 +0800

----------------------------------------------------------------------
 .../main/scala/com/wordnik/swagger/core/SwaggerContext.scala | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/servicemix-bundles/blob/ed7d9262/swagger-core-1.3.7/src/main/scala/com/wordnik/swagger/core/SwaggerContext.scala
----------------------------------------------------------------------
diff --git a/swagger-core-1.3.7/src/main/scala/com/wordnik/swagger/core/SwaggerContext.scala
b/swagger-core-1.3.7/src/main/scala/com/wordnik/swagger/core/SwaggerContext.scala
index 0924949..c029dc5 100644
--- a/swagger-core-1.3.7/src/main/scala/com/wordnik/swagger/core/SwaggerContext.scala
+++ b/swagger-core-1.3.7/src/main/scala/com/wordnik/swagger/core/SwaggerContext.scala
@@ -12,7 +12,10 @@ object SwaggerContext {
   registerClassLoader(this.getClass.getClassLoader)
   registerClassLoader(Thread.currentThread().getContextClassLoader())
 
-  def registerClassLoader(cl: ClassLoader) = this.classLoaders += cl
+  def registerClassLoader(cl: ClassLoader) = { 
+    this.classLoaders += cl
+    LOGGER.debug("======>register classloader " + cl);
+  }
 
   def loadClass(name: String) = {
     var cls: Class[_] = null
@@ -26,6 +29,9 @@ object SwaggerContext {
         }
       }
     }
+    //use TCCL as fallback
+    registerClassLoader(Thread.currentThread().getContextClassLoader())
+    cls = Class.forName(name.trim, true, Thread.currentThread().getContextClassLoader())
     if (cls == null)
       throw new ClassNotFoundException("class " + name + " not found")
     cls


Mime
View raw message