RFR 8072853: SimpleScriptContext used by NashornScriptEngine doesn't completely complies to the spec regarding exception throwing
A. Sundararajan
sundararajan.athijegannathan at oracle.com
Mon May 18 12:59:56 UTC 2015
Thanks for the review. Updated test as per your suggestion. Uploaded
fresh review @ http://cr.openjdk.java.net/~sundar/8072853/webrev.01/
Thanks
-Sundar
Paul Sandoz wrote:
> On May 18, 2015, at 12:44 PM, A. Sundararajan <sundararajan.athijegannathan at oracle.com> wrote:
>
>
>> Please review http://cr.openjdk.java.net/~sundar/8072853/webrev.00/ for https://bugs.openjdk.java.net/browse/JDK-8072853
>>
>>
>
> Changes to SimpleScriptContext look good.
>
> Test-wise you could reduce the duplication with a method accepting Consumer<ScriptContext>.
>
> e.g.
>
> @Test
> public void getAttributeEmptyName() {
> test(sc -> sc.getAttribute("", ScriptContext.GLOBAL_SCOPE));
> }
>
> void test(Consumer<ScriptContext> c) {
> for (ScriptEngineFactory fac : getFactories()) {
> ScriptContext sc = fac.getScriptEngine().getContext();
> String name = fac.getEngineName();
> try {
> c.accept(sc);
> throw new RuntimeException("no exception for " + name);
> } catch (IllegalArgumentException iae) {
> System.out.println("got " + iae + " as expected for " + name);
> }
> }
> }
>
> Paul.
>
More information about the nashorn-dev
mailing list