equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 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 |
148 */ |
148 */ |
149 |
149 |
150 public final class SocketPermission extends Permission |
150 public final class SocketPermission extends Permission |
151 implements java.io.Serializable |
151 implements java.io.Serializable |
152 { |
152 { |
|
153 @java.io.Serial |
153 private static final long serialVersionUID = -7204263841984476862L; |
154 private static final long serialVersionUID = -7204263841984476862L; |
154 |
155 |
155 /** |
156 /** |
156 * Connect to host:port |
157 * Connect to host:port |
157 */ |
158 */ |
1184 /** |
1185 /** |
1185 * WriteObject is called to save the state of the SocketPermission |
1186 * WriteObject is called to save the state of the SocketPermission |
1186 * to a stream. The actions are serialized, and the superclass |
1187 * to a stream. The actions are serialized, and the superclass |
1187 * takes care of the name. |
1188 * takes care of the name. |
1188 */ |
1189 */ |
|
1190 @java.io.Serial |
1189 private synchronized void writeObject(java.io.ObjectOutputStream s) |
1191 private synchronized void writeObject(java.io.ObjectOutputStream s) |
1190 throws IOException |
1192 throws IOException |
1191 { |
1193 { |
1192 // Write out the actions. The superclass takes care of the name |
1194 // Write out the actions. The superclass takes care of the name |
1193 // call getActions to make sure actions field is initialized |
1195 // call getActions to make sure actions field is initialized |
1198 |
1200 |
1199 /** |
1201 /** |
1200 * readObject is called to restore the state of the SocketPermission from |
1202 * readObject is called to restore the state of the SocketPermission from |
1201 * a stream. |
1203 * a stream. |
1202 */ |
1204 */ |
|
1205 @java.io.Serial |
1203 private synchronized void readObject(java.io.ObjectInputStream s) |
1206 private synchronized void readObject(java.io.ObjectInputStream s) |
1204 throws IOException, ClassNotFoundException |
1207 throws IOException, ClassNotFoundException |
1205 { |
1208 { |
1206 // Read in the action, then initialize the rest |
1209 // Read in the action, then initialize the rest |
1207 s.defaultReadObject(); |
1210 s.defaultReadObject(); |
1446 @SuppressWarnings("unchecked") |
1449 @SuppressWarnings("unchecked") |
1447 public Enumeration<Permission> elements() { |
1450 public Enumeration<Permission> elements() { |
1448 return (Enumeration)Collections.enumeration(perms.values()); |
1451 return (Enumeration)Collections.enumeration(perms.values()); |
1449 } |
1452 } |
1450 |
1453 |
|
1454 @java.io.Serial |
1451 private static final long serialVersionUID = 2787186408602843674L; |
1455 private static final long serialVersionUID = 2787186408602843674L; |
1452 |
1456 |
1453 // Need to maintain serialization interoperability with earlier releases, |
1457 // Need to maintain serialization interoperability with earlier releases, |
1454 // which had the serializable field: |
1458 // which had the serializable field: |
1455 |
1459 |
1461 |
1465 |
1462 /** |
1466 /** |
1463 * @serialField permissions java.util.Vector |
1467 * @serialField permissions java.util.Vector |
1464 * A list of the SocketPermissions for this set. |
1468 * A list of the SocketPermissions for this set. |
1465 */ |
1469 */ |
|
1470 @java.io.Serial |
1466 private static final ObjectStreamField[] serialPersistentFields = { |
1471 private static final ObjectStreamField[] serialPersistentFields = { |
1467 new ObjectStreamField("permissions", Vector.class), |
1472 new ObjectStreamField("permissions", Vector.class), |
1468 }; |
1473 }; |
1469 |
1474 |
1470 /** |
1475 /** |
1472 */ |
1477 */ |
1473 /* |
1478 /* |
1474 * Writes the contents of the perms field out as a Vector for |
1479 * Writes the contents of the perms field out as a Vector for |
1475 * serialization compatibility with earlier releases. |
1480 * serialization compatibility with earlier releases. |
1476 */ |
1481 */ |
|
1482 @java.io.Serial |
1477 private void writeObject(ObjectOutputStream out) throws IOException { |
1483 private void writeObject(ObjectOutputStream out) throws IOException { |
1478 // Don't call out.defaultWriteObject() |
1484 // Don't call out.defaultWriteObject() |
1479 |
1485 |
1480 // Write out Vector |
1486 // Write out Vector |
1481 Vector<SocketPermission> permissions = new Vector<>(perms.values()); |
1487 Vector<SocketPermission> permissions = new Vector<>(perms.values()); |
1486 } |
1492 } |
1487 |
1493 |
1488 /* |
1494 /* |
1489 * Reads in a Vector of SocketPermissions and saves them in the perms field. |
1495 * Reads in a Vector of SocketPermissions and saves them in the perms field. |
1490 */ |
1496 */ |
|
1497 @java.io.Serial |
1491 private void readObject(ObjectInputStream in) |
1498 private void readObject(ObjectInputStream in) |
1492 throws IOException, ClassNotFoundException |
1499 throws IOException, ClassNotFoundException |
1493 { |
1500 { |
1494 // Don't call in.defaultReadObject() |
1501 // Don't call in.defaultReadObject() |
1495 |
1502 |