commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/ant DataTypeTag.java
Date Fri, 14 Jun 2002 17:19:22 GMT
jstrachan    2002/06/14 10:19:21

  Modified:    jelly/src/java/org/apache/commons/jelly/tags/ant
                        DataTypeTag.java
  Log:
  patched the code to avoid the use of the crappy Class.getMethod(String. Class[]) call which
throws an exception if the method isn't found.
  Now using the nice helper method that comes from beanutils
  
  Revision  Changes    Path
  1.7       +4 -1      jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/ant/DataTypeTag.java
  
  Index: DataTypeTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/ant/DataTypeTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DataTypeTag.java	6 Jun 2002 07:09:36 -0000	1.6
  +++ DataTypeTag.java	14 Jun 2002 17:19:20 -0000	1.7
  @@ -67,6 +67,7 @@
   import org.apache.commons.beanutils.DynaBean;
   import org.apache.commons.beanutils.DynaClass;
   import org.apache.commons.beanutils.DynaProperty;
  +import org.apache.commons.beanutils.MethodUtils;
   
   import org.apache.commons.jelly.DynaBeanTagSupport;
   import org.apache.commons.jelly.JellyContext;
  @@ -125,7 +126,9 @@
               String methodName = "add" + name.substring(0,1).toUpperCase() + name.substring(1);
               Class taskClass = task.getClass();
               Class[] parameterTypes = new Class[] { dataType.getClass() };
  -            Method method = taskClass.getMethod( methodName, parameterTypes );
  +            Method method = MethodUtils.getAccessibleMethod(
  +                taskClass, methodName, parameterTypes 
  +            );
               if ( method == null ) {
                   throw new JellyException( 
                       "Cannot add dataType: " + dataType + " to Ant task: " + task 
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message