-
Bug
-
Resolution: Won't Fix
-
P3
-
6
-
generic
-
generic
JavaScript engine (embedded in Sun's jdk) can throw not only ScriptException when script has a string that starts with valid operator(s) and ends with invalid one (see below example).
This is a spec violation because spec for ScriptException class says clear:
"The generic Exception class for the Scripting APIs. Checked exception types thrown by underlying scripting implementations must be wrapped in instances of ScriptException."
Example:
package test1;
import javax.script.*;
public class js_test {
public static void main(String[] args) {
String testScript = "print('Hello world');blabla;";
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine jsFactory = manager.getEngineByExtension("js");
try {
Object result = jsFactory.eval(testScript);
} catch (ScriptException e) {
System.out.println("in ScriptException");
e.printStackTrace();
} catch(Exception e) {
System.out.println("in Exception - bug present");
e.printStackTrace();
}
}
}
Above example will throw java.lang.ArrayIndexOutOfBoundsException, not ScriptException as spec required.
###@###.### 2005-07-13 09:44:14 GMT
This is a spec violation because spec for ScriptException class says clear:
"The generic Exception class for the Scripting APIs. Checked exception types thrown by underlying scripting implementations must be wrapped in instances of ScriptException."
Example:
package test1;
import javax.script.*;
public class js_test {
public static void main(String[] args) {
String testScript = "print('Hello world');blabla;";
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine jsFactory = manager.getEngineByExtension("js");
try {
Object result = jsFactory.eval(testScript);
} catch (ScriptException e) {
System.out.println("in ScriptException");
e.printStackTrace();
} catch(Exception e) {
System.out.println("in Exception - bug present");
e.printStackTrace();
}
}
}
Above example will throw java.lang.ArrayIndexOutOfBoundsException, not ScriptException as spec required.
###@###.### 2005-07-13 09:44:14 GMT