Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/util/TimeZone/TimeZoneDatePermissionCheck.sh
38812 views
# Testcase for PR381 Stackoverflow error with security manager, signed jars1# and -Djava.security.debug set.2#3# Copyright (c) 2009, Red Hat Inc.4#5# This code is free software; you can redistribute it and/or modify6# it under the terms of the GNU General Public License as published by7# the Free Software Foundation; either version 2, or (at your option)8# any later version.9#10# This code is distributed in the hope that it will be useful, but11# WITHOUT ANY WARRANTY; without even the implied warranty of12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU13# General Public License for more details.14#15# You should have received a copy of the GNU General Public License version16# 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# @test20# @bug 658403321# @summary Stackoverflow error with security manager, signed jars and debug.22# @build TimeZoneDatePermissionCheck23# @run shell TimeZoneDatePermissionCheck.sh2425# Set default if not run under jtreg from test dir itself26if [ "${TESTCLASSES}" = "" ] ; then27TESTCLASSES="."28fi29if [ "${TESTJAVA}" = "" ] ; then30TESTJAVA=/usr31fi32if [ "${COMPILEJAVA}" = "" ]; then33COMPILEJAVA="${TESTJAVA}"34fi3536# create a test keystore and dummy cert. Note that we use the COMPILEJAVA37# as this test is a TimeZone test, it doesn't test keytool38rm -f ${TESTCLASSES}/timezonedatetest.store39${COMPILEJAVA}/bin/keytool ${TESTTOOLVMOPTS} -genkeypair -alias testcert \40-keystore ${TESTCLASSES}/timezonedatetest.store \41-storepass testpass -validity 360 \42-keyalg rsa \43-dname "cn=Mark Wildebeest, ou=FreeSoft, o=Red Hat, c=NL" \44-keypass testpass4546# create a jar file to sign with the test class in it.47rm -f ${TESTCLASSES}/timezonedatetest.jar48${COMPILEJAVA}/bin/jar ${TESTTOOLVMOPTS} cf \49${TESTCLASSES}/timezonedatetest.jar \50-C ${TESTCLASSES} TimeZoneDatePermissionCheck.class5152# sign it53${COMPILEJAVA}/bin/jarsigner ${TESTTOOLVMOPTS} \54-keystore ${TESTCLASSES}/timezonedatetest.store \55-storepass testpass ${TESTCLASSES}/timezonedatetest.jar testcert5657# run it with the security manager on, plus accesscontroller debugging58# will go into infinite recursion trying to get enough permissions for59# 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 TimeZoneDatePermissionCheck636465