commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Nascimento Santos" <mister...@hotmail.com>
Subject Re: [jxpath] patch for MethodLookupUtils.lookupStaticMethod
Date Wed, 14 Jan 2004 02:36:49 GMT
But wouldn't it work if you were passing an empty array instead of null?

I don't know how this class is used, so, I may be saying something wrong...

[]s
Michael

----- Original Message ----- 
From: "joern turner" <joern.turner@web.de>
To: <commons-user@jakarta.apache.org>
Sent: Tuesday, January 13, 2004 10:28 PM
Subject: [jxpath] patch for MethodLookupUtils.lookupStaticMethod


> hello,
> 
> found a problem in MethodLookupUtils when defining a custom function 
> with no arguments cause the passed parameter array is null in that case.
> 
> a simple test for null and providing an empty Class array in this case 
> solves the issue.
> 
> 
>      public static Method lookupStaticMethod(
>          Class targetClass,
>          String name,
>          Object[] parameters)
>      {
>          boolean tryExact = true;
> 
>          Class types[];
>          if(parameters==null){
>              types = new Class[0];
>          }else{
>              int count = parameters.length;
>              types = new Class[count];
>              for (int i = 0; i < count; i++) {
>                  Object param = parameters[i];
>                  if (param != null) {
>                      types[i] = param.getClass();
>                  }
>                  else {
>                      types[i] = null;
>                      tryExact = false;
>                  }
>              }
>          }
> ....
> 
> Regards,
> 
> Joern Turner
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message