jdk/src/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java
changeset 10596 39b3a979e600
parent 5506 202f599c92aa
child 16499 88276d2da9c0
equal deleted inserted replaced
10595:c5be3e19fbab 10596:39b3a979e600
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   219      * Returns the certificate chain the client sent to the
   219      * Returns the certificate chain the client sent to the
   220      * server, or null if the client did not authenticate.
   220      * server, or null if the client did not authenticate.
   221      */
   221      */
   222     public java.security.cert.Certificate[] getLocalCertificates() {
   222     public java.security.cert.Certificate[] getLocalCertificates() {
   223         if (cachedResponse != null) {
   223         if (cachedResponse != null) {
   224             List l = ((SecureCacheResponse)cachedResponse).getLocalCertificateChain();
   224             List<java.security.cert.Certificate> l = ((SecureCacheResponse)cachedResponse).getLocalCertificateChain();
   225             if (l == null) {
   225             if (l == null) {
   226                 return null;
   226                 return null;
   227             } else {
   227             } else {
   228                 return (java.security.cert.Certificate[])l.toArray();
   228                 return l.toArray(new java.security.cert.Certificate[0]);
   229             }
   229             }
   230         }
   230         }
   231         if (http == null) {
   231         if (http == null) {
   232             throw new IllegalStateException("connection not yet open");
   232             throw new IllegalStateException("connection not yet open");
   233         } else {
   233         } else {
   241      * the server did not authenticate.
   241      * the server did not authenticate.
   242      */
   242      */
   243     public java.security.cert.Certificate[] getServerCertificates()
   243     public java.security.cert.Certificate[] getServerCertificates()
   244             throws SSLPeerUnverifiedException {
   244             throws SSLPeerUnverifiedException {
   245         if (cachedResponse != null) {
   245         if (cachedResponse != null) {
   246             List l = ((SecureCacheResponse)cachedResponse).getServerCertificateChain();
   246             List<java.security.cert.Certificate> l = ((SecureCacheResponse)cachedResponse).getServerCertificateChain();
   247             if (l == null) {
   247             if (l == null) {
   248                 return null;
   248                 return null;
   249             } else {
   249             } else {
   250                 return (java.security.cert.Certificate[])l.toArray();
   250                 return l.toArray(new java.security.cert.Certificate[0]);
   251             }
   251             }
   252         }
   252         }
   253 
   253 
   254         if (http == null) {
   254         if (http == null) {
   255             throw new IllegalStateException("connection not yet open");
   255             throw new IllegalStateException("connection not yet open");