test/script/trusted/JDK-8006424.js

Fri, 05 Jun 2015 12:38:53 +0200

author
mhaupt
date
Fri, 05 Jun 2015 12:38:53 +0200
changeset 1398
2f1b9f4daec1
parent 962
ac62e33a99b0
child 1205
4112748288bb
permissions
-rw-r--r--

8080087: Nashorn $ENV.PWD is originally undefined
Summary: On Windows, the PWD environment variable does not exist and cannot be imported in scripting mode, so it is set explicitly.
Reviewed-by: lagergren, sundar

sundar@60 1 /*
sundar@60 2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
sundar@60 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
attila@962 4 *
sundar@60 5 * This code is free software; you can redistribute it and/or modify it
sundar@60 6 * under the terms of the GNU General Public License version 2 only, as
sundar@60 7 * published by the Free Software Foundation.
attila@962 8 *
sundar@60 9 * This code is distributed in the hope that it will be useful, but WITHOUT
sundar@60 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
sundar@60 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
sundar@60 12 * version 2 for more details (a copy is included in the LICENSE file that
sundar@60 13 * accompanied this code).
attila@962 14 *
sundar@60 15 * You should have received a copy of the GNU General Public License version
sundar@60 16 * 2 along with this work; if not, write to the Free Software Foundation,
sundar@60 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
attila@962 18 *
sundar@60 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
sundar@60 20 * or visit www.oracle.com if you need additional information or have any
sundar@60 21 * questions.
sundar@60 22 */
sundar@60 23
sundar@34 24 /**
sundar@34 25 * JDK-8006424 : Passing null or undefined to adapter class constructors results in NPE or ClassCastException
sundar@34 26 *
sundar@34 27 * @test
sundar@34 28 * @run
sundar@34 29 */
sundar@34 30
sundar@34 31 function check(callback) {
sundar@34 32 try {
sundar@34 33 callback();
sundar@34 34 fail("should have thrown exception");
sundar@34 35 } catch (e) {
sundar@34 36 if (! (e instanceof TypeError)) {
sundar@34 37 fail("TypeError expected, but got " + e);
sundar@34 38 }
sundar@34 39 }
sundar@34 40 }
sundar@34 41
sundar@34 42 check(function() { new java.lang.ClassLoader(null) });
sundar@34 43 check(function() { new java.lang.ClassLoader(undefined) });
sundar@34 44 check(function() { new java.lang.Runnable(null) });
sundar@34 45 check(function() { new java.lang.Runnable(undefined) });

mercurial