1 # Testcase for PR381 Stackoverflow error with security manager, signed jars 2 # and -Djava.security.debug set. 3 # 4 # Copyright (c) 2009, Red Hat Inc. 5 # 6 # This code is free software; you can redistribute it and/or modify 7 # it under the terms of the GNU General Public License as published by 8 # the Free Software Foundation; either version 2, or (at your option) 9 # any later version. 10 # 11 # This code is distributed in the hope that it will be useful, but 12 # WITHOUT ANY WARRANTY; without even the implied warranty of 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 # General Public License for more details. 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 # @test 21 # @bug 6584033 22 # @summary Stackoverflow error with security manager, signed jars and debug. 23 # @build TimeZoneDatePermissionCheck 24 # @run shell TimeZoneDatePermissionCheck.sh 25 26 # Set default if not run under jtreg from test dir itself 27 if [ "${TESTCLASSES}" = "" ] ; then 28 TESTCLASSES="." 29 fi 30 if [ "${TESTJAVA}" = "" ] ; then 31 TESTJAVA=/usr 32 fi 33 if [ "${COMPILEJAVA}" = "" ]; then 34 COMPILEJAVA="${TESTJAVA}" 35 fi 36 37 # create a test keystore and dummy cert. Note that we use the COMPILEJAVA 38 # as this test is a TimeZone test, it doesn't test keytool 39 rm -f ${TESTCLASSES}/timezonedatetest.store 40 ${COMPILEJAVA}/bin/keytool ${TESTTOOLVMOPTS} -genkeypair -alias testcert \ 41 -keystore ${TESTCLASSES}/timezonedatetest.store \ 42 -storepass testpass -validity 360 \ 43 -dname "cn=Mark Wildebeest, ou=FreeSoft, o=Red Hat, c=NL" \ 44 -keypass testpass 45 46 # create a jar file to sign with the test class in it. 47 rm -f ${TESTCLASSES}/timezonedatetest.jar 48 ${COMPILEJAVA}/bin/jar ${TESTTOOLVMOPTS} cf \ 49 ${TESTCLASSES}/timezonedatetest.jar \ 50 -C ${TESTCLASSES} TimeZoneDatePermissionCheck.class 51 52 # sign it 53 ${COMPILEJAVA}/bin/jarsigner ${TESTTOOLVMOPTS} \ 54 -keystore ${TESTCLASSES}/timezonedatetest.store \ 55 -storepass testpass ${TESTCLASSES}/timezonedatetest.jar testcert 56 57 # run it with the security manager on, plus accesscontroller debugging 58 # will go into infinite recursion trying to get enough permissions for 59 # printing Date of failing certificate unless fix is applied. 60 ${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.security.manager \ 61 -Djava.security.debug=access,failure,policy \ 62 -cp ${TESTCLASSES}/timezonedatetest.jar TimeZoneDatePermissionCheck