Oops, my bad. Forget newInstance() being called. But the line:
Class bean = ctxt.getClassLoader().loadClass(klass);
I believe does force my previous static statements to hold true.
-Tim
Marcus Beyer wrote:
Tim Funk schrieb:
Ahh. Here is your issue:
if (beanName == null) {
try {
Class bean = ctxt.getClassLoader().loadClass(klass);
int modifiers = bean.getModifiers();
if (!Modifier.isPublic(modifiers) ||
Modifier.isInterface(modifiers) ||
Modifier.isAbstract(modifiers)) {
throw new Exception("Invalid bean class modifier");
}
// Check that there is a 0 arg constructor
bean.getConstructor(new Class[] {});
generateNew = true;
} catch (Exception e) {
// Cannot instantiate the specified class
if (ctxt.getOptions().getErrorOnUseBeanInvalidClassAttribute()) {
err.jspError(n, "jsp.error.invalid.bean", klass);
}
}
}
At compile time - jasper is checking that the default constructor of a
bean may be invoked. By invoking the constructor at compile time - the
class is loaded by the JVM. This will in turn cause the JVM to call
any static initializers. (In which you have)
Hmm, were is that code is an invokation of a constructor? As far as I
can see Jasper just checks if a zero argument constructor exists.
And why does Jasper instantiate beans? Just to check if it is possible
to instantiate them, or does Jasper do something with the beans?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]