You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2003/05/12 17:41:18 UTC
cvs commit: jakarta-tapestry/framework/src/org/apache/tapestry/valid ValidField.java
hlship 2003/05/12 08:41:18
Modified: framework/src/org/apache/tapestry/bean
AbstractBeanInitializer.java
framework/src/org/apache/tapestry TapestryStrings.properties
framework/src/org/apache/tapestry/valid ValidField.java
Log:
Improve the exception when a helper bean property can not be initialized.
Revision Changes Path
1.5 +19 -2 jakarta-tapestry/framework/src/org/apache/tapestry/bean/AbstractBeanInitializer.java
Index: AbstractBeanInitializer.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/bean/AbstractBeanInitializer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AbstractBeanInitializer.java 17 Apr 2003 21:33:53 -0000 1.4
+++ AbstractBeanInitializer.java 12 May 2003 15:41:17 -0000 1.5
@@ -55,7 +55,9 @@
package org.apache.tapestry.bean;
+import org.apache.tapestry.ApplicationRuntimeException;
import org.apache.tapestry.IResourceResolver;
+import org.apache.tapestry.Tapestry;
import org.apache.tapestry.spec.BaseLocatable;
import org.apache.tapestry.util.prop.OgnlUtils;
@@ -86,6 +88,21 @@
protected void setBeanProperty(IResourceResolver resolver, Object bean, Object value)
{
- OgnlUtils.set(_propertyName, resolver, bean, value);
+ try
+ {
+ OgnlUtils.set(_propertyName, resolver, bean, value);
+ }
+ catch (ApplicationRuntimeException ex)
+ {
+ String message =
+ Tapestry.getString(
+ "AbstractBeanInitializer.unable-to-set-property",
+ _propertyName,
+ bean,
+ value);
+
+ throw new ApplicationRuntimeException(message, getLocation(), ex);
+ }
+
}
}
1.24 +2 -1 jakarta-tapestry/framework/src/org/apache/tapestry/TapestryStrings.properties
Index: TapestryStrings.properties
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/TapestryStrings.properties,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- TapestryStrings.properties 11 May 2003 22:35:41 -0000 1.23
+++ TapestryStrings.properties 12 May 2003 15:41:17 -0000 1.24
@@ -83,6 +83,7 @@
BeanProvider.bean-not-defined=Component {0} does not define a bean name {1}.
BeanProvider.instantiation-error=Unable to instantiate bean ''{0}'' (for component {1}) as class {2}: {3}
+AbstractBeanInitializer.unable-to-set-property=Unable to set property ''{0}'' of {1} to {2}.
# org.apache.tapestry.binding
1.7 +4 -13 jakarta-tapestry/framework/src/org/apache/tapestry/valid/ValidField.java
Index: ValidField.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/valid/ValidField.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ValidField.java 25 Apr 2003 01:18:33 -0000 1.6
+++ ValidField.java 12 May 2003 15:41:17 -0000 1.7
@@ -85,10 +85,6 @@
public abstract class ValidField extends AbstractTextField implements IFormComponent
{
- /** @since 2.2 **/
-
- private Class _valueType;
-
public abstract Object getValue();
public abstract void setValue(Object value);
@@ -120,6 +116,9 @@
IValidator validator = getValidator();
+ if (validator == null)
+ throw Tapestry.createRequiredParameterException(this, "validator");
+
boolean rendering = !cycle.isRewinding();
if (rendering)
@@ -234,12 +233,4 @@
}
public abstract IValidator getValidator();
-
- protected void cleanupAfterRender(IRequestCycle cycle)
- {
- _valueType = null;
-
- super.cleanupAfterRender(cycle);
- }
-
}