From commons-user-return-6574-apmail-jakarta-commons-user-archive=jakarta.apache.org@jakarta.apache.org Thu Feb 12 20:33:00 2004 Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 88113 invoked from network); 12 Feb 2004 20:32:59 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 12 Feb 2004 20:32:59 -0000 Received: (qmail 53320 invoked by uid 500); 12 Feb 2004 20:32:43 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 53303 invoked by uid 500); 12 Feb 2004 20:32:43 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 53287 invoked from network); 12 Feb 2004 20:32:43 -0000 Received: from unknown (HELO sunset.chotel.com) (143.192.1.16) by daedalus.apache.org with SMTP; 12 Feb 2004 20:32:43 -0000 Received: from sundaze.chotel.com (sundaze.chotel.com [143.192.3.120]) by sunset.chotel.com (8.12.9/8.12.9) with ESMTP id i1CKWhj1022431 for ; Thu, 12 Feb 2004 13:32:44 -0700 (MST) Received: from thewoolleyweb.com ([143.192.6.208]) by sundaze.chotel.com (Netscape Messaging Server 4.15) with ESMTP id HSZNQI00.K70; Thu, 12 Feb 2004 13:32:42 -0700 Message-ID: <402BE2E9.8080302@thewoolleyweb.com> Date: Thu, 12 Feb 2004 13:32:42 -0700 From: Chad Woolley User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jakarta Commons Users List CC: japtesta@indra.es Subject: Re: Digester / BeanUtils - No Such Accessible Method error References: <4028989A.1020809@thewoolleyweb.com> <4028CDBA.2090705@indra.es> <40290EAA.3040303@thewoolleyweb.com> In-Reply-To: <40290EAA.3040303@thewoolleyweb.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hello, I never got any bites on this, so here it is again with all the info in one place. I'd really like to resolve this, as it is preventing me from using Digester. I guess I should try to write a failing unit test for it and submit it as a bug, but I'm not sure whether it is a problem with BeanUtils or Digester. It really appears to be the JDK Method.getParameterTypes() that is behaving incorrectly, but that seems unlikely, it is probably some issue with another tool or my environment. Thanks, Chad > Hello, > > I am trying to use Digester, and am getting an exception "No such accessible method" when using Digester.addSetNext(...). > > I have debugged this down to the "MethodUtils.getMatchingAccessibleMethod()" method in BeanUtils. > > The problem appears to be on line 616: > > if (!isAssignmentCompatible(methodsParams[n], parameterTypes[n])) { > > If I use the Eclipse debugger to inspect these two arguments, I see that parameterTypes[n] has the Class data correctly populated (declaredConstructors, declaredMethods, etc). > > However, methodParams[n] has null for all of these properties of the Class. This means that in MethodUtils.isAssignmentCompatible(), the isAssignableFrom() call returns false, even though the names of the classes are identical. > > The original value of methodParams[n] comes from this line just above: > Class[] methodsParams = methods[i].getParameterTypes(); > > I have searched for the answer to this problem, but all other references seem to deal with default-access superclasses, which I don't have. > Both the parent and child objects on the stack when I call Digester.addSetNext() are plain public java objects, with no superclasses, and all public methods. > > It seems like this should be working fine, it's just that the Class object that is created from getParameterTypes() has all null fields instead of the being properly populated. > > I can provide any additional information that is required. This is an open source project, so the problem can be recreated via my unit tests, if you want to look at it. > > Thanks, > Chad > José Antonio Pérez Testa wrote: > >> Can you send the rules and an extract of the code you are using ? > > > Sure. If you want to actually see the error happen, I can give you > instructions to check out my source and run the unit test. > > Here is the XML: > > > > > test.* > > > > > org.virtualmock.rule.AllRecordedCallsMustBeInvokedRule > > > > > > ------------------------------------- > > Here is the Digester: > > vmConfig = new VMConfig(); > > digester.push(vmConfig); > digester.setValidating(validate); > > > digester.addCallMethod("virtualmock/excluded-classes/exclusion-pattern", > "addClassExclusionPattern", 0); > > digester.addObjectCreate("virtualmock/rules/rule", > RuleConfig.class); > digester.addBeanPropertySetter("virtualmock/rules/rule/rule-type", > "ruleType"); > digester.addSetNext("virtualmock/rules/rule", "addRuleConfig", > "org.virtualmock.configuration.RuleConfig"); > > try { > digester.parse(inputStream); > } catch (SAXException saxException) { > > ------------------------------------- > > Here is the Parent object: > > public class VMConfig { > private List classExclusionPatterns = null; > private List ruleConfigs = null; > > public VMConfig() { > classExclusionPatterns = new ArrayList(); > ruleConfigs = new ArrayList(); > } > > public List getClassExclusionPatterns() { > return classExclusionPatterns; > } > > public List getRuleConfigs() { > return ruleConfigs; > } > > public void addClassExclusionPattern(String classExclusionPattern) { > classExclusionPatterns.add(classExclusionPattern); > } > > public void addRuleConfig(RuleConfig ruleConfig) { > ruleConfigs.add(ruleConfig); > } > } > > ------------------------------------- > > Here is the Child object: > > public class RuleConfig { > private String ruleType = null; > > public void setRuleType(String ruleType) { > this.ruleType = ruleType; > } > > public String getRuleType() { > return ruleType; > } > > public RuleConfig() { > super(); > } > > } > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org