Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 3694 invoked from network); 13 Apr 2003 17:53:14 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 13 Apr 2003 17:53:14 -0000 Received: (qmail 13475 invoked by uid 97); 13 Apr 2003 17:55:11 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@nagoya.betaversion.org Received: (qmail 13468 invoked from network); 13 Apr 2003 17:55:11 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 13 Apr 2003 17:55:11 -0000 Received: (qmail 3447 invoked by uid 500); 13 Apr 2003 17:53:12 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 3427 invoked from network); 13 Apr 2003 17:53:12 -0000 Received: from pcow058o.blueyonder.co.uk (HELO blueyonder.co.uk) (195.188.53.98) by daedalus.apache.org with SMTP; 13 Apr 2003 17:53:12 -0000 Received: from localhost ([80.194.24.21]) by blueyonder.co.uk with Microsoft SMTPSVC(5.5.1877.757.75); Sun, 13 Apr 2003 18:45:33 +0100 Date: Sun, 13 Apr 2003 18:46:22 +0100 Subject: Re: [Digester] problem calling methods with a primitive parameter Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v482) From: robert burrell donkin To: "Jakarta Commons Developers List" Content-Transfer-Encoding: 7bit In-Reply-To: <20030413015830.73680.qmail@web41507.mail.yahoo.com> Message-Id: X-Mailer: Apple Mail (2.482) X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On Sunday, April 13, 2003, at 02:58 AM, Mohan Kishore wrote: > One question reg. CallMethodRule: why was the parameters changed from > String[] > to Object[]? this allows parameters to be set in more flexible ways (rather than just from the xml). in particular, this changed allowed parameters to be set to objects on the main digester stack. the present code should ensure that these objects are not be converted but strings are. > I would find the following algo more initutive - any comments: > String p = (String) parameters[i]; > if (paramTypes.equals(String.class)) { > paramValues[i] = p; > } else if (paramTypes[i].isPrimitive()) { > paramValues[i] = ConvertUtils.convert(p, paramTypes[i]); > } else if (parameters[i] != null) { > paramValues[i] = ConvertUtils.convert(p, paramTypes[i]); > } else { > paramValues[i] = null; > } > > i.e. > if String no conversion > elseif is primitive value cannot be null, hence convert > else is object, hence convert if not null i'm now thinking along the lines that maybe all nulls and any objects which are not compatible with the given parameter type should be converted. this should be backwards compatible (the exception thrown when an incompatible type is passed prevents digestion continuing) and give extra functionality whilst probably also fixing the reported problem. what do people think about this plan? > btw, the subject line mentioned that the problem is related to a missing > attribute in the XML file. From the code I understand that if the method > takes > in a single value from the attribute and that attribute is missing, then > the > method never gets called... Am i missing something here? i'm not sure and that's why i'd like more information. i'm having trouble constructing a test case and without a failed test case, i'm very reluctant to patch. - robert --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org