Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-6445

Don't swallow exceptions in Op.exec() / doInSystemContext

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 5.4.2
    • core

      When an exception occurs in Op.exec() or even potentially in MgnlContext.getSystemContext(), AND MgnlContext.release() ALSO fails, the former exception is lost; neither logged nor thrown.

      IMO, the former exception is the one we want to be throwing, and a further exception in release should be ignored (but logged anyway)

      example

      This happens a lot, btw, especially during development, since we start components/guice through a doInSystemContext call from MagnoliaServletContextListener; any misconfigured or missing component, wrong constructor, etc, just results in NPE in info.magnolia.objectfactory.guice.GuiceUtils#hasExplicitBindingFor because of this.
      (FYI see attached patch; I believe if this error here gets fixed, the NPE won't happen again, however, having an explicit exception rather than an NPE would have helped as well).

      Test added in MAGNOLIA-6363 is also questionable. It seems overly complicated and undocumented. At the very least, it should say what it does/why (i understand there's probably no easy way to test those pesky static methods).

        Acceptance criteria

              Unassigned Unassigned
              gjoseph Magnolia International
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:

                  Bug DoR
                  Task DoD