[ https://issues.apache.org/jira/browse/SLING-7685?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Radu Cotescu reassigned SLING-7685: ----------------------------------- Assignee: Radu Cotescu > data-sly-resource throws RecursionTooDeepException when used with dynamic > variables that are null / empty > --------------------------------------------------------------------------------------------------------- > > Key: SLING-7685 > URL: https://issues.apache.org/jira/browse/SLING-7685 > Project: Sling > Issue Type: Bug > Components: Scripting > Reporter: Sagar Sane > Assignee: Radu Cotescu > Priority: Major > > I am on AEM 6.3.1.2. > If I use *data-sly-resource* w/ dynamic variable which is null or empty, I > get a *RecursionTooDeepException* runtime. The stack looks something like > this (redacting project specific stuff): > {code:java} > 2018-05-26 20:18:33,335 *ERROR* [0:0:0:0:0:0:0:1 [1527380309473] GET > /content/<path> HTTP/1.1] > org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught > SlingException > org.apache.sling.scripting.sightly.SightlyException: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: > org.apache.sling.api.request.RecursionTooDeepException: /content/<path> > at > com.adobe.cq.sightly.WCMScriptHelper.includeScript(WCMScriptHelper.java:227) > at > com.adobe.cq.sightly.internal.extensions.IncludeExtension.call(IncludeExtension.java:73) > at > org.apache.sling.scripting.sightly.impl.engine.runtime.RenderContextImpl.call(RenderContextImpl.java:69) > at > org.apache.sling.scripting.sightly.java.compiler.RenderUnit.render(RenderUnit.java:48) > at > org.apache.sling.scripting.sightly.impl.engine.SightlyCompiledScript.eval(SightlyCompiledScript.java:61) > at > org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:386) > at > org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:184) > at > org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:491) > at > org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:552) > at > org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:44) > at > org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77) > at > com.adobe.acs.commons.wcm.impl.ComponentErrorHandlerImpl.doFilter(ComponentErrorHandlerImpl.java:217) > at > org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) > at > com.day.cq.wcm.core.impl.WCMDebugFilter.doFilterWithErrorHandling(WCMDebugFilter.java:192) > at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:159) > at > org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) > at > org.apache.sling.dynamicinclude.IncludeTagFilter.doFilter(IncludeTagFilter.java:71) > at > org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) > at > com.day.cq.wcm.core.impl.WCMDeveloperModeFilter.doFilter(WCMDeveloperModeFilter.java:119) > at > org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) > at > com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:278) > at > org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) > at > org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) > at > com.day.cq.personalization.impl.TargetComponentFilter.doFilter(TargetComponentFilter.java:96) > at > org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) > at > org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:282) > at > org.apache.sling.engine.impl.SlingRequestProcessorImpl.dispatchRequest(SlingRequestProcessorImpl.java:322) > at > org.apache.sling.engine.impl.request.SlingRequestDispatcher.dispatch(SlingRequestDispatcher.java:211) > at > org.apache.sling.engine.impl.request.SlingRequestDispatcher.include(SlingRequestDispatcher.java:104) > at > com.day.cq.wcm.core.impl.WCMComponentFilter$ForwardRequestDispatcher.include(WCMComponentFilter.java:516) > at org.apache.jsp.libs.cq.Page.Page_jsp._jspService(Page_jsp.java:106) > at > org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:725){code} > It seems like the resource include implementation is scanning the page's > whole resource tree. I think the behavior is similar to what's mentioned in > the thread [here|https://forums.adobe.com/message/9720147#9720147] > I can get around this by putting a *data-sly-test* in the same sly tag as the > *data-sly-resource* tag. > (This is a follow up on discussion > [here|https://twitter.com/sagarsane/status/999675314937778176]) > A simple way to reproduce this is to have a Sling Model like : > {code:java} > package com.sling7685; > import org.apache.sling.api.SlingHttpServletRequest; > import org.apache.sling.api.resource.Resource; > import org.apache.sling.models.annotations.DefaultInjectionStrategy; > import org.apache.sling.models.annotations.Model; > @Model(adaptables = {SlingHttpServletRequest.class, Resource.class}, > defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL) > public class ReproduceSling7685 { > private String testVariable; > public String getTestVariable() { > return testVariable; > } > } > {code} > Then the HTL script could be something like : > {code:html} > <sly data-sly-use.model="com.sling7685.ReproduceSling7685"></sly> > <sly data-sly-resource="${model.testVariable @ wcmmode='disabled'}"></sly> > {code} > Please let me know if I should add any more details. > Thanks! -- This message was sent by Atlassian JIRA (v7.6.3#76005)