src/jdk/nashorn/api/scripting/NashornException.java
Print this page
*** 43,57 ****
* implementation defined subclass.
*/
@SuppressWarnings("serial")
public abstract class NashornException extends RuntimeException {
// script file name
! private final String fileName;
// script line number
! private final int line;
// script column number
! private final int column;
// underlying ECMA error object - lazily initialized
private Object ecmaError;
/** script source name used for "engine.js" */
public static final String ENGINE_SCRIPT_SOURCE_NAME = "nashorn:engine/resources/engine.js";
--- 43,57 ----
* implementation defined subclass.
*/
@SuppressWarnings("serial")
public abstract class NashornException extends RuntimeException {
// script file name
! private String fileName;
// script line number
! private int line;
// script column number
! private int column;
// underlying ECMA error object - lazily initialized
private Object ecmaError;
/** script source name used for "engine.js" */
public static final String ENGINE_SCRIPT_SOURCE_NAME = "nashorn:engine/resources/engine.js";
*** 123,150 ****
public final String getFileName() {
return fileName;
}
/**
* Get the line number for this {@code NashornException}
*
* @return the line number
*/
public final int getLineNumber() {
return line;
}
/**
* Get the column for this {@code NashornException}
*
! * @return the column
*/
public final int getColumnNumber() {
return column;
}
/**
* Returns array javascript stack frames from the given exception object.
*
* @param exception exception from which stack frames are retrieved and filtered
* @return array of javascript stack frames
*/
--- 123,177 ----
public final String getFileName() {
return fileName;
}
/**
+ * Set the source file name for this {@code NashornException}
+ *
+ * @param fileName the file name
+ */
+ public final void setFileName(final String fileName) {
+ this.fileName = fileName;
+ }
+
+ /**
* Get the line number for this {@code NashornException}
*
* @return the line number
*/
public final int getLineNumber() {
return line;
}
/**
+ * Set the line number for this {@code NashornException}
+ *
+ * @param line the line number
+ */
+ public final void setLineNumber(final int line) {
+ this.line = line;
+ }
+
+ /**
* Get the column for this {@code NashornException}
*
! * @return the column number
*/
public final int getColumnNumber() {
return column;
}
/**
+ * Set the column for this {@code NashornException}
+ *
+ * @param column the column number
+ */
+ public final void setColumnNumber(final int column) {
+ this.column = column;
+ }
+
+ /**
* Returns array javascript stack frames from the given exception object.
*
* @param exception exception from which stack frames are retrieved and filtered
* @return array of javascript stack frames
*/
*** 206,218 ****
return this; // initialized already!
}
final Object thrown = getThrown();
if (thrown instanceof ScriptObject) {
! ecmaError = ScriptObjectMirror.wrap(thrown, global);
} else {
! ecmaError = thrown;
}
return this;
}
--- 233,245 ----
return this; // initialized already!
}
final Object thrown = getThrown();
if (thrown instanceof ScriptObject) {
! setEcmaError(ScriptObjectMirror.wrap(thrown, global));
} else {
! setEcmaError(thrown);
}
return this;
}
*** 223,228 ****
--- 250,265 ----
* from script such as a String, Number or a Boolean.
*/
public Object getEcmaError() {
return ecmaError;
}
+
+ /**
+ * Return the underlying ECMA error object, if available.
+ *
+ * @param ecmaError underlying ECMA Error object's mirror or whatever was thrown
+ * from script such as a String, Number or a Boolean.
+ */
+ public void setEcmaError(final Object ecmaError) {
+ this.ecmaError = ecmaError;
+ }
}