This commit is contained in:
Keith Donald
2009-07-10 21:32:24 +00:00
parent 84bdd1ab8e
commit e4c868b837
3 changed files with 48 additions and 14 deletions

View File

@@ -295,12 +295,6 @@ public class GenericBinder implements Binder {
"Unable to get model binding; cannot parse property expression from property string ["
+ property + "]", e);
}
try {
propertyExpression.getValueType(createEvaluationContext());
} catch (EvaluationException e) {
throw new IllegalArgumentException("Unable to get model binding; cannot access property '"
+ propertyExpression.getExpressionString() + "'", e);
}
return new BindingImpl(propertyExpression, configuration.getFormatter());
}
@@ -694,7 +688,7 @@ public class GenericBinder implements Binder {
builder.arg("label", new ResolvableArgument(property));
builder.arg("value", sourceValue);
builder.defaultMessage("Successfully bound user value " + StylerUtils.style(sourceValue)
+ "to property '" + property + "'");
+ " to property '" + property + "'");
return builder.build();
}
};

View File

@@ -264,7 +264,7 @@ public class GenericBinderTests {
binder.registerFormatter(new GenericCollectionPropertyType(List.class, Address.class), new AddressListFormatter());
Map<String, String> values = new LinkedHashMap<String, String>();
values.put("addresses", "4655 Macy Lane:Melbourne:FL:35452,1234 Rostock Circle:Palm Bay:FL:32901,1977 Bel Aire Estates:Coker:AL:12345");
binder.bind(values);
BindingResults results = binder.bind(values);
Assert.assertEquals(3, bean.addresses.size());
assertEquals("4655 Macy Lane", bean.addresses.get(0).street);
assertEquals("Melbourne", bean.addresses.get(0).city);