You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/06/17 12:32:03 UTC
svn commit: r668609 -
/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/AsmHelper.java
Author: skitching
Date: Tue Jun 17 03:32:03 2008
New Revision: 668609
URL: http://svn.apache.org/viewvc?rev=668609&view=rev
Log:
Fix bug in getMethods when two properties of the same type existed.
Also tidy up code by moving test for is/get/set to more appropriate place.
Modified:
myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/AsmHelper.java
Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/AsmHelper.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/AsmHelper.java?rev=668609&r1=668608&r2=668609&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/AsmHelper.java (original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/AsmHelper.java Tue Jun 17 03:32:03 2008
@@ -207,12 +207,6 @@
*/
private Method getMethod(Class<?> clazz, String methodName, String descriptor)
{
- if (!methodName.startsWith("set") && !methodName.startsWith("get")
- && !methodName.startsWith("is"))
- {
- return null;
- }
-
// TODO: this looping through all methods and calling getMethodDescriptor
// on each one is not very efficient. It might be nice to build all the
// descriptor->Method mappings once and cache them in a map. The question
@@ -223,10 +217,13 @@
Method[] methods = clazz.getDeclaredMethods();
for (Method m : methods)
{
- String thisMethodDesc = org.objectweb.asm.Type.getMethodDescriptor(m);
- if (thisMethodDesc.equals(descriptor))
+ if (m.getName().equals(methodName))
{
- return m;
+ String thisMethodDesc = org.objectweb.asm.Type.getMethodDescriptor(m);
+ if (thisMethodDesc.equals(descriptor))
+ {
+ return m;
+ }
}
}
@@ -255,10 +252,10 @@
//
// As there can never be two methods with the same "descriptor", we just
// use that to locate the real Method object.
- Method m = getMethod(clazz, name, descriptor);
- if (m != null)
+ if (name.startsWith("set") || name.startsWith("get") || name.startsWith("is"))
{
- if (!methods.contains(m))
+ Method m = getMethod(clazz, name, descriptor);
+ if ((m != null) && !methods.contains(m))
{
methods.add(m);
}