You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by tu...@apache.org on 2002/12/04 22:24:01 UTC
cvs commit: jakarta-commons/validator/src/share/org/apache/commons/validator ValidatorResources.java
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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>