securityContext not available in scheduled function

I’m invoking a function via a timer

invoke searchTags() every 2 minutes

which eventually calls

extend function addToTags(tag : Tag) {
  if(loggedIn()) {
    updateCredit(cost.addTagToPublication);
    tag.taggers.add(securityContext.principal.person);
  }
  this.modified("Added tag '[[tag(" + tag.key + ")|" + tag.name + "]]'.");
}

This leads to a run-time null pointer exception in the statement

SecurityContext securityContext = (SecurityContext)env.getVariable("securityContext");

of the implementation of addToTags:

public void addToTags_(org.hibernate.Session hibSession, Environment env, org.researchr.www.domain.Tag Publication_value57, PrintWriter out)
{ 
  try
  { 
    SecurityContext securityContext = (SecurityContext)env.getVariable("securityContext");
    if(GlobalFunctions.loggedIn_(hibSession, env, out))
    { 
      GlobalFunctions.updateCredit__CostPolicy_(hibSession, env, ((org.researchr.www.domain.CostSheet)env.getVariable("cost")).setupForPropertyEvents(hibSession, out).getAddTagToPublication(), out);
Submitted by Eelco Visser on 13 March 2010 at 16:22

On 15 March 2010 at 10:56 Zef Hemel commented:

Fixed in r3726, all session variables are now initialized to empty objects.

Log in to post comments