Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-15069

Component referencenames broken for abstractpages (replaced by autocreated)

Details

    • Flagged
    • Quasar
    • Team Quasar 286 Sprint

    Description

      In CMS-14143 (14.4.0), there was a change in org.hippoecm.hst.platform.configuration.components.HstComponentsConfigurationService#autocreateReferenceNames where now first usedReferenceNames is checked and when it finds it a second time it gets replaced by an autocreated one.

      This breaks the case where

      • an hst:abstractpage has an hst:referencename property
      • concrete hst:pages have a hst:referencecomponent property referencing the first hst:abstractpage

      Result
      The problem is that when retrieving the pages with its resource URL (and maybe also in other usages), the set referencename is replaced by an autocreated one
      This error is logged:

       log.error("componentConfiguration '{}' contains invalid explicit reference '{}' since already in use. " 
       + "Autocreating a new one now.", componentConfiguration.getCanonicalStoredLocation(), referenceName);
      

      Reproduction
      See myproject14.7.6-CMS-15069.zip
      Visit http://localhost:8080/site/content, it is broken, has a named reference 'myreference' to the 'base' abstract page.

      Investigation and Solution

      CMS-14143 contains a wrong functional change. before CMS-14143, it was supported that for pages the 'root component' instances, the 'referencename' could be the same, so eg for both the pages /home and /contact backed by a different hst root component, the 'referencename' of the root component was allowed to be for example base. For child components of the root component, it is not allowed to have duplicates as it is not allowed to have for one single 'page instance' two different components having the same namespace. CMS-14143, unintentionally, added this constraint to root
      components as well. The fix is to revert this unintentional functional change to again allow duplicate referencenames for root component instances

      Attachments

        Issue Links

          Activity

            More on the use case:

            • all pages extend from hst:abstractpages/defaultpage where defaultpage is configured with a hst:referencename = webpage
            • they construct a resourceURL like www.example.com/*/?_hn:type=resource&_hn:ref=webpage where 'webpage' is filled in a hardcoded way
            jhoffman Jeroen Hoffman added a comment - More on the use case: all pages extend from hst:abstractpages/defaultpage where defaultpage is configured with a hst:referencename = webpage they construct a resourceURL like www.example.com/*/?_hn:type=resource&_hn:ref=webpage where 'webpage' is filled in a hardcoded way

            Hi jhoffman,

            I fixed it now on 15.1. Would you want to take a look at it or test it?

            aschrijvers Ard Schrijvers added a comment - Hi jhoffman , I fixed it now on 15.1. Would you want to take a look at it or test it?
            jhoffman Jeroen Hoffman added a comment - - edited

            I bumped the test project to 15.1, ran it with a locally built SNAPSHOT
            It didn't work, loading HST model on http://localhost:8080/site/content:

            [INFO] [talledLocalContainer] 11.05.2022 10:06:01 WARN  http-nio-8080-exec-7 [HstComponentConfigurationService.populateComponentReferences:1510] Cannot lookup referenced component 'myreference' for this component ['hst:pages/contentlist']. We skip this reference
            
            jhoffman Jeroen Hoffman added a comment - - edited I bumped the test project to 15.1, ran it with a locally built SNAPSHOT It didn't work, loading HST model on http://localhost:8080/site/content: [INFO] [talledLocalContainer] 11.05.2022 10:06:01 WARN http-nio-8080-exec-7 [HstComponentConfigurationService.populateComponentReferences:1510] Cannot lookup referenced component 'myreference' for this component [ 'hst:pages/contentlist' ]. We skip this reference

            Hi jhoffman,

            that is because in the sample project you have _
            http://localhost:8080/cms/console/?1&logintype=local&path=/hst:myproject/hst:configurations/myproject/hst:pages/contentlist_

            hst:referencecomponent  = myreference
            

            which afaik we never supported. It must be

            hst:referencecomponent  = hst:abstractpages/base
            

            The it all works fine. Before the fix in this issue, the homepage would have a 'component rendering url' equal to

            http://localhost:8080/site/?_hn:type=component-rendering&_hn:ref=r4
            

            (or some other r4, eg r3 value)
            and after the fix it becomes

            http://localhost:8080/site/?_hn:type=component-rendering&_hn:ref=myreference
            

            So AFAICS all is fine with the fix in this issue

            aschrijvers Ard Schrijvers added a comment - Hi jhoffman , that is because in the sample project you have _ http://localhost:8080/cms/console/?1&logintype=local&path=/hst:myproject/hst:configurations/myproject/hst:pages/contentlist_ hst:referencecomponent = myreference which afaik we never supported. It must be hst:referencecomponent = hst:abstractpages/base The it all works fine. Before the fix in this issue, the homepage would have a 'component rendering url' equal to http: //localhost:8080/site/?_hn:type=component-rendering&_hn:ref=r4 (or some other r4, eg r3 value) and after the fix it becomes http: //localhost:8080/site/?_hn:type=component-rendering&_hn:ref=myreference So AFAICS all is fine with the fix in this issue

            Ah yes, if the 'hst:referencecomponent' is changed like that, indeed the generated URLs have the reference name from the abstract config.

            Can be reintegrated AFAIC

            jhoffman Jeroen Hoffman added a comment - Ah yes, if the 'hst:referencecomponent' is changed like that, indeed the generated URLs have the reference name from the abstract config. Can be reintegrated AFAIC

            waiting for 14.7 and 15.0 in jenkins

            aschrijvers Ard Schrijvers added a comment - waiting for 14.7 and 15.0 in jenkins

            merged to 14.7, 15.0 and 15.1

            aschrijvers Ard Schrijvers added a comment - merged to 14.7, 15.0 and 15.1

            People

              Unassigned Unassigned
              jhoffman Jeroen Hoffman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: