Uploaded image for project: 'Causeway'
  1. Causeway
  2. CAUSEWAY-1515

BackgroundCommandExecution can NPE if it attempts to invoke an action on an object that no longer exists.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.13.0
    • 1.13.1
    • Core
    • None

    Description

      This is the stack trace that occurs in the main body:

      org.apache.isis.core.runtime.persistence.ObjectNotFoundException: Object not found in store with oid estatioCommunications.Communication:24
      	at org.apache.isis.core.runtime.system.persistence.PersistenceSession.loadPojo(PersistenceSession.java:974)
      	at org.apache.isis.core.runtime.system.persistence.PersistenceSession.recreatePojo(PersistenceSession.java:1633)
      	at org.apache.isis.core.runtime.system.persistence.PersistenceSession.adapterFor(PersistenceSession.java:1576)
      	at org.apache.isis.core.runtime.system.persistence.PersistenceSession.adapterFor(PersistenceSession.java:1536)
      	at org.apache.isis.core.runtime.sessiontemplate.AbstractIsisSessionTemplate.adapterFor(AbstractIsisSessionTemplate.java:108)
      	at org.apache.isis.core.runtime.sessiontemplate.AbstractIsisSessionTemplate.adapterFor(AbstractIsisSessionTemplate.java:104)
      	at org.apache.isis.core.runtime.sessiontemplate.AbstractIsisSessionTemplate.adapterFor(AbstractIsisSessionTemplate.java:99)
      	at org.apache.isis.core.runtime.services.background.BackgroundCommandExecution.targetAdapterFor(BackgroundCommandExecution.java:331)
      	at org.apache.isis.core.runtime.services.background.BackgroundCommandExecution$2.execute(BackgroundCommandExecution.java:177)
      	at org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.executeWithinTransaction(IsisTransactionManager.java:144)
      	at org.apache.isis.core.runtime.services.background.BackgroundCommandExecution.execute(BackgroundCommandExecution.java:111)
      	at org.apache.isis.core.runtime.services.background.BackgroundCommandExecution.doExecute(BackgroundCommandExecution.java:95)
      	at org.apache.isis.core.runtime.sessiontemplate.AbstractIsisSessionTemplate.execute(AbstractIsisSessionTemplate.java:42)
      	at org.isisaddons.module.quartz.dom.jobs.RunBackgroundCommandsJob.execute(RunBackgroundCommandsJob.java:46)
      	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
      	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
      Caused by: javax.jdo.JDOObjectNotFoundException: No such database row
      FailedObject:24[OID]org.incode.module.communications.dom.impl.comms.Communication
      NestedThrowables:
      org.datanucleus.exceptions.NucleusObjectNotFoundException: No such database row
      	at org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:564)
      	at org.datanucleus.api.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1728)
      	at org.datanucleus.api.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1741)
      	at org.apache.isis.core.runtime.system.persistence.PersistenceSession.loadPojo(PersistenceSession.java:963)
      	... 15 more
      Caused by: org.datanucleus.exceptions.NucleusObjectNotFoundException: No such database row
      	at org.datanucleus.store.rdbms.request.FetchRequest.execute(FetchRequest.java:347)
      	at org.datanucleus.store.rdbms.RDBMSPersistenceHandler.fetchObject(RDBMSPersistenceHandler.java:319)
      	at org.datanucleus.state.AbstractStateManager.loadFieldsFromDatastore(AbstractStateManager.java:1147)
      	at org.datanucleus.state.StateManagerImpl.validate(StateManagerImpl.java:4297)
      	at org.datanucleus.ExecutionContextImpl.findObject(ExecutionContextImpl.java:3621)
      	at org.datanucleus.api.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1723)
      

      Then, we get an NPE in the BackgroundCommandExecution after the execption is caught:

      final Interaction.Execution priorExecution = backgroundInteraction.getPriorExecution();
                      backgroundCommand.setCompletedAt(priorExecution.getCompletedAt());
      

      because priorExecution is null. This results in:

      java.lang.NullPointerException
      	at org.apache.isis.core.runtime.services.background.BackgroundCommandExecution$2.execute(BackgroundCommandExecution.java:234)
      	at org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.executeWithinTransaction(IsisTransactionManager.java:144)
      	at org.apache.isis.core.runtime.services.background.BackgroundCommandExecution.execute(BackgroundCommandExecution.java:111)
      	at org.apache.isis.core.runtime.services.background.BackgroundCommandExecution.doExecute(BackgroundCommandExecution.java:95)
      	at org.apache.isis.core.runtime.sessiontemplate.AbstractIsisSessionTemplate.execute(AbstractIsisSessionTemplate.java:42)
      	at org.isisaddons.module.quartz.dom.jobs.RunBackgroundCommandsJob.execute(RunBackgroundCommandsJob.java:46)
      	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
      	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
      

      Attachments

        Activity

          People

            danhaywood Daniel Keir Haywood
            danhaywood Daniel Keir Haywood
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: