ex = e; else if (e != ex) ex.addSuppressed(e);
Class findJettyClass(String className) throws ClassNotFoundException { try { return Class.forName(className, false, preventor.getClassLoader()); } catch (ClassNotFoundException e1) { try { return Class.forName(className); } catch (ClassNotFoundException e2) { e2.addSuppressed(e1); throw e2; } } } }
Class findJettyClass(String className) throws ClassNotFoundException { try { return Class.forName(className, false, getWebApplicationClassLoader().getParent()); } catch (ClassNotFoundException e1) { try { return Class.forName(className); } catch (ClassNotFoundException e2) { e2.addSuppressed(e1); throw e2; } } } }
e.addSuppressed(new ClassNotFoundException("Could not deserialize " + i + "th " + "parameter type of method " + incompleteMethod + ". This indicates that the parameter " + "type is not part of the system class loader.")); e.addSuppressed(new ClassNotFoundException("Could not deserialize " + i + "th " + "argument of method " + incompleteMethod + ". This indicates that the argument " + "type is not part of the system class loader."));
public static void register(String moduleClassName, @Nullable ClassLoader classLoader, DatasetDefinitionRegistry registry) throws ClassNotFoundException, IllegalAccessException, InstantiationException, TypeConflictException { ClassLoader systemClassLoader = DatasetDefinitionRegistries.class.getClassLoader(); // Either uses the given classloader or the system one ClassLoader moduleClassLoader = Objects.firstNonNull(classLoader, systemClassLoader); Class<? extends DatasetModule> moduleClass; try { moduleClass = loadClass(moduleClassLoader, moduleClassName); } catch (ClassNotFoundException e) { // If failed to load from the given classloader (if not null), try to load it from system classloader if (classLoader == null || classLoader.equals(systemClassLoader)) { throw e; } try { moduleClass = loadClass(systemClassLoader, moduleClassName); } catch (ClassNotFoundException e2) { e.addSuppressed(e2); throw e; } } DatasetModule module = DatasetModules.getDatasetModule(moduleClass); module.register(registry); }
e.addSuppressed(new ClassNotFoundException("Could not deserialize " + i + "th " + "parameter type of method " + incompleteMethod + ". This indicates that the parameter " + "type is not part of the system class loader.")); e.addSuppressed(new ClassNotFoundException("Could not deserialize " + i + "th " + "argument of method " + incompleteMethod + ". This indicates that the argument " + "type is not part of the system class loader."));
public static void register(String moduleClassName, @Nullable ClassLoader classLoader, DatasetDefinitionRegistry registry) throws ClassNotFoundException, IllegalAccessException, InstantiationException, TypeConflictException { ClassLoader systemClassLoader = DatasetDefinitionRegistries.class.getClassLoader(); // Either uses the given classloader or the system one ClassLoader moduleClassLoader = Objects.firstNonNull(classLoader, systemClassLoader); Class<? extends DatasetModule> moduleClass; try { moduleClass = loadClass(moduleClassLoader, moduleClassName); } catch (ClassNotFoundException e) { // If failed to load from the given classloader (if not null), try to load it from system classloader if (classLoader == null || classLoader.equals(systemClassLoader)) { throw e; } try { moduleClass = loadClass(systemClassLoader, moduleClassName); } catch (ClassNotFoundException e2) { e.addSuppressed(e2); throw e; } } DatasetModule module = DatasetModules.getDatasetModule(moduleClass); module.register(registry); }
} catch (ClassNotFoundException e){ if (exception != null){ exception.addSuppressed(e); } else { exception = e; exception.addSuppressed(e); } else { throw e;
/** * Returns the value of {@link #getWrapperFor(Class)} for the given class, or for a parent * of the given class if {@code getWrapperFor(Class)} threw {@code ClassNotFoundException}. * * @param type the GeoAPI interface, {@link CodeList} or {@link Enum} type. * @return the wrapper for the given type. * {@link WrapperClass#type} is {@code null} if no wrapper has been found. * @throws ClassNotFoundException if a wrapper was expected but not found in the * given type neither in any of the parent classes. */ private WrapperClass getWrapperInHierarchy(final Class<?> type) throws ClassNotFoundException { try { return new WrapperClass(getWrapperFor(type)); } catch (ClassNotFoundException e) { for (final Class<?> parent : type.getInterfaces()) { if (ArraysExt.containsIdentity(types, parent)) try { final WrapperClass wrapper = getWrapperInHierarchy(parent); wrapper.isInherited = true; return wrapper; } catch (ClassNotFoundException e2) { e.addSuppressed(e2); } } throw e; } }
ex = e; else if (e != ex) ex.addSuppressed(e);