1 # 2 # Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 # 5 # This code is free software; you can redistribute it and/or modify it 6 # under the terms of the GNU General Public License version 2 only, as 7 # published by the Free Software Foundation. 8 # 9 # This code is distributed in the hope that it will be useful, but WITHOUT 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 # version 2 for more details (a copy is included in the LICENSE file that 13 # accompanied this code). 14 # 15 # You should have received a copy of the GNU General Public License version 16 # 2 along with this work; if not, write to the Free Software Foundation, 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 # 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 # or visit www.oracle.com if you need additional information or have any 21 # questions. 22 # 23 24 # @test 25 # @bug 8161527 26 # @summary NPE is thrown if exempt application is bundled with specific 27 # cryptoPerms 28 # @requires java.runtime.name ~= "OpenJDK.*" 29 30 # set a few environment variables so that the shell-script can run stand-alone 31 # in the source directory 32 33 # set platform-dependent variables 34 OS=`uname -s` 35 case "$OS" in 36 Linux | Darwin | AIX | CYGWIN* ) 37 FS="/" 38 ;; 39 Windows_* ) 40 FS="\\" 41 ;; 42 * ) 43 echo "Unrecognized system!" 44 exit 1; 45 ;; 46 esac 47 48 if [ "${TESTSRC}" = "" ] ; then 49 TESTSRC="." 50 fi 51 if [ "${TESTCLASSES}" = "" ] ; then 52 TESTCLASSES="." 53 fi 54 if [ "${TESTJAVA}" = "" ] ; then 55 JAVAC_CMD=`which javac` 56 TESTJAVA=`dirname $JAVAC_CMD`${FS}.. 57 COMPILEJAVA="${TESTJAVA}" 58 fi 59 60 # Build 61 ${COMPILEJAVA}${FS}bin${FS}javac \ 62 -d . \ 63 ${TESTSRC}${FS}TestExemption.java \ 64 || exit 10 65 66 # Package 67 ${COMPILEJAVA}${FS}bin${FS}jar \ 68 -cvf TestExemption.jar \ 69 TestExemption.class \ 70 -C ${TESTSRC} cryptoPerms \ 71 || exit 10 72 73 # Test 74 ${TESTJAVA}${FS}bin${FS}java \ 75 -classpath TestExemption.jar TestExemption 76 status=$? 77 78 exit $status 79