jdk/test/com/sun/jdi/EvalArraysAsList.sh
author sspitsyn
Mon, 07 Nov 2016 16:14:18 -0800
changeset 42676 36fa143f8de8
permissions -rw-r--r--
8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null Summary: Adjust com/sun/jdi/MethodImpl.java for null argument Reviewed-by: dcubed, dsamersoff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42676
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
     1
#!/bin/sh
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
     2
#
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
     3
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
     4
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
     5
#
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
     6
# This code is free software; you can redistribute it and/or modify it
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
     7
# under the terms of the GNU General Public License version 2 only, as
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
     8
# published by the Free Software Foundation.
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
     9
#
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    10
# This code is distributed in the hope that it will be useful, but WITHOUT
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    11
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    12
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    13
# version 2 for more details (a copy is included in the LICENSE file that
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    14
# accompanied this code).
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    15
#
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    16
# You should have received a copy of the GNU General Public License version
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    17
# 2 along with this work; if not, write to the Free Software Foundation,
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    18
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    19
#
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    20
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    21
# or visit www.oracle.com if you need additional information or have any
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    22
# questions.
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    23
#
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    24
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    25
#  @test
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    26
#  @bug 8160024
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    27
#  @summary jdb returns invalid argument count if first parameter to Arrays.asList is null
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    28
#
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    29
#  @run shell/timeout=300 EvalArraysAsList.sh
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    30
#
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    31
#  The test checks if evaluation of the expression java.util.Arrays.asList(null, "a")
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    32
#  works normally and does not throw an IllegalArgumentException.
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    33
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    34
classname=EvalArraysAsList
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    35
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    36
createJavaFile()
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    37
{
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    38
    cat <<EOF > $classname.java.1
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    39
public class $classname {
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    40
    public static void main(String[] args) {
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    41
        java.util.List<Object> l = java.util.Arrays.asList(null, "a");
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    42
        System.out.println("java.util.Arrays.asList(null, \"a\") returns: " + l);
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    43
        return;    // @1 breakpoint
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    44
    }
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    45
}
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    46
EOF
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    47
}
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    48
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    49
# drive jdb by sending cmds to it and examining its output
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    50
dojdbCmds()
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    51
{
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    52
    setBkpts @1
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    53
    runToBkpt @1
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    54
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    55
    cmd eval "java.util.Arrays.asList(null, null)"
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    56
    jdbFailIfPresent "IllegalArgumentException" 3
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    57
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    58
    cmd eval "java.util.Arrays.asList(null, \"a\")"
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    59
    jdbFailIfPresent "IllegalArgumentException" 3
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    60
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    61
    cmd eval "java.util.Arrays.asList(\"a\", null)"
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    62
    jdbFailIfPresent "IllegalArgumentException" 3
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    63
}
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    64
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    65
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    66
mysetup()
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    67
{
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    68
    if [ -z "$TESTSRC" ] ; then
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    69
        TESTSRC=.
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    70
    fi
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    71
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    72
    for ii in . $TESTSRC $TESTSRC/.. ; do
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    73
        if [ -r "$ii/ShellScaffold.sh" ] ; then
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    74
            . $ii/ShellScaffold.sh
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    75
            break
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    76
        fi
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    77
    done
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    78
}
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    79
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    80
# You could replace this next line with the contents
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    81
# of ShellScaffold.sh and this script will run just the same.
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    82
mysetup
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    83
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    84
runit
36fa143f8de8 8160024: jdb returns invalid argument count if first parameter to Arrays.asList is null
sspitsyn
parents:
diff changeset
    85
pass