< prev index next >

## src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/NashornException.java

Print this page

      25
      26 package jdk.nashorn.api.scripting;
      27
      28 import java.util.ArrayList;
      29 import java.util.List;
      30 import jdk.nashorn.internal.codegen.CompilerConstants;
      31 import jdk.nashorn.internal.runtime.ECMAErrors;
      32 import jdk.nashorn.internal.runtime.ScriptObject;
      33
      34 /**
      35  * This is base exception for all Nashorn exceptions. These originate from
      36  * user's ECMAScript code. Example: script parse errors, exceptions thrown from
      37  * scripts. Note that ScriptEngine methods like "eval", "invokeMethod",
      38  * "invokeFunction" will wrap this as ScriptException and throw it. But, there
      39  * are cases where user may need to access this exception (or implementation
      40  * defined subtype of this). For example, if java interface is implemented by a
      41  * script object or Java access to script object properties via java.util.Map
      42  * interface. In these cases, user code will get an instance of this or
      43  * implementation defined subclass.
      44  *

      45  * @since 1.8u40
      46  */

      47 @SuppressWarnings("serial")
      48 public abstract class NashornException extends RuntimeException {
      49     private static final long serialVersionUID = 1L;
      50
      51     // script file name
      52     private String fileName;
      53     // script line number
      54     private int line;
      55     // are the line and fileName unknown?
      56     private boolean lineAndFileNameUnknown;
      57     // script column number
      58     private int column;
      59     // underlying ECMA error object - lazily initialized
      60     private Object ecmaError;
      61
      62     /**
      63      * Constructor to initialize error message, file name, line and column numbers.
      64      *
      65      * @param msg       exception message
      66      * @param fileName  file name
      25
      26 package jdk.nashorn.api.scripting;
      27
      28 import java.util.ArrayList;
      29 import java.util.List;
      30 import jdk.nashorn.internal.codegen.CompilerConstants;
      31 import jdk.nashorn.internal.runtime.ECMAErrors;
      32 import jdk.nashorn.internal.runtime.ScriptObject;
      33
      34 /**
      35  * This is base exception for all Nashorn exceptions. These originate from
      36  * user's ECMAScript code. Example: script parse errors, exceptions thrown from
      37  * scripts. Note that ScriptEngine methods like "eval", "invokeMethod",
      38  * "invokeFunction" will wrap this as ScriptException and throw it. But, there
      39  * are cases where user may need to access this exception (or implementation
      40  * defined subtype of this). For example, if java interface is implemented by a
      41  * script object or Java access to script object properties via java.util.Map
      42  * interface. In these cases, user code will get an instance of this or
      43  * implementation defined subclass.
      44  *
      45  * @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
      46  * are deprecated with the intent to remove them in a future release.
      47  *
      48  * @since 1.8u40
      49  */
      50 @Deprecated(since="11", forRemoval=true)
      51 @SuppressWarnings("serial")
      52 public abstract class NashornException extends RuntimeException {
      53     private static final long serialVersionUID = 1L;
      54
      55     // script file name
      56     private String fileName;
      57     // script line number
      58     private int line;
      59     // are the line and fileName unknown?
      60     private boolean lineAndFileNameUnknown;
      61     // script column number
      62     private int column;
      63     // underlying ECMA error object - lazily initialized
      64     private Object ecmaError;
      65
      66     /**
      67      * Constructor to initialize error message, file name, line and column numbers.
      68      *
      69      * @param msg       exception message
      70      * @param fileName  file name

< prev index next >