Retrieves the naming context bound to a class loader. @return the naming context bound to current class loader or one of its parents @throws NamingException If no naming context was bound
()
| 250 | * @throws NamingException If no naming context was bound |
| 251 | */ |
| 252 | public static Context getClassLoader() throws NamingException { |
| 253 | ClassLoader cl = Thread.currentThread().getContextClassLoader(); |
| 254 | Context context; |
| 255 | do { |
| 256 | context = clBindings.get(cl); |
| 257 | if (context != null) { |
| 258 | return context; |
| 259 | } |
| 260 | } while ((cl = cl.getParent()) != null); |
| 261 | throw new NamingException(sm.getString("contextBindings.noContextBoundToCL")); |
| 262 | } |
| 263 | |
| 264 | |
| 265 | /** |
no test coverage detected