1
1
/*
2
- * Copyright (c) 1999, 2017 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 1999, 2020 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -494,13 +494,20 @@ public DirContext getAttributeDefinition() throws NamingException {
494
494
// ---- serialization methods
495
495
496
496
/**
497
- * Overridden to avoid exposing implementation details
498
- * @serialData Default field (the attribute ID -- a String),
499
- * followed by the number of values (an int), and the
497
+ * The writeObject method is called to save the state of the
498
+ * {@code BasicAttribute} to a stream.
499
+ *
500
+ * @serialData Default field (the attribute ID - a {@code String}),
501
+ * followed by the number of values (an {@code int}), and the
500
502
* individual values.
503
+ *
504
+ * @param s the {@code ObjectOutputStream} to write to
505
+ * @throws java.io.IOException if an I/O error occurs
501
506
*/
507
+ @ java .io .Serial
502
508
private void writeObject (java .io .ObjectOutputStream s )
503
509
throws java .io .IOException {
510
+ // Overridden to avoid exposing implementation details
504
511
s .defaultWriteObject (); // write out the attrID
505
512
s .writeInt (values .size ());
506
513
for (int i = 0 ; i < values .size (); i ++) {
@@ -509,10 +516,20 @@ private void writeObject(java.io.ObjectOutputStream s)
509
516
}
510
517
511
518
/**
512
- * Overridden to avoid exposing implementation details.
519
+ * The readObject method is called to restore the state of
520
+ * the {@code BasicAttribute} from a stream.
521
+ *
522
+ * See {@code writeObject} for a description of the serial form.
523
+ *
524
+ * @param s the {@code ObjectInputStream} to read from
525
+ * @throws java.io.IOException if an I/O error occurs
526
+ * @throws ClassNotFoundException if the class of a serialized object
527
+ * could not be found
513
528
*/
529
+ @ java .io .Serial
514
530
private void readObject (java .io .ObjectInputStream s )
515
531
throws java .io .IOException , ClassNotFoundException {
532
+ // Overridden to avoid exposing implementation details.
516
533
s .defaultReadObject (); // read in the attrID
517
534
int n = s .readInt (); // number of values
518
535
values = new Vector <>(Math .min (1024 , n ));
@@ -553,5 +570,6 @@ public void close() throws NamingException {
553
570
/**
554
571
* Use serialVersionUID from JNDI 1.1.1 for interoperability.
555
572
*/
573
+ @ java .io .Serial
556
574
private static final long serialVersionUID = 6743528196119291326L ;
557
575
}
0 commit comments