Dan Haywood created ISIS-1515:
---------------------------------

             Summary: BackgroundCommandExecution can NPE if it attempts to 
invoke an action on an object that no longer exists.
                 Key: ISIS-1515
                 URL: https://issues.apache.org/jira/browse/ISIS-1515
             Project: Isis
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.13.0
            Reporter: Dan Haywood
            Assignee: Dan Haywood
            Priority: Minor
             Fix For: 1.13.1


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

{code}
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)
{code}

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

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

because priorExecution is null.  This results in:

{code}
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)
{code}




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to