Skip to content

Commit 3777abc

Browse files
author
duke
committedAug 28, 2020
Automatic merge of jdk:master into master
2 parents 42695df + 30c2dbe commit 3777abc

File tree

7 files changed

+137
-20
lines changed

7 files changed

+137
-20
lines changed
 

‎src/java.naming/share/classes/javax/naming/CompositeName.java

+21-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -562,12 +562,19 @@ public Object remove(int posn) throws InvalidNameException{
562562
}
563563

564564
/**
565-
* Overridden to avoid implementation dependency.
565+
* The writeObject method is called to save the state of the
566+
* {@code CompositeName} to a stream.
567+
*
566568
* @serialData The number of components (an {@code int}) followed by
567569
* the individual components (each a {@code String}).
570+
*
571+
* @param s the {@code ObjectOutputStream} to write to
572+
* @throws java.io.IOException if an I/O error occurs
568573
*/
574+
@java.io.Serial
569575
private void writeObject(java.io.ObjectOutputStream s)
570576
throws java.io.IOException {
577+
// Overridden to avoid implementation dependency
571578
s.writeInt(size());
572579
Enumeration<String> comps = getAll();
573580
while (comps.hasMoreElements()) {
@@ -576,10 +583,20 @@ private void writeObject(java.io.ObjectOutputStream s)
576583
}
577584

578585
/**
579-
* Overridden to avoid implementation dependency.
586+
* The readObject method is called to restore the state of
587+
* the {@code CompositeName} from a stream.
588+
*
589+
* See {@code writeObject} for a description of the serial form.
590+
*
591+
* @param s the {@code ObjectInputStream} to read from
592+
* @throws java.io.IOException if an I/O error occurs
593+
* @throws ClassNotFoundException if the class of a serialized object
594+
* could not be found
580595
*/
596+
@java.io.Serial
581597
private void readObject(java.io.ObjectInputStream s)
582598
throws java.io.IOException, ClassNotFoundException {
599+
// Overridden to avoid implementation dependency
583600
impl = new NameImpl(null); // null means use default syntax
584601
int n = s.readInt(); // number of components
585602
try {
@@ -594,6 +611,7 @@ private void readObject(java.io.ObjectInputStream s)
594611
/**
595612
* Use serialVersionUID from JNDI 1.1.1 for interoperability
596613
*/
614+
@java.io.Serial
597615
private static final long serialVersionUID = 1667768148915813118L;
598616

599617
/*

‎src/java.naming/share/classes/javax/naming/CompoundName.java

+21-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -547,13 +547,20 @@ public Object remove(int posn) throws InvalidNameException {
547547
}
548548

549549
/**
550-
* Overridden to avoid implementation dependency.
550+
* The writeObject method is called to save the state of the
551+
* {@code CompoundName} to a stream.
552+
*
551553
* @serialData The syntax {@code Properties}, followed by
552554
* the number of components (an {@code int}), and the individual
553555
* components (each a {@code String}).
556+
*
557+
* @param s the {@code ObjectOutputStream} to write to
558+
* @throws java.io.IOException if an I/O error occurs
554559
*/
560+
@java.io.Serial
555561
private void writeObject(java.io.ObjectOutputStream s)
556562
throws java.io.IOException {
563+
// Overridden to avoid implementation dependency
557564
s.writeObject(mySyntax);
558565
s.writeInt(size());
559566
Enumeration<String> comps = getAll();
@@ -563,10 +570,20 @@ private void writeObject(java.io.ObjectOutputStream s)
563570
}
564571

565572
/**
566-
* Overridden to avoid implementation dependency.
573+
* The readObject method is called to restore the state of
574+
* the {@code CompoundName} from a stream.
575+
*
576+
* See {@code writeObject} for a description of the serial form.
577+
*
578+
* @param s the {@code ObjectInputStream} to read from
579+
* @throws java.io.IOException if an I/O error occurs
580+
* @throws ClassNotFoundException if the class of a serialized object
581+
* could not be found
567582
*/
583+
@java.io.Serial
568584
private void readObject(java.io.ObjectInputStream s)
569585
throws java.io.IOException, ClassNotFoundException {
586+
// Overridden to avoid implementation dependency.
570587
mySyntax = (Properties)s.readObject();
571588
impl = new NameImpl(mySyntax);
572589
int n = s.readInt(); // number of components
@@ -582,6 +599,7 @@ private void readObject(java.io.ObjectInputStream s)
582599
/**
583600
* Use serialVersionUID from JNDI 1.1.1 for interoperability
584601
*/
602+
@java.io.Serial
585603
private static final long serialVersionUID = 3513100557083972036L;
586604

587605
/*

‎src/java.naming/share/classes/javax/naming/directory/BasicAttribute.java

+23-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
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.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -494,13 +494,20 @@ public DirContext getAttributeDefinition() throws NamingException {
494494
// ---- serialization methods
495495

496496
/**
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
500502
* individual values.
503+
*
504+
* @param s the {@code ObjectOutputStream} to write to
505+
* @throws java.io.IOException if an I/O error occurs
501506
*/
507+
@java.io.Serial
502508
private void writeObject(java.io.ObjectOutputStream s)
503509
throws java.io.IOException {
510+
// Overridden to avoid exposing implementation details
504511
s.defaultWriteObject(); // write out the attrID
505512
s.writeInt(values.size());
506513
for (int i = 0; i < values.size(); i++) {
@@ -509,10 +516,20 @@ private void writeObject(java.io.ObjectOutputStream s)
509516
}
510517

511518
/**
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
513528
*/
529+
@java.io.Serial
514530
private void readObject(java.io.ObjectInputStream s)
515531
throws java.io.IOException, ClassNotFoundException {
532+
// Overridden to avoid exposing implementation details.
516533
s.defaultReadObject(); // read in the attrID
517534
int n = s.readInt(); // number of values
518535
values = new Vector<>(Math.min(1024, n));
@@ -553,5 +570,6 @@ public void close() throws NamingException {
553570
/**
554571
* Use serialVersionUID from JNDI 1.1.1 for interoperability.
555572
*/
573+
@java.io.Serial
556574
private static final long serialVersionUID = 6743528196119291326L;
557575
}

‎src/java.naming/share/classes/javax/naming/directory/BasicAttributes.java

+23-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
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.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -279,13 +279,20 @@ public int hashCode() {
279279
}
280280

281281
/**
282-
* Overridden to avoid exposing implementation details.
283-
* @serialData Default field (ignoreCase flag -- a boolean), followed by
282+
* The writeObject method is called to save the state of the
283+
* {@code BasicAttributes} to a stream.
284+
*
285+
* @serialData Default field (ignoreCase flag - a {@code boolean}), followed by
284286
* the number of attributes in the set
285-
* (an int), and then the individual Attribute objects.
287+
* (an {@code int}), and then the individual {@code Attribute} objects.
288+
*
289+
* @param s the {@code ObjectOutputStream} to write to
290+
* @throws java.io.IOException if an I/O error occurs
286291
*/
292+
@java.io.Serial
287293
private void writeObject(java.io.ObjectOutputStream s)
288294
throws java.io.IOException {
295+
// Overridden to avoid exposing implementation details
289296
s.defaultWriteObject(); // write out the ignoreCase flag
290297
s.writeInt(attrs.size());
291298
Enumeration<Attribute> attrEnum = attrs.elements();
@@ -295,10 +302,20 @@ private void writeObject(java.io.ObjectOutputStream s)
295302
}
296303

297304
/**
298-
* Overridden to avoid exposing implementation details.
305+
* The readObject method is called to restore the state of
306+
* the {@code BasicAttributes} from a stream.
307+
*
308+
* See {@code writeObject} for a description of the serial form.
309+
*
310+
* @param s the {@code ObjectInputStream} to read from
311+
* @throws java.io.IOException if an I/O error occurs
312+
* @throws ClassNotFoundException if the class of a serialized object
313+
* could not be found
299314
*/
315+
@java.io.Serial
300316
private void readObject(java.io.ObjectInputStream s)
301317
throws java.io.IOException, ClassNotFoundException {
318+
// Overridden to avoid exposing implementation details.
302319
s.defaultReadObject(); // read in the ignoreCase flag
303320
int n = s.readInt(); // number of attributes
304321
attrs = (n >= 1)
@@ -374,5 +391,6 @@ public void close() throws NamingException {
374391
/**
375392
* Use serialVersionUID from JNDI 1.1.1 for interoperability.
376393
*/
394+
@java.io.Serial
377395
private static final long serialVersionUID = 4980164073184639448L;
378396
}

‎src/java.naming/share/classes/javax/naming/ldap/LdapName.java

+23-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -106,6 +106,8 @@ public class LdapName implements Name {
106106

107107
private transient List<Rdn> rdns; // parsed name components
108108
private transient String unparsed; // if non-null, the DN in unparsed form
109+
110+
@java.io.Serial
109111
private static final long serialVersionUID = -1595520034788997356L;
110112

111113
/**
@@ -755,17 +757,36 @@ public int hashCode() {
755757
}
756758

757759
/**
760+
* The writeObject method is called to save the state of the
761+
* {@code LdapName} to a stream.
762+
*
758763
* Serializes only the unparsed DN, for compactness and to avoid
759764
* any implementation dependency.
760765
*
761-
* @serialData The DN string
766+
* @serialData The DN {@code String} representation of this LDAP name.
767+
*
768+
* @param s the {@code ObjectOutputStream} to write to
769+
* @throws java.io.IOException if an I/O error occurs
762770
*/
771+
@java.io.Serial
763772
private void writeObject(ObjectOutputStream s)
764773
throws java.io.IOException {
765774
s.defaultWriteObject();
766775
s.writeObject(toString());
767776
}
768777

778+
/**
779+
* The readObject method is called to restore the state of
780+
* the {@code LdapName} from a stream.
781+
*
782+
* See {@code writeObject} for a description of the serial form.
783+
*
784+
* @param s the {@code ObjectInputStream} to read from
785+
* @throws java.io.IOException if an I/O error occurs
786+
* @throws ClassNotFoundException if the class of a serialized object
787+
* could not be found
788+
*/
789+
@java.io.Serial
769790
private void readObject(ObjectInputStream s)
770791
throws java.io.IOException, ClassNotFoundException {
771792
s.defaultReadObject();

‎src/java.naming/share/classes/javax/naming/ldap/Rdn.java

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -110,6 +110,7 @@ public class Rdn implements Serializable, Comparable<Object> {
110110
// The common case.
111111
private static final int DEFAULT_SIZE = 1;
112112

113+
@java.io.Serial
113114
private static final long serialVersionUID = -5994465067210009656L;
114115

115116
/**
@@ -732,17 +733,36 @@ private static boolean isWhitespace(char c) {
732733
}
733734

734735
/**
736+
* The writeObject method is called to save the state of the
737+
* {@code Rdn} to a stream.
738+
*
735739
* Serializes only the unparsed RDN, for compactness and to avoid
736740
* any implementation dependency.
737741
*
738-
* @serialData The RDN string
742+
* @serialData The unparsed RDN {@code String} representation.
743+
*
744+
* @param s the {@code ObjectOutputStream} to write to
745+
* @throws java.io.IOException if an I/O error occurs
739746
*/
747+
@java.io.Serial
740748
private void writeObject(ObjectOutputStream s)
741749
throws java.io.IOException {
742750
s.defaultWriteObject();
743751
s.writeObject(toString());
744752
}
745753

754+
/**
755+
* The readObject method is called to restore the state of
756+
* the {@code Rdn} from a stream.
757+
*
758+
* See {@code writeObject} for a description of the serial form.
759+
*
760+
* @param s the {@code ObjectInputStream} to read from
761+
* @throws IOException if an I/O error occurs
762+
* @throws ClassNotFoundException if the class of a serialized object
763+
* could not be found
764+
*/
765+
@java.io.Serial
746766
private void readObject(ObjectInputStream s)
747767
throws IOException, ClassNotFoundException {
748768
s.defaultReadObject();

‎src/java.naming/share/classes/javax/naming/spi/NamingManager.java

+4
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,10 @@ public static Context getContinuationContext(CannotProceedException cpe)
948948
return (answer != null) ? answer : obj;
949949
}
950950

951+
/**
952+
* Thrown when an error is encountered while loading and instantiating the
953+
* context factory classes.
954+
*/
951955
private static class FactoryInitializationError extends Error {
952956
@java.io.Serial
953957
static final long serialVersionUID = -5805552256848841560L;

0 commit comments

Comments
 (0)
Please sign in to comment.