410 views

Description

A class not defined error may be displayed when trying to instantiate an object related to an excessively large, thousands of lines, script. The script causes Rhino to generate more Java byte code for a single method or function than is allowed by the Java specification. When Rhino tries to emit a class file for this script, it is unable to do so.

The following are some examples of possible errors that might be displayed to the user:

  1. Evaluator.evaluateString() problem: java.lang.ArrayIndexOutOfBoundsException
  2. SEVERE *** ERROR *** Unexpected exception: java.lang.RuntimeException: Program too complex: too big jump offset
  3. WARNING *** WARNING *** Evaluator: java.lang.RuntimeException: Program too complex: too big jump offset

 

Steps to Reproduce

 

  1. Use a script with a method or function containing a large amount of code. For example, if-else statements and/or switch cases. Either a script include or written directly in the scripts background editor.
  2. Execute the script through the scripts background editor. Note that Rhino generates more Java byte code than is allowed by the Java specification, and an error message is displayed.
  3. Note that reducing the size of the script and executing the same line of code, there may no longer be an error message.

Workaround

Refactor the JavaScript to reduce the amount of code in the larger functions in the file:

  1. Start by moving the function with the large amount of code to a separate script include.
  2. If the function continues to be an issue after it is moved to its own file, then refactor it so that it is not one very large switch.

 


Related Problem: PRB656274

Seen In

Eureka Patch 11 Hot Fix 2
Helsinki Patch 5

Fixed In

Istanbul

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2017-10-19 09:10:19
Published:2017-08-16