Tapestry
  1. Tapestry
  2. TAPESTRY-638

Recursive components result in a StackOverflowError

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 4.1.2
    • Fix Version/s: 4.1.2
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      4.0-beta-6

      Description

      If a component includes itself in its template, we get a stack overflow. Ideally, we should be able to detect this early as an error.

      org.apache.hivemind.ApplicationRuntimeException
      Could not load class Border from ContextLoader@32124414: java.lang.StackOverflowError

      java.lang.StackOverflowError
      Stack Trace:

      • java.lang.Exception.<init>(Exception.java:77)
      • java.security.PrivilegedActionException.<init>(PrivilegedActionException.java:48)
      • java.security.AccessController.doPrivileged(Native Method)
      • java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      • org.mortbay.http.ContextLoader.loadClass(ContextLoader.java:197)
      • org.mortbay.http.ContextLoader.loadClass(ContextLoader.java:170)
      • java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
      • java.lang.Class.forName0(Native Method)
      • java.lang.Class.forName(Class.java:242)
      • org.apache.hivemind.impl.DefaultClassResolver.lookupClass(DefaultClassResolver.java:101)
      • org.apache.hivemind.impl.DefaultClassResolver.checkForClass(DefaultClassResolver.java:108)
      • org.apache.tapestry.services.impl.ClassFinderImpl.findClass(ClassFinderImpl.java:45)
      • $ClassFinder_106413065c7.findClass($ClassFinder_106413065c7.java)
      • org.apache.tapestry.pageload.NamespaceClassSearchComponentClassProvider.provideComponentClassName(NamespaceClassSearchComponentClassProvider.java:44)
      • $ComponentClassProvider_106413066a8.provideComponentClassName($ComponentClassProvider_106413066a8.java)
      • $ComponentClassProvider_10641306680.provideComponentClassName($ComponentClassProvider_10641306680.java)
      • $ComponentClassProvider_1064130667a.provideComponentClassName($ComponentClassProvider_1064130667a.java)
      • org.apache.tapestry.pageload.PageLoader.instantiateComponent(PageLoader.java:543)
      • org.apache.tapestry.pageload.PageLoader.createImplicitComponent(PageLoader.java:512)
      • $IPageLoader_10641306666.createImplicitComponent($IPageLoader_10641306666.java)
      • $IPageLoader_10641306667.createImplicitComponent($IPageLoader_10641306667.java)
      • org.apache.tapestry.services.impl.ComponentTemplateLoaderLogic.createImplicitComponent(ComponentTemplateLoaderLogic.java:218)
      • org.apache.tapestry.services.impl.ComponentTemplateLoaderLogic.process(ComponentTemplateLoaderLogic.java:172)
      • org.apache.tapestry.services.impl.ComponentTemplateLoaderLogic.process(ComponentTemplateLoaderLogic.java:111)
      • org.apache.tapestry.services.impl.ComponentTemplateLoaderLogic.loadTemplate(ComponentTemplateLoaderLogic.java:88)
      • org.apache.tapestry.services.impl.ComponentTemplateLoaderImpl.loadTemplate(ComponentTemplateLoaderImpl.java:60)
      • $ComponentTemplateLoader_10641306670.loadTemplate($ComponentTemplateLoader_10641306670.java)
      • org.apache.tapestry.pageload.PageLoader.loadTemplateForComponent(PageLoader.java:668)
      • org.apache.tapestry.BaseComponent.readTemplate(BaseComponent.java:77)
      • org.apache.tapestry.BaseComponent.finishLoad(BaseComponent.java:107)
      • org.apache.tapestry.pageload.PageLoader.constructComponent(PageLoader.java:470)
      • org.apache.tapestry.pageload.PageLoader.createImplicitComponent(PageLoader.java:525)
      • $IPageLoader_10641306666.createImplicitComponent($IPageLoader_10641306666.java)
      • $IPageLoader_10641306667.createImplicitComponent($IPageLoader_10641306667.java)

        Activity

        Hide
        Howard M. Lewis Ship added a comment -

        In my case, I was defining a Border.html as:

        <html jwcid="shell">
        <body jwcid="@Border">

        That should have been @Body, not @Border, thus the infinite recursion.

        Show
        Howard M. Lewis Ship added a comment - In my case, I was defining a Border.html as: <html jwcid="shell"> <body jwcid="@Border"> That should have been @Body, not @Border, thus the infinite recursion.
        Hide
        Howard M. Lewis Ship added a comment -

        Woops.

        Show
        Howard M. Lewis Ship added a comment - Woops.
        Hide
        Jesse Kuhnert added a comment -

        Added recursion detection and reporting of recursive references.

        Show
        Jesse Kuhnert added a comment - Added recursion detection and reporting of recursive references.

          People

          • Assignee:
            Jesse Kuhnert
            Reporter:
            Howard M. Lewis Ship
          • Votes:
            3 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development