Repository: commons-lang Updated Branches: refs/heads/master f02261849 -> 0343777db
LANG-1232: DiffBuilder: Add null check on fieldName when appending Object or Object[] (closes #122). Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/b212aa3c Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/b212aa3c Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/b212aa3c Branch: refs/heads/master Commit: b212aa3c6fb91c34a0faccdf783a0a085d40be94 Parents: f022618 Author: Nick Manley <nickmanle...@outlook.com> Authored: Sat Jan 23 23:35:23 2016 -0600 Committer: pascalschumacher <pascalschumac...@gmx.net> Committed: Thu May 19 19:51:51 2016 +0200 ---------------------------------------------------------------------- .../org/apache/commons/lang3/builder/DiffBuilder.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/b212aa3c/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java b/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java index 7a97e9c..677a3ad 100644 --- a/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java +++ b/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java @@ -832,10 +832,14 @@ public class DiffBuilder implements Builder<DiffResult> { * @param rhs * the right hand {@code Object} * @return this + * @throws IllegalArgumentException + * if field name is {@code null} */ public DiffBuilder append(final String fieldName, final Object lhs, final Object rhs) { - + if (fieldName == null) { + throw new IllegalArgumentException("Field name cannot be null"); + } if (objectsTriviallyEqual) { return this; } @@ -913,10 +917,15 @@ public class DiffBuilder implements Builder<DiffResult> { * the left hand {@code Object[]} * @param rhs * the right hand {@code Object[]} + * @throws IllegalArgumentException + * if field name is {@code null} * @return this */ public DiffBuilder append(final String fieldName, final Object[] lhs, final Object[] rhs) { + if (fieldName == null) { + throw new IllegalArgumentException("Field name cannot be null"); + } if (objectsTriviallyEqual) { return this; }