1 #!/bin/sh 2 3 # 4 # Copyright (c) 2002, 2014, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 # or visit www.oracle.com if you need additional information or have any 23 # 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 # @key intermittent 33 # @run shell NotAField.sh 34 # 35 36 createJavaFile() 37 { 38 cat <<EOF > $classname.java.1 39 public class $classname { 40 public static void main(String args[]) { 41 System.out.println("Hello, world!"); 42 } 43 } 44 45 EOF 46 } 47 48 # This is called to feed cmds to jdb. 49 dojdbCmds() 50 { 51 #set -x 52 cmd stop in $classname.main 53 runToBkpt 54 #This works: 55 cmd print "java.lang.Class.reflectionFactory.hashCode()" 56 #This should result in a ParseException: ("No such field in ..."): 57 cmd print "java.lang.Class.reflectionFactory.hashCode" 58 cmd allowExit cont 59 } 60 61 mysetup() 62 { 63 if [ -z "${TESTJAVA}" ] ; then 64 # TESTJAVA is not set, so the test is running stand-alone. 65 # TESTJAVA holds the path to the root directory of the build of the JDK 66 # to be tested. That is, any java files run explicitly in this shell 67 # should use TESTJAVA in the path to the java interpreter. 68 # So, we'll set this to the JDK spec'd on the command line. If none 69 # is given on the command line, tell the user that and use a default. 70 # THIS IS THE JDK BEING TESTED. 71 if [ -n "$1" ] ; then 72 TESTJAVA=$1 73 else 74 TESTJAVA=$JAVA_HOME 75 fi 76 TESTSRC=. 77 TESTCLASSES=. 78 fi 79 echo "JDK under test is: $TESTJAVA" 80 81 if [ -z "$TESTSRC" ] ; then 82 TESTSRC=. 83 fi 84 85 if [ -r $TESTSRC/ShellScaffold.sh ] ; then 86 . $TESTSRC/ShellScaffold.sh 87 elif [ -r $TESTSRC/../ShellScaffold.sh ] ; then 88 . $TESTSRC/../ShellScaffold.sh 89 fi 90 } 91 92 # You could replace this next line with the contents 93 # of ShellScaffold.sh and this script will run just the same. 94 mysetup 95 96 runit 97 jdbFailIfNotPresent "com.sun.tools.example.debug.expr.ParseException" 50 98 pass