Ticket #1163 (closed clarification: fixed)

Opened 18 months ago

Last modified 16 months ago

Expression thisPage is undefined on first view of article

Reported by: rcave Owned by: rcave
Priority: medium Milestone: 0.9.3_rc1
Component: ambra Version: 0.9.1_rc1
Keywords: Cc:

Description

Occasionally. When requesting a page from the server for the first time (and only the first time) after a restart, this exception gets thrown. I was able to reproduce in the PLoS Medicine template starting directly on an article.

Expression thisPage is undefined on line 46, column 92 in article/article_content.ftl.
The problematic instruction:
----------
==> ${thisPage} [on line 46, column 90 in article/article_content.ftl]
----------

Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression thisPage is undefined on line 46, column 92 in article/article_content.ftl.
    at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
    at freemarker.core.Expression.getStringValue(Expression.java:118)
    at freemarker.core.Expression.getStringValue(Expression.java:93)
    at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
    at freemarker.core.Environment.visit(Environment.java:208)
    at freemarker.core.MixedContent.accept(MixedContent.java:92)
    at freemarker.core.Environment.visit(Environment.java:208)
    at freemarker.core.IfBlock.accept(IfBlock.java:82)
    at freemarker.core.Environment.visit(Environment.java:208)
    at freemarker.core.MixedContent.accept(MixedContent.java:92)
    at freemarker.core.Environment.visit(Environment.java:208)
    at freemarker.core.Environment.process(Environment.java:188)
    at freemarker.template.Template.process(Template.java:237)
    at org.apache.struts2.views.freemarker.FreemarkerResult.doExecute(FreemarkerResult.java:168)
    at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178)
    at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
    at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
    at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)
    at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
    at org.mortbay.servlet.UserAgentFilter.doFilter(UserAgentFilter.java:81)
    at org.mortbay.servlet.GzipFilter.doFilter(GzipFilter.java:129)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)

Change History

Changed 18 months ago by josowski

Can you include the URL as well as the stack trace?

Changed 18 months ago by rcave

  • status changed from new to closed
  • resolution set to worksforme

Closing ticket as we can't reproduce. It may have been fixed by previous commit on line 27 of global_header.ftl.

Changed 18 months ago by josowski

  • status changed from closed to reopened
  • resolution worksforme deleted
  • milestone changed from 0.9.2 to 0.9.3

This just occurred to me again, I still can not reproduce it with regularity though.

Changed 18 months ago by josowski

  • owner changed from ssterling to npeterson
  • status changed from reopened to new

Changed 18 months ago by josowski

It turns out article_content.ftl will get this error when the user is logged out and the fetchBody action is called. However, I can't find the use case under which this would occur.

We could implement an interim fix if needed. It is fairly trivial, but the (*correct*) fix involves a refactor that will affect a number of freemarker templates. These changes will also need to be migrated out to some of the journal FTLs.

Changed 17 months ago by rcave

  • owner changed from npeterson to josowski
  • milestone 0.9.3 deleted

Enhancement request - removing from 0.9.3

Changed 17 months ago by josowski

I was able to replicate this. The problem will occur when the user is logged in and the web server restarts in the background, so CAS and the browser see the user as logged in but the web server doesn't.

The fix involves moving the article_variables template include to use a import instead and include this import into the article_body template.

Note:  http://freemarker.org/docs/ref_directive_import.html

We should probably do this refactor anyway, imports are much better suited for templates that do nothing other then define macros or variables. As a template should only be included once, but an import can be included multiple times much like the C++ import command.

Changed 17 months ago by rcave

  • milestone set to 0.9.3_rc1

Moving to 0.9.3_rc1

Changed 17 months ago by josowski

(In [7601]) Moving some variable definitions templates to be included into templates via the imported command versus include.

References #1163

Changed 17 months ago by josowski

  • owner changed from josowski to russ

Changed 17 months ago by russ

  • owner changed from russ to rich

joe took this back and handled the CVS merge himself.

i think both joe and rich have now verified.

bouncing back to rich to close.

Changed 17 months ago by rcave

  • type changed from defect to clarification

Changed 16 months ago by rcave

  • status changed from new to closed
  • resolution set to fixed

Verified that the problem doesn't occur for the following action:

  • A user is logged in and the web server restarts in the background
Note: See TracTickets for help on using tickets.