2141N/A# Testcase for PR381 Stackoverflow error with security manager, signed jars
2141N/A# and -Djava.security.debug set.
2141N/A#
2141N/A# Copyright (c) 2009, Red Hat Inc.
2141N/A#
2141N/A# This code is free software; you can redistribute it and/or modify
2141N/A# it under the terms of the GNU General Public License as published by
2141N/A# the Free Software Foundation; either version 2, or (at your option)
2141N/A# any later version.
2141N/A#
2141N/A# This code is distributed in the hope that it will be useful, but
2141N/A# WITHOUT ANY WARRANTY; without even the implied warranty of
2141N/A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2141N/A# General Public License for more details.
2141N/A#
2141N/A# You should have received a copy of the GNU General Public License version
2141N/A# 2 along with this work; if not, write to the Free Software Foundation,
2141N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2141N/A#
2141N/A# @test
2141N/A# @bug 6584033
2141N/A# @summary Stackoverflow error with security manager, signed jars and debug.
2141N/A# @build TimeZoneDatePermissionCheck
2141N/A# @run shell TimeZoneDatePermissionCheck.sh
2141N/A
2141N/A# Set default if not run under jtreg from test dir itself
2141N/Aif [ "${TESTCLASSES}" = "" ] ; then
2141N/A TESTCLASSES="."
2141N/Afi
2141N/Aif [ "${TESTJAVA}" = "" ] ; then
2141N/A TESTJAVA=/usr
2141N/Afi
2141N/A
2141N/A# create a test keystore and dummy cert
2141N/Arm -f ${TESTCLASSES}/timezonedatetest.store
2141N/A${TESTJAVA}/bin/keytool -genkeypair -alias testcert \
2141N/A -keystore ${TESTCLASSES}/timezonedatetest.store \
2141N/A -storepass testpass -validity 360 \
2141N/A -dname "cn=Mark Wildebeest, ou=FreeSoft, o=Red Hat, c=NL" \
2141N/A -keypass testpass
2141N/A
2141N/A# create a jar file to sign with the test class in it.
2141N/Arm -f ${TESTCLASSES}/timezonedatetest.jar
2141N/A${TESTJAVA}/bin/jar cf \
2141N/A ${TESTCLASSES}/timezonedatetest.jar \
2141N/A -C ${TESTCLASSES} TimeZoneDatePermissionCheck.class
2141N/A
2141N/A# sign it
2141N/A${TESTJAVA}/bin/jarsigner \
2141N/A -keystore ${TESTCLASSES}/timezonedatetest.store \
2141N/A -storepass testpass ${TESTCLASSES}/timezonedatetest.jar testcert
2141N/A
2141N/A# run it with the security manager on, plus accesscontroller debugging
2141N/A# will go into infinite recursion trying to get enough permissions for
2141N/A# printing Date of failing certificate unless fix is applied.
2141N/A${TESTJAVA}/bin/java -Djava.security.manager \
2141N/A -Djava.security.debug=access,failure,policy \
2141N/A -cp ${TESTCLASSES}/timezonedatetest.jar TimeZoneDatePermissionCheck