|
From: Andreas R. <ar...@gm...> - 2004-01-08 17:16:41
|
Hi,
I receive a NullPointerException if I define a Bean in the ApplicationContext
which constructs a ImageResource like this:
class TestApp {
private ImageIcon imageHelp = new
ImageIcon(TestApp.class.getResource("/images/help.gif"));
// Default Constructor
public TestApp()
{
}
}
This works fine, as long as the image is in the classpath. But if not, then
the resulting NullPointerException isn't fetched by
BeanUtils.instantiateClass(Class clazz) and I have to search for the reason
because it was not directly clear where is my error.
Is it possible to add something like this to catch all possible Exceptions in
BeanUtils.instantiateClass(Class clazz)?
-------------------------------------------------------------------------------
catch (Exception ex){
throw new FatalBeanException("Could not instantiate class [" +
clazz.getName() + "]; Something different",ex);
}
------------------------------------------------------------------------------
Of course, my programming style should be better :-)
Best regards
Andreas
|