/** * Get privileged exception action to obtain Class from given class name. * If run using security manager, the returned privileged exception action * must be invoked within a doPrivileged block. * <p/> * The actual context class loader will be utilized if accessible and non-null. * Otherwise the defining class loader of the calling class will be utilized. * * @param <T> class type. * @param name class name. * @return privileged exception action to obtain the Class. * The action could throw {@link ClassNotFoundException} or return {@code null} if the class cannot be found. * @throws ClassNotFoundException in case the class cannot be loaded with the context class loader. * @see AccessController#doPrivileged(java.security.PrivilegedExceptionAction) */ public static <T> PrivilegedExceptionAction<Class<T>> classForNameWithExceptionPEA(final String name) throws ClassNotFoundException { return classForNameWithExceptionPEA(name, getContextClassLoader()); }
/** * Get privileged exception action to obtain Class from given class name. * If run using security manager, the returned privileged exception action * must be invoked within a doPrivileged block. * <p/> * The actual context class loader will be utilized if accessible and non-null. * Otherwise the defining class loader of the calling class will be utilized. * * @param <T> class type. * @param name class name. * @return privileged exception action to obtain the Class. * The action could throw {@link ClassNotFoundException} or return {@code null} if the class cannot be found. * @throws ClassNotFoundException in case the class cannot be loaded with the context class loader. * @see AccessController#doPrivileged(java.security.PrivilegedExceptionAction) */ public static <T> PrivilegedExceptionAction<Class<T>> classForNameWithExceptionPEA(final String name) throws ClassNotFoundException { return classForNameWithExceptionPEA(name, getContextClassLoader()); }
private Class getClassForName(final String className) { try { final OsgiRegistry osgiRegistry = ReflectionHelper.getOsgiRegistryInstance(); if (osgiRegistry != null) { return osgiRegistry.classForNameWithException(className); } else { return AccessController.doPrivileged(ReflectionHelper.classForNameWithExceptionPEA(className, classloader)); } } catch (final ClassNotFoundException ex) { throw new RuntimeException(LocalizationMessages.ERROR_SCANNING_CLASS_NOT_FOUND(className), ex); } catch (final PrivilegedActionException pae) { final Throwable cause = pae.getCause(); if (cause instanceof ClassNotFoundException) { throw new RuntimeException(LocalizationMessages.ERROR_SCANNING_CLASS_NOT_FOUND(className), cause); } else if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else { throw new RuntimeException(cause); } } }
private Class getClassForName(final String className) { try { final OsgiRegistry osgiRegistry = ReflectionHelper.getOsgiRegistryInstance(); if (osgiRegistry != null) { return osgiRegistry.classForNameWithException(className); } else { return AccessController.doPrivileged(ReflectionHelper.classForNameWithExceptionPEA(className, classloader)); } } catch (final ClassNotFoundException ex) { throw new RuntimeException(LocalizationMessages.ERROR_SCANNING_CLASS_NOT_FOUND(className), ex); } catch (final PrivilegedActionException pae) { final Throwable cause = pae.getCause(); if (cause instanceof ClassNotFoundException) { throw new RuntimeException(LocalizationMessages.ERROR_SCANNING_CLASS_NOT_FOUND(className), cause); } else if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else { throw new RuntimeException(cause); } } }
if (ignoreOnClassNotFound) { try { AccessController.doPrivileged(ReflectionHelper.classForNameWithExceptionPEA(nextName, loader)); } catch (final ClassNotFoundException ex) { handleClassNotFoundException();
if (ignoreOnClassNotFound) { try { AccessController.doPrivileged(ReflectionHelper.classForNameWithExceptionPEA(nextName, loader)); } catch (final ClassNotFoundException ex) { handleClassNotFoundException();
ReflectionHelper.<T>classForNameWithExceptionPEA(cn, loader));
ReflectionHelper.<T>classForNameWithExceptionPEA(cn, loader));
} else if (wadlGeneratorConfigProperty instanceof String) { configClazz = AccessController.doPrivileged(ReflectionHelper .classForNameWithExceptionPEA((String) wadlGeneratorConfigProperty)) .asSubclass(WadlGeneratorConfig.class); } else {
} else if (wadlGeneratorConfigProperty instanceof String) { configClazz = AccessController.doPrivileged(ReflectionHelper .classForNameWithExceptionPEA((String) wadlGeneratorConfigProperty)) .asSubclass(WadlGeneratorConfig.class); } else {
try { t = service.cast(AccessController.doPrivileged( ReflectionHelper.classForNameWithExceptionPEA(nextName, loader)).newInstance());
try { t = service.cast(AccessController.doPrivileged( ReflectionHelper.classForNameWithExceptionPEA(nextName, loader)).newInstance());
ReflectionHelper.<javax.ws.rs.core.Application>classForNameWithExceptionPEA(jaxrsApplicationClassName) );
ReflectionHelper.<javax.ws.rs.core.Application>classForNameWithExceptionPEA(jaxrsApplicationClassName) );
private Class getClassForName(final String className) { try { final OsgiRegistry osgiRegistry = ReflectionHelper.getOsgiRegistryInstance(); if (osgiRegistry != null) { return osgiRegistry.classForNameWithException(className); } else { return AccessController.doPrivileged(ReflectionHelper.classForNameWithExceptionPEA(className, classloader)); } } catch (final ClassNotFoundException ex) { throw new RuntimeException(LocalizationMessages.ERROR_SCANNING_CLASS_NOT_FOUND(className), ex); } catch (final PrivilegedActionException pae) { final Throwable cause = pae.getCause(); if (cause instanceof ClassNotFoundException) { throw new RuntimeException(LocalizationMessages.ERROR_SCANNING_CLASS_NOT_FOUND(className), cause); } else if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else { throw new RuntimeException(cause); } } }
} else if (wadlGeneratorConfigProperty instanceof String) { configClazz = AccessController.doPrivileged(ReflectionHelper .classForNameWithExceptionPEA((String) wadlGeneratorConfigProperty)) .asSubclass(WadlGeneratorConfig.class); } else {
/** * Get privileged exception action to obtain Class from given class name. * If run using security manager, the returned privileged exception action * must be invoked within a doPrivileged block. * <p/> * The actual context class loader will be utilized if accessible and non-null. * Otherwise the defining class loader of the calling class will be utilized. * * @param <T> class type. * @param name class name. * @return privileged exception action to obtain the Class. * The action could throw {@link ClassNotFoundException} or return {@code null} if the class cannot be found. * @throws ClassNotFoundException in case the class cannot be loaded with the context class loader. * @see AccessController#doPrivileged(java.security.PrivilegedExceptionAction) */ public static <T> PrivilegedExceptionAction<Class<T>> classForNameWithExceptionPEA(final String name) throws ClassNotFoundException { return classForNameWithExceptionPEA(name, getContextClassLoader()); }
/** * Get privileged exception action to obtain Class from given class name. * If run using security manager, the returned privileged exception action * must be invoked within a doPrivileged block. * <p/> * The actual context class loader will be utilized if accessible and non-null. * Otherwise the defining class loader of the calling class will be utilized. * * @param <T> class type. * @param name class name. * @return privileged exception action to obtain the Class. * The action could throw {@link ClassNotFoundException} or return {@code null} if the class cannot be found. * @throws ClassNotFoundException in case the class cannot be loaded with the context class loader. * @see AccessController#doPrivileged(java.security.PrivilegedExceptionAction) */ public static <T> PrivilegedExceptionAction<Class<T>> classForNameWithExceptionPEA(final String name) throws ClassNotFoundException { return classForNameWithExceptionPEA(name, getContextClassLoader()); }
/** * Get privileged exception action to obtain Class from given class name. * If run using security manager, the returned privileged exception action * must be invoked within a doPrivileged block. * <p/> * The actual context class loader will be utilized if accessible and non-null. * Otherwise the defining class loader of the calling class will be utilized. * * @param <T> class type. * @param name class name. * @return privileged exception action to obtain the Class. * The action could throw {@link ClassNotFoundException} or return {@code null} if the class cannot be found. * @throws ClassNotFoundException in case the class cannot be loaded with the context class loader. * @see AccessController#doPrivileged(java.security.PrivilegedExceptionAction) */ public static <T> PrivilegedExceptionAction<Class<T>> classForNameWithExceptionPEA(final String name) throws ClassNotFoundException { return classForNameWithExceptionPEA(name, getContextClassLoader()); }
/** * Get privileged exception action to obtain Class from given class name. * If run using security manager, the returned privileged exception action * must be invoked within a doPrivileged block. * <p/> * The actual context class loader will be utilized if accessible and non-null. * Otherwise the defining class loader of the calling class will be utilized. * * @param <T> class type. * @param name class name. * @return privileged exception action to obtain the Class. * The action could throw {@link ClassNotFoundException} or return {@code null} if the class cannot be found. * @throws ClassNotFoundException in case the class cannot be loaded with the context class loader. * @see AccessController#doPrivileged(java.security.PrivilegedExceptionAction) */ public static <T> PrivilegedExceptionAction<Class<T>> classForNameWithExceptionPEA(final String name) throws ClassNotFoundException { return classForNameWithExceptionPEA(name, getContextClassLoader()); }