commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tur...@apache.org
Subject cvs commit: jakarta-commons/validator/src/share/org/apache/commons/validator ValidatorResources.java
Date Wed, 04 Dec 2002 21:24:01 GMT
turner      2002/12/04 13:24:01

  Modified:    validator/src/share/org/apache/commons/validator
                        ValidatorResources.java
  Log:
  Fixed bug 14384, refactored code a bit to remove lots of redundent stuff.
  
  Thanks to Björn-H. Moritz for suggesting the fix.
  
  Revision  Changes    Path
  1.8       +20 -39    jakarta-commons/validator/src/share/org/apache/commons/validator/ValidatorResources.java
  
  Index: ValidatorResources.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/ValidatorResources.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ValidatorResources.java	16 Oct 2002 18:48:08 -0000	1.7
  +++ ValidatorResources.java	4 Dec 2002 21:24:01 -0000	1.8
  @@ -255,44 +255,25 @@
         
   	Vector v = (Vector) hFormSets.get(key);
   
  -	if (v == null) return f;
  -
  -	Enumeration formsets = v.elements();
  -	while (formsets.hasMoreElements()) {
  -	    o = formsets.nextElement();
  -	    if (o != null) {
  -		fs = (FormSet)o;
  -		if ((fs != null) && (fs.getForm(formKey) != null)) {
  -		    return fs.getForm(formKey);
  -		}
  -	    }
  +	if (v == null) {
  +	    key = ((language != null && language.length() > 0) ? language : "") + 
  +		((country != null && country.length() > 0) ? "_" + country : "");
  +	    v = (Vector) hFormSets.get(key);
   	}
  -	key = ((language != null && language.length() > 0) ? language : "") + 
  -	    ((country != null && country.length() > 0) ? "_" + country : "");
  -         
  -	formsets = v.elements();
  -	while (formsets.hasMoreElements()) {
  -	    o = formsets.nextElement();
  -	    if (o != null) {
  -		fs = (FormSet)o;
  -		if ((fs != null) && (fs.getForm(formKey) != null)) {
  -		    return fs.getForm(formKey);
  -		}
  -	    }
  +
  +	if (v == null) {
  +	    key = ((language != null && language.length() > 0) ? language : "");
  +	    v = (Vector) hFormSets.get(key);
   	}
  -	key = ((language != null && language.length() > 0) ? language : "");
  -	formsets = v.elements();
  -	while (formsets.hasMoreElements()) {
  -	    o = formsets.nextElement();
  -	    if (o != null) {
  -		fs = (FormSet)o;
  -		if ((fs != null) && (fs.getForm(formKey) != null)) {
  -		    return fs.getForm(formKey);
  -		}
  -	    }
  +
  +	if (v == null) {
  +	    key = defaultLocale.toString();
  +	    v = (Vector) hFormSets.get(key);
   	}
  -	key = defaultLocale.toString();
  -	formsets = v.elements();
  +
  +	if (v == null) return null;
  +
  +	Enumeration formsets = v.elements();
   	while (formsets.hasMoreElements()) {
   	    o = formsets.nextElement();
   	    if (o != null) {
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message