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

ModelFactory.canCreateFromAdaptable reports false errors when using "adapters" on models

    XMLWordPrintableJSON

    Details

      Description

      SLING-3709 introduced a new "ModelFactory" with methods for checking if adaption is possible and adapt to a model with enhanced exception support.

      the current implementation does not support the "adapters" variant of models, where the model is adapted to an alternate adapter class (see documentation).

      adaption of such models via adaptTo still works, but false errors are reported

      ERROR org.apache.sling.models.impl.ModelAdapterFactory - Provided Adapter class does not have a Model annotation
      

      if using the factory method ModelFactory.canCreateFromAdaptable an exception is thrown - this is wrong.

      attached is a patch that extends the unit test to include calls to canCreateFromAdaptable - all fail ImplementsExtendsTest.patch

      Konrad Windszus: can you have a look?

        Attachments

        1. ImplementsExtendsTest.patch
          3 kB
          Stefan Seifert

          Issue Links

            Activity

              People

              • Assignee:
                sseifert Stefan Seifert
                Reporter:
                sseifert Stefan Seifert
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: