Commons OGNL
  1. Commons OGNL
  2. OGNL-45

Accessing subclass-specific Map results in error

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.7
    • Fix Version/s: 4.0
    • Component/s: ExpressionCompiler
    • Labels:
      None
    • Environment:
      Tapestry 4.1.2 snapshot from 4-16, OGNL 2.7 snapshot from 4-14, WinXP, Firefox 2

      Description

      Failsafe catches this error and the page renders fine.

      .html:

      <span jwcid="@Insert" value="ognl:myTest.theMap.get('key')" />

      .java (the classes here are inner classes):

      public abstract class Test

      {

      }

      public class TestImpl extends Test

      {

      public Map<String, String> getTheMap()

      { Map<String, String> map = new HashMap(); map.put("key", "value"); return map; }

      }

      public Test getMyTest()

      { return new TestImpl(); }

      Here is the stack printed to the console:

      org.apache.hivemind.ApplicationRuntimeException: Unable to add method java.lang.Object get(ognl.OgnlContext, java.lang.Object) to class ognl.ASTChain15549720Accessor: [source error] ; is missing

      at org.apache.tapestry.enhance.ClassFabImpl.addMethod(ClassFabImpl.java:278)

      at org.apache.tapestry.services.impl.HiveMindExpressionCompiler.compileExpression(HiveMindExpressionCompiler.java:149)

      at ognl.OgnlRuntime.compileExpression(OgnlRuntime.java:387)

      at ognl.Ognl.compileExpression(Ognl.java:123)

      at org.apache.tapestry.services.impl.ExpressionCacheImpl.parse(ExpressionCacheImpl.java:129)

      at org.apache.tapestry.services.impl.ExpressionCacheImpl.getCompiledExpression(ExpressionCacheImpl.java:91)

      at $ExpressionCache_111fff51c3f.getCompiledExpression($ExpressionCache_111fff51c3f.java)

      at org.apache.tapestry.binding.ExpressionBinding.resolveExpression(ExpressionBinding.java:120)

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

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

      at $Insert_47.getValue($Insert_47.java)

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

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

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

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

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

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

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

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

      at org.apache.tapestry.components.ElseBean.renderComponent(ElseBean.java:47)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      at org.apache.tapestry.components.ElseBean.renderComponent(ElseBean.java:47)

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

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

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

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

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

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

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

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

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

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

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

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

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

      at $ResponseRenderer_111fff51ad1.renderResponse($ResponseRenderer_111fff51ad1.java)

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

      at $IEngineService_111fff51b61.service($IEngineService_111fff51b61.java)

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

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

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

      at $WebRequestServicer_111fff51b3e.service($WebRequestServicer_111fff51b3e.java)

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

      at $WebRequestServicerFilter_111fff51b40.service($WebRequestServicerFilter_111fff51b40.java)

      at $WebRequestServicer_111fff51b42.service($WebRequestServicer_111fff51b42.java)

      at $WebRequestServicer_111fff51b3a.service($WebRequestServicer_111fff51b3a.java)

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

      at $ServletRequestServicer_111fff51b1c.service($ServletRequestServicer_111fff51b1c.java)

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

      at $ServletRequestServicerFilter_111fff51b18.service($ServletRequestServicerFilter_111fff51b18.java)

      at $ServletRequestServicer_111fff51b1e.service($ServletRequestServicer_111fff51b1e.java)

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

      at $ServletRequestServicerFilter_111fff51b16.service($ServletRequestServicerFilter_111fff51b16.java)

      at $ServletRequestServicer_111fff51b1e.service($ServletRequestServicer_111fff51b1e.java)

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

      at $ServletRequestServicerFilter_111fff51b14.service($ServletRequestServicerFilter_111fff51b14.java)

      at $ServletRequestServicer_111fff51b1e.service($ServletRequestServicer_111fff51b1e.java)

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

      at $ServletRequestServicerFilter_111fff51b12.service($ServletRequestServicerFilter_111fff51b12.java)

      at $ServletRequestServicer_111fff51b1e.service($ServletRequestServicer_111fff51b1e.java)

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

      at $ServletRequestServicerFilter_111fff51b1a.service($ServletRequestServicerFilter_111fff51b1a.java)

      at $ServletRequestServicer_111fff51b1e.service($ServletRequestServicer_111fff51b1e.java)

      at $ServletRequestServicer_111fff51b0b.service($ServletRequestServicer_111fff51b0b.java)

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

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

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

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

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

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

      at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:832)

      at collective.servlet.ResponseHeaderFilter.doFilter(ResponseHeaderFilter.java:32)

      at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:823)

      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:473)

      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:556)

      at org.mortbay.http.HttpContext.handle(HttpContext.java:1563)

      at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:623)

      at org.mortbay.http.HttpContext.handle(HttpContext.java:1515)

      at org.mortbay.http.HttpServer.service(HttpServer.java:956)

      at org.mortbay.http.HttpConnection.service(HttpConnection.java:814)

      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)

      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)

      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)

      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)

      at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)

      Caused by: javassist.CannotCompileException: [source error] ; is missing

      at javassist.CtBehavior.setBody(CtBehavior.java:347)

      at javassist.CtBehavior.setBody(CtBehavior.java:316)

      at org.apache.tapestry.enhance.ClassFabImpl.addMethod(ClassFabImpl.java:272)

      ... 122 more

      Caused by: compile error: ; is missing

      at javassist.compiler.Parser.parseReturn(Parser.java:509)

      at javassist.compiler.Parser.parseStatement(Parser.java:268)

      at javassist.compiler.Parser.parseBlock(Parser.java:288)

      at javassist.compiler.Parser.parseStatement(Parser.java:242)

      at javassist.compiler.Javac.compileBody(Javac.java:203)

      at javassist.CtBehavior.setBody(CtBehavior.java:341)

      ... 124 more

        Activity

        Hide
        Jesse Kuhnert added a comment -

        Thanks for the report!

        This appears to be a javassist bug, ie there's not much I can do about it.

        I can say that if you are accessing a Map as a map it's much better (and works) if you do it as an accessor expression like:

        myTest.theMap['key']

        Show
        Jesse Kuhnert added a comment - Thanks for the report! This appears to be a javassist bug, ie there's not much I can do about it. I can say that if you are accessing a Map as a map it's much better (and works) if you do it as an accessor expression like: myTest.theMap ['key']

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development