This commit is contained in:
Henry Jen 2019-10-14 21:01:25 +00:00
commit 8d141f1048
561 changed files with 10985 additions and 8895 deletions

View file

@ -49,6 +49,7 @@ class NegotiateAuthentication extends AuthenticationInfo {
private static final long serialVersionUID = 100L;
private static final PlatformLogger logger = HttpURLConnection.getHttpLogger();
@SuppressWarnings("serial") // Not statically typed as Serializable
private final HttpCallerInfo hci;
// These maps are used to manage the GSS availability for diffrent
@ -67,6 +68,7 @@ class NegotiateAuthentication extends AuthenticationInfo {
}
// The HTTP Negotiate Helper
@SuppressWarnings("serial") // Not statically typed as Serializable
private Negotiator negotiator = null;
/**

View file

@ -875,6 +875,11 @@ class DatagramChannelImpl
if (state == ST_CONNECTED)
throw new AlreadyConnectedException();
// ensure that the socket is bound
if (localAddress == null) {
bindInternal(null);
}
int n = Net.connect(family,
fd,
isa.getAddress(),
@ -932,8 +937,21 @@ class DatagramChannelImpl
remoteAddress = null;
state = ST_UNCONNECTED;
// refresh local address
localAddress = Net.localAddress(fd);
// check whether rebind is needed
InetSocketAddress isa = Net.localAddress(fd);
if (isa.getPort() == 0) {
// On Linux, if bound to ephemeral port,
// disconnect does not preserve that port.
// In this case, try to rebind to the previous port.
int port = localAddress.getPort();
localAddress = isa; // in case Net.bind fails
Net.bind(family, fd, isa.getAddress(), port);
isa = Net.localAddress(fd); // refresh address
assert isa.getPort() == port;
}
// refresh localAddress
localAddress = isa;
}
} finally {
writeLock.unlock();

View file

@ -208,7 +208,8 @@ public abstract class SelectorImpl
if (!(ch instanceof SelChImpl))
throw new IllegalSelectorException();
SelectionKeyImpl k = new SelectionKeyImpl((SelChImpl)ch, this);
k.attach(attachment);
if (attachment != null)
k.attach(attachment);
// register (if needed) before adding to key set
implRegister(k);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,9 @@ package sun.nio.cs;
/*
* FastPath byte[]->char[] decoder, REPLACE on malformed or
* unmappable input.
*
* FastPath encoded byte[]-> "String Latin1 coding" byte[] decoder for use when
* charset is always decodable to the internal String Latin1 coding byte[], ie. all mappings <=0xff
*/
public interface ArrayDecoder {
@ -36,4 +39,14 @@ public interface ArrayDecoder {
default boolean isASCIICompatible() {
return false;
}
// Is always decodable to internal String Latin1 coding, ie. all mappings <= 0xff
default boolean isLatin1Decodable() {
return false;
}
// Decode to internal String Latin1 coding byte[] fastpath for when isLatin1Decodable == true
default int decodeToLatin1(byte[] src, int sp, int len, byte[] dst) {
return 0;
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -50,17 +50,27 @@ public class SingleByte
implements ArrayDecoder {
private final char[] b2c;
private final boolean isASCIICompatible;
private final boolean isLatin1Decodable;
public Decoder(Charset cs, char[] b2c) {
super(cs, 1.0f, 1.0f);
this.b2c = b2c;
this.isASCIICompatible = false;
this.isLatin1Decodable = false;
}
public Decoder(Charset cs, char[] b2c, boolean isASCIICompatible) {
super(cs, 1.0f, 1.0f);
this.b2c = b2c;
this.isASCIICompatible = isASCIICompatible;
this.isLatin1Decodable = false;
}
public Decoder(Charset cs, char[] b2c, boolean isASCIICompatible, boolean isLatin1Decodable) {
super(cs, 1.0f, 1.0f);
this.b2c = b2c;
this.isASCIICompatible = isASCIICompatible;
this.isLatin1Decodable = isLatin1Decodable;
}
private CoderResult decodeArrayLoop(ByteBuffer src, CharBuffer dst) {
@ -124,6 +134,18 @@ public class SingleByte
repl = newReplacement.charAt(0);
}
@Override
public int decodeToLatin1(byte[] src, int sp, int len, byte[] dst) {
if (len > dst.length)
len = dst.length;
int dp = 0;
while (dp < len) {
dst[dp++] = (byte)decode(src[sp++]);
}
return dp;
}
@Override
public int decode(byte[] src, int sp, int len, char[] dst) {
if (len > dst.length)
@ -143,6 +165,11 @@ public class SingleByte
public boolean isASCIICompatible() {
return isASCIICompatible;
}
@Override
public boolean isLatin1Decodable() {
return isLatin1Decodable;
}
}
public static final class Encoder extends CharsetEncoder

View file

@ -44,6 +44,7 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
@java.io.Serial
private static final long serialVersionUID = 6182022883658399397L;
private final Class<? extends Annotation> type;
@SuppressWarnings("serial") // Not statically typed as Serializable
private final Map<String, Object> memberValues;
AnnotationInvocationHandler(Class<? extends Annotation> type, Map<String, Object> memberValues) {

View file

@ -36,7 +36,8 @@ import java.lang.reflect.Method;
class AnnotationTypeMismatchExceptionProxy extends ExceptionProxy {
@java.io.Serial
private static final long serialVersionUID = 7844069490309503934L;
private Method member;
@SuppressWarnings("serial") // Not statically typed as Serializable
private Method member; // Would be more robust to null-out in a writeObject method.
private final String foundType;
/**

View file

@ -50,7 +50,11 @@ public class TlsKeyMaterialSpec implements KeySpec, SecretKey {
private final SecretKey clientMacKey, serverMacKey;
private final SecretKey clientCipherKey, serverCipherKey;
private final IvParameterSpec clientIv, serverIv;
@SuppressWarnings("serial") // Not statically typed as Serializable
private final IvParameterSpec clientIv;
@SuppressWarnings("serial") // Not statically typed as Serializable
private final IvParameterSpec serverIv;
/**
* Constructs a new TlsKeymaterialSpec from the client and server MAC

View file

@ -1315,7 +1315,9 @@ public class PolicyParser {
private static final long serialVersionUID = -4330692689482574072L;
private String i18nMessage;
@SuppressWarnings("serial") // Not statically typed as Serializable
private LocalizedMessage localizedMsg;
@SuppressWarnings("serial") // Not statically typed as Serializable
private Object[] source;
/**

View file

@ -54,6 +54,7 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
private static final Class<?>[] PARAMS = { String.class };
private static final sun.security.util.Debug debug =
sun.security.util.Debug.getInstance("auth", "\t[Auth Access]");
@SuppressWarnings("serial") // Not statically typed as Serializable
private ClassLoader sysClassLoader;
/**

View file

@ -69,6 +69,7 @@ public class X509CertPath extends CertPath {
/**
* List of certificates in this chain
*/
@SuppressWarnings("serial") // Not statically typed as Serializable
private List<X509Certificate> certs;
/**

View file

@ -70,6 +70,7 @@ public final class RSAPrivateCrtKeyImpl
// Optional parameters associated with this RSA key
// specified in the encoding of its AlgorithmId.
// Must be null for "RSA" keys.
@SuppressWarnings("serial") // Not statically typed as Serializable
private AlgorithmParameterSpec keyParams;
/**

View file

@ -61,6 +61,7 @@ public final class RSAPrivateKeyImpl extends PKCS8Key implements RSAPrivateKey {
// optional parameters associated with this RSA key
// specified in the encoding of its AlgorithmId.
// must be null for "RSA" keys.
@SuppressWarnings("serial") // Not statically typed as Serializable
private final AlgorithmParameterSpec keyParams;
/**

View file

@ -62,6 +62,7 @@ public final class RSAPublicKeyImpl extends X509Key implements RSAPublicKey {
// optional parameters associated with this RSA key
// specified in the encoding of its AlgorithmId
// must be null for "RSA" keys.
@SuppressWarnings("serial") // Not statically typed as Serializable
private AlgorithmParameterSpec keyParams;
/**

View file

@ -98,6 +98,7 @@ class ObjectIdentifier implements Serializable
* Changed to Object
* @serial
*/
@SuppressWarnings("serial") // Not statically typed as Serializable
private Object components = null; // path from root
/**
* @serial

View file

@ -62,6 +62,7 @@ public class ValidatorException extends CertificateException {
public static final Object T_UNTRUSTED_CERT =
"Untrusted certificate";
@SuppressWarnings("serial") // Not statically typed as Serializable
private Object type;
private X509Certificate cert;

View file

@ -72,6 +72,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
private ObjectIdentifier algid;
// The (parsed) parameters
@SuppressWarnings("serial") // Not statically typed as Serializable
private AlgorithmParameters algParams;
private boolean constructedFromDer = true;
@ -80,6 +81,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
* DER-encoded form; subclasses can be made to automaticaly parse
* them so there is fast access to these parameters.
*/
@SuppressWarnings("serial") // Not statically typed as Serializable
protected DerValue params;

View file

@ -70,6 +70,7 @@ import sun.security.provider.X509Factory;
* @author Hemma Prafullchandra
* @see X509CertInfo
*/
@SuppressWarnings("serial") // See writeReplace method in Certificate
public class X509CertImpl extends X509Certificate implements DerEncoder {
@java.io.Serial

View file

@ -84,7 +84,7 @@ public class X509Key implements PublicKey {
private int unusedBits = 0;
/* BitArray form of key */
private BitArray bitStringKey = null;
private transient BitArray bitStringKey = null;
/* The encoding for the key. */
protected byte[] encodedKey;