Annotation initializer should trim() property names
---------------------------------------------------
Key: HIVEMIND-138
URL: http://issues.apache.org/jira/browse/HIVEMIND-138
Project: HiveMind
Type: Bug
Environment: Hivemind 1.1 beta 1
Reporter: Phil Zoio
I've been trying out the new annotations, and ran into a problem
I set up an annotation for a NumberValidator bean:
@Bean(value = NumberValidator.class, initializer = "required=true,
valueType=Float")
public abstract IValidator getAmountValidator();
and couldn't work out why it would not recognise a property type - here's the
exception
component: [EMAIL PROTECTED]
Stack Trace:
*
org.apache.hivemind.util.ClassAdaptor.getPropertyAdaptor(ClassAdaptor.java:136)
* org.apache.hivemind.util.ClassAdaptor.smartWrite(ClassAdaptor.java:74)
*
org.apache.hivemind.util.ClassAdaptor.configurePropertyFromToken(ClassAdaptor.java:221)
*
org.apache.hivemind.util.ClassAdaptor.configureProperties(ClassAdaptor.java:195)
*
org.apache.hivemind.util.PropertyUtils.configureProperties(PropertyUtils.java:89)
*
org.apache.tapestry.bean.LightweightBeanInitializer.setBeanProperty(LightweightBeanInitializer.java:45)
Turns out that the problem lies in
private void configurePropertyFromToken(Object target, String token)
{
int equalsx = token.indexOf('=');
if (equalsx > 0)
{
String propertyName = token.substring(0, equalsx);
String value = token.substring(equalsx + 1);
smartWrite(target, propertyName, value);
return;
}
etc...
}
which does not trim the space before valueType. The result is that it doesn't
find the property name " valueType".
You won't get this problem if you trimmed() propertyName before calling
smartWrite()
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]