Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-8455

Memory Node store implementation of PropertyState throws Exception that is not in line with the API documentation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.16.0
    • store-spi

    Description

      As per the api doc here https://github.com/apache/jackrabbit-oak/blob/trunk/oak-api/src/main/java/org/apache/jackrabbit/oak/api/PropertyState.java#L67#L69 for PropertyState the getValue method should throw an IllegalStateException if the actual Property stored is multivalued and the code calling getValue(Type type) expects it to be single valued i.e type.isArray() == false .

       

      In SegmentStore implementation , this is followed and the getValue method throws an IllegalStateException in this scenario .

       

      However in case of MemoryNodeStore , the code here throws an IllegalArgumentException https://github.com/apache/jackrabbit-oak/blob/trunk/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MultiPropertyState.java#L151#L154 instead of IllegalStateException .

      Since MemoryNodeStore is primarily used in testing , this difference in implementation can lead to false or incomplete testing .

       

      For example , the fix for https://issues.apache.org/jira/browse/OAK-8328 required to catch IllegalStateException in a use case where the property was configured to be multi valued in the repository but the code expected it to be single valued . Now the fix works fine on SegmentStore , but due to the difference in implementation in MemoryNodeStore , a test written with memorynode store fails .

       

      Attachments

        1. OAK-8455_1.patch
          3 kB
          Nitin Gupta

        Issue Links

          Activity

            People

              thomasm Thomas Mueller
              ngupta Nitin Gupta
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: