Migrating from Nashorn to Rhino

Known compabillity issues when migrating Nashorn JavaScripts to Rhino:

  • Known issue with toLocaleString() in Rhino. https://github.com/mozilla/rhino/issues/535
  • An unassigned variable will by SiteVision and Rhino be assigned a "org.mozilla.javascript.Undefined@" value which by Velocity will be interpreted as true.
    Solution: Assign variables a default value, for example var foo = false; in the example below:
// Non-compatible Javascript that doesn't assign the variable foo a default
// value and that will cause "...Undefined" in the output if "someCheck" is false.
var foo;

if (someCheck) {
   foo = 'Hello World!';

// Velocity template code
#if ($foo)


#end // Resulting HTML when not setting foo to false org.mozilla.javascript.Undefined@0