jdk/test/sun/security/util/Oid/S11N.java
changeset 33991 619bfc4d582d
parent 30820 0d4717a011d3
child 34426 8da29db0cf2e
equal deleted inserted replaced
33990:a63f27e0c173 33991:619bfc4d582d
     1 /*
     1 /*
     2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 4811968 6908628 8006564
    26  * @bug 4811968 6908628 8006564 8130696
    27  * @modules java.base/sun.misc
    27  * @modules java.base/sun.misc
    28  *          java.base/sun.security.util
    28  *          java.base/sun.security.util
    29  * @run main S11N check
    29  * @run main S11N check
    30  * @summary Serialization compatibility with old versions (and fixes)
    30  * @summary Serialization compatibility with old versions (and fixes)
    31  */
    31  */
    64         }
    64         }
    65     };
    65     };
    66 
    66 
    67     public static void main(String[] args) throws Exception {
    67     public static void main(String[] args) throws Exception {
    68         if (args[0].equals("check")) {
    68         if (args[0].equals("check")) {
    69             int version = Integer.valueOf(System.getProperty("java.version")
    69             String jv = System.getProperty("java.version");
    70                     .split("\\.")[1]);
    70             // java.version format: $VNUM\-$PRE
       
    71             String [] va = (jv.split("-")[0]).split("\\.");
       
    72             String v = (va.length == 1 || !va[0].equals("1")) ? va[0] : va[1];
       
    73             int version = Integer.valueOf(v);
    71             System.out.println("version is " + version);
    74             System.out.println("version is " + version);
    72             if (version >= 7) {
    75             if (version >= 7) {
    73                 for (String oid: SMALL) {
    76                 for (String oid: SMALL) {
    74                     // 7 -> 7
    77                     // 7 -> 7
    75                     check(out(oid), oid);
    78                     check(out(oid), oid);