test/jdk/sun/security/x509/URIName/Parse.java
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 30820 jdk/test/sun/security/x509/URIName/Parse.java@0d4717a011d3
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13575
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
     1
/*
15268
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
13575
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
     4
 *
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
     7
 * published by the Free Software Foundation.
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
     8
 *
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    13
 * accompanied this code).
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    14
 *
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    18
 *
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    21
 * questions.
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    22
 */
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    23
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    24
/*
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    25
 * @test
15268
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
    26
 * @bug 8005389
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
    27
 * @summary CRL Distribution Point URIs with spaces or backslashes should
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
    28
 *          not be parseable
30820
0d4717a011d3 8081347: Add @modules to jdk_core tests
mchung
parents: 15268
diff changeset
    29
 * @modules java.base/sun.security.util
0d4717a011d3 8081347: Add @modules to jdk_core tests
mchung
parents: 15268
diff changeset
    30
 *          java.base/sun.security.x509
13575
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    31
 */
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    32
import java.io.ByteArrayInputStream;
15268
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
    33
import java.io.IOException;
13575
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    34
import java.security.cert.CertificateFactory;
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    35
import java.security.cert.X509Certificate;
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    36
import sun.security.util.DerValue;
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    37
import sun.security.x509.CRLDistributionPointsExtension;
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    38
import sun.security.x509.URIName;
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    39
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    40
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    41
public class Parse {
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    42
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    43
    // certificate with a space in the CRLDistributionPointsExtension uri
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    44
    // uri: file://crl file.crl
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    45
    static String certWithSpaceInCDPStr =
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    46
        "-----BEGIN CERTIFICATE-----\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    47
        "MIIB8DCCAVmgAwIBAgIJAOgNnYA5nHtQMA0GCSqGSIb3DQEBBQUAMCUxETAPBgNV\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    48
        "BAMTCHRlc3RuYW1lMRAwDgYDVQQLEwd0ZXN0b3JnMB4XDTEyMDgxMzIzMzgzN1oX\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    49
        "DTEyMDkxMjIzMzgzN1owJTERMA8GA1UEAxMIdGVzdG5hbWUxEDAOBgNVBAsTB3Rl\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    50
        "c3RvcmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANx02RuD/Y2pvgVnXBbJ\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    51
        "Sb+8j80geuoYEyRRnP6YiL2wmZqMmTHuznFwosO57KoVbz/XEr1bOnBMnPKax5Ll\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    52
        "QlDI3nmnxmUq13ORQ6GkD3M+QRzzxc66BFJbKqUzgv1P3NngyIFr03zb/opXdCTZ\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    53
        "4WfJuCf7Ouz44Ch6ZGQJ+7G5AgMBAAGjKDAmMCQGA1UdHwQdMBswGaAXoBWGE2Zp\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    54
        "bGU6Ly9jcmwgZmlsZS5jcmwwDQYJKoZIhvcNAQEFBQADgYEAB+ublc1l1EnXtEJE\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    55
        "jYeFzAdttHKQ4mn8CXGtHSy9gpckKyLdZUc9/n6yKuNXih29faepZ8mtaftTYpgR\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    56
        "AUqZ+6YYik+rIqZpnWMPR9qZvshf/KPerXiZe7kYBKNvxgmCFfhK8QN6nxUGrR2F\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    57
        "d53HWct6zXqlj+vQZsGC30f764M=\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    58
        "-----END CERTIFICATE-----";
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    59
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    60
    // a certificate with backslashes in the CRLDistributionPointsExtension uri
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    61
    // uri: file://\\\\CRL\\crl_file.crl
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    62
    static String certWithBackslashesInCDPStr =
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    63
        "-----BEGIN CERTIFICATE-----\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    64
        "MIIB9jCCAV+gAwIBAgIJAOQV9wTIgnc1MA0GCSqGSIb3DQEBBQUAMCUxETAPBgNV\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    65
        "BAMTCHRlc3RuYW1lMRAwDgYDVQQLEwd0ZXN0b3JnMB4XDTEyMDgxMzIzMzcxM1oX\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    66
        "DTEyMDkxMjIzMzcxM1owJTERMA8GA1UEAxMIdGVzdG5hbWUxEDAOBgNVBAsTB3Rl\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    67
        "c3RvcmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALdtczqZqI6RI17mz58/\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    68
        "PgFNBmb/dX/MeVcuaUp79RVUbDQ68z4JxDNv4ImcAxigKXb2jObPAxOdM+VlXROS\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    69
        "AmUNgYrIPuHNnKbd+rwilc6DsGWZnZLmZE63fUvTSqjOnSlsENSgDBVL/4r+yWBB\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    70
        "8KKmFGRFqkCyN1EZl03IW9i7AgMBAAGjLjAsMCoGA1UdHwQjMCEwH6AdoBuGGWZp\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    71
        "bGU6Ly9cXENSTFxjcmxfZmlsZS5jcmwwDQYJKoZIhvcNAQEFBQADgYEACOgZEaST\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    72
        "BCFQVeXZ5d8J3dUZ+wRRkPvrlvopxMtZb3Hyte78PNoIZ78f1gYL18HiGYwKttau\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    73
        "DyPp1lrG9xKPfIeKg+aDWTtVE7pexB4qCryID0+kJfdNzkdIgdGJzJ/RmfJ5heMF\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    74
        "+R46Mhpua4c6gGsE2NGBFxmtS3YHpQsKtz8=\n" +
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    75
        "-----END CERTIFICATE-----";
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    76
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    77
    /*
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    78
     * Create an X509Certificate then attempt to construct a
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    79
     * CRLDistributionPointsExtension object from its extension value bytes.
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    80
     */
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    81
    private static void CRLDistributionPointsExtensionTest(String certStr)
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    82
            throws Exception {
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    83
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    84
        ByteArrayInputStream is = new ByteArrayInputStream(certStr.getBytes());
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    85
        X509Certificate cert = (X509Certificate) cf.generateCertificate(is);
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    86
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    87
        // oid for CRL Distribution Points = 2.5.29.31
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    88
        byte[] CDPExtBytes = cert.getExtensionValue("2.5.29.31");
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    89
        DerValue val = new DerValue(CDPExtBytes);
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    90
        byte[] data = val.getOctetString();
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    91
        CRLDistributionPointsExtension CDPExt
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    92
                = new CRLDistributionPointsExtension(false, data);
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    93
    }
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    94
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
    95
    public static void main(String[] args) throws Exception {
15268
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
    96
        /* Try to parse a CRLDistributionPointsExtension URI with a space. */
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
    97
        try {
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
    98
            CRLDistributionPointsExtensionTest(certWithSpaceInCDPStr);
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
    99
            throw new RuntimeException("Illegally parsed a "
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   100
                    + "CRLDistributionPointsExtension uri with a space.");
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   101
        } catch (IOException e) {
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   102
            System.out.println("Caught the correct exception.");
13575
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
   103
15268
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   104
        }
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   105
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   106
        /* Try to parse a CRLDistributionPointsExtension URI with backslashes. */
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   107
        try {
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   108
            CRLDistributionPointsExtensionTest(certWithBackslashesInCDPStr);
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   109
            throw new RuntimeException("Illegally parsed a "
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   110
                    + "CRLDistributionPointsExtension uri with a backslashes.");
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   111
        } catch (IOException e) {
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   112
            System.out.println("Caught the correct exception.");
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   113
        }
13575
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
   114
15268
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   115
        /* Try to construct a URIName from a uri with a space. */
13575
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
   116
        String uriWithSpace = "file://crl file.crl";
15268
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   117
        URIName name;
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   118
        try {
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   119
            name = new URIName(uriWithSpace);
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   120
            throw new RuntimeException("Illegally created a URIName "
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   121
                    + "from a uri with a space.");
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   122
        } catch (IOException e) {
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   123
            System.out.println("Caught the correct exception.");
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   124
        }
13575
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
   125
15268
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   126
        /* Try to construct a URIName from a uri with backslashes. */
13575
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
   127
        String uriWithBackslashes = "file://\\\\CRL\\crl_file.crl";
15268
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   128
        try {
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   129
            name = new URIName(uriWithBackslashes);
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   130
            throw new RuntimeException("Illegally created a URIName "
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   131
                    + "from a uri with backslashes.");
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   132
        } catch (IOException e) {
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   133
            System.out.println("Caught the correct exception.");
d815f9973d97 8005389: Backout fix for JDK-6500133
juh
parents: 13575
diff changeset
   134
        }
13575
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
   135
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
   136
        System.out.println("Tests passed.");
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
   137
    }
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
   138
}
017f49f1f3cb 6500133: REGRESSION: CertificateParsingException for CRL Distribution Point with blank
mullan
parents:
diff changeset
   139