You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Benson Margulies <bi...@gmail.com> on 2010/11/16 21:17:25 UTC
ClassNotFound versus ExceptionInitializationError
This code in Aegis can get an ExceptionInInitializerError (rather
than a ClassNotFound). Think it might be more better to eat those,
too?
private static Class<? extends Annotation> load(String name) {
try {
return
AnnotationReader.class.getClassLoader().loadClass(name).asSubclass(Annotation.class);
} catch (ClassNotFoundException e) {
return null;
}
}
Re: ClassNotFound versus ExceptionInitializationError
Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday 16 November 2010 3:17:25 pm Benson Margulies wrote:
> This code in Aegis can get an ExceptionInInitializerError (rather
> than a ClassNotFound). Think it might be more better to eat those,
> too?
Honestly, in that case, I would just catch "Throwable" as there could be a
slew of potential things there such as Security exceptions, ClassDefinition
type errors, etc... Since it's an "ignored" exception anyway, I'm not sure I
would worry about all the permutations.
Dan
>
> private static Class<? extends Annotation> load(String name) {
> try {
> return
> AnnotationReader.class.getClassLoader().loadClass(name).asSubclass(Annotati
> on.class); } catch (ClassNotFoundException e) {
> return null;
> }
> }
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog