@Test public void testClassForName() throws Exception { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); assertNotNull(contextClassLoader); try { Class<?> clazz = ReflectionUtil.classForName("org.hibernate.tool.util.ReflectionUtil"); assertSame(ReflectionUtil.class, clazz); Thread.currentThread().setContextClassLoader(null); clazz = ReflectionUtil.classForName("org.hibernate.tool.util.ReflectionUtil"); assertSame(ReflectionUtil.class, clazz); } finally { Thread.currentThread().setContextClassLoader(contextClassLoader); } }
public static Class<?> classForName(String name) throws ClassNotFoundException { try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if ( classLoader != null ) { return classLoader.loadClass(name); } } catch ( Throwable ignore ) {} return Class.forName( name ); }
ReflectionUtil { public static Class<?> classForName(String name) throws ClassNotFoundException { try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if ( classLoader != null ) { return classLoader.loadClass(name); } } catch ( Throwable ignore ) {} return Class.forName( name ); } }
ReflectionUtil { public static Class<?> classForName(String name) throws ClassNotFoundException { try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if ( classLoader != null ) { return classLoader.loadClass(name); } } catch ( Throwable ignore ) {} return Class.forName( name ); }  }
ReflectionUtil { public static Class<?> classForName(String name) throws ClassNotFoundException { try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if ( classLoader != null ) { return classLoader.loadClass(name); } } catch ( Throwable ignore ) {} return Class.forName( name ); }  static Class<?> classForName(String name); }
ReflectionUtil { public static Class<?> classForName(String name) throws ClassNotFoundException { try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if ( classLoader != null ) { return classLoader.loadClass(name); } } catch ( Throwable ignore ) {} return Class.forName( name ); }  static Class<?> classForName(String name);  }