geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickmcgu...@apache.org
Subject svn commit: r399294 - /geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/Session.java
Date Wed, 03 May 2006 13:28:46 GMT
Author: rickmcguire
Date: Wed May  3 06:28:41 2006
New Revision: 399294

URL: http://svn.apache.org/viewcvs?rev=399294&view=rev
Log:
GERONIMO-1973  javamail Session class using wrong classloader search sequence for resolving
providers.


Modified:
    geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/Session.java

Modified: geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/Session.java
URL: http://svn.apache.org/viewcvs/geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/Session.java?rev=399294&r1=399293&r2=399294&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/Session.java (original)
+++ geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/Session.java Wed
May  3 06:28:41 2006
@@ -465,7 +465,7 @@
         return info;
     }
 
-    private static Map getAddressMap() {
+    private Map getAddressMap() {
         ClassLoader cl = getClassLoader();
         Map addressMap = (Map)addressMapsByClassLoader.get(cl);
         if (addressMap == null) {
@@ -475,10 +475,24 @@
     }
 
 
-    private static ClassLoader getClassLoader() {
+    /**
+     * Resolve a class loader used to resolve context resources.  The
+     * class loader used is either a current thread context class
+     * loader (if set), the class loader used to load an authenticator
+     * we've been initialized with, or the class loader used to load
+     * this class instance (which may be a subclass of Session).
+     *
+     * @return The class loader used to load resources.
+     */
+    private ClassLoader getClassLoader() {
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         if (cl == null) {
-            cl = Session.class.getClassLoader();
+            if (authenticator != null) {
+                cl = authenticator.getClass().getClassLoader();
+            }
+            else {
+                cl = this.getClass().getClassLoader();
+            }
         }
         return cl;
     }



Mime
View raw message