test/script/trusted/JDK-8006424.js

Wed, 18 Jun 2014 12:35:42 -0700

author
katleman
date
Wed, 18 Jun 2014 12:35:42 -0700
changeset 863
6e9c4e34bc61
parent 77
d7e83be6e7aa
child 952
6d5471a497fb
child 962
ac62e33a99b0
permissions
-rw-r--r--

Added tag jdk8u20-b19 for changeset b047df215de4

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.
sundar@60 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.
sundar@60 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).
sundar@60 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.
sundar@60 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