Uploaded image for project: 'CMS'
  1. CMS
  2. CMS-10319

DefaultZoneItem is passing a null service instance to DefaultModelAwareDataHolder

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 4.3.0
    • 4.3.0
    • None
    • None
    • 4.3 RC2

      I tried to do a CONTENTIO archive export

      But I got the following exception, which was not very clear about what was the source error:

       Category:	org.ametys.core.schedule.AmetysJob$org.ametys.plugins.contentio.archive.ExportArchiveSchedulable
      Message:		An exception occured during the execution of the Schedulable 'org.ametys.plugins.contentio.archive.ExportArchiveSchedulable'
      Location:	org.ametys.core.schedule.AmetysJob.execute(AmetysJob.java:156)
      Thrown:
      java.lang.RuntimeException: Unable to process Page for archiving: page://f502f84f-97e4-443f-adef-0ffd8f4bd85f
      	at org.ametys.plugins.webcontentio.archive.SitesArchiver._exportPage(SitesArchiver.java:398)
      	at org.ametys.plugins.webcontentio.archive.SitesArchiver.lambda$2(SitesArchiver.java:346)
      	at org.ametys.core.util.LambdaUtils.lambda$3(LambdaUtils.java:143)
      	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
      	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
      	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
      	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
      	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
      	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
      	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
      	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
      	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.base/java.util.stream.ReferencePipeline.forEachOrdered(ReferencePipeline.java:502)
      	at org.ametys.plugins.webcontentio.archive.SitesArchiver._exportSitemap(SitesArchiver.java:344)
      	at org.ametys.plugins.webcontentio.archive.SitesArchiver._exportSitemaps(SitesArchiver.java:324)
      	at org.ametys.plugins.webcontentio.archive.SitesArchiver._exportSite(SitesArchiver.java:270)
      	at org.ametys.plugins.webcontentio.archive.SitesArchiver.export(SitesArchiver.java:216)
      	at org.ametys.plugins.contentio.archive.ArchiveHandler._exportActualData(ArchiveHandler.java:232)
      	at org.ametys.plugins.contentio.archive.ArchiveHandler.export(ArchiveHandler.java:202)
      	at org.ametys.plugins.contentio.archive.ExportArchiveSchedulable.execute(ExportArchiveSchedulable.java:44)
      	at org.ametys.core.schedule.AmetysJob.execute(AmetysJob.java:151)
      	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
      	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
      Caused by: java.lang.RuntimeException: Unable to process Zone for archiving: zone://ba61b98c-c91c-4770-a072-82b3d992d5a7
      	at org.ametys.plugins.webcontentio.archive.SitesArchiver._saxZone(SitesArchiver.java:496)
      	at org.ametys.plugins.webcontentio.archive.SitesArchiver._saxZones(SitesArchiver.java:471)
      	at org.ametys.plugins.webcontentio.archive.SitesArchiver._exportPage(SitesArchiver.java:385)
      	... 22 more
      Caused by: java.lang.RuntimeException: Unable to process ZoneItem for archiving: zoneItem://5f39dfac-a206-4503-8a8f-975c74b5a054
      	at org.ametys.plugins.webcontentio.archive.SitesArchiver._saxZoneItems(SitesArchiver.java:510)
      	at org.ametys.plugins.webcontentio.archive.SitesArchiver._saxZone(SitesArchiver.java:490)
      	... 24 more
      Caused by: java.lang.NullPointerException
      	at org.ametys.runtime.model.ViewHelper.createViewItemContainer(ViewHelper.java:84)
      	at org.ametys.plugins.repository.data.holder.impl.DefaultModelAwareDataHolder.dataToSAX(DefaultModelAwareDataHolder.java:701)
      	at org.ametys.plugins.repository.data.holder.ModelAwareDataHolder.dataToSAX(ModelAwareDataHolder.java:301)
      	at org.ametys.plugins.webcontentio.archive.SitesArchiver._saxZoneItem(SitesArchiver.java:530)
      	at org.ametys.plugins.webcontentio.archive.SitesArchiver._saxZoneItems(SitesArchiver.java:506)
      	... 25 more

       

      Actually, DefaultModelAwareDataHolder has a field '_itemContainers', it was not null but was a list with one item which is null !
      It should check that before and forbid it

       

      In fact, it was one of my page which was probably not migrated because the one of its service ids was 'org.ametys.plugins.workspaces.service.SitemapService', but we should make this more clear with some additional checks (see the PR)

          [CMS-10319] DefaultZoneItem is passing a null service instance to DefaultModelAwareDataHolder

          For functional testing, you can :

          1. Modify one of your service directly in your repository (through _repository) and force the ametys:service property to a wrong value
          2. Then launch an export and see the error in description
          3. Pull the branches
          4. Relaunch the export, and see the 'improved' message, which will be more helpful for the user to fix its own repository

          Simon Prieul (Inactive) added a comment - For functional testing, you can : Modify one of your service directly in your repository (through _repository) and force the ametys:service property to a wrong value Then launch an export and see the error in description Pull the branches Relaunch the export, and see the 'improved' message, which will be more helpful for the user to fix its own repository

            sprieul Simon Prieul (Inactive)
            sprieul Simon Prieul (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: