nashorn/test/script/trusted/JDK-8067854.js
author sundar
Thu, 18 Dec 2014 16:33:33 +0530
changeset 28129 698b5aa53174
permissions -rw-r--r--
8067854: bound java static method throws NPE when 'null' is used for this argument Reviewed-by: attila, hannesw
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28129
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
     1
/*
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
     4
 *
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
     7
 * published by the Free Software Foundation.
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
     8
 *
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    13
 * accompanied this code).
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    14
 *
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    18
 *
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    21
 * questions.
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    22
 */
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    23
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    24
/**
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    25
 * JDK-8067854: bound java static method throws NPE when 'null' is used for this argument
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    26
 *
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    27
 * @test
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    28
 * @run
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    29
 */
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    30
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    31
getProp = java.lang.System.getProperty;
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    32
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    33
// bind this and an argument. "null" for this as getProperty is a
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    34
// static method of java.lang.System
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    35
getHome = Function.prototype.bind.call(getProp, null, "java.home");
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    36
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    37
if (getHome() != getProp("java.home")) {
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    38
    fail("getHome() failed to get java.home");
698b5aa53174 8067854: bound java static method throws NPE when 'null' is used for this argument
sundar
parents:
diff changeset
    39
}