src/java.base/share/classes/sun/security/util/ObjectIdentifier.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 47418 6993f9f1ff83
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
     1 /*
     1 /*
     2  * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1996, 2019, 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.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    89      *
    89      *
    90      * Therfore, for the first 3 cases, exact compatibility is preserved. In
    90      * Therfore, for the first 3 cases, exact compatibility is preserved. In
    91      * the 4th case, non-huge OID is still supportable in old versions, while
    91      * the 4th case, non-huge OID is still supportable in old versions, while
    92      * huge OID is not.
    92      * huge OID is not.
    93      */
    93      */
       
    94     @java.io.Serial
    94     private static final long serialVersionUID = 8697030238860181294L;
    95     private static final long serialVersionUID = 8697030238860181294L;
    95 
    96 
    96     /**
    97     /**
    97      * Changed to Object
    98      * Changed to Object
    98      * @serial
    99      * @serial
    99      */
   100      */
       
   101     @SuppressWarnings("serial") // Not statically typed as Serializable
   100     private Object      components   = null;          // path from root
   102     private Object      components   = null;          // path from root
   101     /**
   103     /**
   102      * @serial
   104      * @serial
   103      */
   105      */
   104     private int         componentLen = -1;            // how much is used.
   106     private int         componentLen = -1;            // how much is used.
   105 
   107 
   106     // Is the components field calculated?
   108     // Is the components field calculated?
   107     private transient boolean   componentsCalculated = false;
   109     private transient boolean   componentsCalculated = false;
   108 
   110 
       
   111     @java.io.Serial
   109     private void readObject(ObjectInputStream is)
   112     private void readObject(ObjectInputStream is)
   110             throws IOException, ClassNotFoundException {
   113             throws IOException, ClassNotFoundException {
   111         is.defaultReadObject();
   114         is.defaultReadObject();
   112 
   115 
   113         if (encoding == null) {  // from an old version
   116         if (encoding == null) {  // from an old version
   117             }
   120             }
   118             init(comp, componentLen);
   121             init(comp, componentLen);
   119         }
   122         }
   120     }
   123     }
   121 
   124 
       
   125     @java.io.Serial
   122     private void writeObject(ObjectOutputStream os)
   126     private void writeObject(ObjectOutputStream os)
   123             throws IOException {
   127             throws IOException {
   124         if (!componentsCalculated) {
   128         if (!componentsCalculated) {
   125             int[] comps = toIntArray();
   129             int[] comps = toIntArray();
   126             if (comps != null) {    // every one understands this
   130             if (comps != null) {    // every one understands this
   133         }
   137         }
   134         os.defaultWriteObject();
   138         os.defaultWriteObject();
   135     }
   139     }
   136 
   140 
   137     static class HugeOidNotSupportedByOldJDK implements Serializable {
   141     static class HugeOidNotSupportedByOldJDK implements Serializable {
       
   142         @java.io.Serial
   138         private static final long serialVersionUID = 1L;
   143         private static final long serialVersionUID = 1L;
   139         static HugeOidNotSupportedByOldJDK theOne = new HugeOidNotSupportedByOldJDK();
   144         static HugeOidNotSupportedByOldJDK theOne = new HugeOidNotSupportedByOldJDK();
   140     }
   145     }
   141 
   146 
   142     /**
   147     /**