Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-6341

ResourcePath injector does not correctly wraps to array

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Sling Models Impl 1.2.2
    • Sling Models Impl 1.3.6
    • None
    • None

    Description

      In a sling model, when injecting resources from the resourcePath injector, if you declare the injected field as an array, the injection will fail.

      Injection works fine if you declare the field as a list.

      to verify.

      Have a resource which holds a property with a path to other resource.
      Have the following injection:

      @ResourcePath(path = "/content/test/node")
      private Resource[] pathProperty;

      I get the following:

      org.apache.sling.models.factory.ModelClassException: Could not adapt from class org.apache.sling.jcr.resource.internal.helper.jcr.JcrNodeResource to class [Lorg.apache.sling.api.resource.Resource;

      Attachments

        Activity

          People

            justinedelson Justin Edelson
            santiagozky Santiago GarcĂ­a Pimentel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: