src/java.base/share/classes/javax/crypto/CryptoPermissions.java
changeset 57950 4612a3cfb927
parent 47216 71c04702a3d5
child 59024 b046ba510bbc
equal deleted inserted replaced
57945:e09c993ac476 57950:4612a3cfb927
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 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
    61  * @since 1.4
    61  * @since 1.4
    62  */
    62  */
    63 final class CryptoPermissions extends PermissionCollection
    63 final class CryptoPermissions extends PermissionCollection
    64 implements Serializable {
    64 implements Serializable {
    65 
    65 
       
    66     @java.io.Serial
    66     private static final long serialVersionUID = 4946547168093391015L;
    67     private static final long serialVersionUID = 4946547168093391015L;
    67 
    68 
    68     /**
    69     /**
    69      * @serialField perms java.util.Hashtable
    70      * @serialField perms java.util.Hashtable
    70      */
    71      */
       
    72     @java.io.Serial
    71     private static final ObjectStreamField[] serialPersistentFields = {
    73     private static final ObjectStreamField[] serialPersistentFields = {
    72         new ObjectStreamField("perms", Hashtable.class),
    74         new ObjectStreamField("perms", Hashtable.class),
    73     };
    75     };
    74 
    76 
    75     // Switched from Hashtable to ConcurrentHashMap to improve scalability.
    77     // Switched from Hashtable to ConcurrentHashMap to improve scalability.
   434             pc = cryptoPerm.newPermissionCollection();
   436             pc = cryptoPerm.newPermissionCollection();
   435         }
   437         }
   436         return pc;
   438         return pc;
   437     }
   439     }
   438 
   440 
       
   441     @java.io.Serial
   439     private void readObject(ObjectInputStream s)
   442     private void readObject(ObjectInputStream s)
   440         throws IOException, ClassNotFoundException {
   443         throws IOException, ClassNotFoundException {
   441         ObjectInputStream.GetField fields = s.readFields();
   444         ObjectInputStream.GetField fields = s.readFields();
   442         @SuppressWarnings("unchecked")
   445         @SuppressWarnings("unchecked")
   443         Hashtable<String,PermissionCollection> permTable =
   446         Hashtable<String,PermissionCollection> permTable =
   448         } else {
   451         } else {
   449             perms = new ConcurrentHashMap<>();
   452             perms = new ConcurrentHashMap<>();
   450         }
   453         }
   451     }
   454     }
   452 
   455 
       
   456     @java.io.Serial
   453     private void writeObject(ObjectOutputStream s) throws IOException {
   457     private void writeObject(ObjectOutputStream s) throws IOException {
   454         Hashtable<String,PermissionCollection> permTable =
   458         Hashtable<String,PermissionCollection> permTable =
   455                 new Hashtable<>(perms);
   459                 new Hashtable<>(perms);
   456         ObjectOutputStream.PutField fields = s.putFields();
   460         ObjectOutputStream.PutField fields = s.putFields();
   457         fields.put("perms", permTable);
   461         fields.put("perms", permTable);