You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Colin Chalmers <Co...@xs4all.nl> on 2003/09/24 17:39:04 UTC
Patch for Intake problem 2.3 branch
Here's a patch for the problem which Scott identified when trying to
(re)set a Field to required while it was set to False in Intake.xml. Can
someone check it in? Scott if you could give it a whirl and let me know
how it goes?
After this I'll start looking at refactoring some Intake stuff since
it's pretty unclear as to how some things fit in.
Colin
Index: Field.java
===================================================================
RCS file:
/home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/services/intake/model/Field.java,v
retrieving revision 1.15
diff -u -r1.15 Field.java
--- Field.java 18 Jul 2003 09:09:23 -0000 1.15
+++ Field.java 24 Sep 2003 15:29:51 -0000
@@ -124,7 +124,7 @@
protected final Method setter;
/** Error message set on the field if required and not set by parser */
- protected final String ifRequiredMessage;
+ protected String ifRequiredMessage;
/** Does this field accept multiple values? */
protected final boolean isMultiValued;
@@ -290,8 +290,10 @@
if (reqRule != null)
{
alwaysRequired = new
Boolean(reqRule.getValue()).booleanValue();
+ ifRequiredMessage = reqRule.getMessage();
}
+
Rule maxLengthRule = (Rule) field.getRuleMap().get("maxLength");
if (maxLengthRule != null)
{
@@ -333,7 +335,6 @@
}
getter = tmpGetter;
setter = tmpSetter;
- ifRequiredMessage = field.getIfRequiredMessage();
valArray = new Object[1];
}
@@ -371,7 +372,8 @@
}
}
- if (pp.containsKey(getKey()))
+
+ if ( pp.containsKey(getKey()) &&
StringUtils.isNotEmpty(pp.getString(getKey())) )
{
if (isDebugEnabled)
{