[MAGNOLIA-5927] NoSuchElementException in MgnlAuditLoggingContentDecorator Created: 23/Sep/14  Updated: 21/Oct/14  Resolved: 09/Oct/14

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 4.5.18
Fix Version/s: 4.5.23, 5.3.5

Type: Bug Priority: Neutral
Reporter: Joerg von Frantzius Assignee: Milan Divilek
Resolution: Fixed Votes: 0
Labels: quickwin, support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

We're currently seeing the following exception:

java.util.NoSuchElementException
	at java.util.LinkedList.getLast(LinkedList.java:255)
	at info.magnolia.audit.MgnlAuditLoggingContentDecorator.logActionDelete(MgnlAuditLoggingContentDecorator.java:211)
	at info.magnolia.audit.MgnlAuditLoggingContentDecoratorNodeWrapper.remove(MgnlAuditLoggingContentDecoratorNodeWrapper.java:94)

By looking at the code in MgnlAuditLoggingContentDecorator.java:211 it seems that this is bound to happen when a deletion is the first entry to be logged for a given path.

The fix would be to surround lines 211-222 with

if (!pathEntries.isEmpty()) {
[..]
}

Generated at Mon Feb 12 04:09:42 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.