JDK-8014426.js revision 877:cf4d2252d444
150477Speter/*
281077Speter * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
341199Skato * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4121802Snyan *
5121802Snyan * This code is free software; you can redistribute it and/or modify it
6152726Sjhb * under the terms of the GNU General Public License version 2 only, as
7152726Sjhb * published by the Free Software Foundation.
8125023Snyan *
9125023Snyan * This code is distributed in the hope that it will be useful, but WITHOUT
10121802Snyan * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11121802Snyan * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12122490Sjhb * version 2 for more details (a copy is included in the LICENSE file that
13153335Sru * accompanied this code).
14121802Snyan *
1534458Skato * You should have received a copy of the GNU General Public License version
16125023Snyan * 2 along with this work; if not, write to the Free Software Foundation,
1717256Sasami * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1855656Sbde *
1996755Strhodes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2055656Sbde * or visit www.oracle.com if you need additional information or have any
21103383Snyan * questions.
2255656Sbde */
2355656Sbde
2455656Sbde/**
2555656Sbde * Ensure catchall exceptions from finally inlining are rethrown as is
26158349Snetchild *
27158384Sambrisko * @test
2825195Skato * @run
2983757Speter */
3083757Speter
3183757Speterfunction runScriptEngine() {
3244633Skato    var fac    = new Packages.jdk.nashorn.api.scripting.NashornScriptEngineFactory();
3318208Sasami    var engine = fac.getScriptEngine();
34160813Smarcel    engine.eval(
35160813Smarcel"try {\n\
36160813Smarcel  doIt();\n\
37160813Smarcel} finally { \n\
38160813Smarcel  var x = 17;\n\
39160813Smarcel}\n\
40122754Snyanfunction doIt() {\n\
4127392Skato  throw new TypeError('en stor graa noshoerning!');\n\
4233019Skato}\n");
4347976Skato}
4427391Skato
4533019Skatotry {
46122754Snyan    runScriptEngine();
47122754Snyan} catch(e) {
4833019Skato    print(e);
49122754Snyan}
5033019Skato