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 34 # create a test keystore and dummy cert 35 rm -f ${TESTCLASSES}/timezonedatetest.store 36 ${TESTJAVA}/bin/keytool -genkeypair -alias testcert \ 37 -keystore ${TESTCLASSES}/timezonedatetest.store \ 38 -storepass testpass -validity 360 \ 39 -dname "cn=Mark Wildebeest, ou=FreeSoft, o=Red Hat, c=NL" \ 40 -keypass testpass 41 42 # create a jar file to sign with the test class in it. 43 rm -f ${TESTCLASSES}/timezonedatetest.jar 44 ${TESTJAVA}/bin/jar cf \ 45 ${TESTCLASSES}/timezonedatetest.jar \ 46 -C ${TESTCLASSES} TimeZoneDatePermissionCheck.class 47 48 # sign it 49 ${TESTJAVA}/bin/jarsigner \ 50 -keystore ${TESTCLASSES}/timezonedatetest.store \ 51 -storepass testpass ${TESTCLASSES}/timezonedatetest.jar testcert 52 53 # run it with the security manager on, plus accesscontroller debugging 54 # will go into infinite recursion trying to get enough permissions for 55 # printing Date of failing certificate unless fix is applied. 56 ${TESTJAVA}/bin/java -Djava.security.manager \ 57 -Djava.security.debug=access,failure,policy \ 58 -cp ${TESTCLASSES}/timezonedatetest.jar TimeZoneDatePermissionCheck