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

Optional sub models are logged as warn if they cannot be adapted

    XMLWordPrintableJSON

Details

    Description

      Currently Sling Models logs the example model [1] as warning [2] if the sub model image does not exist. This really should be a debug log as it is totally fine if in optional field cannot be set?

      [1]

      com......mediagallery.MediaGalleryElement
      ...
          @Inject
          @Optional
          @Named(value = ".")
          private Image image;
      

      [2] org.apache.sling.models.impl.ModelAdapterFactory.injectElement(InjectableElement, Object, Model, DisposalCallbackRegistry, InjectCallback)

                      // log previous injection error, if there was any
                      if (lastInjectionException != null) {
                          log.warn("Although falling back to default value worked, injection into {} failed because of: " + lastInjectionException.getMessage(), element.getAnnotatedElement(), lastInjectionException);
                      }
      

      Attachments

        Issue Links

          Activity

            People

              kwin Konrad Windszus
              henzlerg Georg Henzler
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: