Welcome to my blog, I am a Sun certified Java/J2EE professional and specialize in various Open source software technologies. This blog hosts all my open source software development work, which is available for free to everyone.
Wednesday, December 09, 2009
JCL 2.1.1 released
JCL 2.1.1 is released with xml/web context support
thanks for this library! I have a comment though: The method JclObjectFactory.create(JarClassLoader jcl, String className, Object... args) doesn't take into account the case where the constructor's parameters of the object to create are superclasses or interfaces of 'args' (if I try I get an exception as JCL cannot match the constructor's signature with the classes of the arguments). I've created a quick patch to allow this. A new method that adds the constructor's signature needs to be defined and the array 'types' needs to refer to this signature: public Object create(JarClassLoader jcl, String className, Class[] constructorSignature, Object... args) { [...] Class[] types = new Class[constructorSignature.length];
for( int i = 0; i < constructorSignature.length; i++ ) types[i] = constructorSignature[i]; [...]
(perhaps optimization is possible here but I didn't want to fiddle with the code!)
Hi Kamran, Thanks for the library! One question about it: when exception is thrown within our dynamically-loaded code - we cannot catch it within the code later because the exception itself gets wrapped into one of the JCL wrappers. Is it possible to turn the exception wrapping off? Thanks again!
3 comments:
Hi Kamran,
thanks for this library! I have a comment though:
The method JclObjectFactory.create(JarClassLoader jcl, String className, Object... args) doesn't take into account the case where the constructor's parameters of the object to create are superclasses or interfaces of 'args' (if I try I get an exception as JCL cannot match the constructor's signature with the classes of the arguments).
I've created a quick patch to allow this.
A new method that adds the constructor's signature needs to be defined and the array 'types' needs to refer to this signature:
public Object create(JarClassLoader jcl, String className, Class[] constructorSignature, Object... args) {
[...]
Class[] types = new Class[constructorSignature.length];
for( int i = 0; i < constructorSignature.length; i++ )
types[i] = constructorSignature[i];
[...]
(perhaps optimization is possible here but I didn't want to fiddle with the code!)
Regards,
Franck
--
Franck Valentin
EMBL - The EBI
Wellcome Trust Genome Campus
Hinxton, Cambridge CB10 1SD
Thanks for this Franck.. I will update the JclObjectFactory with this in the next release..
Hi Kamran,
Thanks for the library!
One question about it: when exception is thrown within our dynamically-loaded code - we cannot catch it within the code later because the exception itself gets wrapped into one of the JCL wrappers. Is it possible to turn the exception wrapping off?
Thanks again!
Roman
Post a Comment