You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/06/23 13:59:02 UTC

[commons-jxpath] branch master updated (6e298be -> c05ba07)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jxpath.git


    from 6e298be  Merge pull request #65 from apache/dependabot/github_actions/actions/checkout-3.5.3
     new 9ac612e  JDOMNodePointer.compareChildNodePointers(NodePointer, NodePointer) now throws IllegalStateException instead of RuntimeException.
     new c05ba07  ValueUtils.setValue() now throws IllegalArgumentException instead of RuntimeException.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/changes/changes.xml                                 |  6 ++++++
 .../commons/jxpath/ri/model/jdom/JDOMNodePointer.java   |  5 +----
 .../java/org/apache/commons/jxpath/util/ValueUtils.java | 17 ++++-------------
 3 files changed, 11 insertions(+), 17 deletions(-)


[commons-jxpath] 01/02: JDOMNodePointer.compareChildNodePointers(NodePointer, NodePointer) now throws IllegalStateException instead of RuntimeException.

Posted by gg...@apache.org.
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 9ac612e7d96908ee5c0dc63eeaba411f3165bb37
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 09:50:23 2023 -0400

    JDOMNodePointer.compareChildNodePointers(NodePointer, NodePointer) now
    throws IllegalStateException instead of RuntimeException.
---
 src/changes/changes.xml                                              | 3 +++
 .../org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java     | 5 +----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 7c285ed..d582b7c 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -86,6 +86,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action dev="ggregory" type="fix">
         Fix possible NPE in PackageFunctions.getFunction(String, String, Object[]).
       </action>
+      <action dev="ggregory" type="fix" due-to="Gary Gregory">
+        JDOMNodePointer.compareChildNodePointers() now throws IllegalStateException instead of RuntimeException.
+      </action>      
       <!-- ADD -->
       <action issue="JXPATH-123" dev="mbenson" type="add">
         XPath function "ends-with" is not implemented (although "starts-with" is).
diff --git a/src/main/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java b/src/main/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java
index f04dca0..f3b5324 100644
--- a/src/main/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java
+++ b/src/main/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java
@@ -198,10 +198,7 @@ public class JDOMNodePointer extends NodePointer {
         }
 
         if (!(node instanceof Element)) {
-            throw new RuntimeException(
-                "JXPath internal error: "
-                    + "compareChildNodes called for "
-                    + node);
+            throw new IllegalStateException("JXPath internal error: " + "compareChildNodes called for " + node);
         }
 
         final List children = ((Element) node).getContent();


[commons-jxpath] 02/02: ValueUtils.setValue() now throws IllegalArgumentException instead of RuntimeException.

Posted by gg...@apache.org.
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 c05ba079c977d6ee70d9e2e81604f7c4cbe8ec07
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 09:58:58 2023 -0400

    ValueUtils.setValue() now throws IllegalArgumentException instead of
    RuntimeException.
---
 src/changes/changes.xml                                 |  5 ++++-
 .../java/org/apache/commons/jxpath/util/ValueUtils.java | 17 ++++-------------
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index d582b7c..6f07cb8 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -88,7 +88,10 @@ The <action> type attribute can be add,update,fix,remove.
       </action>
       <action dev="ggregory" type="fix" due-to="Gary Gregory">
         JDOMNodePointer.compareChildNodePointers() now throws IllegalStateException instead of RuntimeException.
-      </action>      
+      </action>
+      <action dev="ggregory" type="fix" due-to="Gary Gregory">
+        ValueUtils.setValue() now throws IllegalArgumentException instead of RuntimeException.
+      </action>
       <!-- ADD -->
       <action issue="JXPATH-123" dev="mbenson" type="add">
         XPath function "ends-with" is not implemented (although "starts-with" is).
diff --git a/src/main/java/org/apache/commons/jxpath/util/ValueUtils.java b/src/main/java/org/apache/commons/jxpath/util/ValueUtils.java
index 843715a..ecee382 100644
--- a/src/main/java/org/apache/commons/jxpath/util/ValueUtils.java
+++ b/src/main/java/org/apache/commons/jxpath/util/ValueUtils.java
@@ -478,23 +478,15 @@ public class ValueUtils {
             final PropertyDescriptor propertyDescriptor, final int index, final Object value) {
         if (propertyDescriptor instanceof IndexedPropertyDescriptor) {
             try {
-                final IndexedPropertyDescriptor ipd =
-                    (IndexedPropertyDescriptor) propertyDescriptor;
+                final IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) propertyDescriptor;
                 final Method method = ipd.getIndexedWriteMethod();
                 if (method != null) {
-                    method.invoke(
-                        bean,
-                            Integer.valueOf(index),
-                            convert(value, ipd.getIndexedPropertyType()));
+                    method.invoke(bean, Integer.valueOf(index), convert(value, ipd.getIndexedPropertyType()));
                     return;
                 }
             }
             catch (final Exception ex) {
-                throw new RuntimeException(
-                    "Cannot access property: "
-                        + propertyDescriptor.getName()
-                        + ", "
-                        + ex.getMessage());
+                throw new IllegalArgumentException("Cannot access property: " + propertyDescriptor.getName() + ", " + ex.getMessage());
             }
         }
         // We will fall through if there is no indexed read
@@ -506,8 +498,7 @@ public class ValueUtils {
             setValue(bean, propertyDescriptor, value);
         }
         else {
-            throw new RuntimeException(
-                "Not a collection: " + propertyDescriptor.getName());
+            throw new IllegalArgumentException("Not a collection: " + propertyDescriptor.getName());
         }
     }