4337793: Mark non-serializable fields of java.security.cert.Certificate and CertPath

Reviewed-by: valeriep, rriggs
This commit is contained in:
Sean Mullan 2021-11-18 13:48:12 +00:00
parent b3a62b4881
commit a44b45fdf3
2 changed files with 29 additions and 22 deletions

View file

@ -66,10 +66,10 @@ public abstract class Certificate implements java.io.Serializable {
private static final long serialVersionUID = -3585440601605666277L;
/** The certificate type. */
private final String type;
private final transient String type;
/** The hash code for the certificate. */
private int hash = -1; // Default to -1
private transient int hash = -1; // Default to -1
/**
* Creates a certificate of the specified type.
@ -236,7 +236,7 @@ public abstract class Certificate implements java.io.Serializable {
public abstract PublicKey getPublicKey();
/**
* Alternate Certificate class for serialization.
* Alternate {@code Certificate} class for serialization.
* @since 1.3
*/
protected static class CertificateRep implements java.io.Serializable {
@ -251,12 +251,12 @@ public abstract class Certificate implements java.io.Serializable {
private byte[] data;
/**
* Construct the alternate Certificate class with the Certificate
* type and Certificate encoding bytes.
* Construct the alternate {@code Certificate} class with the
* {@code Certificate} type and {@code Certificate} encoding bytes.
*
* @param type the standard name of the Certificate type.
* @param type the standard name of the {@code Certificate} type.
*
* @param data the Certificate data.
* @param data the {@code Certificate} data.
*/
protected CertificateRep(String type, byte[] data) {
this.type = type;
@ -264,11 +264,12 @@ public abstract class Certificate implements java.io.Serializable {
}
/**
* Resolve the Certificate Object.
* Returns a {@code Certificate} with the type and data of this
* {@code CertificateRep}.
*
* @return the resolved Certificate Object
* @return the resolved {@code Certificate} object
*
* @throws java.io.ObjectStreamException if the Certificate
* @throws java.io.ObjectStreamException if the {@code Certificate}
* could not be resolved
*/
@java.io.Serial
@ -288,12 +289,15 @@ public abstract class Certificate implements java.io.Serializable {
}
/**
* Replace the Certificate to be serialized.
* Replace the {@code Certificate} to be serialized with a
* {@link CertificateRep CertificateRep} object containing the type and
* encoded bytes of the {@code Certificate}.
*
* @return the alternate Certificate object to be serialized
* @return a {@code CertificateRep} object containing the type and encoded
* bytes of the {@code Certificate}
*
* @throws java.io.ObjectStreamException if a new object representing
* this Certificate could not be created
* @throws java.io.ObjectStreamException if a {@code CertificateRep} object
* representing this {@code Certificate} could not be created
* @since 1.3
*/
@java.io.Serial