Context Classloader in ListenerCache.java

3 views
Skip to first unread message

chungonn

unread,
Jul 22, 2011, 9:14:53 PM7/22/11
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 )

Paul Lorenz

unread,
Jul 24, 2011, 12:37:51 AM7/24/11
to sarasvat...@googlegroups.com
Hi Chungonn,
  This was already fix, but not yet released. I finally got around to pushing a 1.0.4 release out with the accumulated bug fixes.

All is well, but my job no longer revolves around workflow, so I've not been able to put much time/effort into Sarasvati. I've been trying to keep up with minor bugs as they come up.

Cheers,
Paul


--
You received this message because you are subscribed to the Google Groups "sarasvati-wf-dev" group.
To post to this group, send email to sarasvat...@googlegroups.com.
To unsubscribe from this group, send email to sarasvati-wf-d...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sarasvati-wf-dev?hl=en.


chungonn

unread,
Jul 24, 2011, 7:41:15 PM7/24/11
to sarasvati-wf-dev
Hi Paul,

Thanks for releasing 1.0.4 with all the fixes.

I am keen to know what's keep you busy, perhaps we can take this
offline :)

Wish you a great week ahead.

Regards
chungonn
Reply all
Reply to author
Forward
0 new messages