CVS: plexus-components/activity/src/java/org/apache/plexus/summit/activity DefaultActionEventService.java,1.1,1.2

[email protected] Tue, 29 Apr 2003 14:01:03 -0500
Newsgroups gmane.comp.java.plexus.devel
Message-ID <[email protected]>
Update of /cvsroot/plexus/plexus-components/activity/src/java/org/apache/plexus/summit/activity
In directory eng.werken.com:/tmp/cvs-serv30533

Modified Files:
	DefaultActionEventService.java 
Log Message:
Fixed the activity component.  Actions never were executed because the
method obtained via reflection was being invoked on the component itself
vs an instance of the object that actually contained the method.



Index: DefaultActionEventService.java
===================================================================
RCS file: /cvsroot/plexus/plexus-components/activity/src/java/org/apache/plexus/summit/activity/DefaultActionEventService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- DefaultActionEventService.java	3 Mar 2003 00:21:03 -0000	1.1
+++ DefaultActionEventService.java	29 Apr 2003 19:00:58 -0000	1.2
@@ -188,13 +188,15 @@
             try
             {
                 methodName = getMethodName( data );
-                Method method = getMethod( action, methodName );
+                Class actionClass = getClass( action );
+
+                Method method = getMethod( actionClass, methodName );
                 
                 // The arguments to pass to the method to execute.
                 Object[] args = new Object[1];
                 args[0] = data;
 
-                method.invoke( this, args );                         
+                method.invoke( actionClass.newInstance(), args );                         
             }
             catch (InvocationTargetException ite)
             {
@@ -232,11 +234,9 @@
      * @return Method
      * @throws NoSuchMethodException
      */
-    protected Method getMethod( String action, String methodName )
+    protected Method getMethod( Class actionClass, String methodName )
         throws NoSuchMethodException, ClassNotFoundException
     {
-        Class actionClass = getClass( action );
-            
         // The arguments to the method to find.
         Class[] classes = new Class[1];
         classes[0] = RunData.class;