[MGNLPN-389] NPE when replacing new audience for variant page Created: 09/Jun/17  Updated: 23/Aug/22

Status: Open
Project: Magnolia Personalization
Component/s: Personas App
Affects Version/s: 1.3.4
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Sang Ngo Huu Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

magnolia-enterprise-pro-cp13n-demo-5.4.13


Attachments: PNG File NPE-replace-new-variant.png     Text File replace-variant-NPE.txt    
Issue Links:
causality
caused by MAGNOLIA-7054 ModuleConfigurationObservingManager d... Accepted
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:
Team: AuthorX

 Description   

Step to reproduce:

1. Case 1

  • Start magnolia-enterprise-pro-cp13n-demo-5.4.13 bundle
  • Go to pages app
  • Add new variant for /travel/contact
  • Name it as test-asia, choose audience Economic-regions - Asia-Pacific and any with date trait
  • Delete exists Asia-Pacific variant, replace it with new variant
  • Preview as visitor
  • Choose Wang Fang -> Error

2. Case 2

  • Enter to Preview as visitor
  • Choose Wang Fang
  • Choose Page /travel/contact -> Error

Above 2 cases do not happen in 5.4.12 and in demo author 5.5.4

If publish this variant, the error will be gone.

Please see log and screen shot for more detail



 Comments   
Comment by Roman Kovařík [ 09/Jun/17 ]

The problem is the deletion of the old variant which probably doesn't trigger the registry reload, then:

public Node info.magnolia.personalization.variant.RegistryVariantResolver#resolveVariant(Node node, TraitCollector traitCollector) throws RepositoryException {
        ....
        JcrItemId variantItemId = variant.getItemId(); //such item doesn't exist anymore
        variantNode = (Node) JcrItemUtil.getJcrItem(variantItemId); //returns null
        ...
        return variantNode;
    }

As a side note, the code should not use an UI code (JcrItemId/JcrItemUtil).
Might be related to MAGNOLIA-7054.

If publish this variant, the error will be gone.

That triggers the reload of registries

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