Repository: cayenne Updated Branches: refs/heads/master b0d0faff0 -> aae4e82a9
Catch conversion errors when setting property values in order to get an error message that includes the property name Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/aae4e82a Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/aae4e82a Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/aae4e82a Branch: refs/heads/master Commit: aae4e82a93f25d7c44cd86d020ddb0fd283c1242 Parents: b0d0faf Author: John Huss <[email protected]> Authored: Fri Nov 18 17:00:19 2016 -0600 Committer: John Huss <[email protected]> Committed: Fri Nov 18 17:10:39 2016 -0600 ---------------------------------------------------------------------- .../java/org/apache/cayenne/reflect/BeanAccessor.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cayenne/blob/aae4e82a/cayenne-server/src/main/java/org/apache/cayenne/reflect/BeanAccessor.java ---------------------------------------------------------------------- diff --git a/cayenne-server/src/main/java/org/apache/cayenne/reflect/BeanAccessor.java b/cayenne-server/src/main/java/org/apache/cayenne/reflect/BeanAccessor.java index ec30df0..c6c2884 100644 --- a/cayenne-server/src/main/java/org/apache/cayenne/reflect/BeanAccessor.java +++ b/cayenne-server/src/main/java/org/apache/cayenne/reflect/BeanAccessor.java @@ -139,14 +139,14 @@ public class BeanAccessor implements Accessor { Class type = writeMethod.getParameterTypes()[0]; Converter<?> converter = ConverterFactory.factory.getConverter(type); - newValue = (converter != null) ? converter.convert(newValue, type) : newValue; - - // this will take care of primitives. - if (newValue == null) { - newValue = this.nullValue; - } - try { + newValue = (converter != null) ? converter.convert(newValue, type) : newValue; + + // this will take care of primitives. + if (newValue == null) { + newValue = this.nullValue; + } + writeMethod.invoke(object, newValue); } catch (Throwable th) { throw new PropertyException("Error writing property: " + propertyName, this, object, th);
