[CNTCTSAPP-83] NPE when trying to pick a contact marked for deletion in LinkField Created: 17/Jun/14  Updated: 08/Jul/14  Resolved: 02/Jul/14

Status: Closed
Project: Contacts App
Component/s: None
Affects Version/s: None
Fix Version/s: 1.3.1

Type: Bug Priority: Neutral
Reporter: Mikaël Geljić Assignee: Robert Šiška
Resolution: Fixed Votes: 0
Labels: quickwin
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MGNLDAM-479 NPE when trying to pick image marked ... Closed
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   
Caused by: java.lang.NullPointerException
	at info.magnolia.contacts.app.field.component.ContactPreviewComponent.createInfoLabel(ContactPreviewComponent.java:92)
	at info.magnolia.contacts.app.field.component.ContactPreviewComponent.createFieldDetail(ContactPreviewComponent.java:82)
	at info.magnolia.ui.form.field.component.AbstractBaseItemContentPreviewComponent.refreshContentDetail(AbstractBaseItemContentPreviewComponent.java:89)
	at info.magnolia.ui.form.field.component.AbstractBaseItemContentPreviewComponent.refreshContentDetail(AbstractBaseItemContentPreviewComponent.java:60)
	at info.magnolia.ui.form.field.component.AbstractContentPreviewComponent.onValueChange(AbstractContentPreviewComponent.java:74)
	at info.magnolia.ui.form.field.LinkField$2.valueChange(LinkField.java:234)


 Comments   
Comment by Mikaël Geljić [ 24/Jun/14 ]

Depending on where the fix is, issue probably needs to be moved to CNTCTSAPP project, might also happen with links to the dam but I haven't checked there.

Comment by Robert Šiška [ 30/Jun/14 ]

Same problem does exist in DAM.

Comment by Mikaël Geljić [ 01/Jul/14 ]

Isn't it just an issue about the preview component?
I don't think JCR Containers are any responsible for that, we just have to prevent the NPE imo, maybe display a trash icon as preview to make it even more obvious...

We can't prevent someone from picking a deleted contact, or opening a dialog that has a link to an asset which was marked as deleted by somebody else.
We can surely prevent the NPE though, either in UI or in concrete preview component implementations.

Comment by Robert Šiška [ 01/Jul/14 ]

Yeah, that makes sense... No idea why it didn't occurred to me. Assigning back, then.

Thanks.

Comment by Mikaël Geljić [ 02/Jul/14 ]

1. Might be a bit of a shortcut to consider contact deleted just because the adapter has no propertyIds; how about checking that JCR node actually has the deleted mixin instead?

if (((JcrNodeAdapter) fileItem).getJcrItem().isNodeType(NodeTypes.Deleted.NAME)) ...

2. If for whatever reason one of these four properties is missing it would still crash, so I would also check that fileItem.getItemProperty(propertyName) is not null before creating the Label and setting its value.

Generated at Mon Feb 12 00:10:27 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.