Uploaded image for project: 'Magnolia Personalization'
  1. Magnolia Personalization
  2. MGNLPN-682

Removing a variant on a copied or imported page fails.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 2.1.3
    • None
    • None

      Steps to reproduce

      1. Create a page with component variants on them.
      2. Copy the page
      3. On the copy try to remove a variant
      Caused by: java.lang.IllegalStateException: Encountered more unregistrations than registration for the same parent page with id: e1ec6a69-40ea-4583-95e1-18a7ccd5be3f
              at info.magnolia.personalization.variant.PersonalizedPages.unregisterParentPage(PersonalizedPages.java:121) ~[magnolia-personalization-core-2.1.3.jar:?]
              at info.magnolia.personalization.variant.PersonalizedPages.unregisterNodeWithVariants(PersonalizedPages.java:113) ~[magnolia-personalization-core-2.1.3.jar:?]
              at info.magnolia.personalization.variant.BaseVariantManager.removeHasVariantMixin(BaseVariantManager.java:76) ~[magnolia-personalization-core-2.1.3.jar:?]
              at info.magnolia.personalization.variant.BaseVariantManager.deleteVariant(BaseVariantManager.java:59) ~[magnolia-personalization-core-2.1.3.jar:?]
              at com.machinezoo.noexception.CheckedExceptionHandler$CheckedConsumer.accept(CheckedExceptionHandler.java:313) ~[noexception-1.4.4.jar:?]
              at java.lang.Iterable.forEach(Iterable.java:75) ~[?:1.8.0_301]
              at info.magnolia.pages.app.detail.action.DeleteElementVariantAction.lambda$execute$0(DeleteElementVariantAction.java:57) ~[magnolia-personalization-pages-2.1.3.jar:?]
              at com.machinezoo.noexception.CheckedExceptionHandler$CheckedConsumer.accept(CheckedExceptionHandler.java:313) ~[noexception-1.4.4.jar:?]
              at java.util.Optional.ifPresent(Optional.java:159) ~[?:1.8.0_301]
              at info.magnolia.pages.app.detail.action.DeleteElementVariantAction.execute(DeleteElementVariantAction.java:51) ~[magnolia-personalization-pages-2.1.3.jar:?]
              at info.magnolia.ui.api.action.AbstractActionExecutor.execute(AbstractActionExecutor.java:62) ~[magnolia-ui-api-6.2.21.jar:?]
              ... 165 more
       

       

      Expected results

      The variant is removed.

      Actual results

      An exception is thrown and shown in the UI.

      Workaround

      Restart the magnolia instance.

      Development notes

      This problem is caused by info.magnolia.personalization.variant.PersonalizedPages

      The cache it maintains does not notice when pages with personalization are created in the website that do not go through the addVariant code of the VariantManager.

      As both copying as importing don't do that, the cache gets inconsistent and does not register the page. This causes unregisterParentPage(Node node) to fail, because it uses 0 for a page that actually has variants but is not in the cache.

      It would be better to recheck if the page actually has variants or not in that case.

       

        Acceptance criteria

              Unassigned Unassigned
              rico.jansen Rico Jansen
              Mathijn Elhorst, Michiel Meeuwissen, Tim Molenaar
              AuthorX
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:

                  Bug DoR
                  Task DoD