private Class<?> resolveClassByClassResolver(String className) { Class<?> resolvedClass = null; try { resolvedClass = classResolver.resolveClass(className); } catch (WicketRuntimeException ex) { // Ignore } catch (ClassNotFoundException e) { // Ignore } return resolvedClass; } }
private Class<?> resolveClassByClassResolver(String className) { Class<?> resolvedClass = null; try { resolvedClass = classResolver.resolveClass(className); } catch (WicketRuntimeException ex) { // Ignore } catch (ClassNotFoundException e) { // Ignore } return resolvedClass; } }
private Class<?> resolveClassByClassResolver(String className) { Class<?> resolvedClass = null; try { resolvedClass = classResolver.resolveClass(className); } catch (WicketRuntimeException ex) { // Ignore } catch (ClassNotFoundException e) { // Ignore } return resolvedClass; } }
/** {@inheritDoc} */ public Class<?> resolveClass(final String classname) throws ClassNotFoundException { LOGGER.trace("Try to resolve {} from {} resolvers", classname, resolvers.size()); for (IClassResolver resolver : resolvers) { try { Class<?> candidate = resolver.resolveClass(classname); if (candidate != null) { return candidate; } } catch (ClassNotFoundException e) { LOGGER.trace("ClassResolver {} could not find class: {}", resolver, classname); } catch (RuntimeException e) { LOGGER.warn("ClassResolver {} threw an unexpected exception.", resolver, e); } } throw new ClassNotFoundException(String.format("Class [%s] can't be resolved.", classname)); }
/** {@inheritDoc} */ public Class<?> resolveClass(final String classname) throws ClassNotFoundException { LOGGER.trace("Try to resolve {} from {} resolvers", classname, resolvers.size()); for (IClassResolver resolver : resolvers) { try { Class<?> candidate = resolver.resolveClass(classname); if (candidate != null) { return candidate; } } catch (ClassNotFoundException e) { LOGGER.trace("ClassResolver {} could not find class: {}", resolver, classname); } catch (RuntimeException e) { LOGGER.warn("ClassResolver {} threw an unexpected exception.", resolver, e); } } throw new ClassNotFoundException(String.format("Class [%s] can't be resolved.", classname)); }
public Class<?> resolveClass(final String classname) throws ClassNotFoundException { synchronized (resolvers) { LOGGER.trace("Try to resolve {} from {} resolvers", classname, resolvers.size()); for (IClassResolver resolver : resolvers) { try { Class<?> candidate = resolver.resolveClass(classname); if (candidate != null) { return candidate; } } catch (ClassNotFoundException e) { LOGGER.trace("ClassResolver {} could not find class: {}", resolver, classname); } catch (RuntimeException e) { LOGGER.warn("ClassResolver {} threw an unexpected exception.", resolver, e); } } } throw new ClassNotFoundException(String.format("Class [%s] can't be resolved.", classname)); }
@Override public Class resolveClass(String name) throws ClassNotFoundException { if (Session.exists()) { UserSession session = UserSession.get(); ClassLoader loader = session.getClassLoader(); if (loader != null) { return session.getClassLoader().loadClass(name); } } return originalResolver.resolveClass(name); }
private Object readResolve() throws ObjectStreamException { Class<?> clazz; try { Application application = WebApplication.get(); IApplicationSettings appSettings = application.getApplicationSettings(); IClassResolver classResolver = appSettings.getClassResolver(); clazz = classResolver.resolveClass(type); } catch (ClassNotFoundException e) { throw new InvalidClassException(type, "could not resolve class [" + type + "] when deserializing proxy"); } ClassLoader currentClassloader = Thread.currentThread().getContextClassLoader(); try { ClassLoader classLoader = clazz.getClassLoader(); if (locator != null && locator.getParent() != null) { classLoader = locator.getParent().getClassLoader(); } if (classLoader != null) { Thread.currentThread().setContextClassLoader(classLoader); } return LazyInitProxyFactory.createProxy(clazz, locator); } finally { Thread.currentThread().setContextClassLoader(currentClassloader); } } }
private Object readResolve() throws ObjectStreamException { Class<?> clazz; try { Application application = WebApplication.get(); ApplicationSettings appSettings = application.getApplicationSettings(); IClassResolver classResolver = appSettings.getClassResolver(); clazz = classResolver.resolveClass(type); } catch (ClassNotFoundException e) { throw new InvalidClassException(type, "could not resolve class [" + type + "] when deserializing proxy"); } ClassLoader currentClassloader = Thread.currentThread().getContextClassLoader(); try { ClassLoader classLoader = clazz.getClassLoader(); if (locator != null && locator.getParent() != null) { classLoader = locator.getParent().getClassLoader(); } if (classLoader != null) { Thread.currentThread().setContextClassLoader(classLoader); } return LazyInitProxyFactory.createProxy(clazz, locator); } finally { Thread.currentThread().setContextClassLoader(currentClassloader); } } }
private Object readResolve() throws ObjectStreamException { Class<?> clazz; try { Application application = WebApplication.get(); ApplicationSettings appSettings = application.getApplicationSettings(); IClassResolver classResolver = appSettings.getClassResolver(); clazz = classResolver.resolveClass(type); } catch (ClassNotFoundException e) { throw new InvalidClassException(type, "could not resolve class [" + type + "] when deserializing proxy"); } ClassLoader currentClassloader = Thread.currentThread().getContextClassLoader(); try { ClassLoader classLoader = clazz.getClassLoader(); if (locator != null && locator.getParent() != null) { classLoader = locator.getParent().getClassLoader(); } if (classLoader != null) { Thread.currentThread().setContextClassLoader(classLoader); } return LazyInitProxyFactory.createProxy(clazz, locator); } finally { Thread.currentThread().setContextClassLoader(currentClassloader); } } }
.getApplicationSettings() .getClassResolver() .resolveClass(className);
.getApplicationSettings() .getClassResolver() .resolveClass(className);
/** * @param className * Class to resolve * @return Resolved class */ public static Class resolveClass(final String className) { if (className == null) { return null; } try { if (Application.exists()) { return Application.get().getApplicationSettings().getClassResolver().resolveClass( className); } return Class.forName(className); } catch (ClassNotFoundException e) { log.warn("Could not resolve class: " + className); return null; } }
/** * Gets the {@link Class} stored in this reference * * @return */ @SuppressWarnings("unchecked") public Class<? extends T> get() { Class<? extends T> clazz = cache != null ? cache.get() : null; if (clazz == null) { try { clazz = (Class<? extends T>)Application.get() .getApplicationSettings() .getClassResolver() .resolveClass(name); } catch (ClassNotFoundException e) { throw new RuntimeException("Could not resolve class: " + name, e); } cache(clazz); } return clazz; }
private boolean isPackageClass(String lastSegment) { String fqcn = packageName + '.' + lastSegment; Class resolved = null; try { if (Application.exists()) { resolved = Application.get() .getApplicationSettings() .getClassResolver() .resolveClass(fqcn); } if (resolved == null) { resolved = Class.forName(fqcn, false, Thread.currentThread() .getContextClassLoader()); } return true; } catch (Exception e) { return false; } }
try candidate = classResolver.resolveClass(className); if (candidate == null)
/** * replacement for {@link Classes}.resolveClass(String) * * @param <T> * class type * @param className * Class to resolve * @return Resolved class */ @SuppressWarnings("unchecked") public static <T> Class<T> resolveClass(final String className) { if (className == null) { return null; } try { if (Application.exists()) { return (Class<T>) Application.get().getApplicationSettings().getClassResolver().resolveClass(className); } return (Class<T>) Class.forName(className); } catch (ClassNotFoundException e) { log.warn("Could not resolve class: " + className); return null; } }
/** * @param <T> * class type * @param className * Class to resolve * @return Resolved class * @throws ClassNotFoundException */ @SuppressWarnings("unchecked") public static <T> Class<T> resolveClass(final String className) throws ClassNotFoundException { if (Application.exists()) { return (Class<T>)Application.get() .getApplicationSettings() .getClassResolver() .resolveClass(className); } return (Class<T>)Class.forName(className); }
private Class<?> resolveClassInWicket(String className) throws ClassNotFoundException { Class<?> candidate; try { Application application = Application.get(); ApplicationSettings applicationSettings = application.getApplicationSettings(); IClassResolver classResolver = applicationSettings.getClassResolver(); candidate = classResolver.resolveClass(className); } catch (WicketRuntimeException ex) { if (ex.getCause() instanceof ClassNotFoundException) { throw (ClassNotFoundException)ex.getCause(); } else { ClassNotFoundException wrapperCnf = new ClassNotFoundException(); wrapperCnf.initCause(ex); throw wrapperCnf; } } return candidate; }
private Class<?> resolveClassInWicket(String className) throws ClassNotFoundException { Class<?> candidate; try { Application application = Application.get(); ApplicationSettings applicationSettings = application.getApplicationSettings(); IClassResolver classResolver = applicationSettings.getClassResolver(); candidate = classResolver.resolveClass(className); } catch (WicketRuntimeException ex) { if (ex.getCause() instanceof ClassNotFoundException) { throw (ClassNotFoundException)ex.getCause(); } else { ClassNotFoundException wrapperCnf = new ClassNotFoundException(); wrapperCnf.initCause(ex); throw wrapperCnf; } } return candidate; }