Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-20083

Don't instantiate CoreSession through service adapter

    XMLWordPrintable

    Details

    • Type: Clean up
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 8.10
    • Component/s: Core
    • Tags:
    • Upgrade notes:
      Hide

      Framework.getService(CoreSession.class) cannot be used anymore to acquire a CoreSession.
      Instead one should use:
      Framework.getService(CoreSessionService.class).createCoreSession(repositoryName, principal)

      Show
      Framework.getService(CoreSession.class) cannot be used anymore to acquire a CoreSession. Instead one should use: Framework.getService(CoreSessionService.class).createCoreSession(repositoryName, principal)
    • Sprint:
      nxFG 8.4.1

      Description

      Today to acquire a LocalSession (CoreSession implementation) we do (in CoreInstance): Framework.getService(CoreSession.class) which uses the RepositoryService.getAdapter method.

      This is a problem when using recent code in nuxeo-apidoc-server in org.nuxeo.apidoc.introspection.ServerInfo which does:

          protected static boolean isServiceOverriden(RegistrationInfo ri, String serviceName) {
              Class<?> typeof = Class.forName(serviceName);
              final Object adapter = ri.getComponent().getAdapter(typeof);
              final Object service = Framework.getService(typeof);
              if (adapter == service) {
                  return false;
              }
              return service.getClass() != adapter.getClass();
      

      So just checking the adapter actually instantiates a CoreSession, which is bad (and it's not closed).

      Instead to acquire the CoreSession we could simply call an explicit method on the RepositoryService.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                PagerDuty

                Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.