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

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

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.13.0
    • Fix Version/s: 1.13.1
    • Component/s: Core
    • Labels:
      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)
      

        Activity

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

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

        ISIS-1515: adds a guard in BackgroundCommandExecution for in case priorExecution is null (can happen if attempts to invoke an action on an object that no longer exists)

        Show
        jira-bot ASF subversion and git services added a comment - Commit 8da21a3a841cd4e11146f6de4730f1b1673d1c13 in isis's branch refs/heads/master from Dan Haywood [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=8da21a3 ] ISIS-1515 : adds a guard in BackgroundCommandExecution for in case priorExecution is null (can happen if attempts to invoke an action on an object that no longer exists)
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 8da21a3a841cd4e11146f6de4730f1b1673d1c13 in isis's branch refs/heads/maint-1.13.1 from Dan Haywood
        [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=8da21a3 ]

        ISIS-1515: adds a guard in BackgroundCommandExecution for in case priorExecution is null (can happen if attempts to invoke an action on an object that no longer exists)

        Show
        jira-bot ASF subversion and git services added a comment - Commit 8da21a3a841cd4e11146f6de4730f1b1673d1c13 in isis's branch refs/heads/maint-1.13.1 from Dan Haywood [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=8da21a3 ] ISIS-1515 : adds a guard in BackgroundCommandExecution for in case priorExecution is null (can happen if attempts to invoke an action on an object that no longer exists)

          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