{
try {
Method method =
getAccessibleMethod(propertyDescriptor.getWriteMethod());
if (method == null) {
throw new JXPathException("No write method");
}
value = convert(value, propertyDescriptor.getPropertyType());
value = method.invoke(bean, new Object[] { value });
}
catch (Exception ex) {
throw new JXPathException(
"Cannot modify property: "
+ (bean == null ? "null" : bean.getClass().getName())
+ "."
+ propertyDescriptor.getName(),
ex);