Uploaded image for project: 'Commons JXPath'
  1. Commons JXPath
  2. JXPATH-160

ValueUtils.getValue throws exception with set and index above size

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.3, 1.4
    • 1.4
    • None

    Description

      ValueUtils offers a utility method to retrieve an indexed value from a collection. In case this collection is an array or a List, the method returns null if the index is above the size. If the supplied collection is a Set instead, then a NoSuchElementException is thrown if index is above size.

      The desired behavior is that the result is the same for all kinds of collections and that even in the case of a Set null is returned if the index value is too large.

      Attachments

        1. NullValueFromSet.patch
          0.7 kB
          Stefan Albrecht
        2. ValueUtilsTest.java
          2 kB
          Michele Vivoda
        3. ValueUtilsTest.java
          1 kB
          Stefan Albrecht

        Activity

          People

            britter Benedikt Ritter
            stalbrecht Stefan Albrecht
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: