Commons OGNL
  1. Commons OGNL
  2. OGNL-31

Caching problem when looping over different implementations of the same interface

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.7
    • Fix Version/s: 2.7
    • Component/s: ExpressionCompiler
    • Labels:
      None
    • Environment:
      Tapestry 4.1.2 snapshot from 3-21, OGNL 2.7 snapshot from 3-27, Firefox 2, WinXP

      Description

      Perhaps this is a regression from OGNL-24? Here is a simple example that demonstrates the problem:

      Template:

      <loop jwcid="@For" source="ognl:testObjs" value="ognl:curObj">

      <span jwcid="@Insert" value="ognl:curObj.myString" />

      </loop>

      Java:

      public abstract TestOgnl getCurObj();

      public List<TestOgnl> getTestObjs()

      { TestOgnl o1 = new TestOgnl1(); TestOgnl o2 = new TestOgnl2(); return Arrays.asList(o1, o2); }

      TestOgnl.java:

      public interface TestOgnl

      { String getMyString(); }

      TestOgnl1.java:

      public class TestOgnl1 implements TestOgnl

      {

      public String getMyString()

      { return "ognl1String"; }

      }

      TestOgnl2.java:

      public class TestOgnl2 implements TestOgnl

      {

      public String getMyString()

      { return "testognl2"; }

      }

      It seems to evaluate the first implementation of the interface fine, then fails when it hits a different one. The same error occurs if you change getTestObjs() to return Arrays.asList(o2, o1);. Here is the error and stack trace:

      Unable to read OGNL expression '<parsed OGNL expression>' of $DirectorAccount_142@3c1[DirectorAccount]: collective.TestOgnl2

      1. org.apache.hivemind.ApplicationRuntimeException: Unable to read OGNL expression '<parsed OGNL expression>' of $DirectorAccount_142@3c1[DirectorAccount]: collective.TestOgnl2

      org.apache.tapestry.services.impl.ExpressionEvaluatorImpl#read (ExpressionEvaluatorImpl.java:126)

      $ExpressionEvaluator_11194c93861#read ($ExpressionEvaluator_11194c93861.java:-1)

      org.apache.tapestry.binding.ExpressionBinding#resolveExpression (ExpressionBinding.java:126)

      org.apache.tapestry.binding.ExpressionBinding#getObject (ExpressionBinding.java:111)

      org.apache.tapestry.binding.AbstractBinding#getObject (AbstractBinding.java:84)

      $Insert_151#getValue ($Insert_151.java:-1)

      org.apache.tapestry.components.Insert#renderComponent (Insert.java:48)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.AbstractComponent#renderBody (AbstractComponent.java:525)

      org.apache.tapestry.components.ForBean#renderComponent (ForBean.java:181)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.AbstractComponent#renderBody (AbstractComponent.java:525)

      org.apache.tapestry.components.RenderBody#renderComponent (RenderBody.java:41)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.AbstractComponent#renderBody (AbstractComponent.java:525)

      org.apache.tapestry.components.IfBean#renderComponent (IfBean.java:96)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.BaseComponent#renderComponent (BaseComponent.java:92)

      collective.ui.components.CollectiveComponent#renderComponent (CollectiveComponent.java:70)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.AbstractComponent#renderBody (AbstractComponent.java:525)

      org.apache.tapestry.components.RenderBody#renderComponent (RenderBody.java:41)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.AbstractComponent#renderBody (AbstractComponent.java:525)

      org.apache.tapestry.components.RenderBody#renderComponent (RenderBody.java:41)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.BaseComponent#renderComponent (BaseComponent.java:92)

      collective.ui.components.CollectiveComponent#renderComponent (CollectiveComponent.java:70)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.AbstractComponent#renderBody (AbstractComponent.java:525)

      org.apache.tapestry.components.Any#renderComponent (Any.java:53)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.AbstractComponent#renderBody (AbstractComponent.java:525)

      org.apache.tapestry.html.Body#renderComponent (Body.java:38)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.AbstractComponent#renderBody (AbstractComponent.java:525)

      org.apache.tapestry.html.Shell#renderComponent (Shell.java:64)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.BaseComponent#renderComponent (BaseComponent.java:92)

      collective.ui.components.CollectiveComponent#renderComponent (CollectiveComponent.java:70)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.BaseComponent#renderComponent (BaseComponent.java:92)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:182)

      org.apache.tapestry.AbstractPage#renderPage (AbstractPage.java:237)

      org.apache.tapestry.engine.RequestCycle#renderPage (RequestCycle.java:397)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#renderResponse (DefaultResponseBuilder.java:158)

      org.apache.tapestry.services.impl.ResponseRendererImpl#renderResponse (ResponseRendererImpl.java:33)

      $ResponseRenderer_11194c936f0#renderResponse ($ResponseRenderer_11194c936f0.java:-1)

      org.apache.tapestry.engine.PageService#service (PageService.java:68)

      $IEngineService_11194c93780#service ($IEngineService_11194c93780.java:-1)

      org.apache.tapestry.services.impl.EngineServiceOuterProxy#service (EngineServiceOuterProxy.java:72)

      org.apache.tapestry.engine.AbstractEngine#service (AbstractEngine.java:246)

      org.apache.tapestry.services.impl.InvokeEngineTerminator#service (InvokeEngineTerminator.java:54)

      $WebRequestServicer_11194c9375d#service ($WebRequestServicer_11194c9375d.java:-1)

      org.apache.tapestry.services.impl.DisableCachingFilter#service (DisableCachingFilter.java:54)

      $WebRequestServicerFilter_11194c9375f#service ($WebRequestServicerFilter_11194c9375f.java:-1)

      $WebRequestServicer_11194c93761#service ($WebRequestServicer_11194c93761.java:-1)

      $WebRequestServicer_11194c93759#service ($WebRequestServicer_11194c93759.java:-1)

      org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge#service (WebRequestServicerPipelineBridge.java:61)

      $ServletRequestServicer_11194c9373b#service ($ServletRequestServicer_11194c9373b.java:-1)

      org.apache.tapestry.request.DecodedRequestInjector#service (DecodedRequestInjector.java:55)

      $ServletRequestServicerFilter_11194c93737#service ($ServletRequestServicerFilter_11194c93737.java:-1)

      $ServletRequestServicer_11194c9373d#service ($ServletRequestServicer_11194c9373d.java:-1)

      collective.ui.custom.HibernateFilter#service (HibernateFilter.java:37)

      $ServletRequestServicerFilter_11194c93735#service ($ServletRequestServicerFilter_11194c93735.java:-1)

      $ServletRequestServicer_11194c9373d#service ($ServletRequestServicer_11194c9373d.java:-1)

      collective.ui.custom.LuceneIndexFilter#service (LuceneIndexFilter.java:24)

      $ServletRequestServicerFilter_11194c93733#service ($ServletRequestServicerFilter_11194c93733.java:-1)

      $ServletRequestServicer_11194c9373d#service ($ServletRequestServicer_11194c9373d.java:-1)

      org.apache.tapestry.multipart.MultipartDecoderFilter#service (MultipartDecoderFilter.java:52)

      $ServletRequestServicerFilter_11194c93731#service ($ServletRequestServicerFilter_11194c93731.java:-1)

      $ServletRequestServicer_11194c9373d#service ($ServletRequestServicer_11194c9373d.java:-1)

      org.apache.tapestry.services.impl.SetupRequestEncoding#service (SetupRequestEncoding.java:53)

      $ServletRequestServicerFilter_11194c93739#service ($ServletRequestServicerFilter_11194c93739.java:-1)

      $ServletRequestServicer_11194c9373d#service ($ServletRequestServicer_11194c9373d.java:-1)

      $ServletRequestServicer_11194c9372a#service ($ServletRequestServicer_11194c9372a.java:-1)

      org.apache.tapestry.ApplicationServlet#doService (ApplicationServlet.java:123)

      collective.ui.CollectiveApplicationServlet#doService (CollectiveApplicationServlet.java:71)

      org.apache.tapestry.ApplicationServlet#doGet (ApplicationServlet.java:104)

      javax.servlet.http.HttpServlet#service (HttpServlet.java:743)

      javax.servlet.http.HttpServlet#service (HttpServlet.java:856)

      org.mortbay.jetty.servlet.ServletHolder#handle (ServletHolder.java:427)

      ... 15 more not displayed

      1. caused by java.lang.ClassCastException: collective.TestOgnl2

      ognl.ASTChain28419276Accessor#get (ASTChain28419276Accessor.java:-1)

      org.apache.tapestry.services.impl.ExpressionEvaluatorImpl#read (ExpressionEvaluatorImpl.java:122)

      $ExpressionEvaluator_11194c93861#read ($ExpressionEvaluator_11194c93861.java:-1)

      org.apache.tapestry.binding.ExpressionBinding#resolveExpression (ExpressionBinding.java:126)

      org.apache.tapestry.binding.ExpressionBinding#getObject (ExpressionBinding.java:111)

      org.apache.tapestry.binding.AbstractBinding#getObject (AbstractBinding.java:84)

      $Insert_151#getValue ($Insert_151.java:-1)

      org.apache.tapestry.components.Insert#renderComponent (Insert.java:48)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.AbstractComponent#renderBody (AbstractComponent.java:525)

      org.apache.tapestry.components.ForBean#renderComponent (ForBean.java:181)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.AbstractComponent#renderBody (AbstractComponent.java:525)

      org.apache.tapestry.components.RenderBody#renderComponent (RenderBody.java:41)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.AbstractComponent#renderBody (AbstractComponent.java:525)

      org.apache.tapestry.components.IfBean#renderComponent (IfBean.java:96)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.BaseComponent#renderComponent (BaseComponent.java:92)

      collective.ui.components.CollectiveComponent#renderComponent (CollectiveComponent.java:70)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.AbstractComponent#renderBody (AbstractComponent.java:525)

      org.apache.tapestry.components.RenderBody#renderComponent (RenderBody.java:41)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.AbstractComponent#renderBody (AbstractComponent.java:525)

      org.apache.tapestry.components.RenderBody#renderComponent (RenderBody.java:41)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.BaseComponent#renderComponent (BaseComponent.java:92)

      collective.ui.components.CollectiveComponent#renderComponent (CollectiveComponent.java:70)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.AbstractComponent#renderBody (AbstractComponent.java:525)

      org.apache.tapestry.components.Any#renderComponent (Any.java:53)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.AbstractComponent#renderBody (AbstractComponent.java:525)

      org.apache.tapestry.html.Body#renderComponent (Body.java:38)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.AbstractComponent#renderBody (AbstractComponent.java:525)

      org.apache.tapestry.html.Shell#renderComponent (Shell.java:64)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.BaseComponent#renderComponent (BaseComponent.java:92)

      collective.ui.components.CollectiveComponent#renderComponent (CollectiveComponent.java:70)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:184)

      org.apache.tapestry.BaseComponent#renderComponent (BaseComponent.java:92)

      org.apache.tapestry.AbstractComponent#render (AbstractComponent.java:712)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#render (DefaultResponseBuilder.java:182)

      org.apache.tapestry.AbstractPage#renderPage (AbstractPage.java:237)

      org.apache.tapestry.engine.RequestCycle#renderPage (RequestCycle.java:397)

      org.apache.tapestry.services.impl.DefaultResponseBuilder#renderResponse (DefaultResponseBuilder.java:158)

      org.apache.tapestry.services.impl.ResponseRendererImpl#renderResponse (ResponseRendererImpl.java:33)

      $ResponseRenderer_11194c936f0#renderResponse ($ResponseRenderer_11194c936f0.java:-1)

      org.apache.tapestry.engine.PageService#service (PageService.java:68)

      $IEngineService_11194c93780#service ($IEngineService_11194c93780.java:-1)

      org.apache.tapestry.services.impl.EngineServiceOuterProxy#service (EngineServiceOuterProxy.java:72)

      org.apache.tapestry.engine.AbstractEngine#service (AbstractEngine.java:246)

      org.apache.tapestry.services.impl.InvokeEngineTerminator#service (InvokeEngineTerminator.java:54)

      $WebRequestServicer_11194c9375d#service ($WebRequestServicer_11194c9375d.java:-1)

      org.apache.tapestry.services.impl.DisableCachingFilter#service (DisableCachingFilter.java:54)

      $WebRequestServicerFilter_11194c9375f#service ($WebRequestServicerFilter_11194c9375f.java:-1)

      $WebRequestServicer_11194c93761#service ($WebRequestServicer_11194c93761.java:-1)

      $WebRequestServicer_11194c93759#service ($WebRequestServicer_11194c93759.java:-1)

      org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge#service (WebRequestServicerPipelineBridge.java:61)

      $ServletRequestServicer_11194c9373b#service ($ServletRequestServicer_11194c9373b.java:-1)

      org.apache.tapestry.request.DecodedRequestInjector#service (DecodedRequestInjector.java:55)

      $ServletRequestServicerFilter_11194c93737#service ($ServletRequestServicerFilter_11194c93737.java:-1)

      $ServletRequestServicer_11194c9373d#service ($ServletRequestServicer_11194c9373d.java:-1)

      collective.ui.custom.HibernateFilter#service (HibernateFilter.java:37)

      $ServletRequestServicerFilter_11194c93735#service ($ServletRequestServicerFilter_11194c93735.java:-1)

      $ServletRequestServicer_11194c9373d#service ($ServletRequestServicer_11194c9373d.java:-1)

      collective.ui.custom.LuceneIndexFilter#service (LuceneIndexFilter.java:24)

      $ServletRequestServicerFilter_11194c93733#service ($ServletRequestServicerFilter_11194c93733.java:-1)

      $ServletRequestServicer_11194c9373d#service ($ServletRequestServicer_11194c9373d.java:-1)

      org.apache.tapestry.multipart.MultipartDecoderFilter#service (MultipartDecoderFilter.java:52)

      $ServletRequestServicerFilter_11194c93731#service ($ServletRequestServicerFilter_11194c93731.java:-1)

      $ServletRequestServicer_11194c9373d#service ($ServletRequestServicer_11194c9373d.java:-1)

      org.apache.tapestry.services.impl.SetupRequestEncoding#service (SetupRequestEncoding.java:53)

      $ServletRequestServicerFilter_11194c93739#service ($ServletRequestServicerFilter_11194c93739.java:-1)

      $ServletRequestServicer_11194c9373d#service ($ServletRequestServicer_11194c9373d.java:-1)

      $ServletRequestServicer_11194c9372a#service ($ServletRequestServicer_11194c9372a.java:-1)

      org.apache.tapestry.ApplicationServlet#doService (ApplicationServlet.java:123)

      collective.ui.CollectiveApplicationServlet#doService (CollectiveApplicationServlet.java:71)

      org.apache.tapestry.ApplicationServlet#doGet (ApplicationServlet.java:104)

      javax.servlet.http.HttpServlet#service (HttpServlet.java:743)

      javax.servlet.http.HttpServlet#service (HttpServlet.java:856)

      org.mortbay.jetty.servlet.ServletHolder#handle (ServletHolder.java:427)

      ... 15 more not displayed

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Jesse Kuhnert
            Reporter:
            Ben Dotte
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development