# HG changeset patch # User xuelei # Date 1376963376 25200 # Node ID 89544f16aa6b0c63b188325d3ad7d21419ccd0f3 # Parent c4414bc886022fe1820495333f33f48c422a77c0 8023230: The impl of KerberosClientKeyExchange maybe not exist Reviewed-by: weijun diff -r c4414bc88602 -r 89544f16aa6b jdk/src/share/classes/sun/security/ssl/KerberosClientKeyExchange.java --- a/jdk/src/share/classes/sun/security/ssl/KerberosClientKeyExchange.java Mon Aug 19 17:42:39 2013 -0700 +++ b/jdk/src/share/classes/sun/security/ssl/KerberosClientKeyExchange.java Mon Aug 19 18:49:36 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, 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 @@ -57,7 +57,8 @@ private final KerberosClientKeyExchange impl = createImpl(); private KerberosClientKeyExchange createImpl() { - if (getClass() == KerberosClientKeyExchange.class) { + if (implClass != null && + getClass() == KerberosClientKeyExchange.class) { try { return (KerberosClientKeyExchange)implClass.newInstance(); } catch (InstantiationException e) { @@ -69,8 +70,11 @@ return null; } - public KerberosClientKeyExchange() { - // empty + // This constructor will be called when constructing an instance of its + // subclass -- KerberosClientKeyExchangeImpl. Please won't check the + // value of impl variable in this constructor. + protected KerberosClientKeyExchange() { + // please won't check the value of impl variable } public KerberosClientKeyExchange(String serverName, boolean isLoopback, @@ -85,8 +89,9 @@ } public KerberosClientKeyExchange(ProtocolVersion protocolVersion, - ProtocolVersion clientVersion, SecureRandom rand, - HandshakeInStream input, AccessControlContext acc, Object serverKeys) throws IOException { + ProtocolVersion clientVersion, SecureRandom rand, + HandshakeInStream input, AccessControlContext acc, + Object serverKeys) throws IOException { if (impl != null) { init(protocolVersion, clientVersion, rand, input, acc, serverKeys); @@ -101,7 +106,7 @@ } @Override - public int messageLength() { + public int messageLength() { return impl.messageLength(); } @@ -125,11 +130,13 @@ } public void init(ProtocolVersion protocolVersion, - ProtocolVersion clientVersion, SecureRandom rand, - HandshakeInStream input, AccessControlContext acc, Object ServiceCreds) throws IOException { + ProtocolVersion clientVersion, SecureRandom rand, + HandshakeInStream input, AccessControlContext acc, + Object ServiceCreds) throws IOException { if (impl != null) { - impl.init(protocolVersion, clientVersion, rand, input, acc, ServiceCreds); + impl.init(protocolVersion, clientVersion, + rand, input, acc, ServiceCreds); } }