Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-1455

Improve metamodel invalid exception handling

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.12.2
    • Fix Version/s: 1.13.0
    • Component/s: Core, Core: Viewer: Wicket
    • Labels:
      None

      Description

      At the moment the MMV error handling works only "by accident":

      • if an validation failure is found then the remaining initialization of authentication manager and persistence is skipped.
      • attempting to go to the login causes a null pointer exception
      • this exception is caught and then the MMV thrown

      This also raises an issue for implementations of - say - the ThemeProvider that want to make database queries, eg via Settings service. The todoapp does this.

      So, instead, we should always do the complete initialization even if there is a metamodel validation exception, but then intercept any such exceptions and route the MmvErrorPage thereafter.

        Activity

        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 44d4b2e505ef9bf596f807f78d06f64f6ce60b00 in isis's branch refs/heads/master from Dan Haywood
        [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=44d4b2e ]

        ISIS-1455: improves bootstrapping in event of an invalid metamodel exception.

        IsisSessionFactoryBuilder now always completes the initialization (of the authenticationManager, authorizationManadater and persistenceSessionFactory) even in the case of invalid metamodel. This means that any custom implementations of SPI services, eg ThemeProvider - do not need special case logic as to whether the framework is properly or only half initialized.

        Instead, in WebRequestCycleForIsis, we use the "onRequestHandlerResolved" callback hoop (previously not overridden) to throw the MetaModelInvalidException if need be (but peeking inside first to ensure that we're not already on the way to rendering an error page)

        In addition:

        • no need to hold the list of validation errors on the IsisWicketApplication, can simply use IsisContext#getMetaModelValidationExceptionIfAny()
        • to support this, added overloaded constructor to MmvErrorPage
        • added isInitialized() method on PersistenceSessionFactory (though not actually used elsewhere in this implementation).
        • IsisSignInPanel no longer uses doInSession for its setVisibilityAllowedBasedOnAvailableServices(...) (though this is just a simplfication of code, and would still be fine to have left it as is).
        Show
        jira-bot ASF subversion and git services added a comment - Commit 44d4b2e505ef9bf596f807f78d06f64f6ce60b00 in isis's branch refs/heads/master from Dan Haywood [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=44d4b2e ] ISIS-1455 : improves bootstrapping in event of an invalid metamodel exception. IsisSessionFactoryBuilder now always completes the initialization (of the authenticationManager, authorizationManadater and persistenceSessionFactory) even in the case of invalid metamodel. This means that any custom implementations of SPI services, eg ThemeProvider - do not need special case logic as to whether the framework is properly or only half initialized. Instead, in WebRequestCycleForIsis, we use the "onRequestHandlerResolved" callback hoop (previously not overridden) to throw the MetaModelInvalidException if need be (but peeking inside first to ensure that we're not already on the way to rendering an error page) In addition: no need to hold the list of validation errors on the IsisWicketApplication, can simply use IsisContext#getMetaModelValidationExceptionIfAny() to support this, added overloaded constructor to MmvErrorPage added isInitialized() method on PersistenceSessionFactory (though not actually used elsewhere in this implementation). IsisSignInPanel no longer uses doInSession for its setVisibilityAllowedBasedOnAvailableServices(...) (though this is just a simplfication of code, and would still be fine to have left it as is).
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit a98cbfdd6cb0c20f9d4b26b7b367a54e3815d0fa in isis's branch refs/heads/master from Dan Haywood
        [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=a98cbfd ]

        ISIS-1455: improves visibility of metamodel validation exceptions when running integration tests.

        Modifies IsisSystemForTest so that if there are metamodel validation exceptions, then these are summarized and printed as part of the immediate fail() that is thrown when the integtest harness is bootstrapping.

        Show
        jira-bot ASF subversion and git services added a comment - Commit a98cbfdd6cb0c20f9d4b26b7b367a54e3815d0fa in isis's branch refs/heads/master from Dan Haywood [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=a98cbfd ] ISIS-1455 : improves visibility of metamodel validation exceptions when running integration tests. Modifies IsisSystemForTest so that if there are metamodel validation exceptions, then these are summarized and printed as part of the immediate fail() that is thrown when the integtest harness is bootstrapping.

          People

          • Assignee:
            danhaywood Dan Haywood
            Reporter:
            danhaywood Dan Haywood
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development