jdk/test/com/sun/jdi/NotAField.sh
changeset 2 90ce3da70b43
child 5506 202f599c92aa
equal deleted inserted replaced
0:fd16c54261b3 2:90ce3da70b43
       
     1 #!/bin/sh
       
     2 
       
     3 #
       
     4 # Copyright 2002-2004 Sun Microsystems, Inc.  All Rights Reserved.
       
     5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     6 #
       
     7 # This code is free software; you can redistribute it and/or modify it
       
     8 # under the terms of the GNU General Public License version 2 only, as
       
     9 # published by the Free Software Foundation.
       
    10 #
       
    11 # This code is distributed in the hope that it will be useful, but WITHOUT
       
    12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14 # version 2 for more details (a copy is included in the LICENSE file that
       
    15 # accompanied this code).
       
    16 #
       
    17 # You should have received a copy of the GNU General Public License version
       
    18 # 2 along with this work; if not, write to the Free Software Foundation,
       
    19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20 #
       
    21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
       
    22 # CA 95054 USA or visit www.sun.com if you need additional information or
       
    23 # have any questions.
       
    24 #
       
    25 
       
    26 #
       
    27 #  @test
       
    28 #  @bug 4467887 4913748
       
    29 #  @summary TTY: NullPointerException at
       
    30 #           com.sun.tools.jdi.MirrorImpl.validateMirrors
       
    31 #  @author Tim Bell
       
    32 #  @run shell NotAField.sh
       
    33 #
       
    34 
       
    35 createJavaFile()
       
    36 {
       
    37     cat <<EOF > $classname.java.1
       
    38 public class $classname {
       
    39     public static void main(String args[]) {
       
    40         System.out.println("Hello, world!");
       
    41     }
       
    42 }
       
    43 
       
    44 EOF
       
    45 }
       
    46 
       
    47 # This is called to feed cmds to jdb.
       
    48 dojdbCmds()
       
    49 {
       
    50    #set -x
       
    51    cmd stop in $classname.main
       
    52    runToBkpt
       
    53    #This works:
       
    54    cmd print "java.lang.Class.reflectionFactory.hashCode()"
       
    55    #This should result in a ParseException: ("No such field in ..."):
       
    56    cmd print "java.lang.Class.reflectionFactory.hashCode"
       
    57    cmd cont
       
    58 }
       
    59 
       
    60 mysetup()
       
    61 {
       
    62    if [ -z "${TESTJAVA}" ] ; then
       
    63       # TESTJAVA is not set, so the test is running stand-alone.
       
    64       # TESTJAVA holds the path to the root directory of the build of the JDK
       
    65       # to be tested.  That is, any java files run explicitly in this shell
       
    66       # should use TESTJAVA in the path to the java interpreter.
       
    67       # So, we'll set this to the JDK spec'd on the command line.  If none
       
    68       # is given on the command line, tell the user that and use a default.
       
    69       # THIS IS THE JDK BEING TESTED.
       
    70       if [ -n "$1" ] ; then
       
    71              TESTJAVA=$1
       
    72          else
       
    73              TESTJAVA=$JAVA_HOME
       
    74       fi
       
    75       TESTSRC=.
       
    76       TESTCLASSES=.
       
    77    fi
       
    78    echo "JDK under test is: $TESTJAVA"
       
    79 
       
    80    if [ -z "$TESTSRC" ] ; then
       
    81         TESTSRC=.
       
    82    fi
       
    83 
       
    84    if [ -r $TESTSRC/ShellScaffold.sh ] ; then
       
    85         . $TESTSRC/ShellScaffold.sh 
       
    86    elif [ -r $TESTSRC/../ShellScaffold.sh ] ; then
       
    87         . $TESTSRC/../ShellScaffold.sh
       
    88    fi
       
    89 }
       
    90 
       
    91 # You could replace this next line with the contents
       
    92 # of ShellScaffold.sh and this script will run just the same.
       
    93 mysetup
       
    94 
       
    95 runit
       
    96 jdbFailIfNotPresent "com.sun.tools.example.debug.expr.ParseException" 50
       
    97 pass