Unit tests logs show that RetentionManagerImpl initializes its acceptedEvents list in a lazy way and too early (so has to retry many times until directories are available).
In addition this is done during an afterCompletion hook, which is bad as it's in a transactional context where some things can't be done (like creating a new directory session in a future master branch).
Logs during tests:
[main] TRACE [RetentionManagerImpl] Empty accepted events, not catching anything
[Nuxeo-Work-default-2:1445541614399448.1215375064] WARN [TransactionImpl] Unexpected exception from afterCompletion; continuing java.lang.NullPointerException: null at org.nuxeo.retention.service.RetentionManagerImpl.getAcceptedEvents(RetentionManagerImpl.java:320) ~[main/:?] at org.nuxeo.retention.listeners.RetentionDocumentEventListener.acceptEvent(RetentionDocumentEventListener.java:62) ~[main/:?] at org.nuxeo.ecm.core.event.impl.EventListenerDescriptor.acceptBundle(EventListenerDescriptor.java:299) ~[main/:?] at org.nuxeo.ecm.core.event.impl.PostCommitEventExecutor.run(PostCommitEventExecutor.java:143) ~[main/:?] at org.nuxeo.ecm.core.event.impl.PostCommitEventExecutor.run(PostCommitEventExecutor.java:131) ~[main/:?] at org.nuxeo.ecm.core.event.impl.EventServiceImpl.fireEventBundle(EventServiceImpl.java:335) ~[main/:?] at org.nuxeo.ecm.core.event.impl.EventServiceImpl.handleTxCommited(EventServiceImpl.java:515) ~[main/:?] at org.nuxeo.ecm.core.event.impl.EventServiceImpl.afterCompletion(EventServiceImpl.java:496) ~[main/:?] at org.apache.geronimo.transaction.manager.TransactionImpl.afterCompletion(TransactionImpl.java:540) [geronimo-transaction-2.2.1.jar:2.2.1] at org.apache.geronimo.transaction.manager.TransactionImpl.afterCompletion(TransactionImpl.java:533) [geronimo-transaction-2.2.1.jar:2.2.1] at org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:329) [geronimo-transaction-2.2.1.jar:2.2.1] at org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:252) [geronimo-transaction-2.2.1.jar:2.2.1] at org.nuxeo.runtime.jtajca.NuxeoContainer$UserTransactionImpl.commit(NuxeoContainer.java:538) [main/:?] at org.nuxeo.runtime.transaction.TransactionHelper.commitOrRollbackTransaction(TransactionHelper.java:393) [main/:?] at org.nuxeo.ecm.core.work.AbstractWork.runWorkWithTransaction(AbstractWork.java:522) [main/:?] at org.nuxeo.ecm.core.work.AbstractWork.run(AbstractWork.java:383) [main/:?] at org.nuxeo.ecm.core.work.WorkHolder.run(WorkHolder.java:57) [main/:?]
- causes
-
NXP-30509 Fix NullPointerException when fetching retention accepted events at server startup
- Resolved
- Is referenced in