This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-jxpath.git
commit 8dea6ed77b95436b67acafa4ee1ad1355fd68fb5 Author: Gary D. Gregory <[email protected]> AuthorDate: Sun Mar 16 13:29:16 2025 -0400 No need to nest else --- .../jxpath/ri/model/beans/NullPropertyPointer.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/apache/commons/jxpath/ri/model/beans/NullPropertyPointer.java b/src/main/java/org/apache/commons/jxpath/ri/model/beans/NullPropertyPointer.java index ce4c1fa..f7d5e64 100644 --- a/src/main/java/org/apache/commons/jxpath/ri/model/beans/NullPropertyPointer.java +++ b/src/main/java/org/apache/commons/jxpath/ri/model/beans/NullPropertyPointer.java @@ -216,21 +216,18 @@ public class NullPropertyPointer extends PropertyPointer { + asPath() + ", the target object is null"); } - if (parent instanceof PropertyOwnerPointer - && ((PropertyOwnerPointer) parent) - .isDynamicPropertyDeclarationSupported()) { - // If the parent property owner can create - // a property automatically - let it do so - final PropertyPointer propertyPointer = - ((PropertyOwnerPointer) parent).getPropertyPointer(); - propertyPointer.setPropertyName(propertyName); - propertyPointer.setValue(value); - } - else { + if (!(parent instanceof PropertyOwnerPointer) || !((PropertyOwnerPointer) parent) + .isDynamicPropertyDeclarationSupported()) { throw new JXPathInvalidAccessException( "Cannot set property " + asPath() + ", path does not match a changeable location"); } + // If the parent property owner can create + // a property automatically - let it do so + final PropertyPointer propertyPointer = + ((PropertyOwnerPointer) parent).getPropertyPointer(); + propertyPointer.setPropertyName(propertyName); + propertyPointer.setValue(value); } }
