chungonn
unread,Jul 22, 2011, 9:14:53 PM7/22/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sarasvati-wf-dev
Hi Paul,
How have you been? Hope all's well.
We are encountering an issue with ListenerCache class when it tries to
load a class using Class.#forName. To fix this we use the Context
Classloader instead. Below is the patch, could you kindly review the
code and see if you can accept the patch.
Index: src/com/googlecode/sarasvati/event/ListenerCache.java
===================================================================
--- src/com/googlecode/sarasvati/event/ListenerCache.java (revision
1173)
+++ src/com/googlecode/sarasvati/event/ListenerCache.java (working
copy)
@@ -33,19 +33,33 @@
if ( listener == null )
{
- Class<? extends ExecutionListener> listenerClass = null;
+ Class< ? extends ExecutionListener> listenerClass = null;
+ listenerClass = null;
try
{
listenerClass = (Class< ? extends
ExecutionListener>)Class.forName( type );
}
- catch (Exception e)
+ catch ( Exception e )
{
- throw new SarasvatiException( "Failed to load
ExecutionListener class: " + type, e );
}
+ ClassLoader classLoader =
Thread.currentThread().getContextClassLoader();
try
{
+ listenerClass = (Class< ? extends
ExecutionListener>)classLoader.loadClass( type );
+ }
+ catch ( Exception e )
+ {
+ }
+
+ if ( listenerClass == null )
+ {
+ throw new SarasvatiException( "Failed to load
ExecutionListener class: " + type );
+ }
+
+ try
+ {
listener = listenerClass.newInstance();
}
catch ( InstantiationException e )