Attempt to load a class using the given Container's class loader. If the class cannot be loaded, a debug level log message will be written to the Container's log and null will be returned. @param context The class loader of this context will be used to attempt to load the class @param className T
(Context context, String className)
| 87 | * @return the loaded class or <code>null</code> if loading failed |
| 88 | */ |
| 89 | public static Class<?> loadClass(Context context, String className) { |
| 90 | ClassLoader cl = context.getLoader().getClassLoader(); |
| 91 | Log log = context.getLogger(); |
| 92 | Class<?> clazz = null; |
| 93 | try { |
| 94 | clazz = cl.loadClass(className); |
| 95 | } catch (ClassNotFoundException | NoClassDefFoundError | ClassFormatError e) { |
| 96 | log.debug(sm.getString("introspection.classLoadFailed", className), e); |
| 97 | } catch (Throwable t) { |
| 98 | ExceptionUtils.handleThrowable(t); |
| 99 | log.debug(sm.getString("introspection.classLoadFailed", className), t); |
| 100 | } |
| 101 | return clazz; |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * Converts the primitive type to its corresponding wrapper. |
no test coverage detected