/** Figure out which ClassLoader to use. For JDK 1.2 and later use the context ClassLoader. */ static ClassLoader findClassLoader() throws ConfigurationError { SecuritySupport ss = SecuritySupport.getInstance(); // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader context = ss.getContextClassLoader(); ClassLoader system = ss.getSystemClassLoader(); ClassLoader chain = system; while (true) { if (context == chain) { // Assert: we are on JDK 1.1 or we have no Context ClassLoader // or any Context ClassLoader in chain of system classloader // (including extension ClassLoader) so extend to widest // ClassLoader (always look in system ClassLoader if Xalan // is in boot/extension/system classpath and in current // ClassLoader otherwise); normal classloaders delegate // back to system ClassLoader first so this widening doesn't // change the fact that context ClassLoader will be consulted ClassLoader current = ObjectFactory.class.getClassLoader(); chain = system; while (true) { if (current == chain) { // Assert: Current ClassLoader in chain of // boot/extension/system ClassLoaders return system; } if (chain == null) { break; } chain = ss.getParentClassLoader(chain); } // Assert: Current ClassLoader not in chain of // boot/extension/system ClassLoaders return current; } if (chain == null) { // boot ClassLoader reached break; } // Check for any extension ClassLoaders in chain up to // boot ClassLoader chain = ss.getParentClassLoader(chain); } ; // Assert: Context ClassLoader not in chain of // boot/extension/system ClassLoaders return context; } // findClassLoader():ClassLoader
/* 192: */ /* 193: */ static ClassLoader findClassLoader() /* 194: */ throws ObjectFactory.ConfigurationError /* 195: */ { /* 196:396 */ SecuritySupport ss = SecuritySupport.getInstance(); /* 197: */ /* 198: */ /* 199: */ /* 200:400 */ ClassLoader context = ss.getContextClassLoader(); /* 201:401 */ ClassLoader system = ss.getSystemClassLoader(); /* 202: */ /* 203:403 */ ClassLoader chain = system; /* 204: */ for (; ; ) /* 205: */ { /* 206:405 */ if (context == chain) /* 207: */ { /* 208:414 */ ClassLoader current = ObjectFactory.class.getClassLoader(); /* 209: */ /* 210:416 */ chain = system; /* 211: */ for (; ; ) /* 212: */ { /* 213:418 */ if (current == chain) { /* 214:421 */ return system; /* 215: */ } /* 216:423 */ if (chain == null) { /* 217: */ break; /* 218: */ } /* 219:426 */ chain = ss.getParentClassLoader(chain); /* 220: */ } /* 221:431 */ return current; /* 222: */ } /* 223:434 */ if (chain == null) { /* 224: */ break; /* 225: */ } /* 226:441 */ chain = ss.getParentClassLoader(chain); /* 227: */ } /* 228:446 */ return context; /* 229: */ }