Top Description Fields Constructors Methods
javax.script

public Class ScriptException

extends Exception
Class Inheritance

The generic Exception class for the Scripting APIs. Checked exception types thrown by underlying scripting implementations must be wrapped in instances of ScriptException. The class has members to store line and column numbers and filenames if this information is available.
Author
Mike Grogan
Since
1.6

Field Summary

Modifier and TypeField and Description
private final int
private final String
private final int
private static final long

Constructor Summary

AccessConstructor and Description
public
ScriptException(String
The String to use in the message.
s
)

Creates a ScriptException with a String to be used in its message.

public
ScriptException(Exception
The wrapped Exception.
e
)

Creates a ScriptException wrapping an Exception thrown by an underlying interpreter.

public
ScriptException(String
The string to use in the message
message
,
String
The file or resource name describing the location of a script error causing the ScriptException to be thrown.
fileName
,
int
A line number describing the location of a script error causing the ScriptException to be thrown.
lineNumber
)

Creates a ScriptException with message, filename and linenumber to be used in error messages.

public
ScriptException(String
The message.
message
,
String
The filename
fileName
,
int
the line number.
lineNumber
,
int
the column number.
columnNumber
)

ScriptException constructor specifying message, filename, line number and column number.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

The column number. Returns -1 if a column number is unavailable.
getColumnNumber
()

Get the column number on which an error occurred.

public String

Returns:

The file name of the script or some other string describing the script source. May return some implementation-defined string such as <unknown> if a description of the source is unavailable.
getFileName
()

Get the source of the script causing the error.

public int

Returns:

The line number. Returns -1 if a line number is unavailable.
getLineNumber
()

Get the line number on which an error occurred.

public String

Returns:

The error message.
getMessage
()

Overrides java.lang.Throwable.getMessage.

Returns a message containing the String passed to a constructor as well as line and column numbers and filename if any of these are known.

Field Detail

columnNumberback to summary
private final int columnNumber
fileNameback to summary
private final String fileName
lineNumberback to summary
private final int lineNumber
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.Exception.serialVersionUID.

Constructor Detail

ScriptExceptionback to summary
public ScriptException(String s)

Creates a ScriptException with a String to be used in its message. Filename, and line and column numbers are unspecified.

Parameters
s:String

The String to use in the message.

ScriptExceptionback to summary
public ScriptException(Exception e)

Creates a ScriptException wrapping an Exception thrown by an underlying interpreter. Line and column numbers and filename are unspecified.

Parameters
e:Exception

The wrapped Exception.

ScriptExceptionback to summary
public ScriptException(String message, String fileName, int lineNumber)

Creates a ScriptException with message, filename and linenumber to be used in error messages.

Parameters
message:String

The string to use in the message

fileName:String

The file or resource name describing the location of a script error causing the ScriptException to be thrown.

lineNumber:int

A line number describing the location of a script error causing the ScriptException to be thrown.

ScriptExceptionback to summary
public ScriptException(String message, String fileName, int lineNumber, int columnNumber)

ScriptException constructor specifying message, filename, line number and column number.

Parameters
message:String

The message.

fileName:String

The filename

lineNumber:int

the line number.

columnNumber:int

the column number.

Method Detail

getColumnNumberback to summary
public int getColumnNumber()

Get the column number on which an error occurred.

Returns:int

The column number. Returns -1 if a column number is unavailable.

getFileNameback to summary
public String getFileName()

Get the source of the script causing the error.

Returns:String

The file name of the script or some other string describing the script source. May return some implementation-defined string such as <unknown> if a description of the source is unavailable.

getLineNumberback to summary
public int getLineNumber()

Get the line number on which an error occurred.

Returns:int

The line number. Returns -1 if a line number is unavailable.

getMessageback to summary
public String getMessage()

Overrides java.lang.Throwable.getMessage.

Returns a message containing the String passed to a constructor as well as line and column numbers and filename if any of these are known.

Returns:String

The error message.