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

Avoid NPE when loading complex property with unknown key (mongodb)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2023.0, 2021.37
    • Component/s: Streams

      Description

      setProperties bulk action should not fail on NPE during loginAs:

      setProperties: Terminate computation due to previous failure
      
      javax.security.auth.login.LoginException: java.lang.NullPointerException
      	at org.nuxeo.ecm.core.api.model.impl.ComplexProperty.init(ComplexProperty.java:203)
      	at org.nuxeo.ecm.core.api.impl.DataModelImpl.<init>(DataModelImpl.java:73)
      	at org.nuxeo.ecm.directory.BaseSession.createEntryModel(BaseSession.java:272)
      	at org.nuxeo.ecm.directory.BaseSession.createEntryModel(BaseSession.java:286)
      	at org.nuxeo.directory.mongodb.MongoDBSession.fieldMapToDocumentModel(MongoDBSession.java:648)
      	at org.nuxeo.directory.mongodb.MongoDBSession.doQuery(MongoDBSession.java:337)
      	at org.nuxeo.directory.mongodb.MongoDBSession.getEntryFromSource(MongoDBSession.java:98)
      	at org.nuxeo.ecm.directory.DirectoryCache.getEntry(DirectoryCache.java:121)
      	at org.nuxeo.ecm.directory.BaseSession.getEntry(BaseSession.java:344)
      	at org.nuxeo.ecm.platform.usermanager.UserManagerImpl.getUserModel(UserManagerImpl.java:1266)
      	at org.nuxeo.ecm.platform.usermanager.UserManagerImpl.getPrincipal(UserManagerImpl.java:1309)
      	at org.nuxeo.ecm.platform.usermanager.UserManagerImpl.getPrincipal(UserManagerImpl.java:1292)
      	at org.nuxeo.ecm.platform.usermanager.UserManagerImpl.getPrincipalUsingCache(UserManagerImpl.java:624)
      	at org.nuxeo.ecm.platform.usermanager.UserManagerImpl.getPrincipal(UserManagerImpl.java:616)
      	at org.nuxeo.ecm.platform.usermanager.UserManagerImpl.getPrincipal(UserManagerImpl.java:608)
      	at org.nuxeo.ecm.platform.login.NuxeoLoginModule.lambda$createIdentity$0(NuxeoLoginModule.java:272)
      	at org.nuxeo.runtime.api.Framework.doPrivileged(Framework.java:293)
      	at org.nuxeo.ecm.platform.login.NuxeoLoginModule.createIdentity(NuxeoLoginModule.java:272)
      	at org.nuxeo.ecm.platform.login.NuxeoLoginModule.validateUserIdentity(NuxeoLoginModule.java:333)
      	at org.nuxeo.ecm.platform.login.NuxeoLoginModule.getPrincipal(NuxeoLoginModule.java:194)
      	at org.nuxeo.ecm.platform.login.NuxeoLoginModule.login(NuxeoLoginModule.java:236)
      	at org.nuxeo.runtime.api.LoginModuleWrapper.login(LoginModuleWrapper.java:80)
      	at sun.reflect.GeneratedMethodAccessor85.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at javax.security.auth.login.LoginContext.invoke(LoginContext.java:755)
      	at javax.security.auth.login.LoginContext.access$000(LoginContext.java:195)
      	at javax.security.auth.login.LoginContext$4.run(LoginContext.java:682)
      	at javax.security.auth.login.LoginContext$4.run(LoginContext.java:680)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
      	at javax.security.auth.login.LoginContext.login(LoginContext.java:587)
      	at org.nuxeo.ecm.platform.ui.web.auth.NuxeoAuthenticationFilter.loginAs(NuxeoAuthenticationFilter.java:1243)
      	at org.nuxeo.ecm.platform.ui.web.auth.service.LoginAsImpl.loginAs(LoginAsImpl.java:34)
      	at org.nuxeo.runtime.api.Framework.loginAsUser(Framework.java:345)
      	at org.nuxeo.ecm.core.bulk.action.computation.AbstractBulkComputation.lambda$processBatchOfDocuments$1(AbstractBulkComputation.java:144)
      	at org.nuxeo.runtime.transaction.TransactionHelper.lambda$runInTransaction$5(TransactionHelper.java:634)
      	at org.nuxeo.runtime.transaction.TransactionHelper.runInTransaction(TransactionHelper.java:667)
      	at org.nuxeo.runtime.transaction.TransactionHelper.runInTransaction(TransactionHelper.java:634)
      	at org.nuxeo.runtime.transaction.TransactionHelper.runInTransaction(TransactionHelper.java:622)
      	at org.nuxeo.ecm.core.bulk.action.computation.AbstractBulkComputation.processBatchOfDocuments(AbstractBulkComputation.java:140)
      	at org.nuxeo.ecm.core.bulk.action.computation.AbstractBulkComputation.processRecord(AbstractBulkComputation.java:104)
      	at org.nuxeo.lib.stream.computation.log.ComputationRunner.lambda$processRecordWithRetry$10(ComputationRunner.java:417)
      	at net.jodah.failsafe.Functions$10.call(Functions.java:252)
      	at net.jodah.failsafe.SyncFailsafe.call(SyncFailsafe.java:145)
      	at net.jodah.failsafe.SyncFailsafe.run(SyncFailsafe.java:81)
      	at org.nuxeo.lib.stream.computation.log.ComputationRunner.processRecordWithRetry(ComputationRunner.java:417)
      

      As commented by Kevin, the NPE happens when loading a complex property with an unknown key because of a schema change.
      We should simply ignore unknown key.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: