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

Avoid logging an failure that is thrown as exception in ModelFactory.createModel

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • Sling Models Implementation 1.1.0
    • Sling Models Impl 1.2.0
    • Extensions
    • None
    • Patch

    Description

      If a post construct method throws an exception, that is NOT a technical problem but can be fixed by the user (e.g. some content problem that can be fixed by an author directly), at the moment this is still logged as an error in the log file (where it should really a debug log at most).

      We could disable the error log for post construct messages completely (patch1, solves the problem for ModelAdapterFactory.createModel() but for ModelAdapterFactory.getAdapter() this would swallow the exception, also see SLING-3709) or we just ensure, that for the case we throw the exception we don't throw and log the exception (which is bad practice anyway, patch2).

      Attachments

        1. SLING-4630-patch1.patch
          1 kB
          Georg Henzler
        2. SLING-4630-patch2.patch
          0.7 kB
          Georg Henzler

        Activity

          People

            sseifert Stefan Seifert
            henzlerg Georg Henzler
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: