Uploaded image for project: 'Lucee Development'
  1. LDEV-1384

CFML Expression Interpreter does not use passed PageContext

    Details

    • Type: Bug
    • Status: Deployed
    • Priority: New
    • Resolution: Fixed
    • Affects Version/s: 5.2.2.29
    • Fix Version/s: 5.2.2.58
    • Labels:
      None
    • Sprint:
      July 2017 Sprint

      Description

      I cannot use a BIF like isJSON in a thread that doesn't have an associated PageContext. Even if I pass a PageContext myself, it is not used, resulting in a Null Pointer Exception.

      Caused by: lucee.runtime.exp.NativeException: java.lang.NullPointerException
      at lucee.runtime.interpreter.CFMLExpressionInterpreter.init(CFMLExpressionInterpreter.java:242)
      at lucee.runtime.interpreter.CFMLExpressionInterpreter.interpret(CFMLExpressionInterpreter.java:205)
      at lucee.runtime.interpreter.CFMLExpressionInterpreter.interpret(CFMLExpressionInterpreter.java:198)
      at lucee.runtime.functions.conversion.IsJSON.call(IsJSON.java:32)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at ortus.extension.cache.util.Functions._isJSON(Functions.java:228)
      at ortus.extension.cache.util.Functions.evaluate(Functions.java:193)
      at ortus.extension.cache.util.Functions.evaluate(Functions.java:170)
      at ortus.extension.cache.couchbase.CouchbaseCache.createCacheEntry(CouchbaseCache.java:490)
      

      It appears that the CFMLExpressionInterpreter class uses ThreadLocalPageContext.get(pc); where pc is null. It seems that the expression interpreter is not using the pc that was passed to the isJSON BIF. Interestingly enough, it looks like the isJSON class is passing the pc into the interpreter, but it isn't being saved! I think we might just need to add

      this.pc = pc;
      

      inside of the top of the interpret() method so the interpreter stops trying to get its own pc from the local thread.

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                michaeloffner Michael Offner
                Reporter:
                bdw429s Brad Wood
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: