test/java/util/TimeZone/TimeZoneDatePermissionCheck.sh

Print this page




  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 ${TESTVMOPTS} -Djava.security.manager \
  57   -Djava.security.debug=access,failure,policy \
  58   -cp ${TESTCLASSES}/timezonedatetest.jar TimeZoneDatePermissionCheck


  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