Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 54409 invoked from network); 20 Jun 2005 17:19:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Jun 2005 17:19:26 -0000 Received: (qmail 16729 invoked by uid 500); 20 Jun 2005 17:19:22 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 16684 invoked by uid 500); 20 Jun 2005 17:19:21 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: 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 16614 invoked by uid 99); 20 Jun 2005 17:19:21 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jun 2005 10:19:19 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of mfncooper@gmail.com designates 64.233.184.193 as permitted sender) Received: from [64.233.184.193] (HELO wproxy.gmail.com) (64.233.184.193) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jun 2005 10:19:11 -0700 Received: by wproxy.gmail.com with SMTP id 58so872428wri for ; Mon, 20 Jun 2005 10:19:15 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=tLcWS3K+bRgiEoJk3LWyIiJ7+44SNNEA22Q+Eeh7GO5PVpUibvrWfU4TUfvb/y4rKYEhjvaviXLLpqTdOdS5vkWwbF41W3W5gYxUWSoNcpv0sk0lWovCnvJG+3FuSJ+rdqvzk+RavQr14lvzsbaM/sox+8IVJpggZ6cCzvail4I= Received: by 10.54.28.2 with SMTP id b2mr2624106wrb; Mon, 20 Jun 2005 10:19:15 -0700 (PDT) Received: by 10.54.57.63 with HTTP; Mon, 20 Jun 2005 10:19:15 -0700 (PDT) Message-ID: <16d6c62005062010192efcb773@mail.gmail.com> Date: Mon, 20 Jun 2005 10:19:15 -0700 From: Martin Cooper Reply-To: Martin Cooper To: Jakarta Commons Developers List , jopaki Subject: Re: Possible bug? [validator] In-Reply-To: <8f7abac5050620090016e066cf@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <8f7abac5050620090016e066cf@mail.gmail.com> X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I don't believe this is a bug. The 'results' variable holds the results for the current field, and a new set of results is created for each field. The overall results are maintained in the 'allResults' field, and the contents of 'results' is merged into that near the end of the loop. -- Martin Cooper On 6/20/05, jopaki wrote: > Hi all, >=20 > I downloaded commons-validator v1.1.4 and I think I ran into a bug in > the method: >=20 > ValidatorResults validate(Map params, Map actions) > throws ValidatorException >=20 > specifically the block: > ******************************** >=20 > for (int fieldNumber =3D 0; fieldNumber < > numberOfFieldsToValidate; fieldNumber++) { >=20 > ValidatorResults results =3D new ValidatorResults(); > // this is the "fix the bug" location >=20 > Iterator dependencies =3D this.dependencyList.iterator(); > while (dependencies.hasNext()) { > String depend =3D (String) dependencies.next(); >=20 > ValidatorAction action =3D (ValidatorAction) actions.get(= depend); > if (action =3D=3D null) { > this.handleMissingAction(depend); > } >=20 > //ValidatorResults results =3D new ValidatorResults(); > // this is the "original" location that is "buggy" >=20 > boolean good =3D > validateForRule(action, results, actions, params, > fieldNumber); >=20 > allResults.merge(results); >=20 > if (!good) { > return allResults; > } > } > } > ******************************** >=20 > I moved the line that instantiates the local var: 'results' > (ValidatorResults ) OUTSIDE of the while loop so the validations > performed based on the dependencies (resolved to actions) are not lost > between passes of the while loop. >=20 > Please advise. >=20 > Thanks! >=20 > Jon Kirton > jopaki@yahoo.com > -- > -jpk- >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-dev-help@jakarta.apache.org >=20 > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org