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

[Script] Content.toGridFormat() without results

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • 4.8.16, 4.9.3, 4.10.0
    • 4.9.2
    • None
    • None

      If we execute a script like this:

      let contents = [];
      return Content.toGridFormat(["title", "code"], contents);

      We get the following error:

      java.lang.RuntimeException: java.lang.Exception: Error while retrieving the search model : Caught an exception trying to initialize the component script-search-model
      at org.ametys.cms.scripts.CmsScriptHandler#processScriptResult:148
      at org.ametys.plugins.core.ui.script.ScriptHandler#_executeScript:242
      at org.ametys.plugins.core.ui.script.ScriptHandler#executeScript:139
      at java.base/jdk.internal.reflect.DirectMethodHandleAccessor#invoke:103
      at java.base/java.lang.reflect.Method#invoke:580
      at org.ametys.core.ui.ExecuteClientCallsAction#_executeMethod:206
      at org.ametys.core.ui.ExecuteClientCallsAction#act:184
      at org.apache.cocoon.components.treeprocessor.sitemap.ActTypeNode#invoke:120
      at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode#invokeNodes:47
      at org.apache.cocoon.components.treeprocessor.sitemap.MatchNode#invoke:108
      at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode#invokeNodes:69
      at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode#invoke:143
      at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode#invokeNodes:69
      at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode#invoke:93
      at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor#process:236
      at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor#buildPipeline:194
      at org.apache.cocoon.components.treeprocessor.TreeProcessor#buildPipeline:267
      at org.apache.cocoon.components.treeprocessor.sitemap.MountNode#invoke:111
      at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode#invokeNodes:47
      at org.apache.cocoon.components.treeprocessor.sitemap.MatchNode#invoke:108
      at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode#invokeNodes:69
      at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode#invoke:143
      at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode#invokeNodes:69
      at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode#invoke:93
      at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor#process:236
      at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor#buildPipeline:194
      at org.apache.cocoon.components.treeprocessor.TreeProcessor#buildPipeline:267
      at org.apache.cocoon.components.source.impl.SitemapSource#init:333
      at org.apache.cocoon.components.source.impl.SitemapSource#<init>:215
      at org.apache.cocoon.components.source.impl.SitemapSourceFactory#getSource:68
      at org.apache.excalibur.source.impl.SourceResolverImpl#resolveURI:208
      at org.apache.cocoon.components.CocoonComponentManager#resolveURI:558
      at org.apache.cocoon.components.CocoonComponentManager#resolveURI:558
      at org.apache.cocoon.components.CocoonComponentManager#resolveURI:558
      at org.apache.cocoon.components.CocoonComponentManager#resolveURI:558
      at org.ametys.core.ui.dispatcher.DispatchGenerator#_dispatchingSubRequest:217
      at org.ametys.core.ui.dispatcher.DispatchGenerator#_dispatching:142
      at org.ametys.core.ui.dispatcher.DispatchGenerator#generate:93
      at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline#processXMLPipeline:581
      at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline#processXMLPipeline:301
      at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline#process:483
      at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode#invoke:144
      at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode#invokeNodes:47
      at org.apache.cocoon.components.treeprocessor.sitemap.MatchNode#invoke:108
      at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode#invokeNodes:69
      at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode#invoke:143
      at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode#invokeNodes:69
      at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode#invoke:93
      at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor#process:236
      at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor#process:178
      at org.apache.cocoon.components.treeprocessor.TreeProcessor#process:254
      at org.apache.cocoon.components.treeprocessor.sitemap.MountNode#invoke:118
      at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode#invokeNodes:47
      at org.apache.cocoon.components.treeprocessor.sitemap.MatchNode#invoke:108
      at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode#invokeNodes:69
      at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode#invoke:143
      at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode#invokeNodes:69
      at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode#invoke:93
      at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor#process:236
      at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor#process:178
      at org.apache.cocoon.components.treeprocessor.TreeProcessor#process:254
      at org.apache.cocoon.components.treeprocessor.sitemap.MountNode#invoke:118
      at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode#invokeNodes:47
      at org.apache.cocoon.components.treeprocessor.sitemap.MatchNode#invoke:108
      at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode#invokeNodes:69
      at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode#invoke:143
      at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode#invokeNodes:69
      at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode#invoke:93
      at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor#process:236
      at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor#process:178
      at org.apache.cocoon.components.treeprocessor.TreeProcessor#process:254
      at org.apache.cocoon.components.treeprocessor.sitemap.MountNode#invoke:118
      at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode#invokeNodes:47
      at org.apache.cocoon.components.treeprocessor.sitemap.MatchNode#invoke:108
      at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode#invokeNodes:69
      at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode#invoke:143
      at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode#invokeNodes:69
      at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode#invoke:93
      at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor#process:236
      at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor#process:178
      at org.apache.cocoon.components.treeprocessor.TreeProcessor#process:254
      at org.apache.cocoon.Cocoon#process:699
      at org.ametys.runtime.servlet.RuntimeServlet#service:717
      at javax.servlet.http.HttpServlet#service:623
      at org.apache.catalina.core.ApplicationFilterChain#internalDoFilter:199
      at org.apache.catalina.core.ApplicationFilterChain#doFilter:144
      at org.apache.tomcat.websocket.server.WsFilter#doFilter:51
      at org.apache.catalina.core.ApplicationFilterChain#internalDoFilter:168
      at org.apache.catalina.core.ApplicationFilterChain#doFilter:144
      at org.apache.catalina.core.StandardWrapperValve#invoke:168
      at org.apache.catalina.core.StandardContextValve#invoke:90
      at org.apache.catalina.authenticator.AuthenticatorBase#invoke:482
      at org.apache.catalina.core.StandardHostValve#invoke:130
      at org.apache.catalina.valves.ErrorReportValve#invoke:93
      at org.apache.catalina.valves.AbstractAccessLogValve#invoke:660
      at org.apache.catalina.core.StandardEngineValve#invoke:74
      at org.apache.catalina.connector.CoyoteAdapter#service:346
      at org.apache.coyote.http11.Http11Processor#service:396
      at org.apache.coyote.AbstractProcessorLight#process:63
      at org.apache.coyote.AbstractProtocol$ConnectionHandler#process:937
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor#doRun:1791
      at org.apache.tomcat.util.net.SocketProcessorBase#run:52
      at org.apache.tomcat.util.threads.ThreadPoolExecutor#runWorker:1190
      at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker#run:659
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable#run:63
      at java.base/java.lang.Thread#run:1583
      Caused by: java.lang.Exception: Error while retrieving the search model : Caught an exception trying to initialize the component script-search-model
      at org.ametys.cms.scripts.CmsScriptHandler#getOrCreateModel:188
      at org.ametys.cms.scripts.CmsScriptHandler#processScriptResult:124
      ... 105 more
      Caused by: java.lang.Exception: Caught an exception trying to initialize the component script-search-model
      at org.ametys.runtime.plugin.component.ThreadSafeComponentManager#initialize:236
      at org.ametys.cms.scripts.CmsScriptHandler#_createModel:310
      at org.ametys.cms.scripts.CmsScriptHandler#getOrCreateModel:183
      ... 106 more
      Caused by: org.apache.avalon.framework.configuration.ConfigurationException: Unable to create local component managers. @null
      at org.ametys.cms.search.ui.model.StaticSearchUIModel#configure:275
      at org.apache.avalon.framework.container.ContainerUtil#configure:202
      at org.ametys.runtime.plugin.component.ThreadSafeComponentManager$ComponentFactory#configureAndStart:396
      at org.ametys.runtime.plugin.component.ThreadSafeComponentManager$ComponentFactory#newInstance:415
      at org.ametys.runtime.plugin.component.ThreadSafeComponentManager#initialize:230
      ... 108 more
      Caused by: org.apache.avalon.framework.configuration.ConfigurationException: Unable to parse columns of search model @null
      at org.ametys.cms.search.ui.model.StaticSearchUIModel#configure:266
      ... 112 more
      Caused by: org.apache.avalon.framework.configuration.ConfigurationException: The item 'code' is not defined in model. @null
      at org.ametys.runtime.model.AbstractViewParser#_getModelItem:396
      at org.ametys.cms.contenttype.AbstractContentTypeViewParser#_getModelItem:68
      at org.ametys.cms.search.ui.model.StaticSearchUIModelColumnsParser#_getModelItem:90
      at org.ametys.runtime.model.AbstractViewParser#_parseModelViewItem:236
      at org.ametys.runtime.model.AbstractViewParser#_parseViewChild:139
      at org.ametys.runtime.model.AbstractViewParser#parseView:57
      at org.ametys.cms.search.ui.model.StaticSearchUIModel#configure:262
      ... 112 more
      Caused by: org.ametys.runtime.model.exception.UndefinedItemPathException: Unable to retrieve the model item at path 'code'. This path is not defined by the model.
      at org.ametys.runtime.model.ModelHelper#getModelItem:116
      at org.ametys.runtime.model.AbstractViewParser#_getModelItem:392
      ... 118 more

      I think this code search for common ancestors of all contents (or maybe only the first 100 of the list), but if the list is empty, nothing match. The check should only be ignored.

            Unassigned Unassigned
            bmaurel Bérénice Maurel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: