1 #!/bin/sh 2 # 3 # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 # 6 # This code is free software; you can redistribute it and/or modify it 7 # under the terms of the GNU General Public License version 2 only, as 8 # published by the Free Software Foundation. 9 # 10 # This code is distributed in the hope that it will be useful, but WITHOUT 11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 # version 2 for more details (a copy is included in the LICENSE file that 14 # accompanied this code). 15 # 16 # You should have received a copy of the GNU General Public License version 17 # 2 along with this work; if not, write to the Free Software Foundation, 18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 # 20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 # or visit www.oracle.com if you need additional information or have any 22 # questions. 23 # 24 25 # @test 26 # @bug 5036554 6357706 27 # @summary unmarshal error on CORBA alias type in CORBA any 28 # @run shell TestCorbaBug.sh 29 30 if [ "${TESTSRC}" = "" ] 31 then TESTSRC=. 32 fi 33 34 if [ "${TESTJAVA}" = "" ] 35 then 36 PARENT=`dirname \`which java\`` 37 TESTJAVA=`dirname ${PARENT}` 38 echo "TESTJAVA not set, selecting " ${TESTJAVA} 39 echo "If this is incorrect, try setting the variable manually." 40 fi 41 42 if [ "${TESTCLASSES}" = "" ] 43 then 44 echo "TESTCLASSES not set. Test cannot execute. Failed." 45 exit 1 46 fi 47 48 # set platform-dependent variables 49 OS=`uname -s` 50 case "$OS" in 51 SunOS | Linux | Darwin | AIX ) 52 PS=":" 53 FS="/" 54 ;; 55 CYGWIN* ) 56 PS=";" 57 FS="/" 58 ;; 59 Windows* ) 60 PS=";" 61 FS="\\" 62 ;; 63 * ) 64 echo "Unrecognized system!" 65 exit 1; 66 ;; 67 esac 68 69 CLASSPATH=.${PS}${TESTCLASSES}; export CLASSPATH 70 71 THIS_DIR=`pwd` 72 73 ${TESTJAVA}${FS}bin${FS}java -version 74 75 mkdir bug 76 77 cp ${TESTSRC}${FS}bug.idl . 78 ${COMPILEJAVA}${FS}bin${FS}idlj bug.idl 79 80 cp ${TESTSRC}${FS}JavaBug.java bug 81 82 chmod -fR 777 bug 83 84 ${COMPILEJAVA}${FS}bin${FS}javac --add-modules java.corba -d . bug${FS}*.java 85 86 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} --add-modules java.corba -cp . bug/JavaBug > test.out 2>&1 87 88 grep "NullPointerException" test.out 89 90 ERROR=$? 91 92 cat test.out 93 94 if [ $ERROR = 0 ] 95 then 96 echo "Test Failed" 97 exit 1 98 fi 99 100 grep "Any: hello" test.out 101 102 STATUS=$? 103 104 if [ $STATUS = 0 ] 105 then 106 echo "Test Passed" 107 exit 0 108 else 109 echo "Invalid output" 110 cat test.out 111 exit 2 112 fi